aboutsummaryrefslogtreecommitdiff
path: root/src/test/java
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2026-03-21 12:55:54 +0000
committerMichael Williamson <mike@zwobble.org>2026-03-21 12:55:54 +0000
commit99d37eb1f20e0c7fdcbc4bf42a25b94b33b5f793 (patch)
tree45333eda23d4dc7ff7791d053e8298254c1a9636 /src/test/java
parent09ae7b92f3775a260451798aefb7ff7fc719fbd9 (diff)
Serialize Patio types to protobuf
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/org/shedlang/compiler/patio/protobuf/PatioToProtobufTests.java80
1 files changed, 80 insertions, 0 deletions
diff --git a/src/test/java/org/shedlang/compiler/patio/protobuf/PatioToProtobufTests.java b/src/test/java/org/shedlang/compiler/patio/protobuf/PatioToProtobufTests.java
index f993fb68..30ee7f56 100644
--- a/src/test/java/org/shedlang/compiler/patio/protobuf/PatioToProtobufTests.java
+++ b/src/test/java/org/shedlang/compiler/patio/protobuf/PatioToProtobufTests.java
@@ -5,6 +5,7 @@ import org.shedlang.compiler.patio.PatioVisibility;
import org.shedlang.compiler.patio.instructions.Patio;
import org.shedlang.compiler.patio.types.PatioDataLayouts;
import org.shedlang.compiler.patio.types.PatioDataValues;
+import org.shedlang.compiler.patio.types.PatioTypes;
import org.shedlang.compiler.sources.Sources;
import java.util.List;
@@ -135,6 +136,85 @@ public class PatioToProtobufTests {
assertThat(deserializedIntValue, equalTo(intValue));
}
+ // == Types ==
+
+ @Test
+ public void canSerializeBoolType() {
+ var type = PatioTypes.BOOL;
+
+ var deserializedType = PatioToProtobuf.deserializeType(
+ PatioToProtobuf.serializeType(type)
+ );
+
+ assertThat(deserializedType, equalTo(type));
+ }
+
+ @Test
+ public void canSerializeByteType() {
+ var type = PatioTypes.BYTE;
+
+ var deserializedType = PatioToProtobuf.deserializeType(
+ PatioToProtobuf.serializeType(type)
+ );
+
+ assertThat(deserializedType, equalTo(type));
+ }
+
+ @Test
+ public void canSerializeDataPtrType() {
+ var type = PatioTypes.DATA_PTR;
+
+ var deserializedType = PatioToProtobuf.deserializeType(
+ PatioToProtobuf.serializeType(type)
+ );
+
+ assertThat(deserializedType, equalTo(type));
+ }
+
+ @Test
+ public void canSerializeFunctionPtrType() {
+ var type = PatioTypes.FUNCTION_PTR;
+
+ var deserializedType = PatioToProtobuf.deserializeType(
+ PatioToProtobuf.serializeType(type)
+ );
+
+ assertThat(deserializedType, equalTo(type));
+ }
+
+ @Test
+ public void canSerializeIntType() {
+ var type = PatioTypes.INT;
+
+ var deserializedType = PatioToProtobuf.deserializeType(
+ PatioToProtobuf.serializeType(type)
+ );
+
+ assertThat(deserializedType, equalTo(type));
+ }
+
+ @Test
+ public void canSerializeInt32Type() {
+ var type = PatioTypes.INT32;
+
+ var deserializedType = PatioToProtobuf.deserializeType(
+ PatioToProtobuf.serializeType(type)
+ );
+
+ assertThat(deserializedType, equalTo(type));
+ }
+
+ @Test
+ public void canSerializeVoidType() {
+ var type = PatioTypes.VOID;
+
+ var deserializedType = PatioToProtobuf.deserializeType(
+ PatioToProtobuf.serializeType(type)
+ );
+
+ assertThat(deserializedType, equalTo(type));
+ }
+
// == Data layouts ==
@Test