aboutsummaryrefslogtreecommitdiff
path: root/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/org/shedlang/compiler/patio/PatioCodeGenPushBoolTests.java32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/test/java/org/shedlang/compiler/patio/PatioCodeGenPushBoolTests.java b/src/test/java/org/shedlang/compiler/patio/PatioCodeGenPushBoolTests.java
new file mode 100644
index 00000000..75c471f3
--- /dev/null
+++ b/src/test/java/org/shedlang/compiler/patio/PatioCodeGenPushBoolTests.java
@@ -0,0 +1,32 @@
+package org.shedlang.compiler.patio;
+
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+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 PatioCodeGenPushBoolTests {
+ @Test
+ public void pushBoolFalseInstructionGeneratesPushIntZeroInstruction(Snapshotter snapshotter) throws IOException {
+ var stackIr = Instructions.pushBool(false);
+
+ var result = PatioCodeGen.generateInstruction(stackIr);
+
+ snapshotter.assertSnapshot(serialize(result));
+ }
+
+ @Test
+ public void pushBoolTrueInstructionGeneratesPushIntOneInstruction(Snapshotter snapshotter) throws IOException {
+ var stackIr = Instructions.pushBool(true);
+
+ var result = PatioCodeGen.generateInstruction(stackIr);
+
+ snapshotter.assertSnapshot(serialize(result));
+ }
+}