Debian Codegraph @

js/src/tests/test262/built-ins/String/S9.8.1_A6.js

raw
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 If 1 <= s < 1e21 or -1e21 s < -1, return the string
7 consisting of the k digits of the decimal representation of s (in order,
8 with no leading zeroes), followed by n-k occurrences of the character '0'
9 es5id: 9.8.1_A6
10 description: >
11 Various integer numbers convert to String by explicit
12 transformation
13 ---*/
14
15 // CHECK#1
16 if (String(1) !== "1") {
17 throw new Test262Error('#1: String(1) === "1". Actual: ' + (String(1)));
18 }
19
20 // CHECK#2
21 if (String(10) !== "10") {
22 throw new Test262Error('#2: String(10) === "10". Actual: ' + (String(10)));
23 }
24
25 // CHECK#3
26 if (String(100) !== "100") {
27 throw new Test262Error('#3: String(100) === "100". Actual: ' + (String(100)));
28 }
29
30 // CHECK#4
31 if (String(100000000000000000000) !== "100000000000000000000") {
32 throw new Test262Error('#4: String(100000000000000000000) === "100000000000000000000". Actual: ' + (String(100000000000000000000)));
33 }
34
35 // CHECK#5
36 if (String(1e20) !== "100000000000000000000") {
37 throw new Test262Error('#5: String(1e20) === "100000000000000000000". Actual: ' + (String(1e20)));
38 }
39
40 // CHECK#6
41 if (String(12345) !== "12345") {
42 throw new Test262Error('#6: String(12345) === "12345". Actual: ' + (String(12345)));
43 }
44
45 // CHECK#7
46 if (String(12345000) !== "12345000") {
47 throw new Test262Error('#7: String(12345000) === "12345000". Actual: ' + (String(12345000)));
48 }
49
50 // CHECK#8
51 if (String(-1) !== "-1") {
52 throw new Test262Error('#8: String(-1) === "-1". Actual: ' + (String(-1)));
53 }
54
55 // CHECK#9
56 if (String(-10) !== "-10") {
57 throw new Test262Error('#9: String(-10) === "-10". Actual: ' + (String(-10)));
58 }
59
60 // CHECK#10
61 if (String(-100) !== "-100") {
62 throw new Test262Error('#3: String(-100) === "-100". Actual: ' + (String(-100)));
63 }
64
65 // CHECK#10
66 if (String(-100000000000000000000) !== "-100000000000000000000") {
67 throw new Test262Error('#10: String(-100000000000000000000) === "-100000000000000000000". Actual: ' + (String(-100000000000000000000)));
68 }
69
70 // CHECK#11
71 if (String(-1e20) !== "-100000000000000000000") {
72 throw new Test262Error('#11: String(-1e20) === "-100000000000000000000". Actual: ' + (String(-1e20)));
73 }
74
75 // CHECK#12
76 if (String(-12345) !== "-12345") {
77 throw new Test262Error('#12: String(-12345) === "-12345". Actual: ' + (String(-12345)));
78 }
79
80 // CHECK#13
81 if (String(-12345000) !== "-12345000") {
82 throw new Test262Error('#13: String(-12345000) === "-12345000". Actual: ' + (String(-12345000)));
83 }
84
85 // CHECK#14
86 if (String(1E20) !== "100000000000000000000") {
87 throw new Test262Error('#14: String(1E20) === "100000000000000000000". Actual: ' + (String(1E20)));
88 }
89
90 // CHECK#15
91 if (String(-1E20) !== "-100000000000000000000") {
92 throw new Test262Error('#15: String(-1E20) === "-100000000000000000000". Actual: ' + (String(-1E20)));
93 }
94
95 reportCompare(0, 0);