-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_conditions.lang
143 lines (131 loc) · 5.46 KB
/
test_conditions.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
lang.name = Lang Tests (Conditions)
lang.version = v1.0.0
lang.test = 1
# Preparation
$void = func.randChoice()
fp.null = null
fp.empty = () -> {
}
fp.anonymGen = () -> return () -> return
fp.ret = ($a) -> return $a
&null = null
&empty = func.arrayOf()
$errNoErr = $LANG_ERROR_NO_ERROR
$errErr = $LANG_ERROR_DIV_BY_ZERO
&EmptyStructDef = {
}
&emptyStructIns = fn.structOf(&EmptyStructDef)
# Tests
fn.testUnit(Conditions)
{
fn.testSubUnit(Data type [False])
fn.testAssertStrictEquals(parser.con(), $void)
fn.testAssertStrictEquals(parser.con(\!), $void)
fn.testAssertStrictEquals(parser.con(\!\!), $void)
fn.testAssertStrictEquals(parser.con(\e), 0)
fn.testAssertStrictEquals(parser.con({{{}}}), 0)
fn.testAssertStrictEquals(parser.con(""""""), 0)
fn.testAssertStrictEquals(parser.con(""), 0)
fn.testAssertStrictEquals(parser.con(\0), 0)
fn.testAssertStrictEquals(parser.con(0), 0)
fn.testAssertStrictEquals(parser.con(+0), 0)
fn.testAssertStrictEquals(parser.con(-0), 0)
fn.testAssertStrictEquals(parser.con(0L), 0)
fn.testAssertStrictEquals(parser.con(0.f), 0)
fn.testAssertStrictEquals(parser.con(+0.f), 0)
fn.testAssertStrictEquals(parser.con(-0.f), 0)
fn.testAssertStrictEquals(parser.con(0.), 0)
fn.testAssertStrictEquals(parser.con(+0.), 0)
fn.testAssertStrictEquals(parser.con(-0.), 0)
fn.testAssertStrictEquals(parser.con(&empty), 0)
fn.testAssertStrictEquals(parser.con(func.arrayCreate(0)), 0)
fn.testAssertStrictEquals(parser.con(&null), 0)
fn.testAssertStrictEquals(parser.con(fp.null), 0)
fn.testAssertStrictEquals(parser.con(fp.ret(0)), 0)
fn.testAssertStrictEquals(parser.con(null), 0)
fn.testAssertStrictEquals(parser.con($void), 0)
fn.testAssertStrictEquals(parser.con($errNoErr), 0)
fn.testAssertStrictEquals(parser.con(&EmptyStructDef), 0)
fn.testAssertStrictEquals(parser.con(&emptyStructIns), 0)
}
{
fn.testSubUnit(Data type [True, TEXT])
fn.testAssertStrictEquals(parser.con({{{a}}}), 1)
fn.testAssertStrictEquals(parser.con({{{-}}}), 1)
fn.testAssertStrictEquals(parser.con({{{\}}}), 1)
fn.testAssertStrictEquals(parser.con({{{0}}}), 1)
fn.testAssertStrictEquals(parser.con(text), 1)
fn.testAssertStrictEquals(parser.con(0.0.0), 1)
fn.testAssertStrictEquals(parser.con(ABCDEF), 1)
}
{
fn.testSubUnit(Data type [True, CHAR])
fn.testAssertStrictEquals(parser.con(\t), 1)
fn.testAssertStrictEquals(parser.con(\s), 1)
fn.testAssertStrictEquals(parser.con(\,), 1)
fn.testAssertStrictEquals(parser.con(\\), 1)
fn.testAssertStrictEquals(parser.con(@), 1)
fn.testAssertStrictEquals(parser.con(x), 1)
fn.testAssertStrictEquals(parser.con(µ), 1)
fn.testAssertStrictEquals(parser.con(\$), 1)
}
{
fn.testSubUnit(Data type [True, INT])
fn.testAssertStrictEquals(parser.con(1), 1)
fn.testAssertStrictEquals(parser.con(42), 1)
fn.testAssertStrictEquals(parser.con(-1), 1)
fn.testAssertStrictEquals(parser.con(-42), 1)
}
{
fn.testSubUnit(Data type [True, LONG])
fn.testAssertStrictEquals(parser.con(1L), 1)
fn.testAssertStrictEquals(parser.con(42L), 1)
fn.testAssertStrictEquals(parser.con(9223372036854775), 1)
fn.testAssertStrictEquals(parser.con(-1L), 1)
fn.testAssertStrictEquals(parser.con(-42L), 1)
fn.testAssertStrictEquals(parser.con(-9223372036854775), 1)
}
{
fn.testSubUnit(Data type [True, FLOAT])
fn.testAssertStrictEquals(parser.con(.0000001f), 1)
fn.testAssertStrictEquals(parser.con(.1f), 1)
fn.testAssertStrictEquals(parser.con(1.f), 1)
fn.testAssertStrictEquals(parser.con(42.f), 1)
fn.testAssertStrictEquals(parser.con(20000000000000000000000000000000f), 1)
fn.testAssertStrictEquals(parser.con(-.0000001f), 1)
fn.testAssertStrictEquals(parser.con(-.1f), 1)
fn.testAssertStrictEquals(parser.con(-1.f), 1)
fn.testAssertStrictEquals(parser.con(-42.f), 1)
fn.testAssertStrictEquals(parser.con(-20000000000000000000000000000000f), 1)
}
{
fn.testSubUnit(Data type [True, DOUBLE])
fn.testAssertStrictEquals(parser.con(.0000001), 1)
fn.testAssertStrictEquals(parser.con(.1), 1)
fn.testAssertStrictEquals(parser.con(1.), 1)
fn.testAssertStrictEquals(parser.con(42.), 1)
fn.testAssertStrictEquals(parser.con(20000000000000000000000000000000000000000), 1)
fn.testAssertStrictEquals(parser.con(-0000001d), 1)
fn.testAssertStrictEquals(parser.con(-.1), 1)
fn.testAssertStrictEquals(parser.con(-1.), 1)
fn.testAssertStrictEquals(parser.con(-42.), 1)
fn.testAssertStrictEquals(parser.con(-20000000000000000000000000000000000000000), 1)
}
{
fn.testSubUnit(Data type [True, ARRAY])
fn.testAssertStrictEquals(parser.con(func.arrayOf(null)), 1)
fn.testAssertStrictEquals(parser.con(func.arrayOf($void)), 1)
fn.testAssertStrictEquals(parser.con(func.arrayOf(null, null)), 1)
fn.testAssertStrictEquals(parser.con(func.arrayOf(1, 2, 3)), 1)
fn.testAssertStrictEquals(parser.con(func.arrayOf(abcdef, a)), 1)
fn.testAssertStrictEquals(parser.con(func.arrayCreate(1)), 1)
fn.testAssertStrictEquals(parser.con(func.arrayCreate(2)), 1)
fn.testAssertStrictEquals(parser.con(func.arrayCreate(42)), 1)
}
{
fn.testSubUnit(Data type [True, FUNCTION POINTER])
fn.testAssertStrictEquals(parser.con(fp.empty), 1)
fn.testAssertStrictEquals(parser.con(fp.anonymGen()), 1)
fn.testAssertStrictEquals(parser.con(fp.ret(1)), 1)
fn.testAssertStrictEquals(parser.con(fp.ret(42)), 1)
}