@@ -187,120 +187,125 @@ def run_string_input(name: str, inputs: List[str], output: str, function: str) -
187
187
188
188
runtime_file_prefix = "../../test/CodeGen/EVM/runtime_tests/"
189
189
190
- file_input_fixtures = OrderedDict ({
190
+ simple_tests = OrderedDict ({
191
191
"simple_test_1" : {
192
- "file" : "simple_test_1.ll" ,
192
+ "file" : "simple_tests/ simple_test_1.ll" ,
193
193
"input" : [],
194
194
"output" : "0x0000000000000000000000000000000000000000000000000000000000000001" ,
195
195
},
196
196
"simple_test_2" : {
197
- "file" : "simple_test_2.ll" ,
197
+ "file" : "simple_tests/ simple_test_2.ll" ,
198
198
"input" : ["0x12345678" , "0x87654321" ],
199
199
"output" : "0x0000000000000000000000000000000000000000000000000000000099999999" ,
200
200
},
201
201
"simple_test_3" : {
202
- "file" : "simple_test_3.ll" ,
202
+ "file" : "simple_tests/ simple_test_3.ll" ,
203
203
"input" : [],
204
204
"output" : "0x" ,
205
205
},
206
206
"simple_test_4" : {
207
- "file" : "simple_test_4.ll" ,
207
+ "file" : "simple_tests/ simple_test_4.ll" ,
208
208
"input" : ["0x12345678" ],
209
209
"output" : "0x" ,
210
210
},
211
211
"simple_test_5.ll" : {
212
- "file" : "simple_test_5.ll" ,
212
+ "file" : "simple_tests/ simple_test_5.ll" ,
213
213
"input" : ["0x12345678" ],
214
214
"output" : "0x0000000000000000000000000000000000000000000000000000000012345679" ,
215
215
},
216
216
"simple_test_6" : {
217
- "file" : "simple_test_6.ll" ,
217
+ "file" : "simple_tests/ simple_test_6.ll" ,
218
218
"input" : ["0x12345678" , "0x87654321" ],
219
219
"output" : "0x0000000000000000000000000000000000000000000000000000000012345678" ,
220
220
},
221
221
"simple_test_7" : {
222
- "file" : "simple_test_7.ll" ,
222
+ "file" : "simple_tests/ simple_test_7.ll" ,
223
223
"input" : ["0x12345678" , "0x87654321" ],
224
224
"output" : "0x0000000000000000000000000000000000000000000000000000000087654321" ,
225
225
},
226
226
"simple_test_8.ll" : {
227
- "file" : "simple_test_8.ll" ,
227
+ "file" : "simple_tests/ simple_test_8.ll" ,
228
228
"input" : ["0x12345678" , "0x87654321" ],
229
229
"output" : "0x0000000000000000000000000000000000000000000000000000000012345678" ,
230
230
},
231
231
})
232
232
233
233
loop_tests = OrderedDict ({
234
234
"loop1" : {
235
- "file" : "loop.ll" ,
235
+ "file" : "loops/ loop.ll" ,
236
236
"input" : ["0x00001000" , "0x00000001" ],
237
237
"output" : "0x000000000000000000000000000000000000000000000000000000000000100a" ,
238
238
},
239
239
"loop2" : {
240
- "file" : "loop2.ll" ,
240
+ "file" : "loops/ loop2.ll" ,
241
241
"input" : ["0x00001000" , "0x0000000a" ],
242
242
"output" : "0x000000000000000000000000000000000000000000000000000000000000100a"
243
243
},
244
244
"loop3" : {
245
- "file" : "loop2.ll" ,
245
+ "file" : "loops/ loop2.ll" ,
246
246
"input" : ["0x0000000a" , "0x00001000" ],
247
247
"output" : "0x000000000000000000000000000000000000000000000000000000000000100a"
248
248
},
249
249
})
250
250
251
251
setcc_tests = OrderedDict ({
252
252
"setcc_eq1" : {
253
- "file" : "setcc_eq.ll" ,
253
+ "file" : "setcc/ setcc_eq.ll" ,
254
254
"input" : ["0xff00ff00" , "0x00ff00ff" ],
255
255
"output" : "0x0000000000000000000000000000000000000000000000000000000000000001" ,
256
256
},
257
257
"setcc_ne1" : {
258
- "file" : "setcc_ne.ll" ,
258
+ "file" : "setcc/ setcc_ne.ll" ,
259
259
"input" : ["0xff00ff01" , "0x00ff00ff" ],
260
260
"output" : "0x0000000000000000000000000000000000000000000000000000000000000001" ,
261
261
},
262
262
"setcc_ule" : {
263
- "file" : "setcc_ule.ll" ,
263
+ "file" : "setcc/ setcc_ule.ll" ,
264
264
"input" : ["0xff00ff00" , "0x00ff01ff" ],
265
265
"output" : "0x0000000000000000000000000000000000000000000000000000000000000000" ,
266
266
},
267
267
"setcc_uge" : {
268
- "file" : "setcc_uge.ll" ,
268
+ "file" : "setcc/ setcc_uge.ll" ,
269
269
"input" : ["0xff00ff00" , "0x00ff00ff" ],
270
270
"output" : "0x0000000000000000000000000000000000000000000000000000000000000001" ,
271
271
},
272
272
"cmp1" : {
273
- "file" : "cmp.ll" ,
273
+ "file" : "setcc/ cmp.ll" ,
274
274
"input" : ["0x00001234" , "0x00004321" ],
275
275
"output" : "0x0000000000000000000000000000000000000000000000000000000000021908" ,
276
276
},
277
277
"cmp2" : {
278
- "file" : "cmp.ll" ,
278
+ "file" : "setcc/ cmp.ll" ,
279
279
"input" : ["0x00004321" , "0x00001234" ],
280
280
"output" : "0x0000000000000000000000000000000000000000000000000000000004c5f4b4" ,
281
281
},
282
+ })
283
+
284
+ fib_tests = OrderedDict ({
282
285
"fibonacci 1" : {
283
- "file" : "fib.ll" ,
286
+ "file" : "fib/fib .ll" ,
284
287
"input" : ["0x00000001" ],
285
288
"output" : "0x0000000000000000000000000000000000000000000000000000000000000001" ,
286
289
},
287
290
"fibonacci 2" : {
288
- "file" : "fib.ll" ,
291
+ "file" : "fib/fib .ll" ,
289
292
"input" : ["0x00000002" ],
290
293
"output" : "0x0000000000000000000000000000000000000000000000000000000000000002" ,
291
294
},
292
295
"fibonacci 3" : {
293
- "file" : "fib.ll" ,
296
+ "file" : "fib/fib .ll" ,
294
297
"input" : ["0x00000003" ],
295
298
"output" : "0x0000000000000000000000000000000000000000000000000000000000000003" ,
296
299
},
297
300
"fibonacci 10" : {
298
- "file" : "fib.ll" ,
301
+ "file" : "fib/fib .ll" ,
299
302
"input" : ["0x0000000a" ],
300
303
"output" : "0x0000000000000000000000000000000000000000000000000000000000000059" ,
301
304
},
302
305
})
303
306
307
+ test_suite = [simple_tests , setcc_tests , loop_tests , fib_tests ]
308
+
304
309
def run_testset (testset ) -> List [str ]:
305
310
failed_tests = []
306
311
for key ,val in testset .items ():
@@ -316,9 +321,8 @@ def run_testset(testset) -> List[str]:
316
321
317
322
def assembly_tests () -> List [str ]:
318
323
failed_tests = []
319
- failed_tests += run_testset (file_input_fixtures )
320
- failed_tests += run_testset (setcc_tests )
321
- failed_tests += run_testset (loop_tests )
324
+ for tests in test_suite :
325
+ failed_tests += run_testset (tests )
322
326
return failed_tests
323
327
324
328
def print_failed (tests : List [str ]) -> None :
0 commit comments