diff options
| author | Michael Williamson <mike@zwobble.org> | 2023-07-19 21:22:15 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2023-07-19 21:23:44 +0100 |
| commit | 0b3efd133423fc4b6c6e497cc1decf77ab208ad0 (patch) | |
| tree | 9e98c6433dcee532d40f2ecb1e92ca9d56e54f3d /src/test/java | |
| parent | 4b1740153be9fb525b9b9a7c9a8e693332390eea (diff) | |
Add Patio code gen for push-bool
Diffstat (limited to 'src/test/java')
| -rw-r--r-- | src/test/java/org/shedlang/compiler/patio/PatioCodeGenPushBoolTests.java | 32 |
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)); + } +} |
