diff options
Diffstat (limited to 'src/test/java/org/shedlang/compiler/patio/serialization/PatioToTransient0Tests.java')
| -rw-r--r-- | src/test/java/org/shedlang/compiler/patio/serialization/PatioToTransient0Tests.java | 125 |
1 files changed, 125 insertions, 0 deletions
diff --git a/src/test/java/org/shedlang/compiler/patio/serialization/PatioToTransient0Tests.java b/src/test/java/org/shedlang/compiler/patio/serialization/PatioToTransient0Tests.java new file mode 100644 index 00000000..34d54ca2 --- /dev/null +++ b/src/test/java/org/shedlang/compiler/patio/serialization/PatioToTransient0Tests.java @@ -0,0 +1,125 @@ +package org.shedlang.compiler.patio.serialization; + +import org.shedlang.compiler.patio.PatioCompilationUnit; +import org.shedlang.compiler.patio.PatioCompilationUnitElement; +import org.shedlang.compiler.patio.instructions.PatioInstruction; +import org.shedlang.compiler.patio.operands.PatioOperand; +import org.shedlang.compiler.patio.types.PatioDataLayout; +import org.shedlang.compiler.patio.types.PatioDataValue; +import org.shedlang.compiler.patio.types.PatioType; +import org.shedlang.compiler.patio.values.PatioDataPtrValue; +import org.shedlang.compiler.patio.values.PatioIntValue; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; + +public class PatioToTransient0Tests extends PatioSerializationTests { + @Override + protected byte[] serializeCompilationUnit(PatioCompilationUnit value) throws IOException { + var outputStream = new ByteArrayOutputStream(); + PatioToTransient0.serializeCompilationUnit(value, outputStream); + return outputStream.toByteArray(); + } + + @Override + protected PatioCompilationUnit deserializeCompilationUnit(byte[] buffer) throws IOException { + return PatioToTransient0.deserializeCompilationUnit(new ByteArrayInputStream(buffer)); + } + + @Override + protected byte[] serializeCompilationUnitElement(PatioCompilationUnitElement value) throws IOException { + var outputStream = new ByteArrayOutputStream(); + PatioToTransient0.serializeCompilationUnitElement(value, outputStream); + return outputStream.toByteArray(); + } + + @Override + protected PatioCompilationUnitElement deserializeCompilationUnitElement(byte[] buffer) throws IOException { + return PatioToTransient0.deserializeCompilationUnitElement(new ByteArrayInputStream(buffer)); + } + + @Override + protected byte[] serializeInstruction(PatioInstruction value) throws IOException { + var outputStream = new ByteArrayOutputStream(); + PatioToTransient0.serializeInstruction(value, outputStream); + return outputStream.toByteArray(); + } + + @Override + protected PatioInstruction deserializeInstruction(byte[] buffer) throws IOException { + return PatioToTransient0.deserializeInstruction(new ByteArrayInputStream(buffer)); + } + + @Override + protected byte[] serializeOperand(PatioOperand value) throws IOException { + var outputStream = new ByteArrayOutputStream(); + PatioToTransient0.serializeOperand(value, outputStream); + return outputStream.toByteArray(); + } + + @Override + protected PatioOperand deserializeOperand(byte[] buffer) throws IOException { + return PatioToTransient0.deserializeOperand(new ByteArrayInputStream(buffer)); + } + + @Override + protected byte[] serializeDataPtrValue(PatioDataPtrValue value) throws IOException { + var outputStream = new ByteArrayOutputStream(); + PatioToTransient0.serializeDataPtrValue(value, outputStream); + return outputStream.toByteArray(); + } + + @Override + protected PatioDataPtrValue deserializeDataPtrValue(byte[] buffer) throws IOException { + return PatioToTransient0.deserializeDataPtrValue(new ByteArrayInputStream(buffer)); + } + + @Override + protected byte[] serializeIntValue(PatioIntValue value) throws IOException { + var outputStream = new ByteArrayOutputStream(); + PatioToTransient0.serializeIntValue(value, outputStream); + return outputStream.toByteArray(); + } + + @Override + protected PatioIntValue deserializeIntValue(byte[] buffer) throws IOException { + return PatioToTransient0.deserializeIntValue(new ByteArrayInputStream(buffer)); + } + + @Override + protected byte[] serializeType(PatioType value) throws IOException { + var outputStream = new ByteArrayOutputStream(); + PatioToTransient0.serializeType(value, outputStream); + return outputStream.toByteArray(); + } + + @Override + protected PatioType deserializeType(byte[] buffer) throws IOException { + return PatioToTransient0.deserializeType(new ByteArrayInputStream(buffer)); + } + + @Override + protected byte[] serializeDataLayout(PatioDataLayout value) throws IOException { + var outputStream = new ByteArrayOutputStream(); + PatioToTransient0.serializeDataLayout(value, outputStream); + return outputStream.toByteArray(); + } + + @Override + protected PatioDataLayout deserializeDataLayout(byte[] buffer) throws IOException { + return PatioToTransient0.deserializeDataLayout(new ByteArrayInputStream(buffer)); + } + + @Override + protected byte[] serializeDataValue(PatioDataValue value) throws IOException { + var outputStream = new ByteArrayOutputStream(); + PatioToTransient0.serializeDataValue(value, outputStream); + return outputStream.toByteArray(); + } + + @Override + protected PatioDataValue deserializeDataValue(byte[] buffer) throws IOException { + return PatioToTransient0.deserializeDataValue(new ByteArrayInputStream(buffer)); + } +} |
