aboutsummaryrefslogtreecommitdiff
path: root/src/test/java
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2023-07-23 22:03:21 +0100
committerMichael Williamson <mike@zwobble.org>2023-07-23 22:03:21 +0100
commit4faec7c2c180569a06a5023fc1bcb77812705672 (patch)
tree289c57965d0f5b0726d43ecb4bbf42a11deae08e /src/test/java
parent2fe51eb35031a9dd0c0b740fd893b9704614464e (diff)
Support int-ne in Patio code gen
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/org/shedlang/compiler/patio/PatioCodeGenIntNotEqualTests.java28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/test/java/org/shedlang/compiler/patio/PatioCodeGenIntNotEqualTests.java b/src/test/java/org/shedlang/compiler/patio/PatioCodeGenIntNotEqualTests.java
new file mode 100644
index 00000000..253781d3
--- /dev/null
+++ b/src/test/java/org/shedlang/compiler/patio/PatioCodeGenIntNotEqualTests.java
@@ -0,0 +1,28 @@
+package org.shedlang.compiler.patio;
+
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.shedlang.compiler.patio.ast.operands.PatioLocalRef;
+import org.shedlang.compiler.stackir.instructions.Instructions;
+import org.shedlang.compiler.testing.snapshots.SnapshotResolver;
+import org.shedlang.compiler.testing.snapshots.Snapshotter;
+
+import java.io.IOException;
+
+import static org.shedlang.compiler.patio.PatioTesting.serialize;
+
+@ExtendWith({SnapshotResolver.class})
+public class PatioCodeGenIntNotEqualTests {
+ @Test
+ public void canGenerateCodeForIntNotEqual(Snapshotter snapshotter) throws IOException {
+ var stackIr = Instructions.intNotEqual();
+ var context = PatioCodeGenContext.EMPTY
+ .temporaryPush(new PatioLocalRef("a"))
+ .temporaryPush(new PatioLocalRef("b"))
+ .temporaryPush(new PatioLocalRef("c"));
+
+ var result = PatioCodeGen.generateInstruction(stackIr, context);
+
+ snapshotter.assertSnapshot(serialize(result));
+ }
+}