feature: add comprehensive WASM test suite (374 tests)

Add a full test framework and 123 test files covering infrastructure,
parser sections, and VM opcodes. All 374 tests pass; exit code reflects
failure count for CI/CD integration.

Test framework (wasm.test.framework):
- Assert helpers: assert_true, assert_i32/i64/u32/u64/f32/f64/bool
- Context builders: make_test_context, setup_test_locals, setup_test_globals
- Global counters: TotalTests, PassedTests, FailedTests

Test runner (wasm.test, WASURO.lpr):
- Master runner calls all 108 test units and prints summary
- halt(FailedTests) returns exit code for pipeline consumption
- Gated behind {$IFDEF RUN_TESTS} / build.bat test

Infrastructure tests (3 units):
- Stack push/pop for i32, i64, f32, f64
- Heap read/write across all widths (8/16/32/64-bit)
- LEB128 unsigned/signed encoding/decoding

Parser tests (8 units):
- type, function, export, code, global, memory, start, data sections

Opcode tests (97 units, ~374 assertions):
- Control: nop, unreachable, drop, select, return
- Variables: local.get/set/tee, global.get/set
- Constants: i32/i64/f32/f64.const
- I32: all arithmetic, bitwise, and comparison ops (29 units)
- I64: all arithmetic, bitwise, and comparison ops (29 units)
- F32/F64: all comparison ops (12 units)
- Memory loads: i32/i64/f32/f64.load + sign/zero-extending variants (14 units)
- Memory stores: i32/i64/f32/f64.store + narrowing variants (9 units)
This commit is contained in:
t3hn3rd committed 2026-02-24 00:34:49 +00:00
1 parent 3361286352
commit dc67262477
123 files changed
+5666 -1

No files matched your search

+12 -1
View File
@@ -10,12 +10,22 @@ uses
wasm.types,
wasm.parser,
wasm.vm, wasm.test.binary,
wasm.types.stack;
wasm.types.stack
{$IFDEF RUN_TESTS}
, wasm.test
, wasm.test.framework
{$ENDIF}
;
var
Context : PWASMProcessContext;
begin
{$IFDEF RUN_TESTS}
wasm.vm.init();
wasm.test.run_all_tests;
halt(wasm.test.framework.FailedTests);
{$ELSE}
writestringln('[main] Initializing VM');
wasm.vm.init();
@@ -32,5 +42,6 @@ begin
end;
writeln();
while true do sleep(1000);
{$ENDIF}
end.