summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Number/prototype/toPrecision/tointeger-precision.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/Number/prototype/toPrecision/tointeger-precision.js')
-rw-r--r--js/src/tests/test262/built-ins/Number/prototype/toPrecision/tointeger-precision.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Number/prototype/toPrecision/tointeger-precision.js b/js/src/tests/test262/built-ins/Number/prototype/toPrecision/tointeger-precision.js
new file mode 100644
index 0000000000..90599f6589
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Number/prototype/toPrecision/tointeger-precision.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2016 The V8 Project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-number.prototype.toprecision
+description: >
+ ToInteger(precision) operations
+info: |
+ Number.prototype.toPrecision ( precision )
+
+ [...]
+ 3. Let p be ? ToInteger(precision).
+ [...]
+---*/
+
+assert.sameValue((123.456).toPrecision(1.1), "1e+2", "1.1");
+assert.sameValue((123.456).toPrecision(1.9), "1e+2", "1.9");
+
+assert.sameValue((123.456).toPrecision(true), "1e+2", "true");
+
+assert.sameValue((123.456).toPrecision("2"), "1.2e+2", "string");
+
+assert.sameValue((123.456).toPrecision([2]), "1.2e+2", "[2]");
+
+reportCompare(0, 0);