aboutsummaryrefslogtreecommitdiff
path: root/src/test/java
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2025-02-02 19:06:21 +0000
committerMichael Williamson <mike@zwobble.org>2025-02-02 19:07:53 +0000
commitcab0787d8c259b21baa376ba1ec2d95740964bd9 (patch)
tree11b812255db683766ac3b85b7023e7d85017210c /src/test/java
parent7001d0eef3e6139c3033570a463e02d845f3cbac (diff)
Add Shid to Patio codegen for relational int operations
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/org/shedlang/compiler/shidtopatio/ShidToPatioIntGreaterThanOrEqualTests.java28
-rw-r--r--src/test/java/org/shedlang/compiler/shidtopatio/ShidToPatioIntGreaterThanTests.java28
-rw-r--r--src/test/java/org/shedlang/compiler/shidtopatio/ShidToPatioIntLessThanOrEqualTests.java28
-rw-r--r--src/test/java/org/shedlang/compiler/shidtopatio/ShidToPatioIntLessThanTests.java28
4 files changed, 112 insertions, 0 deletions
diff --git a/src/test/java/org/shedlang/compiler/shidtopatio/ShidToPatioIntGreaterThanOrEqualTests.java b/src/test/java/org/shedlang/compiler/shidtopatio/ShidToPatioIntGreaterThanOrEqualTests.java
new file mode 100644
index 00000000..3d6f94fe
--- /dev/null
+++ b/src/test/java/org/shedlang/compiler/shidtopatio/ShidToPatioIntGreaterThanOrEqualTests.java
@@ -0,0 +1,28 @@
+package org.shedlang.compiler.shidtopatio;
+
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.shedlang.compiler.patio.operands.PatioLocalRef;
+import org.shedlang.compiler.shid.instructions.Shid;
+import org.shedlang.compiler.testing.snapshots.SnapshotResolver;
+import org.shedlang.compiler.testing.snapshots.Snapshotter;
+
+import java.io.IOException;
+
+import static org.shedlang.compiler.shidtopatio.ShidToPatioTesting.serialize;
+
+@ExtendWith({SnapshotResolver.class})
+public class ShidToPatioIntGreaterThanOrEqualTests {
+ @Test
+ public void canGenerateCodeForIntGreaterThanOrEqual(Snapshotter snapshotter) throws IOException {
+ var shid = Shid.intGreaterThanOrEqual();
+ var context = ShidToPatioContext.EMPTY
+ .temporaryPush(new PatioLocalRef("a"))
+ .temporaryPush(new PatioLocalRef("b"))
+ .temporaryPush(new PatioLocalRef("c"));
+
+ var result = ShidToPatio.generateInstruction(shid, context);
+
+ snapshotter.assertSnapshot(serialize(result));
+ }
+}
diff --git a/src/test/java/org/shedlang/compiler/shidtopatio/ShidToPatioIntGreaterThanTests.java b/src/test/java/org/shedlang/compiler/shidtopatio/ShidToPatioIntGreaterThanTests.java
new file mode 100644
index 00000000..6d0ce238
--- /dev/null
+++ b/src/test/java/org/shedlang/compiler/shidtopatio/ShidToPatioIntGreaterThanTests.java
@@ -0,0 +1,28 @@
+package org.shedlang.compiler.shidtopatio;
+
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.shedlang.compiler.patio.operands.PatioLocalRef;
+import org.shedlang.compiler.shid.instructions.Shid;
+import org.shedlang.compiler.testing.snapshots.SnapshotResolver;
+import org.shedlang.compiler.testing.snapshots.Snapshotter;
+
+import java.io.IOException;
+
+import static org.shedlang.compiler.shidtopatio.ShidToPatioTesting.serialize;
+
+@ExtendWith({SnapshotResolver.class})
+public class ShidToPatioIntGreaterThanTests {
+ @Test
+ public void canGenerateCodeForIntGreaterThan(Snapshotter snapshotter) throws IOException {
+ var shid = Shid.intGreaterThan();
+ var context = ShidToPatioContext.EMPTY
+ .temporaryPush(new PatioLocalRef("a"))
+ .temporaryPush(new PatioLocalRef("b"))
+ .temporaryPush(new PatioLocalRef("c"));
+
+ var result = ShidToPatio.generateInstruction(shid, context);
+
+ snapshotter.assertSnapshot(serialize(result));
+ }
+}
diff --git a/src/test/java/org/shedlang/compiler/shidtopatio/ShidToPatioIntLessThanOrEqualTests.java b/src/test/java/org/shedlang/compiler/shidtopatio/ShidToPatioIntLessThanOrEqualTests.java
new file mode 100644
index 00000000..f77bd025
--- /dev/null
+++ b/src/test/java/org/shedlang/compiler/shidtopatio/ShidToPatioIntLessThanOrEqualTests.java
@@ -0,0 +1,28 @@
+package org.shedlang.compiler.shidtopatio;
+
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.shedlang.compiler.patio.operands.PatioLocalRef;
+import org.shedlang.compiler.shid.instructions.Shid;
+import org.shedlang.compiler.testing.snapshots.SnapshotResolver;
+import org.shedlang.compiler.testing.snapshots.Snapshotter;
+
+import java.io.IOException;
+
+import static org.shedlang.compiler.shidtopatio.ShidToPatioTesting.serialize;
+
+@ExtendWith({SnapshotResolver.class})
+public class ShidToPatioIntLessThanOrEqualTests {
+ @Test
+ public void canGenerateCodeForIntLessThanOrEqual(Snapshotter snapshotter) throws IOException {
+ var shid = Shid.intLessThanOrEqual();
+ var context = ShidToPatioContext.EMPTY
+ .temporaryPush(new PatioLocalRef("a"))
+ .temporaryPush(new PatioLocalRef("b"))
+ .temporaryPush(new PatioLocalRef("c"));
+
+ var result = ShidToPatio.generateInstruction(shid, context);
+
+ snapshotter.assertSnapshot(serialize(result));
+ }
+}
diff --git a/src/test/java/org/shedlang/compiler/shidtopatio/ShidToPatioIntLessThanTests.java b/src/test/java/org/shedlang/compiler/shidtopatio/ShidToPatioIntLessThanTests.java
new file mode 100644
index 00000000..82b64c1d
--- /dev/null
+++ b/src/test/java/org/shedlang/compiler/shidtopatio/ShidToPatioIntLessThanTests.java
@@ -0,0 +1,28 @@
+package org.shedlang.compiler.shidtopatio;
+
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.shedlang.compiler.patio.operands.PatioLocalRef;
+import org.shedlang.compiler.shid.instructions.Shid;
+import org.shedlang.compiler.testing.snapshots.SnapshotResolver;
+import org.shedlang.compiler.testing.snapshots.Snapshotter;
+
+import java.io.IOException;
+
+import static org.shedlang.compiler.shidtopatio.ShidToPatioTesting.serialize;
+
+@ExtendWith({SnapshotResolver.class})
+public class ShidToPatioIntLessThanTests {
+ @Test
+ public void canGenerateCodeForIntLessThan(Snapshotter snapshotter) throws IOException {
+ var shid = Shid.intLessThan();
+ var context = ShidToPatioContext.EMPTY
+ .temporaryPush(new PatioLocalRef("a"))
+ .temporaryPush(new PatioLocalRef("b"))
+ .temporaryPush(new PatioLocalRef("c"));
+
+ var result = ShidToPatio.generateInstruction(shid, context);
+
+ snapshotter.assertSnapshot(serialize(result));
+ }
+}