Debian Codegraph @

js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.12_T1.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 neither x, nor y is a prefix of each other, returned result of strings
7 comparison applies a simple lexicographic ordering to the sequences of
8 code unit value values
9 es5id: 11.8.2_A4.12_T1
10 description: x and y are string primitives
11 ---*/
12
13 //CHECK#1
14 if (("xy" > "xx") !== true) {
15 throw new Test262Error('#1: ("xy" > "xx") === true');
16 }
17
18 //CHECK#2
19 if (("xx" > "xy") !== false) {
20 throw new Test262Error('#2: ("xx" > "xy") === false');
21 }
22
23 //CHECK#3
24 if (("y" > "x") !== true) {
25 throw new Test262Error('#3: ("y" > "x") === true');
26 }
27
28 //CHECK#4
29 if (("aba" > "aab") !== true) {
30 throw new Test262Error('#4: ("aba" > aab") === true');
31 }
32
33 //CHECK#5
34 if (("\u0061\u0061\u0061\u0061" > "\u0061\u0061\u0061\u0062") !== false) {
35 throw new Test262Error('#5: ("\\u0061\\u0061\\u0061\\u0061" > \\u0061\\u0061\\u0061\\u0062") === false');
36 }
37
38 //CHECK#6
39 if (("a\u0000b" > "a\u0000a") !== true) {
40 throw new Test262Error('#6: ("a\\u0000b" > "a\\u0000a") === true');
41 }
42
43 //CHECK#7
44 if (("aa" > "aB") !== true) {
45 throw new Test262Error('#7: ("aa" > aB") === true');
46 }
47
48 //CHECK#8
49 if (("\u{10000}" > "\uD7FF") !== true) {
50 throw new Test262Error('#8: ("\\u{10000}" > "\\uD7FF") === true');
51 }
52
53 //CHECK#9
54 if (("\uDC00" > "\uD800") !== true) {
55 throw new Test262Error('#9: ("\\uDC00" > "\\uD800") === true');
56 }
57
58 //CHECK#10
59 // String comparison is done by code units, rather than by code points.
60 // "\u{10000}" is equivalent to "\uD800\uDC00"
61 if (("\u{10000}" > "\uFFFF") !== false) {
62 throw new Test262Error('#10: ("\\u{10000}" > "\\uFFFF") === false');
63 }
64
65 //CHECK#11
66 if (("\u{12345}" > "\u{10000}") !== true) {
67 throw new Test262Error('#11: ("\\u{12345}" > "\\u{10000}") === true');
68 }
69
70 reportCompare(0, 0);