-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_texts.lang
159 lines (149 loc) · 7.79 KB
/
test_texts.lang
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
lang.name = Lang Tests (Texts)
lang.version = v1.0.0
lang.test = 1
# Preparation
$void = func.randChoice()
$var = test1
$varabc = test2
# Tests
fn.testUnit(Texts)
{
fn.testSubUnit(Escape sequences [Without forced node split])
fn.testAssertStrictEquals(\0, func.toChar(0))
fn.testAssertStrictEquals(\n, func.toChar(10))
fn.testAssertStrictEquals(\r, func.toChar(13))
fn.testAssertStrictEquals(\f, func.toChar(12))
fn.testAssertStrictEquals(\s, func.toChar(32))
fn.testAssertStrictEquals(\e, )
fn.testAssertStrictEquals(\b, func.toChar(8))
fn.testAssertStrictEquals(\t, func.toChar(9))
fn.testAssertStrictEquals(\$, func.toChar(36))
fn.testAssertStrictEquals(\&, func.toChar(38))
fn.testAssertStrictEquals(\#, func.toChar(35))
fn.testAssertStrictEquals(\,, func.toChar(44))
fn.testAssertStrictEquals(\(, func.toChar(40))
fn.testAssertStrictEquals(\), func.toChar(41))
fn.testAssertStrictEquals(\{, func.toChar(123))
fn.testAssertStrictEquals(\}, func.toChar(125))
fn.testAssertStrictEquals(\=, func.toChar(61))
fn.testAssertStrictEquals(\<, func.toChar(60))
fn.testAssertStrictEquals(\>, func.toChar(62))
fn.testAssertStrictEquals(\\, func.toChar(92))
}
{
fn.testSubUnit(Escape sequences [Other characters])
lang.errorOutput = -1 # Temporary disable warnings
fn.testAssertStrictEquals(\", func.toChar(34))
fn.testAssertStrictEquals(\%, func.toChar(37))
fn.testAssertStrictEquals(\', func.toChar(39))
fn.testAssertStrictEquals(\*, func.toChar(42))
fn.testAssertStrictEquals(\+, func.toChar(43))
fn.testAssertStrictEquals(\-, func.toChar(45))
fn.testAssertStrictEquals(\., func.toChar(46))
fn.testAssertStrictEquals(\/, func.toChar(47))
fn.testAssertStrictEquals(\1, func.toChar(49))
fn.testAssertStrictEquals(\2, func.toChar(50))
fn.testAssertStrictEquals(\5, func.toChar(53))
fn.testAssertStrictEquals(\8, func.toChar(56))
fn.testAssertStrictEquals(\9, func.toChar(57))
fn.testAssertStrictEquals(\:, func.toChar(58))
fn.testAssertStrictEquals(\;, func.toChar(59))
fn.testAssertStrictEquals(\?, func.toChar(63))
fn.testAssertStrictEquals(\@, func.toChar(64))
fn.testAssertStrictEquals(\A, func.toChar(65))
fn.testAssertStrictEquals(\B, func.toChar(66))
fn.testAssertStrictEquals(\M, func.toChar(77))
fn.testAssertStrictEquals(\N, func.toChar(78))
fn.testAssertStrictEquals(\Y, func.toChar(89))
fn.testAssertStrictEquals(\Z, func.toChar(90))
fn.testAssertStrictEquals(\`, func.toChar(96))
fn.testAssertStrictEquals(\a, func.toChar(97))
fn.testAssertStrictEquals(\c, func.toChar(99))
fn.testAssertStrictEquals(\m, func.toChar(109))
fn.testAssertStrictEquals(\o, func.toChar(111))
fn.testAssertStrictEquals(\y, func.toChar(121))
fn.testAssertStrictEquals(\z, func.toChar(122))
fn.testAssertStrictEquals(\|, func.toChar(124))
fn.testAssertStrictEquals(\~, func.toChar(126))
lang.errorOutput = 1 # Re-enable warnings
}
{
fn.testSubUnit(Escape sequences [Forced node split])
fn.testAssertStrictEquals(\!, $void)
fn.testAssertStrictEquals(4\!2, {{{42}}})
fn.testAssertStrictEquals(4\!.2, {{{40.2}}})
fn.testAssertStrictEquals(4\!.\!2, {{{4.2}}})
fn.testAssertStrictEquals($var, test1)
fn.testAssertStrictEquals($var\!abc, test1abc)
fn.testAssertStrictEquals($varabc, test2)
fn.testAssertStrictEquals(func.addi(1, 2), 3)
fn.testAssertStrictEquals(func\!.addi(1, 2), {{{func.addi(1, 2)}}})
fn.testAssertStrictEquals($\!var, {{{$var}}})
fn.testAssertStrictNotEquals(4\!.2, 4.2)
fn.testAssertStrictNotEquals(4\!2, 42)
fn.testAssertStrictNotEquals(4\!.\!2, 4.2)
fn.testAssertStrictEquals(nu\!ll, {{{null}}})
fn.testAssertStrictEquals(n\!ull, {{{null}}})
fn.testAssertStrictEquals(nul\!l, {{{null}}})
fn.testAssertNotNull(nu\!ll)
fn.testAssertNotNull(n\!ull)
fn.testAssertNotNull(nul\!l)
fn.testAssertNull(\!null)
fn.testAssertNull(null\!)
}
{
fn.testSubUnit(UTF-32 character support)
fn.testAssertStrictEquals(fn.toChar(372847387823), �)
fn.testAssertStrictEquals(fn.toChar(128579), 🙃, "parser must treat input string with a single UTF-8 code point which \
is to small to fit into 2 bytes as an UTF-32 char value")
fn.testAssertStrictEquals(fn.toChar(128579), fn.ttoc(🙃), "String with a single UTF-8 code point which \
is to small to fit into 2 bytes as an UTF-32 char value")
parser.op(fn.testAssertStrictEquals(@"🙃", 1))
parser.op(fn.testAssertStrictEquals(@"🙃 - test", 8))
parser.op(fn.testAssertStrictEquals(@"test - 🙃", 8))
parser.op(fn.testAssertStrictEquals(@"test - 🙃 - abc - 🙃 - 123", 24))
parser.op(fn.testAssertStrictEquals(charsOf("🙃"), [🙃]))
parser.op(fn.testAssertStrictEquals(charsOf("🙃 - test"), [🙃, \s, \-, \s, t, e, s, t]))
fn.testAssertStrictEquals(fn.indexOf("test - 🙃 - abc - 🙃 - 123", "🙃"), 7)
fn.testAssertStrictEquals(fn.indexOf("test - 🙃 - abc - 🙃 - 123", "🙃", 6), 7)
fn.testAssertStrictEquals(fn.indexOf("test - 🙃 - abc - 🙃 - 123", "🙃", 7), 7)
fn.testAssertStrictEquals(fn.indexOf("test - 🙃 - abc - 🙃 - 123", "🙃", 8), 17)
fn.testAssertStrictEquals(fn.indexOf("test - 🙃 - abc - 🙃 - 123", "🙃", 9), 17)
fn.testAssertStrictEquals(fn.indexOf("test - 🙃 - abc - 🙃 - 123", "🙃", 10), 17)
fn.testAssertStrictEquals(fn.indexOf("test - 🙃 - abc - 🙃 - 123", "🙃", 15), 17)
fn.testAssertStrictEquals(fn.indexOf("test - 🙃 - abc - 🙃 - 123", "🙃", 16), 17)
fn.testAssertStrictEquals(fn.indexOf("test - 🙃 - abc - 🙃 - 123", "🙃", 17), 17)
fn.testAssertStrictEquals(fn.indexOf("test - 🙃 - abc - 🙃 - 123", "🙃", 18), -1)
fn.testAssertStrictEquals(fn.indexOf("test - 🙃 - abc - 🙃 - 123", "🙃", 19), -1)
fn.testAssertStrictEquals(fn.lastIndexOf("test - 🙃 - abc - 🙃 - 123", "🙃"), 17)
fn.testAssertStrictEquals(fn.lastIndexOf("test - 🙃 - abc - 🙃 - 123", "🙃", 6), -1)
fn.testAssertStrictEquals(fn.lastIndexOf("test - 🙃 - abc - 🙃 - 123", "🙃", 7), 7)
fn.testAssertStrictEquals(fn.lastIndexOf("test - 🙃 - abc - 🙃 - 123", "🙃", 8), 7)
fn.testAssertStrictEquals(fn.lastIndexOf("test - 🙃 - abc - 🙃 - 123", "🙃", 9), 7)
fn.testAssertStrictEquals(fn.lastIndexOf("test - 🙃 - abc - 🙃 - 123", "🙃", 10), 7)
fn.testAssertStrictEquals(fn.lastIndexOf("test - 🙃 - abc - 🙃 - 123", "🙃", 15), 7)
fn.testAssertStrictEquals(fn.lastIndexOf("test - 🙃 - abc - 🙃 - 123", "🙃", 16), 7)
fn.testAssertStrictEquals(fn.lastIndexOf("test - 🙃 - abc - 🙃 - 123", "🙃", 17), 17)
fn.testAssertStrictEquals(fn.lastIndexOf("test - 🙃 - abc - 🙃 - 123", "🙃", 18), 17)
fn.testAssertStrictEquals(fn.lastIndexOf("test - 🙃 - abc - 🙃 - 123", "🙃", 19), 17)
parser.op(fn.testAssertStrictEquals(join(" - 🙃 - ", [1, "🙃", "x"]), "1 - 🙃 - 🙃 - 🙃 - x"))
parser.op(fn.testAssertStrictEquals(-|🙃, 🙂))
parser.op(fn.testAssertStrictEquals(+|🙃, 🙄))
fn.testAssertStrictEquals($LANG_TYPE_INT(🙃), 128579)
fn.testAssertStrictEquals(\u{a}, \n)
fn.testAssertStrictEquals(\u{A}, \n)
fn.testAssertStrictEquals(\u{4a}, J)
fn.testAssertStrictEquals(\u{4A}, J)
fn.testAssertStrictEquals(\u{e4}, ä)
fn.testAssertStrictEquals(\u{E4}, ä)
fn.testAssertStrictEquals(\u{3b3}, γ)
fn.testAssertStrictEquals(\u{3B3}, γ)
fn.testAssertStrictEquals(\u{20ac}, €)
fn.testAssertStrictEquals(\u{20AC}, €)
fn.testAssertStrictEquals(\u{1f643}, 🙃)
fn.testAssertStrictEquals(\u{1F643}, 🙃)
fn.testAssertStrictEquals(\u{10AAAA}, )
fn.testAssertStrictEquals(\u{10AAAA}, )
fn.testAssertStrictEquals(\u{21f643}, �)
fn.testAssertStrictEquals(\u{21F643}, �)
}