From adadf82937836a7e0a80c51e34b049021a1ce60f Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Tue, 26 Dec 2023 22:33:37 +0000 Subject: Add test for i32.add instruction --- .../binary/WasmBinaryFormatInstructionsTests.java | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/test/java') diff --git a/src/test/java/org/shedlang/compiler/backends/wasm/structure/binary/WasmBinaryFormatInstructionsTests.java b/src/test/java/org/shedlang/compiler/backends/wasm/structure/binary/WasmBinaryFormatInstructionsTests.java index fd2c6f1e..c7c39691 100644 --- a/src/test/java/org/shedlang/compiler/backends/wasm/structure/binary/WasmBinaryFormatInstructionsTests.java +++ b/src/test/java/org/shedlang/compiler/backends/wasm/structure/binary/WasmBinaryFormatInstructionsTests.java @@ -18,6 +18,27 @@ public class WasmBinaryFormatInstructionsTests { // == Numeric Instructions == + @Test + public void canSerializeI32Add(Snapshotter snapshotter) throws IOException, InterruptedException { + var module = WasmModule.EMPTY + .addFunction(new WasmFunction( + "f", + List.of(), + List.of(), + List.of(), + new WasmExpression(List.of( + new WasmI32Const(0), + new WasmI32Const(0), + new WasmI32Add(), + new WasmDrop() + )) + )); + + var result = serializeModuleWasm32(module); + + snapshotter.assertSnapshot(result); + } + @Test public void canSerializeI64Add(Snapshotter snapshotter) throws IOException, InterruptedException { var module = WasmModule.EMPTY -- cgit v1.2.3