| 1 |
// Copyright 2009 the Sputnik authors. All rights reserved. |
| 2 |
// This code is governed by the BSD license found in the LICENSE file. |
| 3 |
|
| 4 |
/*--- |
| 5 |
info: | |
| 6 |
Return the string consisting of the single digit of s, |
| 7 |
followed by lowercase character 'e', followed by a plus sign '+' or minus |
| 8 |
sign '-' according to whether n-1 is positive or negative, followed by the |
| 9 |
decimal representation of the integer abs(n-1) (with no leading zeros) |
| 10 |
es5id: 9.8.1_A9_T1 |
| 11 |
description: Various big numbers convert to String by explicit transformation |
| 12 |
---*/ |
| 13 |
|
| 14 |
// CHECK#1 |
| 15 |
if (String(1000000000000000000000) !== "1e+21") { |
| 16 |
throw new Test262Error('#1: String(1000000000000000000000) === "1e+21". Actual: ' + (String(1000000000000000000000))); |
| 17 |
} |
| 18 |
|
| 19 |
// CHECK#2 |
| 20 |
if (String(10000000000000000000000) !== "1e+22") { |
| 21 |
throw new Test262Error('#2: String(10000000000000000000000) === "1e+22". Actual: ' + (String(10000000000000000000000))); |
| 22 |
} |
| 23 |
|
| 24 |
// CHECK#3 |
| 25 |
if (String(1e21) !== "1e+21") { |
| 26 |
throw new Test262Error('#3: String(1e21) === "1e+21". Actual: ' + (String(1e21))); |
| 27 |
} |
| 28 |
|
| 29 |
// CHECK#4 |
| 30 |
if (String(1.0e22) !== "1e+22") { |
| 31 |
throw new Test262Error('#4: String(1.0e22) === "1e+22". Actual: ' + (String(1.0e22))); |
| 32 |
} |
| 33 |
|
| 34 |
// CHECK#5 |
| 35 |
if (String(1E21) !== "1e+21") { |
| 36 |
throw new Test262Error('#5: String(1E21) === "1e+21". Actual: ' + (String(1E21))); |
| 37 |
} |
| 38 |
|
| 39 |
// CHECK#6 |
| 40 |
if (String(1.0E22) !== "1e+22") { |
| 41 |
throw new Test262Error('#6: String(1.0E22) === "1e+22". Actual: ' + (String(1.0E22))); |
| 42 |
} |
| 43 |
|
| 44 |
// CHECK#7 |
| 45 |
if (String(-1000000000000000000000) !== "-1e+21") { |
| 46 |
throw new Test262Error('#7: String(-1000000000000000000000) === "-1e+21". Actual: ' + (String(-1000000000000000000000))); |
| 47 |
} |
| 48 |
|
| 49 |
// CHECK#8 |
| 50 |
if (String(-10000000000000000000000) !== "-1e+22") { |
| 51 |
throw new Test262Error('#8: String(-10000000000000000000000) === "-1e+22". Actual: ' + (String(-10000000000000000000000))); |
| 52 |
} |
| 53 |
|
| 54 |
// CHECK#9 |
| 55 |
if (String(-1e21) !== "-1e+21") { |
| 56 |
throw new Test262Error('#9: String(-1e21) === "-1e+21". Actual: ' + (String(-1e21))); |
| 57 |
} |
| 58 |
|
| 59 |
// CHECK#10 |
| 60 |
if (String(-1.0e22) !== "-1e+22") { |
| 61 |
throw new Test262Error('#10: String(-1.0e22) === "-1e+22". Actual: ' + (String(-1.0e22))); |
| 62 |
} |
| 63 |
|
| 64 |
// CHECK#11 |
| 65 |
if (String(-1E21) !== "-1e+21") { |
| 66 |
throw new Test262Error('#11: String(-1E21) === "-1e+21". Actual: ' + (String(-1E21))); |
| 67 |
} |
| 68 |
|
| 69 |
// CHECK#12 |
| 70 |
if (String(-1.0E22) !== "-1e+22") { |
| 71 |
throw new Test262Error('#12: String(-1.0E22) === "-1e+22". Actual: ' + (String(-1.0E22))); |
| 72 |
} |
| 73 |
|
| 74 |
reportCompare(0, 0); |