aboutsummaryrefslogtreecommitdiff
path: root/src/test/java
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2023-06-25 15:30:42 +0100
committerMichael Williamson <mike@zwobble.org>2023-06-25 15:30:42 +0100
commit9a60f58e4ba7889f87561945fa474adfcdbd46a5 (patch)
tree7b81ce9421fa48d30c5d87f1f2d2d2d6358b5c2d /src/test/java
parent5d987fd53baf2dd6632cc6db8d7acea7633f6780 (diff)
Support data symbols in WASM binary format
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/org/shedlang/compiler/backends/wasm/structure/WasmBinaryFormatModuleTests.java28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/test/java/org/shedlang/compiler/backends/wasm/structure/WasmBinaryFormatModuleTests.java b/src/test/java/org/shedlang/compiler/backends/wasm/structure/WasmBinaryFormatModuleTests.java
index 1979dee8..8f36def5 100644
--- a/src/test/java/org/shedlang/compiler/backends/wasm/structure/WasmBinaryFormatModuleTests.java
+++ b/src/test/java/org/shedlang/compiler/backends/wasm/structure/WasmBinaryFormatModuleTests.java
@@ -5,6 +5,8 @@ import org.junit.jupiter.api.extension.ExtendWith;
import org.shedlang.compiler.backends.wasm.structure.ast.instructions.WasmExpression;
import org.shedlang.compiler.backends.wasm.structure.ast.instructions.WasmI32Const;
import org.shedlang.compiler.backends.wasm.structure.ast.instructions.WasmI64Const;
+import org.shedlang.compiler.backends.wasm.structure.ast.linking.WasmDataSegmentIndex;
+import org.shedlang.compiler.backends.wasm.structure.ast.linking.WasmDataSymbol;
import org.shedlang.compiler.backends.wasm.structure.ast.linking.WasmInitFunc;
import org.shedlang.compiler.backends.wasm.structure.ast.modules.*;
import org.shedlang.compiler.backends.wasm.structure.ast.types.*;
@@ -278,13 +280,35 @@ public class WasmBinaryFormatModuleTests {
".data",
new byte[] { 1, 2, 3, 4 },
new WasmExpression(List.of(new WasmI32Const(0))),
- WasmAlignment.ALIGN_32_BIT
+ WasmAlignment.ALIGN_32_BIT,
+ List.of(
+ new WasmDataSymbol(
+ "data1",
+ new WasmDataSegmentIndex(0),
+ 0,
+ 2
+ ),
+ new WasmDataSymbol(
+ "data2",
+ new WasmDataSegmentIndex(0),
+ 2,
+ 2
+ )
+ )
))
.addDataSegment(new WasmDataSegment(
".rodata",
new byte[] { 4, 5, 6, 7 },
new WasmExpression(List.of(new WasmI32Const(4))),
- WasmAlignment.NONE
+ WasmAlignment.NONE,
+ List.of(
+ new WasmDataSymbol(
+ "rodata1",
+ new WasmDataSegmentIndex(1),
+ 0,
+ 4
+ )
+ )
));
var result = serializeModule(module);