aboutsummaryrefslogtreecommitdiff
path: root/src/test/java
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2023-12-26 22:33:37 +0000
committerMichael Williamson <mike@zwobble.org>2023-12-26 22:33:37 +0000
commitadadf82937836a7e0a80c51e34b049021a1ce60f (patch)
treefd45e75713fcb7bc8fb069f715f32351a1cacdfb /src/test/java
parent1f3ff130fb4ed927aaa6ffa5e30eb7a4df575d6e (diff)
Add test for i32.add instruction
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/org/shedlang/compiler/backends/wasm/structure/binary/WasmBinaryFormatInstructionsTests.java21
1 files changed, 21 insertions, 0 deletions
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
@@ -19,6 +19,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
.addFunction(new WasmFunction(