Debian Codegraph @

js/src/tests/test262/language/expressions/less-than/S11.8.1_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.1_A4.12_T1
10 description: x and y are string primitives
11 ---*/
12
13 //CHECK#1
14 if (("xx" < "xy") !== true) {
15 throw new Test262Error('#1: ("xx" < "xy") === true');
16 }
17
18 //CHECK#2
19 if (("xy" < "xx") !== false) {
20 throw new Test262Error('#2: ("xy" < "xx") === false');
21 }
22
23 //CHECK#3
24 if (("x" < "y") !== true) {
25 throw new Test262Error('#3: ("x" < y") === true');
26 }
27
28 //CHECK#4
29 if (("aab" < "aba") !== true) {
30 throw new Test262Error('#4: ("aab" < aba") === true');
31 }
32
33 //CHECK#5
34 if (("\u0061\u0061\u0061\u0062" < "\u0061\u0061\u0061\u0061") !== false) {
35 throw new Test262Error('#5: ("\\u0061\\u0061\\u0061\\u0062" < \\u0061\\u0061\\u0061\\u0061") === false');
36 }
37
38 //CHECK#6
39 if (("a\u0000a" < "a\u0000b") !== true) {
40 throw new Test262Error('#6: ("a\\u0000a" < "a\\u0000b") === true');
41 }
42
43 //CHECK#7
44 if (("aB" < "aa") !== true) {
45 throw new Test262Error('#7: ("aB" < aa") === true');
46 }
47
48 //CHECK#8
49 if (("\uD7FF" < "\u{10000}") !== true) {
50 throw new Test262Error('#8: ("\\uD7FF" < "\\u{10000}") === true');
51 }
52
53 //CHECK#9
54 if (("\uD800" < "\uDC00") !== true) {
55 throw new Test262Error('#9: ("\\uD800" < "\\uDC00") === 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") !== true) {
62 throw new Test262Error('#10: ("\\u{10000}" < "\\uFFFF") === true');
63 }
64
65 //CHECK#11
66 if (("\u{10000}" < "\u{12345}") !== true) {
67 throw new Test262Error('#11: ("\\u{10000}" < "\\u{12345}") === true');
68 }
69
70 reportCompare(0, 0);