-
Notifications
You must be signed in to change notification settings - Fork 120
/
Copy pathconst-eval-failed.spec.ts
260 lines (257 loc) · 12.7 KB
/
const-eval-failed.spec.ts
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
import { itShouldNotCompile } from "./util";
describe("fail-const-eval", () => {
itShouldNotCompile({
testName: "const-eval-div-by-zero",
errorMessage:
"Cannot evaluate expression to a constant: divisor expression must be non-zero",
});
itShouldNotCompile({
testName: "const-eval-mod-by-zero",
errorMessage:
"Cannot evaluate expression to a constant: divisor expression must be non-zero",
});
itShouldNotCompile({
testName: "const-eval-int-overflow-positive-literal",
errorMessage:
"Cannot evaluate expression to a constant: integer '115792089237316195423570985008687907853269984665640564039457584007913129639936' does not fit into TVM Int type",
});
itShouldNotCompile({
testName: "const-eval-int-overflow-negative-literal",
errorMessage:
"Cannot evaluate expression to a constant: integer '-115792089237316195423570985008687907853269984665640564039457584007913129639937' does not fit into TVM Int type",
});
itShouldNotCompile({
testName: "const-eval-int-overflow-add",
errorMessage:
"Cannot evaluate expression to a constant: integer '115792089237316195423570985008687907853269984665640564039457584007913129639936' does not fit into TVM Int type",
});
itShouldNotCompile({
testName: "const-eval-int-overflow-sub",
errorMessage:
"Cannot evaluate expression to a constant: integer '-115792089237316195423570985008687907853269984665640564039457584007913129639937' does not fit into TVM Int type",
});
itShouldNotCompile({
testName: "const-eval-int-overflow-mul1",
errorMessage:
"Cannot evaluate expression to a constant: integer '231584178474632390847141970017375815706539969331281128078915168015826259279870' does not fit into TVM Int type",
});
itShouldNotCompile({
testName: "const-eval-int-overflow-mul2",
errorMessage:
"Cannot evaluate expression to a constant: integer '-231584178474632390847141970017375815706539969331281128078915168015826259279872' does not fit into TVM Int type",
});
itShouldNotCompile({
testName: "const-eval-int-overflow-div",
errorMessage:
"Cannot evaluate expression to a constant: integer '115792089237316195423570985008687907853269984665640564039457584007913129639936' does not fit into TVM Int type",
});
itShouldNotCompile({
testName: "const-eval-int-overflow-ton1",
errorMessage: `Cannot evaluate expression to a constant: invalid "ton" argument`,
});
itShouldNotCompile({
testName: "const-eval-int-overflow-ton2",
errorMessage:
"Cannot evaluate expression to a constant: integer '115792089237316195423570985008687907853269984665640564039457584007913129639936' does not fit into TVM Int type",
});
itShouldNotCompile({
testName: "const-eval-int-overflow-pow-1",
errorMessage: `"pow" builtin called with negative exponent -42`,
});
itShouldNotCompile({
testName: "const-eval-int-overflow-pow-2",
errorMessage:
"Cannot evaluate expression to a constant: integer '115792089237316195423570985008687907853269984665640564039457584007913129639936' does not fit into TVM Int type",
});
itShouldNotCompile({
testName: "const-eval-int-overflow-pow2-1",
errorMessage: `"pow2" builtin called with negative exponent -42`,
});
itShouldNotCompile({
testName: "const-eval-int-overflow-pow2-2",
errorMessage:
"Cannot evaluate expression to a constant: integer '115792089237316195423570985008687907853269984665640564039457584007913129639936' does not fit into TVM Int type",
});
itShouldNotCompile({
testName: "const-eval-int-overflow-shl1",
errorMessage:
"Cannot evaluate expression to a constant: integer '115792089237316195423570985008687907853269984665640564039457584007913129639936' does not fit into TVM Int type",
});
itShouldNotCompile({
testName: "const-eval-int-overflow-shl2",
errorMessage:
"Cannot evaluate expression to a constant: integer '-13407807929942597099574024998205846127479365820592393377723561443721764030073546976801874298166903427690031858186486050853753882811946569946433649006084096' does not fit into TVM Int type",
});
itShouldNotCompile({
testName: "const-eval-int-overflow-struct-instance",
errorMessage:
"Cannot evaluate expression to a constant: integer '115792089237316195423570985008687907853269984665640564039457584007913129639936' does not fit into TVM Int type",
});
itShouldNotCompile({
testName: "const-eval-shl-invalid-bits1",
errorMessage:
"the number of bits shifted ('257') must be within [0..256] range",
});
itShouldNotCompile({
testName: "const-eval-shl-invalid-bits2",
errorMessage:
"the number of bits shifted ('-1') must be within [0..256] range",
});
itShouldNotCompile({
testName: "const-eval-unboxing-null",
errorMessage: "non-null value expected but got null",
});
itShouldNotCompile({
testName: "const-eval-invalid-address",
errorMessage:
"Cannot evaluate expression to a constant: invalid address encoding: FQCD39VS5jcptHL8vMjEXrzGaRcCVYto7HUn4bpAOg8xqB2N",
});
itShouldNotCompile({
testName: "const-eval-div-by-zero-in-fun",
errorMessage:
"Cannot evaluate expression to a constant: divisor expression must be non-zero",
});
itShouldNotCompile({
testName: "const-eval-int-overflow-add-in-fun",
errorMessage:
"Cannot evaluate expression to a constant: integer '115792089237316195423570985008687907853269984665640564039457584007913129639936' does not fit into TVM Int type",
});
itShouldNotCompile({
testName: "const-eval-int-overflow-div-in-fun",
errorMessage:
"Cannot evaluate expression to a constant: integer '115792089237316195423570985008687907853269984665640564039457584007913129639936' does not fit into TVM Int type",
});
itShouldNotCompile({
testName: "const-eval-int-overflow-mul1-in-fun",
errorMessage:
"Cannot evaluate expression to a constant: integer '231584178474632390847141970017375815706539969331281128078915168015826259279870' does not fit into TVM Int type",
});
itShouldNotCompile({
testName: "const-eval-int-overflow-mul2-in-fun",
errorMessage:
"Cannot evaluate expression to a constant: integer '-231584178474632390847141970017375815706539969331281128078915168015826259279872' does not fit into TVM Int type",
});
itShouldNotCompile({
testName: "const-eval-int-overflow-positive-literal-in-fun",
errorMessage:
"Cannot evaluate expression to a constant: integer '115792089237316195423570985008687907853269984665640564039457584007913129639936' does not fit into TVM Int type",
});
itShouldNotCompile({
testName: "const-eval-int-overflow-negative-literal-in-fun",
errorMessage:
"Cannot evaluate expression to a constant: integer '-115792089237316195423570985008687907853269984665640564039457584007913129639937' does not fit into TVM Int type",
});
itShouldNotCompile({
testName: "const-eval-int-overflow-struct-instance-in-fun",
errorMessage:
"Cannot evaluate expression to a constant: integer '115792089237316195423570985008687907853269984665640564039457584007913129639936' does not fit into TVM Int type",
});
itShouldNotCompile({
testName: "const-eval-repeat-lower-bound",
errorMessage:
"Cannot evaluate expression to a constant: integer '-115792089237316195423570985008687907853269984665640564039457584007913129639937' does not fit into TVM Int type",
});
itShouldNotCompile({
testName: "const-eval-repeat-upper-bound",
errorMessage:
"Cannot evaluate expression to a constant: repeat argument '2147483648' must be a number between -2^256 (inclusive) and 2^31 - 1 (inclusive)",
});
itShouldNotCompile({
testName: "const-eval-ascii-overflow",
errorMessage:
"Cannot evaluate expression to a constant: ascii string is too long, expected up to 32 bytes, got 33",
});
itShouldNotCompile({
testName: "const-eval-ascii-overflow-2",
errorMessage:
"Cannot evaluate expression to a constant: ascii string is too long, expected up to 32 bytes, got 33",
});
itShouldNotCompile({
testName: "const-eval-rawslice-not-hex",
errorMessage:
"Cannot evaluate expression to a constant: invalid hex string: hello world",
});
itShouldNotCompile({
testName: "const-eval-rawslice-overflow",
errorMessage:
"Cannot evaluate expression to a constant: slice constant is too long, expected up to 1023 bits, got 1024",
});
itShouldNotCompile({
testName: "const-eval-rawslice-overflow-padded",
errorMessage:
"Cannot evaluate expression to a constant: slice constant is too long, expected up to 1023 bits, got 1024",
});
itShouldNotCompile({
testName: "const-eval-rawslice-invalid",
errorMessage:
"Cannot evaluate expression to a constant: invalid hex string: 4a__",
});
itShouldNotCompile({
testName: "const-eval-ascii-empty",
errorMessage:
"Cannot evaluate expression to a constant: ascii string cannot be empty",
});
itShouldNotCompile({
testName: "const-eval-constant-circular-dependency",
errorMessage:
"Cannot evaluate expression to a constant: cannot evaluate C as it has circular dependencies: [C -> A -> C]",
});
itShouldNotCompile({
testName: "const-eval-constant-deep-circular-dependency",
errorMessage:
"Cannot evaluate expression to a constant: cannot evaluate E as it has circular dependencies: [E -> D -> C -> B -> A -> E]",
});
itShouldNotCompile({
testName: "const-eval-constant-circular-dependency-with-function",
errorMessage:
"Cannot evaluate expression to a constant: cannot evaluate C as it has circular dependencies: [C -> A -> foo() -> C]",
});
itShouldNotCompile({
testName: "const-eval-constant-circular-dependency-with-functions",
errorMessage:
"Cannot evaluate expression to a constant: cannot evaluate C as it has circular dependencies: [C -> A -> foo() -> bar() -> baz() -> C]",
});
itShouldNotCompile({
testName:
"const-eval-constant-circular-dependency-with-recursive-function",
errorMessage:
"Cannot evaluate expression to a constant: cannot evaluate C as it has circular dependencies: [C -> A -> foo() -> foo() -> foo() -> C]",
});
itShouldNotCompile({
testName:
"const-eval-constant-circular-dependency-with-deep-recursive-function",
errorMessage:
"Cannot evaluate expression to a constant: cannot evaluate C as it has circular dependencies: [C -> A -> foo() -> foo() -> foo() -> ... -> foo() -> foo() -> foo() -> foo() -> C]",
});
itShouldNotCompile({
testName: "const-eval-constant-circular-dependency-self-assignment",
errorMessage:
"Cannot evaluate expression to a constant: cannot evaluate A as it has circular dependencies: [A -> A]",
});
itShouldNotCompile({
testName: "const-eval-self-constant-circular-dependency",
errorMessage:
"Cannot evaluate expression to a constant: cannot evaluate self.C as it has circular dependencies: [self.C -> self.A -> self.C]",
});
itShouldNotCompile({
testName: "const-eval-self-constant-deep-circular-dependency",
errorMessage:
"Cannot evaluate expression to a constant: cannot evaluate self.E as it has circular dependencies: [self.E -> self.D -> self.C -> self.B -> self.A -> self.E]",
});
itShouldNotCompile({
testName:
"const-eval-self-constant-circular-dependency-self-assignment",
errorMessage:
"Cannot evaluate expression to a constant: cannot evaluate self.A as it has circular dependencies: [self.A -> self.A]",
});
itShouldNotCompile({
testName: "const-eval-self-constant-assign-field",
errorMessage:
"Cannot evaluate expression to a constant: cannot evaluate non-constant self field access",
});
itShouldNotCompile({
testName: "const-eval-self-constant-with-method-call-in-value",
errorMessage:
'Cannot evaluate expression to a constant: calls of "test" are not supported at this moment',
});
});