From 3b8a2b8a006f04fa58e9c8627ecdb11be9c7bd62 Mon Sep 17 00:00:00 2001 From: Mikhail Yakshin Date: Fri, 24 Mar 2017 10:42:02 +0300 Subject: [PATCH 001/126] Started writing tests for Java, ported 3 specs --- run-java | 12 +++-- .../src/io/kaitai/struct/spec/CommonSpec.java | 2 +- .../kaitai/struct/specwrite/CommonSpec.java | 46 +++++++++++++++++++ .../struct/specwrite/TestFloatingPoints.java | 23 ++++++++++ .../struct/specwrite/TestHelloWorld.java | 23 ++++++++++ .../struct/specwrite/TestTermBytes.java | 19 ++++++++ spec/java/testng.xml | 1 + 7 files changed, 121 insertions(+), 5 deletions(-) create mode 100644 spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestFloatingPoints.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestHelloWorld.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestTermBytes.java diff --git a/run-java b/run-java index e8d884a18..644bc9569 100755 --- a/run-java +++ b/run-java @@ -3,7 +3,9 @@ . ./config TEST_FORMATS_JAVA_DIR=$(pwd)/compiled/java/src/io/kaitai/struct/testformats -JAVA_SPEC_DIR=$(pwd)/spec/java/src/io/kaitai/struct/spec +TEST_FORMATS_WRITE_JAVA_DIR=$(pwd)/compiled/java/src/io/kaitai/struct/testwrite +JAVA_SPEC_READ_DIR=$(pwd)/spec/java/src/io/kaitai/struct/spec +JAVA_SPEC_WRITE_DIR=$(pwd)/spec/java/src/io/kaitai/struct/specwrite JAVA_CLASSES_DIR=$(pwd)/compiled/java/bin JAVA_BUILD_FAILS=$(pwd)/"$TEST_OUT_DIR"/java/build.fails JAVA_COMPILE_LOG_DIR=$(pwd)/"$TEST_OUT_DIR"/java/compile_log @@ -24,9 +26,10 @@ javac $JAVAC_OPTS "$JAVA_RUNTIME_DIR/src/main/java/io/kaitai/struct/"*.java -d " echo "run-java: compiling binary format parser sources, generated by KS compiler" javac $JAVAC_OPTS -cp "$JAVA_CLASSES_DIR" \ "$TEST_FORMATS_JAVA_DIR"/*.java \ + "$TEST_FORMATS_WRITE_JAVA_DIR"/*.java \ -d "$JAVA_CLASSES_DIR" || { echo "run-java: some formats failed to compile, trying one by one" - for TFJ in "$TEST_FORMATS_JAVA_DIR"/*.java; do + for TFJ in "$TEST_FORMATS_JAVA_DIR"/*.java "$TEST_FORMATS_WRITE_JAVA_DIR"/*.java; do SRC=$(basename "$TFJ") echo "$SRC" ( @@ -40,10 +43,11 @@ javac $JAVAC_OPTS -cp "$JAVA_CLASSES_DIR" \ # If this fails to compile as a group, try compiling individual files echo "run-java: compiling test specs" javac $JAVAC_OPTS -cp "$JAVA_CLASSES_DIR:$JAVA_TESTNG_JAR" \ - "$JAVA_SPEC_DIR/"*.java \ + "$JAVA_SPEC_READ_DIR/"*.java \ + "$JAVA_SPEC_WRITE_DIR/"*.java \ -d "$JAVA_CLASSES_DIR" || { echo "run-java: some test specs failed to compile, trying one by one" - for SPEC in "$JAVA_SPEC_DIR"/*.java; do + for SPEC in "$JAVA_SPEC_READ_DIR"/*.java "$JAVA_SPEC_WRITE_DIR"/*.java; do SRC=$(basename "$SPEC") echo "$SRC" ( diff --git a/spec/java/src/io/kaitai/struct/spec/CommonSpec.java b/spec/java/src/io/kaitai/struct/spec/CommonSpec.java index b7badc879..249c1d0e0 100644 --- a/spec/java/src/io/kaitai/struct/spec/CommonSpec.java +++ b/spec/java/src/io/kaitai/struct/spec/CommonSpec.java @@ -1,5 +1,5 @@ package io.kaitai.struct.spec; public class CommonSpec { - public String SRC_DIR = "../../src/"; + public static String SRC_DIR = "../../src/"; } diff --git a/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java b/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java new file mode 100644 index 000000000..f5509fc7b --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java @@ -0,0 +1,46 @@ +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStream; +import io.kaitai.struct.KaitaiStruct; + +import java.io.FileInputStream; +import java.io.IOException; + +import static org.testng.Assert.assertEquals; + +public class CommonSpec { + private final static String SRC_DIR = io.kaitai.struct.spec.CommonSpec.SRC_DIR; + + protected KaitaiStream emptyIO() { + return new KaitaiStream(new byte[1024 * 1024]); + } + + protected void assertEqualToFile(KaitaiStruct struct, String fn) throws IOException { + KaitaiStream io = struct._io(); + int size = io.pos(); + + io.seek(0); + byte[] actual = io.readBytes(size); + + FileInputStream fis = new FileInputStream(SRC_DIR + fn); + byte[] expected = new byte[size]; + fis.read(expected); + + assertEquals(byteArrayToHex(actual), byteArrayToHex(expected)); + } + + private String byteArrayToHex(byte[] arr) { + StringBuilder sb = new StringBuilder(); + sb.append('\n'); + for (int i = 0; i < arr.length; i++) { + if ((i % 16) != 0) { + sb.append((i % 4 == 0) ? '|' : ' '); + } + sb.append(String.format("%02x", arr[i])); + if ((i % 16) == 15) + sb.append('\n'); + } + sb.append('\n'); + return sb.toString(); + } +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestFloatingPoints.java b/spec/java/src/io/kaitai/struct/specwrite/TestFloatingPoints.java new file mode 100644 index 000000000..dc8284d48 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestFloatingPoints.java @@ -0,0 +1,23 @@ +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.testwrite.FloatingPoints; +import org.testng.annotations.Test; + +public class TestFloatingPoints extends CommonSpec { + @Test + public void testFloatingPoints() throws Exception { + FloatingPoints r = new FloatingPoints(emptyIO()); + + r.setSingleValue(0.5f); + r.setSingleValueBe(0.5f); + + r.setDoubleValue(0.25d); + r.setDoubleValueBe(0.25d); + + r.setApproximateValue(1.2345f); + + r._write(); + + assertEqualToFile(r, "floating_points.bin"); + } +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestHelloWorld.java b/spec/java/src/io/kaitai/struct/specwrite/TestHelloWorld.java new file mode 100644 index 000000000..111822988 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestHelloWorld.java @@ -0,0 +1,23 @@ +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStream; +import io.kaitai.struct.testwrite.HelloWorld; +import org.testng.annotations.Test; + +import static org.testng.Assert.assertEquals; + +public class TestHelloWorld extends CommonSpec { + @Test + public void testHelloWorld() throws Exception { + KaitaiStream io = emptyIO(); + assertEquals(io.pos(), 0); + + HelloWorld r = new HelloWorld(io); + r.setOne(0x50); + + r._write(); + assertEquals(io.pos(), 1); + + assertEqualToFile(r, "fixed_struct.bin"); + } +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestTermBytes.java b/spec/java/src/io/kaitai/struct/specwrite/TestTermBytes.java new file mode 100644 index 000000000..90fb95eb3 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestTermBytes.java @@ -0,0 +1,19 @@ +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.testwrite.TermBytes; +import org.testng.annotations.Test; + +public class TestTermBytes extends CommonSpec { + @Test + public void testTermBytes() throws Exception { + TermBytes r = new TermBytes(emptyIO()); + + r.setS1(new byte[] { 0x66, 0x6f, 0x6f }); + r.setS2(new byte[] { 0x62, 0x61, 0x72 }); + r.setS3(new byte[] { 0x7c, 0x62, 0x61, 0x7a, 0x40 }); + + r._write(); + + assertEqualToFile(r, "term_strz.bin"); + } +} diff --git a/spec/java/testng.xml b/spec/java/testng.xml index e0f86827c..44e9b2f8e 100644 --- a/spec/java/testng.xml +++ b/spec/java/testng.xml @@ -3,6 +3,7 @@ + From e0e36261f18d771327e01ce36abfd975d7d22d12 Mon Sep 17 00:00:00 2001 From: Mikhail Yakshin Date: Fri, 24 Mar 2017 10:42:42 +0300 Subject: [PATCH 002/126] Better var name --- run-java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/run-java b/run-java index 644bc9569..60ac4db79 100755 --- a/run-java +++ b/run-java @@ -2,7 +2,7 @@ . ./config -TEST_FORMATS_JAVA_DIR=$(pwd)/compiled/java/src/io/kaitai/struct/testformats +TEST_FORMATS_READ_JAVA_DIR=$(pwd)/compiled/java/src/io/kaitai/struct/testformats TEST_FORMATS_WRITE_JAVA_DIR=$(pwd)/compiled/java/src/io/kaitai/struct/testwrite JAVA_SPEC_READ_DIR=$(pwd)/spec/java/src/io/kaitai/struct/spec JAVA_SPEC_WRITE_DIR=$(pwd)/spec/java/src/io/kaitai/struct/specwrite @@ -25,11 +25,11 @@ javac $JAVAC_OPTS "$JAVA_RUNTIME_DIR/src/main/java/io/kaitai/struct/"*.java -d " # If this fails to compile as a group, try compiling individual files echo "run-java: compiling binary format parser sources, generated by KS compiler" javac $JAVAC_OPTS -cp "$JAVA_CLASSES_DIR" \ - "$TEST_FORMATS_JAVA_DIR"/*.java \ + "$TEST_FORMATS_READ_JAVA_DIR"/*.java \ "$TEST_FORMATS_WRITE_JAVA_DIR"/*.java \ -d "$JAVA_CLASSES_DIR" || { echo "run-java: some formats failed to compile, trying one by one" - for TFJ in "$TEST_FORMATS_JAVA_DIR"/*.java "$TEST_FORMATS_WRITE_JAVA_DIR"/*.java; do + for TFJ in "$TEST_FORMATS_READ_JAVA_DIR"/*.java "$TEST_FORMATS_WRITE_JAVA_DIR"/*.java; do SRC=$(basename "$TFJ") echo "$SRC" ( From 96396934fd5e4d7c4d9c33045cf91fe2b469d215 Mon Sep 17 00:00:00 2001 From: Mikhail Yakshin Date: Fri, 24 Mar 2017 11:40:05 +0300 Subject: [PATCH 003/126] Extra check to see if any data was generated at all --- spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java b/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java index f5509fc7b..7146cd59c 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java +++ b/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java @@ -7,6 +7,7 @@ import java.io.IOException; import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertTrue; public class CommonSpec { private final static String SRC_DIR = io.kaitai.struct.spec.CommonSpec.SRC_DIR; @@ -19,6 +20,8 @@ protected void assertEqualToFile(KaitaiStruct struct, String fn) throws IOExcept KaitaiStream io = struct._io(); int size = io.pos(); + assertTrue(size > 0, "no data was written"); + io.seek(0); byte[] actual = io.readBytes(size); From 8e1d1d057128ef91ab0540f36d320d6ab1576784 Mon Sep 17 00:00:00 2001 From: Mikhail Yakshin Date: Fri, 24 Mar 2017 11:40:21 +0300 Subject: [PATCH 004/126] Ported fixed_struct to writing tests in Java --- .../struct/specwrite/TestFixedStruct.java | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestFixedStruct.java diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestFixedStruct.java b/spec/java/src/io/kaitai/struct/specwrite/TestFixedStruct.java new file mode 100644 index 000000000..05bc1205a --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestFixedStruct.java @@ -0,0 +1,42 @@ +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.testwrite.FixedStruct; +import org.testng.annotations.Test; + +public class TestFixedStruct extends CommonSpec { + @Test + public void testFixedStruct() throws Exception { + FixedStruct.Header r = new FixedStruct.Header(emptyIO()); + + r.setUint8(255); + r.setUint16(65535); + r.setUint32(4294967295L); + //r.setUint64(18446744073709551615); + r.setUint64(0xFFFFFFFFFFFFFFFFL); + + r.setSint8((byte) -1); + r.setSint16((short) -1); + r.setSint32(-1); + r.setSint64(-1); + + r.setUint16le(66); + r.setUint32le(66); + r.setUint64le(66); + + r.setSint16le((short) -66); + r.setSint32le(-66); + r.setSint64le(-66); + + r.setUint16be(66); + r.setUint32be(66); + r.setUint64be(66); + + r.setSint16be((short) -66); + r.setSint32be(-66); + r.setSint64be(-66); + + r._write(); + + assertEqualToFile(r, "fixed_struct.bin"); + } +} From 490fc265e46e0fff0d00f3adfd60d7b19c752d4f Mon Sep 17 00:00:00 2001 From: Mikhail Yakshin Date: Fri, 24 Mar 2017 14:19:20 +0300 Subject: [PATCH 005/126] Write test: ported enum_0 and str_encodings --- .../io/kaitai/struct/specwrite/TestEnum0.java | 17 +++++++++++++ .../struct/specwrite/TestStrEncodings.java | 25 +++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestEnum0.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestStrEncodings.java diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEnum0.java b/spec/java/src/io/kaitai/struct/specwrite/TestEnum0.java new file mode 100644 index 000000000..ca8570114 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEnum0.java @@ -0,0 +1,17 @@ +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.testwrite.Enum0; +import org.testng.annotations.Test; + +public class TestEnum0 extends CommonSpec { + @Test + public void testEnum0() throws Exception { + Enum0 r = new Enum0(emptyIO()); + + r.setPet1(Enum0.Animal.CAT); + r.setPet2(Enum0.Animal.CHICKEN); + + r._write(); + assertEqualToFile(r, "enum_0.bin"); + } +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestStrEncodings.java b/spec/java/src/io/kaitai/struct/specwrite/TestStrEncodings.java new file mode 100644 index 000000000..5c9544e66 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestStrEncodings.java @@ -0,0 +1,25 @@ +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.testwrite.StrEncodings; +import org.testng.annotations.Test; + +public class TestStrEncodings extends CommonSpec { + @Test + public void testStrEncodings() throws Exception { + StrEncodings r = new StrEncodings(emptyIO()); + + r.setStr1("Some ASCII"); + r.setStr2("こんにちは"); + r.setStr3("こんにちは"); + r.setStr4("░▒▓"); + + // To be auto-derived + r.setLenOf1(10); + r.setLenOf2(15); + r.setLenOf3(10); + r.setLenOf4(3); + + r._write(); + assertEqualToFile(r, "str_encodings.bin"); + } +} From d5d03b4db2d835f999fa1ba70d024a29e10c824c Mon Sep 17 00:00:00 2001 From: Mikhail Yakshin Date: Fri, 24 Mar 2017 14:55:13 +0300 Subject: [PATCH 006/126] Ported repeat_n_strz and str_eos to Java write specs --- .../struct/specwrite/TestRepeatNStrz.java | 21 +++++++++++++++++++ .../kaitai/struct/specwrite/TestStrEos.java | 16 ++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStrz.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestStrEos.java diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStrz.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStrz.java new file mode 100644 index 000000000..1bd06fa93 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStrz.java @@ -0,0 +1,21 @@ +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.testwrite.RepeatNStrz; +import org.testng.annotations.Test; + +import java.util.ArrayList; +import java.util.Arrays; + +public class TestRepeatNStrz extends CommonSpec { + @Test + public void testRepeatNStrz() throws Exception { + RepeatNStrz r = new RepeatNStrz(emptyIO()); + + r.setQty(2); + r.setLines(new ArrayList<>(Arrays.asList("foo", "bar"))); + + r._write(); + + assertEqualToFile(r, "repeat_n_strz.bin"); + } +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestStrEos.java b/spec/java/src/io/kaitai/struct/specwrite/TestStrEos.java new file mode 100644 index 000000000..e9be78446 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestStrEos.java @@ -0,0 +1,16 @@ +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.testwrite.StrEos; +import org.testng.annotations.Test; + +public class TestStrEos extends CommonSpec { + @Test + public void testStrEos() throws Exception { + StrEos r = new StrEos(emptyIO()); + + r.setStr("foo|bar|baz@"); + + r._write(); + assertEqualToFile(r, "term_strz.bin"); + } +} From 11a98195e232f26f359716d19242801ee12dabb8 Mon Sep 17 00:00:00 2001 From: Mikhail Yakshin Date: Mon, 27 Mar 2017 13:37:41 +0300 Subject: [PATCH 007/126] Ported bytes_pad_term and nested_types to Java writing tests --- .../struct/specwrite/TestBytesPadTerm.java | 19 ++++++++++ .../struct/specwrite/TestNestedTypes.java | 35 +++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTerm.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestNestedTypes.java diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTerm.java b/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTerm.java new file mode 100644 index 000000000..6e9f187b5 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTerm.java @@ -0,0 +1,19 @@ +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.testwrite.BytesPadTerm; +import org.testng.annotations.Test; + +public class TestBytesPadTerm extends CommonSpec { + @Test + public void testBytesPadTerm() throws Exception { + BytesPadTerm r = new BytesPadTerm(emptyIO()); + + r.setStrPad("str1".getBytes()); + r.setStrTerm("str2foo".getBytes()); + r.setStrTermAndPad("str+++3bar+++".getBytes()); + r.setStrTermInclude("str4baz@".getBytes()); + + r._write(); + assertEqualToFile(r, "str_pad_term.bin"); + } +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestNestedTypes.java b/spec/java/src/io/kaitai/struct/specwrite/TestNestedTypes.java new file mode 100644 index 000000000..9baf84b02 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestNestedTypes.java @@ -0,0 +1,35 @@ +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStream; +import io.kaitai.struct.testwrite.NestedTypes; +import org.testng.annotations.Test; + +public class TestNestedTypes extends CommonSpec { + @Test + public void testNestedTypes() throws Exception { + KaitaiStream io = emptyIO(); + + NestedTypes r = new NestedTypes(io); + + NestedTypes.SubtypeA one = new NestedTypes.SubtypeA(io); + + NestedTypes.SubtypeB one1 = new NestedTypes.SubtypeB(io); + one1.setValueB((byte) 80); + + NestedTypes.SubtypeA.SubtypeC one2 = new NestedTypes.SubtypeA.SubtypeC(io); + one2.setValueC((byte) 65); + + one.setTypedAtRoot(one1); + one.setTypedHere(one2); + + NestedTypes.SubtypeB two = new NestedTypes.SubtypeB(io); + two.setValueB((byte) 67); + + r.setOne(one); + r.setTwo(two); + + r._write(); + + assertEqualToFile(r, "fixed_struct.bin"); + } +} From cfa021916c9bed316f7688a9ae05ee79d23f96af Mon Sep 17 00:00:00 2001 From: Mikhail Yakshin Date: Mon, 27 Mar 2017 22:01:59 +0300 Subject: [PATCH 008/126] Ported process_rotate test for Java writing --- .../struct/specwrite/TestProcessRotate.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestProcessRotate.java diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestProcessRotate.java b/spec/java/src/io/kaitai/struct/specwrite/TestProcessRotate.java new file mode 100644 index 000000000..427312368 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestProcessRotate.java @@ -0,0 +1,19 @@ +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.testwrite.ProcessRotate; +import org.testng.annotations.Test; + +public class TestProcessRotate extends CommonSpec { + @Test + public void testProcessRotate() throws Exception { + ProcessRotate r = new ProcessRotate(emptyIO()); + + r.setBuf1("Hello".getBytes()); + r.setBuf2("World".getBytes()); + r.setKey(1); + r.setBuf3("There".getBytes()); + + r._write(); + assertEqualToFile(r, "process_rotate.bin"); + } +} From f3050e0296f9e069cfd5b30bfa54ae7bfed0a1b5 Mon Sep 17 00:00:00 2001 From: Mikhail Yakshin Date: Mon, 27 Mar 2017 22:28:26 +0300 Subject: [PATCH 009/126] Ported repeat_n_struct to Java writing tests --- .../struct/specwrite/TestRepeatNStruct.java | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStruct.java diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStruct.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStruct.java new file mode 100644 index 000000000..7084f15cc --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStruct.java @@ -0,0 +1,32 @@ +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStream; +import io.kaitai.struct.testwrite.RepeatNStruct; +import org.testng.annotations.Test; + +import java.util.ArrayList; + +import static org.testng.Assert.assertEquals; + +public class TestRepeatNStruct extends CommonSpec { + @Test + public void testRepeatNStruct() throws Exception { + KaitaiStream io = emptyIO(); + RepeatNStruct r = new RepeatNStruct(io); + + ArrayList chunks = new ArrayList<>(); + chunks.add(new RepeatNStruct.Chunk(io) {{ + setOffset(0x10); + setLen(0x2078); + }}); + chunks.add(new RepeatNStruct.Chunk(io) {{ + setOffset(0x2088); + setLen(0xf); + }}); + r.setQty(chunks.size()); + r.setChunks(chunks); + + r._write(); + assertEqualToFile(r, "repeat_n_struct.bin"); + } +} From 579b19b2a9167b4cbe6afc4912dcea7ce1f9e1ba Mon Sep 17 00:00:00 2001 From: Mikhail Yakshin Date: Tue, 28 Mar 2017 21:55:49 +0300 Subject: [PATCH 010/126] Optimize imports --- spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStruct.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStruct.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStruct.java index 7084f15cc..1e4691805 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStruct.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStruct.java @@ -6,8 +6,6 @@ import java.util.ArrayList; -import static org.testng.Assert.assertEquals; - public class TestRepeatNStruct extends CommonSpec { @Test public void testRepeatNStruct() throws Exception { From 757a42532d94d6973f42ecacbe9df489c748d62e Mon Sep 17 00:00:00 2001 From: Mikhail Yakshin Date: Tue, 28 Mar 2017 21:56:02 +0300 Subject: [PATCH 011/126] Ported buffered_struct to Java writing --- .../struct/specwrite/TestBufferedStruct.java | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestBufferedStruct.java diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBufferedStruct.java b/spec/java/src/io/kaitai/struct/specwrite/TestBufferedStruct.java new file mode 100644 index 000000000..8699e2b2e --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBufferedStruct.java @@ -0,0 +1,29 @@ +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStream; +import io.kaitai.struct.testwrite.BufferedStruct; +import org.testng.annotations.Test; + +public class TestBufferedStruct extends CommonSpec { + @Test + public void testBufferedStruct() throws Exception { + BufferedStruct r = new BufferedStruct() {{ + setLen1(0x10); + setBlock1(new BufferedStruct.Block() {{ + setNumber1(0x42); + setNumber2(0x43); + }}); + + setLen2(0x8); + setBlock2(new BufferedStruct.Block() {{ + setNumber1(0x44); + setNumber2(0x45); + }}); + + setFinisher(0xee); + }}; + + r._write(emptyIO()); + assertEqualToFile(r, "buffered_struct.bin"); + } +} From afe2501644439a271f53dd0c28e370ff8dfae0d3 Mon Sep 17 00:00:00 2001 From: Mikhail Yakshin Date: Tue, 28 Mar 2017 22:17:11 +0300 Subject: [PATCH 012/126] Rewrote all Java writing tests using new KaitaiStruct.Writable API --- .../io/kaitai/struct/specwrite/CommonSpec.java | 9 +++++---- .../struct/specwrite/TestBufferedStruct.java | 2 -- .../kaitai/struct/specwrite/TestBytesPadTerm.java | 3 +-- .../src/io/kaitai/struct/specwrite/TestEnum0.java | 3 +-- .../kaitai/struct/specwrite/TestFixedStruct.java | 4 +--- .../struct/specwrite/TestFloatingPoints.java | 4 +--- .../kaitai/struct/specwrite/TestHelloWorld.java | 11 +---------- .../kaitai/struct/specwrite/TestNestedTypes.java | 15 +++++---------- .../struct/specwrite/TestProcessRotate.java | 3 +-- .../struct/specwrite/TestRepeatNStruct.java | 9 +++------ .../kaitai/struct/specwrite/TestRepeatNStrz.java | 4 +--- .../kaitai/struct/specwrite/TestStrEncodings.java | 3 +-- .../io/kaitai/struct/specwrite/TestStrEos.java | 3 +-- .../io/kaitai/struct/specwrite/TestTermBytes.java | 4 +--- 14 files changed, 23 insertions(+), 54 deletions(-) diff --git a/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java b/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java index 7146cd59c..44ea43fb0 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java +++ b/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java @@ -12,12 +12,13 @@ public class CommonSpec { private final static String SRC_DIR = io.kaitai.struct.spec.CommonSpec.SRC_DIR; - protected KaitaiStream emptyIO() { - return new KaitaiStream(new byte[1024 * 1024]); + private KaitaiStream emptyIO() { + return new KaitaiStream(1024 * 1024); } - protected void assertEqualToFile(KaitaiStruct struct, String fn) throws IOException { - KaitaiStream io = struct._io(); + protected void assertEqualToFile(KaitaiStruct.Writable struct, String fn) throws IOException { + KaitaiStream io = emptyIO(); + struct._write(io); int size = io.pos(); assertTrue(size > 0, "no data was written"); diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBufferedStruct.java b/spec/java/src/io/kaitai/struct/specwrite/TestBufferedStruct.java index 8699e2b2e..97f6cae0f 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestBufferedStruct.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBufferedStruct.java @@ -1,6 +1,5 @@ package io.kaitai.struct.specwrite; -import io.kaitai.struct.KaitaiStream; import io.kaitai.struct.testwrite.BufferedStruct; import org.testng.annotations.Test; @@ -23,7 +22,6 @@ public void testBufferedStruct() throws Exception { setFinisher(0xee); }}; - r._write(emptyIO()); assertEqualToFile(r, "buffered_struct.bin"); } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTerm.java b/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTerm.java index 6e9f187b5..5ebda68b8 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTerm.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTerm.java @@ -6,14 +6,13 @@ public class TestBytesPadTerm extends CommonSpec { @Test public void testBytesPadTerm() throws Exception { - BytesPadTerm r = new BytesPadTerm(emptyIO()); + BytesPadTerm r = new BytesPadTerm(); r.setStrPad("str1".getBytes()); r.setStrTerm("str2foo".getBytes()); r.setStrTermAndPad("str+++3bar+++".getBytes()); r.setStrTermInclude("str4baz@".getBytes()); - r._write(); assertEqualToFile(r, "str_pad_term.bin"); } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEnum0.java b/spec/java/src/io/kaitai/struct/specwrite/TestEnum0.java index ca8570114..cd3cfb91d 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestEnum0.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEnum0.java @@ -6,12 +6,11 @@ public class TestEnum0 extends CommonSpec { @Test public void testEnum0() throws Exception { - Enum0 r = new Enum0(emptyIO()); + Enum0 r = new Enum0(); r.setPet1(Enum0.Animal.CAT); r.setPet2(Enum0.Animal.CHICKEN); - r._write(); assertEqualToFile(r, "enum_0.bin"); } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestFixedStruct.java b/spec/java/src/io/kaitai/struct/specwrite/TestFixedStruct.java index 05bc1205a..889207cba 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestFixedStruct.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestFixedStruct.java @@ -6,7 +6,7 @@ public class TestFixedStruct extends CommonSpec { @Test public void testFixedStruct() throws Exception { - FixedStruct.Header r = new FixedStruct.Header(emptyIO()); + FixedStruct.Header r = new FixedStruct.Header(); r.setUint8(255); r.setUint16(65535); @@ -35,8 +35,6 @@ public void testFixedStruct() throws Exception { r.setSint32be(-66); r.setSint64be(-66); - r._write(); - assertEqualToFile(r, "fixed_struct.bin"); } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestFloatingPoints.java b/spec/java/src/io/kaitai/struct/specwrite/TestFloatingPoints.java index dc8284d48..57ef7d1f8 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestFloatingPoints.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestFloatingPoints.java @@ -6,7 +6,7 @@ public class TestFloatingPoints extends CommonSpec { @Test public void testFloatingPoints() throws Exception { - FloatingPoints r = new FloatingPoints(emptyIO()); + FloatingPoints r = new FloatingPoints(); r.setSingleValue(0.5f); r.setSingleValueBe(0.5f); @@ -16,8 +16,6 @@ public void testFloatingPoints() throws Exception { r.setApproximateValue(1.2345f); - r._write(); - assertEqualToFile(r, "floating_points.bin"); } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestHelloWorld.java b/spec/java/src/io/kaitai/struct/specwrite/TestHelloWorld.java index 111822988..177ace32e 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestHelloWorld.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestHelloWorld.java @@ -1,23 +1,14 @@ package io.kaitai.struct.specwrite; -import io.kaitai.struct.KaitaiStream; import io.kaitai.struct.testwrite.HelloWorld; import org.testng.annotations.Test; -import static org.testng.Assert.assertEquals; - public class TestHelloWorld extends CommonSpec { @Test public void testHelloWorld() throws Exception { - KaitaiStream io = emptyIO(); - assertEquals(io.pos(), 0); - - HelloWorld r = new HelloWorld(io); + HelloWorld r = new HelloWorld(); r.setOne(0x50); - r._write(); - assertEquals(io.pos(), 1); - assertEqualToFile(r, "fixed_struct.bin"); } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestNestedTypes.java b/spec/java/src/io/kaitai/struct/specwrite/TestNestedTypes.java index 9baf84b02..fe6b3d1c6 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestNestedTypes.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestNestedTypes.java @@ -1,35 +1,30 @@ package io.kaitai.struct.specwrite; -import io.kaitai.struct.KaitaiStream; import io.kaitai.struct.testwrite.NestedTypes; import org.testng.annotations.Test; public class TestNestedTypes extends CommonSpec { @Test public void testNestedTypes() throws Exception { - KaitaiStream io = emptyIO(); + NestedTypes r = new NestedTypes(); - NestedTypes r = new NestedTypes(io); + NestedTypes.SubtypeA one = new NestedTypes.SubtypeA(); - NestedTypes.SubtypeA one = new NestedTypes.SubtypeA(io); - - NestedTypes.SubtypeB one1 = new NestedTypes.SubtypeB(io); + NestedTypes.SubtypeB one1 = new NestedTypes.SubtypeB(); one1.setValueB((byte) 80); - NestedTypes.SubtypeA.SubtypeC one2 = new NestedTypes.SubtypeA.SubtypeC(io); + NestedTypes.SubtypeA.SubtypeC one2 = new NestedTypes.SubtypeA.SubtypeC(); one2.setValueC((byte) 65); one.setTypedAtRoot(one1); one.setTypedHere(one2); - NestedTypes.SubtypeB two = new NestedTypes.SubtypeB(io); + NestedTypes.SubtypeB two = new NestedTypes.SubtypeB(); two.setValueB((byte) 67); r.setOne(one); r.setTwo(two); - r._write(); - assertEqualToFile(r, "fixed_struct.bin"); } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestProcessRotate.java b/spec/java/src/io/kaitai/struct/specwrite/TestProcessRotate.java index 427312368..97d13581e 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestProcessRotate.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestProcessRotate.java @@ -6,14 +6,13 @@ public class TestProcessRotate extends CommonSpec { @Test public void testProcessRotate() throws Exception { - ProcessRotate r = new ProcessRotate(emptyIO()); + ProcessRotate r = new ProcessRotate(); r.setBuf1("Hello".getBytes()); r.setBuf2("World".getBytes()); r.setKey(1); r.setBuf3("There".getBytes()); - r._write(); assertEqualToFile(r, "process_rotate.bin"); } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStruct.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStruct.java index 1e4691805..f05f1203e 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStruct.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStruct.java @@ -1,6 +1,5 @@ package io.kaitai.struct.specwrite; -import io.kaitai.struct.KaitaiStream; import io.kaitai.struct.testwrite.RepeatNStruct; import org.testng.annotations.Test; @@ -9,22 +8,20 @@ public class TestRepeatNStruct extends CommonSpec { @Test public void testRepeatNStruct() throws Exception { - KaitaiStream io = emptyIO(); - RepeatNStruct r = new RepeatNStruct(io); + RepeatNStruct r = new RepeatNStruct(); ArrayList chunks = new ArrayList<>(); - chunks.add(new RepeatNStruct.Chunk(io) {{ + chunks.add(new RepeatNStruct.Chunk() {{ setOffset(0x10); setLen(0x2078); }}); - chunks.add(new RepeatNStruct.Chunk(io) {{ + chunks.add(new RepeatNStruct.Chunk() {{ setOffset(0x2088); setLen(0xf); }}); r.setQty(chunks.size()); r.setChunks(chunks); - r._write(); assertEqualToFile(r, "repeat_n_struct.bin"); } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStrz.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStrz.java index 1bd06fa93..fcb54e1f3 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStrz.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStrz.java @@ -9,13 +9,11 @@ public class TestRepeatNStrz extends CommonSpec { @Test public void testRepeatNStrz() throws Exception { - RepeatNStrz r = new RepeatNStrz(emptyIO()); + RepeatNStrz r = new RepeatNStrz(); r.setQty(2); r.setLines(new ArrayList<>(Arrays.asList("foo", "bar"))); - r._write(); - assertEqualToFile(r, "repeat_n_strz.bin"); } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestStrEncodings.java b/spec/java/src/io/kaitai/struct/specwrite/TestStrEncodings.java index 5c9544e66..5569360ed 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestStrEncodings.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestStrEncodings.java @@ -6,7 +6,7 @@ public class TestStrEncodings extends CommonSpec { @Test public void testStrEncodings() throws Exception { - StrEncodings r = new StrEncodings(emptyIO()); + StrEncodings r = new StrEncodings(); r.setStr1("Some ASCII"); r.setStr2("こんにちは"); @@ -19,7 +19,6 @@ public void testStrEncodings() throws Exception { r.setLenOf3(10); r.setLenOf4(3); - r._write(); assertEqualToFile(r, "str_encodings.bin"); } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestStrEos.java b/spec/java/src/io/kaitai/struct/specwrite/TestStrEos.java index e9be78446..2773ceaf9 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestStrEos.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestStrEos.java @@ -6,11 +6,10 @@ public class TestStrEos extends CommonSpec { @Test public void testStrEos() throws Exception { - StrEos r = new StrEos(emptyIO()); + StrEos r = new StrEos(); r.setStr("foo|bar|baz@"); - r._write(); assertEqualToFile(r, "term_strz.bin"); } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestTermBytes.java b/spec/java/src/io/kaitai/struct/specwrite/TestTermBytes.java index 90fb95eb3..565274855 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestTermBytes.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestTermBytes.java @@ -6,14 +6,12 @@ public class TestTermBytes extends CommonSpec { @Test public void testTermBytes() throws Exception { - TermBytes r = new TermBytes(emptyIO()); + TermBytes r = new TermBytes(); r.setS1(new byte[] { 0x66, 0x6f, 0x6f }); r.setS2(new byte[] { 0x62, 0x61, 0x72 }); r.setS3(new byte[] { 0x7c, 0x62, 0x61, 0x7a, 0x40 }); - r._write(); - assertEqualToFile(r, "term_strz.bin"); } } From 156a3c7f12be8c082bb21ab77f501a408f541abb Mon Sep 17 00:00:00 2001 From: Mikhail Yakshin Date: Tue, 28 Mar 2017 22:48:08 +0300 Subject: [PATCH 013/126] Added process_to_user Java writing port --- .../struct/specwrite/TestProcessToUser.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestProcessToUser.java diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestProcessToUser.java b/spec/java/src/io/kaitai/struct/specwrite/TestProcessToUser.java new file mode 100644 index 000000000..f52d483f4 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestProcessToUser.java @@ -0,0 +1,17 @@ +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.testwrite.ProcessToUser; +import org.testng.annotations.Test; + +public class TestProcessToUser extends CommonSpec { + @Test + public void testProcessToUser() throws Exception { + ProcessToUser.JustStr buf1 = new ProcessToUser.JustStr(); + buf1.setStr("Hello"); + + ProcessToUser r = new ProcessToUser(); + r.setBuf1(buf1); + + assertEqualToFile(r, "process_rotate.bin"); + } +} From f0cfc1c3172dcae27df98464e24b7c1d23019b73 Mon Sep 17 00:00:00 2001 From: Mikhail Yakshin Date: Tue, 28 Mar 2017 23:15:07 +0300 Subject: [PATCH 014/126] Use new toByteArray API --- spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java b/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java index 44ea43fb0..f670f9c2f 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java +++ b/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java @@ -19,15 +19,12 @@ private KaitaiStream emptyIO() { protected void assertEqualToFile(KaitaiStruct.Writable struct, String fn) throws IOException { KaitaiStream io = emptyIO(); struct._write(io); - int size = io.pos(); + byte[] actual = io.toByteArray(); - assertTrue(size > 0, "no data was written"); - - io.seek(0); - byte[] actual = io.readBytes(size); + assertTrue(actual.length > 0, "no data was written"); FileInputStream fis = new FileInputStream(SRC_DIR + fn); - byte[] expected = new byte[size]; + byte[] expected = new byte[actual.length]; fis.read(expected); assertEquals(byteArrayToHex(actual), byteArrayToHex(expected)); From b15aaf4bc9ff0e86db36a269c7ba72dc4c83f196 Mon Sep 17 00:00:00 2001 From: Mikhail Yakshin Date: Wed, 29 Mar 2017 02:00:41 +0300 Subject: [PATCH 015/126] Fix assertEqualToFile to work again --- spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java b/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java index f670f9c2f..3a5703684 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java +++ b/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java @@ -19,7 +19,9 @@ private KaitaiStream emptyIO() { protected void assertEqualToFile(KaitaiStruct.Writable struct, String fn) throws IOException { KaitaiStream io = emptyIO(); struct._write(io); - byte[] actual = io.toByteArray(); + long size = io.pos(); + io.seek(0); + byte[] actual = io.readBytes(size); assertTrue(actual.length > 0, "no data was written"); From a5d07e90a4be75acf6a20a69cffdf9ecfa9b0f9c Mon Sep 17 00:00:00 2001 From: Mikhail Yakshin Date: Wed, 29 Mar 2017 02:01:01 +0300 Subject: [PATCH 016/126] Added repeat_eos_u4 Java writing port --- .../struct/specwrite/TestRepeatEosU4.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosU4.java diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosU4.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosU4.java new file mode 100644 index 000000000..1cb5f0bcb --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosU4.java @@ -0,0 +1,17 @@ +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.testwrite.RepeatEosU4; +import org.testng.annotations.Test; + +import java.util.ArrayList; +import java.util.Arrays; + +public class TestRepeatEosU4 extends CommonSpec { + @Test + public void testRepeatEosU4() throws Exception { + RepeatEosU4 r = new RepeatEosU4(); + r.setNumbers(new ArrayList<>(Arrays.asList(0L, 0x42L, 0x42L, 0x815L))); + + assertEqualToFile(r, "repeat_eos_struct.bin"); + } +} From 790e89e523c912a4059a0f027c2eff23c0dfd1cc Mon Sep 17 00:00:00 2001 From: Mikhail Yakshin Date: Wed, 29 Mar 2017 10:39:16 +0300 Subject: [PATCH 017/126] More assertion helper functions --- .../kaitai/struct/specwrite/CommonSpec.java | 29 +++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java b/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java index 3a5703684..42edd6009 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java +++ b/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java @@ -16,22 +16,41 @@ private KaitaiStream emptyIO() { return new KaitaiStream(1024 * 1024); } + protected void assertEqualToFullFile(KaitaiStruct.Writable struct, String fn) throws IOException { + byte[] actual = structToByteArray(struct); + + KaitaiStream expFile = new KaitaiStream(SRC_DIR + fn); + byte[] expected = expFile.readBytesFull(); + expFile.close(); + + assertEquals(byteArrayToHex(actual), byteArrayToHex(expected)); + } + protected void assertEqualToFile(KaitaiStruct.Writable struct, String fn) throws IOException { - KaitaiStream io = emptyIO(); - struct._write(io); - long size = io.pos(); - io.seek(0); - byte[] actual = io.readBytes(size); + byte[] actual = structToByteArray(struct); assertTrue(actual.length > 0, "no data was written"); FileInputStream fis = new FileInputStream(SRC_DIR + fn); byte[] expected = new byte[actual.length]; fis.read(expected); + fis.close(); assertEquals(byteArrayToHex(actual), byteArrayToHex(expected)); } + protected byte[] structToByteArray(KaitaiStruct.Writable struct) { + KaitaiStream io = emptyIO(); + struct._write(io); + long size = io.pos(); + io.seek(0); + return io.readBytes(size); + } + + protected KaitaiStream structToReadStream(KaitaiStruct.Writable struct) { + return new KaitaiStream(structToByteArray(struct)); + } + private String byteArrayToHex(byte[] arr) { StringBuilder sb = new StringBuilder(); sb.append('\n'); From c5c84656364d919f384b0ca6e873b75f086c9451 Mon Sep 17 00:00:00 2001 From: Mikhail Yakshin Date: Wed, 29 Mar 2017 10:39:47 +0300 Subject: [PATCH 018/126] Modified BufferedStruct tests to fit both read/write --- .../kaitai/struct/spec/TestBufferedStruct.java | 17 +++++++++++------ .../struct/specwrite/TestBufferedStruct.java | 4 +++- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/spec/java/src/io/kaitai/struct/spec/TestBufferedStruct.java b/spec/java/src/io/kaitai/struct/spec/TestBufferedStruct.java index 1e8f9f793..406d21d32 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestBufferedStruct.java +++ b/spec/java/src/io/kaitai/struct/spec/TestBufferedStruct.java @@ -10,23 +10,28 @@ public class TestBufferedStruct extends CommonSpec { public void testBufferedStruct() throws Exception { BufferedStruct r = BufferedStruct.fromFile(SRC_DIR + "buffered_struct.bin"); - assertEquals(r.len1(), 0x10); - assertEquals(r._raw_block1(), new byte[] { 0x42, 0, 0, 0, 0x43, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, }); + assertEquals(r._raw_block2(), new byte[] { + 0x44, 0, 0, 0, + 0x45, 0, 0, 0, + }); + + assertGood(r); + } + + public static void assertGood(BufferedStruct r) { + assertEquals(r.len1(), 0x10); + assertEquals(r.block1().number1(), 0x42); assertEquals(r.block1().number2(), 0x43); assertEquals(r.len2(), 0x8); - assertEquals(r._raw_block2(), new byte[] { - 0x44, 0, 0, 0, - 0x45, 0, 0, 0, - }); assertEquals(r.block2().number1(), 0x44); assertEquals(r.block2().number2(), 0x45); diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBufferedStruct.java b/spec/java/src/io/kaitai/struct/specwrite/TestBufferedStruct.java index 97f6cae0f..132329333 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestBufferedStruct.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBufferedStruct.java @@ -22,6 +22,8 @@ public void testBufferedStruct() throws Exception { setFinisher(0xee); }}; - assertEqualToFile(r, "buffered_struct.bin"); + io.kaitai.struct.testformats.BufferedStruct r2 = new io.kaitai.struct.testformats.BufferedStruct(structToReadStream(r)); + + io.kaitai.struct.spec.TestBufferedStruct.assertGood(r2); } } From 4c8845d266f7a9bece4d71c8a20406985d809f63 Mon Sep 17 00:00:00 2001 From: Mikhail Yakshin Date: Wed, 29 Mar 2017 10:41:51 +0300 Subject: [PATCH 019/126] Ported if_struct to Java writing --- .../kaitai/struct/specwrite/TestIfStruct.java | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestIfStruct.java diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestIfStruct.java b/spec/java/src/io/kaitai/struct/specwrite/TestIfStruct.java new file mode 100644 index 000000000..d911f614c --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestIfStruct.java @@ -0,0 +1,44 @@ +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.testwrite.IfStruct; +import org.testng.annotations.Test; + +public class TestIfStruct extends CommonSpec { + @Test + public void testIfStruct() throws Exception { + IfStruct r = new IfStruct(); + + IfStruct.Operation op1 = new IfStruct.Operation() {{ + setOpcode(0x53); + setArgStr(new IfStruct.ArgStr() {{ + setStr("foo"); + + // to be set automatically + setLen(3); + }}); + }}; + r.setOp1(op1); + + IfStruct.Operation op2 = new IfStruct.Operation() {{ + setOpcode(0x54); + setArgTuple(new IfStruct.ArgTuple() {{ + setNum1(0x42); + setNum2(0x43); + }}); + }}; + r.setOp2(op2); + + IfStruct.Operation op3 = new IfStruct.Operation() {{ + setOpcode(0x53); + setArgStr(new IfStruct.ArgStr() {{ + setStr("bar"); + + // to be set automatically + setLen(3); + }}); + }}; + r.setOp3(op3); + + assertEqualToFullFile(r, "if_struct.bin"); + } +} From a4a7909038e7cc52253523c2d28bd48e94bc44c3 Mon Sep 17 00:00:00 2001 From: Mikhail Yakshin Date: Wed, 29 Mar 2017 15:18:59 +0300 Subject: [PATCH 020/126] Replaced interfaces with new abstract classes --- .../src/io/kaitai/struct/specwrite/CommonSpec.java | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java b/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java index 42edd6009..30afc5dca 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java +++ b/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java @@ -12,11 +12,7 @@ public class CommonSpec { private final static String SRC_DIR = io.kaitai.struct.spec.CommonSpec.SRC_DIR; - private KaitaiStream emptyIO() { - return new KaitaiStream(1024 * 1024); - } - - protected void assertEqualToFullFile(KaitaiStruct.Writable struct, String fn) throws IOException { + protected void assertEqualToFullFile(KaitaiStruct.ReadWrite struct, String fn) throws IOException { byte[] actual = structToByteArray(struct); KaitaiStream expFile = new KaitaiStream(SRC_DIR + fn); @@ -26,7 +22,7 @@ protected void assertEqualToFullFile(KaitaiStruct.Writable struct, String fn) th assertEquals(byteArrayToHex(actual), byteArrayToHex(expected)); } - protected void assertEqualToFile(KaitaiStruct.Writable struct, String fn) throws IOException { + protected void assertEqualToFile(KaitaiStruct.ReadWrite struct, String fn) throws IOException { byte[] actual = structToByteArray(struct); assertTrue(actual.length > 0, "no data was written"); @@ -39,15 +35,15 @@ protected void assertEqualToFile(KaitaiStruct.Writable struct, String fn) throws assertEquals(byteArrayToHex(actual), byteArrayToHex(expected)); } - protected byte[] structToByteArray(KaitaiStruct.Writable struct) { - KaitaiStream io = emptyIO(); + protected byte[] structToByteArray(KaitaiStruct.ReadWrite struct) { + KaitaiStream io = new KaitaiStream(1024 * 1024); struct._write(io); long size = io.pos(); io.seek(0); return io.readBytes(size); } - protected KaitaiStream structToReadStream(KaitaiStruct.Writable struct) { + protected KaitaiStream structToReadStream(KaitaiStruct.ReadWrite struct) { return new KaitaiStream(structToByteArray(struct)); } From 301d3ac5860f35c59aa38cc919b0bf62eeea3cc3 Mon Sep 17 00:00:00 2001 From: Mikhail Yakshin Date: Wed, 29 Mar 2017 15:19:18 +0300 Subject: [PATCH 021/126] Added SwitchManualInt to Java writing tests --- .../struct/specwrite/TestSwitchManualInt.java | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualInt.java diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualInt.java b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualInt.java new file mode 100644 index 000000000..c062aa897 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualInt.java @@ -0,0 +1,47 @@ +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.testwrite.SwitchManualInt; +import org.testng.annotations.Test; + +import java.util.ArrayList; + +public class TestSwitchManualInt extends CommonSpec { + @Test + public void testSwitchManualInt() throws Exception { + SwitchManualInt r = new SwitchManualInt(); + + ArrayList opcodes = new ArrayList<>(); + + opcodes.add(new SwitchManualInt.Opcode() {{ + setCode(83); + setBody(new Strval() {{ + setValue("foobar"); + }}); + }}); + + opcodes.add(new SwitchManualInt.Opcode() {{ + setCode(73); + setBody(new Intval() {{ + setValue(0x42); + }}); + }}); + + opcodes.add(new SwitchManualInt.Opcode() {{ + setCode(73); + setBody(new Intval() {{ + setValue(0x37); + }}); + }}); + + opcodes.add(new SwitchManualInt.Opcode() {{ + setCode(83); + setBody(new Strval() {{ + setValue(""); + }}); + }}); + + r.setOpcodes(opcodes); + + assertEqualToFullFile(r, "switch_opcodes.bin"); + } +} From d311bd4433a24827f3709ef1068b2eeb3256329c Mon Sep 17 00:00:00 2001 From: Mikhail Yakshin Date: Wed, 29 Mar 2017 16:07:41 +0300 Subject: [PATCH 022/126] Ported switch_manual_str to Java writing --- .../struct/specwrite/TestSwitchManualStr.java | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualStr.java diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualStr.java b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualStr.java new file mode 100644 index 000000000..b13e741eb --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualStr.java @@ -0,0 +1,51 @@ +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.testwrite.SwitchManualStr; +import io.kaitai.struct.testwrite.SwitchManualStr.Opcode.Intval; +import io.kaitai.struct.testwrite.SwitchManualStr.Opcode.Strval; +import org.testng.annotations.Test; + +import java.util.ArrayList; + +import static org.testng.Assert.assertEquals; + +public class TestSwitchManualStr extends CommonSpec { + @Test + public void testSwitchManualStr() throws Exception { + SwitchManualStr r = new SwitchManualStr(); + + ArrayList opcodes = new ArrayList<>(); + + opcodes.add(new SwitchManualStr.Opcode() {{ + setCode("S"); + setBody(new Strval() {{ + setValue("foobar"); + }}); + }}); + + opcodes.add(new SwitchManualStr.Opcode() {{ + setCode("I"); + setBody(new Intval() {{ + setValue(0x42); + }}); + }}); + + opcodes.add(new SwitchManualStr.Opcode() {{ + setCode("I"); + setBody(new Intval() {{ + setValue(0x37); + }}); + }}); + + opcodes.add(new SwitchManualStr.Opcode() {{ + setCode("S"); + setBody(new Strval() {{ + setValue(""); + }}); + }}); + + r.setOpcodes(opcodes); + + assertEqualToFullFile(r, "switch_opcodes.bin"); + } +} From 97a7c1f64529e1882632c1d5f285f64bd66242fd Mon Sep 17 00:00:00 2001 From: Mikhail Yakshin Date: Thu, 30 Mar 2017 05:41:42 +0300 Subject: [PATCH 023/126] Added _check call before every writing attempt --- spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java b/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java index 30afc5dca..65645354b 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java +++ b/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java @@ -36,6 +36,7 @@ protected void assertEqualToFile(KaitaiStruct.ReadWrite struct, String fn) throw } protected byte[] structToByteArray(KaitaiStruct.ReadWrite struct) { + struct._check(); KaitaiStream io = new KaitaiStream(1024 * 1024); struct._write(io); long size = io.pos(); From a00d702b71fe8d42f67342e99d739dba59edba16 Mon Sep 17 00:00:00 2001 From: Mikhail Yakshin Date: Thu, 30 Mar 2017 05:42:35 +0300 Subject: [PATCH 024/126] Added tests for _check number of members in array mismatch + NPE --- .../struct/specwrite/TestRepeatNStrz.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStrz.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStrz.java index fcb54e1f3..bcfba5ea9 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStrz.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStrz.java @@ -1,5 +1,6 @@ package io.kaitai.struct.specwrite; +import io.kaitai.struct.ConsistencyError; import io.kaitai.struct.testwrite.RepeatNStrz; import org.testng.annotations.Test; @@ -8,7 +9,7 @@ public class TestRepeatNStrz extends CommonSpec { @Test - public void testRepeatNStrz() throws Exception { + public void test() throws Exception { RepeatNStrz r = new RepeatNStrz(); r.setQty(2); @@ -16,4 +17,21 @@ public void testRepeatNStrz() throws Exception { assertEqualToFile(r, "repeat_n_strz.bin"); } + + @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: lines,.*") + public void checkMismatch() throws Exception { + RepeatNStrz r = new RepeatNStrz(); + + r.setQty(7); + r.setLines(new ArrayList<>(Arrays.asList("foo", "bar"))); + + r._check(); + } + + @Test(expectedExceptions = NullPointerException.class) + public void checkNull() throws Exception { + RepeatNStrz r = new RepeatNStrz(); + + r._check(); + } } From 803209fb9929bcdc2ffbd9416050b5170d9349f3 Mon Sep 17 00:00:00 2001 From: Mikhail Yakshin Date: Thu, 30 Mar 2017 11:04:21 +0300 Subject: [PATCH 025/126] specwrite/TestStrEncodings: added string size _check testing --- .../struct/specwrite/TestStrEncodings.java | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestStrEncodings.java b/spec/java/src/io/kaitai/struct/specwrite/TestStrEncodings.java index 5569360ed..bd8dd7652 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestStrEncodings.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestStrEncodings.java @@ -1,5 +1,6 @@ package io.kaitai.struct.specwrite; +import io.kaitai.struct.ConsistencyError; import io.kaitai.struct.testwrite.StrEncodings; import org.testng.annotations.Test; @@ -21,4 +22,32 @@ public void testStrEncodings() throws Exception { assertEqualToFile(r, "str_encodings.bin"); } + + @Test(expectedExceptions = NullPointerException.class) + public void checkNull() throws Exception { + StrEncodings r = new StrEncodings(); + + r.setStr1("woo"); + r.setLenOf1(3); + + r._check(); + } + + @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: str2,.*") + public void checkMismatch() throws Exception { + StrEncodings r = new StrEncodings(); + + r.setStr1("Some ASCII"); + r.setStr2("こんにちは"); + r.setStr3("こんにちは"); + r.setStr4("░▒▓"); + + // To be auto-derived + r.setLenOf1(10); + r.setLenOf2(12); // should be 15 + r.setLenOf3(10); + r.setLenOf4(3); + + r._check(); + } } From 99b1753b3d0f009b89a80106e2cecc31c3dc4594 Mon Sep 17 00:00:00 2001 From: Mikhail Yakshin Date: Thu, 30 Mar 2017 11:19:23 +0300 Subject: [PATCH 026/126] Added byte array limited length check test --- .../io/kaitai/struct/specwrite/TestProcessRotate.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestProcessRotate.java b/spec/java/src/io/kaitai/struct/specwrite/TestProcessRotate.java index 97d13581e..09d5d3fcb 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestProcessRotate.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestProcessRotate.java @@ -1,5 +1,6 @@ package io.kaitai.struct.specwrite; +import io.kaitai.struct.ConsistencyError; import io.kaitai.struct.testwrite.ProcessRotate; import org.testng.annotations.Test; @@ -15,4 +16,14 @@ public void testProcessRotate() throws Exception { assertEqualToFile(r, "process_rotate.bin"); } + + @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: buf2,.*") + public void checkSizeMismatch() throws Exception { + ProcessRotate r = new ProcessRotate(); + + r.setBuf1("Hello".getBytes()); + r.setBuf2("Way too long".getBytes()); + + r._check(); + } } From 2cc29ff5d58eb4db62b2ba574ddbf28d8d8e858f Mon Sep 17 00:00:00 2001 From: Mikhail Yakshin Date: Thu, 30 Mar 2017 23:50:38 +0300 Subject: [PATCH 027/126] Added more byte limited type consistency check tests --- .../struct/specwrite/TestBytesPadTerm.java | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTerm.java b/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTerm.java index 5ebda68b8..e1660fbae 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTerm.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTerm.java @@ -1,5 +1,6 @@ package io.kaitai.struct.specwrite; +import io.kaitai.struct.ConsistencyError; import io.kaitai.struct.testwrite.BytesPadTerm; import org.testng.annotations.Test; @@ -15,4 +16,48 @@ public void testBytesPadTerm() throws Exception { assertEqualToFile(r, "str_pad_term.bin"); } + + @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: str_pad,.*") + public void checkLongerString1() throws Exception { + BytesPadTerm r = new BytesPadTerm(); + r.setStrPad("1234567890123456789012345".getBytes()); + r._check(); + } + + @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: str_term,.*") + public void checkLongerString2() throws Exception { + BytesPadTerm r = new BytesPadTerm(); + r.setStrPad("12345678901234567890".getBytes()); + r.setStrTerm("12345678901234567890".getBytes()); + r._check(); + } + + @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: str_term_and_pad,.*") + public void checkLongerString3() throws Exception { + BytesPadTerm r = new BytesPadTerm(); + r.setStrPad("12345678901234567890".getBytes()); + r.setStrTerm("1234567890123456789".getBytes()); + r.setStrTermAndPad("123456789012345678901".getBytes()); + r._check(); + } + + @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: str_term_include,.*") + public void checkLongerString4() throws Exception { + BytesPadTerm r = new BytesPadTerm(); + r.setStrPad("12345678901234567890".getBytes()); + r.setStrTerm("1234567890123456789".getBytes()); + r.setStrTermAndPad("12345678901234567890".getBytes()); + r.setStrTermInclude("123456789012345678901".getBytes()); + r._check(); + } + + @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: str_term_include,.*") + public void checkBadTerminator() throws Exception { + BytesPadTerm r = new BytesPadTerm(); + r.setStrPad("12345678901234567890".getBytes()); + r.setStrTerm("1234567890123456789".getBytes()); + r.setStrTermAndPad("12345678901234567890".getBytes()); + r.setStrTermInclude("123".getBytes()); + r._check(); + } } From 166d2227190c5f76d8b0b925619d5fb5e55e2021 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Sat, 1 Feb 2020 18:22:42 +0100 Subject: [PATCH 028/126] Port bits_simple to Java writing test --- .../struct/specwrite/TestBitsSimple.java | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestBitsSimple.java diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBitsSimple.java b/spec/java/src/io/kaitai/struct/specwrite/TestBitsSimple.java new file mode 100644 index 000000000..117a272d5 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBitsSimple.java @@ -0,0 +1,27 @@ +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.testwrite.BitsSimple; +import org.testng.annotations.Test; + +public class TestBitsSimple extends CommonSpec { + @Test + public void testBitsSimple() throws Exception { + BitsSimple r = new BitsSimple(); + + r.setByte1(80); + r.setByte2(65); + r.setBitsA(false); + r.setBitsB(4); + r.setBitsC(3); + r.setLargeBits1(300); + r.setSpacer(5); + r.setLargeBits2(1329); + r.setNormalS2((short) -1); + r.setByte8910(5259587); + r.setByte11To14(1261262125); + r.setByte15To19(293220057087L); + r.setByte20To27(0xffffffffffffffffL); + + assertEqualToFile(r, "fixed_struct.bin"); + } +} From 5a45be24d23a8a69e9fecd5a4d05717f3bb416ac Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Mon, 1 Aug 2022 22:49:22 +0200 Subject: [PATCH 029/126] Fix compiling for Java to `/src` folder (not implicit since 0.9) --- build-formats | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-formats b/build-formats index a5118f191..33d1b4910 100755 --- a/build-formats +++ b/build-formats @@ -16,7 +16,7 @@ mkdir -p "$FORMATS_COMPILED_DIR" "$FORMATS_KSY_DIR"/*.ksy || : "$COMPILER_DIR/jvm/target/universal/stage/bin/kaitai-struct-compiler" -- \ - --verbose all -t java -d "$FORMATS_COMPILED_DIR/java" \ + --verbose all -t java -d "$FORMATS_COMPILED_DIR/java/src" \ --no-auto-read \ --read-write \ --import-path "$FORMATS_REPO_DIR" \ From c6d48cc6395c00a0fdbcf905cbb9664f85562302 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Tue, 2 Aug 2022 11:42:56 +0200 Subject: [PATCH 030/126] Rename Test{FixedStruct => Integers}, because that's what it is --- .../specwrite/{TestFixedStruct.java => TestIntegers.java} | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) rename spec/java/src/io/kaitai/struct/specwrite/{TestFixedStruct.java => TestIntegers.java} (79%) diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestFixedStruct.java b/spec/java/src/io/kaitai/struct/specwrite/TestIntegers.java similarity index 79% rename from spec/java/src/io/kaitai/struct/specwrite/TestFixedStruct.java rename to spec/java/src/io/kaitai/struct/specwrite/TestIntegers.java index f1fb7fd6e..065731f5b 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestFixedStruct.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestIntegers.java @@ -1,12 +1,12 @@ package io.kaitai.struct.specwrite; -import io.kaitai.struct.testwrite.FixedStruct; +import io.kaitai.struct.testwrite.Integers; import org.testng.annotations.Test; -public class TestFixedStruct extends CommonSpec { +public class TestIntegers extends CommonSpec { @Test - public void testFixedStruct() throws Exception { - FixedStruct.Header r = new FixedStruct.Header(); + public void testIntegers() throws Exception { + Integers r = new Integers(); r.setUint8(255); r.setUint16(65535); From 99c39a6ff3c7e9c965c3a152f3d6630fd869f3a2 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Fri, 12 Aug 2022 23:30:46 +0200 Subject: [PATCH 031/126] Add universal read-write roundtrip test, port existing manual tests --- .../struct/spec/TestBufferedStruct.java | 4 - .../kaitai/struct/specwrite/CommonSpec.java | 143 +++++++++++++++++- .../struct/specwrite/TestBitsSimple.java | 26 +--- .../struct/specwrite/TestBufferedStruct.java | 28 +--- .../struct/specwrite/TestBytesPadTerm.java | 15 ++ .../io/kaitai/struct/specwrite/TestEnum0.java | 15 +- .../struct/specwrite/TestFloatingPoints.java | 20 +-- .../struct/specwrite/TestHelloWorld.java | 13 +- .../kaitai/struct/specwrite/TestIfStruct.java | 43 +----- .../kaitai/struct/specwrite/TestIntegers.java | 39 +---- .../struct/specwrite/TestNestedTypes.java | 29 +--- .../struct/specwrite/TestProcessRotate.java | 14 ++ .../struct/specwrite/TestProcessToUser.java | 14 ++ .../struct/specwrite/TestRepeatEosU4.java | 16 +- .../struct/specwrite/TestRepeatNStruct.java | 26 +--- .../struct/specwrite/TestRepeatNStrz.java | 21 +-- .../struct/specwrite/TestStrEncodings.java | 29 ++-- .../kaitai/struct/specwrite/TestStrEos.java | 14 +- .../struct/specwrite/TestSwitchManualInt.java | 46 +----- .../struct/specwrite/TestSwitchManualStr.java | 50 +----- .../struct/specwrite/TestTermBytes.java | 16 +- 21 files changed, 315 insertions(+), 306 deletions(-) diff --git a/spec/java/src/io/kaitai/struct/spec/TestBufferedStruct.java b/spec/java/src/io/kaitai/struct/spec/TestBufferedStruct.java index 406d21d32..588c3bc1c 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestBufferedStruct.java +++ b/spec/java/src/io/kaitai/struct/spec/TestBufferedStruct.java @@ -21,10 +21,6 @@ public void testBufferedStruct() throws Exception { 0x45, 0, 0, 0, }); - assertGood(r); - } - - public static void assertGood(BufferedStruct r) { assertEquals(r.len1(), 0x10); assertEquals(r.block1().number1(), 0x42); diff --git a/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java b/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java index 3685a5c26..93a675ee0 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java +++ b/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java @@ -1,18 +1,64 @@ package io.kaitai.struct.specwrite; -import io.kaitai.struct.KaitaiStream; -import io.kaitai.struct.ByteBufferKaitaiStream; -import io.kaitai.struct.KaitaiStruct; - import java.io.FileInputStream; import java.io.IOException; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.IdentityHashMap; +import java.util.List; +import java.util.Map; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertTrue; -public class CommonSpec { +import org.testng.annotations.Test; + +import io.kaitai.struct.ByteBufferKaitaiStream; +import io.kaitai.struct.KaitaiStream; +import io.kaitai.struct.KaitaiStruct; + +public abstract class CommonSpec { private final static String SRC_DIR = io.kaitai.struct.spec.CommonSpec.SRC_DIR; + protected abstract Class getStructClass(); + + protected abstract String getSrcFilename(); + + @Test + protected void testReadWriteRoundtrip() throws Exception { + Class structClass = getStructClass(); + String fn = getSrcFilename(); + + Method fromFileMethod = structClass.getMethod("fromFile", String.class); + KaitaiStruct.ReadWrite origKs = (KaitaiStruct.ReadWrite) fromFileMethod.invoke(null, SRC_DIR + fn); + origKs._read(); + + Object origDump = dumpStruct(origKs); + + ByteBufferKaitaiStream newIo = new ByteBufferKaitaiStream(origKs._io().size()); + origKs._write(newIo); + newIo.seek(0); + + KaitaiStruct.ReadWrite newKs = structClass + .getConstructor(KaitaiStream.class) + .newInstance(newIo); + newKs._read(); + + Object newDump = dumpStruct(newKs); + + // // add debug dumps for a specific test format as follows: + // if (structClass.equals(HelloWorld.class)) { + // System.out.println(structClass.getSimpleName()); + // System.out.println("origDump: " + origDump); + // System.out.println(" newDump: " + newDump); + // System.out.println(); + // } + + assertEquals(newDump, origDump); + } + protected void assertEqualToFullFile(KaitaiStruct.ReadWrite struct, String fn) throws IOException { byte[] actual = structToByteArray(struct); @@ -49,6 +95,93 @@ protected KaitaiStream structToReadStream(KaitaiStruct.ReadWrite struct) { return new ByteBufferKaitaiStream(structToByteArray(struct)); } + protected static Object dumpStruct(KaitaiStruct.ReadWrite struct) throws Exception { + return dumpStructValue(struct, new IdentityHashMap<>(), 50, "/"); + } + + protected static Object dumpStructValue( + Object value, + IdentityHashMap parentStructs, + int recursionDepthLimit, + String currentPath + ) throws Exception { + if (recursionDepthLimit < 0) { + // The reason this limit exists is that it is theoretically possible to + // recursively parse an infinite number of new types using instances (even + // keeping track of already encountered identical objects doesn't solve this, + // since new objects are created each time) - not that it's a good idea to do + // this in any KSY specification, of course, since it would make it impossible + // to dump it to JSON, for example, but just to be safe there is this limit. + throw new IllegalStateException( + "recursion depth limit reached, cannot recurse into " + currentPath + ); + } + + if (value instanceof KaitaiStruct.ReadWrite) { + KaitaiStruct.ReadWrite struct = (KaitaiStruct.ReadWrite) value; + struct._check(); + + Map dump = new HashMap<>(); + { + String circularRefToParentPath = parentStructs.get(struct); + if (circularRefToParentPath != null) { + dump.put("$ref", circularRefToParentPath); + return dump; + } + } + parentStructs.put(struct, currentPath); + for (final Method m : struct.getClass().getDeclaredMethods()) { + if (!Modifier.isPublic(m.getModifiers())) continue; + if (Modifier.isStatic(m.getModifiers())) continue; // ignore static methods, i.e. "fromFile" + + final String methodName = m.getName(); + if (methodName.startsWith("_")) { + if ( + methodName.startsWith("_read") || + methodName.startsWith("_check") || + methodName.startsWith("_write") + // we should maybe ignore `_raw_*()` getters too, because they reflect + // leftover substream bytes that are not written (this is why the + // BufferedStruct test fails) + ) { + continue; + } + } + if (m.getParameterCount() != 0) continue; // we only want getters (which must have 0 args) + + // here we could maybe set `_raw_*` properties to `null` to avoid fooling the test + // as easily as merely writing the `_raw_*` bytes left over from parsing, but so far + // so good (it's our generated code, so we can make sure it's not trying to cheat :-P) + + Object o = m.invoke(struct); + dump.put(methodName, dumpStructValue( + o, parentStructs, recursionDepthLimit - 1, + currentPath + (currentPath.equals("/") ? "" : "/") + methodName + )); + } + parentStructs.remove(struct); + value = dump; + } else if (value instanceof byte[]) { + StringBuilder sb = new StringBuilder(); + for (byte b : (byte[]) value) { + sb.append(String.format("%02x ", b)); + } + value = "[" + sb.substring(0, sb.length() - (sb.charAt(sb.length() - 1) == ' ' ? 1 : 0)) + "]"; + } else if (value instanceof List) { + List list = (List) value; + List out = new ArrayList<>(); + for (int i = 0; i < list.size(); i++) { + out.add(dumpStructValue( + list.get(i), parentStructs, recursionDepthLimit - 1, + currentPath + (currentPath.equals("/") ? "" : "/") + i + )); + } + value = out; + } + + return value; + } + private String byteArrayToHex(byte[] arr) { StringBuilder sb = new StringBuilder(); sb.append('\n'); diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBitsSimple.java b/spec/java/src/io/kaitai/struct/specwrite/TestBitsSimple.java index 117a272d5..18b424cea 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestBitsSimple.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBitsSimple.java @@ -1,27 +1,17 @@ package io.kaitai.struct.specwrite; +import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.BitsSimple; import org.testng.annotations.Test; public class TestBitsSimple extends CommonSpec { - @Test - public void testBitsSimple() throws Exception { - BitsSimple r = new BitsSimple(); - - r.setByte1(80); - r.setByte2(65); - r.setBitsA(false); - r.setBitsB(4); - r.setBitsC(3); - r.setLargeBits1(300); - r.setSpacer(5); - r.setLargeBits2(1329); - r.setNormalS2((short) -1); - r.setByte8910(5259587); - r.setByte11To14(1261262125); - r.setByte15To19(293220057087L); - r.setByte20To27(0xffffffffffffffffL); + @Override + protected Class getStructClass() { + return BitsSimple.class; + } - assertEqualToFile(r, "fixed_struct.bin"); + @Override + protected String getSrcFilename() { + return "fixed_struct.bin"; } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBufferedStruct.java b/spec/java/src/io/kaitai/struct/specwrite/TestBufferedStruct.java index 132329333..26752a6f2 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestBufferedStruct.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBufferedStruct.java @@ -1,29 +1,17 @@ package io.kaitai.struct.specwrite; +import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.BufferedStruct; import org.testng.annotations.Test; public class TestBufferedStruct extends CommonSpec { - @Test - public void testBufferedStruct() throws Exception { - BufferedStruct r = new BufferedStruct() {{ - setLen1(0x10); - setBlock1(new BufferedStruct.Block() {{ - setNumber1(0x42); - setNumber2(0x43); - }}); - - setLen2(0x8); - setBlock2(new BufferedStruct.Block() {{ - setNumber1(0x44); - setNumber2(0x45); - }}); - - setFinisher(0xee); - }}; - - io.kaitai.struct.testformats.BufferedStruct r2 = new io.kaitai.struct.testformats.BufferedStruct(structToReadStream(r)); + @Override + protected Class getStructClass() { + return BufferedStruct.class; + } - io.kaitai.struct.spec.TestBufferedStruct.assertGood(r2); + @Override + protected String getSrcFilename() { + return "buffered_struct.bin"; } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTerm.java b/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTerm.java index e1660fbae..ad6340333 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTerm.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTerm.java @@ -1,12 +1,17 @@ package io.kaitai.struct.specwrite; import io.kaitai.struct.ConsistencyError; +import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.BytesPadTerm; import org.testng.annotations.Test; public class TestBytesPadTerm extends CommonSpec { @Test public void testBytesPadTerm() throws Exception { + // NOTE: here it makes sense to prefer a manual test over the automatic roundtrip, because + // the roundtrip can't recognize whether the `pad-right` is correct (since it isn't relevant + // for parsing and therefore has no effect on consistency) + BytesPadTerm r = new BytesPadTerm(); r.setStrPad("str1".getBytes()); @@ -60,4 +65,14 @@ public void checkBadTerminator() throws Exception { r.setStrTermInclude("123".getBytes()); r._check(); } + + @Override + protected Class getStructClass() { + return BytesPadTerm.class; + } + + @Override + protected String getSrcFilename() { + return "str_pad_term.bin"; + } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEnum0.java b/spec/java/src/io/kaitai/struct/specwrite/TestEnum0.java index cd3cfb91d..bd1a557b7 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestEnum0.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEnum0.java @@ -1,16 +1,17 @@ package io.kaitai.struct.specwrite; +import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.Enum0; import org.testng.annotations.Test; public class TestEnum0 extends CommonSpec { - @Test - public void testEnum0() throws Exception { - Enum0 r = new Enum0(); - - r.setPet1(Enum0.Animal.CAT); - r.setPet2(Enum0.Animal.CHICKEN); + @Override + protected Class getStructClass() { + return Enum0.class; + } - assertEqualToFile(r, "enum_0.bin"); + @Override + protected String getSrcFilename() { + return "enum_0.bin"; } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestFloatingPoints.java b/spec/java/src/io/kaitai/struct/specwrite/TestFloatingPoints.java index 57ef7d1f8..5e70794ec 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestFloatingPoints.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestFloatingPoints.java @@ -1,21 +1,17 @@ package io.kaitai.struct.specwrite; +import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.FloatingPoints; import org.testng.annotations.Test; public class TestFloatingPoints extends CommonSpec { - @Test - public void testFloatingPoints() throws Exception { - FloatingPoints r = new FloatingPoints(); - - r.setSingleValue(0.5f); - r.setSingleValueBe(0.5f); - - r.setDoubleValue(0.25d); - r.setDoubleValueBe(0.25d); - - r.setApproximateValue(1.2345f); + @Override + protected Class getStructClass() { + return FloatingPoints.class; + } - assertEqualToFile(r, "floating_points.bin"); + @Override + protected String getSrcFilename() { + return "floating_points.bin"; } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestHelloWorld.java b/spec/java/src/io/kaitai/struct/specwrite/TestHelloWorld.java index 177ace32e..d8b65407e 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestHelloWorld.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestHelloWorld.java @@ -1,14 +1,17 @@ package io.kaitai.struct.specwrite; +import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.HelloWorld; import org.testng.annotations.Test; public class TestHelloWorld extends CommonSpec { - @Test - public void testHelloWorld() throws Exception { - HelloWorld r = new HelloWorld(); - r.setOne(0x50); + @Override + protected Class getStructClass() { + return HelloWorld.class; + } - assertEqualToFile(r, "fixed_struct.bin"); + @Override + protected String getSrcFilename() { + return "fixed_struct.bin"; } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestIfStruct.java b/spec/java/src/io/kaitai/struct/specwrite/TestIfStruct.java index d911f614c..52d39689a 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestIfStruct.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestIfStruct.java @@ -1,44 +1,17 @@ package io.kaitai.struct.specwrite; import io.kaitai.struct.testwrite.IfStruct; +import io.kaitai.struct.KaitaiStruct.ReadWrite; import org.testng.annotations.Test; public class TestIfStruct extends CommonSpec { - @Test - public void testIfStruct() throws Exception { - IfStruct r = new IfStruct(); - - IfStruct.Operation op1 = new IfStruct.Operation() {{ - setOpcode(0x53); - setArgStr(new IfStruct.ArgStr() {{ - setStr("foo"); - - // to be set automatically - setLen(3); - }}); - }}; - r.setOp1(op1); - - IfStruct.Operation op2 = new IfStruct.Operation() {{ - setOpcode(0x54); - setArgTuple(new IfStruct.ArgTuple() {{ - setNum1(0x42); - setNum2(0x43); - }}); - }}; - r.setOp2(op2); - - IfStruct.Operation op3 = new IfStruct.Operation() {{ - setOpcode(0x53); - setArgStr(new IfStruct.ArgStr() {{ - setStr("bar"); - - // to be set automatically - setLen(3); - }}); - }}; - r.setOp3(op3); + @Override + protected Class getStructClass() { + return IfStruct.class; + } - assertEqualToFullFile(r, "if_struct.bin"); + @Override + protected String getSrcFilename() { + return "if_struct.bin"; } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestIntegers.java b/spec/java/src/io/kaitai/struct/specwrite/TestIntegers.java index 065731f5b..b07044cd5 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestIntegers.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestIntegers.java @@ -1,40 +1,17 @@ package io.kaitai.struct.specwrite; +import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.Integers; import org.testng.annotations.Test; public class TestIntegers extends CommonSpec { - @Test - public void testIntegers() throws Exception { - Integers r = new Integers(); - - r.setUint8(255); - r.setUint16(65535); - r.setUint32(4294967295L); - //r.setUint64(18446744073709551615); - r.setUint64(0xFFFFFFFFFFFFFFFFL); - - r.setSint8((byte) -1); - r.setSint16((short) -1); - r.setSint32(-1); - r.setSint64(-1); - - r.setUint16le(66); - r.setUint32le(66); - r.setUint64le(66); - - r.setSint16le((short) -66); - r.setSint32le(-66); - r.setSint64le(-66); - - r.setUint16be(66); - r.setUint32be(66); - r.setUint64be(66); - - r.setSint16be((short) -66); - r.setSint32be(-66); - r.setSint64be(-66); + @Override + protected Class getStructClass() { + return Integers.class; + } - assertEqualToFile(r, "fixed_struct.bin"); + @Override + protected String getSrcFilename() { + return "fixed_struct.bin"; } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestNestedTypes.java b/spec/java/src/io/kaitai/struct/specwrite/TestNestedTypes.java index fe6b3d1c6..c5d8c58b7 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestNestedTypes.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestNestedTypes.java @@ -1,30 +1,17 @@ package io.kaitai.struct.specwrite; +import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.NestedTypes; import org.testng.annotations.Test; public class TestNestedTypes extends CommonSpec { - @Test - public void testNestedTypes() throws Exception { - NestedTypes r = new NestedTypes(); - - NestedTypes.SubtypeA one = new NestedTypes.SubtypeA(); - - NestedTypes.SubtypeB one1 = new NestedTypes.SubtypeB(); - one1.setValueB((byte) 80); - - NestedTypes.SubtypeA.SubtypeC one2 = new NestedTypes.SubtypeA.SubtypeC(); - one2.setValueC((byte) 65); - - one.setTypedAtRoot(one1); - one.setTypedHere(one2); - - NestedTypes.SubtypeB two = new NestedTypes.SubtypeB(); - two.setValueB((byte) 67); - - r.setOne(one); - r.setTwo(two); + @Override + protected Class getStructClass() { + return NestedTypes.class; + } - assertEqualToFile(r, "fixed_struct.bin"); + @Override + protected String getSrcFilename() { + return "fixed_struct.bin"; } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestProcessRotate.java b/spec/java/src/io/kaitai/struct/specwrite/TestProcessRotate.java index 09d5d3fcb..829c75735 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestProcessRotate.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestProcessRotate.java @@ -1,12 +1,16 @@ package io.kaitai.struct.specwrite; import io.kaitai.struct.ConsistencyError; +import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.ProcessRotate; import org.testng.annotations.Test; public class TestProcessRotate extends CommonSpec { @Test public void testProcessRotate() throws Exception { + // NOTE: unlike the automatic roundtrip test, the `_raw_*` fields are set to `null` in this + // manual test, so "cheating" by just writing them is impossible + ProcessRotate r = new ProcessRotate(); r.setBuf1("Hello".getBytes()); @@ -26,4 +30,14 @@ public void checkSizeMismatch() throws Exception { r._check(); } + + @Override + protected Class getStructClass() { + return ProcessRotate.class; + } + + @Override + protected String getSrcFilename() { + return "process_rotate.bin"; + } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestProcessToUser.java b/spec/java/src/io/kaitai/struct/specwrite/TestProcessToUser.java index f52d483f4..7f8825627 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestProcessToUser.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestProcessToUser.java @@ -1,11 +1,15 @@ package io.kaitai.struct.specwrite; +import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.ProcessToUser; import org.testng.annotations.Test; public class TestProcessToUser extends CommonSpec { @Test public void testProcessToUser() throws Exception { + // NOTE: unlike the automatic roundtrip test, the `_raw_*` fields are set to `null` in this + // manual test, so "cheating" by just writing them is impossible + ProcessToUser.JustStr buf1 = new ProcessToUser.JustStr(); buf1.setStr("Hello"); @@ -14,4 +18,14 @@ public void testProcessToUser() throws Exception { assertEqualToFile(r, "process_rotate.bin"); } + + @Override + protected Class getStructClass() { + return ProcessToUser.class; + } + + @Override + protected String getSrcFilename() { + return "process_rotate.bin"; + } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosU4.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosU4.java index 1cb5f0bcb..c3d76559e 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosU4.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosU4.java @@ -1,17 +1,17 @@ package io.kaitai.struct.specwrite; +import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.RepeatEosU4; import org.testng.annotations.Test; -import java.util.ArrayList; -import java.util.Arrays; - public class TestRepeatEosU4 extends CommonSpec { - @Test - public void testRepeatEosU4() throws Exception { - RepeatEosU4 r = new RepeatEosU4(); - r.setNumbers(new ArrayList<>(Arrays.asList(0L, 0x42L, 0x42L, 0x815L))); + @Override + protected Class getStructClass() { + return RepeatEosU4.class; + } - assertEqualToFile(r, "repeat_eos_struct.bin"); + @Override + protected String getSrcFilename() { + return "repeat_eos_struct.bin"; } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStruct.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStruct.java index f05f1203e..bcb7f8d81 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStruct.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStruct.java @@ -1,27 +1,17 @@ package io.kaitai.struct.specwrite; +import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.RepeatNStruct; import org.testng.annotations.Test; -import java.util.ArrayList; - public class TestRepeatNStruct extends CommonSpec { - @Test - public void testRepeatNStruct() throws Exception { - RepeatNStruct r = new RepeatNStruct(); - - ArrayList chunks = new ArrayList<>(); - chunks.add(new RepeatNStruct.Chunk() {{ - setOffset(0x10); - setLen(0x2078); - }}); - chunks.add(new RepeatNStruct.Chunk() {{ - setOffset(0x2088); - setLen(0xf); - }}); - r.setQty(chunks.size()); - r.setChunks(chunks); + @Override + protected Class getStructClass() { + return RepeatNStruct.class; + } - assertEqualToFile(r, "repeat_n_struct.bin"); + @Override + protected String getSrcFilename() { + return "repeat_n_struct.bin"; } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStrz.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStrz.java index bcfba5ea9..e1acd71cf 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStrz.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStrz.java @@ -1,6 +1,7 @@ package io.kaitai.struct.specwrite; import io.kaitai.struct.ConsistencyError; +import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.RepeatNStrz; import org.testng.annotations.Test; @@ -8,16 +9,6 @@ import java.util.Arrays; public class TestRepeatNStrz extends CommonSpec { - @Test - public void test() throws Exception { - RepeatNStrz r = new RepeatNStrz(); - - r.setQty(2); - r.setLines(new ArrayList<>(Arrays.asList("foo", "bar"))); - - assertEqualToFile(r, "repeat_n_strz.bin"); - } - @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: lines,.*") public void checkMismatch() throws Exception { RepeatNStrz r = new RepeatNStrz(); @@ -34,4 +25,14 @@ public void checkNull() throws Exception { r._check(); } + + @Override + protected Class getStructClass() { + return RepeatNStrz.class; + } + + @Override + protected String getSrcFilename() { + return "repeat_n_strz.bin"; + } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestStrEncodings.java b/spec/java/src/io/kaitai/struct/specwrite/TestStrEncodings.java index bd8dd7652..04a20b58c 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestStrEncodings.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestStrEncodings.java @@ -1,28 +1,11 @@ package io.kaitai.struct.specwrite; import io.kaitai.struct.ConsistencyError; +import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.StrEncodings; import org.testng.annotations.Test; public class TestStrEncodings extends CommonSpec { - @Test - public void testStrEncodings() throws Exception { - StrEncodings r = new StrEncodings(); - - r.setStr1("Some ASCII"); - r.setStr2("こんにちは"); - r.setStr3("こんにちは"); - r.setStr4("░▒▓"); - - // To be auto-derived - r.setLenOf1(10); - r.setLenOf2(15); - r.setLenOf3(10); - r.setLenOf4(3); - - assertEqualToFile(r, "str_encodings.bin"); - } - @Test(expectedExceptions = NullPointerException.class) public void checkNull() throws Exception { StrEncodings r = new StrEncodings(); @@ -50,4 +33,14 @@ public void checkMismatch() throws Exception { r._check(); } + + @Override + protected Class getStructClass() { + return StrEncodings.class; + } + + @Override + protected String getSrcFilename() { + return "str_encodings.bin"; + } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestStrEos.java b/spec/java/src/io/kaitai/struct/specwrite/TestStrEos.java index 2773ceaf9..65ce92f7c 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestStrEos.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestStrEos.java @@ -1,15 +1,17 @@ package io.kaitai.struct.specwrite; +import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.StrEos; import org.testng.annotations.Test; public class TestStrEos extends CommonSpec { - @Test - public void testStrEos() throws Exception { - StrEos r = new StrEos(); - - r.setStr("foo|bar|baz@"); + @Override + protected Class getStructClass() { + return StrEos.class; + } - assertEqualToFile(r, "term_strz.bin"); + @Override + protected String getSrcFilename() { + return "term_strz.bin"; } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualInt.java b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualInt.java index c062aa897..bc94dee14 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualInt.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualInt.java @@ -1,47 +1,17 @@ package io.kaitai.struct.specwrite; +import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.SwitchManualInt; import org.testng.annotations.Test; -import java.util.ArrayList; - public class TestSwitchManualInt extends CommonSpec { - @Test - public void testSwitchManualInt() throws Exception { - SwitchManualInt r = new SwitchManualInt(); - - ArrayList opcodes = new ArrayList<>(); - - opcodes.add(new SwitchManualInt.Opcode() {{ - setCode(83); - setBody(new Strval() {{ - setValue("foobar"); - }}); - }}); - - opcodes.add(new SwitchManualInt.Opcode() {{ - setCode(73); - setBody(new Intval() {{ - setValue(0x42); - }}); - }}); - - opcodes.add(new SwitchManualInt.Opcode() {{ - setCode(73); - setBody(new Intval() {{ - setValue(0x37); - }}); - }}); - - opcodes.add(new SwitchManualInt.Opcode() {{ - setCode(83); - setBody(new Strval() {{ - setValue(""); - }}); - }}); - - r.setOpcodes(opcodes); + @Override + protected Class getStructClass() { + return SwitchManualInt.class; + } - assertEqualToFullFile(r, "switch_opcodes.bin"); + @Override + protected String getSrcFilename() { + return "switch_opcodes.bin"; } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualStr.java b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualStr.java index b13e741eb..33186c393 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualStr.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualStr.java @@ -1,51 +1,17 @@ package io.kaitai.struct.specwrite; +import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.SwitchManualStr; -import io.kaitai.struct.testwrite.SwitchManualStr.Opcode.Intval; -import io.kaitai.struct.testwrite.SwitchManualStr.Opcode.Strval; import org.testng.annotations.Test; -import java.util.ArrayList; - -import static org.testng.Assert.assertEquals; - public class TestSwitchManualStr extends CommonSpec { - @Test - public void testSwitchManualStr() throws Exception { - SwitchManualStr r = new SwitchManualStr(); - - ArrayList opcodes = new ArrayList<>(); - - opcodes.add(new SwitchManualStr.Opcode() {{ - setCode("S"); - setBody(new Strval() {{ - setValue("foobar"); - }}); - }}); - - opcodes.add(new SwitchManualStr.Opcode() {{ - setCode("I"); - setBody(new Intval() {{ - setValue(0x42); - }}); - }}); - - opcodes.add(new SwitchManualStr.Opcode() {{ - setCode("I"); - setBody(new Intval() {{ - setValue(0x37); - }}); - }}); - - opcodes.add(new SwitchManualStr.Opcode() {{ - setCode("S"); - setBody(new Strval() {{ - setValue(""); - }}); - }}); - - r.setOpcodes(opcodes); + @Override + protected Class getStructClass() { + return SwitchManualStr.class; + } - assertEqualToFullFile(r, "switch_opcodes.bin"); + @Override + protected String getSrcFilename() { + return "switch_opcodes.bin"; } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestTermBytes.java b/spec/java/src/io/kaitai/struct/specwrite/TestTermBytes.java index 565274855..86855d5be 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestTermBytes.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestTermBytes.java @@ -1,17 +1,17 @@ package io.kaitai.struct.specwrite; +import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.TermBytes; import org.testng.annotations.Test; public class TestTermBytes extends CommonSpec { - @Test - public void testTermBytes() throws Exception { - TermBytes r = new TermBytes(); - - r.setS1(new byte[] { 0x66, 0x6f, 0x6f }); - r.setS2(new byte[] { 0x62, 0x61, 0x72 }); - r.setS3(new byte[] { 0x7c, 0x62, 0x61, 0x7a, 0x40 }); + @Override + protected Class getStructClass() { + return TermBytes.class; + } - assertEqualToFile(r, "term_strz.bin"); + @Override + protected String getSrcFilename() { + return "term_strz.bin"; } } From 8732152330e2777bbae0e3d86251977b079982dc Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Sat, 13 Aug 2022 11:45:26 +0200 Subject: [PATCH 032/126] KST translator: add --read-write mode for Java roundtrip tests --- translator/build.sbt | 2 +- .../kaitai/struct/testtranslator/Main.scala | 5 ++ .../testtranslator/TestTranslator.scala | 6 +- .../specgenerators/JavaWriteSG.scala | 82 +++++++++++++++++++ 4 files changed, 93 insertions(+), 2 deletions(-) create mode 100644 translator/src/main/scala/io/kaitai/struct/testtranslator/specgenerators/JavaWriteSG.scala diff --git a/translator/build.sbt b/translator/build.sbt index f063ae51b..96134e48b 100644 --- a/translator/build.sbt +++ b/translator/build.sbt @@ -2,7 +2,7 @@ name := "translator" version := "0.10-SNAPSHOT" -scalaVersion := "2.12.8" +scalaVersion := "2.12.12" resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots" resolvers += Resolver.sonatypeRepo("public") diff --git a/translator/src/main/scala/io/kaitai/struct/testtranslator/Main.scala b/translator/src/main/scala/io/kaitai/struct/testtranslator/Main.scala index 6f0eccf8b..9c08bce90 100644 --- a/translator/src/main/scala/io/kaitai/struct/testtranslator/Main.scala +++ b/translator/src/main/scala/io/kaitai/struct/testtranslator/Main.scala @@ -38,6 +38,7 @@ object Main extends App { case class CLIOptions( srcFiles: Seq[String] = Seq(), targets: Seq[String] = Seq(), + readWrite: Boolean = false, outDir: String = defaultOutDir ) @@ -73,6 +74,10 @@ object Main extends App { } } + opt[Unit]('w', "read-write") action { (_, c) => + c.copy(readWrite = true) + } text("read-write mode") + opt[Unit]("all-specs") action { (_, c) => val dir = new File(specKsDir) val list: Array[String] = dir.list(). diff --git a/translator/src/main/scala/io/kaitai/struct/testtranslator/TestTranslator.scala b/translator/src/main/scala/io/kaitai/struct/testtranslator/TestTranslator.scala index 19b99edc1..ea876c203 100644 --- a/translator/src/main/scala/io/kaitai/struct/testtranslator/TestTranslator.scala +++ b/translator/src/main/scala/io/kaitai/struct/testtranslator/TestTranslator.scala @@ -112,7 +112,11 @@ class TestTranslator(options: CLIOptions) { case "cpp_stl_11" => new CppStlSG(testSpec, provider, CppRuntimeConfig().copyAsCpp11()) case "csharp" => new CSharpSG(testSpec, provider) case "go" => new GoSG(testSpec, provider) - case "java" => new JavaSG(testSpec, provider) + case "java" => if (options.readWrite) { + new JavaWriteSG(testSpec, provider) + } else { + new JavaSG(testSpec, provider) + } case "javascript" => new JavaScriptSG(testSpec, provider) case "lua" => new LuaSG(testSpec, provider) case "nim" => new NimSG(testSpec, provider) diff --git a/translator/src/main/scala/io/kaitai/struct/testtranslator/specgenerators/JavaWriteSG.scala b/translator/src/main/scala/io/kaitai/struct/testtranslator/specgenerators/JavaWriteSG.scala new file mode 100644 index 000000000..2c08be66e --- /dev/null +++ b/translator/src/main/scala/io/kaitai/struct/testtranslator/specgenerators/JavaWriteSG.scala @@ -0,0 +1,82 @@ +package io.kaitai.struct.testtranslator.specgenerators + +import io.kaitai.struct.{ClassTypeProvider, RuntimeConfig} +import io.kaitai.struct.datatype.DataType._ +import io.kaitai.struct.datatype.{DataType, KSError} +import io.kaitai.struct.exprlang.Ast +import io.kaitai.struct.languages.JavaCompiler +import io.kaitai.struct.testtranslator.{Main, TestAssert, TestSpec} +import io.kaitai.struct.translators.JavaTranslator + +class JavaWriteSG(spec: TestSpec, provider: ClassTypeProvider) extends BaseGenerator(spec) { + val config = RuntimeConfig() + val className = JavaCompiler.type2class(spec.id) + val translator = new JavaTranslator(provider, importList) + val compiler = new JavaCompiler(provider, config) + + importList.add("io.kaitai.struct.KaitaiStruct.ReadWrite") + importList.add(s"io.kaitai.struct.testwrite.$className") + + importList.add("org.testng.annotations.Test") + + override def fileName(name: String): String = s"src/io/kaitai/struct/specwrite/Test$className.java" + + override def header(): Unit = { + out.puts(s"public class Test$className extends CommonSpec {") + out.inc + } + + override def runParse(): Unit = { + out.puts("@Override") + out.puts("protected Class getStructClass() {") + out.inc + out.puts(s"return $className.class;") + out.dec + out.puts("}") + out.puts + out.puts("@Override") + out.puts("protected String getSrcFilename() {") + out.inc + out.puts("return \"" + spec.data + "\";") + out.dec + out.puts("}") + } + + override def runParseExpectError(exception: KSError): Unit = { + out.puts("@Override") + out.puts("protected Class getStructClass() {") + out.inc + out.puts("throw new UnsupportedOperationException();") + out.dec + out.puts("}") + out.puts + out.puts("@Override") + out.puts("protected String getSrcFilename() {") + out.inc + out.puts("throw new UnsupportedOperationException();") + out.dec + out.puts("}") + } + + override def footer(): Unit = { + out.dec + out.puts("}") + } + + override def runAsserts(): Unit = {} + + def simpleAssert(check: TestAssert): Unit = ??? + + def nullAssert(actual: Ast.expr): Unit = ??? + + def trueArrayAssert(check: TestAssert, elType: DataType, elts: Seq[Ast.expr]): Unit = ??? + + override def indentStr: String = " " + + override def results: String = { + "// " + AUTOGEN_COMMENT + "\n\n" + + "package io.kaitai.struct.specwrite;\n\n" + + importList.toList.map((x) => s"import $x;").mkString("", "\n", "\n\n") + + out.result + } +} From 80b5da0a88e61aa39766850cd8928350bef8769d Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Sat, 13 Aug 2022 11:47:44 +0200 Subject: [PATCH 033/126] Regen applicable Java read-write tests from KST ...using this command: ``` ./spec_kst_to_all -t java -w --all-specs -f ``` Tests ZlibSurrounded and ZlibWithHeader78 were disabled, because they had been hanging the execution of the test suite. I haven't investigated what the problem is yet, so I can't say more about it at the moment. --- .../struct/specwrite/TestBcdUserTypeBe.java | 20 ++++++++++++++ .../struct/specwrite/TestBcdUserTypeLe.java | 20 ++++++++++++++ .../struct/specwrite/TestBitsByteAligned.java | 20 ++++++++++++++ .../kaitai/struct/specwrite/TestBitsEnum.java | 20 ++++++++++++++ .../specwrite/TestBitsSeqEndianCombo.java | 20 ++++++++++++++ .../specwrite/TestBitsShiftByB32Le.java | 20 ++++++++++++++ .../specwrite/TestBitsShiftByB64Le.java | 20 ++++++++++++++ .../specwrite/TestBitsSignedResB32Be.java | 20 ++++++++++++++ .../specwrite/TestBitsSignedResB32Le.java | 20 ++++++++++++++ .../specwrite/TestBitsSignedShiftB32Le.java | 20 ++++++++++++++ .../specwrite/TestBitsSignedShiftB64Le.java | 20 ++++++++++++++ .../struct/specwrite/TestBitsSimple.java | 3 +++ .../struct/specwrite/TestBitsSimpleLe.java | 20 ++++++++++++++ .../specwrite/TestBitsUnalignedB32Be.java | 20 ++++++++++++++ .../specwrite/TestBitsUnalignedB32Le.java | 20 ++++++++++++++ .../specwrite/TestBitsUnalignedB64Be.java | 20 ++++++++++++++ .../specwrite/TestBitsUnalignedB64Le.java | 20 ++++++++++++++ .../struct/specwrite/TestBufferedStruct.java | 3 +++ .../struct/specwrite/TestCastNested.java | 20 ++++++++++++++ .../struct/specwrite/TestCastToImported.java | 20 ++++++++++++++ .../struct/specwrite/TestCastToTop.java | 20 ++++++++++++++ .../struct/specwrite/TestCombineBool.java | 20 ++++++++++++++ .../struct/specwrite/TestCombineBytes.java | 20 ++++++++++++++ .../struct/specwrite/TestCombineEnum.java | 20 ++++++++++++++ .../struct/specwrite/TestCombineStr.java | 20 ++++++++++++++ .../struct/specwrite/TestDebugSwitchUser.java | 20 ++++++++++++++ .../specwrite/TestDefaultBigEndian.java | 20 ++++++++++++++ .../specwrite/TestDefaultBitEndianMod.java | 20 ++++++++++++++ .../TestDefaultEndianExprException.java | 19 +++++++++++++ .../TestDefaultEndianExprInherited.java | 20 ++++++++++++++ .../specwrite/TestDefaultEndianExprIsBe.java | 20 ++++++++++++++ .../specwrite/TestDefaultEndianExprIsLe.java | 20 ++++++++++++++ .../specwrite/TestDefaultEndianMod.java | 20 ++++++++++++++ .../struct/specwrite/TestDocstrings.java | 20 ++++++++++++++ .../specwrite/TestDocstringsDocref.java | 20 ++++++++++++++ .../specwrite/TestDocstringsDocrefMulti.java | 20 ++++++++++++++ .../io/kaitai/struct/specwrite/TestEnum0.java | 3 +++ .../io/kaitai/struct/specwrite/TestEnum1.java | 20 ++++++++++++++ .../kaitai/struct/specwrite/TestEnumDeep.java | 20 ++++++++++++++ .../specwrite/TestEnumDeepLiterals.java | 20 ++++++++++++++ .../struct/specwrite/TestEnumFancy.java | 20 ++++++++++++++ .../specwrite/TestEnumForUnknownId.java | 20 ++++++++++++++ .../kaitai/struct/specwrite/TestEnumIf.java | 20 ++++++++++++++ .../struct/specwrite/TestEnumImport.java | 20 ++++++++++++++ .../struct/specwrite/TestEnumIntRangeS.java | 20 ++++++++++++++ .../struct/specwrite/TestEnumIntRangeU.java | 20 ++++++++++++++ .../struct/specwrite/TestEnumInvalid.java | 20 ++++++++++++++ .../struct/specwrite/TestEnumLongRangeS.java | 20 ++++++++++++++ .../struct/specwrite/TestEnumLongRangeU.java | 20 ++++++++++++++ .../struct/specwrite/TestEnumNegative.java | 20 ++++++++++++++ .../struct/specwrite/TestEnumOfValueInst.java | 20 ++++++++++++++ .../kaitai/struct/specwrite/TestEnumToI.java | 20 ++++++++++++++ .../specwrite/TestEnumToIClassBorder1.java | 20 ++++++++++++++ .../specwrite/TestEofExceptionBytes.java | 19 +++++++++++++ .../struct/specwrite/TestEofExceptionU4.java | 19 +++++++++++++ .../specwrite/TestEosExceptionBytes.java | 19 +++++++++++++ .../struct/specwrite/TestEosExceptionU4.java | 19 +++++++++++++ .../io/kaitai/struct/specwrite/TestExpr0.java | 20 ++++++++++++++ .../io/kaitai/struct/specwrite/TestExpr1.java | 20 ++++++++++++++ .../io/kaitai/struct/specwrite/TestExpr2.java | 20 ++++++++++++++ .../io/kaitai/struct/specwrite/TestExpr3.java | 20 ++++++++++++++ .../struct/specwrite/TestExprArray.java | 20 ++++++++++++++ .../kaitai/struct/specwrite/TestExprBits.java | 20 ++++++++++++++ .../struct/specwrite/TestExprBytesCmp.java | 20 ++++++++++++++ .../specwrite/TestExprBytesNonLiteral.java | 20 ++++++++++++++ .../struct/specwrite/TestExprBytesOps.java | 20 ++++++++++++++ .../specwrite/TestExprCalcArrayOps.java | 20 ++++++++++++++ .../kaitai/struct/specwrite/TestExprEnum.java | 20 ++++++++++++++ .../struct/specwrite/TestExprIfIntOps.java | 20 ++++++++++++++ .../struct/specwrite/TestExprIntDiv.java | 20 ++++++++++++++ .../struct/specwrite/TestExprIoEof.java | 20 ++++++++++++++ .../struct/specwrite/TestExprIoPos.java | 20 ++++++++++++++ .../kaitai/struct/specwrite/TestExprMod.java | 20 ++++++++++++++ .../struct/specwrite/TestExprOpsParens.java | 20 ++++++++++++++ .../struct/specwrite/TestExprSizeofType0.java | 20 ++++++++++++++ .../struct/specwrite/TestExprSizeofType1.java | 20 ++++++++++++++ .../specwrite/TestExprSizeofValue0.java | 20 ++++++++++++++ .../specwrite/TestExprSizeofValueSized.java | 20 ++++++++++++++ .../specwrite/TestExprStrEncodings.java | 20 ++++++++++++++ .../struct/specwrite/TestExprStrOps.java | 20 ++++++++++++++ .../struct/specwrite/TestFixedContents.java | 20 ++++++++++++++ .../struct/specwrite/TestFixedStruct.java | 20 ++++++++++++++ .../kaitai/struct/specwrite/TestFloatToI.java | 20 ++++++++++++++ .../struct/specwrite/TestFloatingPoints.java | 3 +++ .../struct/specwrite/TestHelloWorld.java | 3 +++ .../struct/specwrite/TestIfInstances.java | 20 ++++++++++++++ .../kaitai/struct/specwrite/TestIfStruct.java | 5 +++- .../kaitai/struct/specwrite/TestIfValues.java | 20 ++++++++++++++ .../kaitai/struct/specwrite/TestImports0.java | 20 ++++++++++++++ .../struct/specwrite/TestImportsAbs.java | 20 ++++++++++++++ .../specwrite/TestImportsCircularA.java | 20 ++++++++++++++ .../struct/specwrite/TestImportsRel1.java | 20 ++++++++++++++ .../struct/specwrite/TestIndexSizes.java | 20 ++++++++++++++ .../struct/specwrite/TestIndexToParamEos.java | 20 ++++++++++++++ .../specwrite/TestIndexToParamExpr.java | 20 ++++++++++++++ .../specwrite/TestIndexToParamUntil.java | 20 ++++++++++++++ .../struct/specwrite/TestInstanceIoUser.java | 20 ++++++++++++++ .../struct/specwrite/TestInstanceStd.java | 20 ++++++++++++++ .../specwrite/TestInstanceStdArray.java | 20 ++++++++++++++ .../specwrite/TestInstanceUserArray.java | 20 ++++++++++++++ .../kaitai/struct/specwrite/TestIntegers.java | 3 +++ .../specwrite/TestIntegersDoubleOverflow.java | 20 ++++++++++++++ .../struct/specwrite/TestIntegersMinMax.java | 20 ++++++++++++++ .../struct/specwrite/TestIoLocalVar.java | 20 ++++++++++++++ .../specwrite/TestJsSignedRightShift.java | 20 ++++++++++++++ .../kaitai/struct/specwrite/TestMetaTags.java | 20 ++++++++++++++ .../kaitai/struct/specwrite/TestMetaXref.java | 20 ++++++++++++++ .../struct/specwrite/TestMultipleUse.java | 20 ++++++++++++++ .../struct/specwrite/TestNavParent.java | 20 ++++++++++++++ .../struct/specwrite/TestNavParent2.java | 20 ++++++++++++++ .../struct/specwrite/TestNavParent3.java | 20 ++++++++++++++ .../struct/specwrite/TestNavParentFalse.java | 20 ++++++++++++++ .../struct/specwrite/TestNavParentFalse2.java | 20 ++++++++++++++ .../specwrite/TestNavParentOverride.java | 20 ++++++++++++++ .../struct/specwrite/TestNavParentSwitch.java | 20 ++++++++++++++ .../specwrite/TestNavParentSwitchCast.java | 20 ++++++++++++++ .../specwrite/TestNavParentVsValueInst.java | 20 ++++++++++++++ .../kaitai/struct/specwrite/TestNavRoot.java | 20 ++++++++++++++ .../struct/specwrite/TestNestedSameName.java | 20 ++++++++++++++ .../struct/specwrite/TestNestedSameName2.java | 20 ++++++++++++++ .../struct/specwrite/TestNestedTypeParam.java | 20 ++++++++++++++ .../struct/specwrite/TestNestedTypes.java | 3 +++ .../struct/specwrite/TestNestedTypes2.java | 20 ++++++++++++++ .../struct/specwrite/TestNestedTypes3.java | 20 ++++++++++++++ .../struct/specwrite/TestNonStandard.java | 20 ++++++++++++++ .../specwrite/TestParamsCallExtraParens.java | 20 ++++++++++++++ .../struct/specwrite/TestParamsCallShort.java | 20 ++++++++++++++ .../struct/specwrite/TestParamsEnum.java | 20 ++++++++++++++ .../specwrite/TestParamsPassArrayInt.java | 20 ++++++++++++++ .../specwrite/TestParamsPassArrayStr.java | 20 ++++++++++++++ .../specwrite/TestParamsPassArrayStruct.java | 20 ++++++++++++++ .../TestParamsPassArrayUsertype.java | 20 ++++++++++++++ .../struct/specwrite/TestParamsPassBool.java | 20 ++++++++++++++ .../specwrite/TestParamsPassStruct.java | 20 ++++++++++++++ .../specwrite/TestParamsPassUsertype.java | 20 ++++++++++++++ .../struct/specwrite/TestPositionAbs.java | 20 ++++++++++++++ .../struct/specwrite/TestPositionInSeq.java | 20 ++++++++++++++ .../struct/specwrite/TestPositionToEnd.java | 20 ++++++++++++++ .../specwrite/TestProcessCoerceBytes.java | 20 ++++++++++++++ .../specwrite/TestProcessCoerceSwitch.java | 20 ++++++++++++++ .../specwrite/TestProcessCoerceUsertype1.java | 20 ++++++++++++++ .../specwrite/TestProcessCoerceUsertype2.java | 20 ++++++++++++++ .../struct/specwrite/TestProcessCustom.java | 20 ++++++++++++++ .../specwrite/TestProcessCustomNoArgs.java | 20 ++++++++++++++ .../specwrite/TestProcessRepeatBytes.java | 20 ++++++++++++++ .../specwrite/TestProcessRepeatUsertype.java | 20 ++++++++++++++ .../specwrite/TestProcessXor4Const.java | 20 ++++++++++++++ .../specwrite/TestProcessXor4Value.java | 20 ++++++++++++++ .../struct/specwrite/TestProcessXorConst.java | 20 ++++++++++++++ .../struct/specwrite/TestProcessXorValue.java | 20 ++++++++++++++ .../struct/specwrite/TestRecursiveOne.java | 20 ++++++++++++++ .../struct/specwrite/TestRepeatEosBit.java | 20 ++++++++++++++ .../struct/specwrite/TestRepeatEosStruct.java | 20 ++++++++++++++ .../struct/specwrite/TestRepeatEosU4.java | 3 +++ .../struct/specwrite/TestRepeatNStruct.java | 3 +++ .../specwrite/TestRepeatNStrzDouble.java | 20 ++++++++++++++ .../TestRepeatUntilCalcArrayType.java | 20 ++++++++++++++ .../specwrite/TestRepeatUntilComplex.java | 20 ++++++++++++++ .../struct/specwrite/TestRepeatUntilS4.java | 20 ++++++++++++++ .../specwrite/TestRepeatUntilSized.java | 20 ++++++++++++++ .../specwrite/TestStrEncodingsDefault.java | 20 ++++++++++++++ .../specwrite/TestStrEncodingsUtf16.java | 20 ++++++++++++++ .../kaitai/struct/specwrite/TestStrEos.java | 3 +++ .../struct/specwrite/TestStrLiterals2.java | 20 ++++++++++++++ .../struct/specwrite/TestStrPadTerm.java | 20 ++++++++++++++ .../struct/specwrite/TestStrPadTermEmpty.java | 20 ++++++++++++++ .../struct/specwrite/TestSwitchBytearray.java | 20 ++++++++++++++ .../struct/specwrite/TestSwitchElseOnly.java | 20 ++++++++++++++ .../struct/specwrite/TestSwitchIntegers.java | 20 ++++++++++++++ .../struct/specwrite/TestSwitchIntegers2.java | 20 ++++++++++++++ .../specwrite/TestSwitchManualEnum.java | 20 ++++++++++++++ .../TestSwitchManualEnumInvalid.java | 20 ++++++++++++++ .../TestSwitchManualEnumInvalidElse.java | 20 ++++++++++++++ .../struct/specwrite/TestSwitchManualInt.java | 3 +++ .../specwrite/TestSwitchManualIntElse.java | 20 ++++++++++++++ .../specwrite/TestSwitchManualIntSize.java | 20 ++++++++++++++ .../TestSwitchManualIntSizeElse.java | 20 ++++++++++++++ .../specwrite/TestSwitchManualIntSizeEos.java | 20 ++++++++++++++ .../struct/specwrite/TestSwitchManualStr.java | 3 +++ .../specwrite/TestSwitchManualStrElse.java | 20 ++++++++++++++ .../specwrite/TestSwitchMultiBoolOps.java | 20 ++++++++++++++ .../specwrite/TestSwitchRepeatExpr.java | 20 ++++++++++++++ .../TestSwitchRepeatExprInvalid.java | 20 ++++++++++++++ .../struct/specwrite/TestTermBytes.java | 3 +++ .../kaitai/struct/specwrite/TestTermStrz.java | 20 ++++++++++++++ .../struct/specwrite/TestTermU1Val.java | 20 ++++++++++++++ .../struct/specwrite/TestTsPacketHeader.java | 20 ++++++++++++++ .../struct/specwrite/TestTypeIntUnaryOp.java | 20 ++++++++++++++ .../struct/specwrite/TestTypeTernary.java | 20 ++++++++++++++ .../specwrite/TestTypeTernary2ndFalsy.java | 20 ++++++++++++++ .../kaitai/struct/specwrite/TestUserType.java | 20 ++++++++++++++ .../specwrite/TestValidEqStrEncodings.java | 20 ++++++++++++++ .../specwrite/TestValidFailAnyofInt.java | 19 +++++++++++++ .../specwrite/TestValidFailContents.java | 19 +++++++++++++ .../specwrite/TestValidFailEqBytes.java | 19 +++++++++++++ .../struct/specwrite/TestValidFailEqInt.java | 19 +++++++++++++ .../struct/specwrite/TestValidFailEqStr.java | 19 +++++++++++++ .../struct/specwrite/TestValidFailExpr.java | 19 +++++++++++++ .../struct/specwrite/TestValidFailInst.java | 19 +++++++++++++ .../struct/specwrite/TestValidFailMaxInt.java | 19 +++++++++++++ .../struct/specwrite/TestValidFailMinInt.java | 19 +++++++++++++ .../specwrite/TestValidFailRangeBytes.java | 19 +++++++++++++ .../specwrite/TestValidFailRangeFloat.java | 19 +++++++++++++ .../specwrite/TestValidFailRangeInt.java | 19 +++++++++++++ .../specwrite/TestValidFailRangeStr.java | 19 +++++++++++++ .../struct/specwrite/TestValidLong.java | 20 ++++++++++++++ .../specwrite/TestValidNotParsedIf.java | 20 ++++++++++++++ .../struct/specwrite/TestValidOptionalId.java | 20 ++++++++++++++ .../struct/specwrite/TestValidShort.java | 20 ++++++++++++++ .../struct/specwrite/TestValidSwitch.java | 20 ++++++++++++++ .../kaitai/struct/specwrite/TestYamlInts.java | 20 ++++++++++++++ .../struct/specwrite/TestZlibSurrounded.java | 27 +++++++++++++++++++ .../specwrite/TestZlibWithHeader78.java | 27 +++++++++++++++++++ 213 files changed, 4019 insertions(+), 1 deletion(-) create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestBcdUserTypeBe.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestBcdUserTypeLe.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestBitsByteAligned.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestBitsEnum.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestBitsSeqEndianCombo.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestBitsShiftByB32Le.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestBitsShiftByB64Le.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestBitsSignedResB32Be.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestBitsSignedResB32Le.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestBitsSignedShiftB32Le.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestBitsSignedShiftB64Le.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestBitsSimpleLe.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestBitsUnalignedB32Be.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestBitsUnalignedB32Le.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestBitsUnalignedB64Be.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestBitsUnalignedB64Le.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestCastNested.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestCastToImported.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestCastToTop.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestCombineBool.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestCombineBytes.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestCombineEnum.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestCombineStr.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestDebugSwitchUser.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestDefaultBigEndian.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestDefaultBitEndianMod.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestDefaultEndianExprException.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestDefaultEndianExprInherited.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestDefaultEndianExprIsBe.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestDefaultEndianExprIsLe.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestDefaultEndianMod.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestDocstrings.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestDocstringsDocref.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestDocstringsDocrefMulti.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestEnum1.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestEnumDeep.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestEnumDeepLiterals.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestEnumFancy.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestEnumForUnknownId.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestEnumIf.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestEnumImport.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestEnumIntRangeS.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestEnumIntRangeU.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestEnumInvalid.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestEnumLongRangeS.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestEnumLongRangeU.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestEnumNegative.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestEnumOfValueInst.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestEnumToI.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestEnumToIClassBorder1.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBytes.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionU4.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestEosExceptionBytes.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestEosExceptionU4.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestExpr0.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestExpr1.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestExpr2.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestExpr3.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestExprArray.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestExprBits.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestExprBytesCmp.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestExprBytesNonLiteral.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestExprBytesOps.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestExprCalcArrayOps.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestExprEnum.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestExprIfIntOps.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestExprIntDiv.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestExprIoEof.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestExprIoPos.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestExprMod.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestExprOpsParens.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestExprSizeofType0.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestExprSizeofType1.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestExprSizeofValue0.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestExprSizeofValueSized.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestExprStrEncodings.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestExprStrOps.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestFixedContents.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestFixedStruct.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestFloatToI.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestIfInstances.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestIfValues.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestImports0.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestImportsAbs.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestImportsCircularA.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestImportsRel1.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestIndexSizes.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestIndexToParamEos.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestIndexToParamExpr.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestIndexToParamUntil.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestInstanceIoUser.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestInstanceStd.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestInstanceStdArray.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestInstanceUserArray.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestIntegersDoubleOverflow.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestIntegersMinMax.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestIoLocalVar.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestJsSignedRightShift.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestMetaTags.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestMetaXref.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestMultipleUse.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestNavParent.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestNavParent2.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestNavParent3.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestNavParentFalse.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestNavParentFalse2.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestNavParentOverride.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestNavParentSwitch.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestNavParentSwitchCast.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestNavParentVsValueInst.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestNavRoot.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestNestedSameName.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestNestedSameName2.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestNestedTypeParam.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestNestedTypes2.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestNestedTypes3.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestNonStandard.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestParamsCallExtraParens.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestParamsCallShort.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestParamsEnum.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestParamsPassArrayInt.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestParamsPassArrayStr.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestParamsPassArrayStruct.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestParamsPassArrayUsertype.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestParamsPassBool.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestParamsPassStruct.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestParamsPassUsertype.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestPositionAbs.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestPositionInSeq.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestPositionToEnd.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestProcessCoerceBytes.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestProcessCoerceSwitch.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestProcessCoerceUsertype1.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestProcessCoerceUsertype2.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestProcessCustom.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestProcessCustomNoArgs.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestProcessRepeatBytes.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestProcessRepeatUsertype.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestProcessXor4Const.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestProcessXor4Value.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestProcessXorConst.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestProcessXorValue.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestRecursiveOne.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosBit.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosStruct.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStrzDouble.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilCalcArrayType.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilComplex.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilS4.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilSized.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestStrEncodingsDefault.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestStrEncodingsUtf16.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestStrLiterals2.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestStrPadTerm.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestStrPadTermEmpty.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestSwitchBytearray.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestSwitchElseOnly.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestSwitchIntegers.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestSwitchIntegers2.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualEnum.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualEnumInvalid.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualEnumInvalidElse.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualIntElse.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualIntSize.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualIntSizeElse.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualIntSizeEos.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualStrElse.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestSwitchMultiBoolOps.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestSwitchRepeatExpr.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestSwitchRepeatExprInvalid.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestTermStrz.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestTermU1Val.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestTsPacketHeader.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestTypeIntUnaryOp.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestTypeTernary.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestTypeTernary2ndFalsy.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestUserType.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestValidEqStrEncodings.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestValidFailAnyofInt.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestValidFailContents.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestValidFailEqBytes.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestValidFailEqInt.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestValidFailEqStr.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestValidFailExpr.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestValidFailInst.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestValidFailMaxInt.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestValidFailMinInt.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestValidFailRangeBytes.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestValidFailRangeFloat.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestValidFailRangeInt.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestValidFailRangeStr.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestValidLong.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestValidNotParsedIf.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestValidOptionalId.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestValidShort.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestValidSwitch.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestYamlInts.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestZlibSurrounded.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestZlibWithHeader78.java diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBcdUserTypeBe.java b/spec/java/src/io/kaitai/struct/specwrite/TestBcdUserTypeBe.java new file mode 100644 index 000000000..679420520 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBcdUserTypeBe.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.BcdUserTypeBe; +import org.testng.annotations.Test; + +public class TestBcdUserTypeBe extends CommonSpec { + @Override + protected Class getStructClass() { + return BcdUserTypeBe.class; + } + + @Override + protected String getSrcFilename() { + return "bcd_user_type_be.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBcdUserTypeLe.java b/spec/java/src/io/kaitai/struct/specwrite/TestBcdUserTypeLe.java new file mode 100644 index 000000000..aa3d277b3 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBcdUserTypeLe.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.BcdUserTypeLe; +import org.testng.annotations.Test; + +public class TestBcdUserTypeLe extends CommonSpec { + @Override + protected Class getStructClass() { + return BcdUserTypeLe.class; + } + + @Override + protected String getSrcFilename() { + return "bcd_user_type_le.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBitsByteAligned.java b/spec/java/src/io/kaitai/struct/specwrite/TestBitsByteAligned.java new file mode 100644 index 000000000..32f770ba6 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBitsByteAligned.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.BitsByteAligned; +import org.testng.annotations.Test; + +public class TestBitsByteAligned extends CommonSpec { + @Override + protected Class getStructClass() { + return BitsByteAligned.class; + } + + @Override + protected String getSrcFilename() { + return "fixed_struct.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBitsEnum.java b/spec/java/src/io/kaitai/struct/specwrite/TestBitsEnum.java new file mode 100644 index 000000000..a7b44c002 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBitsEnum.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.BitsEnum; +import org.testng.annotations.Test; + +public class TestBitsEnum extends CommonSpec { + @Override + protected Class getStructClass() { + return BitsEnum.class; + } + + @Override + protected String getSrcFilename() { + return "fixed_struct.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBitsSeqEndianCombo.java b/spec/java/src/io/kaitai/struct/specwrite/TestBitsSeqEndianCombo.java new file mode 100644 index 000000000..27d3fef58 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBitsSeqEndianCombo.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.BitsSeqEndianCombo; +import org.testng.annotations.Test; + +public class TestBitsSeqEndianCombo extends CommonSpec { + @Override + protected Class getStructClass() { + return BitsSeqEndianCombo.class; + } + + @Override + protected String getSrcFilename() { + return "process_xor_4.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBitsShiftByB32Le.java b/spec/java/src/io/kaitai/struct/specwrite/TestBitsShiftByB32Le.java new file mode 100644 index 000000000..cecc5fa3b --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBitsShiftByB32Le.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.BitsShiftByB32Le; +import org.testng.annotations.Test; + +public class TestBitsShiftByB32Le extends CommonSpec { + @Override + protected Class getStructClass() { + return BitsShiftByB32Le.class; + } + + @Override + protected String getSrcFilename() { + return "bits_shift_by_b32_le.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBitsShiftByB64Le.java b/spec/java/src/io/kaitai/struct/specwrite/TestBitsShiftByB64Le.java new file mode 100644 index 000000000..e0bf66980 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBitsShiftByB64Le.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.BitsShiftByB64Le; +import org.testng.annotations.Test; + +public class TestBitsShiftByB64Le extends CommonSpec { + @Override + protected Class getStructClass() { + return BitsShiftByB64Le.class; + } + + @Override + protected String getSrcFilename() { + return "bits_shift_by_b64_le.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBitsSignedResB32Be.java b/spec/java/src/io/kaitai/struct/specwrite/TestBitsSignedResB32Be.java new file mode 100644 index 000000000..f0fd20517 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBitsSignedResB32Be.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.BitsSignedResB32Be; +import org.testng.annotations.Test; + +public class TestBitsSignedResB32Be extends CommonSpec { + @Override + protected Class getStructClass() { + return BitsSignedResB32Be.class; + } + + @Override + protected String getSrcFilename() { + return "bits_shift_by_b32_le.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBitsSignedResB32Le.java b/spec/java/src/io/kaitai/struct/specwrite/TestBitsSignedResB32Le.java new file mode 100644 index 000000000..a397112b0 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBitsSignedResB32Le.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.BitsSignedResB32Le; +import org.testng.annotations.Test; + +public class TestBitsSignedResB32Le extends CommonSpec { + @Override + protected Class getStructClass() { + return BitsSignedResB32Le.class; + } + + @Override + protected String getSrcFilename() { + return "bits_shift_by_b32_le.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBitsSignedShiftB32Le.java b/spec/java/src/io/kaitai/struct/specwrite/TestBitsSignedShiftB32Le.java new file mode 100644 index 000000000..2dcd352a7 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBitsSignedShiftB32Le.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.BitsSignedShiftB32Le; +import org.testng.annotations.Test; + +public class TestBitsSignedShiftB32Le extends CommonSpec { + @Override + protected Class getStructClass() { + return BitsSignedShiftB32Le.class; + } + + @Override + protected String getSrcFilename() { + return "bits_signed_shift_b32_le.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBitsSignedShiftB64Le.java b/spec/java/src/io/kaitai/struct/specwrite/TestBitsSignedShiftB64Le.java new file mode 100644 index 000000000..7482daf26 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBitsSignedShiftB64Le.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.BitsSignedShiftB64Le; +import org.testng.annotations.Test; + +public class TestBitsSignedShiftB64Le extends CommonSpec { + @Override + protected Class getStructClass() { + return BitsSignedShiftB64Le.class; + } + + @Override + protected String getSrcFilename() { + return "bits_signed_shift_b64_le.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBitsSimple.java b/spec/java/src/io/kaitai/struct/specwrite/TestBitsSimple.java index 18b424cea..1cd67cdad 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestBitsSimple.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBitsSimple.java @@ -1,3 +1,5 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + package io.kaitai.struct.specwrite; import io.kaitai.struct.KaitaiStruct.ReadWrite; @@ -14,4 +16,5 @@ protected Class getStructClass() { protected String getSrcFilename() { return "fixed_struct.bin"; } + } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBitsSimpleLe.java b/spec/java/src/io/kaitai/struct/specwrite/TestBitsSimpleLe.java new file mode 100644 index 000000000..f734b0dbd --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBitsSimpleLe.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.BitsSimpleLe; +import org.testng.annotations.Test; + +public class TestBitsSimpleLe extends CommonSpec { + @Override + protected Class getStructClass() { + return BitsSimpleLe.class; + } + + @Override + protected String getSrcFilename() { + return "fixed_struct.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBitsUnalignedB32Be.java b/spec/java/src/io/kaitai/struct/specwrite/TestBitsUnalignedB32Be.java new file mode 100644 index 000000000..411d71fdb --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBitsUnalignedB32Be.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.BitsUnalignedB32Be; +import org.testng.annotations.Test; + +public class TestBitsUnalignedB32Be extends CommonSpec { + @Override + protected Class getStructClass() { + return BitsUnalignedB32Be.class; + } + + @Override + protected String getSrcFilename() { + return "process_xor_4.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBitsUnalignedB32Le.java b/spec/java/src/io/kaitai/struct/specwrite/TestBitsUnalignedB32Le.java new file mode 100644 index 000000000..fe01de3e7 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBitsUnalignedB32Le.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.BitsUnalignedB32Le; +import org.testng.annotations.Test; + +public class TestBitsUnalignedB32Le extends CommonSpec { + @Override + protected Class getStructClass() { + return BitsUnalignedB32Le.class; + } + + @Override + protected String getSrcFilename() { + return "process_xor_4.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBitsUnalignedB64Be.java b/spec/java/src/io/kaitai/struct/specwrite/TestBitsUnalignedB64Be.java new file mode 100644 index 000000000..8a09359cf --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBitsUnalignedB64Be.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.BitsUnalignedB64Be; +import org.testng.annotations.Test; + +public class TestBitsUnalignedB64Be extends CommonSpec { + @Override + protected Class getStructClass() { + return BitsUnalignedB64Be.class; + } + + @Override + protected String getSrcFilename() { + return "process_xor_4.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBitsUnalignedB64Le.java b/spec/java/src/io/kaitai/struct/specwrite/TestBitsUnalignedB64Le.java new file mode 100644 index 000000000..9e3fd2f97 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBitsUnalignedB64Le.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.BitsUnalignedB64Le; +import org.testng.annotations.Test; + +public class TestBitsUnalignedB64Le extends CommonSpec { + @Override + protected Class getStructClass() { + return BitsUnalignedB64Le.class; + } + + @Override + protected String getSrcFilename() { + return "process_xor_4.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBufferedStruct.java b/spec/java/src/io/kaitai/struct/specwrite/TestBufferedStruct.java index 26752a6f2..ae498e291 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestBufferedStruct.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBufferedStruct.java @@ -1,3 +1,5 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + package io.kaitai.struct.specwrite; import io.kaitai.struct.KaitaiStruct.ReadWrite; @@ -14,4 +16,5 @@ protected Class getStructClass() { protected String getSrcFilename() { return "buffered_struct.bin"; } + } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestCastNested.java b/spec/java/src/io/kaitai/struct/specwrite/TestCastNested.java new file mode 100644 index 000000000..3dbe2a0f0 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestCastNested.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.CastNested; +import org.testng.annotations.Test; + +public class TestCastNested extends CommonSpec { + @Override + protected Class getStructClass() { + return CastNested.class; + } + + @Override + protected String getSrcFilename() { + return "switch_opcodes.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestCastToImported.java b/spec/java/src/io/kaitai/struct/specwrite/TestCastToImported.java new file mode 100644 index 000000000..afb8b37e0 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestCastToImported.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.CastToImported; +import org.testng.annotations.Test; + +public class TestCastToImported extends CommonSpec { + @Override + protected Class getStructClass() { + return CastToImported.class; + } + + @Override + protected String getSrcFilename() { + return "fixed_struct.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestCastToTop.java b/spec/java/src/io/kaitai/struct/specwrite/TestCastToTop.java new file mode 100644 index 000000000..2f3538c90 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestCastToTop.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.CastToTop; +import org.testng.annotations.Test; + +public class TestCastToTop extends CommonSpec { + @Override + protected Class getStructClass() { + return CastToTop.class; + } + + @Override + protected String getSrcFilename() { + return "fixed_struct.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestCombineBool.java b/spec/java/src/io/kaitai/struct/specwrite/TestCombineBool.java new file mode 100644 index 000000000..9278f1972 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestCombineBool.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.CombineBool; +import org.testng.annotations.Test; + +public class TestCombineBool extends CommonSpec { + @Override + protected Class getStructClass() { + return CombineBool.class; + } + + @Override + protected String getSrcFilename() { + return "enum_negative.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestCombineBytes.java b/spec/java/src/io/kaitai/struct/specwrite/TestCombineBytes.java new file mode 100644 index 000000000..41d6b8d9b --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestCombineBytes.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.CombineBytes; +import org.testng.annotations.Test; + +public class TestCombineBytes extends CommonSpec { + @Override + protected Class getStructClass() { + return CombineBytes.class; + } + + @Override + protected String getSrcFilename() { + return "term_strz.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestCombineEnum.java b/spec/java/src/io/kaitai/struct/specwrite/TestCombineEnum.java new file mode 100644 index 000000000..fe703127d --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestCombineEnum.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.CombineEnum; +import org.testng.annotations.Test; + +public class TestCombineEnum extends CommonSpec { + @Override + protected Class getStructClass() { + return CombineEnum.class; + } + + @Override + protected String getSrcFilename() { + return "enum_0.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestCombineStr.java b/spec/java/src/io/kaitai/struct/specwrite/TestCombineStr.java new file mode 100644 index 000000000..e1000d69c --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestCombineStr.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.CombineStr; +import org.testng.annotations.Test; + +public class TestCombineStr extends CommonSpec { + @Override + protected Class getStructClass() { + return CombineStr.class; + } + + @Override + protected String getSrcFilename() { + return "term_strz.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestDebugSwitchUser.java b/spec/java/src/io/kaitai/struct/specwrite/TestDebugSwitchUser.java new file mode 100644 index 000000000..74c825860 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestDebugSwitchUser.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.DebugSwitchUser; +import org.testng.annotations.Test; + +public class TestDebugSwitchUser extends CommonSpec { + @Override + protected Class getStructClass() { + return DebugSwitchUser.class; + } + + @Override + protected String getSrcFilename() { + return "nav_parent_switch.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestDefaultBigEndian.java b/spec/java/src/io/kaitai/struct/specwrite/TestDefaultBigEndian.java new file mode 100644 index 000000000..3c993f97b --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestDefaultBigEndian.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.DefaultBigEndian; +import org.testng.annotations.Test; + +public class TestDefaultBigEndian extends CommonSpec { + @Override + protected Class getStructClass() { + return DefaultBigEndian.class; + } + + @Override + protected String getSrcFilename() { + return "enum_0.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestDefaultBitEndianMod.java b/spec/java/src/io/kaitai/struct/specwrite/TestDefaultBitEndianMod.java new file mode 100644 index 000000000..bd94d41e3 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestDefaultBitEndianMod.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.DefaultBitEndianMod; +import org.testng.annotations.Test; + +public class TestDefaultBitEndianMod extends CommonSpec { + @Override + protected Class getStructClass() { + return DefaultBitEndianMod.class; + } + + @Override + protected String getSrcFilename() { + return "fixed_struct.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestDefaultEndianExprException.java b/spec/java/src/io/kaitai/struct/specwrite/TestDefaultEndianExprException.java new file mode 100644 index 000000000..b2fadb476 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestDefaultEndianExprException.java @@ -0,0 +1,19 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.DefaultEndianExprException; +import org.testng.annotations.Test; + +public class TestDefaultEndianExprException extends CommonSpec { + @Override + protected Class getStructClass() { + throw new UnsupportedOperationException(); + } + + @Override + protected String getSrcFilename() { + throw new UnsupportedOperationException(); + } +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestDefaultEndianExprInherited.java b/spec/java/src/io/kaitai/struct/specwrite/TestDefaultEndianExprInherited.java new file mode 100644 index 000000000..67fbc9e86 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestDefaultEndianExprInherited.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.DefaultEndianExprInherited; +import org.testng.annotations.Test; + +public class TestDefaultEndianExprInherited extends CommonSpec { + @Override + protected Class getStructClass() { + return DefaultEndianExprInherited.class; + } + + @Override + protected String getSrcFilename() { + return "endian_expr.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestDefaultEndianExprIsBe.java b/spec/java/src/io/kaitai/struct/specwrite/TestDefaultEndianExprIsBe.java new file mode 100644 index 000000000..ff399b3a2 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestDefaultEndianExprIsBe.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.DefaultEndianExprIsBe; +import org.testng.annotations.Test; + +public class TestDefaultEndianExprIsBe extends CommonSpec { + @Override + protected Class getStructClass() { + return DefaultEndianExprIsBe.class; + } + + @Override + protected String getSrcFilename() { + return "endian_expr.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestDefaultEndianExprIsLe.java b/spec/java/src/io/kaitai/struct/specwrite/TestDefaultEndianExprIsLe.java new file mode 100644 index 000000000..88ec4502e --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestDefaultEndianExprIsLe.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.DefaultEndianExprIsLe; +import org.testng.annotations.Test; + +public class TestDefaultEndianExprIsLe extends CommonSpec { + @Override + protected Class getStructClass() { + return DefaultEndianExprIsLe.class; + } + + @Override + protected String getSrcFilename() { + return "endian_expr.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestDefaultEndianMod.java b/spec/java/src/io/kaitai/struct/specwrite/TestDefaultEndianMod.java new file mode 100644 index 000000000..1618f424f --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestDefaultEndianMod.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.DefaultEndianMod; +import org.testng.annotations.Test; + +public class TestDefaultEndianMod extends CommonSpec { + @Override + protected Class getStructClass() { + return DefaultEndianMod.class; + } + + @Override + protected String getSrcFilename() { + return "fixed_struct.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestDocstrings.java b/spec/java/src/io/kaitai/struct/specwrite/TestDocstrings.java new file mode 100644 index 000000000..4a015ac6d --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestDocstrings.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.Docstrings; +import org.testng.annotations.Test; + +public class TestDocstrings extends CommonSpec { + @Override + protected Class getStructClass() { + return Docstrings.class; + } + + @Override + protected String getSrcFilename() { + return "fixed_struct.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestDocstringsDocref.java b/spec/java/src/io/kaitai/struct/specwrite/TestDocstringsDocref.java new file mode 100644 index 000000000..56f09ebb4 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestDocstringsDocref.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.DocstringsDocref; +import org.testng.annotations.Test; + +public class TestDocstringsDocref extends CommonSpec { + @Override + protected Class getStructClass() { + return DocstringsDocref.class; + } + + @Override + protected String getSrcFilename() { + return "fixed_struct.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestDocstringsDocrefMulti.java b/spec/java/src/io/kaitai/struct/specwrite/TestDocstringsDocrefMulti.java new file mode 100644 index 000000000..388af735d --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestDocstringsDocrefMulti.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.DocstringsDocrefMulti; +import org.testng.annotations.Test; + +public class TestDocstringsDocrefMulti extends CommonSpec { + @Override + protected Class getStructClass() { + return DocstringsDocrefMulti.class; + } + + @Override + protected String getSrcFilename() { + return "fixed_struct.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEnum0.java b/spec/java/src/io/kaitai/struct/specwrite/TestEnum0.java index bd1a557b7..06d3d69ae 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestEnum0.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEnum0.java @@ -1,3 +1,5 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + package io.kaitai.struct.specwrite; import io.kaitai.struct.KaitaiStruct.ReadWrite; @@ -14,4 +16,5 @@ protected Class getStructClass() { protected String getSrcFilename() { return "enum_0.bin"; } + } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEnum1.java b/spec/java/src/io/kaitai/struct/specwrite/TestEnum1.java new file mode 100644 index 000000000..457b79a73 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEnum1.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.Enum1; +import org.testng.annotations.Test; + +public class TestEnum1 extends CommonSpec { + @Override + protected Class getStructClass() { + return Enum1.class; + } + + @Override + protected String getSrcFilename() { + return "enum_0.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEnumDeep.java b/spec/java/src/io/kaitai/struct/specwrite/TestEnumDeep.java new file mode 100644 index 000000000..d7a6480dc --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEnumDeep.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.EnumDeep; +import org.testng.annotations.Test; + +public class TestEnumDeep extends CommonSpec { + @Override + protected Class getStructClass() { + return EnumDeep.class; + } + + @Override + protected String getSrcFilename() { + return "enum_0.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEnumDeepLiterals.java b/spec/java/src/io/kaitai/struct/specwrite/TestEnumDeepLiterals.java new file mode 100644 index 000000000..339dc9211 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEnumDeepLiterals.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.EnumDeepLiterals; +import org.testng.annotations.Test; + +public class TestEnumDeepLiterals extends CommonSpec { + @Override + protected Class getStructClass() { + return EnumDeepLiterals.class; + } + + @Override + protected String getSrcFilename() { + return "enum_0.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEnumFancy.java b/spec/java/src/io/kaitai/struct/specwrite/TestEnumFancy.java new file mode 100644 index 000000000..fc231e140 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEnumFancy.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.EnumFancy; +import org.testng.annotations.Test; + +public class TestEnumFancy extends CommonSpec { + @Override + protected Class getStructClass() { + return EnumFancy.class; + } + + @Override + protected String getSrcFilename() { + return "enum_0.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEnumForUnknownId.java b/spec/java/src/io/kaitai/struct/specwrite/TestEnumForUnknownId.java new file mode 100644 index 000000000..170f4b7d9 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEnumForUnknownId.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.EnumForUnknownId; +import org.testng.annotations.Test; + +public class TestEnumForUnknownId extends CommonSpec { + @Override + protected Class getStructClass() { + return EnumForUnknownId.class; + } + + @Override + protected String getSrcFilename() { + return "fixed_struct.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEnumIf.java b/spec/java/src/io/kaitai/struct/specwrite/TestEnumIf.java new file mode 100644 index 000000000..f6fd36c72 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEnumIf.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.EnumIf; +import org.testng.annotations.Test; + +public class TestEnumIf extends CommonSpec { + @Override + protected Class getStructClass() { + return EnumIf.class; + } + + @Override + protected String getSrcFilename() { + return "if_struct.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEnumImport.java b/spec/java/src/io/kaitai/struct/specwrite/TestEnumImport.java new file mode 100644 index 000000000..6e78e7d61 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEnumImport.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.EnumImport; +import org.testng.annotations.Test; + +public class TestEnumImport extends CommonSpec { + @Override + protected Class getStructClass() { + return EnumImport.class; + } + + @Override + protected String getSrcFilename() { + return "enum_0.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEnumIntRangeS.java b/spec/java/src/io/kaitai/struct/specwrite/TestEnumIntRangeS.java new file mode 100644 index 000000000..a0dcac90f --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEnumIntRangeS.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.EnumIntRangeS; +import org.testng.annotations.Test; + +public class TestEnumIntRangeS extends CommonSpec { + @Override + protected Class getStructClass() { + return EnumIntRangeS.class; + } + + @Override + protected String getSrcFilename() { + return "enum_int_range_s.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEnumIntRangeU.java b/spec/java/src/io/kaitai/struct/specwrite/TestEnumIntRangeU.java new file mode 100644 index 000000000..8cd090dd7 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEnumIntRangeU.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.EnumIntRangeU; +import org.testng.annotations.Test; + +public class TestEnumIntRangeU extends CommonSpec { + @Override + protected Class getStructClass() { + return EnumIntRangeU.class; + } + + @Override + protected String getSrcFilename() { + return "enum_int_range_u.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEnumInvalid.java b/spec/java/src/io/kaitai/struct/specwrite/TestEnumInvalid.java new file mode 100644 index 000000000..b4963b06c --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEnumInvalid.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.EnumInvalid; +import org.testng.annotations.Test; + +public class TestEnumInvalid extends CommonSpec { + @Override + protected Class getStructClass() { + return EnumInvalid.class; + } + + @Override + protected String getSrcFilename() { + return "term_strz.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEnumLongRangeS.java b/spec/java/src/io/kaitai/struct/specwrite/TestEnumLongRangeS.java new file mode 100644 index 000000000..300463caf --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEnumLongRangeS.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.EnumLongRangeS; +import org.testng.annotations.Test; + +public class TestEnumLongRangeS extends CommonSpec { + @Override + protected Class getStructClass() { + return EnumLongRangeS.class; + } + + @Override + protected String getSrcFilename() { + return "enum_long_range_s.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEnumLongRangeU.java b/spec/java/src/io/kaitai/struct/specwrite/TestEnumLongRangeU.java new file mode 100644 index 000000000..1c79767cd --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEnumLongRangeU.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.EnumLongRangeU; +import org.testng.annotations.Test; + +public class TestEnumLongRangeU extends CommonSpec { + @Override + protected Class getStructClass() { + return EnumLongRangeU.class; + } + + @Override + protected String getSrcFilename() { + return "enum_long_range_u.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEnumNegative.java b/spec/java/src/io/kaitai/struct/specwrite/TestEnumNegative.java new file mode 100644 index 000000000..3aec4e70f --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEnumNegative.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.EnumNegative; +import org.testng.annotations.Test; + +public class TestEnumNegative extends CommonSpec { + @Override + protected Class getStructClass() { + return EnumNegative.class; + } + + @Override + protected String getSrcFilename() { + return "enum_negative.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEnumOfValueInst.java b/spec/java/src/io/kaitai/struct/specwrite/TestEnumOfValueInst.java new file mode 100644 index 000000000..c86cc9b68 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEnumOfValueInst.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.EnumOfValueInst; +import org.testng.annotations.Test; + +public class TestEnumOfValueInst extends CommonSpec { + @Override + protected Class getStructClass() { + return EnumOfValueInst.class; + } + + @Override + protected String getSrcFilename() { + return "enum_0.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEnumToI.java b/spec/java/src/io/kaitai/struct/specwrite/TestEnumToI.java new file mode 100644 index 000000000..58f1bcdc8 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEnumToI.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.EnumToI; +import org.testng.annotations.Test; + +public class TestEnumToI extends CommonSpec { + @Override + protected Class getStructClass() { + return EnumToI.class; + } + + @Override + protected String getSrcFilename() { + return "enum_0.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEnumToIClassBorder1.java b/spec/java/src/io/kaitai/struct/specwrite/TestEnumToIClassBorder1.java new file mode 100644 index 000000000..acb065c0d --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEnumToIClassBorder1.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.EnumToIClassBorder1; +import org.testng.annotations.Test; + +public class TestEnumToIClassBorder1 extends CommonSpec { + @Override + protected Class getStructClass() { + return EnumToIClassBorder1.class; + } + + @Override + protected String getSrcFilename() { + return "enum_0.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBytes.java b/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBytes.java new file mode 100644 index 000000000..a35019466 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBytes.java @@ -0,0 +1,19 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.EofExceptionBytes; +import org.testng.annotations.Test; + +public class TestEofExceptionBytes extends CommonSpec { + @Override + protected Class getStructClass() { + throw new UnsupportedOperationException(); + } + + @Override + protected String getSrcFilename() { + throw new UnsupportedOperationException(); + } +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionU4.java b/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionU4.java new file mode 100644 index 000000000..28b19afab --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionU4.java @@ -0,0 +1,19 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.EofExceptionU4; +import org.testng.annotations.Test; + +public class TestEofExceptionU4 extends CommonSpec { + @Override + protected Class getStructClass() { + throw new UnsupportedOperationException(); + } + + @Override + protected String getSrcFilename() { + throw new UnsupportedOperationException(); + } +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEosExceptionBytes.java b/spec/java/src/io/kaitai/struct/specwrite/TestEosExceptionBytes.java new file mode 100644 index 000000000..b87359522 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEosExceptionBytes.java @@ -0,0 +1,19 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.EosExceptionBytes; +import org.testng.annotations.Test; + +public class TestEosExceptionBytes extends CommonSpec { + @Override + protected Class getStructClass() { + throw new UnsupportedOperationException(); + } + + @Override + protected String getSrcFilename() { + throw new UnsupportedOperationException(); + } +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEosExceptionU4.java b/spec/java/src/io/kaitai/struct/specwrite/TestEosExceptionU4.java new file mode 100644 index 000000000..4384684fe --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEosExceptionU4.java @@ -0,0 +1,19 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.EosExceptionU4; +import org.testng.annotations.Test; + +public class TestEosExceptionU4 extends CommonSpec { + @Override + protected Class getStructClass() { + throw new UnsupportedOperationException(); + } + + @Override + protected String getSrcFilename() { + throw new UnsupportedOperationException(); + } +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestExpr0.java b/spec/java/src/io/kaitai/struct/specwrite/TestExpr0.java new file mode 100644 index 000000000..eff9eae11 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestExpr0.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.Expr0; +import org.testng.annotations.Test; + +public class TestExpr0 extends CommonSpec { + @Override + protected Class getStructClass() { + return Expr0.class; + } + + @Override + protected String getSrcFilename() { + return "str_encodings.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestExpr1.java b/spec/java/src/io/kaitai/struct/specwrite/TestExpr1.java new file mode 100644 index 000000000..97c4cdf23 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestExpr1.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.Expr1; +import org.testng.annotations.Test; + +public class TestExpr1 extends CommonSpec { + @Override + protected Class getStructClass() { + return Expr1.class; + } + + @Override + protected String getSrcFilename() { + return "str_encodings.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestExpr2.java b/spec/java/src/io/kaitai/struct/specwrite/TestExpr2.java new file mode 100644 index 000000000..3887624a2 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestExpr2.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.Expr2; +import org.testng.annotations.Test; + +public class TestExpr2 extends CommonSpec { + @Override + protected Class getStructClass() { + return Expr2.class; + } + + @Override + protected String getSrcFilename() { + return "str_encodings.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestExpr3.java b/spec/java/src/io/kaitai/struct/specwrite/TestExpr3.java new file mode 100644 index 000000000..28c8ceeb8 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestExpr3.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.Expr3; +import org.testng.annotations.Test; + +public class TestExpr3 extends CommonSpec { + @Override + protected Class getStructClass() { + return Expr3.class; + } + + @Override + protected String getSrcFilename() { + return "fixed_struct.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestExprArray.java b/spec/java/src/io/kaitai/struct/specwrite/TestExprArray.java new file mode 100644 index 000000000..f11de5169 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestExprArray.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ExprArray; +import org.testng.annotations.Test; + +public class TestExprArray extends CommonSpec { + @Override + protected Class getStructClass() { + return ExprArray.class; + } + + @Override + protected String getSrcFilename() { + return "expr_array.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestExprBits.java b/spec/java/src/io/kaitai/struct/specwrite/TestExprBits.java new file mode 100644 index 000000000..0d2805008 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestExprBits.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ExprBits; +import org.testng.annotations.Test; + +public class TestExprBits extends CommonSpec { + @Override + protected Class getStructClass() { + return ExprBits.class; + } + + @Override + protected String getSrcFilename() { + return "switch_opcodes.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestExprBytesCmp.java b/spec/java/src/io/kaitai/struct/specwrite/TestExprBytesCmp.java new file mode 100644 index 000000000..ea4327e56 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestExprBytesCmp.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ExprBytesCmp; +import org.testng.annotations.Test; + +public class TestExprBytesCmp extends CommonSpec { + @Override + protected Class getStructClass() { + return ExprBytesCmp.class; + } + + @Override + protected String getSrcFilename() { + return "fixed_struct.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestExprBytesNonLiteral.java b/spec/java/src/io/kaitai/struct/specwrite/TestExprBytesNonLiteral.java new file mode 100644 index 000000000..30f8e6abf --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestExprBytesNonLiteral.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ExprBytesNonLiteral; +import org.testng.annotations.Test; + +public class TestExprBytesNonLiteral extends CommonSpec { + @Override + protected Class getStructClass() { + return ExprBytesNonLiteral.class; + } + + @Override + protected String getSrcFilename() { + return "enum_negative.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestExprBytesOps.java b/spec/java/src/io/kaitai/struct/specwrite/TestExprBytesOps.java new file mode 100644 index 000000000..571c2629c --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestExprBytesOps.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ExprBytesOps; +import org.testng.annotations.Test; + +public class TestExprBytesOps extends CommonSpec { + @Override + protected Class getStructClass() { + return ExprBytesOps.class; + } + + @Override + protected String getSrcFilename() { + return "nav_parent_switch.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestExprCalcArrayOps.java b/spec/java/src/io/kaitai/struct/specwrite/TestExprCalcArrayOps.java new file mode 100644 index 000000000..7b9f0503c --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestExprCalcArrayOps.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ExprCalcArrayOps; +import org.testng.annotations.Test; + +public class TestExprCalcArrayOps extends CommonSpec { + @Override + protected Class getStructClass() { + return ExprCalcArrayOps.class; + } + + @Override + protected String getSrcFilename() { + return "fixed_struct.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestExprEnum.java b/spec/java/src/io/kaitai/struct/specwrite/TestExprEnum.java new file mode 100644 index 000000000..a33cd5d0f --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestExprEnum.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ExprEnum; +import org.testng.annotations.Test; + +public class TestExprEnum extends CommonSpec { + @Override + protected Class getStructClass() { + return ExprEnum.class; + } + + @Override + protected String getSrcFilename() { + return "term_strz.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestExprIfIntOps.java b/spec/java/src/io/kaitai/struct/specwrite/TestExprIfIntOps.java new file mode 100644 index 000000000..4fc37975d --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestExprIfIntOps.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ExprIfIntOps; +import org.testng.annotations.Test; + +public class TestExprIfIntOps extends CommonSpec { + @Override + protected Class getStructClass() { + return ExprIfIntOps.class; + } + + @Override + protected String getSrcFilename() { + return "process_coerce_switch.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestExprIntDiv.java b/spec/java/src/io/kaitai/struct/specwrite/TestExprIntDiv.java new file mode 100644 index 000000000..2afaf6905 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestExprIntDiv.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ExprIntDiv; +import org.testng.annotations.Test; + +public class TestExprIntDiv extends CommonSpec { + @Override + protected Class getStructClass() { + return ExprIntDiv.class; + } + + @Override + protected String getSrcFilename() { + return "fixed_struct.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestExprIoEof.java b/spec/java/src/io/kaitai/struct/specwrite/TestExprIoEof.java new file mode 100644 index 000000000..0569e0af7 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestExprIoEof.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ExprIoEof; +import org.testng.annotations.Test; + +public class TestExprIoEof extends CommonSpec { + @Override + protected Class getStructClass() { + return ExprIoEof.class; + } + + @Override + protected String getSrcFilename() { + return "fixed_struct.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestExprIoPos.java b/spec/java/src/io/kaitai/struct/specwrite/TestExprIoPos.java new file mode 100644 index 000000000..247c008ab --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestExprIoPos.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ExprIoPos; +import org.testng.annotations.Test; + +public class TestExprIoPos extends CommonSpec { + @Override + protected Class getStructClass() { + return ExprIoPos.class; + } + + @Override + protected String getSrcFilename() { + return "expr_io_pos.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestExprMod.java b/spec/java/src/io/kaitai/struct/specwrite/TestExprMod.java new file mode 100644 index 000000000..2bf680144 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestExprMod.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ExprMod; +import org.testng.annotations.Test; + +public class TestExprMod extends CommonSpec { + @Override + protected Class getStructClass() { + return ExprMod.class; + } + + @Override + protected String getSrcFilename() { + return "fixed_struct.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestExprOpsParens.java b/spec/java/src/io/kaitai/struct/specwrite/TestExprOpsParens.java new file mode 100644 index 000000000..0454443dd --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestExprOpsParens.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ExprOpsParens; +import org.testng.annotations.Test; + +public class TestExprOpsParens extends CommonSpec { + @Override + protected Class getStructClass() { + return ExprOpsParens.class; + } + + @Override + protected String getSrcFilename() { + return "enum_negative.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestExprSizeofType0.java b/spec/java/src/io/kaitai/struct/specwrite/TestExprSizeofType0.java new file mode 100644 index 000000000..743287760 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestExprSizeofType0.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ExprSizeofType0; +import org.testng.annotations.Test; + +public class TestExprSizeofType0 extends CommonSpec { + @Override + protected Class getStructClass() { + return ExprSizeofType0.class; + } + + @Override + protected String getSrcFilename() { + return "fixed_struct.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestExprSizeofType1.java b/spec/java/src/io/kaitai/struct/specwrite/TestExprSizeofType1.java new file mode 100644 index 000000000..0e08d38c8 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestExprSizeofType1.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ExprSizeofType1; +import org.testng.annotations.Test; + +public class TestExprSizeofType1 extends CommonSpec { + @Override + protected Class getStructClass() { + return ExprSizeofType1.class; + } + + @Override + protected String getSrcFilename() { + return "fixed_struct.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestExprSizeofValue0.java b/spec/java/src/io/kaitai/struct/specwrite/TestExprSizeofValue0.java new file mode 100644 index 000000000..ed8c46a4b --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestExprSizeofValue0.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ExprSizeofValue0; +import org.testng.annotations.Test; + +public class TestExprSizeofValue0 extends CommonSpec { + @Override + protected Class getStructClass() { + return ExprSizeofValue0.class; + } + + @Override + protected String getSrcFilename() { + return "fixed_struct.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestExprSizeofValueSized.java b/spec/java/src/io/kaitai/struct/specwrite/TestExprSizeofValueSized.java new file mode 100644 index 000000000..e1effc1c2 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestExprSizeofValueSized.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ExprSizeofValueSized; +import org.testng.annotations.Test; + +public class TestExprSizeofValueSized extends CommonSpec { + @Override + protected Class getStructClass() { + return ExprSizeofValueSized.class; + } + + @Override + protected String getSrcFilename() { + return "fixed_struct.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestExprStrEncodings.java b/spec/java/src/io/kaitai/struct/specwrite/TestExprStrEncodings.java new file mode 100644 index 000000000..a9a645477 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestExprStrEncodings.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ExprStrEncodings; +import org.testng.annotations.Test; + +public class TestExprStrEncodings extends CommonSpec { + @Override + protected Class getStructClass() { + return ExprStrEncodings.class; + } + + @Override + protected String getSrcFilename() { + return "str_encodings.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestExprStrOps.java b/spec/java/src/io/kaitai/struct/specwrite/TestExprStrOps.java new file mode 100644 index 000000000..7ffbd4a0e --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestExprStrOps.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ExprStrOps; +import org.testng.annotations.Test; + +public class TestExprStrOps extends CommonSpec { + @Override + protected Class getStructClass() { + return ExprStrOps.class; + } + + @Override + protected String getSrcFilename() { + return "term_strz.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestFixedContents.java b/spec/java/src/io/kaitai/struct/specwrite/TestFixedContents.java new file mode 100644 index 000000000..016d96295 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestFixedContents.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.FixedContents; +import org.testng.annotations.Test; + +public class TestFixedContents extends CommonSpec { + @Override + protected Class getStructClass() { + return FixedContents.class; + } + + @Override + protected String getSrcFilename() { + return "fixed_struct.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestFixedStruct.java b/spec/java/src/io/kaitai/struct/specwrite/TestFixedStruct.java new file mode 100644 index 000000000..7fb0adc94 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestFixedStruct.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.FixedStruct; +import org.testng.annotations.Test; + +public class TestFixedStruct extends CommonSpec { + @Override + protected Class getStructClass() { + return FixedStruct.class; + } + + @Override + protected String getSrcFilename() { + return "fixed_struct.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestFloatToI.java b/spec/java/src/io/kaitai/struct/specwrite/TestFloatToI.java new file mode 100644 index 000000000..15265ff5e --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestFloatToI.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.FloatToI; +import org.testng.annotations.Test; + +public class TestFloatToI extends CommonSpec { + @Override + protected Class getStructClass() { + return FloatToI.class; + } + + @Override + protected String getSrcFilename() { + return "floating_points.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestFloatingPoints.java b/spec/java/src/io/kaitai/struct/specwrite/TestFloatingPoints.java index 5e70794ec..4e917c914 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestFloatingPoints.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestFloatingPoints.java @@ -1,3 +1,5 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + package io.kaitai.struct.specwrite; import io.kaitai.struct.KaitaiStruct.ReadWrite; @@ -14,4 +16,5 @@ protected Class getStructClass() { protected String getSrcFilename() { return "floating_points.bin"; } + } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestHelloWorld.java b/spec/java/src/io/kaitai/struct/specwrite/TestHelloWorld.java index d8b65407e..f29328fc7 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestHelloWorld.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestHelloWorld.java @@ -1,3 +1,5 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + package io.kaitai.struct.specwrite; import io.kaitai.struct.KaitaiStruct.ReadWrite; @@ -14,4 +16,5 @@ protected Class getStructClass() { protected String getSrcFilename() { return "fixed_struct.bin"; } + } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestIfInstances.java b/spec/java/src/io/kaitai/struct/specwrite/TestIfInstances.java new file mode 100644 index 000000000..19208b2d3 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestIfInstances.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.IfInstances; +import org.testng.annotations.Test; + +public class TestIfInstances extends CommonSpec { + @Override + protected Class getStructClass() { + return IfInstances.class; + } + + @Override + protected String getSrcFilename() { + return "fixed_struct.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestIfStruct.java b/spec/java/src/io/kaitai/struct/specwrite/TestIfStruct.java index 52d39689a..94d931c6d 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestIfStruct.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestIfStruct.java @@ -1,7 +1,9 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + package io.kaitai.struct.specwrite; -import io.kaitai.struct.testwrite.IfStruct; import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.IfStruct; import org.testng.annotations.Test; public class TestIfStruct extends CommonSpec { @@ -14,4 +16,5 @@ protected Class getStructClass() { protected String getSrcFilename() { return "if_struct.bin"; } + } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestIfValues.java b/spec/java/src/io/kaitai/struct/specwrite/TestIfValues.java new file mode 100644 index 000000000..16bac5fd6 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestIfValues.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.IfValues; +import org.testng.annotations.Test; + +public class TestIfValues extends CommonSpec { + @Override + protected Class getStructClass() { + return IfValues.class; + } + + @Override + protected String getSrcFilename() { + return "fixed_struct.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestImports0.java b/spec/java/src/io/kaitai/struct/specwrite/TestImports0.java new file mode 100644 index 000000000..ab99faa13 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestImports0.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.Imports0; +import org.testng.annotations.Test; + +public class TestImports0 extends CommonSpec { + @Override + protected Class getStructClass() { + return Imports0.class; + } + + @Override + protected String getSrcFilename() { + return "fixed_struct.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestImportsAbs.java b/spec/java/src/io/kaitai/struct/specwrite/TestImportsAbs.java new file mode 100644 index 000000000..c4167466a --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestImportsAbs.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ImportsAbs; +import org.testng.annotations.Test; + +public class TestImportsAbs extends CommonSpec { + @Override + protected Class getStructClass() { + return ImportsAbs.class; + } + + @Override + protected String getSrcFilename() { + return "fixed_struct.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestImportsCircularA.java b/spec/java/src/io/kaitai/struct/specwrite/TestImportsCircularA.java new file mode 100644 index 000000000..041fe609c --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestImportsCircularA.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ImportsCircularA; +import org.testng.annotations.Test; + +public class TestImportsCircularA extends CommonSpec { + @Override + protected Class getStructClass() { + return ImportsCircularA.class; + } + + @Override + protected String getSrcFilename() { + return "fixed_struct.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestImportsRel1.java b/spec/java/src/io/kaitai/struct/specwrite/TestImportsRel1.java new file mode 100644 index 000000000..0009e2b29 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestImportsRel1.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ImportsRel1; +import org.testng.annotations.Test; + +public class TestImportsRel1 extends CommonSpec { + @Override + protected Class getStructClass() { + return ImportsRel1.class; + } + + @Override + protected String getSrcFilename() { + return "fixed_struct.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestIndexSizes.java b/spec/java/src/io/kaitai/struct/specwrite/TestIndexSizes.java new file mode 100644 index 000000000..b6294f14f --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestIndexSizes.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.IndexSizes; +import org.testng.annotations.Test; + +public class TestIndexSizes extends CommonSpec { + @Override + protected Class getStructClass() { + return IndexSizes.class; + } + + @Override + protected String getSrcFilename() { + return "index_sizes.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestIndexToParamEos.java b/spec/java/src/io/kaitai/struct/specwrite/TestIndexToParamEos.java new file mode 100644 index 000000000..7a58d306a --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestIndexToParamEos.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.IndexToParamEos; +import org.testng.annotations.Test; + +public class TestIndexToParamEos extends CommonSpec { + @Override + protected Class getStructClass() { + return IndexToParamEos.class; + } + + @Override + protected String getSrcFilename() { + return "index_sizes.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestIndexToParamExpr.java b/spec/java/src/io/kaitai/struct/specwrite/TestIndexToParamExpr.java new file mode 100644 index 000000000..965de8759 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestIndexToParamExpr.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.IndexToParamExpr; +import org.testng.annotations.Test; + +public class TestIndexToParamExpr extends CommonSpec { + @Override + protected Class getStructClass() { + return IndexToParamExpr.class; + } + + @Override + protected String getSrcFilename() { + return "index_sizes.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestIndexToParamUntil.java b/spec/java/src/io/kaitai/struct/specwrite/TestIndexToParamUntil.java new file mode 100644 index 000000000..a49b4b28d --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestIndexToParamUntil.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.IndexToParamUntil; +import org.testng.annotations.Test; + +public class TestIndexToParamUntil extends CommonSpec { + @Override + protected Class getStructClass() { + return IndexToParamUntil.class; + } + + @Override + protected String getSrcFilename() { + return "index_sizes.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestInstanceIoUser.java b/spec/java/src/io/kaitai/struct/specwrite/TestInstanceIoUser.java new file mode 100644 index 000000000..edd6f57e1 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestInstanceIoUser.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.InstanceIoUser; +import org.testng.annotations.Test; + +public class TestInstanceIoUser extends CommonSpec { + @Override + protected Class getStructClass() { + return InstanceIoUser.class; + } + + @Override + protected String getSrcFilename() { + return "instance_io.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestInstanceStd.java b/spec/java/src/io/kaitai/struct/specwrite/TestInstanceStd.java new file mode 100644 index 000000000..aedf2ade1 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestInstanceStd.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.InstanceStd; +import org.testng.annotations.Test; + +public class TestInstanceStd extends CommonSpec { + @Override + protected Class getStructClass() { + return InstanceStd.class; + } + + @Override + protected String getSrcFilename() { + return "str_encodings.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestInstanceStdArray.java b/spec/java/src/io/kaitai/struct/specwrite/TestInstanceStdArray.java new file mode 100644 index 000000000..100fa63c9 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestInstanceStdArray.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.InstanceStdArray; +import org.testng.annotations.Test; + +public class TestInstanceStdArray extends CommonSpec { + @Override + protected Class getStructClass() { + return InstanceStdArray.class; + } + + @Override + protected String getSrcFilename() { + return "instance_std_array.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestInstanceUserArray.java b/spec/java/src/io/kaitai/struct/specwrite/TestInstanceUserArray.java new file mode 100644 index 000000000..42e4aebfa --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestInstanceUserArray.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.InstanceUserArray; +import org.testng.annotations.Test; + +public class TestInstanceUserArray extends CommonSpec { + @Override + protected Class getStructClass() { + return InstanceUserArray.class; + } + + @Override + protected String getSrcFilename() { + return "instance_std_array.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestIntegers.java b/spec/java/src/io/kaitai/struct/specwrite/TestIntegers.java index b07044cd5..edecf33e0 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestIntegers.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestIntegers.java @@ -1,3 +1,5 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + package io.kaitai.struct.specwrite; import io.kaitai.struct.KaitaiStruct.ReadWrite; @@ -14,4 +16,5 @@ protected Class getStructClass() { protected String getSrcFilename() { return "fixed_struct.bin"; } + } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestIntegersDoubleOverflow.java b/spec/java/src/io/kaitai/struct/specwrite/TestIntegersDoubleOverflow.java new file mode 100644 index 000000000..6f3503e56 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestIntegersDoubleOverflow.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.IntegersDoubleOverflow; +import org.testng.annotations.Test; + +public class TestIntegersDoubleOverflow extends CommonSpec { + @Override + protected Class getStructClass() { + return IntegersDoubleOverflow.class; + } + + @Override + protected String getSrcFilename() { + return "integers_double_overflow.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestIntegersMinMax.java b/spec/java/src/io/kaitai/struct/specwrite/TestIntegersMinMax.java new file mode 100644 index 000000000..b5b8b9d13 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestIntegersMinMax.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.IntegersMinMax; +import org.testng.annotations.Test; + +public class TestIntegersMinMax extends CommonSpec { + @Override + protected Class getStructClass() { + return IntegersMinMax.class; + } + + @Override + protected String getSrcFilename() { + return "integers_min_max.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestIoLocalVar.java b/spec/java/src/io/kaitai/struct/specwrite/TestIoLocalVar.java new file mode 100644 index 000000000..677a4536d --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestIoLocalVar.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.IoLocalVar; +import org.testng.annotations.Test; + +public class TestIoLocalVar extends CommonSpec { + @Override + protected Class getStructClass() { + return IoLocalVar.class; + } + + @Override + protected String getSrcFilename() { + return "full256.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestJsSignedRightShift.java b/spec/java/src/io/kaitai/struct/specwrite/TestJsSignedRightShift.java new file mode 100644 index 000000000..398da44cc --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestJsSignedRightShift.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.JsSignedRightShift; +import org.testng.annotations.Test; + +public class TestJsSignedRightShift extends CommonSpec { + @Override + protected Class getStructClass() { + return JsSignedRightShift.class; + } + + @Override + protected String getSrcFilename() { + return "fixed_struct.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestMetaTags.java b/spec/java/src/io/kaitai/struct/specwrite/TestMetaTags.java new file mode 100644 index 000000000..6de1b08ed --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestMetaTags.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.MetaTags; +import org.testng.annotations.Test; + +public class TestMetaTags extends CommonSpec { + @Override + protected Class getStructClass() { + return MetaTags.class; + } + + @Override + protected String getSrcFilename() { + return "fixed_struct.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestMetaXref.java b/spec/java/src/io/kaitai/struct/specwrite/TestMetaXref.java new file mode 100644 index 000000000..7990de1c1 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestMetaXref.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.MetaXref; +import org.testng.annotations.Test; + +public class TestMetaXref extends CommonSpec { + @Override + protected Class getStructClass() { + return MetaXref.class; + } + + @Override + protected String getSrcFilename() { + return "fixed_struct.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestMultipleUse.java b/spec/java/src/io/kaitai/struct/specwrite/TestMultipleUse.java new file mode 100644 index 000000000..c5bc57994 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestMultipleUse.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.MultipleUse; +import org.testng.annotations.Test; + +public class TestMultipleUse extends CommonSpec { + @Override + protected Class getStructClass() { + return MultipleUse.class; + } + + @Override + protected String getSrcFilename() { + return "position_abs.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestNavParent.java b/spec/java/src/io/kaitai/struct/specwrite/TestNavParent.java new file mode 100644 index 000000000..a57c2ad27 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestNavParent.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.NavParent; +import org.testng.annotations.Test; + +public class TestNavParent extends CommonSpec { + @Override + protected Class getStructClass() { + return NavParent.class; + } + + @Override + protected String getSrcFilename() { + return "nav.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestNavParent2.java b/spec/java/src/io/kaitai/struct/specwrite/TestNavParent2.java new file mode 100644 index 000000000..ac179b9c4 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestNavParent2.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.NavParent2; +import org.testng.annotations.Test; + +public class TestNavParent2 extends CommonSpec { + @Override + protected Class getStructClass() { + return NavParent2.class; + } + + @Override + protected String getSrcFilename() { + return "nav_parent2.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestNavParent3.java b/spec/java/src/io/kaitai/struct/specwrite/TestNavParent3.java new file mode 100644 index 000000000..a64844045 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestNavParent3.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.NavParent3; +import org.testng.annotations.Test; + +public class TestNavParent3 extends CommonSpec { + @Override + protected Class getStructClass() { + return NavParent3.class; + } + + @Override + protected String getSrcFilename() { + return "nav_parent2.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestNavParentFalse.java b/spec/java/src/io/kaitai/struct/specwrite/TestNavParentFalse.java new file mode 100644 index 000000000..dd4ebc7e4 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestNavParentFalse.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.NavParentFalse; +import org.testng.annotations.Test; + +public class TestNavParentFalse extends CommonSpec { + @Override + protected Class getStructClass() { + return NavParentFalse.class; + } + + @Override + protected String getSrcFilename() { + return "nav_parent_codes.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestNavParentFalse2.java b/spec/java/src/io/kaitai/struct/specwrite/TestNavParentFalse2.java new file mode 100644 index 000000000..2ceff290b --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestNavParentFalse2.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.NavParentFalse2; +import org.testng.annotations.Test; + +public class TestNavParentFalse2 extends CommonSpec { + @Override + protected Class getStructClass() { + return NavParentFalse2.class; + } + + @Override + protected String getSrcFilename() { + return "fixed_struct.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestNavParentOverride.java b/spec/java/src/io/kaitai/struct/specwrite/TestNavParentOverride.java new file mode 100644 index 000000000..999cde389 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestNavParentOverride.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.NavParentOverride; +import org.testng.annotations.Test; + +public class TestNavParentOverride extends CommonSpec { + @Override + protected Class getStructClass() { + return NavParentOverride.class; + } + + @Override + protected String getSrcFilename() { + return "nav_parent_codes.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestNavParentSwitch.java b/spec/java/src/io/kaitai/struct/specwrite/TestNavParentSwitch.java new file mode 100644 index 000000000..ae25b58d7 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestNavParentSwitch.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.NavParentSwitch; +import org.testng.annotations.Test; + +public class TestNavParentSwitch extends CommonSpec { + @Override + protected Class getStructClass() { + return NavParentSwitch.class; + } + + @Override + protected String getSrcFilename() { + return "nav_parent_switch.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestNavParentSwitchCast.java b/spec/java/src/io/kaitai/struct/specwrite/TestNavParentSwitchCast.java new file mode 100644 index 000000000..ed8e494a5 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestNavParentSwitchCast.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.NavParentSwitchCast; +import org.testng.annotations.Test; + +public class TestNavParentSwitchCast extends CommonSpec { + @Override + protected Class getStructClass() { + return NavParentSwitchCast.class; + } + + @Override + protected String getSrcFilename() { + return "switch_integers.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestNavParentVsValueInst.java b/spec/java/src/io/kaitai/struct/specwrite/TestNavParentVsValueInst.java new file mode 100644 index 000000000..18364d97b --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestNavParentVsValueInst.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.NavParentVsValueInst; +import org.testng.annotations.Test; + +public class TestNavParentVsValueInst extends CommonSpec { + @Override + protected Class getStructClass() { + return NavParentVsValueInst.class; + } + + @Override + protected String getSrcFilename() { + return "term_strz.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestNavRoot.java b/spec/java/src/io/kaitai/struct/specwrite/TestNavRoot.java new file mode 100644 index 000000000..fd37dabfa --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestNavRoot.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.NavRoot; +import org.testng.annotations.Test; + +public class TestNavRoot extends CommonSpec { + @Override + protected Class getStructClass() { + return NavRoot.class; + } + + @Override + protected String getSrcFilename() { + return "nav.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestNestedSameName.java b/spec/java/src/io/kaitai/struct/specwrite/TestNestedSameName.java new file mode 100644 index 000000000..2e43c1908 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestNestedSameName.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.NestedSameName; +import org.testng.annotations.Test; + +public class TestNestedSameName extends CommonSpec { + @Override + protected Class getStructClass() { + return NestedSameName.class; + } + + @Override + protected String getSrcFilename() { + return "repeat_n_struct.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestNestedSameName2.java b/spec/java/src/io/kaitai/struct/specwrite/TestNestedSameName2.java new file mode 100644 index 000000000..138de272e --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestNestedSameName2.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.NestedSameName2; +import org.testng.annotations.Test; + +public class TestNestedSameName2 extends CommonSpec { + @Override + protected Class getStructClass() { + return NestedSameName2.class; + } + + @Override + protected String getSrcFilename() { + return "nested_same_name2.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestNestedTypeParam.java b/spec/java/src/io/kaitai/struct/specwrite/TestNestedTypeParam.java new file mode 100644 index 000000000..aae02cc74 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestNestedTypeParam.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.NestedTypeParam; +import org.testng.annotations.Test; + +public class TestNestedTypeParam extends CommonSpec { + @Override + protected Class getStructClass() { + return NestedTypeParam.class; + } + + @Override + protected String getSrcFilename() { + return "term_strz.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestNestedTypes.java b/spec/java/src/io/kaitai/struct/specwrite/TestNestedTypes.java index c5d8c58b7..826e2a352 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestNestedTypes.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestNestedTypes.java @@ -1,3 +1,5 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + package io.kaitai.struct.specwrite; import io.kaitai.struct.KaitaiStruct.ReadWrite; @@ -14,4 +16,5 @@ protected Class getStructClass() { protected String getSrcFilename() { return "fixed_struct.bin"; } + } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestNestedTypes2.java b/spec/java/src/io/kaitai/struct/specwrite/TestNestedTypes2.java new file mode 100644 index 000000000..ae7d74a14 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestNestedTypes2.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.NestedTypes2; +import org.testng.annotations.Test; + +public class TestNestedTypes2 extends CommonSpec { + @Override + protected Class getStructClass() { + return NestedTypes2.class; + } + + @Override + protected String getSrcFilename() { + return "fixed_struct.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestNestedTypes3.java b/spec/java/src/io/kaitai/struct/specwrite/TestNestedTypes3.java new file mode 100644 index 000000000..0f67a2816 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestNestedTypes3.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.NestedTypes3; +import org.testng.annotations.Test; + +public class TestNestedTypes3 extends CommonSpec { + @Override + protected Class getStructClass() { + return NestedTypes3.class; + } + + @Override + protected String getSrcFilename() { + return "fixed_struct.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestNonStandard.java b/spec/java/src/io/kaitai/struct/specwrite/TestNonStandard.java new file mode 100644 index 000000000..6863928e8 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestNonStandard.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.NonStandard; +import org.testng.annotations.Test; + +public class TestNonStandard extends CommonSpec { + @Override + protected Class getStructClass() { + return NonStandard.class; + } + + @Override + protected String getSrcFilename() { + return "fixed_struct.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestParamsCallExtraParens.java b/spec/java/src/io/kaitai/struct/specwrite/TestParamsCallExtraParens.java new file mode 100644 index 000000000..65e4b8a03 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestParamsCallExtraParens.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ParamsCallExtraParens; +import org.testng.annotations.Test; + +public class TestParamsCallExtraParens extends CommonSpec { + @Override + protected Class getStructClass() { + return ParamsCallExtraParens.class; + } + + @Override + protected String getSrcFilename() { + return "term_strz.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestParamsCallShort.java b/spec/java/src/io/kaitai/struct/specwrite/TestParamsCallShort.java new file mode 100644 index 000000000..5d461843f --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestParamsCallShort.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ParamsCallShort; +import org.testng.annotations.Test; + +public class TestParamsCallShort extends CommonSpec { + @Override + protected Class getStructClass() { + return ParamsCallShort.class; + } + + @Override + protected String getSrcFilename() { + return "term_strz.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestParamsEnum.java b/spec/java/src/io/kaitai/struct/specwrite/TestParamsEnum.java new file mode 100644 index 000000000..bd35d1bd9 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestParamsEnum.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ParamsEnum; +import org.testng.annotations.Test; + +public class TestParamsEnum extends CommonSpec { + @Override + protected Class getStructClass() { + return ParamsEnum.class; + } + + @Override + protected String getSrcFilename() { + return "enum_0.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassArrayInt.java b/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassArrayInt.java new file mode 100644 index 000000000..184c98098 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassArrayInt.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ParamsPassArrayInt; +import org.testng.annotations.Test; + +public class TestParamsPassArrayInt extends CommonSpec { + @Override + protected Class getStructClass() { + return ParamsPassArrayInt.class; + } + + @Override + protected String getSrcFilename() { + return "position_to_end.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassArrayStr.java b/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassArrayStr.java new file mode 100644 index 000000000..cea4c1fd5 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassArrayStr.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ParamsPassArrayStr; +import org.testng.annotations.Test; + +public class TestParamsPassArrayStr extends CommonSpec { + @Override + protected Class getStructClass() { + return ParamsPassArrayStr.class; + } + + @Override + protected String getSrcFilename() { + return "term_strz.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassArrayStruct.java b/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassArrayStruct.java new file mode 100644 index 000000000..216a38b56 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassArrayStruct.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ParamsPassArrayStruct; +import org.testng.annotations.Test; + +public class TestParamsPassArrayStruct extends CommonSpec { + @Override + protected Class getStructClass() { + return ParamsPassArrayStruct.class; + } + + @Override + protected String getSrcFilename() { + return "position_to_end.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassArrayUsertype.java b/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassArrayUsertype.java new file mode 100644 index 000000000..41ee03beb --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassArrayUsertype.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ParamsPassArrayUsertype; +import org.testng.annotations.Test; + +public class TestParamsPassArrayUsertype extends CommonSpec { + @Override + protected Class getStructClass() { + return ParamsPassArrayUsertype.class; + } + + @Override + protected String getSrcFilename() { + return "position_to_end.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassBool.java b/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassBool.java new file mode 100644 index 000000000..eac2aff0e --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassBool.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ParamsPassBool; +import org.testng.annotations.Test; + +public class TestParamsPassBool extends CommonSpec { + @Override + protected Class getStructClass() { + return ParamsPassBool.class; + } + + @Override + protected String getSrcFilename() { + return "term_strz.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassStruct.java b/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassStruct.java new file mode 100644 index 000000000..296e77c21 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassStruct.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ParamsPassStruct; +import org.testng.annotations.Test; + +public class TestParamsPassStruct extends CommonSpec { + @Override + protected Class getStructClass() { + return ParamsPassStruct.class; + } + + @Override + protected String getSrcFilename() { + return "enum_negative.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassUsertype.java b/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassUsertype.java new file mode 100644 index 000000000..667917506 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassUsertype.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ParamsPassUsertype; +import org.testng.annotations.Test; + +public class TestParamsPassUsertype extends CommonSpec { + @Override + protected Class getStructClass() { + return ParamsPassUsertype.class; + } + + @Override + protected String getSrcFilename() { + return "position_in_seq.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestPositionAbs.java b/spec/java/src/io/kaitai/struct/specwrite/TestPositionAbs.java new file mode 100644 index 000000000..d2402c857 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestPositionAbs.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.PositionAbs; +import org.testng.annotations.Test; + +public class TestPositionAbs extends CommonSpec { + @Override + protected Class getStructClass() { + return PositionAbs.class; + } + + @Override + protected String getSrcFilename() { + return "position_abs.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestPositionInSeq.java b/spec/java/src/io/kaitai/struct/specwrite/TestPositionInSeq.java new file mode 100644 index 000000000..3d73633da --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestPositionInSeq.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.PositionInSeq; +import org.testng.annotations.Test; + +public class TestPositionInSeq extends CommonSpec { + @Override + protected Class getStructClass() { + return PositionInSeq.class; + } + + @Override + protected String getSrcFilename() { + return "position_in_seq.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestPositionToEnd.java b/spec/java/src/io/kaitai/struct/specwrite/TestPositionToEnd.java new file mode 100644 index 000000000..b8c4db592 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestPositionToEnd.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.PositionToEnd; +import org.testng.annotations.Test; + +public class TestPositionToEnd extends CommonSpec { + @Override + protected Class getStructClass() { + return PositionToEnd.class; + } + + @Override + protected String getSrcFilename() { + return "position_to_end.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestProcessCoerceBytes.java b/spec/java/src/io/kaitai/struct/specwrite/TestProcessCoerceBytes.java new file mode 100644 index 000000000..7bbbe4886 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestProcessCoerceBytes.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ProcessCoerceBytes; +import org.testng.annotations.Test; + +public class TestProcessCoerceBytes extends CommonSpec { + @Override + protected Class getStructClass() { + return ProcessCoerceBytes.class; + } + + @Override + protected String getSrcFilename() { + return "process_coerce_bytes.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestProcessCoerceSwitch.java b/spec/java/src/io/kaitai/struct/specwrite/TestProcessCoerceSwitch.java new file mode 100644 index 000000000..4ed79fa33 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestProcessCoerceSwitch.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ProcessCoerceSwitch; +import org.testng.annotations.Test; + +public class TestProcessCoerceSwitch extends CommonSpec { + @Override + protected Class getStructClass() { + return ProcessCoerceSwitch.class; + } + + @Override + protected String getSrcFilename() { + return "process_coerce_switch.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestProcessCoerceUsertype1.java b/spec/java/src/io/kaitai/struct/specwrite/TestProcessCoerceUsertype1.java new file mode 100644 index 000000000..f5781201c --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestProcessCoerceUsertype1.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ProcessCoerceUsertype1; +import org.testng.annotations.Test; + +public class TestProcessCoerceUsertype1 extends CommonSpec { + @Override + protected Class getStructClass() { + return ProcessCoerceUsertype1.class; + } + + @Override + protected String getSrcFilename() { + return "process_coerce_bytes.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestProcessCoerceUsertype2.java b/spec/java/src/io/kaitai/struct/specwrite/TestProcessCoerceUsertype2.java new file mode 100644 index 000000000..2a49f80bf --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestProcessCoerceUsertype2.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ProcessCoerceUsertype2; +import org.testng.annotations.Test; + +public class TestProcessCoerceUsertype2 extends CommonSpec { + @Override + protected Class getStructClass() { + return ProcessCoerceUsertype2.class; + } + + @Override + protected String getSrcFilename() { + return "process_coerce_bytes.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestProcessCustom.java b/spec/java/src/io/kaitai/struct/specwrite/TestProcessCustom.java new file mode 100644 index 000000000..b5c2d232b --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestProcessCustom.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ProcessCustom; +import org.testng.annotations.Test; + +public class TestProcessCustom extends CommonSpec { + @Override + protected Class getStructClass() { + return ProcessCustom.class; + } + + @Override + protected String getSrcFilename() { + return "process_rotate.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestProcessCustomNoArgs.java b/spec/java/src/io/kaitai/struct/specwrite/TestProcessCustomNoArgs.java new file mode 100644 index 000000000..916f00e73 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestProcessCustomNoArgs.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ProcessCustomNoArgs; +import org.testng.annotations.Test; + +public class TestProcessCustomNoArgs extends CommonSpec { + @Override + protected Class getStructClass() { + return ProcessCustomNoArgs.class; + } + + @Override + protected String getSrcFilename() { + return "process_rotate.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestProcessRepeatBytes.java b/spec/java/src/io/kaitai/struct/specwrite/TestProcessRepeatBytes.java new file mode 100644 index 000000000..a817dbece --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestProcessRepeatBytes.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ProcessRepeatBytes; +import org.testng.annotations.Test; + +public class TestProcessRepeatBytes extends CommonSpec { + @Override + protected Class getStructClass() { + return ProcessRepeatBytes.class; + } + + @Override + protected String getSrcFilename() { + return "process_xor_4.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestProcessRepeatUsertype.java b/spec/java/src/io/kaitai/struct/specwrite/TestProcessRepeatUsertype.java new file mode 100644 index 000000000..3a80d9cb9 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestProcessRepeatUsertype.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ProcessRepeatUsertype; +import org.testng.annotations.Test; + +public class TestProcessRepeatUsertype extends CommonSpec { + @Override + protected Class getStructClass() { + return ProcessRepeatUsertype.class; + } + + @Override + protected String getSrcFilename() { + return "process_xor_4.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestProcessXor4Const.java b/spec/java/src/io/kaitai/struct/specwrite/TestProcessXor4Const.java new file mode 100644 index 000000000..8496fd82d --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestProcessXor4Const.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ProcessXor4Const; +import org.testng.annotations.Test; + +public class TestProcessXor4Const extends CommonSpec { + @Override + protected Class getStructClass() { + return ProcessXor4Const.class; + } + + @Override + protected String getSrcFilename() { + return "process_xor_4.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestProcessXor4Value.java b/spec/java/src/io/kaitai/struct/specwrite/TestProcessXor4Value.java new file mode 100644 index 000000000..513959504 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestProcessXor4Value.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ProcessXor4Value; +import org.testng.annotations.Test; + +public class TestProcessXor4Value extends CommonSpec { + @Override + protected Class getStructClass() { + return ProcessXor4Value.class; + } + + @Override + protected String getSrcFilename() { + return "process_xor_4.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestProcessXorConst.java b/spec/java/src/io/kaitai/struct/specwrite/TestProcessXorConst.java new file mode 100644 index 000000000..0fbc66704 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestProcessXorConst.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ProcessXorConst; +import org.testng.annotations.Test; + +public class TestProcessXorConst extends CommonSpec { + @Override + protected Class getStructClass() { + return ProcessXorConst.class; + } + + @Override + protected String getSrcFilename() { + return "process_xor_1.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestProcessXorValue.java b/spec/java/src/io/kaitai/struct/specwrite/TestProcessXorValue.java new file mode 100644 index 000000000..b14fd5a07 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestProcessXorValue.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ProcessXorValue; +import org.testng.annotations.Test; + +public class TestProcessXorValue extends CommonSpec { + @Override + protected Class getStructClass() { + return ProcessXorValue.class; + } + + @Override + protected String getSrcFilename() { + return "process_xor_1.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRecursiveOne.java b/spec/java/src/io/kaitai/struct/specwrite/TestRecursiveOne.java new file mode 100644 index 000000000..473aff896 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRecursiveOne.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.RecursiveOne; +import org.testng.annotations.Test; + +public class TestRecursiveOne extends CommonSpec { + @Override + protected Class getStructClass() { + return RecursiveOne.class; + } + + @Override + protected String getSrcFilename() { + return "fixed_struct.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosBit.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosBit.java new file mode 100644 index 000000000..1a24e7ea4 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosBit.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.RepeatEosBit; +import org.testng.annotations.Test; + +public class TestRepeatEosBit extends CommonSpec { + @Override + protected Class getStructClass() { + return RepeatEosBit.class; + } + + @Override + protected String getSrcFilename() { + return "enum_0.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosStruct.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosStruct.java new file mode 100644 index 000000000..b017b5d9e --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosStruct.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.RepeatEosStruct; +import org.testng.annotations.Test; + +public class TestRepeatEosStruct extends CommonSpec { + @Override + protected Class getStructClass() { + return RepeatEosStruct.class; + } + + @Override + protected String getSrcFilename() { + return "repeat_eos_struct.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosU4.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosU4.java index c3d76559e..953933d2c 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosU4.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosU4.java @@ -1,3 +1,5 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + package io.kaitai.struct.specwrite; import io.kaitai.struct.KaitaiStruct.ReadWrite; @@ -14,4 +16,5 @@ protected Class getStructClass() { protected String getSrcFilename() { return "repeat_eos_struct.bin"; } + } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStruct.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStruct.java index bcb7f8d81..d63540eb4 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStruct.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStruct.java @@ -1,3 +1,5 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + package io.kaitai.struct.specwrite; import io.kaitai.struct.KaitaiStruct.ReadWrite; @@ -14,4 +16,5 @@ protected Class getStructClass() { protected String getSrcFilename() { return "repeat_n_struct.bin"; } + } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStrzDouble.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStrzDouble.java new file mode 100644 index 000000000..49790ad3f --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStrzDouble.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.RepeatNStrzDouble; +import org.testng.annotations.Test; + +public class TestRepeatNStrzDouble extends CommonSpec { + @Override + protected Class getStructClass() { + return RepeatNStrzDouble.class; + } + + @Override + protected String getSrcFilename() { + return "repeat_n_strz.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilCalcArrayType.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilCalcArrayType.java new file mode 100644 index 000000000..79ac524c2 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilCalcArrayType.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.RepeatUntilCalcArrayType; +import org.testng.annotations.Test; + +public class TestRepeatUntilCalcArrayType extends CommonSpec { + @Override + protected Class getStructClass() { + return RepeatUntilCalcArrayType.class; + } + + @Override + protected String getSrcFilename() { + return "repeat_until_process.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilComplex.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilComplex.java new file mode 100644 index 000000000..69b50dc6c --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilComplex.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.RepeatUntilComplex; +import org.testng.annotations.Test; + +public class TestRepeatUntilComplex extends CommonSpec { + @Override + protected Class getStructClass() { + return RepeatUntilComplex.class; + } + + @Override + protected String getSrcFilename() { + return "repeat_until_complex.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilS4.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilS4.java new file mode 100644 index 000000000..973521976 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilS4.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.RepeatUntilS4; +import org.testng.annotations.Test; + +public class TestRepeatUntilS4 extends CommonSpec { + @Override + protected Class getStructClass() { + return RepeatUntilS4.class; + } + + @Override + protected String getSrcFilename() { + return "repeat_until_s4.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilSized.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilSized.java new file mode 100644 index 000000000..5bfe8ee4a --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilSized.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.RepeatUntilSized; +import org.testng.annotations.Test; + +public class TestRepeatUntilSized extends CommonSpec { + @Override + protected Class getStructClass() { + return RepeatUntilSized.class; + } + + @Override + protected String getSrcFilename() { + return "repeat_until_process.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestStrEncodingsDefault.java b/spec/java/src/io/kaitai/struct/specwrite/TestStrEncodingsDefault.java new file mode 100644 index 000000000..f656e18ce --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestStrEncodingsDefault.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.StrEncodingsDefault; +import org.testng.annotations.Test; + +public class TestStrEncodingsDefault extends CommonSpec { + @Override + protected Class getStructClass() { + return StrEncodingsDefault.class; + } + + @Override + protected String getSrcFilename() { + return "str_encodings.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestStrEncodingsUtf16.java b/spec/java/src/io/kaitai/struct/specwrite/TestStrEncodingsUtf16.java new file mode 100644 index 000000000..38afa70dc --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestStrEncodingsUtf16.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.StrEncodingsUtf16; +import org.testng.annotations.Test; + +public class TestStrEncodingsUtf16 extends CommonSpec { + @Override + protected Class getStructClass() { + return StrEncodingsUtf16.class; + } + + @Override + protected String getSrcFilename() { + return "str_encodings_utf16.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestStrEos.java b/spec/java/src/io/kaitai/struct/specwrite/TestStrEos.java index 65ce92f7c..b6704d820 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestStrEos.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestStrEos.java @@ -1,3 +1,5 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + package io.kaitai.struct.specwrite; import io.kaitai.struct.KaitaiStruct.ReadWrite; @@ -14,4 +16,5 @@ protected Class getStructClass() { protected String getSrcFilename() { return "term_strz.bin"; } + } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestStrLiterals2.java b/spec/java/src/io/kaitai/struct/specwrite/TestStrLiterals2.java new file mode 100644 index 000000000..bb88d8170 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestStrLiterals2.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.StrLiterals2; +import org.testng.annotations.Test; + +public class TestStrLiterals2 extends CommonSpec { + @Override + protected Class getStructClass() { + return StrLiterals2.class; + } + + @Override + protected String getSrcFilename() { + return "fixed_struct.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestStrPadTerm.java b/spec/java/src/io/kaitai/struct/specwrite/TestStrPadTerm.java new file mode 100644 index 000000000..a518a858d --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestStrPadTerm.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.StrPadTerm; +import org.testng.annotations.Test; + +public class TestStrPadTerm extends CommonSpec { + @Override + protected Class getStructClass() { + return StrPadTerm.class; + } + + @Override + protected String getSrcFilename() { + return "str_pad_term.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestStrPadTermEmpty.java b/spec/java/src/io/kaitai/struct/specwrite/TestStrPadTermEmpty.java new file mode 100644 index 000000000..f498d7214 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestStrPadTermEmpty.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.StrPadTermEmpty; +import org.testng.annotations.Test; + +public class TestStrPadTermEmpty extends CommonSpec { + @Override + protected Class getStructClass() { + return StrPadTermEmpty.class; + } + + @Override + protected String getSrcFilename() { + return "str_pad_term_empty.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchBytearray.java b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchBytearray.java new file mode 100644 index 000000000..d1de882ab --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchBytearray.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.SwitchBytearray; +import org.testng.annotations.Test; + +public class TestSwitchBytearray extends CommonSpec { + @Override + protected Class getStructClass() { + return SwitchBytearray.class; + } + + @Override + protected String getSrcFilename() { + return "switch_opcodes.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchElseOnly.java b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchElseOnly.java new file mode 100644 index 000000000..860539d4b --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchElseOnly.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.SwitchElseOnly; +import org.testng.annotations.Test; + +public class TestSwitchElseOnly extends CommonSpec { + @Override + protected Class getStructClass() { + return SwitchElseOnly.class; + } + + @Override + protected String getSrcFilename() { + return "switch_opcodes.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchIntegers.java b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchIntegers.java new file mode 100644 index 000000000..5eede418f --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchIntegers.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.SwitchIntegers; +import org.testng.annotations.Test; + +public class TestSwitchIntegers extends CommonSpec { + @Override + protected Class getStructClass() { + return SwitchIntegers.class; + } + + @Override + protected String getSrcFilename() { + return "switch_integers.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchIntegers2.java b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchIntegers2.java new file mode 100644 index 000000000..aa46011d6 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchIntegers2.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.SwitchIntegers2; +import org.testng.annotations.Test; + +public class TestSwitchIntegers2 extends CommonSpec { + @Override + protected Class getStructClass() { + return SwitchIntegers2.class; + } + + @Override + protected String getSrcFilename() { + return "switch_integers.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualEnum.java b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualEnum.java new file mode 100644 index 000000000..e9cfaf7c0 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualEnum.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.SwitchManualEnum; +import org.testng.annotations.Test; + +public class TestSwitchManualEnum extends CommonSpec { + @Override + protected Class getStructClass() { + return SwitchManualEnum.class; + } + + @Override + protected String getSrcFilename() { + return "switch_opcodes.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualEnumInvalid.java b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualEnumInvalid.java new file mode 100644 index 000000000..f39371ea6 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualEnumInvalid.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.SwitchManualEnumInvalid; +import org.testng.annotations.Test; + +public class TestSwitchManualEnumInvalid extends CommonSpec { + @Override + protected Class getStructClass() { + return SwitchManualEnumInvalid.class; + } + + @Override + protected String getSrcFilename() { + return "enum_negative.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualEnumInvalidElse.java b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualEnumInvalidElse.java new file mode 100644 index 000000000..a01d4ad00 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualEnumInvalidElse.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.SwitchManualEnumInvalidElse; +import org.testng.annotations.Test; + +public class TestSwitchManualEnumInvalidElse extends CommonSpec { + @Override + protected Class getStructClass() { + return SwitchManualEnumInvalidElse.class; + } + + @Override + protected String getSrcFilename() { + return "enum_negative.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualInt.java b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualInt.java index bc94dee14..8da4116d0 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualInt.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualInt.java @@ -1,3 +1,5 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + package io.kaitai.struct.specwrite; import io.kaitai.struct.KaitaiStruct.ReadWrite; @@ -14,4 +16,5 @@ protected Class getStructClass() { protected String getSrcFilename() { return "switch_opcodes.bin"; } + } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualIntElse.java b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualIntElse.java new file mode 100644 index 000000000..d079a11eb --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualIntElse.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.SwitchManualIntElse; +import org.testng.annotations.Test; + +public class TestSwitchManualIntElse extends CommonSpec { + @Override + protected Class getStructClass() { + return SwitchManualIntElse.class; + } + + @Override + protected String getSrcFilename() { + return "switch_opcodes2.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualIntSize.java b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualIntSize.java new file mode 100644 index 000000000..af7cbb27c --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualIntSize.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.SwitchManualIntSize; +import org.testng.annotations.Test; + +public class TestSwitchManualIntSize extends CommonSpec { + @Override + protected Class getStructClass() { + return SwitchManualIntSize.class; + } + + @Override + protected String getSrcFilename() { + return "switch_tlv.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualIntSizeElse.java b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualIntSizeElse.java new file mode 100644 index 000000000..36a130d87 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualIntSizeElse.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.SwitchManualIntSizeElse; +import org.testng.annotations.Test; + +public class TestSwitchManualIntSizeElse extends CommonSpec { + @Override + protected Class getStructClass() { + return SwitchManualIntSizeElse.class; + } + + @Override + protected String getSrcFilename() { + return "switch_tlv.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualIntSizeEos.java b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualIntSizeEos.java new file mode 100644 index 000000000..1fcf4209b --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualIntSizeEos.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.SwitchManualIntSizeEos; +import org.testng.annotations.Test; + +public class TestSwitchManualIntSizeEos extends CommonSpec { + @Override + protected Class getStructClass() { + return SwitchManualIntSizeEos.class; + } + + @Override + protected String getSrcFilename() { + return "switch_tlv.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualStr.java b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualStr.java index 33186c393..475c8ecf7 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualStr.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualStr.java @@ -1,3 +1,5 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + package io.kaitai.struct.specwrite; import io.kaitai.struct.KaitaiStruct.ReadWrite; @@ -14,4 +16,5 @@ protected Class getStructClass() { protected String getSrcFilename() { return "switch_opcodes.bin"; } + } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualStrElse.java b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualStrElse.java new file mode 100644 index 000000000..43291a0b0 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualStrElse.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.SwitchManualStrElse; +import org.testng.annotations.Test; + +public class TestSwitchManualStrElse extends CommonSpec { + @Override + protected Class getStructClass() { + return SwitchManualStrElse.class; + } + + @Override + protected String getSrcFilename() { + return "switch_opcodes2.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchMultiBoolOps.java b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchMultiBoolOps.java new file mode 100644 index 000000000..e9de2acee --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchMultiBoolOps.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.SwitchMultiBoolOps; +import org.testng.annotations.Test; + +public class TestSwitchMultiBoolOps extends CommonSpec { + @Override + protected Class getStructClass() { + return SwitchMultiBoolOps.class; + } + + @Override + protected String getSrcFilename() { + return "switch_integers.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchRepeatExpr.java b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchRepeatExpr.java new file mode 100644 index 000000000..66e0ff691 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchRepeatExpr.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.SwitchRepeatExpr; +import org.testng.annotations.Test; + +public class TestSwitchRepeatExpr extends CommonSpec { + @Override + protected Class getStructClass() { + return SwitchRepeatExpr.class; + } + + @Override + protected String getSrcFilename() { + return "switch_tlv.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchRepeatExprInvalid.java b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchRepeatExprInvalid.java new file mode 100644 index 000000000..cc1b7f080 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchRepeatExprInvalid.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.SwitchRepeatExprInvalid; +import org.testng.annotations.Test; + +public class TestSwitchRepeatExprInvalid extends CommonSpec { + @Override + protected Class getStructClass() { + return SwitchRepeatExprInvalid.class; + } + + @Override + protected String getSrcFilename() { + return "switch_tlv.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestTermBytes.java b/spec/java/src/io/kaitai/struct/specwrite/TestTermBytes.java index 86855d5be..f34781ccf 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestTermBytes.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestTermBytes.java @@ -1,3 +1,5 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + package io.kaitai.struct.specwrite; import io.kaitai.struct.KaitaiStruct.ReadWrite; @@ -14,4 +16,5 @@ protected Class getStructClass() { protected String getSrcFilename() { return "term_strz.bin"; } + } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestTermStrz.java b/spec/java/src/io/kaitai/struct/specwrite/TestTermStrz.java new file mode 100644 index 000000000..c2245d12a --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestTermStrz.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.TermStrz; +import org.testng.annotations.Test; + +public class TestTermStrz extends CommonSpec { + @Override + protected Class getStructClass() { + return TermStrz.class; + } + + @Override + protected String getSrcFilename() { + return "term_strz.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestTermU1Val.java b/spec/java/src/io/kaitai/struct/specwrite/TestTermU1Val.java new file mode 100644 index 000000000..7841c9008 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestTermU1Val.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.TermU1Val; +import org.testng.annotations.Test; + +public class TestTermU1Val extends CommonSpec { + @Override + protected Class getStructClass() { + return TermU1Val.class; + } + + @Override + protected String getSrcFilename() { + return "str_encodings.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestTsPacketHeader.java b/spec/java/src/io/kaitai/struct/specwrite/TestTsPacketHeader.java new file mode 100644 index 000000000..854734602 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestTsPacketHeader.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.TsPacketHeader; +import org.testng.annotations.Test; + +public class TestTsPacketHeader extends CommonSpec { + @Override + protected Class getStructClass() { + return TsPacketHeader.class; + } + + @Override + protected String getSrcFilename() { + return "ts_packet.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestTypeIntUnaryOp.java b/spec/java/src/io/kaitai/struct/specwrite/TestTypeIntUnaryOp.java new file mode 100644 index 000000000..ea9c7cb76 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestTypeIntUnaryOp.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.TypeIntUnaryOp; +import org.testng.annotations.Test; + +public class TestTypeIntUnaryOp extends CommonSpec { + @Override + protected Class getStructClass() { + return TypeIntUnaryOp.class; + } + + @Override + protected String getSrcFilename() { + return "fixed_struct.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestTypeTernary.java b/spec/java/src/io/kaitai/struct/specwrite/TestTypeTernary.java new file mode 100644 index 000000000..7bdf905a5 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestTypeTernary.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.TypeTernary; +import org.testng.annotations.Test; + +public class TestTypeTernary extends CommonSpec { + @Override + protected Class getStructClass() { + return TypeTernary.class; + } + + @Override + protected String getSrcFilename() { + return "term_strz.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestTypeTernary2ndFalsy.java b/spec/java/src/io/kaitai/struct/specwrite/TestTypeTernary2ndFalsy.java new file mode 100644 index 000000000..9e8f8f34c --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestTypeTernary2ndFalsy.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.TypeTernary2ndFalsy; +import org.testng.annotations.Test; + +public class TestTypeTernary2ndFalsy extends CommonSpec { + @Override + protected Class getStructClass() { + return TypeTernary2ndFalsy.class; + } + + @Override + protected String getSrcFilename() { + return "switch_integers.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestUserType.java b/spec/java/src/io/kaitai/struct/specwrite/TestUserType.java new file mode 100644 index 000000000..29f2712c5 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestUserType.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.UserType; +import org.testng.annotations.Test; + +public class TestUserType extends CommonSpec { + @Override + protected Class getStructClass() { + return UserType.class; + } + + @Override + protected String getSrcFilename() { + return "repeat_until_s4.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestValidEqStrEncodings.java b/spec/java/src/io/kaitai/struct/specwrite/TestValidEqStrEncodings.java new file mode 100644 index 000000000..71717b005 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestValidEqStrEncodings.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ValidEqStrEncodings; +import org.testng.annotations.Test; + +public class TestValidEqStrEncodings extends CommonSpec { + @Override + protected Class getStructClass() { + return ValidEqStrEncodings.class; + } + + @Override + protected String getSrcFilename() { + return "str_encodings.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailAnyofInt.java b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailAnyofInt.java new file mode 100644 index 000000000..244806299 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailAnyofInt.java @@ -0,0 +1,19 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ValidFailAnyofInt; +import org.testng.annotations.Test; + +public class TestValidFailAnyofInt extends CommonSpec { + @Override + protected Class getStructClass() { + throw new UnsupportedOperationException(); + } + + @Override + protected String getSrcFilename() { + throw new UnsupportedOperationException(); + } +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailContents.java b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailContents.java new file mode 100644 index 000000000..b184d6342 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailContents.java @@ -0,0 +1,19 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ValidFailContents; +import org.testng.annotations.Test; + +public class TestValidFailContents extends CommonSpec { + @Override + protected Class getStructClass() { + throw new UnsupportedOperationException(); + } + + @Override + protected String getSrcFilename() { + throw new UnsupportedOperationException(); + } +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailEqBytes.java b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailEqBytes.java new file mode 100644 index 000000000..ba7eeac87 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailEqBytes.java @@ -0,0 +1,19 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ValidFailEqBytes; +import org.testng.annotations.Test; + +public class TestValidFailEqBytes extends CommonSpec { + @Override + protected Class getStructClass() { + throw new UnsupportedOperationException(); + } + + @Override + protected String getSrcFilename() { + throw new UnsupportedOperationException(); + } +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailEqInt.java b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailEqInt.java new file mode 100644 index 000000000..79f3daa8b --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailEqInt.java @@ -0,0 +1,19 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ValidFailEqInt; +import org.testng.annotations.Test; + +public class TestValidFailEqInt extends CommonSpec { + @Override + protected Class getStructClass() { + throw new UnsupportedOperationException(); + } + + @Override + protected String getSrcFilename() { + throw new UnsupportedOperationException(); + } +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailEqStr.java b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailEqStr.java new file mode 100644 index 000000000..6279ae886 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailEqStr.java @@ -0,0 +1,19 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ValidFailEqStr; +import org.testng.annotations.Test; + +public class TestValidFailEqStr extends CommonSpec { + @Override + protected Class getStructClass() { + throw new UnsupportedOperationException(); + } + + @Override + protected String getSrcFilename() { + throw new UnsupportedOperationException(); + } +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailExpr.java b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailExpr.java new file mode 100644 index 000000000..efb40f97f --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailExpr.java @@ -0,0 +1,19 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ValidFailExpr; +import org.testng.annotations.Test; + +public class TestValidFailExpr extends CommonSpec { + @Override + protected Class getStructClass() { + throw new UnsupportedOperationException(); + } + + @Override + protected String getSrcFilename() { + throw new UnsupportedOperationException(); + } +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailInst.java b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailInst.java new file mode 100644 index 000000000..2fdfb06a6 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailInst.java @@ -0,0 +1,19 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ValidFailInst; +import org.testng.annotations.Test; + +public class TestValidFailInst extends CommonSpec { + @Override + protected Class getStructClass() { + throw new UnsupportedOperationException(); + } + + @Override + protected String getSrcFilename() { + throw new UnsupportedOperationException(); + } +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailMaxInt.java b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailMaxInt.java new file mode 100644 index 000000000..5e800d49b --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailMaxInt.java @@ -0,0 +1,19 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ValidFailMaxInt; +import org.testng.annotations.Test; + +public class TestValidFailMaxInt extends CommonSpec { + @Override + protected Class getStructClass() { + throw new UnsupportedOperationException(); + } + + @Override + protected String getSrcFilename() { + throw new UnsupportedOperationException(); + } +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailMinInt.java b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailMinInt.java new file mode 100644 index 000000000..785698fa8 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailMinInt.java @@ -0,0 +1,19 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ValidFailMinInt; +import org.testng.annotations.Test; + +public class TestValidFailMinInt extends CommonSpec { + @Override + protected Class getStructClass() { + throw new UnsupportedOperationException(); + } + + @Override + protected String getSrcFilename() { + throw new UnsupportedOperationException(); + } +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailRangeBytes.java b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailRangeBytes.java new file mode 100644 index 000000000..eb90424be --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailRangeBytes.java @@ -0,0 +1,19 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ValidFailRangeBytes; +import org.testng.annotations.Test; + +public class TestValidFailRangeBytes extends CommonSpec { + @Override + protected Class getStructClass() { + throw new UnsupportedOperationException(); + } + + @Override + protected String getSrcFilename() { + throw new UnsupportedOperationException(); + } +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailRangeFloat.java b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailRangeFloat.java new file mode 100644 index 000000000..ad857585c --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailRangeFloat.java @@ -0,0 +1,19 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ValidFailRangeFloat; +import org.testng.annotations.Test; + +public class TestValidFailRangeFloat extends CommonSpec { + @Override + protected Class getStructClass() { + throw new UnsupportedOperationException(); + } + + @Override + protected String getSrcFilename() { + throw new UnsupportedOperationException(); + } +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailRangeInt.java b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailRangeInt.java new file mode 100644 index 000000000..f7f6728d2 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailRangeInt.java @@ -0,0 +1,19 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ValidFailRangeInt; +import org.testng.annotations.Test; + +public class TestValidFailRangeInt extends CommonSpec { + @Override + protected Class getStructClass() { + throw new UnsupportedOperationException(); + } + + @Override + protected String getSrcFilename() { + throw new UnsupportedOperationException(); + } +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailRangeStr.java b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailRangeStr.java new file mode 100644 index 000000000..3caa58bf6 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailRangeStr.java @@ -0,0 +1,19 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ValidFailRangeStr; +import org.testng.annotations.Test; + +public class TestValidFailRangeStr extends CommonSpec { + @Override + protected Class getStructClass() { + throw new UnsupportedOperationException(); + } + + @Override + protected String getSrcFilename() { + throw new UnsupportedOperationException(); + } +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestValidLong.java b/spec/java/src/io/kaitai/struct/specwrite/TestValidLong.java new file mode 100644 index 000000000..e6ad1ceb7 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestValidLong.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ValidLong; +import org.testng.annotations.Test; + +public class TestValidLong extends CommonSpec { + @Override + protected Class getStructClass() { + return ValidLong.class; + } + + @Override + protected String getSrcFilename() { + return "fixed_struct.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestValidNotParsedIf.java b/spec/java/src/io/kaitai/struct/specwrite/TestValidNotParsedIf.java new file mode 100644 index 000000000..ffca570fb --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestValidNotParsedIf.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ValidNotParsedIf; +import org.testng.annotations.Test; + +public class TestValidNotParsedIf extends CommonSpec { + @Override + protected Class getStructClass() { + return ValidNotParsedIf.class; + } + + @Override + protected String getSrcFilename() { + return "fixed_struct.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestValidOptionalId.java b/spec/java/src/io/kaitai/struct/specwrite/TestValidOptionalId.java new file mode 100644 index 000000000..8992a35ff --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestValidOptionalId.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ValidOptionalId; +import org.testng.annotations.Test; + +public class TestValidOptionalId extends CommonSpec { + @Override + protected Class getStructClass() { + return ValidOptionalId.class; + } + + @Override + protected String getSrcFilename() { + return "fixed_struct.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestValidShort.java b/spec/java/src/io/kaitai/struct/specwrite/TestValidShort.java new file mode 100644 index 000000000..d79355bc5 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestValidShort.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ValidShort; +import org.testng.annotations.Test; + +public class TestValidShort extends CommonSpec { + @Override + protected Class getStructClass() { + return ValidShort.class; + } + + @Override + protected String getSrcFilename() { + return "fixed_struct.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestValidSwitch.java b/spec/java/src/io/kaitai/struct/specwrite/TestValidSwitch.java new file mode 100644 index 000000000..c5a644f6d --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestValidSwitch.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ValidSwitch; +import org.testng.annotations.Test; + +public class TestValidSwitch extends CommonSpec { + @Override + protected Class getStructClass() { + return ValidSwitch.class; + } + + @Override + protected String getSrcFilename() { + return "fixed_struct.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestYamlInts.java b/spec/java/src/io/kaitai/struct/specwrite/TestYamlInts.java new file mode 100644 index 000000000..7a83e6491 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestYamlInts.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.YamlInts; +import org.testng.annotations.Test; + +public class TestYamlInts extends CommonSpec { + @Override + protected Class getStructClass() { + return YamlInts.class; + } + + @Override + protected String getSrcFilename() { + return "fixed_struct.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestZlibSurrounded.java b/spec/java/src/io/kaitai/struct/specwrite/TestZlibSurrounded.java new file mode 100644 index 000000000..bda343879 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestZlibSurrounded.java @@ -0,0 +1,27 @@ +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ZlibSurrounded; +import org.testng.annotations.Test; + +public class TestZlibSurrounded extends CommonSpec { + // @Override + // protected Class getStructClass() { + // return ZlibSurrounded.class; + // } + + // @Override + // protected String getSrcFilename() { + // return "zlib_surrounded.bin"; + // } + + @Override + protected Class getStructClass() { + throw new UnsupportedOperationException(); + } + + @Override + protected String getSrcFilename() { + throw new UnsupportedOperationException(); + } +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestZlibWithHeader78.java b/spec/java/src/io/kaitai/struct/specwrite/TestZlibWithHeader78.java new file mode 100644 index 000000000..b7764411c --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestZlibWithHeader78.java @@ -0,0 +1,27 @@ +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ZlibWithHeader78; +import org.testng.annotations.Test; + +public class TestZlibWithHeader78 extends CommonSpec { + // @Override + // protected Class getStructClass() { + // return ZlibWithHeader78.class; + // } + + // @Override + // protected String getSrcFilename() { + // return "zlib_with_header_78.bin"; + // } + + @Override + protected Class getStructClass() { + throw new UnsupportedOperationException(); + } + + @Override + protected String getSrcFilename() { + throw new UnsupportedOperationException(); + } +} From 0b61180bee2fc1ec6195c124da4fe3d2bcca4551 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Sat, 13 Aug 2022 20:10:09 +0200 Subject: [PATCH 034/126] Fix 2 bugs in read-write roundtrip code --- spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java b/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java index 93a675ee0..3eb96a156 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java +++ b/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java @@ -39,6 +39,7 @@ protected void testReadWriteRoundtrip() throws Exception { ByteBufferKaitaiStream newIo = new ByteBufferKaitaiStream(origKs._io().size()); origKs._write(newIo); + newIo.alignToByte(); newIo.seek(0); KaitaiStruct.ReadWrite newKs = structClass @@ -166,7 +167,7 @@ protected static Object dumpStructValue( for (byte b : (byte[]) value) { sb.append(String.format("%02x ", b)); } - value = "[" + sb.substring(0, sb.length() - (sb.charAt(sb.length() - 1) == ' ' ? 1 : 0)) + "]"; + value = "[" + sb.substring(0, sb.length() - (sb.length() != 0 && sb.charAt(sb.length() - 1) == ' ' ? 1 : 0)) + "]"; } else if (value instanceof List) { List list = (List) value; List out = new ArrayList<>(); From 98a275a3eda3e54c448fa4ba0456e4b289011559 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Sat, 13 Aug 2022 21:27:12 +0200 Subject: [PATCH 035/126] Use HelloWorld (not TermStrz) as an opaque type in tests I don't think it makes tests worse in detecting errors, but it makes it easier to change TermStrz if needed. --- formats/opaque_external_type.ksy | 4 ++-- formats/type_ternary_opaque.ksy | 8 ++++---- spec/cpp_stl_11/test_opaque_external_type.cpp | 10 +++------- spec/cpp_stl_11/test_type_ternary_opaque.cpp | 10 +++------- spec/cpp_stl_98/test_opaque_external_type.cpp | 10 +++------- spec/cpp_stl_98/test_type_ternary_opaque.cpp | 10 +++------- .../tests/SpecOpaqueExternalType.cs | 5 ++--- .../tests/SpecTypeTernaryOpaque.cs | 5 ++--- spec/go/opaque_external_type_test.go | 4 +--- spec/go/type_ternary_opaque_test.go | 12 +---------- .../struct/spec/TestOpaqueExternalType.java | 9 +++------ .../struct/spec/TestTypeTernaryOpaque.java | 9 +++------ .../specwrite/TestOpaqueExternalType.java | 20 +++++++++++++++++++ .../specwrite/TestTypeTernaryOpaque.java | 20 +++++++++++++++++++ spec/javascript/test_opaque_external_type.js | 9 +++++---- spec/javascript/test_type_ternary_opaque.js | 9 +++++---- spec/ks/opaque_external_type.kst | 7 +++++++ spec/ks/type_ternary_opaque.kst | 7 +++++++ spec/lua/test_opaque_external_type.lua | 6 +++--- spec/lua/test_type_ternary_opaque.lua | 6 +++--- spec/nim/topaque_external_type.nim | 7 +++++++ spec/nim/ttype_ternary_opaque.nim | 7 +++++++ spec/perl/TestOpaqueExternalType.t | 8 ++++---- spec/perl/TestTypeTernaryOpaque.t | 8 ++++---- spec/php/OpaqueExternalTypeTest.php | 8 ++++---- spec/php/TypeTernaryOpaqueTest.php | 8 ++++---- spec/python/test_opaque_external_type.py | 8 ++++---- spec/python/test_type_ternary_opaque.py | 8 ++++---- spec/ruby/opaque_external_type_spec.rb | 6 ++---- spec/ruby/type_ternary_opaque_spec.rb | 5 ++--- 30 files changed, 142 insertions(+), 111 deletions(-) create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestOpaqueExternalType.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestTypeTernaryOpaque.java create mode 100644 spec/ks/opaque_external_type.kst create mode 100644 spec/ks/type_ternary_opaque.kst create mode 100644 spec/nim/topaque_external_type.nim create mode 100644 spec/nim/ttype_ternary_opaque.nim diff --git a/formats/opaque_external_type.ksy b/formats/opaque_external_type.ksy index 4336b88f2..37862b548 100644 --- a/formats/opaque_external_type.ksy +++ b/formats/opaque_external_type.ksy @@ -2,5 +2,5 @@ meta: id: opaque_external_type ks-opaque-types: true seq: - - id: one - type: term_strz + - id: hw + type: hello_world diff --git a/formats/type_ternary_opaque.ksy b/formats/type_ternary_opaque.ksy index 9c8416a51..5886bac17 100644 --- a/formats/type_ternary_opaque.ksy +++ b/formats/type_ternary_opaque.ksy @@ -3,12 +3,12 @@ meta: ks-opaque-types: true seq: - id: dif_wo_hack - size: 12 - type: term_strz + size: 1 + type: hello_world if: not is_hack - id: dif_with_hack - size: 12 - type: term_strz + size: 1 + type: hello_world process: xor(0b00000011) if: is_hack instances: diff --git a/spec/cpp_stl_11/test_opaque_external_type.cpp b/spec/cpp_stl_11/test_opaque_external_type.cpp index cd705da14..372c7a9b9 100644 --- a/spec/cpp_stl_11/test_opaque_external_type.cpp +++ b/spec/cpp_stl_11/test_opaque_external_type.cpp @@ -1,8 +1,6 @@ #include - -#include -#include - +#include "opaque_external_type.h" +#include "hello_world.h" #include #include #include @@ -12,9 +10,7 @@ BOOST_AUTO_TEST_CASE(test_opaque_external_type) { kaitai::kstream ks(&ifs); opaque_external_type_t* r = new opaque_external_type_t(&ks); - BOOST_CHECK_EQUAL(r->one()->s1(), "foo"); - BOOST_CHECK_EQUAL(r->one()->s2(), "bar"); - BOOST_CHECK_EQUAL(r->one()->s3(), "|baz@"); + BOOST_CHECK_EQUAL(r->hw()->one(), 102); delete r; } diff --git a/spec/cpp_stl_11/test_type_ternary_opaque.cpp b/spec/cpp_stl_11/test_type_ternary_opaque.cpp index 51afdfb21..8f0ae04a8 100644 --- a/spec/cpp_stl_11/test_type_ternary_opaque.cpp +++ b/spec/cpp_stl_11/test_type_ternary_opaque.cpp @@ -1,8 +1,6 @@ #include - -#include -#include - +#include "type_ternary_opaque.h" +#include "hello_world.h" #include #include #include @@ -12,9 +10,7 @@ BOOST_AUTO_TEST_CASE(test_type_ternary_opaque) { kaitai::kstream ks(&ifs); type_ternary_opaque_t* r = new type_ternary_opaque_t(&ks); - BOOST_CHECK_EQUAL(r->dif()->s1(), "foo"); - BOOST_CHECK_EQUAL(r->dif()->s2(), "bar"); - BOOST_CHECK_EQUAL(r->dif()->s3(), "|baz@"); + BOOST_CHECK_EQUAL(r->dif()->one(), 102); delete r; } diff --git a/spec/cpp_stl_98/test_opaque_external_type.cpp b/spec/cpp_stl_98/test_opaque_external_type.cpp index cd705da14..372c7a9b9 100644 --- a/spec/cpp_stl_98/test_opaque_external_type.cpp +++ b/spec/cpp_stl_98/test_opaque_external_type.cpp @@ -1,8 +1,6 @@ #include - -#include -#include - +#include "opaque_external_type.h" +#include "hello_world.h" #include #include #include @@ -12,9 +10,7 @@ BOOST_AUTO_TEST_CASE(test_opaque_external_type) { kaitai::kstream ks(&ifs); opaque_external_type_t* r = new opaque_external_type_t(&ks); - BOOST_CHECK_EQUAL(r->one()->s1(), "foo"); - BOOST_CHECK_EQUAL(r->one()->s2(), "bar"); - BOOST_CHECK_EQUAL(r->one()->s3(), "|baz@"); + BOOST_CHECK_EQUAL(r->hw()->one(), 102); delete r; } diff --git a/spec/cpp_stl_98/test_type_ternary_opaque.cpp b/spec/cpp_stl_98/test_type_ternary_opaque.cpp index 51afdfb21..8f0ae04a8 100644 --- a/spec/cpp_stl_98/test_type_ternary_opaque.cpp +++ b/spec/cpp_stl_98/test_type_ternary_opaque.cpp @@ -1,8 +1,6 @@ #include - -#include -#include - +#include "type_ternary_opaque.h" +#include "hello_world.h" #include #include #include @@ -12,9 +10,7 @@ BOOST_AUTO_TEST_CASE(test_type_ternary_opaque) { kaitai::kstream ks(&ifs); type_ternary_opaque_t* r = new type_ternary_opaque_t(&ks); - BOOST_CHECK_EQUAL(r->dif()->s1(), "foo"); - BOOST_CHECK_EQUAL(r->dif()->s2(), "bar"); - BOOST_CHECK_EQUAL(r->dif()->s3(), "|baz@"); + BOOST_CHECK_EQUAL(r->dif()->one(), 102); delete r; } diff --git a/spec/csharp/kaitai_struct_csharp_tests/tests/SpecOpaqueExternalType.cs b/spec/csharp/kaitai_struct_csharp_tests/tests/SpecOpaqueExternalType.cs index 2574909c5..5c28f8405 100644 --- a/spec/csharp/kaitai_struct_csharp_tests/tests/SpecOpaqueExternalType.cs +++ b/spec/csharp/kaitai_struct_csharp_tests/tests/SpecOpaqueExternalType.cs @@ -9,9 +9,8 @@ public class SpecOpaqueExternalType : CommonSpec public void TestOpaqueExternalType() { var r = OpaqueExternalType.FromFile(SourceFile("term_strz.bin")); - Assert.AreEqual(r.One.S1, "foo"); - Assert.AreEqual(r.One.S2, "bar"); - Assert.AreEqual(r.One.S3, "|baz@"); + + Assert.AreEqual(r.Hw.One, 102); } } } diff --git a/spec/csharp/kaitai_struct_csharp_tests/tests/SpecTypeTernaryOpaque.cs b/spec/csharp/kaitai_struct_csharp_tests/tests/SpecTypeTernaryOpaque.cs index 8a03c6975..425df4af4 100644 --- a/spec/csharp/kaitai_struct_csharp_tests/tests/SpecTypeTernaryOpaque.cs +++ b/spec/csharp/kaitai_struct_csharp_tests/tests/SpecTypeTernaryOpaque.cs @@ -9,9 +9,8 @@ public class SpecTypeTernaryOpaque : CommonSpec public void TestTypeTernaryOpaque() { var r = TypeTernaryOpaque.FromFile(SourceFile("term_strz.bin")); - Assert.AreEqual(r.Dif.S1, "foo"); - Assert.AreEqual(r.Dif.S2, "bar"); - Assert.AreEqual(r.Dif.S3, "|baz@"); + + Assert.AreEqual(r.Dif.One, 102); } } } diff --git a/spec/go/opaque_external_type_test.go b/spec/go/opaque_external_type_test.go index ad54f2844..02b2c1df9 100644 --- a/spec/go/opaque_external_type_test.go +++ b/spec/go/opaque_external_type_test.go @@ -27,7 +27,5 @@ func TestOpaqueExternalType(t *testing.T) { t.Fatal(err) } - assert.EqualValues(t, "foo", r.One.S1) - assert.EqualValues(t, "bar", r.One.S2) - assert.EqualValues(t, "|baz@", r.One.S3) + assert.EqualValues(t, 102, r.Hw.One) } diff --git a/spec/go/type_ternary_opaque_test.go b/spec/go/type_ternary_opaque_test.go index 5df214cc2..0b2e0c64a 100644 --- a/spec/go/type_ternary_opaque_test.go +++ b/spec/go/type_ternary_opaque_test.go @@ -31,15 +31,5 @@ func TestTypeTernaryOpaque(t *testing.T) { if err != nil { t.Fatal(err) } - assert.EqualValues(t, "foo", tmp1.S1) - tmp2, err := r.Dif() - if err != nil { - t.Fatal(err) - } - assert.EqualValues(t, "bar", tmp2.S2) - tmp3, err := r.Dif() - if err != nil { - t.Fatal(err) - } - assert.EqualValues(t, "|baz@", tmp3.S3) + assert.EqualValues(t, 102, tmp1.One) } diff --git a/spec/java/src/io/kaitai/struct/spec/TestOpaqueExternalType.java b/spec/java/src/io/kaitai/struct/spec/TestOpaqueExternalType.java index c0a85ff5f..18ab1d8ed 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestOpaqueExternalType.java +++ b/spec/java/src/io/kaitai/struct/spec/TestOpaqueExternalType.java @@ -2,16 +2,13 @@ import io.kaitai.struct.testformats.OpaqueExternalType; import org.testng.annotations.Test; - -import static org.testng.Assert.assertEquals; - +import static org.testng.Assert.*; public class TestOpaqueExternalType extends CommonSpec { + @Test public void testOpaqueExternalType() throws Exception { OpaqueExternalType r = OpaqueExternalType.fromFile(SRC_DIR + "term_strz.bin"); - assertEquals(r.one().s1(), "foo"); - assertEquals(r.one().s2(), "bar"); - assertEquals(r.one().s3(), "|baz@"); + assertIntEquals(r.hw().one(), 102); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestTypeTernaryOpaque.java b/spec/java/src/io/kaitai/struct/spec/TestTypeTernaryOpaque.java index 258a75745..dadc4d63c 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestTypeTernaryOpaque.java +++ b/spec/java/src/io/kaitai/struct/spec/TestTypeTernaryOpaque.java @@ -2,16 +2,13 @@ import io.kaitai.struct.testformats.TypeTernaryOpaque; import org.testng.annotations.Test; - -import static org.testng.Assert.assertEquals; - +import static org.testng.Assert.*; public class TestTypeTernaryOpaque extends CommonSpec { + @Test public void testTypeTernaryOpaque() throws Exception { TypeTernaryOpaque r = TypeTernaryOpaque.fromFile(SRC_DIR + "term_strz.bin"); - assertEquals(r.dif().s1(), "foo"); - assertEquals(r.dif().s2(), "bar"); - assertEquals(r.dif().s3(), "|baz@"); + assertIntEquals(r.dif().one(), 102); } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestOpaqueExternalType.java b/spec/java/src/io/kaitai/struct/specwrite/TestOpaqueExternalType.java new file mode 100644 index 000000000..86d41c8ba --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestOpaqueExternalType.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.OpaqueExternalType; +import org.testng.annotations.Test; + +public class TestOpaqueExternalType extends CommonSpec { + @Override + protected Class getStructClass() { + return OpaqueExternalType.class; + } + + @Override + protected String getSrcFilename() { + return "term_strz.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestTypeTernaryOpaque.java b/spec/java/src/io/kaitai/struct/specwrite/TestTypeTernaryOpaque.java new file mode 100644 index 000000000..e4bad0cbe --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestTypeTernaryOpaque.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.TypeTernaryOpaque; +import org.testng.annotations.Test; + +public class TestTypeTernaryOpaque extends CommonSpec { + @Override + protected Class getStructClass() { + return TypeTernaryOpaque.class; + } + + @Override + protected String getSrcFilename() { + return "term_strz.bin"; + } + +} diff --git a/spec/javascript/test_opaque_external_type.js b/spec/javascript/test_opaque_external_type.js index 10f5cc487..e8f96ddeb 100644 --- a/spec/javascript/test_opaque_external_type.js +++ b/spec/javascript/test_opaque_external_type.js @@ -1,8 +1,9 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + var assert = require('assert'); var testHelper = require('testHelper'); -testHelper('OpaqueExternalType', 'src/term_strz.bin', function(r) { - assert.equal(r.one.s1, 'foo'); - assert.equal(r.one.s2, 'bar'); - assert.equal(r.one.s3, '|baz@'); +testHelper('OpaqueExternalType', 'src/term_strz.bin', function(r, OpaqueExternalType) { + + assert.strictEqual(r.hw.one, 102); }); diff --git a/spec/javascript/test_type_ternary_opaque.js b/spec/javascript/test_type_ternary_opaque.js index 9e047c6df..4e8e0f846 100644 --- a/spec/javascript/test_type_ternary_opaque.js +++ b/spec/javascript/test_type_ternary_opaque.js @@ -1,8 +1,9 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + var assert = require('assert'); var testHelper = require('testHelper'); -testHelper('TypeTernaryOpaque', 'src/term_strz.bin', function(r) { - assert.equal(r.dif.s1, 'foo'); - assert.equal(r.dif.s2, 'bar'); - assert.equal(r.dif.s3, '|baz@'); +testHelper('TypeTernaryOpaque', 'src/term_strz.bin', function(r, TypeTernaryOpaque) { + + assert.strictEqual(r.dif.one, 102); }); diff --git a/spec/ks/opaque_external_type.kst b/spec/ks/opaque_external_type.kst new file mode 100644 index 000000000..177d6b423 --- /dev/null +++ b/spec/ks/opaque_external_type.kst @@ -0,0 +1,7 @@ +id: opaque_external_type +data: term_strz.bin +asserts: + # the `.as` type cast is effectively a hack that fools the type validation + # of the compiler, but it's better to have a hacky KST spec than none + - actual: hw.one.as + expected: 0x66 diff --git a/spec/ks/type_ternary_opaque.kst b/spec/ks/type_ternary_opaque.kst new file mode 100644 index 000000000..3e262632a --- /dev/null +++ b/spec/ks/type_ternary_opaque.kst @@ -0,0 +1,7 @@ +id: type_ternary_opaque +data: term_strz.bin +asserts: + # the `.as` type cast is effectively a hack that fools the type validation + # of the compiler, but it's better to have a hacky KST spec than none + - actual: dif.one.as + expected: 0x66 diff --git a/spec/lua/test_opaque_external_type.lua b/spec/lua/test_opaque_external_type.lua index 9f39504c4..fb36b57ba 100644 --- a/spec/lua/test_opaque_external_type.lua +++ b/spec/lua/test_opaque_external_type.lua @@ -1,3 +1,5 @@ +-- Autogenerated from KST: please remove this line if doing any edits by hand! + local luaunit = require("luaunit") require("opaque_external_type") @@ -7,7 +9,5 @@ TestOpaqueExternalType = {} function TestOpaqueExternalType:test_opaque_external_type() local r = OpaqueExternalType:from_file("src/term_strz.bin") - luaunit.assertEquals(r.one.s1, "foo") - luaunit.assertEquals(r.one.s2, "bar") - luaunit.assertEquals(r.one.s3, "|baz@") + luaunit.assertEquals(r.hw.one, 102) end diff --git a/spec/lua/test_type_ternary_opaque.lua b/spec/lua/test_type_ternary_opaque.lua index f047751f2..9f103768d 100644 --- a/spec/lua/test_type_ternary_opaque.lua +++ b/spec/lua/test_type_ternary_opaque.lua @@ -1,3 +1,5 @@ +-- Autogenerated from KST: please remove this line if doing any edits by hand! + local luaunit = require("luaunit") require("type_ternary_opaque") @@ -7,7 +9,5 @@ TestTypeTernaryOpaque = {} function TestTypeTernaryOpaque:test_type_ternary_opaque() local r = TypeTernaryOpaque:from_file("src/term_strz.bin") - luaunit.assertEquals(r.dif.s1, "foo") - luaunit.assertEquals(r.dif.s2, "bar") - luaunit.assertEquals(r.dif.s3, "|baz@") + luaunit.assertEquals(r.dif.one, 102) end diff --git a/spec/nim/topaque_external_type.nim b/spec/nim/topaque_external_type.nim new file mode 100644 index 000000000..d712b9af8 --- /dev/null +++ b/spec/nim/topaque_external_type.nim @@ -0,0 +1,7 @@ +import os, streams, options, sequtils +import ../../compiled/nim/opaque_external_type +import auxiliary/test_utils + +let r = OpaqueExternalType.fromFile("../../src/term_strz.bin") + +assert r.hw.one == 102 diff --git a/spec/nim/ttype_ternary_opaque.nim b/spec/nim/ttype_ternary_opaque.nim new file mode 100644 index 000000000..2055fc705 --- /dev/null +++ b/spec/nim/ttype_ternary_opaque.nim @@ -0,0 +1,7 @@ +import os, streams, options, sequtils +import ../../compiled/nim/type_ternary_opaque +import auxiliary/test_utils + +let r = TypeTernaryOpaque.fromFile("../../src/term_strz.bin") + +assert r.dif.one == 102 diff --git a/spec/perl/TestOpaqueExternalType.t b/spec/perl/TestOpaqueExternalType.t index 3cd388afd..bccc4ee8d 100644 --- a/spec/perl/TestOpaqueExternalType.t +++ b/spec/perl/TestOpaqueExternalType.t @@ -1,3 +1,5 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + package spec::perl::TestOpaqueExternalType; use strict; @@ -6,12 +8,10 @@ use base qw(Test::Class); use Test::More; use OpaqueExternalType; -sub test_opaque_external_type: Test(3) { +sub test_opaque_external_type: Test(1) { my $r = OpaqueExternalType->from_file('src/term_strz.bin'); - is($r->one()->s1(), 'foo', 'Equals'); - is($r->one()->s2(), 'bar', 'Equals'); - is($r->one()->s3(), '|baz@', 'Equals'); + is($r->hw()->one(), 102, 'Equals'); } Test::Class->runtests; diff --git a/spec/perl/TestTypeTernaryOpaque.t b/spec/perl/TestTypeTernaryOpaque.t index bf46b20fa..a1b022c35 100644 --- a/spec/perl/TestTypeTernaryOpaque.t +++ b/spec/perl/TestTypeTernaryOpaque.t @@ -1,3 +1,5 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + package spec::perl::TestTypeTernaryOpaque; use strict; @@ -6,12 +8,10 @@ use base qw(Test::Class); use Test::More; use TypeTernaryOpaque; -sub test_type_ternary_opaque: Test(3) { +sub test_type_ternary_opaque: Test(1) { my $r = TypeTernaryOpaque->from_file('src/term_strz.bin'); - is($r->dif()->s1(), 'foo', 'Equals'); - is($r->dif()->s2(), 'bar', 'Equals'); - is($r->dif()->s3(), '|baz@', 'Equals'); + is($r->dif()->one(), 102, 'Equals'); } Test::Class->runtests; diff --git a/spec/php/OpaqueExternalTypeTest.php b/spec/php/OpaqueExternalTypeTest.php index 8bb5a3293..25be2b407 100644 --- a/spec/php/OpaqueExternalTypeTest.php +++ b/spec/php/OpaqueExternalTypeTest.php @@ -1,12 +1,12 @@ assertSame('foo', $r->one->s1); - $this->assertSame('bar', $r->one->s2); - $this->assertSame('|baz@', $r->one->s3); + $this->assertSame(102, $r->hw()->one()); } } diff --git a/spec/php/TypeTernaryOpaqueTest.php b/spec/php/TypeTernaryOpaqueTest.php index e599d2d2c..827bb3831 100644 --- a/spec/php/TypeTernaryOpaqueTest.php +++ b/spec/php/TypeTernaryOpaqueTest.php @@ -1,12 +1,12 @@ assertSame('foo', $r->dif->s1); - $this->assertSame('bar', $r->dif->s2); - $this->assertSame('|baz@', $r->dif->s3); + $this->assertSame(102, $r->dif()->one()); } } diff --git a/spec/python/test_opaque_external_type.py b/spec/python/test_opaque_external_type.py index 42c460392..92cead9d2 100644 --- a/spec/python/test_opaque_external_type.py +++ b/spec/python/test_opaque_external_type.py @@ -1,11 +1,11 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + import unittest from opaque_external_type import OpaqueExternalType class TestOpaqueExternalType(unittest.TestCase): def test_opaque_external_type(self): - r = OpaqueExternalType.from_file("src/term_strz.bin") + with OpaqueExternalType.from_file('src/term_strz.bin') as r: - self.assertEqual(r.one.s1, "foo") - self.assertEqual(r.one.s2, "bar") - self.assertEqual(r.one.s3, "|baz@") + self.assertEqual(r.hw.one, 102) diff --git a/spec/python/test_type_ternary_opaque.py b/spec/python/test_type_ternary_opaque.py index 0e71732e0..042273fc1 100644 --- a/spec/python/test_type_ternary_opaque.py +++ b/spec/python/test_type_ternary_opaque.py @@ -1,11 +1,11 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + import unittest from type_ternary_opaque import TypeTernaryOpaque class TestTypeTernaryOpaque(unittest.TestCase): def test_type_ternary_opaque(self): - r = TypeTernaryOpaque.from_file("src/term_strz.bin") + with TypeTernaryOpaque.from_file('src/term_strz.bin') as r: - self.assertEqual(r.dif.s1, "foo") - self.assertEqual(r.dif.s2, "bar") - self.assertEqual(r.dif.s3, "|baz@") + self.assertEqual(r.dif.one, 102) diff --git a/spec/ruby/opaque_external_type_spec.rb b/spec/ruby/opaque_external_type_spec.rb index cfdfa6b4f..e957d5663 100644 --- a/spec/ruby/opaque_external_type_spec.rb +++ b/spec/ruby/opaque_external_type_spec.rb @@ -1,11 +1,9 @@ RSpec.describe 'OpaqueExternalType' do it 'parses test properly' do require 'opaque_external_type' - require 'term_strz' # the opaque type + require 'hello_world' # the opaque type r = OpaqueExternalType.from_file('src/term_strz.bin') - expect(r.one.s1).to eq('foo') - expect(r.one.s2).to eq('bar') - expect(r.one.s3).to eq('|baz@') + expect(r.hw.one).to eq 102 end end diff --git a/spec/ruby/type_ternary_opaque_spec.rb b/spec/ruby/type_ternary_opaque_spec.rb index d898c124c..9bd45a186 100644 --- a/spec/ruby/type_ternary_opaque_spec.rb +++ b/spec/ruby/type_ternary_opaque_spec.rb @@ -1,10 +1,9 @@ RSpec.describe 'TypeTernaryOpaque' do it 'parses test properly' do require 'type_ternary_opaque' + require 'hello_world' # the opaque type r = TypeTernaryOpaque.from_file('src/term_strz.bin') - expect(r.dif.s1).to eq('foo') - expect(r.dif.s2).to eq('bar') - expect(r.dif.s3).to eq('|baz@') + expect(r.dif.one).to eq 102 end end From 07c13273189da1d3c269b583bf3941c09f48fd74 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Sun, 14 Aug 2022 17:22:59 +0200 Subject: [PATCH 036/126] Add tests {Bytes,Str,Struct}*PadTerm based on BytesPadTerm --- formats/bytes_eos_pad_term.ksy | 39 ++++++++++++++++ formats/process_bytes_pad_term.ksy | 22 +++++++++ formats/process_struct_pad_term.ksy | 31 +++++++++++++ formats/str_eos_pad_term.ksy | 44 ++++++++++++++++++ formats/str_eos_pad_term_empty.ksy | 45 +++++++++++++++++++ formats/struct_pad_term.ksy | 27 +++++++++++ .../struct/spec/TestBytesEosPadTerm.java | 19 ++++++++ .../struct/spec/TestProcessBytesPadTerm.java | 19 ++++++++ .../struct/spec/TestProcessStructPadTerm.java | 19 ++++++++ .../kaitai/struct/spec/TestStrEosPadTerm.java | 19 ++++++++ .../struct/spec/TestStrEosPadTermEmpty.java | 19 ++++++++ .../kaitai/struct/spec/TestStructPadTerm.java | 19 ++++++++ .../struct/specwrite/TestBytesEosPadTerm.java | 20 +++++++++ .../specwrite/TestProcessBytesPadTerm.java | 20 +++++++++ .../specwrite/TestProcessStructPadTerm.java | 20 +++++++++ .../struct/specwrite/TestStrEosPadTerm.java | 20 +++++++++ .../specwrite/TestStrEosPadTermEmpty.java | 20 +++++++++ .../struct/specwrite/TestStructPadTerm.java | 20 +++++++++ spec/ks/bytes_eos_pad_term.kst | 11 +++++ spec/ks/process_bytes_pad_term.kst | 12 +++++ spec/ks/process_struct_pad_term.kst | 12 +++++ spec/ks/str_eos_pad_term.kst | 11 +++++ spec/ks/str_eos_pad_term_empty.kst | 11 +++++ spec/ks/struct_pad_term.kst | 11 +++++ 24 files changed, 510 insertions(+) create mode 100644 formats/bytes_eos_pad_term.ksy create mode 100644 formats/process_bytes_pad_term.ksy create mode 100644 formats/process_struct_pad_term.ksy create mode 100644 formats/str_eos_pad_term.ksy create mode 100644 formats/str_eos_pad_term_empty.ksy create mode 100644 formats/struct_pad_term.ksy create mode 100644 spec/java/src/io/kaitai/struct/spec/TestBytesEosPadTerm.java create mode 100644 spec/java/src/io/kaitai/struct/spec/TestProcessBytesPadTerm.java create mode 100644 spec/java/src/io/kaitai/struct/spec/TestProcessStructPadTerm.java create mode 100644 spec/java/src/io/kaitai/struct/spec/TestStrEosPadTerm.java create mode 100644 spec/java/src/io/kaitai/struct/spec/TestStrEosPadTermEmpty.java create mode 100644 spec/java/src/io/kaitai/struct/spec/TestStructPadTerm.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestBytesEosPadTerm.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestProcessBytesPadTerm.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestProcessStructPadTerm.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestStrEosPadTerm.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestStrEosPadTermEmpty.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestStructPadTerm.java create mode 100644 spec/ks/bytes_eos_pad_term.kst create mode 100644 spec/ks/process_bytes_pad_term.kst create mode 100644 spec/ks/process_struct_pad_term.kst create mode 100644 spec/ks/str_eos_pad_term.kst create mode 100644 spec/ks/str_eos_pad_term_empty.kst create mode 100644 spec/ks/struct_pad_term.kst diff --git a/formats/bytes_eos_pad_term.ksy b/formats/bytes_eos_pad_term.ksy new file mode 100644 index 000000000..d622e6e2f --- /dev/null +++ b/formats/bytes_eos_pad_term.ksy @@ -0,0 +1,39 @@ +# Tests "pad-right" and "terminator" functionality in fixed-length "size-eos: true" byte arrays +meta: + id: bytes_eos_pad_term +seq: + - id: str_pad + size: 20 + type: str_pad_type + - id: str_term + size: 20 + type: str_term_type + - id: str_term_and_pad + size: 20 + type: str_term_and_pad_type + - id: str_term_include + size: 20 + type: str_term_include_type +types: + str_pad_type: + seq: + - id: value + size-eos: true + pad-right: 0x40 + str_term_type: + seq: + - id: value + size-eos: true + terminator: 0x40 + str_term_and_pad_type: + seq: + - id: value + size-eos: true + terminator: 0x40 + pad-right: 0x2b + str_term_include_type: + seq: + - id: value + size-eos: true + terminator: 0x40 + include: true diff --git a/formats/process_bytes_pad_term.ksy b/formats/process_bytes_pad_term.ksy new file mode 100644 index 000000000..f72f64cfb --- /dev/null +++ b/formats/process_bytes_pad_term.ksy @@ -0,0 +1,22 @@ +# Tests "pad-right" and "terminator" functionality in fixed-length byte arrays with "process" +meta: + id: process_bytes_pad_term +seq: + - id: str_pad + size: 20 + pad-right: 0x40 + process: xor(0x15) + - id: str_term + size: 20 + process: xor(0x15) + terminator: 0x40 + - id: str_term_and_pad + size: 20 + process: xor(0x15) + terminator: 0x40 + pad-right: 0x2b + - id: str_term_include + size: 20 + process: xor(0x15) + terminator: 0x40 + include: true diff --git a/formats/process_struct_pad_term.ksy b/formats/process_struct_pad_term.ksy new file mode 100644 index 000000000..87acdaf6b --- /dev/null +++ b/formats/process_struct_pad_term.ksy @@ -0,0 +1,31 @@ +# Tests "pad-right" and "terminator" functionality in fixed-length structs with "process" +meta: + id: process_struct_pad_term +seq: + - id: str_pad + size: 20 + pad-right: 0x40 + process: xor(0x15) + type: bytes_wrapper + - id: str_term + size: 20 + terminator: 0x40 + process: xor(0x15) + type: bytes_wrapper + - id: str_term_and_pad + size: 20 + terminator: 0x40 + pad-right: 0x2b + process: xor(0x15) + type: bytes_wrapper + - id: str_term_include + size: 20 + terminator: 0x40 + include: true + process: xor(0x15) + type: bytes_wrapper +types: + bytes_wrapper: + seq: + - id: value + size-eos: true diff --git a/formats/str_eos_pad_term.ksy b/formats/str_eos_pad_term.ksy new file mode 100644 index 000000000..2c7087a03 --- /dev/null +++ b/formats/str_eos_pad_term.ksy @@ -0,0 +1,44 @@ +# Tests "pad-right" and "terminator" functionality in fixed-length strings ("str" with "size-eos: true") +meta: + id: str_eos_pad_term + encoding: UTF-8 +seq: + - id: str_pad + size: 20 + type: str_pad_type + - id: str_term + size: 20 + type: str_term_type + - id: str_term_and_pad + size: 20 + type: str_term_and_pad_type + - id: str_term_include + size: 20 + type: str_term_include_type +types: + str_pad_type: + seq: + - id: value + type: str + size-eos: true + pad-right: 0x40 + str_term_type: + seq: + - id: value + type: str + size-eos: true + terminator: 0x40 + str_term_and_pad_type: + seq: + - id: value + type: str + size-eos: true + terminator: 0x40 + pad-right: 0x2b + str_term_include_type: + seq: + - id: value + type: str + size-eos: true + terminator: 0x40 + include: true diff --git a/formats/str_eos_pad_term_empty.ksy b/formats/str_eos_pad_term_empty.ksy new file mode 100644 index 000000000..b560fc742 --- /dev/null +++ b/formats/str_eos_pad_term_empty.ksy @@ -0,0 +1,45 @@ +# Same as "str_eos_pad_term", but used with different input file that is +# meant to test fully empty strings +meta: + id: str_eos_pad_term_empty + encoding: UTF-8 +seq: + - id: str_pad + size: 20 + type: str_pad_type + - id: str_term + size: 20 + type: str_term_type + - id: str_term_and_pad + size: 20 + type: str_term_and_pad_type + - id: str_term_include + size: 20 + type: str_term_include_type +types: + str_pad_type: + seq: + - id: value + type: str + size-eos: true + pad-right: 0x40 + str_term_type: + seq: + - id: value + type: str + size-eos: true + terminator: 0x40 + str_term_and_pad_type: + seq: + - id: value + type: str + size-eos: true + terminator: 0x40 + pad-right: 0x2b + str_term_include_type: + seq: + - id: value + type: str + size-eos: true + terminator: 0x40 + include: true diff --git a/formats/struct_pad_term.ksy b/formats/struct_pad_term.ksy new file mode 100644 index 000000000..1d99fd2de --- /dev/null +++ b/formats/struct_pad_term.ksy @@ -0,0 +1,27 @@ +# Tests "pad-right" and "terminator" functionality in fixed-length structs +meta: + id: struct_pad_term +seq: + - id: str_pad + size: 20 + pad-right: 0x40 + type: bytes_wrapper + - id: str_term + size: 20 + terminator: 0x40 + type: bytes_wrapper + - id: str_term_and_pad + size: 20 + terminator: 0x40 + pad-right: 0x2b + type: bytes_wrapper + - id: str_term_include + size: 20 + terminator: 0x40 + include: true + type: bytes_wrapper +types: + bytes_wrapper: + seq: + - id: value + size-eos: true diff --git a/spec/java/src/io/kaitai/struct/spec/TestBytesEosPadTerm.java b/spec/java/src/io/kaitai/struct/spec/TestBytesEosPadTerm.java new file mode 100644 index 000000000..2f7871d72 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestBytesEosPadTerm.java @@ -0,0 +1,19 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.BytesEosPadTerm; +import org.testng.annotations.Test; +import static org.testng.Assert.*; +public class TestBytesEosPadTerm extends CommonSpec { + + @Test + public void testBytesEosPadTerm() throws Exception { + BytesEosPadTerm r = BytesEosPadTerm.fromFile(SRC_DIR + "str_pad_term.bin"); + + assertEquals(r.strPad().value(), new byte[] { 115, 116, 114, 49 }); + assertEquals(r.strTerm().value(), new byte[] { 115, 116, 114, 50, 102, 111, 111 }); + assertEquals(r.strTermAndPad().value(), new byte[] { 115, 116, 114, 43, 43, 43, 51, 98, 97, 114, 43, 43, 43 }); + assertEquals(r.strTermInclude().value(), new byte[] { 115, 116, 114, 52, 98, 97, 122, 64 }); + } +} diff --git a/spec/java/src/io/kaitai/struct/spec/TestProcessBytesPadTerm.java b/spec/java/src/io/kaitai/struct/spec/TestProcessBytesPadTerm.java new file mode 100644 index 000000000..4394a7eae --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestProcessBytesPadTerm.java @@ -0,0 +1,19 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.ProcessBytesPadTerm; +import org.testng.annotations.Test; +import static org.testng.Assert.*; +public class TestProcessBytesPadTerm extends CommonSpec { + + @Test + public void testProcessBytesPadTerm() throws Exception { + ProcessBytesPadTerm r = ProcessBytesPadTerm.fromFile(SRC_DIR + "str_pad_term.bin"); + + assertEquals(r.strPad(), new byte[] { 102, 97, 103, 36 }); + assertEquals(r.strTerm(), new byte[] { 102, 97, 103, 39, 115, 122, 122 }); + assertEquals(r.strTermAndPad(), new byte[] { 102, 97, 103, 62, 62, 62, 38, 119, 116, 103, 62, 62, 62 }); + assertEquals(r.strTermInclude(), new byte[] { 102, 97, 103, 33, 119, 116, 111, 85 }); + } +} diff --git a/spec/java/src/io/kaitai/struct/spec/TestProcessStructPadTerm.java b/spec/java/src/io/kaitai/struct/spec/TestProcessStructPadTerm.java new file mode 100644 index 000000000..0ac742060 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestProcessStructPadTerm.java @@ -0,0 +1,19 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.ProcessStructPadTerm; +import org.testng.annotations.Test; +import static org.testng.Assert.*; +public class TestProcessStructPadTerm extends CommonSpec { + + @Test + public void testProcessStructPadTerm() throws Exception { + ProcessStructPadTerm r = ProcessStructPadTerm.fromFile(SRC_DIR + "str_pad_term.bin"); + + assertEquals(r.strPad().value(), new byte[] { 102, 97, 103, 36 }); + assertEquals(r.strTerm().value(), new byte[] { 102, 97, 103, 39, 115, 122, 122 }); + assertEquals(r.strTermAndPad().value(), new byte[] { 102, 97, 103, 62, 62, 62, 38, 119, 116, 103, 62, 62, 62 }); + assertEquals(r.strTermInclude().value(), new byte[] { 102, 97, 103, 33, 119, 116, 111, 85 }); + } +} diff --git a/spec/java/src/io/kaitai/struct/spec/TestStrEosPadTerm.java b/spec/java/src/io/kaitai/struct/spec/TestStrEosPadTerm.java new file mode 100644 index 000000000..ab94151b6 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestStrEosPadTerm.java @@ -0,0 +1,19 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.StrEosPadTerm; +import org.testng.annotations.Test; +import static org.testng.Assert.*; +public class TestStrEosPadTerm extends CommonSpec { + + @Test + public void testStrEosPadTerm() throws Exception { + StrEosPadTerm r = StrEosPadTerm.fromFile(SRC_DIR + "str_pad_term.bin"); + + assertEquals(r.strPad().value(), "str1"); + assertEquals(r.strTerm().value(), "str2foo"); + assertEquals(r.strTermAndPad().value(), "str+++3bar+++"); + assertEquals(r.strTermInclude().value(), "str4baz@"); + } +} diff --git a/spec/java/src/io/kaitai/struct/spec/TestStrEosPadTermEmpty.java b/spec/java/src/io/kaitai/struct/spec/TestStrEosPadTermEmpty.java new file mode 100644 index 000000000..aa7fd6158 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestStrEosPadTermEmpty.java @@ -0,0 +1,19 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.StrEosPadTermEmpty; +import org.testng.annotations.Test; +import static org.testng.Assert.*; +public class TestStrEosPadTermEmpty extends CommonSpec { + + @Test + public void testStrEosPadTermEmpty() throws Exception { + StrEosPadTermEmpty r = StrEosPadTermEmpty.fromFile(SRC_DIR + "str_pad_term_empty.bin"); + + assertEquals(r.strPad().value(), ""); + assertEquals(r.strTerm().value(), ""); + assertEquals(r.strTermAndPad().value(), ""); + assertEquals(r.strTermInclude().value(), "@"); + } +} diff --git a/spec/java/src/io/kaitai/struct/spec/TestStructPadTerm.java b/spec/java/src/io/kaitai/struct/spec/TestStructPadTerm.java new file mode 100644 index 000000000..2339a481c --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestStructPadTerm.java @@ -0,0 +1,19 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.StructPadTerm; +import org.testng.annotations.Test; +import static org.testng.Assert.*; +public class TestStructPadTerm extends CommonSpec { + + @Test + public void testStructPadTerm() throws Exception { + StructPadTerm r = StructPadTerm.fromFile(SRC_DIR + "str_pad_term.bin"); + + assertEquals(r.strPad().value(), new byte[] { 115, 116, 114, 49 }); + assertEquals(r.strTerm().value(), new byte[] { 115, 116, 114, 50, 102, 111, 111 }); + assertEquals(r.strTermAndPad().value(), new byte[] { 115, 116, 114, 43, 43, 43, 51, 98, 97, 114, 43, 43, 43 }); + assertEquals(r.strTermInclude().value(), new byte[] { 115, 116, 114, 52, 98, 97, 122, 64 }); + } +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBytesEosPadTerm.java b/spec/java/src/io/kaitai/struct/specwrite/TestBytesEosPadTerm.java new file mode 100644 index 000000000..83df82297 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBytesEosPadTerm.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.BytesEosPadTerm; +import org.testng.annotations.Test; + +public class TestBytesEosPadTerm extends CommonSpec { + @Override + protected Class getStructClass() { + return BytesEosPadTerm.class; + } + + @Override + protected String getSrcFilename() { + return "str_pad_term.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestProcessBytesPadTerm.java b/spec/java/src/io/kaitai/struct/specwrite/TestProcessBytesPadTerm.java new file mode 100644 index 000000000..b9e958860 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestProcessBytesPadTerm.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ProcessBytesPadTerm; +import org.testng.annotations.Test; + +public class TestProcessBytesPadTerm extends CommonSpec { + @Override + protected Class getStructClass() { + return ProcessBytesPadTerm.class; + } + + @Override + protected String getSrcFilename() { + return "str_pad_term.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestProcessStructPadTerm.java b/spec/java/src/io/kaitai/struct/specwrite/TestProcessStructPadTerm.java new file mode 100644 index 000000000..2d95f13ce --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestProcessStructPadTerm.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ProcessStructPadTerm; +import org.testng.annotations.Test; + +public class TestProcessStructPadTerm extends CommonSpec { + @Override + protected Class getStructClass() { + return ProcessStructPadTerm.class; + } + + @Override + protected String getSrcFilename() { + return "str_pad_term.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestStrEosPadTerm.java b/spec/java/src/io/kaitai/struct/specwrite/TestStrEosPadTerm.java new file mode 100644 index 000000000..ad0da1408 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestStrEosPadTerm.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.StrEosPadTerm; +import org.testng.annotations.Test; + +public class TestStrEosPadTerm extends CommonSpec { + @Override + protected Class getStructClass() { + return StrEosPadTerm.class; + } + + @Override + protected String getSrcFilename() { + return "str_pad_term.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestStrEosPadTermEmpty.java b/spec/java/src/io/kaitai/struct/specwrite/TestStrEosPadTermEmpty.java new file mode 100644 index 000000000..8c38d8c6a --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestStrEosPadTermEmpty.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.StrEosPadTermEmpty; +import org.testng.annotations.Test; + +public class TestStrEosPadTermEmpty extends CommonSpec { + @Override + protected Class getStructClass() { + return StrEosPadTermEmpty.class; + } + + @Override + protected String getSrcFilename() { + return "str_pad_term_empty.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestStructPadTerm.java b/spec/java/src/io/kaitai/struct/specwrite/TestStructPadTerm.java new file mode 100644 index 000000000..69dead14d --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestStructPadTerm.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.StructPadTerm; +import org.testng.annotations.Test; + +public class TestStructPadTerm extends CommonSpec { + @Override + protected Class getStructClass() { + return StructPadTerm.class; + } + + @Override + protected String getSrcFilename() { + return "str_pad_term.bin"; + } + +} diff --git a/spec/ks/bytes_eos_pad_term.kst b/spec/ks/bytes_eos_pad_term.kst new file mode 100644 index 000000000..781c11512 --- /dev/null +++ b/spec/ks/bytes_eos_pad_term.kst @@ -0,0 +1,11 @@ +id: bytes_eos_pad_term +data: str_pad_term.bin +asserts: + - actual: str_pad.value + expected: '[0x73, 0x74, 0x72, 0x31]' # str1 + - actual: str_term.value + expected: '[0x73, 0x74, 0x72, 0x32, 0x66, 0x6f, 0x6f]' # str2foo + - actual: str_term_and_pad.value + expected: '[0x73, 0x74, 0x72, 0x2b, 0x2b, 0x2b, 0x33, 0x62, 0x61, 0x72, 0x2b, 0x2b, 0x2b]' # str+++3bar+++ + - actual: str_term_include.value + expected: '[0x73, 0x74, 0x72, 0x34, 0x62, 0x61, 0x7a, 0x40]' # str4baz@ diff --git a/spec/ks/process_bytes_pad_term.kst b/spec/ks/process_bytes_pad_term.kst new file mode 100644 index 000000000..5441a0cb8 --- /dev/null +++ b/spec/ks/process_bytes_pad_term.kst @@ -0,0 +1,12 @@ +id: process_bytes_pad_term +data: str_pad_term.bin +asserts: + # See https://gchq.github.io/CyberChef/#recipe=XOR(%7B'option':'Hex','string':'15'%7D,'Standard',false)&input=c3RyMUBAQEBAQEBAQEBAQEBAQEBzdHIyZm9vQCsrKysrKysrKysrK3N0cisrKzNiYXIrKytAKysrKysrc3RyNGJhekAuLi4uLi4uLi4uLi4 + - actual: str_pad + expected: '[0x66, 0x61, 0x67, 0x24]' # fag$ + - actual: str_term + expected: '[0x66, 0x61, 0x67, 0x27, 0x73, 0x7a, 0x7a]' # fag'szz + - actual: str_term_and_pad + expected: '[0x66, 0x61, 0x67, 0x3e, 0x3e, 0x3e, 0x26, 0x77, 0x74, 0x67, 0x3e, 0x3e, 0x3e]' # fag>>>&wtg>>> + - actual: str_term_include + expected: '[0x66, 0x61, 0x67, 0x21, 0x77, 0x74, 0x6f, 0x55]' # fag!wtoU diff --git a/spec/ks/process_struct_pad_term.kst b/spec/ks/process_struct_pad_term.kst new file mode 100644 index 000000000..9cf26bc94 --- /dev/null +++ b/spec/ks/process_struct_pad_term.kst @@ -0,0 +1,12 @@ +id: process_struct_pad_term +data: str_pad_term.bin +# See process_bytes_pad_term.kst +asserts: + - actual: str_pad.value + expected: '[0x66, 0x61, 0x67, 0x24]' # fag$ + - actual: str_term.value + expected: '[0x66, 0x61, 0x67, 0x27, 0x73, 0x7a, 0x7a]' # fag'szz + - actual: str_term_and_pad.value + expected: '[0x66, 0x61, 0x67, 0x3e, 0x3e, 0x3e, 0x26, 0x77, 0x74, 0x67, 0x3e, 0x3e, 0x3e]' # fag>>>&wtg>>> + - actual: str_term_include.value + expected: '[0x66, 0x61, 0x67, 0x21, 0x77, 0x74, 0x6f, 0x55]' # fag!wtoU diff --git a/spec/ks/str_eos_pad_term.kst b/spec/ks/str_eos_pad_term.kst new file mode 100644 index 000000000..18746d2eb --- /dev/null +++ b/spec/ks/str_eos_pad_term.kst @@ -0,0 +1,11 @@ +id: str_eos_pad_term +data: str_pad_term.bin +asserts: + - actual: str_pad.value + expected: '"str1"' + - actual: str_term.value + expected: '"str2foo"' + - actual: str_term_and_pad.value + expected: '"str+++3bar+++"' + - actual: str_term_include.value + expected: '"str4baz@"' diff --git a/spec/ks/str_eos_pad_term_empty.kst b/spec/ks/str_eos_pad_term_empty.kst new file mode 100644 index 000000000..94764eeaa --- /dev/null +++ b/spec/ks/str_eos_pad_term_empty.kst @@ -0,0 +1,11 @@ +id: str_eos_pad_term_empty +data: str_pad_term_empty.bin +asserts: + - actual: str_pad.value + expected: '""' + - actual: str_term.value + expected: '""' + - actual: str_term_and_pad.value + expected: '""' + - actual: str_term_include.value + expected: '"@"' diff --git a/spec/ks/struct_pad_term.kst b/spec/ks/struct_pad_term.kst new file mode 100644 index 000000000..56fb94cb3 --- /dev/null +++ b/spec/ks/struct_pad_term.kst @@ -0,0 +1,11 @@ +id: struct_pad_term +data: str_pad_term.bin +asserts: + - actual: str_pad.value + expected: '[0x73, 0x74, 0x72, 0x31]' # str1 + - actual: str_term.value + expected: '[0x73, 0x74, 0x72, 0x32, 0x66, 0x6f, 0x6f]' # str2foo + - actual: str_term_and_pad.value + expected: '[0x73, 0x74, 0x72, 0x2b, 0x2b, 0x2b, 0x33, 0x62, 0x61, 0x72, 0x2b, 0x2b, 0x2b]' # str+++3bar+++ + - actual: str_term_include.value + expected: '[0x73, 0x74, 0x72, 0x34, 0x62, 0x61, 0x7a, 0x40]' # str4baz@ From 09b3ba00973ef6cfbce0a05d86c4ebf6bf8fe4d3 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Sun, 14 Aug 2022 18:15:09 +0200 Subject: [PATCH 037/126] Add Term{Bytes,Strz}2 as a variation of existing Term{Bytes,Strz} They detect https://github.com/kaitai-io/kaitai_struct/issues/783 and are also more difficult to serialize, because the `consume: false` field is at the end. --- formats/term_bytes2.ksy | 14 +++++++++++++ formats/term_strz2.ksy | 21 +++++++++++++++++++ .../io/kaitai/struct/spec/TestTermBytes2.java | 18 ++++++++++++++++ .../io/kaitai/struct/spec/TestTermStrz2.java | 18 ++++++++++++++++ .../struct/specwrite/TestTermBytes2.java | 20 ++++++++++++++++++ .../struct/specwrite/TestTermStrz2.java | 20 ++++++++++++++++++ spec/ks/term_bytes2.kst | 9 ++++++++ spec/ks/term_strz2.kst | 9 ++++++++ 8 files changed, 129 insertions(+) create mode 100644 formats/term_bytes2.ksy create mode 100644 formats/term_strz2.ksy create mode 100644 spec/java/src/io/kaitai/struct/spec/TestTermBytes2.java create mode 100644 spec/java/src/io/kaitai/struct/spec/TestTermStrz2.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestTermBytes2.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestTermStrz2.java create mode 100644 spec/ks/term_bytes2.kst create mode 100644 spec/ks/term_strz2.kst diff --git a/formats/term_bytes2.ksy b/formats/term_bytes2.ksy new file mode 100644 index 000000000..44a7e2c66 --- /dev/null +++ b/formats/term_bytes2.ksy @@ -0,0 +1,14 @@ +# Like "term_bytes", but the order of fields is `include: true` and +# `consume: false` (in "term_bytes" it's the other way around) - this may catch +# other bugs that passed "term_bytes" just by luck. +meta: + id: term_bytes2 +seq: + - id: s1 + terminator: 0x7c + - id: s2 + terminator: 0x7c + include: true + - id: s3 + terminator: 0x40 + consume: false diff --git a/formats/term_strz2.ksy b/formats/term_strz2.ksy new file mode 100644 index 000000000..37d192dd7 --- /dev/null +++ b/formats/term_strz2.ksy @@ -0,0 +1,21 @@ +# Like "term_strz", but the order of fields is `include: true` and +# `consume: false` (in "term_strz" it's the other way around) - this may catch +# other bugs that passed "term_strz" just by luck. +meta: + id: term_strz2 + endian: le +seq: + - id: s1 + type: str + encoding: UTF-8 + terminator: 0x7c + - id: s2 + type: str + encoding: UTF-8 + terminator: 0x7c + include: true + - id: s3 + type: str + encoding: UTF-8 + terminator: 0x40 + consume: false diff --git a/spec/java/src/io/kaitai/struct/spec/TestTermBytes2.java b/spec/java/src/io/kaitai/struct/spec/TestTermBytes2.java new file mode 100644 index 000000000..439171287 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestTermBytes2.java @@ -0,0 +1,18 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.TermBytes2; +import org.testng.annotations.Test; +import static org.testng.Assert.*; +public class TestTermBytes2 extends CommonSpec { + + @Test + public void testTermBytes2() throws Exception { + TermBytes2 r = TermBytes2.fromFile(SRC_DIR + "term_strz.bin"); + + assertEquals(r.s1(), new byte[] { 102, 111, 111 }); + assertEquals(r.s2(), new byte[] { 98, 97, 114, 124 }); + assertEquals(r.s3(), new byte[] { 98, 97, 122 }); + } +} diff --git a/spec/java/src/io/kaitai/struct/spec/TestTermStrz2.java b/spec/java/src/io/kaitai/struct/spec/TestTermStrz2.java new file mode 100644 index 000000000..7c4e1d49d --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestTermStrz2.java @@ -0,0 +1,18 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.TermStrz2; +import org.testng.annotations.Test; +import static org.testng.Assert.*; +public class TestTermStrz2 extends CommonSpec { + + @Test + public void testTermStrz2() throws Exception { + TermStrz2 r = TermStrz2.fromFile(SRC_DIR + "term_strz.bin"); + + assertEquals(r.s1(), "foo"); + assertEquals(r.s2(), "bar|"); + assertEquals(r.s3(), "baz"); + } +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestTermBytes2.java b/spec/java/src/io/kaitai/struct/specwrite/TestTermBytes2.java new file mode 100644 index 000000000..ba510a690 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestTermBytes2.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.TermBytes2; +import org.testng.annotations.Test; + +public class TestTermBytes2 extends CommonSpec { + @Override + protected Class getStructClass() { + return TermBytes2.class; + } + + @Override + protected String getSrcFilename() { + return "term_strz.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestTermStrz2.java b/spec/java/src/io/kaitai/struct/specwrite/TestTermStrz2.java new file mode 100644 index 000000000..7879320b6 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestTermStrz2.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.TermStrz2; +import org.testng.annotations.Test; + +public class TestTermStrz2 extends CommonSpec { + @Override + protected Class getStructClass() { + return TermStrz2.class; + } + + @Override + protected String getSrcFilename() { + return "term_strz.bin"; + } + +} diff --git a/spec/ks/term_bytes2.kst b/spec/ks/term_bytes2.kst new file mode 100644 index 000000000..2d4851c03 --- /dev/null +++ b/spec/ks/term_bytes2.kst @@ -0,0 +1,9 @@ +id: term_bytes2 +data: term_strz.bin +asserts: + - actual: s1 + expected: '[0x66, 0x6f, 0x6f]' + - actual: s2 + expected: '[0x62, 0x61, 0x72, 0x7c]' + - actual: s3 + expected: '[0x62, 0x61, 0x7a]' diff --git a/spec/ks/term_strz2.kst b/spec/ks/term_strz2.kst new file mode 100644 index 000000000..db5b20e7a --- /dev/null +++ b/spec/ks/term_strz2.kst @@ -0,0 +1,9 @@ +id: term_strz2 +data: term_strz.bin +asserts: + - actual: s1 + expected: '"foo"' + - actual: s2 + expected: '"bar|"' + - actual: s3 + expected: '"baz"' From 3b0e57a3a355a632b8b6988a0eb015a8091de56c Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Sun, 14 Aug 2022 18:51:43 +0200 Subject: [PATCH 038/126] Add TermStruct{,2} based on TermBytes{,2} --- formats/term_struct.ksy | 20 +++++++++++++++++++ formats/term_struct2.ksy | 20 +++++++++++++++++++ .../io/kaitai/struct/spec/TestTermStruct.java | 18 +++++++++++++++++ .../kaitai/struct/spec/TestTermStruct2.java | 18 +++++++++++++++++ .../struct/specwrite/TestTermStruct.java | 20 +++++++++++++++++++ .../struct/specwrite/TestTermStruct2.java | 20 +++++++++++++++++++ spec/ks/term_struct.kst | 9 +++++++++ spec/ks/term_struct2.kst | 9 +++++++++ 8 files changed, 134 insertions(+) create mode 100644 formats/term_struct.ksy create mode 100644 formats/term_struct2.ksy create mode 100644 spec/java/src/io/kaitai/struct/spec/TestTermStruct.java create mode 100644 spec/java/src/io/kaitai/struct/spec/TestTermStruct2.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestTermStruct.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestTermStruct2.java create mode 100644 spec/ks/term_struct.kst create mode 100644 spec/ks/term_struct2.kst diff --git a/formats/term_struct.ksy b/formats/term_struct.ksy new file mode 100644 index 000000000..dd3330540 --- /dev/null +++ b/formats/term_struct.ksy @@ -0,0 +1,20 @@ +# Like "term_bytes", but the byte array is wrapped in a user-defined type +meta: + id: term_struct +seq: + - id: s1 + terminator: 0x7c + type: bytes_wrapper + - id: s2 + terminator: 0x7c + consume: false + type: bytes_wrapper + - id: s3 + terminator: 0x40 + include: true + type: bytes_wrapper +types: + bytes_wrapper: + seq: + - id: value + size-eos: true diff --git a/formats/term_struct2.ksy b/formats/term_struct2.ksy new file mode 100644 index 000000000..d067d0bd5 --- /dev/null +++ b/formats/term_struct2.ksy @@ -0,0 +1,20 @@ +# Like "term_bytes2", but the byte array is wrapped in a user-defined type +meta: + id: term_struct2 +seq: + - id: s1 + terminator: 0x7c + type: bytes_wrapper + - id: s2 + terminator: 0x7c + include: true + type: bytes_wrapper + - id: s3 + terminator: 0x40 + consume: false + type: bytes_wrapper +types: + bytes_wrapper: + seq: + - id: value + size-eos: true diff --git a/spec/java/src/io/kaitai/struct/spec/TestTermStruct.java b/spec/java/src/io/kaitai/struct/spec/TestTermStruct.java new file mode 100644 index 000000000..b35d795de --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestTermStruct.java @@ -0,0 +1,18 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.TermStruct; +import org.testng.annotations.Test; +import static org.testng.Assert.*; +public class TestTermStruct extends CommonSpec { + + @Test + public void testTermStruct() throws Exception { + TermStruct r = TermStruct.fromFile(SRC_DIR + "term_strz.bin"); + + assertEquals(r.s1().value(), new byte[] { 102, 111, 111 }); + assertEquals(r.s2().value(), new byte[] { 98, 97, 114 }); + assertEquals(r.s3().value(), new byte[] { 124, 98, 97, 122, 64 }); + } +} diff --git a/spec/java/src/io/kaitai/struct/spec/TestTermStruct2.java b/spec/java/src/io/kaitai/struct/spec/TestTermStruct2.java new file mode 100644 index 000000000..a8c637089 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestTermStruct2.java @@ -0,0 +1,18 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.TermStruct2; +import org.testng.annotations.Test; +import static org.testng.Assert.*; +public class TestTermStruct2 extends CommonSpec { + + @Test + public void testTermStruct2() throws Exception { + TermStruct2 r = TermStruct2.fromFile(SRC_DIR + "term_strz.bin"); + + assertEquals(r.s1().value(), new byte[] { 102, 111, 111 }); + assertEquals(r.s2().value(), new byte[] { 98, 97, 114, 124 }); + assertEquals(r.s3().value(), new byte[] { 98, 97, 122 }); + } +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestTermStruct.java b/spec/java/src/io/kaitai/struct/specwrite/TestTermStruct.java new file mode 100644 index 000000000..5f14f6e21 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestTermStruct.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.TermStruct; +import org.testng.annotations.Test; + +public class TestTermStruct extends CommonSpec { + @Override + protected Class getStructClass() { + return TermStruct.class; + } + + @Override + protected String getSrcFilename() { + return "term_strz.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestTermStruct2.java b/spec/java/src/io/kaitai/struct/specwrite/TestTermStruct2.java new file mode 100644 index 000000000..50f765bae --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestTermStruct2.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.TermStruct2; +import org.testng.annotations.Test; + +public class TestTermStruct2 extends CommonSpec { + @Override + protected Class getStructClass() { + return TermStruct2.class; + } + + @Override + protected String getSrcFilename() { + return "term_strz.bin"; + } + +} diff --git a/spec/ks/term_struct.kst b/spec/ks/term_struct.kst new file mode 100644 index 000000000..23ca16c49 --- /dev/null +++ b/spec/ks/term_struct.kst @@ -0,0 +1,9 @@ +id: term_struct +data: term_strz.bin +asserts: + - actual: s1.value + expected: '[0x66, 0x6f, 0x6f]' + - actual: s2.value + expected: '[0x62, 0x61, 0x72]' + - actual: s3.value + expected: '[0x7c, 0x62, 0x61, 0x7a, 0x40]' diff --git a/spec/ks/term_struct2.kst b/spec/ks/term_struct2.kst new file mode 100644 index 000000000..e4dee7fde --- /dev/null +++ b/spec/ks/term_struct2.kst @@ -0,0 +1,9 @@ +id: term_struct2 +data: term_strz.bin +asserts: + - actual: s1.value + expected: '[0x66, 0x6f, 0x6f]' + - actual: s2.value + expected: '[0x62, 0x61, 0x72, 0x7c]' + - actual: s3.value + expected: '[0x62, 0x61, 0x7a]' From 458fdd68fea093384eb41de63f03e0b25f96f27b Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Sun, 28 Aug 2022 21:01:34 +0200 Subject: [PATCH 039/126] KST translator: fix JavaTranslator instantiation for read-write KSC --- .../io/kaitai/struct/testtranslator/specgenerators/JavaSG.scala | 2 +- .../struct/testtranslator/specgenerators/JavaWriteSG.scala | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/translator/src/main/scala/io/kaitai/struct/testtranslator/specgenerators/JavaSG.scala b/translator/src/main/scala/io/kaitai/struct/testtranslator/specgenerators/JavaSG.scala index 990e720dd..9125d80cc 100644 --- a/translator/src/main/scala/io/kaitai/struct/testtranslator/specgenerators/JavaSG.scala +++ b/translator/src/main/scala/io/kaitai/struct/testtranslator/specgenerators/JavaSG.scala @@ -11,7 +11,7 @@ import io.kaitai.struct.translators.JavaTranslator class JavaSG(spec: TestSpec, provider: ClassTypeProvider) extends BaseGenerator(spec) { val config = RuntimeConfig() val className = JavaCompiler.type2class(spec.id) - val translator = new JavaTranslator(provider, importList) + val translator = new JavaTranslator(provider, importList, config) val compiler = new JavaCompiler(provider, config) importList.add(s"io.kaitai.struct.testformats.$className") diff --git a/translator/src/main/scala/io/kaitai/struct/testtranslator/specgenerators/JavaWriteSG.scala b/translator/src/main/scala/io/kaitai/struct/testtranslator/specgenerators/JavaWriteSG.scala index 2c08be66e..0fba1b241 100644 --- a/translator/src/main/scala/io/kaitai/struct/testtranslator/specgenerators/JavaWriteSG.scala +++ b/translator/src/main/scala/io/kaitai/struct/testtranslator/specgenerators/JavaWriteSG.scala @@ -11,7 +11,7 @@ import io.kaitai.struct.translators.JavaTranslator class JavaWriteSG(spec: TestSpec, provider: ClassTypeProvider) extends BaseGenerator(spec) { val config = RuntimeConfig() val className = JavaCompiler.type2class(spec.id) - val translator = new JavaTranslator(provider, importList) + val translator = new JavaTranslator(provider, importList, config) val compiler = new JavaCompiler(provider, config) importList.add("io.kaitai.struct.KaitaiStruct.ReadWrite") From 911ccb0eee4ce8a98967705ee258a7ff4a2e15c2 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Sun, 28 Aug 2022 22:56:17 +0200 Subject: [PATCH 040/126] Add KST specs for Debug{ArrayUser,EnumName}, regen for Java write --- .../struct/specwrite/TestDebugArrayUser.java | 20 +++++++++++++++++++ .../struct/specwrite/TestDebugEnumName.java | 20 +++++++++++++++++++ spec/ks/debug_array_user.kst | 12 +++++++++++ spec/ks/debug_enum_name.kst | 6 ++++++ 4 files changed, 58 insertions(+) create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestDebugArrayUser.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestDebugEnumName.java create mode 100644 spec/ks/debug_array_user.kst create mode 100644 spec/ks/debug_enum_name.kst diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestDebugArrayUser.java b/spec/java/src/io/kaitai/struct/specwrite/TestDebugArrayUser.java new file mode 100644 index 000000000..fa5764e9b --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestDebugArrayUser.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.DebugArrayUser; +import org.testng.annotations.Test; + +public class TestDebugArrayUser extends CommonSpec { + @Override + protected Class getStructClass() { + return DebugArrayUser.class; + } + + @Override + protected String getSrcFilename() { + return "fixed_struct.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestDebugEnumName.java b/spec/java/src/io/kaitai/struct/specwrite/TestDebugEnumName.java new file mode 100644 index 000000000..b78966263 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestDebugEnumName.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.DebugEnumName; +import org.testng.annotations.Test; + +public class TestDebugEnumName extends CommonSpec { + @Override + protected Class getStructClass() { + return DebugEnumName.class; + } + + @Override + protected String getSrcFilename() { + return "fixed_struct.bin"; + } + +} diff --git a/spec/ks/debug_array_user.kst b/spec/ks/debug_array_user.kst new file mode 100644 index 000000000..2e86241d9 --- /dev/null +++ b/spec/ks/debug_array_user.kst @@ -0,0 +1,12 @@ +id: debug_array_user +data: fixed_struct.bin +# NOTE: debug mode is enabled, so don't forget to add the `r._read()` call +asserts: + - actual: one_cat.meow + expected: 0x50 + - actual: array_of_cats[0].meow + expected: 0x41 + - actual: array_of_cats[1].meow + expected: 0x43 + - actual: array_of_cats[2].meow + expected: 0x4b diff --git a/spec/ks/debug_enum_name.kst b/spec/ks/debug_enum_name.kst new file mode 100644 index 000000000..cd20da91a --- /dev/null +++ b/spec/ks/debug_enum_name.kst @@ -0,0 +1,6 @@ +id: debug_enum_name +data: fixed_struct.bin +# NOTE: debug mode is enabled, so don't forget to add the `r._read()` call + +# No asserts, this test is meaningful only for languages that have --debug and +# do not save enum type info From 2d19543d0150c1fdb78cf87cf4614cf266bc3724 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Sun, 28 Aug 2022 23:26:01 +0200 Subject: [PATCH 041/126] Add KST spec for OptionalId (semi-automatic), regen for Java write --- .../struct/specwrite/TestOptionalId.java | 20 +++++++++++++++++++ spec/ks/optional_id.kst | 12 +++++++++++ 2 files changed, 32 insertions(+) create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestOptionalId.java create mode 100644 spec/ks/optional_id.kst diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestOptionalId.java b/spec/java/src/io/kaitai/struct/specwrite/TestOptionalId.java new file mode 100644 index 000000000..70b85c940 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestOptionalId.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.OptionalId; +import org.testng.annotations.Test; + +public class TestOptionalId extends CommonSpec { + @Override + protected Class getStructClass() { + return OptionalId.class; + } + + @Override + protected String getSrcFilename() { + return "fixed_struct.bin"; + } + +} diff --git a/spec/ks/optional_id.kst b/spec/ks/optional_id.kst new file mode 100644 index 000000000..fd4d1483b --- /dev/null +++ b/spec/ks/optional_id.kst @@ -0,0 +1,12 @@ +id: optional_id +data: fixed_struct.bin +# # NOTE: you have to temporarily add attribute `id`s to optional_id.ksy, add +# # underscores `r.{ => _}unnamedX` in the generated unit test spec and remove the +# # "Autogenerated from KST: please remove ... if doing any edits" header comment +# asserts: +# - actual: unnamed0 +# expected: 0x50 +# - actual: unnamed1 +# expected: 0x41 +# - actual: unnamed2 +# expected: '[0x43, 0x4b, 0x2d, 0x31, 0xff]' From 04352a5adc272aedd29bbb885e0be466cda7f2b7 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Sun, 28 Aug 2022 23:40:39 +0200 Subject: [PATCH 042/126] Add KST for Debug0 (semi-automatic), regen for Java write --- .../kaitai/struct/specwrite/TestDebug0.java | 20 +++++++++++++++++++ spec/ks/debug_0.kst | 12 +++++++++++ 2 files changed, 32 insertions(+) create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestDebug0.java create mode 100644 spec/ks/debug_0.kst diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestDebug0.java b/spec/java/src/io/kaitai/struct/specwrite/TestDebug0.java new file mode 100644 index 000000000..f3ec597d9 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestDebug0.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.Debug0; +import org.testng.annotations.Test; + +public class TestDebug0 extends CommonSpec { + @Override + protected Class getStructClass() { + return Debug0.class; + } + + @Override + protected String getSrcFilename() { + return "fixed_struct.bin"; + } + +} diff --git a/spec/ks/debug_0.kst b/spec/ks/debug_0.kst new file mode 100644 index 000000000..8dbfedb03 --- /dev/null +++ b/spec/ks/debug_0.kst @@ -0,0 +1,12 @@ +id: debug_0 +data: fixed_struct.bin +# NOTE: debug mode is enabled, so don't forget to add the `r._read()` call +asserts: + - actual: one + expected: 0x50 + - actual: array_of_ints + expected: '[0x41, 0x43, 0x4b].as' + # - actual: unnamed2 + # expected: 0x2d + + # NOTE: `_debug` asserts must be added manually to the generated unit test From 65376ffec8e5bb999cdb4b1a9308759aea03da00 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Sun, 4 Sep 2022 14:41:48 +0200 Subject: [PATCH 043/126] Add Term{Bytes,Struct,Strz}3 as a variation of TermBytes --- formats/term_bytes3.ksy | 20 +++++++++++++++++++ formats/term_struct3.ksy | 20 +++++++++++++++++++ formats/term_strz3.ksy | 19 ++++++++++++++++++ .../io/kaitai/struct/spec/TestTermBytes3.java | 18 +++++++++++++++++ .../kaitai/struct/spec/TestTermStruct3.java | 18 +++++++++++++++++ .../io/kaitai/struct/spec/TestTermStrz3.java | 18 +++++++++++++++++ .../struct/specwrite/TestTermBytes3.java | 20 +++++++++++++++++++ .../struct/specwrite/TestTermStruct3.java | 20 +++++++++++++++++++ .../struct/specwrite/TestTermStrz3.java | 20 +++++++++++++++++++ spec/ks/term_bytes3.kst | 9 +++++++++ spec/ks/term_struct3.kst | 9 +++++++++ spec/ks/term_strz3.kst | 9 +++++++++ 12 files changed, 200 insertions(+) create mode 100644 formats/term_bytes3.ksy create mode 100644 formats/term_struct3.ksy create mode 100644 formats/term_strz3.ksy create mode 100644 spec/java/src/io/kaitai/struct/spec/TestTermBytes3.java create mode 100644 spec/java/src/io/kaitai/struct/spec/TestTermStruct3.java create mode 100644 spec/java/src/io/kaitai/struct/spec/TestTermStrz3.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestTermBytes3.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestTermStruct3.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestTermStrz3.java create mode 100644 spec/ks/term_bytes3.kst create mode 100644 spec/ks/term_struct3.kst create mode 100644 spec/ks/term_strz3.kst diff --git a/formats/term_bytes3.ksy b/formats/term_bytes3.ksy new file mode 100644 index 000000000..6956e1115 --- /dev/null +++ b/formats/term_bytes3.ksy @@ -0,0 +1,20 @@ +# Another variation of "term_bytes" - this time with two `consume: false` fields, which makes sure +# that multiple `consume: false` fields in the same `seq` do not cause redeclaration of the local +# `_pos` variable (which is illegal in some targets), which is used to remember the stream position +# before the `terminator` byte is written so that the generated code can seek back there after +# writing it. +# +# Other case tested here is that `s3` will be a 0-length field (the `terminator` will occur as the +# first byte and thus the field value will be cut off), which is probably not common but perfectly +# legal, so this test makes sure that we don't fail in this case. +meta: + id: term_bytes3 +seq: + - id: s1 + terminator: 0x7c + consume: false + - id: s2 + terminator: 0x40 + consume: false + - id: s3 + terminator: 0x40 diff --git a/formats/term_struct3.ksy b/formats/term_struct3.ksy new file mode 100644 index 000000000..a057d5438 --- /dev/null +++ b/formats/term_struct3.ksy @@ -0,0 +1,20 @@ +# Like "term_bytes3", but the byte array is wrapped in a user-defined type +meta: + id: term_struct3 +seq: + - id: s1 + terminator: 0x7c + consume: false + type: bytes_wrapper + - id: s2 + terminator: 0x40 + consume: false + type: bytes_wrapper + - id: s3 + terminator: 0x40 + type: bytes_wrapper +types: + bytes_wrapper: + seq: + - id: value + size-eos: true diff --git a/formats/term_strz3.ksy b/formats/term_strz3.ksy new file mode 100644 index 000000000..312dce6c4 --- /dev/null +++ b/formats/term_strz3.ksy @@ -0,0 +1,19 @@ +# Another variation of "term_strz" - this time with two `consume: false` fields and a 0-byte field +# (`s3`). See "term_bytes3" for more details. +meta: + id: term_strz3 +seq: + - id: s1 + type: str + encoding: UTF-8 + terminator: 0x7c + consume: false + - id: s2 + type: str + encoding: UTF-8 + terminator: 0x40 + consume: false + - id: s3 + type: str + encoding: UTF-8 + terminator: 0x40 diff --git a/spec/java/src/io/kaitai/struct/spec/TestTermBytes3.java b/spec/java/src/io/kaitai/struct/spec/TestTermBytes3.java new file mode 100644 index 000000000..3e3d91fee --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestTermBytes3.java @@ -0,0 +1,18 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.TermBytes3; +import org.testng.annotations.Test; +import static org.testng.Assert.*; +public class TestTermBytes3 extends CommonSpec { + + @Test + public void testTermBytes3() throws Exception { + TermBytes3 r = TermBytes3.fromFile(SRC_DIR + "term_strz.bin"); + + assertEquals(r.s1(), new byte[] { 102, 111, 111 }); + assertEquals(r.s2(), new byte[] { 124, 98, 97, 114, 124, 98, 97, 122 }); + assertEquals(r.s3(), new byte[] { }); + } +} diff --git a/spec/java/src/io/kaitai/struct/spec/TestTermStruct3.java b/spec/java/src/io/kaitai/struct/spec/TestTermStruct3.java new file mode 100644 index 000000000..ba016f346 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestTermStruct3.java @@ -0,0 +1,18 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.TermStruct3; +import org.testng.annotations.Test; +import static org.testng.Assert.*; +public class TestTermStruct3 extends CommonSpec { + + @Test + public void testTermStruct3() throws Exception { + TermStruct3 r = TermStruct3.fromFile(SRC_DIR + "term_strz.bin"); + + assertEquals(r.s1().value(), new byte[] { 102, 111, 111 }); + assertEquals(r.s2().value(), new byte[] { 124, 98, 97, 114, 124, 98, 97, 122 }); + assertEquals(r.s3().value(), new byte[] { }); + } +} diff --git a/spec/java/src/io/kaitai/struct/spec/TestTermStrz3.java b/spec/java/src/io/kaitai/struct/spec/TestTermStrz3.java new file mode 100644 index 000000000..1974d22a3 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestTermStrz3.java @@ -0,0 +1,18 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.TermStrz3; +import org.testng.annotations.Test; +import static org.testng.Assert.*; +public class TestTermStrz3 extends CommonSpec { + + @Test + public void testTermStrz3() throws Exception { + TermStrz3 r = TermStrz3.fromFile(SRC_DIR + "term_strz.bin"); + + assertEquals(r.s1(), "foo"); + assertEquals(r.s2(), "|bar|baz"); + assertEquals(r.s3(), ""); + } +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestTermBytes3.java b/spec/java/src/io/kaitai/struct/specwrite/TestTermBytes3.java new file mode 100644 index 000000000..9b680c89e --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestTermBytes3.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.TermBytes3; +import org.testng.annotations.Test; + +public class TestTermBytes3 extends CommonSpec { + @Override + protected Class getStructClass() { + return TermBytes3.class; + } + + @Override + protected String getSrcFilename() { + return "term_strz.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestTermStruct3.java b/spec/java/src/io/kaitai/struct/specwrite/TestTermStruct3.java new file mode 100644 index 000000000..ef025b99a --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestTermStruct3.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.TermStruct3; +import org.testng.annotations.Test; + +public class TestTermStruct3 extends CommonSpec { + @Override + protected Class getStructClass() { + return TermStruct3.class; + } + + @Override + protected String getSrcFilename() { + return "term_strz.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestTermStrz3.java b/spec/java/src/io/kaitai/struct/specwrite/TestTermStrz3.java new file mode 100644 index 000000000..aced9fa64 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestTermStrz3.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.TermStrz3; +import org.testng.annotations.Test; + +public class TestTermStrz3 extends CommonSpec { + @Override + protected Class getStructClass() { + return TermStrz3.class; + } + + @Override + protected String getSrcFilename() { + return "term_strz.bin"; + } + +} diff --git a/spec/ks/term_bytes3.kst b/spec/ks/term_bytes3.kst new file mode 100644 index 000000000..8fc953607 --- /dev/null +++ b/spec/ks/term_bytes3.kst @@ -0,0 +1,9 @@ +id: term_bytes3 +data: term_strz.bin +asserts: + - actual: s1 + expected: '[0x66, 0x6f, 0x6f]' + - actual: s2 + expected: '[0x7c, 0x62, 0x61, 0x72, 0x7c, 0x62, 0x61, 0x7a]' + - actual: s3 + expected: '[].as' diff --git a/spec/ks/term_struct3.kst b/spec/ks/term_struct3.kst new file mode 100644 index 000000000..dbc078a91 --- /dev/null +++ b/spec/ks/term_struct3.kst @@ -0,0 +1,9 @@ +id: term_struct3 +data: term_strz.bin +asserts: + - actual: s1.value + expected: '[0x66, 0x6f, 0x6f]' + - actual: s2.value + expected: '[0x7c, 0x62, 0x61, 0x72, 0x7c, 0x62, 0x61, 0x7a]' + - actual: s3.value + expected: '[].as' diff --git a/spec/ks/term_strz3.kst b/spec/ks/term_strz3.kst new file mode 100644 index 000000000..8e78992ef --- /dev/null +++ b/spec/ks/term_strz3.kst @@ -0,0 +1,9 @@ +id: term_strz3 +data: term_strz.bin +asserts: + - actual: s1 + expected: '"foo"' + - actual: s2 + expected: '"|bar|baz"' + - actual: s3 + expected: '""' From 53e92fb75620ccb988dbc99b10d599b9cdfc1557 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Mon, 5 Sep 2022 09:03:19 +0200 Subject: [PATCH 044/126] Add Repeat{Eos,N,Until}Bytes for a repeated fixed-size byte array --- formats/repeat_eos_bytes.ksy | 6 ++++++ formats/repeat_n_bytes.ksy | 7 +++++++ formats/repeat_until_bytes.ksy | 7 +++++++ .../struct/spec/TestRepeatEosBytes.java | 19 ++++++++++++++++++ .../kaitai/struct/spec/TestRepeatNBytes.java | 19 ++++++++++++++++++ .../struct/spec/TestRepeatUntilBytes.java | 19 ++++++++++++++++++ .../struct/specwrite/TestRepeatEosBytes.java | 20 +++++++++++++++++++ .../struct/specwrite/TestRepeatNBytes.java | 20 +++++++++++++++++++ .../specwrite/TestRepeatUntilBytes.java | 20 +++++++++++++++++++ spec/ks/repeat_eos_bytes.kst | 12 +++++++++++ spec/ks/repeat_n_bytes.kst | 12 +++++++++++ spec/ks/repeat_until_bytes.kst | 12 +++++++++++ 12 files changed, 173 insertions(+) create mode 100644 formats/repeat_eos_bytes.ksy create mode 100644 formats/repeat_n_bytes.ksy create mode 100644 formats/repeat_until_bytes.ksy create mode 100644 spec/java/src/io/kaitai/struct/spec/TestRepeatEosBytes.java create mode 100644 spec/java/src/io/kaitai/struct/spec/TestRepeatNBytes.java create mode 100644 spec/java/src/io/kaitai/struct/spec/TestRepeatUntilBytes.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosBytes.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestRepeatNBytes.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilBytes.java create mode 100644 spec/ks/repeat_eos_bytes.kst create mode 100644 spec/ks/repeat_n_bytes.kst create mode 100644 spec/ks/repeat_until_bytes.kst diff --git a/formats/repeat_eos_bytes.ksy b/formats/repeat_eos_bytes.ksy new file mode 100644 index 000000000..4c08a2719 --- /dev/null +++ b/formats/repeat_eos_bytes.ksy @@ -0,0 +1,6 @@ +meta: + id: repeat_eos_bytes +seq: + - id: records + size: 5 + repeat: eos diff --git a/formats/repeat_n_bytes.ksy b/formats/repeat_n_bytes.ksy new file mode 100644 index 000000000..c0b80ba3a --- /dev/null +++ b/formats/repeat_n_bytes.ksy @@ -0,0 +1,7 @@ +meta: + id: repeat_n_bytes +seq: + - id: records + size: 5 + repeat: expr + repeat-expr: 3 diff --git a/formats/repeat_until_bytes.ksy b/formats/repeat_until_bytes.ksy new file mode 100644 index 000000000..12dc52184 --- /dev/null +++ b/formats/repeat_until_bytes.ksy @@ -0,0 +1,7 @@ +meta: + id: repeat_until_bytes +seq: + - id: records + size: 5 + repeat: until + repeat-until: _[0] == 0xaa diff --git a/spec/java/src/io/kaitai/struct/spec/TestRepeatEosBytes.java b/spec/java/src/io/kaitai/struct/spec/TestRepeatEosBytes.java new file mode 100644 index 000000000..4cac2eb0c --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestRepeatEosBytes.java @@ -0,0 +1,19 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.RepeatEosBytes; +import org.testng.annotations.Test; +import static org.testng.Assert.*; +public class TestRepeatEosBytes extends CommonSpec { + + @Test + public void testRepeatEosBytes() throws Exception { + RepeatEosBytes r = RepeatEosBytes.fromFile(SRC_DIR + "repeat_until_process.bin"); + + assertIntEquals(r.records().size(), 3); + assertEquals(r.records().get((int) 0), new byte[] { -24, -70, -86, -86, -86 }); + assertEquals(r.records().get((int) 1), new byte[] { -6, -98, -72, -86, -86 }); + assertEquals(r.records().get((int) 2), new byte[] { -86, 85, 85, 85, 85 }); + } +} diff --git a/spec/java/src/io/kaitai/struct/spec/TestRepeatNBytes.java b/spec/java/src/io/kaitai/struct/spec/TestRepeatNBytes.java new file mode 100644 index 000000000..344a09888 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestRepeatNBytes.java @@ -0,0 +1,19 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.RepeatNBytes; +import org.testng.annotations.Test; +import static org.testng.Assert.*; +public class TestRepeatNBytes extends CommonSpec { + + @Test + public void testRepeatNBytes() throws Exception { + RepeatNBytes r = RepeatNBytes.fromFile(SRC_DIR + "repeat_until_process.bin"); + + assertIntEquals(r.records().size(), 3); + assertEquals(r.records().get((int) 0), new byte[] { -24, -70, -86, -86, -86 }); + assertEquals(r.records().get((int) 1), new byte[] { -6, -98, -72, -86, -86 }); + assertEquals(r.records().get((int) 2), new byte[] { -86, 85, 85, 85, 85 }); + } +} diff --git a/spec/java/src/io/kaitai/struct/spec/TestRepeatUntilBytes.java b/spec/java/src/io/kaitai/struct/spec/TestRepeatUntilBytes.java new file mode 100644 index 000000000..37b0a13d9 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestRepeatUntilBytes.java @@ -0,0 +1,19 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.RepeatUntilBytes; +import org.testng.annotations.Test; +import static org.testng.Assert.*; +public class TestRepeatUntilBytes extends CommonSpec { + + @Test + public void testRepeatUntilBytes() throws Exception { + RepeatUntilBytes r = RepeatUntilBytes.fromFile(SRC_DIR + "repeat_until_process.bin"); + + assertIntEquals(r.records().size(), 3); + assertEquals(r.records().get((int) 0), new byte[] { -24, -70, -86, -86, -86 }); + assertEquals(r.records().get((int) 1), new byte[] { -6, -98, -72, -86, -86 }); + assertEquals(r.records().get((int) 2), new byte[] { -86, 85, 85, 85, 85 }); + } +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosBytes.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosBytes.java new file mode 100644 index 000000000..bee8471fe --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosBytes.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.RepeatEosBytes; +import org.testng.annotations.Test; + +public class TestRepeatEosBytes extends CommonSpec { + @Override + protected Class getStructClass() { + return RepeatEosBytes.class; + } + + @Override + protected String getSrcFilename() { + return "repeat_until_process.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNBytes.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNBytes.java new file mode 100644 index 000000000..d9f51a74f --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNBytes.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.RepeatNBytes; +import org.testng.annotations.Test; + +public class TestRepeatNBytes extends CommonSpec { + @Override + protected Class getStructClass() { + return RepeatNBytes.class; + } + + @Override + protected String getSrcFilename() { + return "repeat_until_process.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilBytes.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilBytes.java new file mode 100644 index 000000000..a48cac6f9 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilBytes.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.RepeatUntilBytes; +import org.testng.annotations.Test; + +public class TestRepeatUntilBytes extends CommonSpec { + @Override + protected Class getStructClass() { + return RepeatUntilBytes.class; + } + + @Override + protected String getSrcFilename() { + return "repeat_until_process.bin"; + } + +} diff --git a/spec/ks/repeat_eos_bytes.kst b/spec/ks/repeat_eos_bytes.kst new file mode 100644 index 000000000..fbfb1548b --- /dev/null +++ b/spec/ks/repeat_eos_bytes.kst @@ -0,0 +1,12 @@ +id: repeat_eos_bytes +data: repeat_until_process.bin +asserts: + - actual: records.size + expected: 3 + + - actual: records[0] + expected: '[0xe8, 0xba, 0xaa, 0xaa, 0xaa]' + - actual: records[1] + expected: '[0xfa, 0x9e, 0xb8, 0xaa, 0xaa]' + - actual: records[2] + expected: '[0xaa, 0x55, 0x55, 0x55, 0x55]' diff --git a/spec/ks/repeat_n_bytes.kst b/spec/ks/repeat_n_bytes.kst new file mode 100644 index 000000000..ce66b6231 --- /dev/null +++ b/spec/ks/repeat_n_bytes.kst @@ -0,0 +1,12 @@ +id: repeat_n_bytes +data: repeat_until_process.bin +asserts: + - actual: records.size + expected: 3 + + - actual: records[0] + expected: '[0xe8, 0xba, 0xaa, 0xaa, 0xaa]' + - actual: records[1] + expected: '[0xfa, 0x9e, 0xb8, 0xaa, 0xaa]' + - actual: records[2] + expected: '[0xaa, 0x55, 0x55, 0x55, 0x55]' diff --git a/spec/ks/repeat_until_bytes.kst b/spec/ks/repeat_until_bytes.kst new file mode 100644 index 000000000..9e802b0a4 --- /dev/null +++ b/spec/ks/repeat_until_bytes.kst @@ -0,0 +1,12 @@ +id: repeat_until_bytes +data: repeat_until_process.bin +asserts: + - actual: records.size + expected: 3 + + - actual: records[0] + expected: '[0xe8, 0xba, 0xaa, 0xaa, 0xaa]' + - actual: records[1] + expected: '[0xfa, 0x9e, 0xb8, 0xaa, 0xaa]' + - actual: records[2] + expected: '[0xaa, 0x55, 0x55, 0x55, 0x55]' From 0335f1011cd613f5733c90f710797e1eed26ee9d Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Mon, 5 Sep 2022 15:29:30 +0200 Subject: [PATCH 045/126] Add Repeat{Eos,N,Until}{BytesPad{,Term},TermBytes} --- formats/repeat_eos_bytes_pad.ksy | 8 +++++++ formats/repeat_eos_bytes_pad_term.ksy | 10 ++++++++ formats/repeat_eos_term_bytes.ksy | 7 ++++++ formats/repeat_n_bytes_pad.ksy | 9 +++++++ formats/repeat_n_bytes_pad_term.ksy | 11 +++++++++ formats/repeat_n_term_bytes.ksy | 18 ++++++++++++++ formats/repeat_until_bytes_pad.ksy | 9 +++++++ formats/repeat_until_bytes_pad_term.ksy | 11 +++++++++ formats/repeat_until_term_bytes.ksy | 18 ++++++++++++++ .../struct/spec/TestRepeatEosBytesPad.java | 19 +++++++++++++++ .../spec/TestRepeatEosBytesPadTerm.java | 19 +++++++++++++++ .../struct/spec/TestRepeatEosTermBytes.java | 18 ++++++++++++++ .../struct/spec/TestRepeatNBytesPad.java | 19 +++++++++++++++ .../struct/spec/TestRepeatNBytesPadTerm.java | 19 +++++++++++++++ .../struct/spec/TestRepeatNTermBytes.java | 24 +++++++++++++++++++ .../struct/spec/TestRepeatUntilBytesPad.java | 19 +++++++++++++++ .../spec/TestRepeatUntilBytesPadTerm.java | 19 +++++++++++++++ .../struct/spec/TestRepeatUntilTermBytes.java | 24 +++++++++++++++++++ .../specwrite/TestRepeatEosBytesPad.java | 20 ++++++++++++++++ .../specwrite/TestRepeatEosBytesPadTerm.java | 20 ++++++++++++++++ .../specwrite/TestRepeatEosTermBytes.java | 20 ++++++++++++++++ .../struct/specwrite/TestRepeatNBytesPad.java | 20 ++++++++++++++++ .../specwrite/TestRepeatNBytesPadTerm.java | 20 ++++++++++++++++ .../specwrite/TestRepeatNTermBytes.java | 20 ++++++++++++++++ .../specwrite/TestRepeatUntilBytesPad.java | 20 ++++++++++++++++ .../TestRepeatUntilBytesPadTerm.java | 20 ++++++++++++++++ .../specwrite/TestRepeatUntilTermBytes.java | 20 ++++++++++++++++ spec/ks/repeat_eos_bytes_pad.kst | 12 ++++++++++ spec/ks/repeat_eos_bytes_pad_term.kst | 12 ++++++++++ spec/ks/repeat_eos_term_bytes.kst | 10 ++++++++ spec/ks/repeat_n_bytes_pad.kst | 12 ++++++++++ spec/ks/repeat_n_bytes_pad_term.kst | 12 ++++++++++ spec/ks/repeat_n_term_bytes.kst | 23 ++++++++++++++++++ spec/ks/repeat_until_bytes_pad.kst | 12 ++++++++++ spec/ks/repeat_until_bytes_pad_term.kst | 12 ++++++++++ spec/ks/repeat_until_term_bytes.kst | 23 ++++++++++++++++++ 36 files changed, 589 insertions(+) create mode 100644 formats/repeat_eos_bytes_pad.ksy create mode 100644 formats/repeat_eos_bytes_pad_term.ksy create mode 100644 formats/repeat_eos_term_bytes.ksy create mode 100644 formats/repeat_n_bytes_pad.ksy create mode 100644 formats/repeat_n_bytes_pad_term.ksy create mode 100644 formats/repeat_n_term_bytes.ksy create mode 100644 formats/repeat_until_bytes_pad.ksy create mode 100644 formats/repeat_until_bytes_pad_term.ksy create mode 100644 formats/repeat_until_term_bytes.ksy create mode 100644 spec/java/src/io/kaitai/struct/spec/TestRepeatEosBytesPad.java create mode 100644 spec/java/src/io/kaitai/struct/spec/TestRepeatEosBytesPadTerm.java create mode 100644 spec/java/src/io/kaitai/struct/spec/TestRepeatEosTermBytes.java create mode 100644 spec/java/src/io/kaitai/struct/spec/TestRepeatNBytesPad.java create mode 100644 spec/java/src/io/kaitai/struct/spec/TestRepeatNBytesPadTerm.java create mode 100644 spec/java/src/io/kaitai/struct/spec/TestRepeatNTermBytes.java create mode 100644 spec/java/src/io/kaitai/struct/spec/TestRepeatUntilBytesPad.java create mode 100644 spec/java/src/io/kaitai/struct/spec/TestRepeatUntilBytesPadTerm.java create mode 100644 spec/java/src/io/kaitai/struct/spec/TestRepeatUntilTermBytes.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosBytesPad.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosBytesPadTerm.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosTermBytes.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestRepeatNBytesPad.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestRepeatNBytesPadTerm.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestRepeatNTermBytes.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilBytesPad.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilBytesPadTerm.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilTermBytes.java create mode 100644 spec/ks/repeat_eos_bytes_pad.kst create mode 100644 spec/ks/repeat_eos_bytes_pad_term.kst create mode 100644 spec/ks/repeat_eos_term_bytes.kst create mode 100644 spec/ks/repeat_n_bytes_pad.kst create mode 100644 spec/ks/repeat_n_bytes_pad_term.kst create mode 100644 spec/ks/repeat_n_term_bytes.kst create mode 100644 spec/ks/repeat_until_bytes_pad.kst create mode 100644 spec/ks/repeat_until_bytes_pad_term.kst create mode 100644 spec/ks/repeat_until_term_bytes.kst diff --git a/formats/repeat_eos_bytes_pad.ksy b/formats/repeat_eos_bytes_pad.ksy new file mode 100644 index 000000000..c0e821217 --- /dev/null +++ b/formats/repeat_eos_bytes_pad.ksy @@ -0,0 +1,8 @@ +# see "repeat_n_bytes_pad" +meta: + id: repeat_eos_bytes_pad +seq: + - id: records + size: 5 + pad-right: 0xaa + repeat: eos diff --git a/formats/repeat_eos_bytes_pad_term.ksy b/formats/repeat_eos_bytes_pad_term.ksy new file mode 100644 index 000000000..5946bb9fe --- /dev/null +++ b/formats/repeat_eos_bytes_pad_term.ksy @@ -0,0 +1,10 @@ +# see "repeat_n_bytes_pad_term" +meta: + id: repeat_eos_bytes_pad_term +seq: + - id: records + size: 5 + terminator: 0x55 + include: true + pad-right: 0xaa + repeat: eos diff --git a/formats/repeat_eos_term_bytes.ksy b/formats/repeat_eos_term_bytes.ksy new file mode 100644 index 000000000..b3a27b513 --- /dev/null +++ b/formats/repeat_eos_term_bytes.ksy @@ -0,0 +1,7 @@ +meta: + id: repeat_eos_term_bytes +seq: + - id: records + terminator: 0xb2 + include: true + repeat: eos diff --git a/formats/repeat_n_bytes_pad.ksy b/formats/repeat_n_bytes_pad.ksy new file mode 100644 index 000000000..11885cd9e --- /dev/null +++ b/formats/repeat_n_bytes_pad.ksy @@ -0,0 +1,9 @@ +# see also "repeat_eos_bytes_pad" and "repeat_until_bytes_pad" +meta: + id: repeat_n_bytes_pad +seq: + - id: records + size: 5 + pad-right: 0xaa + repeat: expr + repeat-expr: 3 diff --git a/formats/repeat_n_bytes_pad_term.ksy b/formats/repeat_n_bytes_pad_term.ksy new file mode 100644 index 000000000..18c0af98b --- /dev/null +++ b/formats/repeat_n_bytes_pad_term.ksy @@ -0,0 +1,11 @@ +# see also "repeat_eos_bytes_pad_term" and "repeat_until_bytes_pad_term" +meta: + id: repeat_n_bytes_pad_term +seq: + - id: records + size: 5 + terminator: 0x55 + include: true + pad-right: 0xaa + repeat: expr + repeat-expr: 3 diff --git a/formats/repeat_n_term_bytes.ksy b/formats/repeat_n_term_bytes.ksy new file mode 100644 index 000000000..146b0fee4 --- /dev/null +++ b/formats/repeat_n_term_bytes.ksy @@ -0,0 +1,18 @@ +# see also "repeat_until_term_bytes" +meta: + id: repeat_n_term_bytes +seq: + - id: records1 + terminator: 0xaa + repeat: expr + repeat-expr: 2 + - id: records2 + terminator: 0xaa + include: true + repeat: expr + repeat-expr: 2 + - id: records3 + terminator: 0x55 + consume: false + repeat: expr + repeat-expr: 2 diff --git a/formats/repeat_until_bytes_pad.ksy b/formats/repeat_until_bytes_pad.ksy new file mode 100644 index 000000000..7b064069e --- /dev/null +++ b/formats/repeat_until_bytes_pad.ksy @@ -0,0 +1,9 @@ +# see "repeat_n_bytes_pad" +meta: + id: repeat_until_bytes_pad +seq: + - id: records + size: 5 + pad-right: 0xaa + repeat: until + repeat-until: _.length == 5 diff --git a/formats/repeat_until_bytes_pad_term.ksy b/formats/repeat_until_bytes_pad_term.ksy new file mode 100644 index 000000000..470285e7b --- /dev/null +++ b/formats/repeat_until_bytes_pad_term.ksy @@ -0,0 +1,11 @@ +# see "repeat_n_bytes_pad_term" +meta: + id: repeat_until_bytes_pad_term +seq: + - id: records + size: 5 + terminator: 0x55 + include: true + pad-right: 0xaa + repeat: until + repeat-until: _ == [0xaa, 0x55] diff --git a/formats/repeat_until_term_bytes.ksy b/formats/repeat_until_term_bytes.ksy new file mode 100644 index 000000000..20e5e8ec6 --- /dev/null +++ b/formats/repeat_until_term_bytes.ksy @@ -0,0 +1,18 @@ +# see "repeat_n_term_bytes" +meta: + id: repeat_until_term_bytes +seq: + - id: records1 + terminator: 0xaa + repeat: until + repeat-until: _.length == 0 + - id: records2 + terminator: 0xaa + include: true + repeat: until + repeat-until: _ != [0xaa] + - id: records3 + terminator: 0x55 + consume: false + repeat: until + repeat-until: _ == records1.last diff --git a/spec/java/src/io/kaitai/struct/spec/TestRepeatEosBytesPad.java b/spec/java/src/io/kaitai/struct/spec/TestRepeatEosBytesPad.java new file mode 100644 index 000000000..63d24633a --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestRepeatEosBytesPad.java @@ -0,0 +1,19 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.RepeatEosBytesPad; +import org.testng.annotations.Test; +import static org.testng.Assert.*; +public class TestRepeatEosBytesPad extends CommonSpec { + + @Test + public void testRepeatEosBytesPad() throws Exception { + RepeatEosBytesPad r = RepeatEosBytesPad.fromFile(SRC_DIR + "repeat_until_process.bin"); + + assertIntEquals(r.records().size(), 3); + assertEquals(r.records().get((int) 0), new byte[] { -24, -70 }); + assertEquals(r.records().get((int) 1), new byte[] { -6, -98, -72 }); + assertEquals(r.records().get((int) 2), new byte[] { -86, 85, 85, 85, 85 }); + } +} diff --git a/spec/java/src/io/kaitai/struct/spec/TestRepeatEosBytesPadTerm.java b/spec/java/src/io/kaitai/struct/spec/TestRepeatEosBytesPadTerm.java new file mode 100644 index 000000000..8e689e200 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestRepeatEosBytesPadTerm.java @@ -0,0 +1,19 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.RepeatEosBytesPadTerm; +import org.testng.annotations.Test; +import static org.testng.Assert.*; +public class TestRepeatEosBytesPadTerm extends CommonSpec { + + @Test + public void testRepeatEosBytesPadTerm() throws Exception { + RepeatEosBytesPadTerm r = RepeatEosBytesPadTerm.fromFile(SRC_DIR + "repeat_until_process.bin"); + + assertIntEquals(r.records().size(), 3); + assertEquals(r.records().get((int) 0), new byte[] { -24, -70 }); + assertEquals(r.records().get((int) 1), new byte[] { -6, -98, -72 }); + assertEquals(r.records().get((int) 2), new byte[] { -86, 85 }); + } +} diff --git a/spec/java/src/io/kaitai/struct/spec/TestRepeatEosTermBytes.java b/spec/java/src/io/kaitai/struct/spec/TestRepeatEosTermBytes.java new file mode 100644 index 000000000..143b0022a --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestRepeatEosTermBytes.java @@ -0,0 +1,18 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.RepeatEosTermBytes; +import org.testng.annotations.Test; +import static org.testng.Assert.*; +public class TestRepeatEosTermBytes extends CommonSpec { + + @Test + public void testRepeatEosTermBytes() throws Exception { + RepeatEosTermBytes r = RepeatEosTermBytes.fromFile(SRC_DIR + "process_rotate.bin"); + + assertIntEquals(r.records().size(), 2); + assertEquals(r.records().get((int) 0), new byte[] { 9, -84, -115, -115, -19, -70, 123, -109, 99, 35, 1, 42, 52, -78 }); + assertEquals(r.records().get((int) 1), new byte[] { 57, -78 }); + } +} diff --git a/spec/java/src/io/kaitai/struct/spec/TestRepeatNBytesPad.java b/spec/java/src/io/kaitai/struct/spec/TestRepeatNBytesPad.java new file mode 100644 index 000000000..daa353545 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestRepeatNBytesPad.java @@ -0,0 +1,19 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.RepeatNBytesPad; +import org.testng.annotations.Test; +import static org.testng.Assert.*; +public class TestRepeatNBytesPad extends CommonSpec { + + @Test + public void testRepeatNBytesPad() throws Exception { + RepeatNBytesPad r = RepeatNBytesPad.fromFile(SRC_DIR + "repeat_until_process.bin"); + + assertIntEquals(r.records().size(), 3); + assertEquals(r.records().get((int) 0), new byte[] { -24, -70 }); + assertEquals(r.records().get((int) 1), new byte[] { -6, -98, -72 }); + assertEquals(r.records().get((int) 2), new byte[] { -86, 85, 85, 85, 85 }); + } +} diff --git a/spec/java/src/io/kaitai/struct/spec/TestRepeatNBytesPadTerm.java b/spec/java/src/io/kaitai/struct/spec/TestRepeatNBytesPadTerm.java new file mode 100644 index 000000000..4c221094d --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestRepeatNBytesPadTerm.java @@ -0,0 +1,19 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.RepeatNBytesPadTerm; +import org.testng.annotations.Test; +import static org.testng.Assert.*; +public class TestRepeatNBytesPadTerm extends CommonSpec { + + @Test + public void testRepeatNBytesPadTerm() throws Exception { + RepeatNBytesPadTerm r = RepeatNBytesPadTerm.fromFile(SRC_DIR + "repeat_until_process.bin"); + + assertIntEquals(r.records().size(), 3); + assertEquals(r.records().get((int) 0), new byte[] { -24, -70 }); + assertEquals(r.records().get((int) 1), new byte[] { -6, -98, -72 }); + assertEquals(r.records().get((int) 2), new byte[] { -86, 85 }); + } +} diff --git a/spec/java/src/io/kaitai/struct/spec/TestRepeatNTermBytes.java b/spec/java/src/io/kaitai/struct/spec/TestRepeatNTermBytes.java new file mode 100644 index 000000000..5846f13f9 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestRepeatNTermBytes.java @@ -0,0 +1,24 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.RepeatNTermBytes; +import org.testng.annotations.Test; +import static org.testng.Assert.*; +public class TestRepeatNTermBytes extends CommonSpec { + + @Test + public void testRepeatNTermBytes() throws Exception { + RepeatNTermBytes r = RepeatNTermBytes.fromFile(SRC_DIR + "repeat_until_process.bin"); + + assertIntEquals(r.records1().size(), 2); + assertEquals(r.records1().get((int) 0), new byte[] { -24, -70 }); + assertEquals(r.records1().get((int) 1), new byte[] { }); + assertIntEquals(r.records2().size(), 2); + assertEquals(r.records2().get((int) 0), new byte[] { -86 }); + assertEquals(r.records2().get((int) 1), new byte[] { -6, -98, -72, -86 }); + assertIntEquals(r.records3().size(), 2); + assertEquals(r.records3().get((int) 0), new byte[] { -86, -86 }); + assertEquals(r.records3().get((int) 1), new byte[] { }); + } +} diff --git a/spec/java/src/io/kaitai/struct/spec/TestRepeatUntilBytesPad.java b/spec/java/src/io/kaitai/struct/spec/TestRepeatUntilBytesPad.java new file mode 100644 index 000000000..4bdf0b751 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestRepeatUntilBytesPad.java @@ -0,0 +1,19 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.RepeatUntilBytesPad; +import org.testng.annotations.Test; +import static org.testng.Assert.*; +public class TestRepeatUntilBytesPad extends CommonSpec { + + @Test + public void testRepeatUntilBytesPad() throws Exception { + RepeatUntilBytesPad r = RepeatUntilBytesPad.fromFile(SRC_DIR + "repeat_until_process.bin"); + + assertIntEquals(r.records().size(), 3); + assertEquals(r.records().get((int) 0), new byte[] { -24, -70 }); + assertEquals(r.records().get((int) 1), new byte[] { -6, -98, -72 }); + assertEquals(r.records().get((int) 2), new byte[] { -86, 85, 85, 85, 85 }); + } +} diff --git a/spec/java/src/io/kaitai/struct/spec/TestRepeatUntilBytesPadTerm.java b/spec/java/src/io/kaitai/struct/spec/TestRepeatUntilBytesPadTerm.java new file mode 100644 index 000000000..a3d86dd3b --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestRepeatUntilBytesPadTerm.java @@ -0,0 +1,19 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.RepeatUntilBytesPadTerm; +import org.testng.annotations.Test; +import static org.testng.Assert.*; +public class TestRepeatUntilBytesPadTerm extends CommonSpec { + + @Test + public void testRepeatUntilBytesPadTerm() throws Exception { + RepeatUntilBytesPadTerm r = RepeatUntilBytesPadTerm.fromFile(SRC_DIR + "repeat_until_process.bin"); + + assertIntEquals(r.records().size(), 3); + assertEquals(r.records().get((int) 0), new byte[] { -24, -70 }); + assertEquals(r.records().get((int) 1), new byte[] { -6, -98, -72 }); + assertEquals(r.records().get((int) 2), new byte[] { -86, 85 }); + } +} diff --git a/spec/java/src/io/kaitai/struct/spec/TestRepeatUntilTermBytes.java b/spec/java/src/io/kaitai/struct/spec/TestRepeatUntilTermBytes.java new file mode 100644 index 000000000..fb5009bd8 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestRepeatUntilTermBytes.java @@ -0,0 +1,24 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.RepeatUntilTermBytes; +import org.testng.annotations.Test; +import static org.testng.Assert.*; +public class TestRepeatUntilTermBytes extends CommonSpec { + + @Test + public void testRepeatUntilTermBytes() throws Exception { + RepeatUntilTermBytes r = RepeatUntilTermBytes.fromFile(SRC_DIR + "repeat_until_process.bin"); + + assertIntEquals(r.records1().size(), 2); + assertEquals(r.records1().get((int) 0), new byte[] { -24, -70 }); + assertEquals(r.records1().get((int) 1), new byte[] { }); + assertIntEquals(r.records2().size(), 2); + assertEquals(r.records2().get((int) 0), new byte[] { -86 }); + assertEquals(r.records2().get((int) 1), new byte[] { -6, -98, -72, -86 }); + assertIntEquals(r.records3().size(), 2); + assertEquals(r.records3().get((int) 0), new byte[] { -86, -86 }); + assertEquals(r.records3().get((int) 1), new byte[] { }); + } +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosBytesPad.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosBytesPad.java new file mode 100644 index 000000000..025c1d2ee --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosBytesPad.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.RepeatEosBytesPad; +import org.testng.annotations.Test; + +public class TestRepeatEosBytesPad extends CommonSpec { + @Override + protected Class getStructClass() { + return RepeatEosBytesPad.class; + } + + @Override + protected String getSrcFilename() { + return "repeat_until_process.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosBytesPadTerm.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosBytesPadTerm.java new file mode 100644 index 000000000..1994c6cde --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosBytesPadTerm.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.RepeatEosBytesPadTerm; +import org.testng.annotations.Test; + +public class TestRepeatEosBytesPadTerm extends CommonSpec { + @Override + protected Class getStructClass() { + return RepeatEosBytesPadTerm.class; + } + + @Override + protected String getSrcFilename() { + return "repeat_until_process.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosTermBytes.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosTermBytes.java new file mode 100644 index 000000000..67c0179ed --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosTermBytes.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.RepeatEosTermBytes; +import org.testng.annotations.Test; + +public class TestRepeatEosTermBytes extends CommonSpec { + @Override + protected Class getStructClass() { + return RepeatEosTermBytes.class; + } + + @Override + protected String getSrcFilename() { + return "process_rotate.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNBytesPad.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNBytesPad.java new file mode 100644 index 000000000..96850fd52 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNBytesPad.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.RepeatNBytesPad; +import org.testng.annotations.Test; + +public class TestRepeatNBytesPad extends CommonSpec { + @Override + protected Class getStructClass() { + return RepeatNBytesPad.class; + } + + @Override + protected String getSrcFilename() { + return "repeat_until_process.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNBytesPadTerm.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNBytesPadTerm.java new file mode 100644 index 000000000..bc6c89312 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNBytesPadTerm.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.RepeatNBytesPadTerm; +import org.testng.annotations.Test; + +public class TestRepeatNBytesPadTerm extends CommonSpec { + @Override + protected Class getStructClass() { + return RepeatNBytesPadTerm.class; + } + + @Override + protected String getSrcFilename() { + return "repeat_until_process.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNTermBytes.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNTermBytes.java new file mode 100644 index 000000000..c943164b1 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNTermBytes.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.RepeatNTermBytes; +import org.testng.annotations.Test; + +public class TestRepeatNTermBytes extends CommonSpec { + @Override + protected Class getStructClass() { + return RepeatNTermBytes.class; + } + + @Override + protected String getSrcFilename() { + return "repeat_until_process.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilBytesPad.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilBytesPad.java new file mode 100644 index 000000000..4d3b44f8b --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilBytesPad.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.RepeatUntilBytesPad; +import org.testng.annotations.Test; + +public class TestRepeatUntilBytesPad extends CommonSpec { + @Override + protected Class getStructClass() { + return RepeatUntilBytesPad.class; + } + + @Override + protected String getSrcFilename() { + return "repeat_until_process.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilBytesPadTerm.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilBytesPadTerm.java new file mode 100644 index 000000000..23d76e8e3 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilBytesPadTerm.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.RepeatUntilBytesPadTerm; +import org.testng.annotations.Test; + +public class TestRepeatUntilBytesPadTerm extends CommonSpec { + @Override + protected Class getStructClass() { + return RepeatUntilBytesPadTerm.class; + } + + @Override + protected String getSrcFilename() { + return "repeat_until_process.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilTermBytes.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilTermBytes.java new file mode 100644 index 000000000..007094285 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilTermBytes.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.RepeatUntilTermBytes; +import org.testng.annotations.Test; + +public class TestRepeatUntilTermBytes extends CommonSpec { + @Override + protected Class getStructClass() { + return RepeatUntilTermBytes.class; + } + + @Override + protected String getSrcFilename() { + return "repeat_until_process.bin"; + } + +} diff --git a/spec/ks/repeat_eos_bytes_pad.kst b/spec/ks/repeat_eos_bytes_pad.kst new file mode 100644 index 000000000..e9c0881fe --- /dev/null +++ b/spec/ks/repeat_eos_bytes_pad.kst @@ -0,0 +1,12 @@ +id: repeat_eos_bytes_pad +data: repeat_until_process.bin +asserts: + - actual: records.size + expected: 3 + + - actual: records[0] + expected: '[0xe8, 0xba]' + - actual: records[1] + expected: '[0xfa, 0x9e, 0xb8]' + - actual: records[2] + expected: '[0xaa, 0x55, 0x55, 0x55, 0x55]' diff --git a/spec/ks/repeat_eos_bytes_pad_term.kst b/spec/ks/repeat_eos_bytes_pad_term.kst new file mode 100644 index 000000000..2dfb5bca5 --- /dev/null +++ b/spec/ks/repeat_eos_bytes_pad_term.kst @@ -0,0 +1,12 @@ +id: repeat_eos_bytes_pad_term +data: repeat_until_process.bin +asserts: + - actual: records.size + expected: 3 + + - actual: records[0] + expected: '[0xe8, 0xba]' + - actual: records[1] + expected: '[0xfa, 0x9e, 0xb8]' + - actual: records[2] + expected: '[0xaa, 0x55]' diff --git a/spec/ks/repeat_eos_term_bytes.kst b/spec/ks/repeat_eos_term_bytes.kst new file mode 100644 index 000000000..fda159882 --- /dev/null +++ b/spec/ks/repeat_eos_term_bytes.kst @@ -0,0 +1,10 @@ +id: repeat_eos_term_bytes +data: process_rotate.bin +asserts: + - actual: records.size + expected: 2 + + - actual: records[0] + expected: '[0x09, 0xac, 0x8d, 0x8d, 0xed, 0xba, 0x7b, 0x93, 0x63, 0x23, 0x01, 0x2a, 0x34, 0xb2]' + - actual: records[1] + expected: '[0x39, 0xb2]' diff --git a/spec/ks/repeat_n_bytes_pad.kst b/spec/ks/repeat_n_bytes_pad.kst new file mode 100644 index 000000000..b0a335ed2 --- /dev/null +++ b/spec/ks/repeat_n_bytes_pad.kst @@ -0,0 +1,12 @@ +id: repeat_n_bytes_pad +data: repeat_until_process.bin +asserts: + - actual: records.size + expected: 3 + + - actual: records[0] + expected: '[0xe8, 0xba]' + - actual: records[1] + expected: '[0xfa, 0x9e, 0xb8]' + - actual: records[2] + expected: '[0xaa, 0x55, 0x55, 0x55, 0x55]' diff --git a/spec/ks/repeat_n_bytes_pad_term.kst b/spec/ks/repeat_n_bytes_pad_term.kst new file mode 100644 index 000000000..f1eb05793 --- /dev/null +++ b/spec/ks/repeat_n_bytes_pad_term.kst @@ -0,0 +1,12 @@ +id: repeat_n_bytes_pad_term +data: repeat_until_process.bin +asserts: + - actual: records.size + expected: 3 + + - actual: records[0] + expected: '[0xe8, 0xba]' + - actual: records[1] + expected: '[0xfa, 0x9e, 0xb8]' + - actual: records[2] + expected: '[0xaa, 0x55]' diff --git a/spec/ks/repeat_n_term_bytes.kst b/spec/ks/repeat_n_term_bytes.kst new file mode 100644 index 000000000..26fe897a3 --- /dev/null +++ b/spec/ks/repeat_n_term_bytes.kst @@ -0,0 +1,23 @@ +id: repeat_n_term_bytes +data: repeat_until_process.bin +asserts: + - actual: records1.size + expected: 2 + - actual: records1[0] + expected: '[0xe8, 0xba]' + - actual: records1[1] + expected: '[].as' + + - actual: records2.size + expected: 2 + - actual: records2[0] + expected: '[0xaa]' + - actual: records2[1] + expected: '[0xfa, 0x9e, 0xb8, 0xaa]' + + - actual: records3.size + expected: 2 + - actual: records3[0] + expected: '[0xaa, 0xaa]' + - actual: records3[1] + expected: '[].as' diff --git a/spec/ks/repeat_until_bytes_pad.kst b/spec/ks/repeat_until_bytes_pad.kst new file mode 100644 index 000000000..cbf59441c --- /dev/null +++ b/spec/ks/repeat_until_bytes_pad.kst @@ -0,0 +1,12 @@ +id: repeat_until_bytes_pad +data: repeat_until_process.bin +asserts: + - actual: records.size + expected: 3 + + - actual: records[0] + expected: '[0xe8, 0xba]' + - actual: records[1] + expected: '[0xfa, 0x9e, 0xb8]' + - actual: records[2] + expected: '[0xaa, 0x55, 0x55, 0x55, 0x55]' diff --git a/spec/ks/repeat_until_bytes_pad_term.kst b/spec/ks/repeat_until_bytes_pad_term.kst new file mode 100644 index 000000000..e8c4fdc30 --- /dev/null +++ b/spec/ks/repeat_until_bytes_pad_term.kst @@ -0,0 +1,12 @@ +id: repeat_until_bytes_pad_term +data: repeat_until_process.bin +asserts: + - actual: records.size + expected: 3 + + - actual: records[0] + expected: '[0xe8, 0xba]' + - actual: records[1] + expected: '[0xfa, 0x9e, 0xb8]' + - actual: records[2] + expected: '[0xaa, 0x55]' diff --git a/spec/ks/repeat_until_term_bytes.kst b/spec/ks/repeat_until_term_bytes.kst new file mode 100644 index 000000000..08f7bf8c2 --- /dev/null +++ b/spec/ks/repeat_until_term_bytes.kst @@ -0,0 +1,23 @@ +id: repeat_until_term_bytes +data: repeat_until_process.bin +asserts: + - actual: records1.size + expected: 2 + - actual: records1[0] + expected: '[0xe8, 0xba]' + - actual: records1[1] + expected: '[].as' + + - actual: records2.size + expected: 2 + - actual: records2[0] + expected: '[0xaa]' + - actual: records2[1] + expected: '[0xfa, 0x9e, 0xb8, 0xaa]' + + - actual: records3.size + expected: 2 + - actual: records3[0] + expected: '[0xaa, 0xaa]' + - actual: records3[1] + expected: '[].as' From 6789fdfd3a35046e5b781158104c87b15b3d2b3f Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Thu, 8 Sep 2022 13:34:01 +0200 Subject: [PATCH 046/126] Add {Bytes,Str{Eos,},Struct}PadTermEqual (`terminator` == `pad-right`) --- formats/bytes_pad_term_equal.ksy | 23 +++++++++ formats/str_eos_pad_term_equal.ksy | 49 +++++++++++++++++++ formats/str_pad_term_equal.ksy | 28 +++++++++++ formats/struct_pad_term_equal.ksy | 32 ++++++++++++ .../struct/spec/TestBytesPadTermEqual.java | 19 +++++++ .../struct/spec/TestStrEosPadTermEqual.java | 19 +++++++ .../struct/spec/TestStrPadTermEqual.java | 19 +++++++ .../struct/spec/TestStructPadTermEqual.java | 19 +++++++ .../specwrite/TestBytesPadTermEqual.java | 20 ++++++++ .../specwrite/TestStrEosPadTermEqual.java | 20 ++++++++ .../struct/specwrite/TestStrPadTermEqual.java | 20 ++++++++ .../specwrite/TestStructPadTermEqual.java | 20 ++++++++ spec/ks/bytes_pad_term_equal.kst | 11 +++++ spec/ks/str_eos_pad_term_equal.kst | 11 +++++ spec/ks/str_pad_term_equal.kst | 11 +++++ spec/ks/struct_pad_term_equal.kst | 11 +++++ 16 files changed, 332 insertions(+) create mode 100644 formats/bytes_pad_term_equal.ksy create mode 100644 formats/str_eos_pad_term_equal.ksy create mode 100644 formats/str_pad_term_equal.ksy create mode 100644 formats/struct_pad_term_equal.ksy create mode 100644 spec/java/src/io/kaitai/struct/spec/TestBytesPadTermEqual.java create mode 100644 spec/java/src/io/kaitai/struct/spec/TestStrEosPadTermEqual.java create mode 100644 spec/java/src/io/kaitai/struct/spec/TestStrPadTermEqual.java create mode 100644 spec/java/src/io/kaitai/struct/spec/TestStructPadTermEqual.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTermEqual.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestStrEosPadTermEqual.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestStrPadTermEqual.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestStructPadTermEqual.java create mode 100644 spec/ks/bytes_pad_term_equal.kst create mode 100644 spec/ks/str_eos_pad_term_equal.kst create mode 100644 spec/ks/str_pad_term_equal.kst create mode 100644 spec/ks/struct_pad_term_equal.kst diff --git a/formats/bytes_pad_term_equal.ksy b/formats/bytes_pad_term_equal.ksy new file mode 100644 index 000000000..58dd01de5 --- /dev/null +++ b/formats/bytes_pad_term_equal.ksy @@ -0,0 +1,23 @@ +# Tests "pad-right" and "terminator" functionality in fixed-length byte arrays +# with `terminator` == `pad-right` +meta: + id: bytes_pad_term_equal +seq: + - id: s1 + size: 20 + terminator: 0x40 + pad-right: 0x40 + - id: s2 + size: 20 + terminator: 0x40 + include: true + pad-right: 0x2b + - id: s3 + size: 20 + terminator: 0x2b + pad-right: 0x2b + - id: s4 + size: 20 + terminator: 0x2e + include: true + pad-right: 0x2e diff --git a/formats/str_eos_pad_term_equal.ksy b/formats/str_eos_pad_term_equal.ksy new file mode 100644 index 000000000..2a0881d88 --- /dev/null +++ b/formats/str_eos_pad_term_equal.ksy @@ -0,0 +1,49 @@ +# Tests "pad-right" and "terminator" functionality in fixed-length strings ("str" with "size") +# with `terminator` == `pad-right` +meta: + id: str_eos_pad_term_equal + encoding: UTF-8 +seq: + - id: s1 + size: 20 + type: s1_type + - id: s2 + size: 20 + type: s2_type + - id: s3 + size: 20 + type: s3_type + - id: s4 + size: 20 + type: s4_type +types: + s1_type: + seq: + - id: value + type: str + size-eos: true + terminator: 0x40 + pad-right: 0x40 + s2_type: + seq: + - id: value + type: str + size-eos: true + terminator: 0x40 + include: true + pad-right: 0x2b + s3_type: + seq: + - id: value + type: str + size-eos: true + terminator: 0x2b + pad-right: 0x2b + s4_type: + seq: + - id: value + type: str + size-eos: true + terminator: 0x2e + include: true + pad-right: 0x2e diff --git a/formats/str_pad_term_equal.ksy b/formats/str_pad_term_equal.ksy new file mode 100644 index 000000000..6f787d9da --- /dev/null +++ b/formats/str_pad_term_equal.ksy @@ -0,0 +1,28 @@ +# Tests "pad-right" and "terminator" functionality in fixed-length strings ("str" with "size") +# with `terminator` == `pad-right` +meta: + id: str_pad_term_equal + encoding: UTF-8 +seq: + - id: s1 + type: str + size: 20 + terminator: 0x40 + pad-right: 0x40 + - id: s2 + type: str + size: 20 + terminator: 0x40 + include: true + pad-right: 0x2b + - id: s3 + type: str + size: 20 + terminator: 0x2b + pad-right: 0x2b + - id: s4 + type: str + size: 20 + terminator: 0x2e + include: true + pad-right: 0x2e diff --git a/formats/struct_pad_term_equal.ksy b/formats/struct_pad_term_equal.ksy new file mode 100644 index 000000000..a071b9bf5 --- /dev/null +++ b/formats/struct_pad_term_equal.ksy @@ -0,0 +1,32 @@ +# Tests "pad-right" and "terminator" functionality in fixed-length structs +# with `terminator` == `pad-right` +meta: + id: struct_pad_term_equal +seq: + - id: s1 + size: 20 + terminator: 0x40 + pad-right: 0x40 + type: bytes_wrapper + - id: s2 + size: 20 + terminator: 0x40 + include: true + pad-right: 0x2b + type: bytes_wrapper + - id: s3 + size: 20 + terminator: 0x2b + pad-right: 0x2b + type: bytes_wrapper + - id: s4 + size: 20 + terminator: 0x2e + include: true + pad-right: 0x2e + type: bytes_wrapper +types: + bytes_wrapper: + seq: + - id: value + size-eos: true diff --git a/spec/java/src/io/kaitai/struct/spec/TestBytesPadTermEqual.java b/spec/java/src/io/kaitai/struct/spec/TestBytesPadTermEqual.java new file mode 100644 index 000000000..9505fe90e --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestBytesPadTermEqual.java @@ -0,0 +1,19 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.BytesPadTermEqual; +import org.testng.annotations.Test; +import static org.testng.Assert.*; +public class TestBytesPadTermEqual extends CommonSpec { + + @Test + public void testBytesPadTermEqual() throws Exception { + BytesPadTermEqual r = BytesPadTermEqual.fromFile(SRC_DIR + "str_pad_term.bin"); + + assertEquals(r.s1(), new byte[] { 115, 116, 114, 49 }); + assertEquals(r.s2(), new byte[] { 115, 116, 114, 50, 102, 111, 111, 64 }); + assertEquals(r.s3(), new byte[] { 115, 116, 114 }); + assertEquals(r.s4(), new byte[] { 115, 116, 114, 52, 98, 97, 122, 64, 46 }); + } +} diff --git a/spec/java/src/io/kaitai/struct/spec/TestStrEosPadTermEqual.java b/spec/java/src/io/kaitai/struct/spec/TestStrEosPadTermEqual.java new file mode 100644 index 000000000..526caee54 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestStrEosPadTermEqual.java @@ -0,0 +1,19 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.StrEosPadTermEqual; +import org.testng.annotations.Test; +import static org.testng.Assert.*; +public class TestStrEosPadTermEqual extends CommonSpec { + + @Test + public void testStrEosPadTermEqual() throws Exception { + StrEosPadTermEqual r = StrEosPadTermEqual.fromFile(SRC_DIR + "str_pad_term.bin"); + + assertEquals(r.s1().value(), "str1"); + assertEquals(r.s2().value(), "str2foo@"); + assertEquals(r.s3().value(), "str"); + assertEquals(r.s4().value(), "str4baz@."); + } +} diff --git a/spec/java/src/io/kaitai/struct/spec/TestStrPadTermEqual.java b/spec/java/src/io/kaitai/struct/spec/TestStrPadTermEqual.java new file mode 100644 index 000000000..1c94db5fa --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestStrPadTermEqual.java @@ -0,0 +1,19 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.StrPadTermEqual; +import org.testng.annotations.Test; +import static org.testng.Assert.*; +public class TestStrPadTermEqual extends CommonSpec { + + @Test + public void testStrPadTermEqual() throws Exception { + StrPadTermEqual r = StrPadTermEqual.fromFile(SRC_DIR + "str_pad_term.bin"); + + assertEquals(r.s1(), "str1"); + assertEquals(r.s2(), "str2foo@"); + assertEquals(r.s3(), "str"); + assertEquals(r.s4(), "str4baz@."); + } +} diff --git a/spec/java/src/io/kaitai/struct/spec/TestStructPadTermEqual.java b/spec/java/src/io/kaitai/struct/spec/TestStructPadTermEqual.java new file mode 100644 index 000000000..d4dde2a12 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestStructPadTermEqual.java @@ -0,0 +1,19 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.StructPadTermEqual; +import org.testng.annotations.Test; +import static org.testng.Assert.*; +public class TestStructPadTermEqual extends CommonSpec { + + @Test + public void testStructPadTermEqual() throws Exception { + StructPadTermEqual r = StructPadTermEqual.fromFile(SRC_DIR + "str_pad_term.bin"); + + assertEquals(r.s1().value(), new byte[] { 115, 116, 114, 49 }); + assertEquals(r.s2().value(), new byte[] { 115, 116, 114, 50, 102, 111, 111, 64 }); + assertEquals(r.s3().value(), new byte[] { 115, 116, 114 }); + assertEquals(r.s4().value(), new byte[] { 115, 116, 114, 52, 98, 97, 122, 64, 46 }); + } +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTermEqual.java b/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTermEqual.java new file mode 100644 index 000000000..f5d80b3ac --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTermEqual.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.BytesPadTermEqual; +import org.testng.annotations.Test; + +public class TestBytesPadTermEqual extends CommonSpec { + @Override + protected Class getStructClass() { + return BytesPadTermEqual.class; + } + + @Override + protected String getSrcFilename() { + return "str_pad_term.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestStrEosPadTermEqual.java b/spec/java/src/io/kaitai/struct/specwrite/TestStrEosPadTermEqual.java new file mode 100644 index 000000000..e53ca74c5 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestStrEosPadTermEqual.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.StrEosPadTermEqual; +import org.testng.annotations.Test; + +public class TestStrEosPadTermEqual extends CommonSpec { + @Override + protected Class getStructClass() { + return StrEosPadTermEqual.class; + } + + @Override + protected String getSrcFilename() { + return "str_pad_term.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestStrPadTermEqual.java b/spec/java/src/io/kaitai/struct/specwrite/TestStrPadTermEqual.java new file mode 100644 index 000000000..297850899 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestStrPadTermEqual.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.StrPadTermEqual; +import org.testng.annotations.Test; + +public class TestStrPadTermEqual extends CommonSpec { + @Override + protected Class getStructClass() { + return StrPadTermEqual.class; + } + + @Override + protected String getSrcFilename() { + return "str_pad_term.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestStructPadTermEqual.java b/spec/java/src/io/kaitai/struct/specwrite/TestStructPadTermEqual.java new file mode 100644 index 000000000..d9a6a94bf --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestStructPadTermEqual.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.StructPadTermEqual; +import org.testng.annotations.Test; + +public class TestStructPadTermEqual extends CommonSpec { + @Override + protected Class getStructClass() { + return StructPadTermEqual.class; + } + + @Override + protected String getSrcFilename() { + return "str_pad_term.bin"; + } + +} diff --git a/spec/ks/bytes_pad_term_equal.kst b/spec/ks/bytes_pad_term_equal.kst new file mode 100644 index 000000000..9d0f83aed --- /dev/null +++ b/spec/ks/bytes_pad_term_equal.kst @@ -0,0 +1,11 @@ +id: bytes_pad_term_equal +data: str_pad_term.bin +asserts: + - actual: s1 + expected: '[0x73, 0x74, 0x72, 0x31]' # str1 + - actual: s2 + expected: '[0x73, 0x74, 0x72, 0x32, 0x66, 0x6f, 0x6f, 0x40]' # str2foo@ + - actual: s3 + expected: '[0x73, 0x74, 0x72]' # str + - actual: s4 + expected: '[0x73, 0x74, 0x72, 0x34, 0x62, 0x61, 0x7a, 0x40, 0x2e]' # str4baz@. diff --git a/spec/ks/str_eos_pad_term_equal.kst b/spec/ks/str_eos_pad_term_equal.kst new file mode 100644 index 000000000..b7d2aeea3 --- /dev/null +++ b/spec/ks/str_eos_pad_term_equal.kst @@ -0,0 +1,11 @@ +id: str_eos_pad_term_equal +data: str_pad_term.bin +asserts: + - actual: s1.value + expected: '"str1"' + - actual: s2.value + expected: '"str2foo@"' + - actual: s3.value + expected: '"str"' + - actual: s4.value + expected: '"str4baz@."' diff --git a/spec/ks/str_pad_term_equal.kst b/spec/ks/str_pad_term_equal.kst new file mode 100644 index 000000000..dd071c59e --- /dev/null +++ b/spec/ks/str_pad_term_equal.kst @@ -0,0 +1,11 @@ +id: str_pad_term_equal +data: str_pad_term.bin +asserts: + - actual: s1 + expected: '"str1"' + - actual: s2 + expected: '"str2foo@"' + - actual: s3 + expected: '"str"' + - actual: s4 + expected: '"str4baz@."' diff --git a/spec/ks/struct_pad_term_equal.kst b/spec/ks/struct_pad_term_equal.kst new file mode 100644 index 000000000..587269d9e --- /dev/null +++ b/spec/ks/struct_pad_term_equal.kst @@ -0,0 +1,11 @@ +id: struct_pad_term_equal +data: str_pad_term.bin +asserts: + - actual: s1.value + expected: '[0x73, 0x74, 0x72, 0x31]' # str1 + - actual: s2.value + expected: '[0x73, 0x74, 0x72, 0x32, 0x66, 0x6f, 0x6f, 0x40]' # str2foo@ + - actual: s3.value + expected: '[0x73, 0x74, 0x72]' # str + - actual: s4.value + expected: '[0x73, 0x74, 0x72, 0x34, 0x62, 0x61, 0x7a, 0x40, 0x2e]' # str4baz@. From 0c07f4c89142005e3a269802b6dd45188aa947b5 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Sat, 10 Sep 2022 22:57:15 +0200 Subject: [PATCH 047/126] Add new BytesPadTerm* tests and asserts for _check() correctness See https://github.com/kaitai-io/kaitai_struct_compiler/commit/73b034703f693c4c46353ca77dbebf73bef7e528 --- formats/bytes_pad_term_empty.ksy | 19 ++ formats/bytes_pad_term_roundtrip.ksy | 21 ++ formats/bytes_pad_term_zero_size.ksy | 19 ++ .../struct/spec/TestBytesPadTermEmpty.java | 19 ++ .../spec/TestBytesPadTermRoundtrip.java | 19 ++ .../struct/spec/TestBytesPadTermZeroSize.java | 19 ++ .../struct/specwrite/TestBytesPadTerm.java | 163 ++++++++++++++-- .../specwrite/TestBytesPadTermEmpty.java | 20 ++ .../specwrite/TestBytesPadTermEqual.java | 184 +++++++++++++++++- .../specwrite/TestBytesPadTermRoundtrip.java | 34 ++++ .../specwrite/TestBytesPadTermZeroSize.java | 20 ++ spec/ks/bytes_pad_term_empty.kst | 11 ++ spec/ks/bytes_pad_term_roundtrip.kst | 11 ++ spec/ks/bytes_pad_term_zero_size.kst | 11 ++ 14 files changed, 549 insertions(+), 21 deletions(-) create mode 100644 formats/bytes_pad_term_empty.ksy create mode 100644 formats/bytes_pad_term_roundtrip.ksy create mode 100644 formats/bytes_pad_term_zero_size.ksy create mode 100644 spec/java/src/io/kaitai/struct/spec/TestBytesPadTermEmpty.java create mode 100644 spec/java/src/io/kaitai/struct/spec/TestBytesPadTermRoundtrip.java create mode 100644 spec/java/src/io/kaitai/struct/spec/TestBytesPadTermZeroSize.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTermEmpty.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTermRoundtrip.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTermZeroSize.java create mode 100644 spec/ks/bytes_pad_term_empty.kst create mode 100644 spec/ks/bytes_pad_term_roundtrip.kst create mode 100644 spec/ks/bytes_pad_term_zero_size.kst diff --git a/formats/bytes_pad_term_empty.ksy b/formats/bytes_pad_term_empty.ksy new file mode 100644 index 000000000..037e0941f --- /dev/null +++ b/formats/bytes_pad_term_empty.ksy @@ -0,0 +1,19 @@ +# Same as "bytes_pad_term", but used with different input file that is +# meant to test fully empty byte arrays (see "str_pad_term_empty") +meta: + id: bytes_pad_term_empty +seq: + - id: str_pad + size: 20 + pad-right: 0x40 + - id: str_term + size: 20 + terminator: 0x40 + - id: str_term_and_pad + size: 20 + terminator: 0x40 + pad-right: 0x2b + - id: str_term_include + size: 20 + terminator: 0x40 + include: true diff --git a/formats/bytes_pad_term_roundtrip.ksy b/formats/bytes_pad_term_roundtrip.ksy new file mode 100644 index 000000000..6caa239c5 --- /dev/null +++ b/formats/bytes_pad_term_roundtrip.ksy @@ -0,0 +1,21 @@ +# Like "bytes_pad_term", but with added `pad-right`s to be able to test for an +# exact match with the original file after serialization +meta: + id: bytes_pad_term_roundtrip +seq: + - id: str_pad + size: 20 + pad-right: 0x40 + - id: str_term + size: 20 + terminator: 0x40 + pad-right: 0x2b + - id: str_term_and_pad + size: 20 + terminator: 0x40 + pad-right: 0x2b + - id: str_term_include + size: 20 + terminator: 0x40 + include: true + pad-right: 0x2e diff --git a/formats/bytes_pad_term_zero_size.ksy b/formats/bytes_pad_term_zero_size.ksy new file mode 100644 index 000000000..51407553a --- /dev/null +++ b/formats/bytes_pad_term_zero_size.ksy @@ -0,0 +1,19 @@ +# Like "bytes_pad_term", but all `size`s are set to 0 (to make sure we don't +# fail in this case) +meta: + id: bytes_pad_term_zero_size +seq: + - id: str_pad + size: 0 + pad-right: 0x40 + - id: str_term + size: 0 + terminator: 0x40 + - id: str_term_and_pad + size: 0 + terminator: 0x40 + pad-right: 0x2b + - id: str_term_include + size: 0 + terminator: 0x40 + include: true diff --git a/spec/java/src/io/kaitai/struct/spec/TestBytesPadTermEmpty.java b/spec/java/src/io/kaitai/struct/spec/TestBytesPadTermEmpty.java new file mode 100644 index 000000000..651a248e3 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestBytesPadTermEmpty.java @@ -0,0 +1,19 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.BytesPadTermEmpty; +import org.testng.annotations.Test; +import static org.testng.Assert.*; +public class TestBytesPadTermEmpty extends CommonSpec { + + @Test + public void testBytesPadTermEmpty() throws Exception { + BytesPadTermEmpty r = BytesPadTermEmpty.fromFile(SRC_DIR + "str_pad_term_empty.bin"); + + assertEquals(r.strPad(), new byte[] { }); + assertEquals(r.strTerm(), new byte[] { }); + assertEquals(r.strTermAndPad(), new byte[] { }); + assertEquals(r.strTermInclude(), new byte[] { 64 }); + } +} diff --git a/spec/java/src/io/kaitai/struct/spec/TestBytesPadTermRoundtrip.java b/spec/java/src/io/kaitai/struct/spec/TestBytesPadTermRoundtrip.java new file mode 100644 index 000000000..c81831389 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestBytesPadTermRoundtrip.java @@ -0,0 +1,19 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.BytesPadTermRoundtrip; +import org.testng.annotations.Test; +import static org.testng.Assert.*; +public class TestBytesPadTermRoundtrip extends CommonSpec { + + @Test + public void testBytesPadTermRoundtrip() throws Exception { + BytesPadTermRoundtrip r = BytesPadTermRoundtrip.fromFile(SRC_DIR + "str_pad_term.bin"); + + assertEquals(r.strPad(), new byte[] { 115, 116, 114, 49 }); + assertEquals(r.strTerm(), new byte[] { 115, 116, 114, 50, 102, 111, 111 }); + assertEquals(r.strTermAndPad(), new byte[] { 115, 116, 114, 43, 43, 43, 51, 98, 97, 114, 43, 43, 43 }); + assertEquals(r.strTermInclude(), new byte[] { 115, 116, 114, 52, 98, 97, 122, 64 }); + } +} diff --git a/spec/java/src/io/kaitai/struct/spec/TestBytesPadTermZeroSize.java b/spec/java/src/io/kaitai/struct/spec/TestBytesPadTermZeroSize.java new file mode 100644 index 000000000..8404d6040 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestBytesPadTermZeroSize.java @@ -0,0 +1,19 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.BytesPadTermZeroSize; +import org.testng.annotations.Test; +import static org.testng.Assert.*; +public class TestBytesPadTermZeroSize extends CommonSpec { + + @Test + public void testBytesPadTermZeroSize() throws Exception { + BytesPadTermZeroSize r = BytesPadTermZeroSize.fromFile(SRC_DIR + "enum_negative.bin"); + + assertEquals(r.strPad(), new byte[] { }); + assertEquals(r.strTerm(), new byte[] { }); + assertEquals(r.strTermAndPad(), new byte[] { }); + assertEquals(r.strTermInclude(), new byte[] { }); + } +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTerm.java b/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTerm.java index ad6340333..a684c646a 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTerm.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTerm.java @@ -7,65 +7,190 @@ public class TestBytesPadTerm extends CommonSpec { @Test - public void testBytesPadTerm() throws Exception { - // NOTE: here it makes sense to prefer a manual test over the automatic roundtrip, because - // the roundtrip can't recognize whether the `pad-right` is correct (since it isn't relevant - // for parsing and therefore has no effect on consistency) + public void checkGoodMaxLengths() throws Exception { + BytesPadTerm r = new BytesPadTerm(); + r.setStrPad("12345678901234567890".getBytes()); + r.setStrTerm("12345678901234567890".getBytes()); + r.setStrTermAndPad("12345678901234567890".getBytes()); + r.setStrTermInclude("12345678901234567890".getBytes()); + r._check(); + } + @Test + public void checkGoodMinLengths() throws Exception { BytesPadTerm r = new BytesPadTerm(); + r.setStrPad("".getBytes()); + r.setStrTerm("".getBytes()); + r.setStrTermAndPad("".getBytes()); + r.setStrTermInclude("@".getBytes()); + r._check(); + } - r.setStrPad("str1".getBytes()); - r.setStrTerm("str2foo".getBytes()); - r.setStrTermAndPad("str+++3bar+++".getBytes()); - r.setStrTermInclude("str4baz@".getBytes()); + @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: str_pad,.*") + public void checkLongerStrPad() throws Exception { + BytesPadTerm r = new BytesPadTerm(); + r.setStrPad("123456789012345678901".getBytes()); + r._check(); + } - assertEqualToFile(r, "str_pad_term.bin"); + @Test + public void checkGoodLastByteStrPad() throws Exception { + BytesPadTerm r = new BytesPadTerm(); + r.setStrPad(("@@@@@"+"@@@@@"+"@@@@@"+"@@@@?").getBytes()); + r.setStrTerm("12345678901234567890".getBytes()); + r.setStrTermAndPad("12345678901234567890".getBytes()); + r.setStrTermInclude("12345678901234567890".getBytes()); + r._check(); } @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: str_pad,.*") - public void checkLongerString1() throws Exception { + public void checkBadLastByteStrPad() throws Exception { BytesPadTerm r = new BytesPadTerm(); - r.setStrPad("1234567890123456789012345".getBytes()); + r.setStrPad("123456789012345678@".getBytes()); r._check(); } @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: str_term,.*") - public void checkLongerString2() throws Exception { + public void checkLongerStrTerm() throws Exception { BytesPadTerm r = new BytesPadTerm(); r.setStrPad("12345678901234567890".getBytes()); - r.setStrTerm("12345678901234567890".getBytes()); + r.setStrTerm("123456789012345678901".getBytes()); + r._check(); + } + + @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: str_term,.*") + public void checkBadHasTerminator1StrTerm() throws Exception { + BytesPadTerm r = new BytesPadTerm(); + r.setStrPad("12345678901234567890".getBytes()); + r.setStrTerm("123456789012@4567890".getBytes()); + r._check(); + } + + @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: str_term,.*") + public void checkBadHasTerminator2StrTerm() throws Exception { + BytesPadTerm r = new BytesPadTerm(); + r.setStrPad("12345678901234567890".getBytes()); + r.setStrTerm("1234567890123456789@".getBytes()); r._check(); } @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: str_term_and_pad,.*") - public void checkLongerString3() throws Exception { + public void checkLongerStrTermAndPad() throws Exception { BytesPadTerm r = new BytesPadTerm(); r.setStrPad("12345678901234567890".getBytes()); - r.setStrTerm("1234567890123456789".getBytes()); + r.setStrTerm("12345678901234567890".getBytes()); r.setStrTermAndPad("123456789012345678901".getBytes()); r._check(); } + @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: str_term_and_pad,.*") + public void checkBadHasTerminatorStrTermAndPad() throws Exception { + BytesPadTerm r = new BytesPadTerm(); + r.setStrPad("12345678901234567890".getBytes()); + r.setStrTerm("12345678901234567890".getBytes()); + r.setStrTermAndPad("@2345678901234567890".getBytes()); + r._check(); + } + + @Test + public void checkGoodLastByte1StrTermAndPad() throws Exception { + BytesPadTerm r = new BytesPadTerm(); + r.setStrPad("12345678901234567890".getBytes()); + r.setStrTerm("12345678901234567890".getBytes()); + r.setStrTermAndPad(("+++++"+"+++++"+"+++++"+"++++").getBytes()); + r.setStrTermInclude("12345678901234567890".getBytes()); + r._check(); + } + + @Test + public void checkGoodLastByte2StrTermAndPad() throws Exception { + BytesPadTerm r = new BytesPadTerm(); + r.setStrPad("12345678901234567890".getBytes()); + r.setStrTerm("12345678901234567890".getBytes()); + r.setStrTermAndPad(("+++++"+"+++++"+"+++++"+"++++0").getBytes()); + r.setStrTermInclude("12345678901234567890".getBytes()); + r._check(); + } + + @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: str_term_and_pad,.*") + public void checkBadLastByteStrTermAndPad() throws Exception { + BytesPadTerm r = new BytesPadTerm(); + r.setStrPad("12345678901234567890".getBytes()); + r.setStrTerm("12345678901234567890".getBytes()); + r.setStrTermAndPad("1234567890123456789+".getBytes()); + r._check(); + } + @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: str_term_include,.*") - public void checkLongerString4() throws Exception { + public void checkLongerStrTermInclude() throws Exception { BytesPadTerm r = new BytesPadTerm(); r.setStrPad("12345678901234567890".getBytes()); - r.setStrTerm("1234567890123456789".getBytes()); + r.setStrTerm("12345678901234567890".getBytes()); r.setStrTermAndPad("12345678901234567890".getBytes()); r.setStrTermInclude("123456789012345678901".getBytes()); r._check(); } @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: str_term_include,.*") - public void checkBadTerminator() throws Exception { + public void checkEmptyStrTermInclude() throws Exception { + BytesPadTerm r = new BytesPadTerm(); + r.setStrPad("12345678901234567890".getBytes()); + r.setStrTerm("12345678901234567890".getBytes()); + r.setStrTermAndPad("12345678901234567890".getBytes()); + r.setStrTermInclude("".getBytes()); + r._check(); + } + + @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: str_term_include,.*") + public void checkBadNoTerminatorStrTermInclude() throws Exception { BytesPadTerm r = new BytesPadTerm(); r.setStrPad("12345678901234567890".getBytes()); - r.setStrTerm("1234567890123456789".getBytes()); + r.setStrTerm("12345678901234567890".getBytes()); r.setStrTermAndPad("12345678901234567890".getBytes()); r.setStrTermInclude("123".getBytes()); r._check(); } + @Test + public void checkGoodTerminator1StrTermInclude() throws Exception { + BytesPadTerm r = new BytesPadTerm(); + r.setStrPad("12345678901234567890".getBytes()); + r.setStrTerm("12345678901234567890".getBytes()); + r.setStrTermAndPad("12345678901234567890".getBytes()); + r.setStrTermInclude("12@".getBytes()); + r._check(); + } + + @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: str_term_include,.*") + public void checkEarlyTerminator1StrTermInclude() throws Exception { + BytesPadTerm r = new BytesPadTerm(); + r.setStrPad("12345678901234567890".getBytes()); + r.setStrTerm("12345678901234567890".getBytes()); + r.setStrTermAndPad("12345678901234567890".getBytes()); + r.setStrTermInclude("1@@".getBytes()); + r._check(); + } + + @Test + public void checkGoodTerminator2StrTermInclude() throws Exception { + BytesPadTerm r = new BytesPadTerm(); + r.setStrPad("12345678901234567890".getBytes()); + r.setStrTerm("12345678901234567890".getBytes()); + r.setStrTermAndPad("12345678901234567890".getBytes()); + r.setStrTermInclude("1234567890123456789@".getBytes()); + r._check(); + } + + @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: str_term_include,.*") + public void checkEarlyTerminator2StrTermInclude() throws Exception { + BytesPadTerm r = new BytesPadTerm(); + r.setStrPad("12345678901234567890".getBytes()); + r.setStrTerm("12345678901234567890".getBytes()); + r.setStrTermAndPad("12345678901234567890".getBytes()); + r.setStrTermInclude("123456789012345678@@".getBytes()); + r._check(); + } + @Override protected Class getStructClass() { return BytesPadTerm.class; diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTermEmpty.java b/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTermEmpty.java new file mode 100644 index 000000000..a0fae87c2 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTermEmpty.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.BytesPadTermEmpty; +import org.testng.annotations.Test; + +public class TestBytesPadTermEmpty extends CommonSpec { + @Override + protected Class getStructClass() { + return BytesPadTermEmpty.class; + } + + @Override + protected String getSrcFilename() { + return "str_pad_term_empty.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTermEqual.java b/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTermEqual.java index f5d80b3ac..cb56d66cf 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTermEqual.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTermEqual.java @@ -1,7 +1,6 @@ -// Autogenerated from KST: please remove this line if doing any edits by hand! - package io.kaitai.struct.specwrite; +import io.kaitai.struct.ConsistencyError; import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.BytesPadTermEqual; import org.testng.annotations.Test; @@ -17,4 +16,185 @@ protected String getSrcFilename() { return "str_pad_term.bin"; } + @Test + public void checkGoodMaxLengths() throws Exception { + BytesPadTermEqual r = new BytesPadTermEqual(); + r.setS1("12345678901234567890".getBytes()); + r.setS2("12345678901234567890".getBytes()); + r.setS3("12345678901234567890".getBytes()); + r.setS4("12345678901234567890".getBytes()); + r._check(); + } + + @Test + public void checkGoodMinLengths() throws Exception { + BytesPadTermEqual r = new BytesPadTermEqual(); + r.setS1("".getBytes()); + r.setS2("".getBytes()); + r.setS3("".getBytes()); + r.setS4(".".getBytes()); + r._check(); + } + + @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: s1,.*") + public void checkLongerS1() throws Exception { + BytesPadTermEqual r = new BytesPadTermEqual(); + r.setS1("123456789012345678901".getBytes()); + r._check(); + } + + @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: s1,.*") + public void checkBadHasTerminator1S1() throws Exception { + BytesPadTermEqual r = new BytesPadTermEqual(); + r.setS1("123456789012@4567890".getBytes()); + r._check(); + } + + @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: s1,.*") + public void checkBadHasTerminator2S1() throws Exception { + BytesPadTermEqual r = new BytesPadTermEqual(); + r.setS1("1234567890123456789@".getBytes()); + r._check(); + } + + @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: s2,.*") + public void checkLongerS2() throws Exception { + BytesPadTermEqual r = new BytesPadTermEqual(); + r.setS1("12345678901234567890".getBytes()); + r.setS2("123456789012345678901".getBytes()); + r._check(); + } + + @Test + public void checkGoodTerminator1S2() throws Exception { + BytesPadTermEqual r = new BytesPadTermEqual(); + r.setS1("12345678901234567890".getBytes()); + r.setS2("123456789012345678@".getBytes()); + r.setS3("12345678901234567890".getBytes()); + r.setS4("12345678901234567890".getBytes()); + r._check(); + } + + @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: s2,.*") + public void checkEarlyTerminator1S2() throws Exception { + BytesPadTermEqual r = new BytesPadTermEqual(); + r.setS1("12345678901234567890".getBytes()); + r.setS2("1234567890123456@8@".getBytes()); + r._check(); + } + + @Test + public void checkGoodLastByteS2() throws Exception { + BytesPadTermEqual r = new BytesPadTermEqual(); + r.setS1("12345678901234567890".getBytes()); + r.setS2(("+++++"+"+++++"+"+++++"+"+++9").getBytes()); + r.setS3("12345678901234567890".getBytes()); + r.setS4("12345678901234567890".getBytes()); + r._check(); + } + + @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: s2,.*") + public void checkBadLastByteS2() throws Exception { + BytesPadTermEqual r = new BytesPadTermEqual(); + r.setS1("12345678901234567890".getBytes()); + r.setS2("123456789012345678+".getBytes()); + r._check(); + } + + @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: s3,.*") + public void checkLongerS3() throws Exception { + BytesPadTermEqual r = new BytesPadTermEqual(); + r.setS1("12345678901234567890".getBytes()); + r.setS2("12345678901234567890".getBytes()); + r.setS3("123456789012345678901".getBytes()); + r._check(); + } + + @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: s3,.*") + public void checkBadHasTerminator1S3() throws Exception { + BytesPadTermEqual r = new BytesPadTermEqual(); + r.setS1("12345678901234567890".getBytes()); + r.setS2("12345678901234567890".getBytes()); + r.setS3("1234567890123456789+".getBytes()); + r._check(); + } + + @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: s3,.*") + public void checkBadHasTerminator2S3() throws Exception { + BytesPadTermEqual r = new BytesPadTermEqual(); + r.setS1("12345678901234567890".getBytes()); + r.setS2("12345678901234567890".getBytes()); + r.setS3("12345678901234567+9".getBytes()); + r._check(); + } + + @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: s4,.*") + public void checkLongerS4() throws Exception { + BytesPadTermEqual r = new BytesPadTermEqual(); + r.setS1("12345678901234567890".getBytes()); + r.setS2("12345678901234567890".getBytes()); + r.setS3("12345678901234567890".getBytes()); + r.setS4("123456789012345678901".getBytes()); + r._check(); + } + + @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: s4,.*") + public void checkEmptyS4() throws Exception { + BytesPadTermEqual r = new BytesPadTermEqual(); + r.setS1("12345678901234567890".getBytes()); + r.setS2("12345678901234567890".getBytes()); + r.setS3("12345678901234567890".getBytes()); + r.setS4("".getBytes()); + r._check(); + } + + @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: s4,.*") + public void checkBadNoTerminatorS4() throws Exception { + BytesPadTermEqual r = new BytesPadTermEqual(); + r.setS1("12345678901234567890".getBytes()); + r.setS2("12345678901234567890".getBytes()); + r.setS3("12345678901234567890".getBytes()); + r.setS4("1234567890123456789".getBytes()); + r._check(); + } + + @Test + public void checkGoodTerminator1S4() throws Exception { + BytesPadTermEqual r = new BytesPadTermEqual(); + r.setS1("12345678901234567890".getBytes()); + r.setS2("12345678901234567890".getBytes()); + r.setS3("12345678901234567890".getBytes()); + r.setS4("123456789012345678.".getBytes()); + r._check(); + } + + @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: s4,.*") + public void checkEarlyTerminator1S4() throws Exception { + BytesPadTermEqual r = new BytesPadTermEqual(); + r.setS1("12345678901234567890".getBytes()); + r.setS2("12345678901234567890".getBytes()); + r.setS3("12345678901234567890".getBytes()); + r.setS4(".23456789012345678.".getBytes()); + r._check(); + } + + @Test + public void checkGoodTerminator2S4() throws Exception { + BytesPadTermEqual r = new BytesPadTermEqual(); + r.setS1("12345678901234567890".getBytes()); + r.setS2("12345678901234567890".getBytes()); + r.setS3("12345678901234567890".getBytes()); + r.setS4("1234567890123456789.".getBytes()); + r._check(); + } + + @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: s4,.*") + public void checkEarlyTerminator2S4() throws Exception { + BytesPadTermEqual r = new BytesPadTermEqual(); + r.setS1("12345678901234567890".getBytes()); + r.setS2("12345678901234567890".getBytes()); + r.setS3("12345678901234567890".getBytes()); + r.setS4("123456789012345678..".getBytes()); + r._check(); + } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTermRoundtrip.java b/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTermRoundtrip.java new file mode 100644 index 000000000..532b2e6a7 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTermRoundtrip.java @@ -0,0 +1,34 @@ +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.BytesPadTermRoundtrip; +import org.testng.annotations.Test; + +public class TestBytesPadTermRoundtrip extends CommonSpec { + @Test + public void testBytesPadTermRoundtrip() throws Exception { + // NOTE: here it makes sense to prefer a manual test over the automatic + // testReadWriteRoundtrip, because the roundtrip can't always recognize whether the + // `pad-right` is correct (i.e. whether the serialized field is padded correctly) + + BytesPadTermRoundtrip r = new BytesPadTermRoundtrip(); + + r.setStrPad("str1".getBytes()); + r.setStrTerm("str2foo".getBytes()); + r.setStrTermAndPad("str+++3bar+++".getBytes()); + r.setStrTermInclude("str4baz@".getBytes()); + + assertEqualToFile(r, "str_pad_term.bin"); + } + + @Override + protected Class getStructClass() { + return BytesPadTermRoundtrip.class; + } + + @Override + protected String getSrcFilename() { + return "str_pad_term.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTermZeroSize.java b/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTermZeroSize.java new file mode 100644 index 000000000..cac2e4d3a --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTermZeroSize.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.BytesPadTermZeroSize; +import org.testng.annotations.Test; + +public class TestBytesPadTermZeroSize extends CommonSpec { + @Override + protected Class getStructClass() { + return BytesPadTermZeroSize.class; + } + + @Override + protected String getSrcFilename() { + return "enum_negative.bin"; + } + +} diff --git a/spec/ks/bytes_pad_term_empty.kst b/spec/ks/bytes_pad_term_empty.kst new file mode 100644 index 000000000..10d133576 --- /dev/null +++ b/spec/ks/bytes_pad_term_empty.kst @@ -0,0 +1,11 @@ +id: bytes_pad_term_empty +data: str_pad_term_empty.bin +asserts: + - actual: str_pad + expected: '[].as' # "" + - actual: str_term + expected: '[].as' # "" + - actual: str_term_and_pad + expected: '[].as' # "" + - actual: str_term_include + expected: '[0x40]' # "@" diff --git a/spec/ks/bytes_pad_term_roundtrip.kst b/spec/ks/bytes_pad_term_roundtrip.kst new file mode 100644 index 000000000..198e3bd96 --- /dev/null +++ b/spec/ks/bytes_pad_term_roundtrip.kst @@ -0,0 +1,11 @@ +id: bytes_pad_term_roundtrip +data: str_pad_term.bin +asserts: + - actual: str_pad + expected: '[0x73, 0x74, 0x72, 0x31]' # str1 + - actual: str_term + expected: '[0x73, 0x74, 0x72, 0x32, 0x66, 0x6f, 0x6f]' # str2foo + - actual: str_term_and_pad + expected: '[0x73, 0x74, 0x72, 0x2b, 0x2b, 0x2b, 0x33, 0x62, 0x61, 0x72, 0x2b, 0x2b, 0x2b]' # str+++3bar+++ + - actual: str_term_include + expected: '[0x73, 0x74, 0x72, 0x34, 0x62, 0x61, 0x7a, 0x40]' # str4baz@ diff --git a/spec/ks/bytes_pad_term_zero_size.kst b/spec/ks/bytes_pad_term_zero_size.kst new file mode 100644 index 000000000..520401723 --- /dev/null +++ b/spec/ks/bytes_pad_term_zero_size.kst @@ -0,0 +1,11 @@ +id: bytes_pad_term_zero_size +data: enum_negative.bin +asserts: + - actual: str_pad + expected: '[].as' + - actual: str_term + expected: '[].as' + - actual: str_term_and_pad + expected: '[].as' + - actual: str_term_include + expected: '[].as' From 2be6f4b9650b44c4bb5488b0c67825aa05c0548b Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Sun, 11 Sep 2022 12:18:35 +0200 Subject: [PATCH 048/126] Add StrPadTerm{Roundtrip,ZeroSize} (BytesPadTerm* equivalents) --- formats/str_pad_term_roundtrip.ksy | 25 +++++++++++++ formats/str_pad_term_zero_size.ksy | 23 ++++++++++++ .../struct/spec/TestStrPadTermRoundtrip.java | 19 ++++++++++ .../struct/spec/TestStrPadTermZeroSize.java | 19 ++++++++++ .../specwrite/TestStrPadTermRoundtrip.java | 36 +++++++++++++++++++ .../specwrite/TestStrPadTermZeroSize.java | 20 +++++++++++ spec/ks/str_pad_term_roundtrip.kst | 11 ++++++ spec/ks/str_pad_term_zero_size.kst | 11 ++++++ 8 files changed, 164 insertions(+) create mode 100644 formats/str_pad_term_roundtrip.ksy create mode 100644 formats/str_pad_term_zero_size.ksy create mode 100644 spec/java/src/io/kaitai/struct/spec/TestStrPadTermRoundtrip.java create mode 100644 spec/java/src/io/kaitai/struct/spec/TestStrPadTermZeroSize.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestStrPadTermRoundtrip.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestStrPadTermZeroSize.java create mode 100644 spec/ks/str_pad_term_roundtrip.kst create mode 100644 spec/ks/str_pad_term_zero_size.kst diff --git a/formats/str_pad_term_roundtrip.ksy b/formats/str_pad_term_roundtrip.ksy new file mode 100644 index 000000000..1aa67a8ee --- /dev/null +++ b/formats/str_pad_term_roundtrip.ksy @@ -0,0 +1,25 @@ +# see "bytes_pad_term_roundtrip" +meta: + id: str_pad_term_roundtrip + encoding: UTF-8 +seq: + - id: str_pad + type: str + size: 20 + pad-right: 0x40 + - id: str_term + type: str + size: 20 + terminator: 0x40 + pad-right: 0x2b + - id: str_term_and_pad + type: str + size: 20 + terminator: 0x40 + pad-right: 0x2b + - id: str_term_include + type: str + size: 20 + terminator: 0x40 + include: true + pad-right: 0x2e diff --git a/formats/str_pad_term_zero_size.ksy b/formats/str_pad_term_zero_size.ksy new file mode 100644 index 000000000..895a6f548 --- /dev/null +++ b/formats/str_pad_term_zero_size.ksy @@ -0,0 +1,23 @@ +# see "bytes_pad_term_zero_size" +meta: + id: str_pad_term_zero_size + encoding: UTF-8 +seq: + - id: str_pad + type: str + size: 0 + pad-right: 0x40 + - id: str_term + type: str + size: 0 + terminator: 0x40 + - id: str_term_and_pad + type: str + size: 0 + terminator: 0x40 + pad-right: 0x2b + - id: str_term_include + type: str + size: 0 + terminator: 0x40 + include: true diff --git a/spec/java/src/io/kaitai/struct/spec/TestStrPadTermRoundtrip.java b/spec/java/src/io/kaitai/struct/spec/TestStrPadTermRoundtrip.java new file mode 100644 index 000000000..0acdcd90a --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestStrPadTermRoundtrip.java @@ -0,0 +1,19 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.StrPadTermRoundtrip; +import org.testng.annotations.Test; +import static org.testng.Assert.*; +public class TestStrPadTermRoundtrip extends CommonSpec { + + @Test + public void testStrPadTermRoundtrip() throws Exception { + StrPadTermRoundtrip r = StrPadTermRoundtrip.fromFile(SRC_DIR + "str_pad_term.bin"); + + assertEquals(r.strPad(), "str1"); + assertEquals(r.strTerm(), "str2foo"); + assertEquals(r.strTermAndPad(), "str+++3bar+++"); + assertEquals(r.strTermInclude(), "str4baz@"); + } +} diff --git a/spec/java/src/io/kaitai/struct/spec/TestStrPadTermZeroSize.java b/spec/java/src/io/kaitai/struct/spec/TestStrPadTermZeroSize.java new file mode 100644 index 000000000..596741910 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestStrPadTermZeroSize.java @@ -0,0 +1,19 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.StrPadTermZeroSize; +import org.testng.annotations.Test; +import static org.testng.Assert.*; +public class TestStrPadTermZeroSize extends CommonSpec { + + @Test + public void testStrPadTermZeroSize() throws Exception { + StrPadTermZeroSize r = StrPadTermZeroSize.fromFile(SRC_DIR + "enum_negative.bin"); + + assertEquals(r.strPad(), ""); + assertEquals(r.strTerm(), ""); + assertEquals(r.strTermAndPad(), ""); + assertEquals(r.strTermInclude(), ""); + } +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestStrPadTermRoundtrip.java b/spec/java/src/io/kaitai/struct/specwrite/TestStrPadTermRoundtrip.java new file mode 100644 index 000000000..df2ec4d70 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestStrPadTermRoundtrip.java @@ -0,0 +1,36 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.StrPadTermRoundtrip; +import org.testng.annotations.Test; + +public class TestStrPadTermRoundtrip extends CommonSpec { + @Test + public void testStrPadTermRoundtrip() throws Exception { + // NOTE: here it makes sense to prefer a manual test over the automatic + // testReadWriteRoundtrip, because the roundtrip can't always recognize whether the + // `pad-right` is correct (i.e. whether the serialized field is padded correctly) + + StrPadTermRoundtrip r = new StrPadTermRoundtrip(); + + r.setStrPad("str1"); + r.setStrTerm("str2foo"); + r.setStrTermAndPad("str+++3bar+++"); + r.setStrTermInclude("str4baz@"); + + assertEqualToFile(r, "str_pad_term.bin"); + } + + @Override + protected Class getStructClass() { + return StrPadTermRoundtrip.class; + } + + @Override + protected String getSrcFilename() { + return "str_pad_term.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestStrPadTermZeroSize.java b/spec/java/src/io/kaitai/struct/specwrite/TestStrPadTermZeroSize.java new file mode 100644 index 000000000..859e880eb --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestStrPadTermZeroSize.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.StrPadTermZeroSize; +import org.testng.annotations.Test; + +public class TestStrPadTermZeroSize extends CommonSpec { + @Override + protected Class getStructClass() { + return StrPadTermZeroSize.class; + } + + @Override + protected String getSrcFilename() { + return "enum_negative.bin"; + } + +} diff --git a/spec/ks/str_pad_term_roundtrip.kst b/spec/ks/str_pad_term_roundtrip.kst new file mode 100644 index 000000000..1279c84fa --- /dev/null +++ b/spec/ks/str_pad_term_roundtrip.kst @@ -0,0 +1,11 @@ +id: str_pad_term_roundtrip +data: str_pad_term.bin +asserts: + - actual: str_pad + expected: '"str1"' + - actual: str_term + expected: '"str2foo"' + - actual: str_term_and_pad + expected: '"str+++3bar+++"' + - actual: str_term_include + expected: '"str4baz@"' diff --git a/spec/ks/str_pad_term_zero_size.kst b/spec/ks/str_pad_term_zero_size.kst new file mode 100644 index 000000000..10fa054e6 --- /dev/null +++ b/spec/ks/str_pad_term_zero_size.kst @@ -0,0 +1,11 @@ +id: str_pad_term_zero_size +data: enum_negative.bin +asserts: + - actual: str_pad + expected: '""' + - actual: str_term + expected: '""' + - actual: str_term_and_pad + expected: '""' + - actual: str_term_include + expected: '""' From fda09a9496aa00341f4b12b843a88b57b087824f Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Sun, 11 Sep 2022 20:03:22 +0200 Subject: [PATCH 049/126] Add Term{Bytes,Struct,Strz}4 for `eos-error: false` --- formats/term_bytes4.ksy | 35 +++++++++++++++ formats/term_struct4.ksy | 43 +++++++++++++++++++ formats/term_strz4.ksy | 41 ++++++++++++++++++ .../io/kaitai/struct/spec/TestTermBytes4.java | 18 ++++++++ .../kaitai/struct/spec/TestTermStruct4.java | 18 ++++++++ .../io/kaitai/struct/spec/TestTermStrz4.java | 18 ++++++++ .../struct/specwrite/TestTermBytes4.java | 20 +++++++++ .../struct/specwrite/TestTermStruct4.java | 20 +++++++++ .../struct/specwrite/TestTermStrz4.java | 20 +++++++++ spec/ks/term_bytes4.kst | 9 ++++ spec/ks/term_struct4.kst | 9 ++++ spec/ks/term_strz4.kst | 9 ++++ 12 files changed, 260 insertions(+) create mode 100644 formats/term_bytes4.ksy create mode 100644 formats/term_struct4.ksy create mode 100644 formats/term_strz4.ksy create mode 100644 spec/java/src/io/kaitai/struct/spec/TestTermBytes4.java create mode 100644 spec/java/src/io/kaitai/struct/spec/TestTermStruct4.java create mode 100644 spec/java/src/io/kaitai/struct/spec/TestTermStrz4.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestTermBytes4.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestTermStruct4.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestTermStrz4.java create mode 100644 spec/ks/term_bytes4.kst create mode 100644 spec/ks/term_struct4.kst create mode 100644 spec/ks/term_strz4.kst diff --git a/formats/term_bytes4.ksy b/formats/term_bytes4.ksy new file mode 100644 index 000000000..435119186 --- /dev/null +++ b/formats/term_bytes4.ksy @@ -0,0 +1,35 @@ +# Like "term_bytes", but tests `eos-error: false` +meta: + id: term_bytes4 +seq: + - id: s1 + size: 3 + type: s1_type + - id: skip_term1 + type: u1 + - id: s2 + size: 3 + type: s2_type + - id: skip_term2 + type: u1 + - id: s3 + size: 3 + type: s3_type +types: + s1_type: + seq: + - id: value + terminator: 0x7c + eos-error: false + s2_type: + seq: + - id: value + terminator: 0x7c + consume: false + eos-error: false + s3_type: + seq: + - id: value + terminator: 0x40 + include: true + eos-error: false diff --git a/formats/term_struct4.ksy b/formats/term_struct4.ksy new file mode 100644 index 000000000..81800c596 --- /dev/null +++ b/formats/term_struct4.ksy @@ -0,0 +1,43 @@ +# Like "term_bytes4", but the byte array is wrapped in a user-defined type +meta: + id: term_struct4 +seq: + - id: s1 + size: 3 + type: s1_type + - id: skip_term1 + type: u1 + - id: s2 + size: 3 + type: s2_type + - id: skip_term2 + type: u1 + - id: s3 + size: 3 + type: s3_type +types: + s1_type: + seq: + - id: value + terminator: 0x7c + eos-error: false + type: bytes_wrapper + s2_type: + seq: + - id: value + terminator: 0x7c + consume: false + eos-error: false + type: bytes_wrapper + s3_type: + seq: + - id: value + terminator: 0x40 + include: true + eos-error: false + type: bytes_wrapper + + bytes_wrapper: + seq: + - id: value + size-eos: true diff --git a/formats/term_strz4.ksy b/formats/term_strz4.ksy new file mode 100644 index 000000000..a9897dad4 --- /dev/null +++ b/formats/term_strz4.ksy @@ -0,0 +1,41 @@ +# Like "term_strz", but tests `eos-error: false` +meta: + id: term_strz4 +seq: + - id: s1 + size: 3 + type: s1_type + - id: skip_term1 + type: u1 + - id: s2 + size: 3 + type: s2_type + - id: skip_term2 + type: u1 + - id: s3 + size: 3 + type: s3_type +types: + s1_type: + seq: + - id: value + type: str + encoding: UTF-8 + terminator: 0x7c + eos-error: false + s2_type: + seq: + - id: value + type: str + encoding: UTF-8 + terminator: 0x7c + consume: false + eos-error: false + s3_type: + seq: + - id: value + type: str + encoding: UTF-8 + terminator: 0x40 + include: true + eos-error: false diff --git a/spec/java/src/io/kaitai/struct/spec/TestTermBytes4.java b/spec/java/src/io/kaitai/struct/spec/TestTermBytes4.java new file mode 100644 index 000000000..2e5c6665d --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestTermBytes4.java @@ -0,0 +1,18 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.TermBytes4; +import org.testng.annotations.Test; +import static org.testng.Assert.*; +public class TestTermBytes4 extends CommonSpec { + + @Test + public void testTermBytes4() throws Exception { + TermBytes4 r = TermBytes4.fromFile(SRC_DIR + "term_strz.bin"); + + assertEquals(r.s1().value(), new byte[] { 102, 111, 111 }); + assertEquals(r.s2().value(), new byte[] { 98, 97, 114 }); + assertEquals(r.s3().value(), new byte[] { 98, 97, 122 }); + } +} diff --git a/spec/java/src/io/kaitai/struct/spec/TestTermStruct4.java b/spec/java/src/io/kaitai/struct/spec/TestTermStruct4.java new file mode 100644 index 000000000..53bf51cdf --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestTermStruct4.java @@ -0,0 +1,18 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.TermStruct4; +import org.testng.annotations.Test; +import static org.testng.Assert.*; +public class TestTermStruct4 extends CommonSpec { + + @Test + public void testTermStruct4() throws Exception { + TermStruct4 r = TermStruct4.fromFile(SRC_DIR + "term_strz.bin"); + + assertEquals(r.s1().value().value(), new byte[] { 102, 111, 111 }); + assertEquals(r.s2().value().value(), new byte[] { 98, 97, 114 }); + assertEquals(r.s3().value().value(), new byte[] { 98, 97, 122 }); + } +} diff --git a/spec/java/src/io/kaitai/struct/spec/TestTermStrz4.java b/spec/java/src/io/kaitai/struct/spec/TestTermStrz4.java new file mode 100644 index 000000000..74b16f639 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestTermStrz4.java @@ -0,0 +1,18 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.TermStrz4; +import org.testng.annotations.Test; +import static org.testng.Assert.*; +public class TestTermStrz4 extends CommonSpec { + + @Test + public void testTermStrz4() throws Exception { + TermStrz4 r = TermStrz4.fromFile(SRC_DIR + "term_strz.bin"); + + assertEquals(r.s1().value(), "foo"); + assertEquals(r.s2().value(), "bar"); + assertEquals(r.s3().value(), "baz"); + } +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestTermBytes4.java b/spec/java/src/io/kaitai/struct/specwrite/TestTermBytes4.java new file mode 100644 index 000000000..37e9b3c79 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestTermBytes4.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.TermBytes4; +import org.testng.annotations.Test; + +public class TestTermBytes4 extends CommonSpec { + @Override + protected Class getStructClass() { + return TermBytes4.class; + } + + @Override + protected String getSrcFilename() { + return "term_strz.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestTermStruct4.java b/spec/java/src/io/kaitai/struct/specwrite/TestTermStruct4.java new file mode 100644 index 000000000..cf9cbc699 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestTermStruct4.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.TermStruct4; +import org.testng.annotations.Test; + +public class TestTermStruct4 extends CommonSpec { + @Override + protected Class getStructClass() { + return TermStruct4.class; + } + + @Override + protected String getSrcFilename() { + return "term_strz.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestTermStrz4.java b/spec/java/src/io/kaitai/struct/specwrite/TestTermStrz4.java new file mode 100644 index 000000000..01725e278 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestTermStrz4.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.TermStrz4; +import org.testng.annotations.Test; + +public class TestTermStrz4 extends CommonSpec { + @Override + protected Class getStructClass() { + return TermStrz4.class; + } + + @Override + protected String getSrcFilename() { + return "term_strz.bin"; + } + +} diff --git a/spec/ks/term_bytes4.kst b/spec/ks/term_bytes4.kst new file mode 100644 index 000000000..7ac91bad0 --- /dev/null +++ b/spec/ks/term_bytes4.kst @@ -0,0 +1,9 @@ +id: term_bytes4 +data: term_strz.bin +asserts: + - actual: s1.value + expected: '[0x66, 0x6f, 0x6f]' + - actual: s2.value + expected: '[0x62, 0x61, 0x72]' + - actual: s3.value + expected: '[0x62, 0x61, 0x7a]' diff --git a/spec/ks/term_struct4.kst b/spec/ks/term_struct4.kst new file mode 100644 index 000000000..b1427615e --- /dev/null +++ b/spec/ks/term_struct4.kst @@ -0,0 +1,9 @@ +id: term_struct4 +data: term_strz.bin +asserts: + - actual: s1.value.value + expected: '[0x66, 0x6f, 0x6f]' + - actual: s2.value.value + expected: '[0x62, 0x61, 0x72]' + - actual: s3.value.value + expected: '[0x62, 0x61, 0x7a]' diff --git a/spec/ks/term_strz4.kst b/spec/ks/term_strz4.kst new file mode 100644 index 000000000..c33cc6b6a --- /dev/null +++ b/spec/ks/term_strz4.kst @@ -0,0 +1,9 @@ +id: term_strz4 +data: term_strz.bin +asserts: + - actual: s1.value + expected: '"foo"' + - actual: s2.value + expected: '"bar"' + - actual: s3.value + expected: '"baz"' From 5ab822dee0ea4df42803cc44a4aec7eeff545315 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Mon, 12 Sep 2022 20:58:44 +0200 Subject: [PATCH 050/126] Add test cases to RepeatUntilS4 for `repeat-until` checks See https://github.com/kaitai-io/kaitai_struct_compiler/commit/def665036159fbb23e8f7ebac04c0ba06a3039c3 --- .../struct/specwrite/TestRepeatUntilS4.java | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilS4.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilS4.java index 973521976..dc3066728 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilS4.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilS4.java @@ -2,8 +2,13 @@ package io.kaitai.struct.specwrite; +import io.kaitai.struct.ConsistencyError; import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.RepeatUntilS4; + +import java.util.ArrayList; +import java.util.Arrays; + import org.testng.annotations.Test; public class TestRepeatUntilS4 extends CommonSpec { @@ -17,4 +22,40 @@ protected String getSrcFilename() { return "repeat_until_s4.bin"; } + @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: entries,.*") + public void checkBadNoEntries() { + RepeatUntilS4 r = new RepeatUntilS4(); + r.setEntries(new ArrayList<>(0)); + r._check(); + } + + @Test + public void checkGoodOneEntry() { + RepeatUntilS4 r = new RepeatUntilS4(); + r.setEntries(new ArrayList<>(Arrays.asList(-1))); + r.setAfterall(""); + r._check(); + } + + @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: entries,.*") + public void checkBadEarlyUntilEntry() { + RepeatUntilS4 r = new RepeatUntilS4(); + r.setEntries(new ArrayList<>(Arrays.asList(-3, 275000, -1, 0, -1))); + r._check(); + } + + @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: entries,.*") + public void checkBadNoUntilEntry() { + RepeatUntilS4 r = new RepeatUntilS4(); + r.setEntries(new ArrayList<>(Arrays.asList(-3, 275000, -2, 0))); + r._check(); + } + + @Test + public void checkGoodUntilEntry() { + RepeatUntilS4 r = new RepeatUntilS4(); + r.setEntries(new ArrayList<>(Arrays.asList(-3, 275000, -2, 0, -1))); + r.setAfterall(""); + r._check(); + } } From f6a61f64bc3ce960fb265772d0fae67060e07604 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Fri, 16 Sep 2022 00:00:29 +0200 Subject: [PATCH 051/126] Add/adjust ExprIfInt{Eq,Ops} + FloatToI for Java casting issues See https://github.com/kaitai-io/kaitai_struct_compiler/commit/604359d63b7d98511828913e206a85f105d3993a --- formats/expr_if_int_eq.ksy | 46 +++++++++++++++++++ formats/expr_if_int_ops.ksy | 28 ++++++----- formats/float_to_i.ksy | 14 ++++++ .../kaitai/struct/spec/TestExprIfIntEq.java | 25 ++++++++++ .../kaitai/struct/spec/TestExprIfIntOps.java | 8 ++-- .../io/kaitai/struct/spec/TestFloatToI.java | 29 +++++++----- .../struct/specwrite/TestExprIfIntEq.java | 20 ++++++++ .../struct/specwrite/TestExprIfIntOps.java | 2 +- spec/ks/expr_if_int_eq.kst | 26 +++++++++++ spec/ks/expr_if_int_ops.kst | 15 ++++-- spec/ks/float_to_i.kst | 10 ++++ 11 files changed, 191 insertions(+), 32 deletions(-) create mode 100644 formats/expr_if_int_eq.ksy create mode 100644 spec/java/src/io/kaitai/struct/spec/TestExprIfIntEq.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestExprIfIntEq.java create mode 100644 spec/ks/expr_if_int_eq.kst diff --git a/formats/expr_if_int_eq.ksy b/formats/expr_if_int_eq.ksy new file mode 100644 index 000000000..da61a22a5 --- /dev/null +++ b/formats/expr_if_int_eq.ksy @@ -0,0 +1,46 @@ +# Demonstrates problems in Java where you cannot naively compare boxed integer +# types (e.g. `Short`, `Integer`) using `==` (at best you get a reference +# equality where `Integer.valueOf(-1) != Integer.valueOf(-1)`, at worst the +# generated Java code will have a compile-time error like "Incompatible operand +# types Integer and Short") +meta: + id: expr_if_int_eq + endian: le +seq: + - id: skip + size: 2 + - id: seq + type: s2 + - id: seq_if + type: s2 + if: true +instances: + calc: + value: 0x4141 + calc_if: + value: 0x4141 + if: true + + seq_eq_lit: + value: seq == 0x4141 + seq_eq_calc: + value: seq == calc + seq_eq_calc_if: + value: seq == calc_if + seq_eq_seq_if: + value: seq == seq_if + + calc_eq_lit: + value: calc == 0x4141 + calc_eq_calc_if: + value: calc == calc_if + calc_eq_seq_if: + value: calc == seq_if + + calc_if_eq_lit: + value: calc_if == 0x4141 + calc_if_eq_seq_if: + value: calc_if == seq_if + + seq_if_eq_lit: + value: seq_if == 0x4141 diff --git a/formats/expr_if_int_ops.ksy b/formats/expr_if_int_ops.ksy index 8fbc48c42..b44170dae 100644 --- a/formats/expr_if_int_ops.ksy +++ b/formats/expr_if_int_ops.ksy @@ -1,17 +1,23 @@ +# Crafted with Java in mind, where you need to take extra care with type +# conversions to make the unboxing + downcasting required here work meta: id: expr_if_int_ops endian: le seq: - - id: skip - size: 2 - - id: it - type: s2 - if: true - - id: boxed - type: s2 + - id: key + type: u8 if: true + - id: skip + size: 8 + - id: bytes + size: 8 + process: xor(key) + - id: items + type: s1 + repeat: expr + repeat-expr: 4 instances: - is_eq_prim: - value: it == 0x4141 - is_eq_boxed: - value: it == boxed + bytes_sub_key: + value: bytes[key] + items_sub_key: + value: items[key] diff --git a/formats/float_to_i.ksy b/formats/float_to_i.ksy index 6370838af..d5734709b 100644 --- a/formats/float_to_i.ksy +++ b/formats/float_to_i.ksy @@ -6,6 +6,12 @@ seq: type: f4 - id: double_value type: f8 + - id: single_value_if + type: f4be + if: true + - id: double_value_if + type: f8be + if: true instances: calc_float1: value: 1.234 @@ -15,10 +21,16 @@ instances: value: 1.9 calc_float4: value: -2.7 + calc_if: + value: 13.9 single_i: value: single_value.to_i double_i: value: double_value.to_i + single_if_i: + value: single_value_if.to_i + double_if_i: + value: double_value_if.to_i float1_i: value: calc_float1.to_i float2_i: @@ -27,3 +39,5 @@ instances: value: calc_float3.to_i float4_i: value: calc_float4.to_i + calc_if_i: + value: calc_if.to_i diff --git a/spec/java/src/io/kaitai/struct/spec/TestExprIfIntEq.java b/spec/java/src/io/kaitai/struct/spec/TestExprIfIntEq.java new file mode 100644 index 000000000..123f8d018 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestExprIfIntEq.java @@ -0,0 +1,25 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.ExprIfIntEq; +import org.testng.annotations.Test; +import static org.testng.Assert.*; +public class TestExprIfIntEq extends CommonSpec { + + @Test + public void testExprIfIntEq() throws Exception { + ExprIfIntEq r = ExprIfIntEq.fromFile(SRC_DIR + "process_coerce_switch.bin"); + + assertIntEquals(r.seqEqLit(), true); + assertIntEquals(r.seqEqCalc(), true); + assertIntEquals(r.seqEqCalcIf(), true); + assertIntEquals(r.seqEqSeqIf(), true); + assertIntEquals(r.calcEqLit(), true); + assertIntEquals(r.calcEqCalcIf(), true); + assertIntEquals(r.calcEqSeqIf(), true); + assertIntEquals(r.calcIfEqLit(), true); + assertIntEquals(r.calcIfEqSeqIf(), true); + assertIntEquals(r.seqIfEqLit(), true); + } +} diff --git a/spec/java/src/io/kaitai/struct/spec/TestExprIfIntOps.java b/spec/java/src/io/kaitai/struct/spec/TestExprIfIntOps.java index 2cc5e2767..730266e7a 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestExprIfIntOps.java +++ b/spec/java/src/io/kaitai/struct/spec/TestExprIfIntOps.java @@ -9,9 +9,11 @@ public class TestExprIfIntOps extends CommonSpec { @Test public void testExprIfIntOps() throws Exception { - ExprIfIntOps r = ExprIfIntOps.fromFile(SRC_DIR + "process_coerce_switch.bin"); + ExprIfIntOps r = ExprIfIntOps.fromFile(SRC_DIR + "instance_io.bin"); - assertIntEquals(r.isEqPrim(), true); - assertIntEquals(r.isEqBoxed(), true); + assertIntEquals(r.key(), 3); + assertEquals(r.bytes(), new byte[] { -4, -4, -4, -3, 9, 3, 3, 3 }); + assertIntEquals(r.bytesSubKey(), 253); + assertIntEquals(r.itemsSubKey(), -3); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestFloatToI.java b/spec/java/src/io/kaitai/struct/spec/TestFloatToI.java index ea9bf25f6..4749e9a9b 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestFloatToI.java +++ b/spec/java/src/io/kaitai/struct/spec/TestFloatToI.java @@ -1,23 +1,28 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + package io.kaitai.struct.spec; import io.kaitai.struct.testformats.FloatToI; import org.testng.annotations.Test; - -import static org.testng.Assert.assertEquals; - +import static org.testng.Assert.*; public class TestFloatToI extends CommonSpec { + @Test public void testFloatToI() throws Exception { FloatToI r = FloatToI.fromFile(SRC_DIR + "floating_points.bin"); - assertEquals(r.singleValue(), 0.5f); - assertEquals(r.doubleValue(), 0.25); - - assertEquals(r.singleI().intValue(), 0); - assertEquals(r.doubleI().intValue(), 0); - assertEquals(r.float1I().intValue(), 1); - assertEquals(r.float2I().intValue(), 1); - assertEquals(r.float3I().intValue(), 1); - assertEquals(r.float4I().intValue(), -2); + assertEquals(r.singleValue(), 0.5, 1e-6); + assertEquals(r.doubleValue(), 0.25, 1e-6); + assertEquals(r.singleValueIf(), 0.5, 1e-6); + assertEquals(r.doubleValueIf(), 0.25, 1e-6); + assertIntEquals(r.singleI(), 0); + assertIntEquals(r.doubleI(), 0); + assertIntEquals(r.singleIfI(), 0); + assertIntEquals(r.doubleIfI(), 0); + assertIntEquals(r.float1I(), 1); + assertIntEquals(r.float2I(), 1); + assertIntEquals(r.float3I(), 1); + assertIntEquals(r.float4I(), -2); + assertIntEquals(r.calcIfI(), 13); } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestExprIfIntEq.java b/spec/java/src/io/kaitai/struct/specwrite/TestExprIfIntEq.java new file mode 100644 index 000000000..dc2424443 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestExprIfIntEq.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ExprIfIntEq; +import org.testng.annotations.Test; + +public class TestExprIfIntEq extends CommonSpec { + @Override + protected Class getStructClass() { + return ExprIfIntEq.class; + } + + @Override + protected String getSrcFilename() { + return "process_coerce_switch.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestExprIfIntOps.java b/spec/java/src/io/kaitai/struct/specwrite/TestExprIfIntOps.java index 4fc37975d..661e2d3e5 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestExprIfIntOps.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestExprIfIntOps.java @@ -14,7 +14,7 @@ protected Class getStructClass() { @Override protected String getSrcFilename() { - return "process_coerce_switch.bin"; + return "instance_io.bin"; } } diff --git a/spec/ks/expr_if_int_eq.kst b/spec/ks/expr_if_int_eq.kst new file mode 100644 index 000000000..bb2c7e264 --- /dev/null +++ b/spec/ks/expr_if_int_eq.kst @@ -0,0 +1,26 @@ +id: expr_if_int_eq +data: process_coerce_switch.bin +asserts: + - actual: seq_eq_lit + expected: true + - actual: seq_eq_calc + expected: true + - actual: seq_eq_calc_if + expected: true + - actual: seq_eq_seq_if + expected: true + + - actual: calc_eq_lit + expected: true + - actual: calc_eq_calc_if + expected: true + - actual: calc_eq_seq_if + expected: true + + - actual: calc_if_eq_lit + expected: true + - actual: calc_if_eq_seq_if + expected: true + + - actual: seq_if_eq_lit + expected: true diff --git a/spec/ks/expr_if_int_ops.kst b/spec/ks/expr_if_int_ops.kst index 176e3ec54..720db0865 100644 --- a/spec/ks/expr_if_int_ops.kst +++ b/spec/ks/expr_if_int_ops.kst @@ -1,7 +1,12 @@ id: expr_if_int_ops -data: process_coerce_switch.bin +data: instance_io.bin asserts: - - actual: is_eq_prim - expected: true - - actual: is_eq_boxed - expected: true + - actual: key + expected: 3 + - actual: bytes + expected: '[0xfc, 0xfc, 0xfc, 0xfd, 0x09, 0x03, 0x03, 0x03]' + + - actual: bytes_sub_key + expected: 0xfd + - actual: items_sub_key + expected: -3 diff --git a/spec/ks/float_to_i.kst b/spec/ks/float_to_i.kst index e72220a0a..3c95c15ff 100644 --- a/spec/ks/float_to_i.kst +++ b/spec/ks/float_to_i.kst @@ -5,11 +5,19 @@ asserts: expected: 0.5 - actual: double_value expected: 0.25 + - actual: single_value_if + expected: 0.5 + - actual: double_value_if + expected: 0.25 - actual: single_i expected: 0 - actual: double_i expected: 0 + - actual: single_if_i + expected: 0 + - actual: double_if_i + expected: 0 - actual: float1_i expected: 1 - actual: float2_i @@ -18,3 +26,5 @@ asserts: expected: 1 - actual: float4_i expected: -2 + - actual: calc_if_i + expected: 13 From 895a0252d627fe90a6c3003da4579fbb2b506c78 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Fri, 16 Sep 2022 16:10:10 +0200 Subject: [PATCH 052/126] dumpStructValue: exclude _invalidate* and _raw_* from struct dumps --- spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java b/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java index 3eb96a156..297dfeb35 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java +++ b/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java @@ -140,10 +140,9 @@ protected static Object dumpStructValue( if ( methodName.startsWith("_read") || methodName.startsWith("_check") || - methodName.startsWith("_write") - // we should maybe ignore `_raw_*()` getters too, because they reflect - // leftover substream bytes that are not written (this is why the - // BufferedStruct test fails) + methodName.startsWith("_write") || + methodName.startsWith("_invalidate") || + methodName.startsWith("_raw_") ) { continue; } From fdba97c9f0db73c8f96b5e02cdcee916b8cc5e74 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Fri, 16 Sep 2022 16:30:03 +0200 Subject: [PATCH 053/126] Add Expr2 subtest for _invalidate*() method of value instances See https://github.com/kaitai-io/kaitai_struct_compiler/commit/f8bb57713d746c9eff4c8bc4a4dd69559539bb60 --- .../kaitai/struct/specwrite/CommonSpec.java | 4 +- .../io/kaitai/struct/specwrite/TestExpr2.java | 47 +++++++++++++++++++ 2 files changed, 48 insertions(+), 3 deletions(-) diff --git a/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java b/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java index 297dfeb35..24529c639 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java +++ b/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java @@ -19,9 +19,7 @@ import io.kaitai.struct.KaitaiStream; import io.kaitai.struct.KaitaiStruct; -public abstract class CommonSpec { - private final static String SRC_DIR = io.kaitai.struct.spec.CommonSpec.SRC_DIR; - +public abstract class CommonSpec extends io.kaitai.struct.spec.CommonSpec { protected abstract Class getStructClass(); protected abstract String getSrcFilename(); diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestExpr2.java b/spec/java/src/io/kaitai/struct/specwrite/TestExpr2.java index 3887624a2..a8a5df42c 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestExpr2.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestExpr2.java @@ -2,9 +2,12 @@ package io.kaitai.struct.specwrite; +import io.kaitai.struct.ByteBufferKaitaiStream; import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.Expr2; import org.testng.annotations.Test; +import java.nio.charset.StandardCharsets; +import static org.testng.Assert.*; public class TestExpr2 extends CommonSpec { @Override @@ -17,4 +20,48 @@ protected String getSrcFilename() { return "str_encodings.bin"; } + @Test + public void testEdit() throws Exception { + Expr2 r = Expr2.fromFile(SRC_DIR + getSrcFilename()); + r._read(); + + int oldLenMod = r.str2().lenMod(); + int oldStr2RestAvg = r.str2().rest().avg(); + + r.str2().setStr("Kaitai Struct カ"); + r.str2()._invalidateLenMod(); + + int str2Size = r.str2().str().getBytes(StandardCharsets.UTF_8).length; + r.str2().setLenOrig(str2Size + 3); + assertNotEquals(r.str2().lenMod(), oldLenMod); + assertIntEquals(r.str2().lenMod(), str2Size); + + r.str2().rest().setByte0(0xfa); + r.str2().rest()._invalidateAvg(); + r.str2().rest().setByte1(0x44); + r.str2().rest().setByte2(0x88); + assertNotEquals(r.str2().rest().avg(), oldStr2RestAvg); + + // see .testReadWriteRoundtrip + Object origDump = dumpStruct(r); + + ByteBufferKaitaiStream newIo = new ByteBufferKaitaiStream( + 2 + // str1.len_orig + r.str1().lenMod() + // str1.str + 3 + // str1.rest + 2 + // str2.len_orig + r.str2().lenMod() + // str2.str + 3 // str2.rest + ); + r._write(newIo); + newIo.alignToByte(); + newIo.seek(0); + + Expr2 newR = new Expr2(newIo); + newR._read(); + + Object newDump = dumpStruct(newR); + + assertEquals(newDump, origDump); + } } From 14424f3eb9ebc4c2e9e5571300978cc3025fe081 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Sat, 17 Sep 2022 19:34:54 +0200 Subject: [PATCH 054/126] dumpStructValue: call all _check*() (both `seq` and `instances`) See https://github.com/kaitai-io/kaitai_struct_compiler/commit/16374cc4508d662ba222095db3f75d03eb266164 --- spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java b/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java index 24529c639..d525757b1 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java +++ b/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java @@ -118,7 +118,6 @@ protected static Object dumpStructValue( if (value instanceof KaitaiStruct.ReadWrite) { KaitaiStruct.ReadWrite struct = (KaitaiStruct.ReadWrite) value; - struct._check(); Map dump = new HashMap<>(); { @@ -135,6 +134,11 @@ protected static Object dumpStructValue( final String methodName = m.getName(); if (methodName.startsWith("_")) { + // call all _check*() methods + if (methodName.startsWith("_check")) { + m.invoke(struct); + continue; + } if ( methodName.startsWith("_read") || methodName.startsWith("_check") || From 0596437854c322b3bcfccc215e925a9966602ffa Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Sat, 17 Sep 2022 19:36:47 +0200 Subject: [PATCH 055/126] Add InstanceStd subtests for _check{Inst}() and _write{Inst}() See https://github.com/kaitai-io/kaitai_struct_compiler/commit/16374cc4508d662ba222095db3f75d03eb266164 --- .../struct/specwrite/TestInstanceStd.java | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestInstanceStd.java b/spec/java/src/io/kaitai/struct/specwrite/TestInstanceStd.java index aedf2ade1..a6aad39a1 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestInstanceStd.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestInstanceStd.java @@ -2,9 +2,14 @@ package io.kaitai.struct.specwrite; +import io.kaitai.struct.ByteBufferKaitaiStream; +import io.kaitai.struct.ConsistencyError; +import io.kaitai.struct.KaitaiStream; import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.InstanceStd; import org.testng.annotations.Test; +import static org.testng.Assert.*; +import java.lang.reflect.InvocationTargetException; public class TestInstanceStd extends CommonSpec { @Override @@ -17,4 +22,56 @@ protected String getSrcFilename() { return "str_encodings.bin"; } + @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: header,.*") + public void checkShorterHeader() throws Exception { + InstanceStd r = new InstanceStd(); + r._check(); + r.setHeader("1234"); + r._checkHeader(); + } + + @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: header,.*") + public void checkLongerHeader() throws Exception { + InstanceStd r = new InstanceStd(); + r._check(); + r.setHeader("123456"); + r._checkHeader(); + } + + @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: header,.*") + public void checkEmptyHeaderViaDump() throws Exception { + InstanceStd r = new InstanceStd(); + r.setHeader(""); + try { + // calls all _check*() methods + dumpStruct(r); + } catch (InvocationTargetException e) { + if (e.getCause() instanceof Exception) { + throw ((Exception) e.getCause()); + } + throw e; + } + } + + @Test + public void testWrite() throws Exception { + InstanceStd r = new InstanceStd(); + r.setHeader("Hello"); + + // see .testReadWriteRoundtrip + Object origDump = dumpStruct(r); + + KaitaiStream io = new ByteBufferKaitaiStream(2 + 5); + r._write(io); + io.alignToByte(); + io.seek(0); + r._writeHeader(); + + InstanceStd newR = new InstanceStd(io); + newR._read(); + + Object newDump = dumpStruct(newR); + + assertEquals(newDump, origDump); + } } From fe66a130acb11f7a776b5a61783a613c7bda984e Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Thu, 17 Nov 2022 21:40:54 +0100 Subject: [PATCH 056/126] Add InstanceInRepeat{Expr,Until} Demonstrate that the special loops for each `repeat` kind cannot be optimized to a common loop iterating the collection (see https://github.com/kaitai-io/kaitai_struct_compiler/pull/182), because that would skip invocations of instances and thus break parity with parsing. --- formats/instance_in_repeat_expr.ksy | 30 ++++++++++++++++++ formats/instance_in_repeat_until.ksy | 13 ++++++++ .../struct/spec/TestInstanceInRepeatExpr.java | 20 ++++++++++++ .../spec/TestInstanceInRepeatUntil.java | 21 ++++++++++++ .../specwrite/TestInstanceInRepeatExpr.java | 20 ++++++++++++ .../specwrite/TestInstanceInRepeatUntil.java | 20 ++++++++++++ spec/ks/instance_in_repeat_expr.kst | 13 ++++++++ spec/ks/instance_in_repeat_until.kst | 15 +++++++++ src/instance_in_repeat_expr.bin | Bin 0 -> 20 bytes 9 files changed, 152 insertions(+) create mode 100644 formats/instance_in_repeat_expr.ksy create mode 100644 formats/instance_in_repeat_until.ksy create mode 100644 spec/java/src/io/kaitai/struct/spec/TestInstanceInRepeatExpr.java create mode 100644 spec/java/src/io/kaitai/struct/spec/TestInstanceInRepeatUntil.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestInstanceInRepeatExpr.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestInstanceInRepeatUntil.java create mode 100644 spec/ks/instance_in_repeat_expr.kst create mode 100644 spec/ks/instance_in_repeat_until.kst create mode 100644 src/instance_in_repeat_expr.bin diff --git a/formats/instance_in_repeat_expr.ksy b/formats/instance_in_repeat_expr.ksy new file mode 100644 index 000000000..701f1af29 --- /dev/null +++ b/formats/instance_in_repeat_expr.ksy @@ -0,0 +1,30 @@ +# Demonstrates that if an instance is used in `repeat-expr`, it's necessary that +# the expression is actually evaluated because the "num_chunks" instance must be +# invoked, even when writing (where you already know the array length). +# +# If the `repeat-expr` isn't evaluated and we would for example use a for-each +# loop over "chunks" when writing instead, the "num_chunks" instance would not +# be invoked at the right moment and wouldn't be written. But writing the +# "num_chunks" _after_ the seq has been written is incorrect, because the `pos` +# expression of "num_chunks" will evaluate differently (`_io.pos` will be `16`, +# since that's where the `seq` left off, not `0` as it should be) and +# "num_chunks" will be written to a totally different position. +meta: + id: instance_in_repeat_expr + endian: le +seq: + - id: chunks + type: chunk + repeat: expr + repeat-expr: num_chunks +instances: + num_chunks: + pos: _io.pos + 16 # _io.pos is 0 when first invoked, so this should be at byte 16 + type: u4 +types: + chunk: + seq: + - id: offset + type: u4 + - id: len + type: u4 diff --git a/formats/instance_in_repeat_until.ksy b/formats/instance_in_repeat_until.ksy new file mode 100644 index 000000000..ee3fbb385 --- /dev/null +++ b/formats/instance_in_repeat_until.ksy @@ -0,0 +1,13 @@ +# Similar to "instance_in_repeat_expr", but the instance is used in `repeat-until` +meta: + id: instance_in_repeat_until + endian: le +seq: + - id: entries + type: s2 + repeat: until + repeat-until: _ == until_val # NB: this is first evaluated after reading `entries[0]` +instances: + until_val: + pos: _io.pos + 12 # _io.pos is 2 when first invoked, so this should be at byte 14 + type: s2 diff --git a/spec/java/src/io/kaitai/struct/spec/TestInstanceInRepeatExpr.java b/spec/java/src/io/kaitai/struct/spec/TestInstanceInRepeatExpr.java new file mode 100644 index 000000000..e92eca8e8 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestInstanceInRepeatExpr.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.InstanceInRepeatExpr; +import org.testng.annotations.Test; +import static org.testng.Assert.*; +public class TestInstanceInRepeatExpr extends CommonSpec { + + @Test + public void testInstanceInRepeatExpr() throws Exception { + InstanceInRepeatExpr r = InstanceInRepeatExpr.fromFile(SRC_DIR + "instance_in_repeat_expr.bin"); + + assertIntEquals(r.chunks().size(), 2); + assertIntEquals(r.chunks().get(((int) 0)).offset(), 16); + assertIntEquals(r.chunks().get(((int) 0)).len(), 8312); + assertIntEquals(r.chunks().get(((int) 1)).offset(), 8328); + assertIntEquals(r.chunks().get(((int) 1)).len(), 15); + } +} diff --git a/spec/java/src/io/kaitai/struct/spec/TestInstanceInRepeatUntil.java b/spec/java/src/io/kaitai/struct/spec/TestInstanceInRepeatUntil.java new file mode 100644 index 000000000..5c0cfcd00 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestInstanceInRepeatUntil.java @@ -0,0 +1,21 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.InstanceInRepeatUntil; +import org.testng.annotations.Test; +import static org.testng.Assert.*; +public class TestInstanceInRepeatUntil extends CommonSpec { + + @Test + public void testInstanceInRepeatUntil() throws Exception { + InstanceInRepeatUntil r = InstanceInRepeatUntil.fromFile(SRC_DIR + "repeat_until_s4.bin"); + + assertIntEquals(r.entries().size(), 5); + assertIntEquals(r.entries().get(((int) 0)), 66); + assertIntEquals(r.entries().get(((int) 1)), 0); + assertIntEquals(r.entries().get(((int) 2)), 4919); + assertIntEquals(r.entries().get(((int) 3)), 0); + assertIntEquals(r.entries().get(((int) 4)), -1); + } +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestInstanceInRepeatExpr.java b/spec/java/src/io/kaitai/struct/specwrite/TestInstanceInRepeatExpr.java new file mode 100644 index 000000000..cdc9db099 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestInstanceInRepeatExpr.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.InstanceInRepeatExpr; +import org.testng.annotations.Test; + +public class TestInstanceInRepeatExpr extends CommonSpec { + @Override + protected Class getStructClass() { + return InstanceInRepeatExpr.class; + } + + @Override + protected String getSrcFilename() { + return "instance_in_repeat_expr.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestInstanceInRepeatUntil.java b/spec/java/src/io/kaitai/struct/specwrite/TestInstanceInRepeatUntil.java new file mode 100644 index 000000000..532a98fe9 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestInstanceInRepeatUntil.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.InstanceInRepeatUntil; +import org.testng.annotations.Test; + +public class TestInstanceInRepeatUntil extends CommonSpec { + @Override + protected Class getStructClass() { + return InstanceInRepeatUntil.class; + } + + @Override + protected String getSrcFilename() { + return "repeat_until_s4.bin"; + } + +} diff --git a/spec/ks/instance_in_repeat_expr.kst b/spec/ks/instance_in_repeat_expr.kst new file mode 100644 index 000000000..298a2947c --- /dev/null +++ b/spec/ks/instance_in_repeat_expr.kst @@ -0,0 +1,13 @@ +id: instance_in_repeat_expr +data: instance_in_repeat_expr.bin +asserts: + - actual: chunks.size + expected: 2 + - actual: chunks[0].offset + expected: 0x10 + - actual: chunks[0].len + expected: 0x2078 + - actual: chunks[1].offset + expected: 0x2088 + - actual: chunks[1].len + expected: 0xf diff --git a/spec/ks/instance_in_repeat_until.kst b/spec/ks/instance_in_repeat_until.kst new file mode 100644 index 000000000..30e111413 --- /dev/null +++ b/spec/ks/instance_in_repeat_until.kst @@ -0,0 +1,15 @@ +id: instance_in_repeat_until +data: repeat_until_s4.bin +asserts: + - actual: entries.size + expected: 5 + - actual: entries[0] + expected: 0x42 + - actual: entries[1] + expected: 0x00 + - actual: entries[2] + expected: 0x1337 + - actual: entries[3] + expected: 0x00 + - actual: entries[4] + expected: -1 diff --git a/src/instance_in_repeat_expr.bin b/src/instance_in_repeat_expr.bin new file mode 100644 index 0000000000000000000000000000000000000000..84055c57d3d79575c782bdff8f2b8a7213fb507f GIT binary patch literal 20 WcmWe&U|^_FU|{F~Vtyc-35Wp_^Z{Z3 literal 0 HcmV?d00001 From 79b186107e9f3002892ad4630bbcac0c3c944895 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Sat, 26 Nov 2022 11:31:14 +0100 Subject: [PATCH 057/126] dumpStructValue: exclude _fetchInstances* from dumps --- spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java b/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java index d525757b1..955442194 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java +++ b/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java @@ -144,6 +144,7 @@ protected static Object dumpStructValue( methodName.startsWith("_check") || methodName.startsWith("_write") || methodName.startsWith("_invalidate") || + methodName.startsWith("_fetchInstances") || methodName.startsWith("_raw_") ) { continue; From b9cf221c6298d1cac3245462ab38efbabfaf6c55 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Sat, 26 Nov 2022 11:33:44 +0100 Subject: [PATCH 058/126] Add Instance{InSized,IoUserEarlier} for instances in substreams --- formats/instance_in_sized.ksy | 55 ++++++++++++++++++ formats/instance_io_user_earlier.ksy | 57 +++++++++++++++++++ .../struct/spec/TestInstanceInSized.java | 25 ++++++++ .../spec/TestInstanceIoUserEarlier.java | 31 ++++++++++ .../struct/specwrite/TestInstanceInSized.java | 20 +++++++ .../specwrite/TestInstanceIoUserEarlier.java | 20 +++++++ spec/ks/instance_in_sized.kst | 24 ++++++++ spec/ks/instance_io_user_earlier.kst | 38 +++++++++++++ 8 files changed, 270 insertions(+) create mode 100644 formats/instance_in_sized.ksy create mode 100644 formats/instance_io_user_earlier.ksy create mode 100644 spec/java/src/io/kaitai/struct/spec/TestInstanceInSized.java create mode 100644 spec/java/src/io/kaitai/struct/spec/TestInstanceIoUserEarlier.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestInstanceInSized.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestInstanceIoUserEarlier.java create mode 100644 spec/ks/instance_in_sized.kst create mode 100644 spec/ks/instance_io_user_earlier.kst diff --git a/formats/instance_in_sized.ksy b/formats/instance_in_sized.ksy new file mode 100644 index 000000000..598560d60 --- /dev/null +++ b/formats/instance_in_sized.ksy @@ -0,0 +1,55 @@ +# Tests instances in substreams (mainly intended for writing, where it's a bit challenge to get everything right) +meta: + id: instance_in_sized + endian: le +seq: + - id: cont + size: 16 + type: wrapper +types: + wrapper: + seq: + - id: seq_sized + size: 4 + type: qux + - id: seq_in_stream + type: bar + instances: + inst_in_stream: + pos: _io.pos + 3 # should be 8 (5 is where the `seq` ends) + type: baz + inst_sized: + pos: _io.pos + 7 # should be 12 (5 is where the `seq` ends) + size: 4 + type: qux + + bar: + seq: + - id: seq_f + type: u1 + instances: + inst: + pos: 4 + 1 + size: 3 + + baz: + seq: + - id: seq_f + type: u1 + instances: + inst: + pos: 8 + 1 + size: 3 + + qux: + seq: + - id: seq_f + type: u1 + if: inst_invoked > 0 + instances: + inst_invoked: + pos: _io.pos + 1 # invoked from position 0 -> should be 2 + type: u1 + inst_unused_by_seq: + pos: _io.pos + 1 # should be 2 (1 is where the `seq` ends) + size: 2 diff --git a/formats/instance_io_user_earlier.ksy b/formats/instance_io_user_earlier.ksy new file mode 100644 index 000000000..10af49f88 --- /dev/null +++ b/formats/instance_io_user_earlier.ksy @@ -0,0 +1,57 @@ +meta: + id: instance_io_user_earlier + endian: le +seq: + - id: sized_a + size: 6 + type: slot + - id: sized_b + size: 6 + type: slot + - id: into_b + type: foo + - id: into_a_skipped + type: foo + - id: into_a + type: foo + - id: last_accessor + type: baz +instances: + a_mid: + io: into_a.inst._io + pos: 1 + type: u2 + b_mid: + io: into_b.inst._io + pos: 1 + type: u2 + +types: + foo: + seq: + - id: indicator + type: u1 + - id: bar + type: u1 + if: inst._io.size != 0 and inst.content == 0x66 + instances: + inst: + io: 'indicator == 0xca ? _parent.sized_b._io : _parent.sized_a._io' + pos: 1 + size: '_io.pos != 0x0e ? 4 : 0' + type: slot + slot: + seq: + - id: content + type: u1 + if: _io.size != 0 + instances: + last: + pos: _io.size - 1 + type: u1 + if: _io.size != 0 + baz: + seq: + - id: v + type: u1 + if: _parent.into_b.inst.last == 0x59 diff --git a/spec/java/src/io/kaitai/struct/spec/TestInstanceInSized.java b/spec/java/src/io/kaitai/struct/spec/TestInstanceInSized.java new file mode 100644 index 000000000..774ae465f --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestInstanceInSized.java @@ -0,0 +1,25 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.InstanceInSized; +import org.testng.annotations.Test; +import static org.testng.Assert.*; +public class TestInstanceInSized extends CommonSpec { + + @Test + public void testInstanceInSized() throws Exception { + InstanceInSized r = InstanceInSized.fromFile(SRC_DIR + "process_rotate.bin"); + + assertIntEquals(r.cont().seqSized().seqF(), 9); + assertIntEquals(r.cont().seqSized().instInvoked(), 172); + assertEquals(r.cont().seqSized().instUnusedBySeq(), new byte[] { -115, -115 }); + assertIntEquals(r.cont().seqInStream().seqF(), 237); + assertEquals(r.cont().seqInStream().inst(), new byte[] { -70, 123, -109 }); + assertIntEquals(r.cont().instInStream().seqF(), 99); + assertEquals(r.cont().instInStream().inst(), new byte[] { 35, 1, 42 }); + assertIntEquals(r.cont().instSized().seqF(), 52); + assertIntEquals(r.cont().instSized().instInvoked(), 178); + assertEquals(r.cont().instSized().instUnusedBySeq(), new byte[] { 57, -78 }); + } +} diff --git a/spec/java/src/io/kaitai/struct/spec/TestInstanceIoUserEarlier.java b/spec/java/src/io/kaitai/struct/spec/TestInstanceIoUserEarlier.java new file mode 100644 index 000000000..8185052f4 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestInstanceIoUserEarlier.java @@ -0,0 +1,31 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.InstanceIoUserEarlier; +import org.testng.annotations.Test; +import static org.testng.Assert.*; +public class TestInstanceIoUserEarlier extends CommonSpec { + + @Test + public void testInstanceIoUserEarlier() throws Exception { + InstanceIoUserEarlier r = InstanceIoUserEarlier.fromFile(SRC_DIR + "switch_opcodes2.bin"); + + assertIntEquals(r.sizedA().content(), 83); + assertIntEquals(r.intoA().inst().content(), 102); + assertIntEquals(r.aMid(), 28527); + assertIntEquals(r.intoA().inst().last(), 0); + assertIntEquals(r.sizedA().last(), 88); + assertIntEquals(r.sizedB().content(), 66); + assertIntEquals(r.intoB().inst().content(), 0); + assertIntEquals(r.bMid(), 0); + assertIntEquals(r.intoB().inst().last(), 89); + assertIntEquals(r.sizedB().last(), 254); + assertIntEquals(r.intoB().indicator(), 202); + assertIntEquals(r.intoASkipped().indicator(), 0); + assertIntEquals(r.intoASkipped().inst()._io().size(), 0); + assertIntEquals(r.intoA().indicator(), 0); + assertIntEquals(r.intoA().bar(), 73); + assertIntEquals(r.lastAccessor().v(), 7); + } +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestInstanceInSized.java b/spec/java/src/io/kaitai/struct/specwrite/TestInstanceInSized.java new file mode 100644 index 000000000..946ee779e --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestInstanceInSized.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.InstanceInSized; +import org.testng.annotations.Test; + +public class TestInstanceInSized extends CommonSpec { + @Override + protected Class getStructClass() { + return InstanceInSized.class; + } + + @Override + protected String getSrcFilename() { + return "process_rotate.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestInstanceIoUserEarlier.java b/spec/java/src/io/kaitai/struct/specwrite/TestInstanceIoUserEarlier.java new file mode 100644 index 000000000..b1028eb09 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestInstanceIoUserEarlier.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.InstanceIoUserEarlier; +import org.testng.annotations.Test; + +public class TestInstanceIoUserEarlier extends CommonSpec { + @Override + protected Class getStructClass() { + return InstanceIoUserEarlier.class; + } + + @Override + protected String getSrcFilename() { + return "switch_opcodes2.bin"; + } + +} diff --git a/spec/ks/instance_in_sized.kst b/spec/ks/instance_in_sized.kst new file mode 100644 index 000000000..3d851fd20 --- /dev/null +++ b/spec/ks/instance_in_sized.kst @@ -0,0 +1,24 @@ +id: instance_in_sized +data: process_rotate.bin +asserts: + - actual: cont.seq_sized.seq_f + expected: 0x09 + - actual: cont.seq_sized.inst_invoked + expected: 0xac + - actual: cont.seq_sized.inst_unused_by_seq + expected: '[0x8d, 0x8d]' + - actual: cont.seq_in_stream.seq_f + expected: 0xed + - actual: cont.seq_in_stream.inst + expected: '[0xba, 0x7b, 0x93]' + + - actual: cont.inst_in_stream.seq_f + expected: 0x63 + - actual: cont.inst_in_stream.inst + expected: '[0x23, 0x01, 0x2a]' + - actual: cont.inst_sized.seq_f + expected: 0x34 + - actual: cont.inst_sized.inst_invoked + expected: 0xb2 + - actual: cont.inst_sized.inst_unused_by_seq + expected: '[0x39, 0xb2]' diff --git a/spec/ks/instance_io_user_earlier.kst b/spec/ks/instance_io_user_earlier.kst new file mode 100644 index 000000000..074a74960 --- /dev/null +++ b/spec/ks/instance_io_user_earlier.kst @@ -0,0 +1,38 @@ +id: instance_io_user_earlier +data: switch_opcodes2.bin +asserts: + - actual: sized_a.content + expected: 0x53 + - actual: into_a.inst.content + expected: 0x66 + - actual: a_mid + expected: 0x6f_6f + - actual: into_a.inst.last + expected: 0x00 + - actual: sized_a.last + expected: 0x58 + + - actual: sized_b.content + expected: 0x42 + - actual: into_b.inst.content + expected: 0x00 + - actual: b_mid + expected: 0x00_00 + - actual: into_b.inst.last + expected: 0x59 + - actual: sized_b.last + expected: 0xfe + + - actual: into_b.indicator + expected: 0xca + - actual: into_a_skipped.indicator + expected: 0x00 + - actual: into_a_skipped.inst._io.size + expected: 0 + - actual: into_a.indicator + expected: 0x00 + - actual: into_a.bar + expected: 0x49 + + - actual: last_accessor.v + expected: 0x07 From b16605c1fc4c7d60bd684d58d77cb88a26d133e9 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Mon, 19 Dec 2022 22:50:55 +0100 Subject: [PATCH 059/126] Implement encode() in custom processing classes --- .../struct/testwrite/CustomFxNoArgs.java | 30 +++++++++++++++++++ .../kaitai/struct/testwrite/MyCustomFx.java | 28 +++++++++++++++++ spec/java/src/nested/deeply/CustomFx.java | 17 +++++++++-- 3 files changed, 73 insertions(+), 2 deletions(-) create mode 100644 spec/java/src/io/kaitai/struct/testwrite/CustomFxNoArgs.java create mode 100644 spec/java/src/io/kaitai/struct/testwrite/MyCustomFx.java diff --git a/spec/java/src/io/kaitai/struct/testwrite/CustomFxNoArgs.java b/spec/java/src/io/kaitai/struct/testwrite/CustomFxNoArgs.java new file mode 100644 index 000000000..cbafe4b79 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/testwrite/CustomFxNoArgs.java @@ -0,0 +1,30 @@ +package io.kaitai.struct.testwrite; + +import io.kaitai.struct.CustomProcessor; + +public class CustomFxNoArgs implements CustomProcessor { + public CustomFxNoArgs() { + } + + @Override + public byte[] decode(byte[] src) { + byte[] dst = new byte[src.length + 2]; + dst[0] = '_'; + dst[src.length + 1] = '_'; + System.arraycopy(src, 0, dst, 1, src.length); + return dst; + } + + @Override + public byte[] encode(byte[] src) { + if (src.length >= 2 && src[0] == '_' && src[src.length - 1] == '_') { + byte[] dst = new byte[src.length - 2]; + System.arraycopy(src, 1, dst, 0, dst.length); + return dst; + } else { + // usually it's decode(byte[]) that puts restrictions on the input data, but + // hey - this class is just for testing purposes anyway :-P + throw new UnsupportedOperationException("CustomFxNoArgs can only encode data like '_(.*)_'"); + } + } +} diff --git a/spec/java/src/io/kaitai/struct/testwrite/MyCustomFx.java b/spec/java/src/io/kaitai/struct/testwrite/MyCustomFx.java new file mode 100644 index 000000000..debae3d3a --- /dev/null +++ b/spec/java/src/io/kaitai/struct/testwrite/MyCustomFx.java @@ -0,0 +1,28 @@ +package io.kaitai.struct.testwrite; + +import io.kaitai.struct.CustomProcessor; + +public class MyCustomFx implements CustomProcessor { + private int key; + + public MyCustomFx(int key, boolean flag, byte[] someBytes) { + this.key = flag ? key : -key; + } + + @Override + public byte[] decode(byte[] src) { + byte[] dst = new byte[src.length]; + for (int i = 0; i < src.length; i++) + dst[i] = (byte) (src[i] + key); + return dst; + } + + @Override + public byte[] encode(byte[] src) { + int oldKey = key; + key = -key; + byte[] res = decode(src); + key = oldKey; + return res; + } +} diff --git a/spec/java/src/nested/deeply/CustomFx.java b/spec/java/src/nested/deeply/CustomFx.java index b29fafbd6..b7a44151e 100644 --- a/spec/java/src/nested/deeply/CustomFx.java +++ b/spec/java/src/nested/deeply/CustomFx.java @@ -1,8 +1,8 @@ package nested.deeply; -import io.kaitai.struct.CustomDecoder; +import io.kaitai.struct.CustomProcessor; -public class CustomFx implements CustomDecoder { +public class CustomFx implements CustomProcessor { public CustomFx(int x) { } @@ -14,4 +14,17 @@ public byte[] decode(byte[] src) { System.arraycopy(src, 0, dst, 1, src.length); return dst; } + + @Override + public byte[] encode(byte[] src) { + if (src.length >= 2 && src[0] == '_' && src[src.length - 1] == '_') { + byte[] dst = new byte[src.length - 2]; + System.arraycopy(src, 1, dst, 0, dst.length); + return dst; + } else { + // usually it's decode(byte[]) that puts restrictions on the input data, but + // hey - this class is just for testing purposes anyway :-P + throw new UnsupportedOperationException("CustomFx can only encode data like '_(.*)_'"); + } + } } From 436e74250e3e678db4febfafd3a4db2766c20ca6 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Tue, 20 Dec 2022 22:32:09 +0100 Subject: [PATCH 060/126] Enable Zlib{WithHeader78,Surrounded} write tests They were temporarily disabled because `unprocessZlib` had a bug that caused the method to hang in an infinite loop, which blocked the entire test suite. This has been fixed in https://github.com/kaitai-io/kaitai_struct_java_runtime/commit/b11a29bf022a151650089b508221d2bc98b0ebed. --- .../struct/specwrite/TestZlibSurrounded.java | 17 +++++------------ .../struct/specwrite/TestZlibWithHeader78.java | 17 +++++------------ 2 files changed, 10 insertions(+), 24 deletions(-) diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestZlibSurrounded.java b/spec/java/src/io/kaitai/struct/specwrite/TestZlibSurrounded.java index bda343879..a99cc2b02 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestZlibSurrounded.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestZlibSurrounded.java @@ -1,3 +1,5 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + package io.kaitai.struct.specwrite; import io.kaitai.struct.KaitaiStruct.ReadWrite; @@ -5,23 +7,14 @@ import org.testng.annotations.Test; public class TestZlibSurrounded extends CommonSpec { - // @Override - // protected Class getStructClass() { - // return ZlibSurrounded.class; - // } - - // @Override - // protected String getSrcFilename() { - // return "zlib_surrounded.bin"; - // } - @Override protected Class getStructClass() { - throw new UnsupportedOperationException(); + return ZlibSurrounded.class; } @Override protected String getSrcFilename() { - throw new UnsupportedOperationException(); + return "zlib_surrounded.bin"; } + } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestZlibWithHeader78.java b/spec/java/src/io/kaitai/struct/specwrite/TestZlibWithHeader78.java index b7764411c..fb83cd6ea 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestZlibWithHeader78.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestZlibWithHeader78.java @@ -1,3 +1,5 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + package io.kaitai.struct.specwrite; import io.kaitai.struct.KaitaiStruct.ReadWrite; @@ -5,23 +7,14 @@ import org.testng.annotations.Test; public class TestZlibWithHeader78 extends CommonSpec { - // @Override - // protected Class getStructClass() { - // return ZlibWithHeader78.class; - // } - - // @Override - // protected String getSrcFilename() { - // return "zlib_with_header_78.bin"; - // } - @Override protected Class getStructClass() { - throw new UnsupportedOperationException(); + return ZlibWithHeader78.class; } @Override protected String getSrcFilename() { - throw new UnsupportedOperationException(); + return "zlib_with_header_78.bin"; } + } From 99df2b1d589b405244c9ea91a3aee6b6842d0cbf Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Tue, 20 Dec 2022 23:48:35 +0100 Subject: [PATCH 061/126] Add ProcessRepeatUsertypeDynarg{Xor,Rotate,Custom} --- formats/process_repeat_usertype.ksy | 2 +- .../process_repeat_usertype_dynarg_custom.ksy | 36 ++++++++++++ .../process_repeat_usertype_dynarg_rotate.ksy | 55 +++++++++++++++++++ .../process_repeat_usertype_dynarg_xor.ksy | 46 ++++++++++++++++ ...TestProcessRepeatUsertypeDynargCustom.java | 20 +++++++ ...TestProcessRepeatUsertypeDynargRotate.java | 26 +++++++++ .../TestProcessRepeatUsertypeDynargXor.java | 20 +++++++ ...TestProcessRepeatUsertypeDynargCustom.java | 20 +++++++ ...TestProcessRepeatUsertypeDynargRotate.java | 20 +++++++ .../TestProcessRepeatUsertypeDynargXor.java | 20 +++++++ .../process_repeat_usertype_dynarg_custom.kst | 14 +++++ .../process_repeat_usertype_dynarg_rotate.kst | 29 ++++++++++ .../ks/process_repeat_usertype_dynarg_xor.kst | 14 +++++ 13 files changed, 321 insertions(+), 1 deletion(-) create mode 100644 formats/process_repeat_usertype_dynarg_custom.ksy create mode 100644 formats/process_repeat_usertype_dynarg_rotate.ksy create mode 100644 formats/process_repeat_usertype_dynarg_xor.ksy create mode 100644 spec/java/src/io/kaitai/struct/spec/TestProcessRepeatUsertypeDynargCustom.java create mode 100644 spec/java/src/io/kaitai/struct/spec/TestProcessRepeatUsertypeDynargRotate.java create mode 100644 spec/java/src/io/kaitai/struct/spec/TestProcessRepeatUsertypeDynargXor.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestProcessRepeatUsertypeDynargCustom.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestProcessRepeatUsertypeDynargRotate.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestProcessRepeatUsertypeDynargXor.java create mode 100644 spec/ks/process_repeat_usertype_dynarg_custom.kst create mode 100644 spec/ks/process_repeat_usertype_dynarg_rotate.kst create mode 100644 spec/ks/process_repeat_usertype_dynarg_xor.kst diff --git a/formats/process_repeat_usertype.ksy b/formats/process_repeat_usertype.ksy index edbe7bdd2..3c80334f1 100644 --- a/formats/process_repeat_usertype.ksy +++ b/formats/process_repeat_usertype.ksy @@ -4,10 +4,10 @@ meta: seq: - id: blocks size: 5 + process: xor(0x9e) type: block repeat: expr repeat-expr: 2 - process: xor(0x9e) types: block: seq: diff --git a/formats/process_repeat_usertype_dynarg_custom.ksy b/formats/process_repeat_usertype_dynarg_custom.ksy new file mode 100644 index 000000000..9bcdf2a2a --- /dev/null +++ b/formats/process_repeat_usertype_dynarg_custom.ksy @@ -0,0 +1,36 @@ +# Like "process_repeat_usertype_dynarg_xor", but using a custom `process` with +# arguments. +meta: + id: process_repeat_usertype_dynarg_custom + endian: le +seq: + - id: blocks + size: 5 + process: 'my_custom_fx(_io.pos + 13 * _index, _io.pos % 2 == 0, _index == 1 ? [0x20, 0x30] : [0x40])' + type: block + repeat: expr + repeat-expr: 2 + - id: blocks_b + type: blocks_b_wrapper + +types: + block: + seq: + - id: a + type: u4 + # - id: b + # type: u1 + + blocks_b_wrapper: + seq: + - id: dummy + type: u1 + instances: + blocks_0_b: + io: _parent.blocks[0]._io + pos: 4 + type: u1 + blocks_1_b: + io: _parent.blocks[1]._io + pos: 4 + type: u1 diff --git a/formats/process_repeat_usertype_dynarg_rotate.ksy b/formats/process_repeat_usertype_dynarg_rotate.ksy new file mode 100644 index 000000000..447d84e51 --- /dev/null +++ b/formats/process_repeat_usertype_dynarg_rotate.ksy @@ -0,0 +1,55 @@ +# Like "process_repeat_usertype_dynarg_xor", but using `process: rol(n)` and +# `process: ror(n)`. +meta: + id: process_repeat_usertype_dynarg_rotate + endian: le +seq: + - id: blocks_rol + size: 3 + process: rol(_io.pos - 4 * _index) + type: block + repeat: expr + repeat-expr: 2 + - id: blocks_ror + size: 3 + process: ror((_io.pos - 6) - 4 * _index) + type: block + repeat: expr + repeat-expr: 3 + - id: blocks_b + type: blocks_b_wrapper + +types: + block: + seq: + - id: a + type: u2 + # - id: b + # type: u1 + + blocks_b_wrapper: + seq: + - id: dummy + type: u1 + instances: + blocks_rol_0_b: + io: _parent.blocks_rol[0]._io + pos: 2 + type: u1 + blocks_rol_1_b: + io: _parent.blocks_rol[1]._io + pos: 2 + type: u1 + + blocks_ror_0_b: + io: _parent.blocks_ror[0]._io + pos: 2 + type: u1 + blocks_ror_1_b: + io: _parent.blocks_ror[1]._io + pos: 2 + type: u1 + blocks_ror_2_b: + io: _parent.blocks_ror[2]._io + pos: 2 + type: u1 diff --git a/formats/process_repeat_usertype_dynarg_xor.ksy b/formats/process_repeat_usertype_dynarg_xor.ksy new file mode 100644 index 000000000..dee19ab0d --- /dev/null +++ b/formats/process_repeat_usertype_dynarg_xor.ksy @@ -0,0 +1,46 @@ +# Like "process_repeat_usertype", but with a dynamic `key` parameter of the built-in +# `process: xor(key)` that depends on the current stream state. This means that the `key` +# expression must be always evaluated just before parsing the 5-byte array backing each +# `blocks[i]` item - this is natural for parsing, but not for serialization. +# +# To make things worse for serialization, we also parse another byte in each `blocks[i]` +# substream outside of the `block` type with positional instances using `io` key. So that +# even if the serializing code converted the `blocks[i]` substream to a byte array and +# unprocessed it with `xor` right after leaving the `block` type, it wouldn't help and it +# would now be forced to use `xor` again (but still with the `key` process argument +# correctly evaluated in the context right before each `blocks[i]`), because contents of +# `blocks[i]` substreams have changed. +meta: + id: process_repeat_usertype_dynarg_xor + endian: le +seq: + - id: blocks + size: 5 + process: xor(0x9b ^ (_index << 4 | _io.pos)) + type: block + repeat: expr + repeat-expr: 2 + - id: blocks_b + type: blocks_b_wrapper + +types: + block: + seq: + - id: a + type: u4 + # - id: b + # type: u1 + + blocks_b_wrapper: + seq: + - id: dummy + type: u1 + instances: + blocks_0_b: + io: _parent.blocks[0]._io + pos: 4 + type: u1 + blocks_1_b: + io: _parent.blocks[1]._io + pos: 4 + type: u1 diff --git a/spec/java/src/io/kaitai/struct/spec/TestProcessRepeatUsertypeDynargCustom.java b/spec/java/src/io/kaitai/struct/spec/TestProcessRepeatUsertypeDynargCustom.java new file mode 100644 index 000000000..fd294a561 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestProcessRepeatUsertypeDynargCustom.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.ProcessRepeatUsertypeDynargCustom; +import org.testng.annotations.Test; +import static org.testng.Assert.*; +public class TestProcessRepeatUsertypeDynargCustom extends CommonSpec { + + @Test + public void testProcessRepeatUsertypeDynargCustom() throws Exception { + ProcessRepeatUsertypeDynargCustom r = ProcessRepeatUsertypeDynargCustom.fromFile(SRC_DIR + "process_rotate.bin"); + + assertIntEquals(r.blocks().get(((int) 0)).a(), 2290657028L); + assertIntEquals(r.blocks().get(((int) 1)).a(), 2057999057); + assertIntEquals(r.blocksB().dummy(), 1); + assertIntEquals(r.blocksB().blocks0B(), 232); + assertIntEquals(r.blocksB().blocks1B(), 58); + } +} diff --git a/spec/java/src/io/kaitai/struct/spec/TestProcessRepeatUsertypeDynargRotate.java b/spec/java/src/io/kaitai/struct/spec/TestProcessRepeatUsertypeDynargRotate.java new file mode 100644 index 000000000..7e2ab23e6 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestProcessRepeatUsertypeDynargRotate.java @@ -0,0 +1,26 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.ProcessRepeatUsertypeDynargRotate; +import org.testng.annotations.Test; +import static org.testng.Assert.*; +public class TestProcessRepeatUsertypeDynargRotate extends CommonSpec { + + @Test + public void testProcessRepeatUsertypeDynargRotate() throws Exception { + ProcessRepeatUsertypeDynargRotate r = ProcessRepeatUsertypeDynargRotate.fromFile(SRC_DIR + "process_rotate.bin"); + + assertIntEquals(r.blocksRol().get(((int) 0)).a(), 25928); + assertIntEquals(r.blocksRol().get(((int) 1)).a(), 46902); + assertIntEquals(r.blocksRor().get(((int) 0)).a(), 29295); + assertIntEquals(r.blocksRor().get(((int) 1)).a(), 16584); + assertIntEquals(r.blocksRor().get(((int) 2)).a(), 22810); + assertIntEquals(r.blocksB().dummy(), 178); + assertIntEquals(r.blocksB().blocksRol0B(), 108); + assertIntEquals(r.blocksB().blocksRol1B(), 234); + assertIntEquals(r.blocksB().blocksRor0B(), 108); + assertIntEquals(r.blocksB().blocksRor1B(), 138); + assertIntEquals(r.blocksB().blocksRor2B(), 156); + } +} diff --git a/spec/java/src/io/kaitai/struct/spec/TestProcessRepeatUsertypeDynargXor.java b/spec/java/src/io/kaitai/struct/spec/TestProcessRepeatUsertypeDynargXor.java new file mode 100644 index 000000000..511d56238 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestProcessRepeatUsertypeDynargXor.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.ProcessRepeatUsertypeDynargXor; +import org.testng.annotations.Test; +import static org.testng.Assert.*; +public class TestProcessRepeatUsertypeDynargXor extends CommonSpec { + + @Test + public void testProcessRepeatUsertypeDynargXor() throws Exception { + ProcessRepeatUsertypeDynargXor r = ProcessRepeatUsertypeDynargXor.fromFile(SRC_DIR + "process_xor_4.bin"); + + assertIntEquals(r.blocks().get(((int) 0)).a(), 2319263090L); + assertIntEquals(r.blocks().get(((int) 1)).a(), 263540053); + assertIntEquals(r.blocksB().dummy(), 209); + assertIntEquals(r.blocksB().blocks0B(), 20); + assertIntEquals(r.blocksB().blocks1B(), 91); + } +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestProcessRepeatUsertypeDynargCustom.java b/spec/java/src/io/kaitai/struct/specwrite/TestProcessRepeatUsertypeDynargCustom.java new file mode 100644 index 000000000..bdf33f6d4 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestProcessRepeatUsertypeDynargCustom.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ProcessRepeatUsertypeDynargCustom; +import org.testng.annotations.Test; + +public class TestProcessRepeatUsertypeDynargCustom extends CommonSpec { + @Override + protected Class getStructClass() { + return ProcessRepeatUsertypeDynargCustom.class; + } + + @Override + protected String getSrcFilename() { + return "process_rotate.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestProcessRepeatUsertypeDynargRotate.java b/spec/java/src/io/kaitai/struct/specwrite/TestProcessRepeatUsertypeDynargRotate.java new file mode 100644 index 000000000..b1d1e6131 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestProcessRepeatUsertypeDynargRotate.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ProcessRepeatUsertypeDynargRotate; +import org.testng.annotations.Test; + +public class TestProcessRepeatUsertypeDynargRotate extends CommonSpec { + @Override + protected Class getStructClass() { + return ProcessRepeatUsertypeDynargRotate.class; + } + + @Override + protected String getSrcFilename() { + return "process_rotate.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestProcessRepeatUsertypeDynargXor.java b/spec/java/src/io/kaitai/struct/specwrite/TestProcessRepeatUsertypeDynargXor.java new file mode 100644 index 000000000..4ecdbf55f --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestProcessRepeatUsertypeDynargXor.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ProcessRepeatUsertypeDynargXor; +import org.testng.annotations.Test; + +public class TestProcessRepeatUsertypeDynargXor extends CommonSpec { + @Override + protected Class getStructClass() { + return ProcessRepeatUsertypeDynargXor.class; + } + + @Override + protected String getSrcFilename() { + return "process_xor_4.bin"; + } + +} diff --git a/spec/ks/process_repeat_usertype_dynarg_custom.kst b/spec/ks/process_repeat_usertype_dynarg_custom.kst new file mode 100644 index 000000000..1b7f5add8 --- /dev/null +++ b/spec/ks/process_repeat_usertype_dynarg_custom.kst @@ -0,0 +1,14 @@ +id: process_repeat_usertype_dynarg_custom +data: process_rotate.bin +asserts: + - actual: blocks[0].a # key: 5 + 13 * 0 = 5, flag: false + expected: 0x8888_a704 + - actual: blocks[1].a # key: 10 + 13 * 1 = 23, flag: true + expected: 0x7aaa_92d1 + - actual: blocks_b.dummy + expected: 0x01 + + - actual: blocks_b.blocks_0_b + expected: 0xe8 # 0xed - 0x05 + - actual: blocks_b.blocks_1_b + expected: 0x3a # 0x23 + 0x17 diff --git a/spec/ks/process_repeat_usertype_dynarg_rotate.kst b/spec/ks/process_repeat_usertype_dynarg_rotate.kst new file mode 100644 index 000000000..ba6325e5a --- /dev/null +++ b/spec/ks/process_repeat_usertype_dynarg_rotate.kst @@ -0,0 +1,29 @@ +id: process_repeat_usertype_dynarg_rotate +data: process_rotate.bin +asserts: + - actual: blocks_rol[0].a # key: 3 - (4 * 0) = 3 + expected: 0x6548 + - actual: blocks_rol[1].a # key: 6 - (4 * 1) = 2 + expected: 0xb736 + + - actual: blocks_ror[0].a # key: 3 - (4 * 0) = 3 + expected: 0x726f + - actual: blocks_ror[1].a # key: 6 - (4 * 1) = 2 + expected: 0x40c8 + - actual: blocks_ror[2].a # key: 9 - (4 * 2) = 1 + expected: 0x591a + + - actual: blocks_b.dummy + expected: 0xb2 + + - actual: blocks_b.blocks_rol_0_b + expected: 0x6c + - actual: blocks_b.blocks_rol_1_b + expected: 0xea + + - actual: blocks_b.blocks_ror_0_b + expected: 0x6c + - actual: blocks_b.blocks_ror_1_b + expected: 0x8a + - actual: blocks_b.blocks_ror_2_b + expected: 0x9c diff --git a/spec/ks/process_repeat_usertype_dynarg_xor.kst b/spec/ks/process_repeat_usertype_dynarg_xor.kst new file mode 100644 index 000000000..647abd395 --- /dev/null +++ b/spec/ks/process_repeat_usertype_dynarg_xor.kst @@ -0,0 +1,14 @@ +id: process_repeat_usertype_dynarg_xor +data: process_xor_4.bin +asserts: + - actual: blocks[0].a # key: 0x9b ^ (0x00 | 0x05) = 0x9e + expected: 0x8a3d_2572 + - actual: blocks[1].a # key: 0x9b ^ (0x10 | 0x0a) = 0x81 + expected: 0x0fb5_4d55 + - actual: blocks_b.dummy + expected: 0xd1 + + - actual: blocks_b.blocks_0_b + expected: 0x14 # 0x8a ^ 0x9e + - actual: blocks_b.blocks_1_b + expected: 0x5b # 0xda ^ 0x81 From b0fe2e9fd55273454eddffbb6747ca2af90fad82 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Fri, 23 Dec 2022 12:26:32 +0100 Subject: [PATCH 062/126] Add Repeat{Eos,N,Until}TermStruct --- formats/repeat_eos_term_struct.ksy | 14 ++++++++++ formats/repeat_n_term_struct.ksy | 26 +++++++++++++++++++ formats/repeat_until_term_struct.ksy | 26 +++++++++++++++++++ .../struct/spec/TestRepeatEosTermStruct.java | 18 +++++++++++++ .../struct/spec/TestRepeatNTermStruct.java | 24 +++++++++++++++++ .../spec/TestRepeatUntilTermStruct.java | 24 +++++++++++++++++ .../kaitai/struct/specwrite/CommonSpec.java | 2 ++ .../specwrite/TestRepeatEosTermStruct.java | 20 ++++++++++++++ .../specwrite/TestRepeatNTermStruct.java | 20 ++++++++++++++ .../specwrite/TestRepeatUntilTermStruct.java | 20 ++++++++++++++ spec/ks/repeat_eos_term_struct.kst | 10 +++++++ spec/ks/repeat_n_term_struct.kst | 23 ++++++++++++++++ spec/ks/repeat_until_term_struct.kst | 23 ++++++++++++++++ 13 files changed, 250 insertions(+) create mode 100644 formats/repeat_eos_term_struct.ksy create mode 100644 formats/repeat_n_term_struct.ksy create mode 100644 formats/repeat_until_term_struct.ksy create mode 100644 spec/java/src/io/kaitai/struct/spec/TestRepeatEosTermStruct.java create mode 100644 spec/java/src/io/kaitai/struct/spec/TestRepeatNTermStruct.java create mode 100644 spec/java/src/io/kaitai/struct/spec/TestRepeatUntilTermStruct.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosTermStruct.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestRepeatNTermStruct.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilTermStruct.java create mode 100644 spec/ks/repeat_eos_term_struct.kst create mode 100644 spec/ks/repeat_n_term_struct.kst create mode 100644 spec/ks/repeat_until_term_struct.kst diff --git a/formats/repeat_eos_term_struct.ksy b/formats/repeat_eos_term_struct.ksy new file mode 100644 index 000000000..5d22485a4 --- /dev/null +++ b/formats/repeat_eos_term_struct.ksy @@ -0,0 +1,14 @@ +# Like "repeat_eos_term_bytes", but the byte array is wrapped in a user-defined type +meta: + id: repeat_eos_term_struct +seq: + - id: records + terminator: 0xb2 + include: true + type: bytes_wrapper + repeat: eos +types: + bytes_wrapper: + seq: + - id: value + size-eos: true diff --git a/formats/repeat_n_term_struct.ksy b/formats/repeat_n_term_struct.ksy new file mode 100644 index 000000000..7333cbe83 --- /dev/null +++ b/formats/repeat_n_term_struct.ksy @@ -0,0 +1,26 @@ +# Like "repeat_n_term_bytes", but the byte array is wrapped in a user-defined type +meta: + id: repeat_n_term_struct +seq: + - id: records1 + terminator: 0xaa + type: bytes_wrapper + repeat: expr + repeat-expr: 2 + - id: records2 + terminator: 0xaa + include: true + type: bytes_wrapper + repeat: expr + repeat-expr: 2 + - id: records3 + terminator: 0x55 + consume: false + type: bytes_wrapper + repeat: expr + repeat-expr: 2 +types: + bytes_wrapper: + seq: + - id: value + size-eos: true diff --git a/formats/repeat_until_term_struct.ksy b/formats/repeat_until_term_struct.ksy new file mode 100644 index 000000000..0dadc0f27 --- /dev/null +++ b/formats/repeat_until_term_struct.ksy @@ -0,0 +1,26 @@ +# Like "repeat_until_term_bytes", but the byte array is wrapped in a user-defined type +meta: + id: repeat_until_term_struct +seq: + - id: records1 + terminator: 0xaa + type: bytes_wrapper + repeat: until + repeat-until: _.value.length == 0 + - id: records2 + terminator: 0xaa + include: true + type: bytes_wrapper + repeat: until + repeat-until: _.value != [0xaa] + - id: records3 + terminator: 0x55 + consume: false + type: bytes_wrapper + repeat: until + repeat-until: _.value == records1.last.value +types: + bytes_wrapper: + seq: + - id: value + size-eos: true diff --git a/spec/java/src/io/kaitai/struct/spec/TestRepeatEosTermStruct.java b/spec/java/src/io/kaitai/struct/spec/TestRepeatEosTermStruct.java new file mode 100644 index 000000000..fb1e966f7 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestRepeatEosTermStruct.java @@ -0,0 +1,18 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.RepeatEosTermStruct; +import org.testng.annotations.Test; +import static org.testng.Assert.*; +public class TestRepeatEosTermStruct extends CommonSpec { + + @Test + public void testRepeatEosTermStruct() throws Exception { + RepeatEosTermStruct r = RepeatEosTermStruct.fromFile(SRC_DIR + "process_rotate.bin"); + + assertIntEquals(r.records().size(), 2); + assertEquals(r.records().get(((int) 0)).value(), new byte[] { 9, -84, -115, -115, -19, -70, 123, -109, 99, 35, 1, 42, 52, -78 }); + assertEquals(r.records().get(((int) 1)).value(), new byte[] { 57, -78 }); + } +} diff --git a/spec/java/src/io/kaitai/struct/spec/TestRepeatNTermStruct.java b/spec/java/src/io/kaitai/struct/spec/TestRepeatNTermStruct.java new file mode 100644 index 000000000..2bbdd60e0 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestRepeatNTermStruct.java @@ -0,0 +1,24 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.RepeatNTermStruct; +import org.testng.annotations.Test; +import static org.testng.Assert.*; +public class TestRepeatNTermStruct extends CommonSpec { + + @Test + public void testRepeatNTermStruct() throws Exception { + RepeatNTermStruct r = RepeatNTermStruct.fromFile(SRC_DIR + "repeat_until_process.bin"); + + assertIntEquals(r.records1().size(), 2); + assertEquals(r.records1().get(((int) 0)).value(), new byte[] { -24, -70 }); + assertEquals(r.records1().get(((int) 1)).value(), new byte[] { }); + assertIntEquals(r.records2().size(), 2); + assertEquals(r.records2().get(((int) 0)).value(), new byte[] { -86 }); + assertEquals(r.records2().get(((int) 1)).value(), new byte[] { -6, -98, -72, -86 }); + assertIntEquals(r.records3().size(), 2); + assertEquals(r.records3().get(((int) 0)).value(), new byte[] { -86, -86 }); + assertEquals(r.records3().get(((int) 1)).value(), new byte[] { }); + } +} diff --git a/spec/java/src/io/kaitai/struct/spec/TestRepeatUntilTermStruct.java b/spec/java/src/io/kaitai/struct/spec/TestRepeatUntilTermStruct.java new file mode 100644 index 000000000..23262af8c --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestRepeatUntilTermStruct.java @@ -0,0 +1,24 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.RepeatUntilTermStruct; +import org.testng.annotations.Test; +import static org.testng.Assert.*; +public class TestRepeatUntilTermStruct extends CommonSpec { + + @Test + public void testRepeatUntilTermStruct() throws Exception { + RepeatUntilTermStruct r = RepeatUntilTermStruct.fromFile(SRC_DIR + "repeat_until_process.bin"); + + assertIntEquals(r.records1().size(), 2); + assertEquals(r.records1().get(((int) 0)).value(), new byte[] { -24, -70 }); + assertEquals(r.records1().get(((int) 1)).value(), new byte[] { }); + assertIntEquals(r.records2().size(), 2); + assertEquals(r.records2().get(((int) 0)).value(), new byte[] { -86 }); + assertEquals(r.records2().get(((int) 1)).value(), new byte[] { -6, -98, -72, -86 }); + assertIntEquals(r.records3().size(), 2); + assertEquals(r.records3().get(((int) 0)).value(), new byte[] { -86, -86 }); + assertEquals(r.records3().get(((int) 1)).value(), new byte[] { }); + } +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java b/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java index 955442194..3c8233e48 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java +++ b/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java @@ -29,6 +29,8 @@ protected void testReadWriteRoundtrip() throws Exception { Class structClass = getStructClass(); String fn = getSrcFilename(); + System.out.println(structClass.getSimpleName()); + Method fromFileMethod = structClass.getMethod("fromFile", String.class); KaitaiStruct.ReadWrite origKs = (KaitaiStruct.ReadWrite) fromFileMethod.invoke(null, SRC_DIR + fn); origKs._read(); diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosTermStruct.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosTermStruct.java new file mode 100644 index 000000000..f55eae655 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosTermStruct.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.RepeatEosTermStruct; +import org.testng.annotations.Test; + +public class TestRepeatEosTermStruct extends CommonSpec { + @Override + protected Class getStructClass() { + return RepeatEosTermStruct.class; + } + + @Override + protected String getSrcFilename() { + return "process_rotate.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNTermStruct.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNTermStruct.java new file mode 100644 index 000000000..e51a57ffe --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNTermStruct.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.RepeatNTermStruct; +import org.testng.annotations.Test; + +public class TestRepeatNTermStruct extends CommonSpec { + @Override + protected Class getStructClass() { + return RepeatNTermStruct.class; + } + + @Override + protected String getSrcFilename() { + return "repeat_until_process.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilTermStruct.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilTermStruct.java new file mode 100644 index 000000000..1a21a7912 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilTermStruct.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.RepeatUntilTermStruct; +import org.testng.annotations.Test; + +public class TestRepeatUntilTermStruct extends CommonSpec { + @Override + protected Class getStructClass() { + return RepeatUntilTermStruct.class; + } + + @Override + protected String getSrcFilename() { + return "repeat_until_process.bin"; + } + +} diff --git a/spec/ks/repeat_eos_term_struct.kst b/spec/ks/repeat_eos_term_struct.kst new file mode 100644 index 000000000..840f0705d --- /dev/null +++ b/spec/ks/repeat_eos_term_struct.kst @@ -0,0 +1,10 @@ +id: repeat_eos_term_struct +data: process_rotate.bin +asserts: + - actual: records.size + expected: 2 + + - actual: records[0].value + expected: '[0x09, 0xac, 0x8d, 0x8d, 0xed, 0xba, 0x7b, 0x93, 0x63, 0x23, 0x01, 0x2a, 0x34, 0xb2]' + - actual: records[1].value + expected: '[0x39, 0xb2]' diff --git a/spec/ks/repeat_n_term_struct.kst b/spec/ks/repeat_n_term_struct.kst new file mode 100644 index 000000000..62b91b3c5 --- /dev/null +++ b/spec/ks/repeat_n_term_struct.kst @@ -0,0 +1,23 @@ +id: repeat_n_term_struct +data: repeat_until_process.bin +asserts: + - actual: records1.size + expected: 2 + - actual: records1[0].value + expected: '[0xe8, 0xba]' + - actual: records1[1].value + expected: '[].as' + + - actual: records2.size + expected: 2 + - actual: records2[0].value + expected: '[0xaa]' + - actual: records2[1].value + expected: '[0xfa, 0x9e, 0xb8, 0xaa]' + + - actual: records3.size + expected: 2 + - actual: records3[0].value + expected: '[0xaa, 0xaa]' + - actual: records3[1].value + expected: '[].as' diff --git a/spec/ks/repeat_until_term_struct.kst b/spec/ks/repeat_until_term_struct.kst new file mode 100644 index 000000000..9d8f6a4fc --- /dev/null +++ b/spec/ks/repeat_until_term_struct.kst @@ -0,0 +1,23 @@ +id: repeat_until_term_struct +data: repeat_until_process.bin +asserts: + - actual: records1.size + expected: 2 + - actual: records1[0].value + expected: '[0xe8, 0xba]' + - actual: records1[1].value + expected: '[].as' + + - actual: records2.size + expected: 2 + - actual: records2[0].value + expected: '[0xaa]' + - actual: records2[1].value + expected: '[0xfa, 0x9e, 0xb8, 0xaa]' + + - actual: records3.size + expected: 2 + - actual: records3[0].value + expected: '[0xaa, 0xaa]' + - actual: records3[1].value + expected: '[].as' From 53440a971e1ef3d2131f1f7cab223cc0bc82b626 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Fri, 23 Dec 2022 17:11:06 +0100 Subject: [PATCH 063/126] Add ProcessTermStruct --- formats/process_term_struct.ksy | 34 +++++++++++++++++++ .../struct/spec/TestProcessTermStruct.java | 18 ++++++++++ .../specwrite/TestProcessTermStruct.java | 20 +++++++++++ spec/ks/process_term_struct.kst | 9 +++++ 4 files changed, 81 insertions(+) create mode 100644 formats/process_term_struct.ksy create mode 100644 spec/java/src/io/kaitai/struct/spec/TestProcessTermStruct.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestProcessTermStruct.java create mode 100644 spec/ks/process_term_struct.kst diff --git a/formats/process_term_struct.ksy b/formats/process_term_struct.ksy new file mode 100644 index 000000000..937a3eed3 --- /dev/null +++ b/formats/process_term_struct.ksy @@ -0,0 +1,34 @@ +# Like "term_struct", but the parsed bytes go through `process` before they are passed to +# the user type `bytes_wrapper`. +# +# We use a custom process `my_custom_fx` (not usual built-in ones like `process: +# xor(key)`), for which the compiler doesn't know whether it preserves the byte size when +# decoding/encoding. This is important, we want this test to demonstrate a case when both +# the *outer size* (the length of the byte array read directly from the file, which will +# be the input to the `process` decoder) and the *inner size* (exact length of the +# substream created from the decoded bytes) are unknown at serialization and must be both +# specified by the user. We cannot use the built-in processes `xor`, `rol` or `ror` +# because the compiler knows that these preserve the length of the input, and therefore +# once the *outer size* is known, *inner size* is also known because it's the same. +meta: + id: process_term_struct +seq: + - id: s1 + terminator: 0x7c + process: my_custom_fx(0x20, false, [0]) + type: bytes_wrapper + - id: s2 + terminator: 0x7c + consume: false + process: my_custom_fx(0x20, false, [0]) + type: bytes_wrapper + - id: s3 + terminator: 0x40 + include: true + process: my_custom_fx(0x20, false, [0]) + type: bytes_wrapper +types: + bytes_wrapper: + seq: + - id: value + size-eos: true diff --git a/spec/java/src/io/kaitai/struct/spec/TestProcessTermStruct.java b/spec/java/src/io/kaitai/struct/spec/TestProcessTermStruct.java new file mode 100644 index 000000000..71031d196 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestProcessTermStruct.java @@ -0,0 +1,18 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.ProcessTermStruct; +import org.testng.annotations.Test; +import static org.testng.Assert.*; +public class TestProcessTermStruct extends CommonSpec { + + @Test + public void testProcessTermStruct() throws Exception { + ProcessTermStruct r = ProcessTermStruct.fromFile(SRC_DIR + "term_strz.bin"); + + assertEquals(r.s1().value(), new byte[] { 70, 79, 79 }); + assertEquals(r.s2().value(), new byte[] { 66, 65, 82 }); + assertEquals(r.s3().value(), new byte[] { 92, 66, 65, 90, 32 }); + } +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestProcessTermStruct.java b/spec/java/src/io/kaitai/struct/specwrite/TestProcessTermStruct.java new file mode 100644 index 000000000..d0ace7853 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestProcessTermStruct.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ProcessTermStruct; +import org.testng.annotations.Test; + +public class TestProcessTermStruct extends CommonSpec { + @Override + protected Class getStructClass() { + return ProcessTermStruct.class; + } + + @Override + protected String getSrcFilename() { + return "term_strz.bin"; + } + +} diff --git a/spec/ks/process_term_struct.kst b/spec/ks/process_term_struct.kst new file mode 100644 index 000000000..cb8228bfa --- /dev/null +++ b/spec/ks/process_term_struct.kst @@ -0,0 +1,9 @@ +id: process_term_struct +data: term_strz.bin +asserts: + - actual: s1.value + expected: '[0x46, 0x4f, 0x4f]' + - actual: s2.value + expected: '[0x42, 0x41, 0x52]' + - actual: s3.value + expected: '[0x5c, 0x42, 0x41, 0x5a, 0x20]' From 010efd1d9c07a61a320a644d4e782dd488ba28e4 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Sun, 25 Dec 2022 13:43:47 +0100 Subject: [PATCH 064/126] Remove unneeded alignToByte() calls in write tests The byte alignment is now handled in the runtime library itself: https://github.com/kaitai-io/kaitai_struct_java_runtime/commit/1bc75aa91199588a1cb12a5a1c672b80b66619ac In addition, calling alignToByte() after _write() is actually wrong, because it discards the unaligned bits. We would have to call writeAlignToByte() instead. But even better is to let the runtime library deal with it. --- spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestExpr2.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestInstanceStd.java | 1 - 3 files changed, 3 deletions(-) diff --git a/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java b/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java index 3c8233e48..bdd70b8ee 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java +++ b/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java @@ -39,7 +39,6 @@ protected void testReadWriteRoundtrip() throws Exception { ByteBufferKaitaiStream newIo = new ByteBufferKaitaiStream(origKs._io().size()); origKs._write(newIo); - newIo.alignToByte(); newIo.seek(0); KaitaiStruct.ReadWrite newKs = structClass diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestExpr2.java b/spec/java/src/io/kaitai/struct/specwrite/TestExpr2.java index a8a5df42c..ff3bc1b0a 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestExpr2.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestExpr2.java @@ -54,7 +54,6 @@ public void testEdit() throws Exception { 3 // str2.rest ); r._write(newIo); - newIo.alignToByte(); newIo.seek(0); Expr2 newR = new Expr2(newIo); diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestInstanceStd.java b/spec/java/src/io/kaitai/struct/specwrite/TestInstanceStd.java index a6aad39a1..20f2afbe2 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestInstanceStd.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestInstanceStd.java @@ -63,7 +63,6 @@ public void testWrite() throws Exception { KaitaiStream io = new ByteBufferKaitaiStream(2 + 5); r._write(io); - io.alignToByte(); io.seek(0); r._writeHeader(); From 0fb06a5a75d77111abf4eab85542f5c61cc39a87 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Sat, 31 Dec 2022 17:49:31 +0100 Subject: [PATCH 065/126] Add test case to ProcessRotate for a size check in _write() --- .../struct/specwrite/TestProcessRotate.java | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestProcessRotate.java b/spec/java/src/io/kaitai/struct/specwrite/TestProcessRotate.java index 829c75735..e9aa64677 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestProcessRotate.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestProcessRotate.java @@ -1,5 +1,6 @@ package io.kaitai.struct.specwrite; +import io.kaitai.struct.ByteBufferKaitaiStream; import io.kaitai.struct.ConsistencyError; import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.ProcessRotate; @@ -22,7 +23,7 @@ public void testProcessRotate() throws Exception { } @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: buf2,.*") - public void checkSizeMismatch() throws Exception { + public void checkSizeMismatchCheck() throws Exception { ProcessRotate r = new ProcessRotate(); r.setBuf1("Hello".getBytes()); @@ -31,6 +32,31 @@ public void checkSizeMismatch() throws Exception { r._check(); } + @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: buf2,.*") + public void checkSizeMismatchCheckOrWrite() throws Exception { + ProcessRotate r = new ProcessRotate(); + + r.setBuf1("Hello".getBytes()); + r.setBuf2("Way too long".getBytes()); + r.setKey(1); + r.setBuf3("There".getBytes()); + + r._check(); + + // It would be more user-friendly if the size mismatch of `buf2` was caught already in + // _check(), as tested by the previous test case checkSizeMismatchCheck() (this is possible + // because it's known that `process: rol/ror(...)` preserve the input length, so the length + // of `buf2` is the same as the length of `_raw_buf2` which actually gets written). But if + // the compiler implementation doesn't want to distinguish among `process` types here, just + // a check in _write() is probably acceptable as well. + r._write(new ByteBufferKaitaiStream( + 5 + // buf1 + 5 + // buf2 + 1 + // key + 5 // buf3 + )); + } + @Override protected Class getStructClass() { return ProcessRotate.class; From 19868912b00ed8f60787e032df62e783c5e18dc6 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Sat, 31 Dec 2022 19:24:02 +0100 Subject: [PATCH 066/126] Add a test case to StrEos for residual bytes after `size-eos: true` --- .../io/kaitai/struct/specwrite/TestStrEos.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestStrEos.java b/spec/java/src/io/kaitai/struct/specwrite/TestStrEos.java index b6704d820..a3c00a263 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestStrEos.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestStrEos.java @@ -1,12 +1,22 @@ -// Autogenerated from KST: please remove this line if doing any edits by hand! - package io.kaitai.struct.specwrite; +import io.kaitai.struct.ByteBufferKaitaiStream; +import io.kaitai.struct.ConsistencyError; import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.StrEos; import org.testng.annotations.Test; public class TestStrEos extends CommonSpec { + @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: str, expected: 0, actual: 2") + public void checkLongerIo() throws Exception { + StrEos r = new StrEos(); + + r.setStr("Hello"); + + r._check(); + r._write(new ByteBufferKaitaiStream(5 + 2)); + } + @Override protected Class getStructClass() { return StrEos.class; @@ -16,5 +26,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "term_strz.bin"; } - } From 6a537fb618610bc6d59f61fa39bf8d131c5b09b8 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Sat, 31 Dec 2022 20:09:56 +0100 Subject: [PATCH 067/126] Add a case to RepeatEosBytes on residual bytes after `repeat: eos` --- .../struct/specwrite/TestRepeatEosBytes.java | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosBytes.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosBytes.java index bee8471fe..54815903f 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosBytes.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosBytes.java @@ -1,12 +1,32 @@ -// Autogenerated from KST: please remove this line if doing any edits by hand! - package io.kaitai.struct.specwrite; +import io.kaitai.struct.ByteBufferKaitaiStream; +import io.kaitai.struct.ConsistencyError; import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.RepeatEosBytes; + +import java.util.ArrayList; +import java.util.Arrays; + import org.testng.annotations.Test; public class TestRepeatEosBytes extends CommonSpec { + @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: records, expected: 0, actual: 3") + public void checkLongerIo() throws Exception { + RepeatEosBytes r = new RepeatEosBytes(); + + r.setRecords(new ArrayList<>( + Arrays.asList( + new byte[] { -24, -70, -86, -86, -86 }, + new byte[] { -6, -98, -72, -86, -86 }, + new byte[] { -86, 85, 85, 85, 85 } + ) + )); + + r._check(); + r._write(new ByteBufferKaitaiStream(15 + 3)); + } + @Override protected Class getStructClass() { return RepeatEosBytes.class; @@ -16,5 +36,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "repeat_until_process.bin"; } - } From c5a451e1c04e8d570e6f2255e5a3b2162a51c39e Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Sun, 1 Jan 2023 10:56:58 +0100 Subject: [PATCH 068/126] Add a case to TermBytes4 for EOF after `include: true` without term --- .../struct/specwrite/TestTermBytes4.java | 44 +++++++++++++++++-- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestTermBytes4.java b/spec/java/src/io/kaitai/struct/specwrite/TestTermBytes4.java index 37e9b3c79..7bff6b7f0 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestTermBytes4.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestTermBytes4.java @@ -1,12 +1,51 @@ -// Autogenerated from KST: please remove this line if doing any edits by hand! - package io.kaitai.struct.specwrite; +import io.kaitai.struct.ByteBufferKaitaiStream; +import io.kaitai.struct.ConsistencyError; +import io.kaitai.struct.KaitaiStream; import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.TermBytes4; import org.testng.annotations.Test; public class TestTermBytes4 extends CommonSpec { + @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: value, expected: 0, actual: 1") + public void checkIsEofAfterIncludeTermMissing() { + TermBytes4 r = new TermBytes4(); + + TermBytes4.S1Type s1 = new TermBytes4.S1Type(); + s1.setValue(new byte[] { 102, 111, 111 }); + s1._check(); + r.setS1(s1); + + r.setSkipTerm1(0x7c); + + TermBytes4.S2Type s2 = new TermBytes4.S2Type(); + s2.setValue(new byte[] { 98, 97, 114 }); + s2._check(); + r.setS2(s2); + + r.setSkipTerm2(0x7c); + + TermBytes4.S3Type s3 = new TermBytes4.S3Type(); + // this field with `include: true` and `eos-error: false` does not end with the terminator, + // but there is 1 byte left in the stream => consistency error + s3.setValue(new byte[] { 98, 97 }); + s3._check(); + r.setS3(s3); + + r._check(); + + KaitaiStream io = new ByteBufferKaitaiStream( + 3 + // s1 + 1 + // skip_term1 + 3 + // s2 + 1 + // skip_term2 + 3 // s3 + ); + + r._write(io); // should throw a ConsistencyError + } + @Override protected Class getStructClass() { return TermBytes4.class; @@ -16,5 +55,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "term_strz.bin"; } - } From 218127fc9e138612c8aa193ca9dea2dd854cb949 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Sun, 1 Jan 2023 15:58:04 +0100 Subject: [PATCH 069/126] Add test case to SwitchManualIntSize for byte size mismatch check --- .../struct/specwrite/TestSwitchManualIntSize.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualIntSize.java b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualIntSize.java index af7cbb27c..f4bf44b8d 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualIntSize.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualIntSize.java @@ -1,12 +1,22 @@ -// Autogenerated from KST: please remove this line if doing any edits by hand! - package io.kaitai.struct.specwrite; +import io.kaitai.struct.ConsistencyError; import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.SwitchManualIntSize; import org.testng.annotations.Test; public class TestSwitchManualIntSize extends CommonSpec { + @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: body, expected: 3, actual: 2") + public void checkSwitchBytesSizeMismatch() { + SwitchManualIntSize.Chunk chunk = new SwitchManualIntSize.Chunk(); + chunk.setCode(0x33); + chunk.setSize(3); + // should cause the consistency check to fail because it's 2 bytes, not 3 + chunk.setBody(new byte[] { 0x10, 0x20 }); + + chunk._check(); + } + @Override protected Class getStructClass() { return SwitchManualIntSize.class; @@ -16,5 +26,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "switch_tlv.bin"; } - } From a3d967d81806a266925145bf93fd2fdc5c2c083d Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Sun, 1 Jan 2023 22:43:10 +0100 Subject: [PATCH 070/126] Add ParamsPass{,Array}Io --- formats/params_pass_array_io.ksy | 20 +++++++++++++++++++ formats/params_pass_io.ksy | 20 +++++++++++++++++++ .../struct/spec/TestParamsPassArrayIo.java | 17 ++++++++++++++++ .../kaitai/struct/spec/TestParamsPassIo.java | 17 ++++++++++++++++ .../kaitai/struct/specwrite/CommonSpec.java | 17 ++++++++++------ .../specwrite/TestParamsPassArrayIo.java | 20 +++++++++++++++++++ .../struct/specwrite/TestParamsPassIo.java | 20 +++++++++++++++++++ spec/ks/params_pass_array_io.kst | 7 +++++++ spec/ks/params_pass_io.kst | 7 +++++++ 9 files changed, 139 insertions(+), 6 deletions(-) create mode 100644 formats/params_pass_array_io.ksy create mode 100644 formats/params_pass_io.ksy create mode 100644 spec/java/src/io/kaitai/struct/spec/TestParamsPassArrayIo.java create mode 100644 spec/java/src/io/kaitai/struct/spec/TestParamsPassIo.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestParamsPassArrayIo.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestParamsPassIo.java create mode 100644 spec/ks/params_pass_array_io.kst create mode 100644 spec/ks/params_pass_io.kst diff --git a/formats/params_pass_array_io.ksy b/formats/params_pass_array_io.ksy new file mode 100644 index 000000000..e7e8c5ddb --- /dev/null +++ b/formats/params_pass_array_io.ksy @@ -0,0 +1,20 @@ +meta: + id: params_pass_array_io +seq: + - id: first + size: 1 + type: block + - id: one + type: 'param_type([first._io, _root._io])' +types: + block: + seq: + - id: foo + type: u1 + param_type: + params: + - id: arg_streams + type: io[] + seq: + - id: buf + size: arg_streams[0].size diff --git a/formats/params_pass_io.ksy b/formats/params_pass_io.ksy new file mode 100644 index 000000000..dbdb5332b --- /dev/null +++ b/formats/params_pass_io.ksy @@ -0,0 +1,20 @@ +meta: + id: params_pass_io +seq: + - id: first + size: 1 + type: block + - id: one + type: 'param_type(first.foo == 0xff ? first._io : _root._io)' +types: + block: + seq: + - id: foo + type: u1 + param_type: + params: + - id: arg_stream + type: io + seq: + - id: buf + size: arg_stream.size diff --git a/spec/java/src/io/kaitai/struct/spec/TestParamsPassArrayIo.java b/spec/java/src/io/kaitai/struct/spec/TestParamsPassArrayIo.java new file mode 100644 index 000000000..45799518b --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestParamsPassArrayIo.java @@ -0,0 +1,17 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.ParamsPassArrayIo; +import org.testng.annotations.Test; +import static org.testng.Assert.*; +public class TestParamsPassArrayIo extends CommonSpec { + + @Test + public void testParamsPassArrayIo() throws Exception { + ParamsPassArrayIo r = ParamsPassArrayIo.fromFile(SRC_DIR + "enum_negative.bin"); + + assertIntEquals(r.first().foo(), 255); + assertEquals(r.one().buf(), new byte[] { 1 }); + } +} diff --git a/spec/java/src/io/kaitai/struct/spec/TestParamsPassIo.java b/spec/java/src/io/kaitai/struct/spec/TestParamsPassIo.java new file mode 100644 index 000000000..f3efafdde --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestParamsPassIo.java @@ -0,0 +1,17 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.ParamsPassIo; +import org.testng.annotations.Test; +import static org.testng.Assert.*; +public class TestParamsPassIo extends CommonSpec { + + @Test + public void testParamsPassIo() throws Exception { + ParamsPassIo r = ParamsPassIo.fromFile(SRC_DIR + "enum_negative.bin"); + + assertIntEquals(r.first().foo(), 255); + assertEquals(r.one().buf(), new byte[] { 1 }); + } +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java b/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java index bdd70b8ee..2f8ac6f30 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java +++ b/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java @@ -165,12 +165,6 @@ protected static Object dumpStructValue( } parentStructs.remove(struct); value = dump; - } else if (value instanceof byte[]) { - StringBuilder sb = new StringBuilder(); - for (byte b : (byte[]) value) { - sb.append(String.format("%02x ", b)); - } - value = "[" + sb.substring(0, sb.length() - (sb.length() != 0 && sb.charAt(sb.length() - 1) == ' ' ? 1 : 0)) + "]"; } else if (value instanceof List) { List list = (List) value; List out = new ArrayList<>(); @@ -181,6 +175,17 @@ protected static Object dumpStructValue( )); } value = out; + } else { + if (value instanceof KaitaiStream) { + value = ((KaitaiStream) value).toByteArray(); + } + if (value instanceof byte[]) { + StringBuilder sb = new StringBuilder(); + for (byte b : (byte[]) value) { + sb.append(String.format("%02x ", b)); + } + value = "[" + sb.substring(0, sb.length() - (sb.length() != 0 && sb.charAt(sb.length() - 1) == ' ' ? 1 : 0)) + "]"; + } } return value; diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassArrayIo.java b/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassArrayIo.java new file mode 100644 index 000000000..aaff8f7b2 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassArrayIo.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ParamsPassArrayIo; +import org.testng.annotations.Test; + +public class TestParamsPassArrayIo extends CommonSpec { + @Override + protected Class getStructClass() { + return ParamsPassArrayIo.class; + } + + @Override + protected String getSrcFilename() { + return "enum_negative.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassIo.java b/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassIo.java new file mode 100644 index 000000000..6623fb857 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassIo.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ParamsPassIo; +import org.testng.annotations.Test; + +public class TestParamsPassIo extends CommonSpec { + @Override + protected Class getStructClass() { + return ParamsPassIo.class; + } + + @Override + protected String getSrcFilename() { + return "enum_negative.bin"; + } + +} diff --git a/spec/ks/params_pass_array_io.kst b/spec/ks/params_pass_array_io.kst new file mode 100644 index 000000000..6e34a6d46 --- /dev/null +++ b/spec/ks/params_pass_array_io.kst @@ -0,0 +1,7 @@ +id: params_pass_array_io +data: enum_negative.bin +asserts: + - actual: first.foo + expected: 255 + - actual: one.buf + expected: '[1]' diff --git a/spec/ks/params_pass_io.kst b/spec/ks/params_pass_io.kst new file mode 100644 index 000000000..3cddc4aca --- /dev/null +++ b/spec/ks/params_pass_io.kst @@ -0,0 +1,7 @@ +id: params_pass_io +data: enum_negative.bin +asserts: + - actual: first.foo + expected: 255 + - actual: one.buf + expected: '[1]' From 9bbbc1af6dfd48ddd9d4c643a2e863c8b337b908 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Mon, 2 Jan 2023 15:00:31 +0100 Subject: [PATCH 071/126] Fix tests with wrong `_root`/`_parent` now checked by _check() See https://github.com/kaitai-io/kaitai_struct_compiler/commit/2accf38eb010a242b73aaf65f9ed0a213778b9b0 --- .../src/io/kaitai/struct/specwrite/TestProcessToUser.java | 6 +++--- .../java/src/io/kaitai/struct/specwrite/TestTermBytes4.java | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestProcessToUser.java b/spec/java/src/io/kaitai/struct/specwrite/TestProcessToUser.java index 7f8825627..1a596e388 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestProcessToUser.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestProcessToUser.java @@ -10,10 +10,10 @@ public void testProcessToUser() throws Exception { // NOTE: unlike the automatic roundtrip test, the `_raw_*` fields are set to `null` in this // manual test, so "cheating" by just writing them is impossible - ProcessToUser.JustStr buf1 = new ProcessToUser.JustStr(); - buf1.setStr("Hello"); - ProcessToUser r = new ProcessToUser(); + + ProcessToUser.JustStr buf1 = new ProcessToUser.JustStr(null, r, r._root()); + buf1.setStr("Hello"); r.setBuf1(buf1); assertEqualToFile(r, "process_rotate.bin"); diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestTermBytes4.java b/spec/java/src/io/kaitai/struct/specwrite/TestTermBytes4.java index 7bff6b7f0..26cb39f9a 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestTermBytes4.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestTermBytes4.java @@ -12,21 +12,21 @@ public class TestTermBytes4 extends CommonSpec { public void checkIsEofAfterIncludeTermMissing() { TermBytes4 r = new TermBytes4(); - TermBytes4.S1Type s1 = new TermBytes4.S1Type(); + TermBytes4.S1Type s1 = new TermBytes4.S1Type(null, r, r._root()); s1.setValue(new byte[] { 102, 111, 111 }); s1._check(); r.setS1(s1); r.setSkipTerm1(0x7c); - TermBytes4.S2Type s2 = new TermBytes4.S2Type(); + TermBytes4.S2Type s2 = new TermBytes4.S2Type(null, r, r._root()); s2.setValue(new byte[] { 98, 97, 114 }); s2._check(); r.setS2(s2); r.setSkipTerm2(0x7c); - TermBytes4.S3Type s3 = new TermBytes4.S3Type(); + TermBytes4.S3Type s3 = new TermBytes4.S3Type(null, r, r._root()); // this field with `include: true` and `eos-error: false` does not end with the terminator, // but there is 1 byte left in the stream => consistency error s3.setValue(new byte[] { 98, 97 }); From 4825dfc49b1b7e94c26fdcd13a76db0fc54e729f Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Mon, 13 Feb 2023 14:17:23 +0100 Subject: [PATCH 072/126] Bump KST translator to 0.11-SNAPSHOT, use KSC 0.11-SNAPSHOT --- translator/build.sbt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/translator/build.sbt b/translator/build.sbt index 96134e48b..1cf8771e7 100644 --- a/translator/build.sbt +++ b/translator/build.sbt @@ -1,6 +1,6 @@ name := "translator" -version := "0.10-SNAPSHOT" +version := "0.11-SNAPSHOT" scalaVersion := "2.12.12" @@ -8,7 +8,7 @@ resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repos resolvers += Resolver.sonatypeRepo("public") libraryDependencies ++= Seq( - "io.kaitai" % "kaitai-struct-compiler_2.12" % "0.10-SNAPSHOT", + "io.kaitai" % "kaitai-struct-compiler_2.12" % "0.11-SNAPSHOT", "com.github.scopt" % "scopt_2.12" % "3.7.1", "org.yaml" % "snakeyaml" % "1.16" ) From 1e1035c03f25fe83f8e7d76082f3ed7f76ba49d4 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Fri, 17 Feb 2023 21:02:42 +0100 Subject: [PATCH 073/126] Regen existing Python tests from KST --- spec/python/test_bcd_user_type_be.py | 1 + spec/python/test_bcd_user_type_le.py | 1 + spec/python/test_bits_byte_aligned.py | 1 + spec/python/test_bits_enum.py | 1 + spec/python/test_bits_simple.py | 1 + spec/python/test_buffered_struct.py | 1 + spec/python/test_bytes_pad_term.py | 1 + spec/python/test_cast_nested.py | 1 + spec/python/test_cast_to_imported.py | 1 + spec/python/test_cast_to_top.py | 1 + spec/python/test_debug_enum_name.py | 7 ++++--- spec/python/test_default_big_endian.py | 1 + spec/python/test_default_endian_expr_inherited.py | 1 + spec/python/test_default_endian_expr_is_be.py | 1 + spec/python/test_default_endian_expr_is_le.py | 1 + spec/python/test_default_endian_mod.py | 1 + spec/python/test_docstrings.py | 1 + spec/python/test_docstrings_docref.py | 1 + spec/python/test_docstrings_docref_multi.py | 1 + spec/python/test_enum_0.py | 1 + spec/python/test_enum_1.py | 1 + spec/python/test_enum_deep.py | 1 + spec/python/test_enum_deep_literals.py | 1 + spec/python/test_enum_fancy.py | 1 + spec/python/test_enum_if.py | 1 + spec/python/test_enum_import.py | 8 ++++---- spec/python/test_enum_negative.py | 1 + spec/python/test_enum_of_value_inst.py | 1 + spec/python/test_expr_0.py | 1 + spec/python/test_expr_1.py | 1 + spec/python/test_expr_2.py | 1 + spec/python/test_expr_3.py | 1 + spec/python/test_expr_array.py | 3 +-- spec/python/test_expr_bytes_cmp.py | 1 + spec/python/test_expr_enum.py | 1 + spec/python/test_expr_if_int_ops.py | 8 +++++--- spec/python/test_expr_io_eof.py | 11 +++++------ spec/python/test_expr_io_pos.py | 1 + spec/python/test_expr_mod.py | 1 + spec/python/test_expr_sizeof_type_0.py | 1 + spec/python/test_expr_sizeof_type_1.py | 1 + spec/python/test_expr_sizeof_value_0.py | 1 + spec/python/test_expr_sizeof_value_sized.py | 1 + spec/python/test_fixed_contents.py | 1 + spec/python/test_fixed_struct.py | 1 + spec/python/test_float_to_i.py | 10 ++++++++-- spec/python/test_floating_points.py | 1 + spec/python/test_hello_world.py | 1 + spec/python/test_if_instances.py | 1 + spec/python/test_if_struct.py | 1 + spec/python/test_if_values.py | 1 + spec/python/test_imports0.py | 1 + spec/python/test_imports_abs.py | 1 + spec/python/test_index_sizes.py | 1 + spec/python/test_index_to_param_eos.py | 1 + spec/python/test_index_to_param_expr.py | 1 + spec/python/test_index_to_param_until.py | 1 + spec/python/test_instance_io_user.py | 1 + spec/python/test_instance_std.py | 1 + spec/python/test_instance_std_array.py | 1 + spec/python/test_instance_user_array.py | 1 + spec/python/test_integers.py | 1 + spec/python/test_io_local_var.py | 1 + spec/python/test_js_signed_right_shift.py | 1 + spec/python/test_meta_tags.py | 1 + spec/python/test_meta_xref.py | 1 + spec/python/test_multiple_use.py | 1 + spec/python/test_nav_parent.py | 1 + spec/python/test_nav_parent2.py | 1 + spec/python/test_nav_parent3.py | 1 + spec/python/test_nav_parent_false.py | 1 + spec/python/test_nav_parent_false2.py | 1 + spec/python/test_nav_parent_override.py | 1 + spec/python/test_nav_parent_switch.py | 1 + spec/python/test_nav_parent_vs_value_inst.py | 1 + spec/python/test_nav_root.py | 1 + spec/python/test_nested_same_name.py | 1 + spec/python/test_nested_same_name2.py | 1 + spec/python/test_nested_types.py | 1 + spec/python/test_nested_types2.py | 1 + spec/python/test_nested_types3.py | 1 + spec/python/test_non_standard.py | 1 + spec/python/test_params_call_short.py | 1 + spec/python/test_params_enum.py | 1 + spec/python/test_params_pass_usertype.py | 1 + spec/python/test_position_abs.py | 1 + spec/python/test_position_in_seq.py | 1 + spec/python/test_position_to_end.py | 1 + spec/python/test_process_coerce_bytes.py | 1 + spec/python/test_process_coerce_switch.py | 1 + spec/python/test_process_coerce_usertype1.py | 1 + spec/python/test_process_coerce_usertype2.py | 1 + spec/python/test_process_custom.py | 1 + spec/python/test_process_rotate.py | 1 + spec/python/test_process_to_user.py | 1 + spec/python/test_process_xor4_const.py | 1 + spec/python/test_process_xor4_value.py | 1 + spec/python/test_process_xor_const.py | 1 + spec/python/test_process_xor_value.py | 1 + spec/python/test_recursive_one.py | 1 + spec/python/test_repeat_eos_bit.py | 1 + spec/python/test_repeat_eos_struct.py | 1 + spec/python/test_repeat_eos_u4.py | 1 + spec/python/test_repeat_n_struct.py | 1 + spec/python/test_repeat_n_strz.py | 1 + spec/python/test_repeat_n_strz_double.py | 1 + spec/python/test_repeat_until_complex.py | 1 + spec/python/test_repeat_until_s4.py | 1 + spec/python/test_repeat_until_sized.py | 1 + spec/python/test_str_encodings.py | 1 + spec/python/test_str_encodings_default.py | 1 + spec/python/test_str_eos.py | 1 + spec/python/test_str_literals2.py | 1 + spec/python/test_str_pad_term.py | 1 + spec/python/test_str_pad_term_empty.py | 1 + spec/python/test_switch_bytearray.py | 1 + spec/python/test_switch_integers.py | 1 + spec/python/test_switch_integers2.py | 1 + spec/python/test_switch_manual_enum.py | 1 + spec/python/test_switch_manual_enum_invalid.py | 14 ++++++-------- spec/python/test_switch_manual_int.py | 1 + spec/python/test_switch_manual_int_else.py | 1 + spec/python/test_switch_manual_int_size_else.py | 1 + spec/python/test_switch_manual_str.py | 1 + spec/python/test_switch_manual_str_else.py | 1 + spec/python/test_term_bytes.py | 1 + spec/python/test_term_strz.py | 1 + spec/python/test_ts_packet_header.py | 1 + spec/python/test_type_int_unary_op.py | 1 + spec/python/test_type_ternary.py | 1 + spec/python/test_type_ternary_2nd_falsy.py | 2 +- spec/python/test_user_type.py | 1 + spec/python/test_zlib_with_header_78.py | 1 + 133 files changed, 159 insertions(+), 29 deletions(-) diff --git a/spec/python/test_bcd_user_type_be.py b/spec/python/test_bcd_user_type_be.py index 12dcfcd72..2364d1ec1 100644 --- a/spec/python/test_bcd_user_type_be.py +++ b/spec/python/test_bcd_user_type_be.py @@ -7,6 +7,7 @@ class TestBcdUserTypeBe(unittest.TestCase): def test_bcd_user_type_be(self): with BcdUserTypeBe.from_file('src/bcd_user_type_be.bin') as r: + self.assertEqual(r.ltr.as_int, 12345678) self.assertEqual(r.ltr.as_str, u"12345678") self.assertEqual(r.rtl.as_int, 87654321) diff --git a/spec/python/test_bcd_user_type_le.py b/spec/python/test_bcd_user_type_le.py index a31d8b64f..eb1b96db5 100644 --- a/spec/python/test_bcd_user_type_le.py +++ b/spec/python/test_bcd_user_type_le.py @@ -7,6 +7,7 @@ class TestBcdUserTypeLe(unittest.TestCase): def test_bcd_user_type_le(self): with BcdUserTypeLe.from_file('src/bcd_user_type_le.bin') as r: + self.assertEqual(r.ltr.as_int, 12345678) self.assertEqual(r.ltr.as_str, u"12345678") self.assertEqual(r.rtl.as_int, 87654321) diff --git a/spec/python/test_bits_byte_aligned.py b/spec/python/test_bits_byte_aligned.py index 4ad37a903..01f7ae315 100644 --- a/spec/python/test_bits_byte_aligned.py +++ b/spec/python/test_bits_byte_aligned.py @@ -7,6 +7,7 @@ class TestBitsByteAligned(unittest.TestCase): def test_bits_byte_aligned(self): with BitsByteAligned.from_file('src/fixed_struct.bin') as r: + self.assertEqual(r.one, 20) self.assertEqual(r.byte_1, 65) self.assertEqual(r.two, 2) diff --git a/spec/python/test_bits_enum.py b/spec/python/test_bits_enum.py index 819556b22..1932db7a4 100644 --- a/spec/python/test_bits_enum.py +++ b/spec/python/test_bits_enum.py @@ -7,6 +7,7 @@ class TestBitsEnum(unittest.TestCase): def test_bits_enum(self): with BitsEnum.from_file('src/fixed_struct.bin') as r: + self.assertEqual(r.one, BitsEnum.Animal.platypus) self.assertEqual(r.two, BitsEnum.Animal.horse) self.assertEqual(r.three, BitsEnum.Animal.cat) diff --git a/spec/python/test_bits_simple.py b/spec/python/test_bits_simple.py index 69cd9889e..6a36fc362 100644 --- a/spec/python/test_bits_simple.py +++ b/spec/python/test_bits_simple.py @@ -7,6 +7,7 @@ class TestBitsSimple(unittest.TestCase): def test_bits_simple(self): with BitsSimple.from_file('src/fixed_struct.bin') as r: + self.assertEqual(r.byte_1, 80) self.assertEqual(r.byte_2, 65) self.assertEqual(r.bits_a, False) diff --git a/spec/python/test_buffered_struct.py b/spec/python/test_buffered_struct.py index d8c6688b4..2933808cb 100644 --- a/spec/python/test_buffered_struct.py +++ b/spec/python/test_buffered_struct.py @@ -7,6 +7,7 @@ class TestBufferedStruct(unittest.TestCase): def test_buffered_struct(self): with BufferedStruct.from_file('src/buffered_struct.bin') as r: + self.assertEqual(r.len1, 16) self.assertEqual(r.block1.number1, 66) self.assertEqual(r.block1.number2, 67) diff --git a/spec/python/test_bytes_pad_term.py b/spec/python/test_bytes_pad_term.py index 65dad5766..7e6f15cd2 100644 --- a/spec/python/test_bytes_pad_term.py +++ b/spec/python/test_bytes_pad_term.py @@ -7,6 +7,7 @@ class TestBytesPadTerm(unittest.TestCase): def test_bytes_pad_term(self): with BytesPadTerm.from_file('src/str_pad_term.bin') as r: + self.assertEqual(r.str_pad, b"\x73\x74\x72\x31") self.assertEqual(r.str_term, b"\x73\x74\x72\x32\x66\x6F\x6F") self.assertEqual(r.str_term_and_pad, b"\x73\x74\x72\x2B\x2B\x2B\x33\x62\x61\x72\x2B\x2B\x2B") diff --git a/spec/python/test_cast_nested.py b/spec/python/test_cast_nested.py index 500def4cb..131e706b5 100644 --- a/spec/python/test_cast_nested.py +++ b/spec/python/test_cast_nested.py @@ -7,6 +7,7 @@ class TestCastNested(unittest.TestCase): def test_cast_nested(self): with CastNested.from_file('src/switch_opcodes.bin') as r: + self.assertEqual(r.opcodes_0_str.value, u"foobar") self.assertEqual(r.opcodes_0_str_value, u"foobar") self.assertEqual(r.opcodes_1_int.value, 66) diff --git a/spec/python/test_cast_to_imported.py b/spec/python/test_cast_to_imported.py index 432eeaedc..671912b5f 100644 --- a/spec/python/test_cast_to_imported.py +++ b/spec/python/test_cast_to_imported.py @@ -7,5 +7,6 @@ class TestCastToImported(unittest.TestCase): def test_cast_to_imported(self): with CastToImported.from_file('src/fixed_struct.bin') as r: + self.assertEqual(r.one.one, 80) self.assertEqual(r.one_casted.one, 80) diff --git a/spec/python/test_cast_to_top.py b/spec/python/test_cast_to_top.py index ca733bbf9..7d074781d 100644 --- a/spec/python/test_cast_to_top.py +++ b/spec/python/test_cast_to_top.py @@ -7,6 +7,7 @@ class TestCastToTop(unittest.TestCase): def test_cast_to_top(self): with CastToTop.from_file('src/fixed_struct.bin') as r: + self.assertEqual(r.code, 80) self.assertEqual(r.header.code, 65) self.assertEqual(r.header_casted.code, 65) diff --git a/spec/python/test_debug_enum_name.py b/spec/python/test_debug_enum_name.py index 2421f2953..d756951c4 100644 --- a/spec/python/test_debug_enum_name.py +++ b/spec/python/test_debug_enum_name.py @@ -4,7 +4,8 @@ class TestDebugEnumName(unittest.TestCase): def test_debug_enum_name(self): - r = DebugEnumName.from_file("src/fixed_struct.bin") + with DebugEnumName.from_file('src/fixed_struct.bin') as r: + # this test is meaningful only for languages that have --debug and do + # not save enum type info - # this test is meaningful only for languages that have --debug and do - # not save enum type info + pass diff --git a/spec/python/test_default_big_endian.py b/spec/python/test_default_big_endian.py index 75667621a..04f0dbdcb 100644 --- a/spec/python/test_default_big_endian.py +++ b/spec/python/test_default_big_endian.py @@ -7,4 +7,5 @@ class TestDefaultBigEndian(unittest.TestCase): def test_default_big_endian(self): with DefaultBigEndian.from_file('src/enum_0.bin') as r: + self.assertEqual(r.one, 117440512) diff --git a/spec/python/test_default_endian_expr_inherited.py b/spec/python/test_default_endian_expr_inherited.py index c586406b0..01f12a53a 100644 --- a/spec/python/test_default_endian_expr_inherited.py +++ b/spec/python/test_default_endian_expr_inherited.py @@ -7,6 +7,7 @@ class TestDefaultEndianExprInherited(unittest.TestCase): def test_default_endian_expr_inherited(self): with DefaultEndianExprInherited.from_file('src/endian_expr.bin') as r: + self.assertEqual(r.docs[0].indicator, b"\x49\x49") self.assertEqual(r.docs[0].main.insides.some_int, 66) self.assertEqual(r.docs[0].main.insides.more.some_int1, 16896) diff --git a/spec/python/test_default_endian_expr_is_be.py b/spec/python/test_default_endian_expr_is_be.py index ddc5a1540..d75b45779 100644 --- a/spec/python/test_default_endian_expr_is_be.py +++ b/spec/python/test_default_endian_expr_is_be.py @@ -7,6 +7,7 @@ class TestDefaultEndianExprIsBe(unittest.TestCase): def test_default_endian_expr_is_be(self): with DefaultEndianExprIsBe.from_file('src/endian_expr.bin') as r: + self.assertEqual(r.docs[0].indicator, b"\x49\x49") self.assertEqual(r.docs[0].main.some_int, 66) self.assertEqual(r.docs[0].main.some_int_be, 66) diff --git a/spec/python/test_default_endian_expr_is_le.py b/spec/python/test_default_endian_expr_is_le.py index 020728e1b..cc258985e 100644 --- a/spec/python/test_default_endian_expr_is_le.py +++ b/spec/python/test_default_endian_expr_is_le.py @@ -7,6 +7,7 @@ class TestDefaultEndianExprIsLe(unittest.TestCase): def test_default_endian_expr_is_le(self): with DefaultEndianExprIsLe.from_file('src/endian_expr.bin') as r: + self.assertEqual(r.docs[0].indicator, b"\x49\x49") self.assertEqual(r.docs[0].main.some_int, 66) self.assertEqual(r.docs[0].main.some_int_be, 66) diff --git a/spec/python/test_default_endian_mod.py b/spec/python/test_default_endian_mod.py index 82053085c..9ca9c53f0 100644 --- a/spec/python/test_default_endian_mod.py +++ b/spec/python/test_default_endian_mod.py @@ -7,6 +7,7 @@ class TestDefaultEndianMod(unittest.TestCase): def test_default_endian_mod(self): with DefaultEndianMod.from_file('src/fixed_struct.bin') as r: + self.assertEqual(r.main.one, 1262698832) self.assertEqual(r.main.nest.two, -52947) self.assertEqual(r.main.nest_be.two, 1346454347) diff --git a/spec/python/test_docstrings.py b/spec/python/test_docstrings.py index 4c95f4ca0..8db31f2e3 100644 --- a/spec/python/test_docstrings.py +++ b/spec/python/test_docstrings.py @@ -7,4 +7,5 @@ class TestDocstrings(unittest.TestCase): def test_docstrings(self): with Docstrings.from_file('src/fixed_struct.bin') as r: + pass diff --git a/spec/python/test_docstrings_docref.py b/spec/python/test_docstrings_docref.py index a28073661..7d15be182 100644 --- a/spec/python/test_docstrings_docref.py +++ b/spec/python/test_docstrings_docref.py @@ -7,4 +7,5 @@ class TestDocstringsDocref(unittest.TestCase): def test_docstrings_docref(self): with DocstringsDocref.from_file('src/fixed_struct.bin') as r: + pass diff --git a/spec/python/test_docstrings_docref_multi.py b/spec/python/test_docstrings_docref_multi.py index ceaf2f55d..41b760a56 100644 --- a/spec/python/test_docstrings_docref_multi.py +++ b/spec/python/test_docstrings_docref_multi.py @@ -7,4 +7,5 @@ class TestDocstringsDocrefMulti(unittest.TestCase): def test_docstrings_docref_multi(self): with DocstringsDocrefMulti.from_file('src/fixed_struct.bin') as r: + pass diff --git a/spec/python/test_enum_0.py b/spec/python/test_enum_0.py index 9f6a30919..37c2fb40e 100644 --- a/spec/python/test_enum_0.py +++ b/spec/python/test_enum_0.py @@ -7,5 +7,6 @@ class TestEnum0(unittest.TestCase): def test_enum_0(self): with Enum0.from_file('src/enum_0.bin') as r: + self.assertEqual(r.pet_1, Enum0.Animal.cat) self.assertEqual(r.pet_2, Enum0.Animal.chicken) diff --git a/spec/python/test_enum_1.py b/spec/python/test_enum_1.py index 0b96546d3..a2b23a2e1 100644 --- a/spec/python/test_enum_1.py +++ b/spec/python/test_enum_1.py @@ -7,5 +7,6 @@ class TestEnum1(unittest.TestCase): def test_enum_1(self): with Enum1.from_file('src/enum_0.bin') as r: + self.assertEqual(r.main.submain.pet_1, Enum1.MainObj.Animal.cat) self.assertEqual(r.main.submain.pet_2, Enum1.MainObj.Animal.chicken) diff --git a/spec/python/test_enum_deep.py b/spec/python/test_enum_deep.py index c8b2664b5..4d615e41e 100644 --- a/spec/python/test_enum_deep.py +++ b/spec/python/test_enum_deep.py @@ -7,5 +7,6 @@ class TestEnumDeep(unittest.TestCase): def test_enum_deep(self): with EnumDeep.from_file('src/enum_0.bin') as r: + self.assertEqual(r.pet_1, EnumDeep.Container1.Animal.cat) self.assertEqual(r.pet_2, EnumDeep.Container1.Container2.Animal.hare) diff --git a/spec/python/test_enum_deep_literals.py b/spec/python/test_enum_deep_literals.py index fe002cd81..75329c516 100644 --- a/spec/python/test_enum_deep_literals.py +++ b/spec/python/test_enum_deep_literals.py @@ -7,5 +7,6 @@ class TestEnumDeepLiterals(unittest.TestCase): def test_enum_deep_literals(self): with EnumDeepLiterals.from_file('src/enum_0.bin') as r: + self.assertEqual(r.is_pet_1_ok, True) self.assertEqual(r.is_pet_2_ok, True) diff --git a/spec/python/test_enum_fancy.py b/spec/python/test_enum_fancy.py index 1312359cd..32010c31b 100644 --- a/spec/python/test_enum_fancy.py +++ b/spec/python/test_enum_fancy.py @@ -7,5 +7,6 @@ class TestEnumFancy(unittest.TestCase): def test_enum_fancy(self): with EnumFancy.from_file('src/enum_0.bin') as r: + self.assertEqual(r.pet_1, EnumFancy.Animal.cat) self.assertEqual(r.pet_2, EnumFancy.Animal.chicken) diff --git a/spec/python/test_enum_if.py b/spec/python/test_enum_if.py index aa1e19093..6b9e7e44d 100644 --- a/spec/python/test_enum_if.py +++ b/spec/python/test_enum_if.py @@ -7,6 +7,7 @@ class TestEnumIf(unittest.TestCase): def test_enum_if(self): with EnumIf.from_file('src/if_struct.bin') as r: + self.assertEqual(r.op1.opcode, EnumIf.Opcodes.a_string) self.assertEqual(r.op1.arg_str.str, u"foo") self.assertEqual(r.op2.opcode, EnumIf.Opcodes.a_tuple) diff --git a/spec/python/test_enum_import.py b/spec/python/test_enum_import.py index 7216ff6cb..50ee377ea 100644 --- a/spec/python/test_enum_import.py +++ b/spec/python/test_enum_import.py @@ -1,12 +1,12 @@ -# Autogenerated from KST: please remove this line if doing any edits by hand! - import unittest from enum_import import EnumImport +from enum_0 import Enum0 +from enum_deep import EnumDeep class TestEnumImport(unittest.TestCase): def test_enum_import(self): with EnumImport.from_file('src/enum_0.bin') as r: - self.assertEqual(r.pet_1, EnumImport.Animal.cat) - self.assertEqual(r.pet_2, EnumImport.Container1.Container2.Animal.hare) + self.assertEqual(r.pet_1, Enum0.Animal.cat) + self.assertEqual(r.pet_2, EnumDeep.Container1.Container2.Animal.hare) diff --git a/spec/python/test_enum_negative.py b/spec/python/test_enum_negative.py index a4905409e..f9aa2dd92 100644 --- a/spec/python/test_enum_negative.py +++ b/spec/python/test_enum_negative.py @@ -7,5 +7,6 @@ class TestEnumNegative(unittest.TestCase): def test_enum_negative(self): with EnumNegative.from_file('src/enum_negative.bin') as r: + self.assertEqual(r.f1, EnumNegative.Constants.negative_one) self.assertEqual(r.f2, EnumNegative.Constants.positive_one) diff --git a/spec/python/test_enum_of_value_inst.py b/spec/python/test_enum_of_value_inst.py index e6dd8b6fd..db4670be1 100644 --- a/spec/python/test_enum_of_value_inst.py +++ b/spec/python/test_enum_of_value_inst.py @@ -7,6 +7,7 @@ class TestEnumOfValueInst(unittest.TestCase): def test_enum_of_value_inst(self): with EnumOfValueInst.from_file('src/enum_0.bin') as r: + self.assertEqual(r.pet_1, EnumOfValueInst.Animal.cat) self.assertEqual(r.pet_2, EnumOfValueInst.Animal.chicken) self.assertEqual(r.pet_3, EnumOfValueInst.Animal.dog) diff --git a/spec/python/test_expr_0.py b/spec/python/test_expr_0.py index f20148ba8..ccc99cfb2 100644 --- a/spec/python/test_expr_0.py +++ b/spec/python/test_expr_0.py @@ -7,5 +7,6 @@ class TestExpr0(unittest.TestCase): def test_expr_0(self): with Expr0.from_file('src/str_encodings.bin') as r: + self.assertEqual(r.must_be_f7, 247) self.assertEqual(r.must_be_abc123, u"abc123") diff --git a/spec/python/test_expr_1.py b/spec/python/test_expr_1.py index 79906ded2..bad55d35e 100644 --- a/spec/python/test_expr_1.py +++ b/spec/python/test_expr_1.py @@ -7,6 +7,7 @@ class TestExpr1(unittest.TestCase): def test_expr_1(self): with Expr1.from_file('src/str_encodings.bin') as r: + self.assertEqual(r.len_of_1, 10) self.assertEqual(r.len_of_1_mod, 8) self.assertEqual(r.str1, u"Some ASC") diff --git a/spec/python/test_expr_2.py b/spec/python/test_expr_2.py index ec82c1597..392b352e9 100644 --- a/spec/python/test_expr_2.py +++ b/spec/python/test_expr_2.py @@ -7,6 +7,7 @@ class TestExpr2(unittest.TestCase): def test_expr_2(self): with Expr2.from_file('src/str_encodings.bin') as r: + self.assertEqual(r.str1.len_orig, 10) self.assertEqual(r.str1.len_mod, 7) self.assertEqual(r.str1.str, u"Some AS") diff --git a/spec/python/test_expr_3.py b/spec/python/test_expr_3.py index d57563c51..61fd1dbe3 100644 --- a/spec/python/test_expr_3.py +++ b/spec/python/test_expr_3.py @@ -7,6 +7,7 @@ class TestExpr3(unittest.TestCase): def test_expr_3(self): with Expr3.from_file('src/fixed_struct.bin') as r: + self.assertEqual(r.one, 80) self.assertEqual(r.two, u"ACK") self.assertEqual(r.three, u"@ACK") diff --git a/spec/python/test_expr_array.py b/spec/python/test_expr_array.py index 779c574e0..1c393ab78 100644 --- a/spec/python/test_expr_array.py +++ b/spec/python/test_expr_array.py @@ -1,5 +1,3 @@ -# Autogenerated from KST: please remove this line if doing any edits by hand! - import unittest from expr_array import ExprArray @@ -7,6 +5,7 @@ class TestExprArray(unittest.TestCase): def test_expr_array(self): with ExprArray.from_file('src/expr_array.bin') as r: + self.assertEqual(r.aint_size, 4) self.assertEqual(r.aint_first, 7657765) self.assertEqual(r.aint_last, 16272640) diff --git a/spec/python/test_expr_bytes_cmp.py b/spec/python/test_expr_bytes_cmp.py index 6d7f675e5..b319e4efe 100644 --- a/spec/python/test_expr_bytes_cmp.py +++ b/spec/python/test_expr_bytes_cmp.py @@ -7,6 +7,7 @@ class TestExprBytesCmp(unittest.TestCase): def test_expr_bytes_cmp(self): with ExprBytesCmp.from_file('src/fixed_struct.bin') as r: + self.assertEqual(r.one, b"\x50") self.assertEqual(r.two, b"\x41\x43\x4B") self.assertEqual(r.is_eq, True) diff --git a/spec/python/test_expr_enum.py b/spec/python/test_expr_enum.py index 360503ddf..f04536e76 100644 --- a/spec/python/test_expr_enum.py +++ b/spec/python/test_expr_enum.py @@ -7,6 +7,7 @@ class TestExprEnum(unittest.TestCase): def test_expr_enum(self): with ExprEnum.from_file('src/term_strz.bin') as r: + self.assertEqual(r.const_dog, ExprEnum.Animal.dog) self.assertEqual(r.derived_boom, ExprEnum.Animal.boom) self.assertEqual(r.derived_dog, ExprEnum.Animal.dog) diff --git a/spec/python/test_expr_if_int_ops.py b/spec/python/test_expr_if_int_ops.py index 1535deb57..4a23d162e 100644 --- a/spec/python/test_expr_if_int_ops.py +++ b/spec/python/test_expr_if_int_ops.py @@ -6,7 +6,9 @@ class TestExprIfIntOps(unittest.TestCase): def test_expr_if_int_ops(self): - with ExprIfIntOps.from_file('src/process_coerce_switch.bin') as r: + with ExprIfIntOps.from_file('src/instance_io.bin') as r: - self.assertEqual(r.is_eq_prim, True) - self.assertEqual(r.is_eq_boxed, True) + self.assertEqual(r.key, 3) + self.assertEqual(r.bytes, b"\xFC\xFC\xFC\xFD\x09\x03\x03\x03") + self.assertEqual(r.bytes_sub_key, 253) + self.assertEqual(r.items_sub_key, -3) diff --git a/spec/python/test_expr_io_eof.py b/spec/python/test_expr_io_eof.py index e876b2ceb..d0b21787d 100644 --- a/spec/python/test_expr_io_eof.py +++ b/spec/python/test_expr_io_eof.py @@ -4,10 +4,9 @@ class TestExprIoEof(unittest.TestCase): def test_expr_io_eof(self): - r = ExprIoEof.from_file("src/fixed_struct.bin") + with ExprIoEof.from_file('src/fixed_struct.bin') as r: - self.assertEqual(r.substream1.one, 1262698832) - self.assertEqual(hasattr(r.substream1, 'two'), False) - - self.assertEqual(r.substream2.one, 4294914349) - self.assertEqual(r.substream2.two, 1262698832) + self.assertEqual(r.substream1.one, 1262698832) + self.assertFalse(hasattr(r.substream1, 'two')) + self.assertEqual(r.substream2.one, 4294914349) + self.assertEqual(r.substream2.two, 1262698832) diff --git a/spec/python/test_expr_io_pos.py b/spec/python/test_expr_io_pos.py index 87e0e4da3..1c9c92e24 100644 --- a/spec/python/test_expr_io_pos.py +++ b/spec/python/test_expr_io_pos.py @@ -7,6 +7,7 @@ class TestExprIoPos(unittest.TestCase): def test_expr_io_pos(self): with ExprIoPos.from_file('src/expr_io_pos.bin') as r: + self.assertEqual(r.substream1.my_str, u"CURIOSITY") self.assertEqual(r.substream1.body, b"\x11\x22\x33\x44") self.assertEqual(r.substream1.number, 66) diff --git a/spec/python/test_expr_mod.py b/spec/python/test_expr_mod.py index 7dcf3aa87..b5f9869e8 100644 --- a/spec/python/test_expr_mod.py +++ b/spec/python/test_expr_mod.py @@ -7,6 +7,7 @@ class TestExprMod(unittest.TestCase): def test_expr_mod(self): with ExprMod.from_file('src/fixed_struct.bin') as r: + self.assertEqual(r.int_u, 1262698832) self.assertEqual(r.int_s, -52947) self.assertEqual(r.mod_pos_const, 9) diff --git a/spec/python/test_expr_sizeof_type_0.py b/spec/python/test_expr_sizeof_type_0.py index bfdfd16a2..4241a82fc 100644 --- a/spec/python/test_expr_sizeof_type_0.py +++ b/spec/python/test_expr_sizeof_type_0.py @@ -7,4 +7,5 @@ class TestExprSizeofType0(unittest.TestCase): def test_expr_sizeof_type_0(self): with ExprSizeofType0.from_file('src/fixed_struct.bin') as r: + self.assertEqual(r.sizeof_block, ((1 + 4) + 2)) diff --git a/spec/python/test_expr_sizeof_type_1.py b/spec/python/test_expr_sizeof_type_1.py index d5d43c434..d1b0fdfb3 100644 --- a/spec/python/test_expr_sizeof_type_1.py +++ b/spec/python/test_expr_sizeof_type_1.py @@ -7,5 +7,6 @@ class TestExprSizeofType1(unittest.TestCase): def test_expr_sizeof_type_1(self): with ExprSizeofType1.from_file('src/fixed_struct.bin') as r: + self.assertEqual(r.sizeof_block, (((1 + 4) + 2) + 4)) self.assertEqual(r.sizeof_subblock, 4) diff --git a/spec/python/test_expr_sizeof_value_0.py b/spec/python/test_expr_sizeof_value_0.py index 1774987e5..2e37cae8c 100644 --- a/spec/python/test_expr_sizeof_value_0.py +++ b/spec/python/test_expr_sizeof_value_0.py @@ -7,6 +7,7 @@ class TestExprSizeofValue0(unittest.TestCase): def test_expr_sizeof_value_0(self): with ExprSizeofValue0.from_file('src/fixed_struct.bin') as r: + self.assertEqual(r.self_sizeof, (((1 + 4) + 2) + 2)) self.assertEqual(r.sizeof_block, ((1 + 4) + 2)) self.assertEqual(r.sizeof_block_a, 1) diff --git a/spec/python/test_expr_sizeof_value_sized.py b/spec/python/test_expr_sizeof_value_sized.py index 5d0d70249..073fd9d59 100644 --- a/spec/python/test_expr_sizeof_value_sized.py +++ b/spec/python/test_expr_sizeof_value_sized.py @@ -7,6 +7,7 @@ class TestExprSizeofValueSized(unittest.TestCase): def test_expr_sizeof_value_sized(self): with ExprSizeofValueSized.from_file('src/fixed_struct.bin') as r: + self.assertEqual(r.self_sizeof, (12 + 2)) self.assertEqual(r.sizeof_block, 12) self.assertEqual(r.sizeof_block_a, 1) diff --git a/spec/python/test_fixed_contents.py b/spec/python/test_fixed_contents.py index 2235f2014..af55bf84c 100644 --- a/spec/python/test_fixed_contents.py +++ b/spec/python/test_fixed_contents.py @@ -7,4 +7,5 @@ class TestFixedContents(unittest.TestCase): def test_fixed_contents(self): with FixedContents.from_file('src/fixed_struct.bin') as r: + pass diff --git a/spec/python/test_fixed_struct.py b/spec/python/test_fixed_struct.py index 59876f1cd..2768402a6 100644 --- a/spec/python/test_fixed_struct.py +++ b/spec/python/test_fixed_struct.py @@ -7,6 +7,7 @@ class TestFixedStruct(unittest.TestCase): def test_fixed_struct(self): with FixedStruct.from_file('src/fixed_struct.bin') as r: + self.assertEqual(r.hdr.uint8, 255) self.assertEqual(r.hdr.uint16, 65535) self.assertEqual(r.hdr.uint32, 4294967295) diff --git a/spec/python/test_float_to_i.py b/spec/python/test_float_to_i.py index d3fe67014..6fdd1aa4f 100644 --- a/spec/python/test_float_to_i.py +++ b/spec/python/test_float_to_i.py @@ -7,11 +7,17 @@ class TestFloatToI(unittest.TestCase): def test_float_to_i(self): with FloatToI.from_file('src/floating_points.bin') as r: - self.assertEqual(r.single_value, 0.5) - self.assertEqual(r.double_value, 0.25) + + self.assertAlmostEqual(r.single_value, 0.5, 6) + self.assertAlmostEqual(r.double_value, 0.25, 6) + self.assertAlmostEqual(r.single_value_if, 0.5, 6) + self.assertAlmostEqual(r.double_value_if, 0.25, 6) self.assertEqual(r.single_i, 0) self.assertEqual(r.double_i, 0) + self.assertEqual(r.single_if_i, 0) + self.assertEqual(r.double_if_i, 0) self.assertEqual(r.float1_i, 1) self.assertEqual(r.float2_i, 1) self.assertEqual(r.float3_i, 1) self.assertEqual(r.float4_i, -2) + self.assertEqual(r.calc_if_i, 13) diff --git a/spec/python/test_floating_points.py b/spec/python/test_floating_points.py index 5e4996e53..2ee584818 100644 --- a/spec/python/test_floating_points.py +++ b/spec/python/test_floating_points.py @@ -7,6 +7,7 @@ class TestFloatingPoints(unittest.TestCase): def test_floating_points(self): with FloatingPoints.from_file('src/floating_points.bin') as r: + self.assertAlmostEqual(r.single_value, 0.5, 6) self.assertAlmostEqual(r.single_value_be, 0.5, 6) self.assertAlmostEqual(r.double_value, 0.25, 6) diff --git a/spec/python/test_hello_world.py b/spec/python/test_hello_world.py index 3d59e5cb2..4ca9bcfb3 100644 --- a/spec/python/test_hello_world.py +++ b/spec/python/test_hello_world.py @@ -7,4 +7,5 @@ class TestHelloWorld(unittest.TestCase): def test_hello_world(self): with HelloWorld.from_file('src/fixed_struct.bin') as r: + self.assertEqual(r.one, 80) diff --git a/spec/python/test_if_instances.py b/spec/python/test_if_instances.py index f3e592cbf..ce3eba909 100644 --- a/spec/python/test_if_instances.py +++ b/spec/python/test_if_instances.py @@ -7,4 +7,5 @@ class TestIfInstances(unittest.TestCase): def test_if_instances(self): with IfInstances.from_file('src/fixed_struct.bin') as r: + self.assertIsNone(r.never_happens) diff --git a/spec/python/test_if_struct.py b/spec/python/test_if_struct.py index a5e2b0841..6b7e868b1 100644 --- a/spec/python/test_if_struct.py +++ b/spec/python/test_if_struct.py @@ -7,6 +7,7 @@ class TestIfStruct(unittest.TestCase): def test_if_struct(self): with IfStruct.from_file('src/if_struct.bin') as r: + self.assertEqual(r.op1.opcode, 83) self.assertEqual(r.op1.arg_str.str, u"foo") self.assertEqual(r.op2.opcode, 84) diff --git a/spec/python/test_if_values.py b/spec/python/test_if_values.py index 80e47c1cc..595393302 100644 --- a/spec/python/test_if_values.py +++ b/spec/python/test_if_values.py @@ -7,6 +7,7 @@ class TestIfValues(unittest.TestCase): def test_if_values(self): with IfValues.from_file('src/fixed_struct.bin') as r: + self.assertEqual(r.codes[0].opcode, 80) self.assertEqual(r.codes[0].half_opcode, 40) self.assertEqual(r.codes[1].opcode, 65) diff --git a/spec/python/test_imports0.py b/spec/python/test_imports0.py index 41f2e03b7..4a5b1071e 100644 --- a/spec/python/test_imports0.py +++ b/spec/python/test_imports0.py @@ -7,6 +7,7 @@ class TestImports0(unittest.TestCase): def test_imports0(self): with Imports0.from_file('src/fixed_struct.bin') as r: + self.assertEqual(r.two, 80) self.assertEqual(r.hw.one, 65) self.assertEqual(r.hw_one, 65) diff --git a/spec/python/test_imports_abs.py b/spec/python/test_imports_abs.py index ce40cb4bf..ab177e00b 100644 --- a/spec/python/test_imports_abs.py +++ b/spec/python/test_imports_abs.py @@ -7,5 +7,6 @@ class TestImportsAbs(unittest.TestCase): def test_imports_abs(self): with ImportsAbs.from_file('src/fixed_struct.bin') as r: + self.assertEqual(r.len.value, 80) self.assertEqual(len(r.body), 80) diff --git a/spec/python/test_index_sizes.py b/spec/python/test_index_sizes.py index d1d155489..2754a6364 100644 --- a/spec/python/test_index_sizes.py +++ b/spec/python/test_index_sizes.py @@ -7,6 +7,7 @@ class TestIndexSizes(unittest.TestCase): def test_index_sizes(self): with IndexSizes.from_file('src/index_sizes.bin') as r: + self.assertEqual(r.qty, 3) self.assertEqual(r.sizes[0], 1) self.assertEqual(r.sizes[1], 8) diff --git a/spec/python/test_index_to_param_eos.py b/spec/python/test_index_to_param_eos.py index bea791350..201199794 100644 --- a/spec/python/test_index_to_param_eos.py +++ b/spec/python/test_index_to_param_eos.py @@ -7,6 +7,7 @@ class TestIndexToParamEos(unittest.TestCase): def test_index_to_param_eos(self): with IndexToParamEos.from_file('src/index_sizes.bin') as r: + self.assertEqual(r.qty, 3) self.assertEqual(r.sizes[0], 1) self.assertEqual(r.sizes[1], 8) diff --git a/spec/python/test_index_to_param_expr.py b/spec/python/test_index_to_param_expr.py index d0e35f564..17eaf1449 100644 --- a/spec/python/test_index_to_param_expr.py +++ b/spec/python/test_index_to_param_expr.py @@ -7,6 +7,7 @@ class TestIndexToParamExpr(unittest.TestCase): def test_index_to_param_expr(self): with IndexToParamExpr.from_file('src/index_sizes.bin') as r: + self.assertEqual(r.qty, 3) self.assertEqual(r.sizes[0], 1) self.assertEqual(r.sizes[1], 8) diff --git a/spec/python/test_index_to_param_until.py b/spec/python/test_index_to_param_until.py index 4afc55b9a..01f0d9878 100644 --- a/spec/python/test_index_to_param_until.py +++ b/spec/python/test_index_to_param_until.py @@ -7,6 +7,7 @@ class TestIndexToParamUntil(unittest.TestCase): def test_index_to_param_until(self): with IndexToParamUntil.from_file('src/index_sizes.bin') as r: + self.assertEqual(r.qty, 3) self.assertEqual(r.sizes[0], 1) self.assertEqual(r.sizes[1], 8) diff --git a/spec/python/test_instance_io_user.py b/spec/python/test_instance_io_user.py index d560ab91f..68d4af0e8 100644 --- a/spec/python/test_instance_io_user.py +++ b/spec/python/test_instance_io_user.py @@ -7,6 +7,7 @@ class TestInstanceIoUser(unittest.TestCase): def test_instance_io_user(self): with InstanceIoUser.from_file('src/instance_io.bin') as r: + self.assertEqual(r.qty_entries, 3) self.assertEqual(r.entries[0].name, u"the") self.assertEqual(r.entries[1].name, u"rainy") diff --git a/spec/python/test_instance_std.py b/spec/python/test_instance_std.py index ad69def28..5d2cf2ac0 100644 --- a/spec/python/test_instance_std.py +++ b/spec/python/test_instance_std.py @@ -7,4 +7,5 @@ class TestInstanceStd(unittest.TestCase): def test_instance_std(self): with InstanceStd.from_file('src/str_encodings.bin') as r: + self.assertEqual(r.header, u"Some ") diff --git a/spec/python/test_instance_std_array.py b/spec/python/test_instance_std_array.py index c7d9e97ae..ecbc6147b 100644 --- a/spec/python/test_instance_std_array.py +++ b/spec/python/test_instance_std_array.py @@ -7,6 +7,7 @@ class TestInstanceStdArray(unittest.TestCase): def test_instance_std_array(self): with InstanceStdArray.from_file('src/instance_std_array.bin') as r: + self.assertEqual(r.ofs, 16) self.assertEqual(r.qty_entries, 3) self.assertEqual(r.entry_size, 4) diff --git a/spec/python/test_instance_user_array.py b/spec/python/test_instance_user_array.py index c63356039..487d40a0e 100644 --- a/spec/python/test_instance_user_array.py +++ b/spec/python/test_instance_user_array.py @@ -7,6 +7,7 @@ class TestInstanceUserArray(unittest.TestCase): def test_instance_user_array(self): with InstanceUserArray.from_file('src/instance_std_array.bin') as r: + self.assertEqual(r.ofs, 16) self.assertEqual(r.qty_entries, 3) self.assertEqual(r.entry_size, 4) diff --git a/spec/python/test_integers.py b/spec/python/test_integers.py index 1573877fa..a3ae8771c 100644 --- a/spec/python/test_integers.py +++ b/spec/python/test_integers.py @@ -7,6 +7,7 @@ class TestIntegers(unittest.TestCase): def test_integers(self): with Integers.from_file('src/fixed_struct.bin') as r: + self.assertEqual(r.uint8, 255) self.assertEqual(r.uint16, 65535) self.assertEqual(r.uint32, 4294967295) diff --git a/spec/python/test_io_local_var.py b/spec/python/test_io_local_var.py index 506611009..4ac10f093 100644 --- a/spec/python/test_io_local_var.py +++ b/spec/python/test_io_local_var.py @@ -7,5 +7,6 @@ class TestIoLocalVar(unittest.TestCase): def test_io_local_var(self): with IoLocalVar.from_file('src/full256.bin') as r: + self.assertEqual(r.skip, b"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F\x10\x11\x12\x13") self.assertEqual(r.followup, 20) diff --git a/spec/python/test_js_signed_right_shift.py b/spec/python/test_js_signed_right_shift.py index 63866ed0e..b20c406d1 100644 --- a/spec/python/test_js_signed_right_shift.py +++ b/spec/python/test_js_signed_right_shift.py @@ -7,5 +7,6 @@ class TestJsSignedRightShift(unittest.TestCase): def test_js_signed_right_shift(self): with JsSignedRightShift.from_file('src/fixed_struct.bin') as r: + self.assertEqual(r.should_be_40000000, 1073741824) self.assertEqual(r.should_be_a00000, 10485760) diff --git a/spec/python/test_meta_tags.py b/spec/python/test_meta_tags.py index e5e03c387..bf417bb03 100644 --- a/spec/python/test_meta_tags.py +++ b/spec/python/test_meta_tags.py @@ -7,4 +7,5 @@ class TestMetaTags(unittest.TestCase): def test_meta_tags(self): with MetaTags.from_file('src/fixed_struct.bin') as r: + pass diff --git a/spec/python/test_meta_xref.py b/spec/python/test_meta_xref.py index 64c881426..f0f0d7b07 100644 --- a/spec/python/test_meta_xref.py +++ b/spec/python/test_meta_xref.py @@ -7,4 +7,5 @@ class TestMetaXref(unittest.TestCase): def test_meta_xref(self): with MetaXref.from_file('src/fixed_struct.bin') as r: + pass diff --git a/spec/python/test_multiple_use.py b/spec/python/test_multiple_use.py index 5a13ee564..8e85b2607 100644 --- a/spec/python/test_multiple_use.py +++ b/spec/python/test_multiple_use.py @@ -7,5 +7,6 @@ class TestMultipleUse(unittest.TestCase): def test_multiple_use(self): with MultipleUse.from_file('src/position_abs.bin') as r: + self.assertEqual(r.t1.first_use.value, 32) self.assertEqual(r.t2.second_use.value, 32) diff --git a/spec/python/test_nav_parent.py b/spec/python/test_nav_parent.py index dd05d1257..154f5651d 100644 --- a/spec/python/test_nav_parent.py +++ b/spec/python/test_nav_parent.py @@ -7,6 +7,7 @@ class TestNavParent(unittest.TestCase): def test_nav_parent(self): with NavParent.from_file('src/nav.bin') as r: + self.assertEqual(r.header.qty_entries, 2) self.assertEqual(r.header.filename_len, 8) self.assertEqual(len(r.index.entries), 2) diff --git a/spec/python/test_nav_parent2.py b/spec/python/test_nav_parent2.py index c813ca8ea..5d1786e8a 100644 --- a/spec/python/test_nav_parent2.py +++ b/spec/python/test_nav_parent2.py @@ -7,6 +7,7 @@ class TestNavParent2(unittest.TestCase): def test_nav_parent2(self): with NavParent2.from_file('src/nav_parent2.bin') as r: + self.assertEqual(r.ofs_tags, 8) self.assertEqual(r.num_tags, 2) self.assertEqual(r.tags[0].name, u"RAHC") diff --git a/spec/python/test_nav_parent3.py b/spec/python/test_nav_parent3.py index 83f086ad5..3f0eeae66 100644 --- a/spec/python/test_nav_parent3.py +++ b/spec/python/test_nav_parent3.py @@ -7,6 +7,7 @@ class TestNavParent3(unittest.TestCase): def test_nav_parent3(self): with NavParent3.from_file('src/nav_parent2.bin') as r: + self.assertEqual(r.ofs_tags, 8) self.assertEqual(r.num_tags, 2) self.assertEqual(r.tags[0].name, u"RAHC") diff --git a/spec/python/test_nav_parent_false.py b/spec/python/test_nav_parent_false.py index 95bf984aa..174a851fb 100644 --- a/spec/python/test_nav_parent_false.py +++ b/spec/python/test_nav_parent_false.py @@ -7,6 +7,7 @@ class TestNavParentFalse(unittest.TestCase): def test_nav_parent_false(self): with NavParentFalse.from_file('src/nav_parent_codes.bin') as r: + self.assertEqual(r.child_size, 3) self.assertEqual(r.element_a.foo.code, 73) self.assertEqual(r.element_a.foo.more, b"\x31\x32\x33") diff --git a/spec/python/test_nav_parent_false2.py b/spec/python/test_nav_parent_false2.py index aa2cdff37..7c39970d9 100644 --- a/spec/python/test_nav_parent_false2.py +++ b/spec/python/test_nav_parent_false2.py @@ -7,4 +7,5 @@ class TestNavParentFalse2(unittest.TestCase): def test_nav_parent_false2(self): with NavParentFalse2.from_file('src/fixed_struct.bin') as r: + self.assertEqual(r.parentless.foo, 80) diff --git a/spec/python/test_nav_parent_override.py b/spec/python/test_nav_parent_override.py index 8309ce9f0..39dd0b976 100644 --- a/spec/python/test_nav_parent_override.py +++ b/spec/python/test_nav_parent_override.py @@ -7,6 +7,7 @@ class TestNavParentOverride(unittest.TestCase): def test_nav_parent_override(self): with NavParentOverride.from_file('src/nav_parent_codes.bin') as r: + self.assertEqual(r.child_size, 3) self.assertEqual(r.child_1.data, b"\x49\x31\x32") self.assertEqual(r.mediator_2.child_2.data, b"\x33\x42\x62") diff --git a/spec/python/test_nav_parent_switch.py b/spec/python/test_nav_parent_switch.py index c7da42abe..d5b9aeb05 100644 --- a/spec/python/test_nav_parent_switch.py +++ b/spec/python/test_nav_parent_switch.py @@ -7,6 +7,7 @@ class TestNavParentSwitch(unittest.TestCase): def test_nav_parent_switch(self): with NavParentSwitch.from_file('src/nav_parent_switch.bin') as r: + self.assertEqual(r.category, 1) self.assertEqual(r.content.foo, 66) self.assertEqual(r.content.subelement.bar, 255) diff --git a/spec/python/test_nav_parent_vs_value_inst.py b/spec/python/test_nav_parent_vs_value_inst.py index 79bbee8fc..1d9c108d8 100644 --- a/spec/python/test_nav_parent_vs_value_inst.py +++ b/spec/python/test_nav_parent_vs_value_inst.py @@ -7,4 +7,5 @@ class TestNavParentVsValueInst(unittest.TestCase): def test_nav_parent_vs_value_inst(self): with NavParentVsValueInst.from_file('src/term_strz.bin') as r: + self.assertEqual(r.s1, u"foo") diff --git a/spec/python/test_nav_root.py b/spec/python/test_nav_root.py index e4c64651c..ce94816f6 100644 --- a/spec/python/test_nav_root.py +++ b/spec/python/test_nav_root.py @@ -7,6 +7,7 @@ class TestNavRoot(unittest.TestCase): def test_nav_root(self): with NavRoot.from_file('src/nav.bin') as r: + self.assertEqual(r.header.qty_entries, 2) self.assertEqual(r.header.filename_len, 8) self.assertEqual(len(r.index.entries), 2) diff --git a/spec/python/test_nested_same_name.py b/spec/python/test_nested_same_name.py index f8a670f58..324f8495e 100644 --- a/spec/python/test_nested_same_name.py +++ b/spec/python/test_nested_same_name.py @@ -7,5 +7,6 @@ class TestNestedSameName(unittest.TestCase): def test_nested_same_name(self): with NestedSameName.from_file('src/repeat_n_struct.bin') as r: + self.assertEqual(r.main_data.main_size, 2) self.assertEqual(r.main_data.foo.data, b"\x10\x00\x00\x00") diff --git a/spec/python/test_nested_same_name2.py b/spec/python/test_nested_same_name2.py index 2bb7c4607..bc00cf192 100644 --- a/spec/python/test_nested_same_name2.py +++ b/spec/python/test_nested_same_name2.py @@ -7,6 +7,7 @@ class TestNestedSameName2(unittest.TestCase): def test_nested_same_name2(self): with NestedSameName2.from_file('src/nested_same_name2.bin') as r: + self.assertEqual(r.version, 66) self.assertEqual(r.main_data.main_size, 2) self.assertEqual(r.main_data.foo.data1, b"\x11\x11\x11\x11") diff --git a/spec/python/test_nested_types.py b/spec/python/test_nested_types.py index 4911778aa..fc1e77f8d 100644 --- a/spec/python/test_nested_types.py +++ b/spec/python/test_nested_types.py @@ -7,6 +7,7 @@ class TestNestedTypes(unittest.TestCase): def test_nested_types(self): with NestedTypes.from_file('src/fixed_struct.bin') as r: + self.assertEqual(r.one.typed_at_root.value_b, 80) self.assertEqual(r.one.typed_here.value_c, 65) self.assertEqual(r.two.value_b, 67) diff --git a/spec/python/test_nested_types2.py b/spec/python/test_nested_types2.py index b9b263d3e..b48f6d869 100644 --- a/spec/python/test_nested_types2.py +++ b/spec/python/test_nested_types2.py @@ -7,6 +7,7 @@ class TestNestedTypes2(unittest.TestCase): def test_nested_types2(self): with NestedTypes2.from_file('src/fixed_struct.bin') as r: + self.assertEqual(r.one.typed_at_root.value_b, 80) self.assertEqual(r.one.typed_here1.value_c, 65) self.assertEqual(r.one.typed_here1.typed_here.value_d, 67) diff --git a/spec/python/test_nested_types3.py b/spec/python/test_nested_types3.py index e20755f17..b1151ea3b 100644 --- a/spec/python/test_nested_types3.py +++ b/spec/python/test_nested_types3.py @@ -7,6 +7,7 @@ class TestNestedTypes3(unittest.TestCase): def test_nested_types3(self): with NestedTypes3.from_file('src/fixed_struct.bin') as r: + self.assertEqual(r.a_cc.value_cc, 80) self.assertEqual(r.a_c_d.value_d, 65) self.assertEqual(r.b.value_b, 67) diff --git a/spec/python/test_non_standard.py b/spec/python/test_non_standard.py index e62a951d5..e59165b88 100644 --- a/spec/python/test_non_standard.py +++ b/spec/python/test_non_standard.py @@ -7,4 +7,5 @@ class TestNonStandard(unittest.TestCase): def test_non_standard(self): with NonStandard.from_file('src/fixed_struct.bin') as r: + self.assertEqual(r.foo, 80) diff --git a/spec/python/test_params_call_short.py b/spec/python/test_params_call_short.py index 2b4cdda61..dba30e894 100644 --- a/spec/python/test_params_call_short.py +++ b/spec/python/test_params_call_short.py @@ -7,6 +7,7 @@ class TestParamsCallShort(unittest.TestCase): def test_params_call_short(self): with ParamsCallShort.from_file('src/term_strz.bin') as r: + self.assertEqual(r.buf1.body, u"foo|b") self.assertEqual(r.buf2.body, u"ar|ba") self.assertEqual(r.buf2.trailer, 122) diff --git a/spec/python/test_params_enum.py b/spec/python/test_params_enum.py index d89e969d5..ed0a6d530 100644 --- a/spec/python/test_params_enum.py +++ b/spec/python/test_params_enum.py @@ -7,5 +7,6 @@ class TestParamsEnum(unittest.TestCase): def test_params_enum(self): with ParamsEnum.from_file('src/enum_0.bin') as r: + self.assertEqual(r.one, ParamsEnum.Animal.cat) self.assertEqual(r.invoke_with_param.is_cat, True) diff --git a/spec/python/test_params_pass_usertype.py b/spec/python/test_params_pass_usertype.py index e9b1561ba..569670ed6 100644 --- a/spec/python/test_params_pass_usertype.py +++ b/spec/python/test_params_pass_usertype.py @@ -7,5 +7,6 @@ class TestParamsPassUsertype(unittest.TestCase): def test_params_pass_usertype(self): with ParamsPassUsertype.from_file('src/position_in_seq.bin') as r: + self.assertEqual(r.first.foo, 1) self.assertEqual(r.one.buf, b"\x02") diff --git a/spec/python/test_position_abs.py b/spec/python/test_position_abs.py index 1fd9cc7ae..df88e37f4 100644 --- a/spec/python/test_position_abs.py +++ b/spec/python/test_position_abs.py @@ -7,5 +7,6 @@ class TestPositionAbs(unittest.TestCase): def test_position_abs(self): with PositionAbs.from_file('src/position_abs.bin') as r: + self.assertEqual(r.index_offset, 32) self.assertEqual(r.index.entry, u"foo") diff --git a/spec/python/test_position_in_seq.py b/spec/python/test_position_in_seq.py index b06450cbe..9490beea9 100644 --- a/spec/python/test_position_in_seq.py +++ b/spec/python/test_position_in_seq.py @@ -7,4 +7,5 @@ class TestPositionInSeq(unittest.TestCase): def test_position_in_seq(self): with PositionInSeq.from_file('src/position_in_seq.bin') as r: + self.assertEqual(r.numbers, [(0 + 1), 2, 3]) diff --git a/spec/python/test_position_to_end.py b/spec/python/test_position_to_end.py index 6a9b91959..f95bafb0a 100644 --- a/spec/python/test_position_to_end.py +++ b/spec/python/test_position_to_end.py @@ -7,5 +7,6 @@ class TestPositionToEnd(unittest.TestCase): def test_position_to_end(self): with PositionToEnd.from_file('src/position_to_end.bin') as r: + self.assertEqual(r.index.foo, 66) self.assertEqual(r.index.bar, 4660) diff --git a/spec/python/test_process_coerce_bytes.py b/spec/python/test_process_coerce_bytes.py index 72203984a..8b4d8ad59 100644 --- a/spec/python/test_process_coerce_bytes.py +++ b/spec/python/test_process_coerce_bytes.py @@ -7,6 +7,7 @@ class TestProcessCoerceBytes(unittest.TestCase): def test_process_coerce_bytes(self): with ProcessCoerceBytes.from_file('src/process_coerce_bytes.bin') as r: + self.assertEqual(r.records[0].flag, 0) self.assertEqual(r.records[0].buf, b"\x41\x41\x41\x41") self.assertEqual(r.records[1].flag, 1) diff --git a/spec/python/test_process_coerce_switch.py b/spec/python/test_process_coerce_switch.py index d68321486..3015bd31b 100644 --- a/spec/python/test_process_coerce_switch.py +++ b/spec/python/test_process_coerce_switch.py @@ -7,6 +7,7 @@ class TestProcessCoerceSwitch(unittest.TestCase): def test_process_coerce_switch(self): with ProcessCoerceSwitch.from_file('src/process_coerce_switch.bin') as r: + self.assertEqual(r.buf_type, 0) self.assertEqual(r.flag, 0) self.assertEqual(r.buf.bar, b"\x41\x41\x41\x41") diff --git a/spec/python/test_process_coerce_usertype1.py b/spec/python/test_process_coerce_usertype1.py index 1a479e0f9..6511fe351 100644 --- a/spec/python/test_process_coerce_usertype1.py +++ b/spec/python/test_process_coerce_usertype1.py @@ -7,6 +7,7 @@ class TestProcessCoerceUsertype1(unittest.TestCase): def test_process_coerce_usertype1(self): with ProcessCoerceUsertype1.from_file('src/process_coerce_bytes.bin') as r: + self.assertEqual(r.records[0].flag, 0) self.assertEqual(r.records[0].buf.value, 1094795585) self.assertEqual(r.records[1].flag, 1) diff --git a/spec/python/test_process_coerce_usertype2.py b/spec/python/test_process_coerce_usertype2.py index a5d318743..18d6be68a 100644 --- a/spec/python/test_process_coerce_usertype2.py +++ b/spec/python/test_process_coerce_usertype2.py @@ -7,6 +7,7 @@ class TestProcessCoerceUsertype2(unittest.TestCase): def test_process_coerce_usertype2(self): with ProcessCoerceUsertype2.from_file('src/process_coerce_bytes.bin') as r: + self.assertEqual(r.records[0].flag, 0) self.assertEqual(r.records[0].buf.value, 1094795585) self.assertEqual(r.records[1].flag, 1) diff --git a/spec/python/test_process_custom.py b/spec/python/test_process_custom.py index 85e553f1c..1d229c1a2 100644 --- a/spec/python/test_process_custom.py +++ b/spec/python/test_process_custom.py @@ -7,6 +7,7 @@ class TestProcessCustom(unittest.TestCase): def test_process_custom(self): with ProcessCustom.from_file('src/process_rotate.bin') as r: + self.assertEqual(r.buf1, b"\x10\xB3\x94\x94\xF4") self.assertEqual(r.buf2, b"\x5F\xBA\x7B\x93\x63\x23\x5F") self.assertEqual(r.buf3, b"\x29\x33\xB1\x38\xB1") diff --git a/spec/python/test_process_rotate.py b/spec/python/test_process_rotate.py index 1419a25a3..da8f1ba30 100644 --- a/spec/python/test_process_rotate.py +++ b/spec/python/test_process_rotate.py @@ -7,6 +7,7 @@ class TestProcessRotate(unittest.TestCase): def test_process_rotate(self): with ProcessRotate.from_file('src/process_rotate.bin') as r: + self.assertEqual(r.buf1, b"\x48\x65\x6C\x6C\x6F") self.assertEqual(r.buf2, b"\x57\x6F\x72\x6C\x64") self.assertEqual(r.buf3, b"\x54\x68\x65\x72\x65") diff --git a/spec/python/test_process_to_user.py b/spec/python/test_process_to_user.py index 9d3f12111..eb6a8ed9b 100644 --- a/spec/python/test_process_to_user.py +++ b/spec/python/test_process_to_user.py @@ -7,4 +7,5 @@ class TestProcessToUser(unittest.TestCase): def test_process_to_user(self): with ProcessToUser.from_file('src/process_rotate.bin') as r: + self.assertEqual(r.buf1.str, u"Hello") diff --git a/spec/python/test_process_xor4_const.py b/spec/python/test_process_xor4_const.py index 58059faba..2981c5383 100644 --- a/spec/python/test_process_xor4_const.py +++ b/spec/python/test_process_xor4_const.py @@ -7,5 +7,6 @@ class TestProcessXor4Const(unittest.TestCase): def test_process_xor4_const(self): with ProcessXor4Const.from_file('src/process_xor_4.bin') as r: + self.assertEqual(r.key, b"\xEC\xBB\xA3\x14") self.assertEqual(r.buf, b"\x66\x6F\x6F\x20\x62\x61\x72") diff --git a/spec/python/test_process_xor4_value.py b/spec/python/test_process_xor4_value.py index 0c89ae604..2fb4971fe 100644 --- a/spec/python/test_process_xor4_value.py +++ b/spec/python/test_process_xor4_value.py @@ -7,5 +7,6 @@ class TestProcessXor4Value(unittest.TestCase): def test_process_xor4_value(self): with ProcessXor4Value.from_file('src/process_xor_4.bin') as r: + self.assertEqual(r.key, b"\xEC\xBB\xA3\x14") self.assertEqual(r.buf, b"\x66\x6F\x6F\x20\x62\x61\x72") diff --git a/spec/python/test_process_xor_const.py b/spec/python/test_process_xor_const.py index c087b5baa..fdb22b5b8 100644 --- a/spec/python/test_process_xor_const.py +++ b/spec/python/test_process_xor_const.py @@ -7,5 +7,6 @@ class TestProcessXorConst(unittest.TestCase): def test_process_xor_const(self): with ProcessXorConst.from_file('src/process_xor_1.bin') as r: + self.assertEqual(r.key, 255) self.assertEqual(r.buf, b"\x66\x6F\x6F\x20\x62\x61\x72") diff --git a/spec/python/test_process_xor_value.py b/spec/python/test_process_xor_value.py index 4657a3793..f1aa2a7e5 100644 --- a/spec/python/test_process_xor_value.py +++ b/spec/python/test_process_xor_value.py @@ -7,5 +7,6 @@ class TestProcessXorValue(unittest.TestCase): def test_process_xor_value(self): with ProcessXorValue.from_file('src/process_xor_1.bin') as r: + self.assertEqual(r.key, 255) self.assertEqual(r.buf, b"\x66\x6F\x6F\x20\x62\x61\x72") diff --git a/spec/python/test_recursive_one.py b/spec/python/test_recursive_one.py index c637fc3b0..30ce73da6 100644 --- a/spec/python/test_recursive_one.py +++ b/spec/python/test_recursive_one.py @@ -7,6 +7,7 @@ class TestRecursiveOne(unittest.TestCase): def test_recursive_one(self): with RecursiveOne.from_file('src/fixed_struct.bin') as r: + self.assertEqual(r.one, 80) self.assertEqual(r.next.one, 65) self.assertEqual(r.next.next.one, 67) diff --git a/spec/python/test_repeat_eos_bit.py b/spec/python/test_repeat_eos_bit.py index 678b7b35a..a17eae884 100644 --- a/spec/python/test_repeat_eos_bit.py +++ b/spec/python/test_repeat_eos_bit.py @@ -7,4 +7,5 @@ class TestRepeatEosBit(unittest.TestCase): def test_repeat_eos_bit(self): with RepeatEosBit.from_file('src/enum_0.bin') as r: + self.assertEqual(len(r.nibbles), 16) diff --git a/spec/python/test_repeat_eos_struct.py b/spec/python/test_repeat_eos_struct.py index 11d7ea785..c3a554075 100644 --- a/spec/python/test_repeat_eos_struct.py +++ b/spec/python/test_repeat_eos_struct.py @@ -7,6 +7,7 @@ class TestRepeatEosStruct(unittest.TestCase): def test_repeat_eos_struct(self): with RepeatEosStruct.from_file('src/repeat_eos_struct.bin') as r: + self.assertEqual(len(r.chunks), 2) self.assertEqual(r.chunks[0].offset, 0) self.assertEqual(r.chunks[0].len, 66) diff --git a/spec/python/test_repeat_eos_u4.py b/spec/python/test_repeat_eos_u4.py index f1c468852..68dbf1087 100644 --- a/spec/python/test_repeat_eos_u4.py +++ b/spec/python/test_repeat_eos_u4.py @@ -7,4 +7,5 @@ class TestRepeatEosU4(unittest.TestCase): def test_repeat_eos_u4(self): with RepeatEosU4.from_file('src/repeat_eos_struct.bin') as r: + self.assertEqual(r.numbers, [0, 66, 66, 2069]) diff --git a/spec/python/test_repeat_n_struct.py b/spec/python/test_repeat_n_struct.py index d9ae60f7c..c54d3c420 100644 --- a/spec/python/test_repeat_n_struct.py +++ b/spec/python/test_repeat_n_struct.py @@ -7,6 +7,7 @@ class TestRepeatNStruct(unittest.TestCase): def test_repeat_n_struct(self): with RepeatNStruct.from_file('src/repeat_n_struct.bin') as r: + self.assertEqual(len(r.chunks), 2) self.assertEqual(r.chunks[0].offset, 16) self.assertEqual(r.chunks[0].len, 8312) diff --git a/spec/python/test_repeat_n_strz.py b/spec/python/test_repeat_n_strz.py index 04b922ad0..57ebb6fa0 100644 --- a/spec/python/test_repeat_n_strz.py +++ b/spec/python/test_repeat_n_strz.py @@ -7,5 +7,6 @@ class TestRepeatNStrz(unittest.TestCase): def test_repeat_n_strz(self): with RepeatNStrz.from_file('src/repeat_n_strz.bin') as r: + self.assertEqual(r.qty, 2) self.assertEqual(r.lines, [u"foo", u"bar"]) diff --git a/spec/python/test_repeat_n_strz_double.py b/spec/python/test_repeat_n_strz_double.py index b1f9a63b8..3f9d6bc7f 100644 --- a/spec/python/test_repeat_n_strz_double.py +++ b/spec/python/test_repeat_n_strz_double.py @@ -7,6 +7,7 @@ class TestRepeatNStrzDouble(unittest.TestCase): def test_repeat_n_strz_double(self): with RepeatNStrzDouble.from_file('src/repeat_n_strz.bin') as r: + self.assertEqual(r.qty, 2) self.assertEqual(r.lines1, [u"foo"]) self.assertEqual(r.lines2, [u"bar"]) diff --git a/spec/python/test_repeat_until_complex.py b/spec/python/test_repeat_until_complex.py index 9395c7189..ce05ef1bd 100644 --- a/spec/python/test_repeat_until_complex.py +++ b/spec/python/test_repeat_until_complex.py @@ -7,6 +7,7 @@ class TestRepeatUntilComplex(unittest.TestCase): def test_repeat_until_complex(self): with RepeatUntilComplex.from_file('src/repeat_until_complex.bin') as r: + self.assertEqual(len(r.first), 3) self.assertEqual(r.first[0].count, 4) self.assertEqual(r.first[0].values, [(0 + 1), 2, 3, 4]) diff --git a/spec/python/test_repeat_until_s4.py b/spec/python/test_repeat_until_s4.py index c44d4b4ab..fc81ab9c5 100644 --- a/spec/python/test_repeat_until_s4.py +++ b/spec/python/test_repeat_until_s4.py @@ -7,5 +7,6 @@ class TestRepeatUntilS4(unittest.TestCase): def test_repeat_until_s4(self): with RepeatUntilS4.from_file('src/repeat_until_s4.bin') as r: + self.assertEqual(r.entries, [66, 4919, -251658241, -1]) self.assertEqual(r.afterall, u"foobar") diff --git a/spec/python/test_repeat_until_sized.py b/spec/python/test_repeat_until_sized.py index 8f0027920..76b62f98c 100644 --- a/spec/python/test_repeat_until_sized.py +++ b/spec/python/test_repeat_until_sized.py @@ -7,6 +7,7 @@ class TestRepeatUntilSized(unittest.TestCase): def test_repeat_until_sized(self): with RepeatUntilSized.from_file('src/repeat_until_process.bin') as r: + self.assertEqual(len(r.records), 3) self.assertEqual(r.records[0].marker, 232) self.assertEqual(r.records[0].body, 2863311546) diff --git a/spec/python/test_str_encodings.py b/spec/python/test_str_encodings.py index e70116de3..6d0c38dcd 100644 --- a/spec/python/test_str_encodings.py +++ b/spec/python/test_str_encodings.py @@ -7,6 +7,7 @@ class TestStrEncodings(unittest.TestCase): def test_str_encodings(self): with StrEncodings.from_file('src/str_encodings.bin') as r: + self.assertEqual(r.str1, u"Some ASCII") self.assertEqual(r.str2, u"\u3053\u3093\u306b\u3061\u306f") self.assertEqual(r.str3, u"\u3053\u3093\u306b\u3061\u306f") diff --git a/spec/python/test_str_encodings_default.py b/spec/python/test_str_encodings_default.py index 82e5de21e..31c042ab4 100644 --- a/spec/python/test_str_encodings_default.py +++ b/spec/python/test_str_encodings_default.py @@ -7,6 +7,7 @@ class TestStrEncodingsDefault(unittest.TestCase): def test_str_encodings_default(self): with StrEncodingsDefault.from_file('src/str_encodings.bin') as r: + self.assertEqual(r.str1, u"Some ASCII") self.assertEqual(r.rest.str2, u"\u3053\u3093\u306b\u3061\u306f") self.assertEqual(r.rest.str3, u"\u3053\u3093\u306b\u3061\u306f") diff --git a/spec/python/test_str_eos.py b/spec/python/test_str_eos.py index 8875b9c61..3c7a2539e 100644 --- a/spec/python/test_str_eos.py +++ b/spec/python/test_str_eos.py @@ -7,4 +7,5 @@ class TestStrEos(unittest.TestCase): def test_str_eos(self): with StrEos.from_file('src/term_strz.bin') as r: + self.assertEqual(r.str, u"foo|bar|baz@") diff --git a/spec/python/test_str_literals2.py b/spec/python/test_str_literals2.py index 9314bef57..39a3f779c 100644 --- a/spec/python/test_str_literals2.py +++ b/spec/python/test_str_literals2.py @@ -7,6 +7,7 @@ class TestStrLiterals2(unittest.TestCase): def test_str_literals2(self): with StrLiterals2.from_file('src/fixed_struct.bin') as r: + self.assertEqual(r.dollar1, u"$foo") self.assertEqual(r.dollar2, u"${foo}") self.assertEqual(r.hash, u"#{foo}") diff --git a/spec/python/test_str_pad_term.py b/spec/python/test_str_pad_term.py index 5ccc32897..8234a4f58 100644 --- a/spec/python/test_str_pad_term.py +++ b/spec/python/test_str_pad_term.py @@ -7,6 +7,7 @@ class TestStrPadTerm(unittest.TestCase): def test_str_pad_term(self): with StrPadTerm.from_file('src/str_pad_term.bin') as r: + self.assertEqual(r.str_pad, u"str1") self.assertEqual(r.str_term, u"str2foo") self.assertEqual(r.str_term_and_pad, u"str+++3bar+++") diff --git a/spec/python/test_str_pad_term_empty.py b/spec/python/test_str_pad_term_empty.py index 62a9a38e8..64a64cff3 100644 --- a/spec/python/test_str_pad_term_empty.py +++ b/spec/python/test_str_pad_term_empty.py @@ -7,6 +7,7 @@ class TestStrPadTermEmpty(unittest.TestCase): def test_str_pad_term_empty(self): with StrPadTermEmpty.from_file('src/str_pad_term_empty.bin') as r: + self.assertEqual(r.str_pad, u"") self.assertEqual(r.str_term, u"") self.assertEqual(r.str_term_and_pad, u"") diff --git a/spec/python/test_switch_bytearray.py b/spec/python/test_switch_bytearray.py index 74aee0a8f..253e636d6 100644 --- a/spec/python/test_switch_bytearray.py +++ b/spec/python/test_switch_bytearray.py @@ -7,6 +7,7 @@ class TestSwitchBytearray(unittest.TestCase): def test_switch_bytearray(self): with SwitchBytearray.from_file('src/switch_opcodes.bin') as r: + self.assertEqual(len(r.opcodes), 4) self.assertEqual(r.opcodes[0].code, b"\x53") self.assertEqual(r.opcodes[0].body.value, u"foobar") diff --git a/spec/python/test_switch_integers.py b/spec/python/test_switch_integers.py index 1d03b9ad4..84baad1d9 100644 --- a/spec/python/test_switch_integers.py +++ b/spec/python/test_switch_integers.py @@ -7,6 +7,7 @@ class TestSwitchIntegers(unittest.TestCase): def test_switch_integers(self): with SwitchIntegers.from_file('src/switch_integers.bin') as r: + self.assertEqual(len(r.opcodes), 4) self.assertEqual(r.opcodes[0].code, 1) self.assertEqual(r.opcodes[0].body, 7) diff --git a/spec/python/test_switch_integers2.py b/spec/python/test_switch_integers2.py index f008cad74..8544ee43c 100644 --- a/spec/python/test_switch_integers2.py +++ b/spec/python/test_switch_integers2.py @@ -7,6 +7,7 @@ class TestSwitchIntegers2(unittest.TestCase): def test_switch_integers2(self): with SwitchIntegers2.from_file('src/switch_integers.bin') as r: + self.assertEqual(r.code, 1) self.assertEqual(r.len, 7) self.assertEqual(r.ham, b"\x02\x40\x40\x04\x37\x13\x00") diff --git a/spec/python/test_switch_manual_enum.py b/spec/python/test_switch_manual_enum.py index 0eca3a525..57ee2b2ef 100644 --- a/spec/python/test_switch_manual_enum.py +++ b/spec/python/test_switch_manual_enum.py @@ -7,6 +7,7 @@ class TestSwitchManualEnum(unittest.TestCase): def test_switch_manual_enum(self): with SwitchManualEnum.from_file('src/switch_opcodes.bin') as r: + self.assertEqual(len(r.opcodes), 4) self.assertEqual(r.opcodes[0].code, SwitchManualEnum.Opcode.CodeEnum.strval) self.assertEqual(r.opcodes[0].body.value, u"foobar") diff --git a/spec/python/test_switch_manual_enum_invalid.py b/spec/python/test_switch_manual_enum_invalid.py index 018dca30f..ae5f09c7e 100644 --- a/spec/python/test_switch_manual_enum_invalid.py +++ b/spec/python/test_switch_manual_enum_invalid.py @@ -4,12 +4,10 @@ class TestSwitchManualEnumInvalid(unittest.TestCase): def test_switch_manual_enum_invalid(self): - r = SwitchManualEnumInvalid.from_file("src/enum_negative.bin") + with SwitchManualEnumInvalid.from_file('src/enum_negative.bin') as r: - self.assertEqual(len(r.opcodes), 2) - - self.assertEqual(r.opcodes[0].code, 255) - self.assertFalse(hasattr(r.opcodes[0], 'body')) - - self.assertEqual(r.opcodes[1].code, 1) - self.assertFalse(hasattr(r.opcodes[1], 'body')) + self.assertEqual(len(r.opcodes), 2) + self.assertEqual(r.opcodes[0].code, 255) + self.assertFalse(hasattr(r.opcodes[0], 'body')) + self.assertEqual(r.opcodes[1].code, 1) + self.assertFalse(hasattr(r.opcodes[1], 'body')) diff --git a/spec/python/test_switch_manual_int.py b/spec/python/test_switch_manual_int.py index ccbbd36bb..7d7febc6e 100644 --- a/spec/python/test_switch_manual_int.py +++ b/spec/python/test_switch_manual_int.py @@ -7,6 +7,7 @@ class TestSwitchManualInt(unittest.TestCase): def test_switch_manual_int(self): with SwitchManualInt.from_file('src/switch_opcodes.bin') as r: + self.assertEqual(len(r.opcodes), 4) self.assertEqual(r.opcodes[0].code, 83) self.assertEqual(r.opcodes[0].body.value, u"foobar") diff --git a/spec/python/test_switch_manual_int_else.py b/spec/python/test_switch_manual_int_else.py index e514b8c1b..06f4e3c1d 100644 --- a/spec/python/test_switch_manual_int_else.py +++ b/spec/python/test_switch_manual_int_else.py @@ -7,6 +7,7 @@ class TestSwitchManualIntElse(unittest.TestCase): def test_switch_manual_int_else(self): with SwitchManualIntElse.from_file('src/switch_opcodes2.bin') as r: + self.assertEqual(len(r.opcodes), 4) self.assertEqual(r.opcodes[0].code, 83) self.assertEqual(r.opcodes[0].body.value, u"foo") diff --git a/spec/python/test_switch_manual_int_size_else.py b/spec/python/test_switch_manual_int_size_else.py index 6d95bd8d9..e2eae2e93 100644 --- a/spec/python/test_switch_manual_int_size_else.py +++ b/spec/python/test_switch_manual_int_size_else.py @@ -7,6 +7,7 @@ class TestSwitchManualIntSizeElse(unittest.TestCase): def test_switch_manual_int_size_else(self): with SwitchManualIntSizeElse.from_file('src/switch_tlv.bin') as r: + self.assertEqual(len(r.chunks), 4) self.assertEqual(r.chunks[0].code, 17) self.assertEqual(r.chunks[0].body.title, u"Stuff") diff --git a/spec/python/test_switch_manual_str.py b/spec/python/test_switch_manual_str.py index 1b153eb96..2143e215b 100644 --- a/spec/python/test_switch_manual_str.py +++ b/spec/python/test_switch_manual_str.py @@ -7,6 +7,7 @@ class TestSwitchManualStr(unittest.TestCase): def test_switch_manual_str(self): with SwitchManualStr.from_file('src/switch_opcodes.bin') as r: + self.assertEqual(len(r.opcodes), 4) self.assertEqual(r.opcodes[0].code, u"S") self.assertEqual(r.opcodes[0].body.value, u"foobar") diff --git a/spec/python/test_switch_manual_str_else.py b/spec/python/test_switch_manual_str_else.py index a8911cbe7..60e15b47e 100644 --- a/spec/python/test_switch_manual_str_else.py +++ b/spec/python/test_switch_manual_str_else.py @@ -7,6 +7,7 @@ class TestSwitchManualStrElse(unittest.TestCase): def test_switch_manual_str_else(self): with SwitchManualStrElse.from_file('src/switch_opcodes2.bin') as r: + self.assertEqual(len(r.opcodes), 4) self.assertEqual(r.opcodes[0].code, u"S") self.assertEqual(r.opcodes[0].body.value, u"foo") diff --git a/spec/python/test_term_bytes.py b/spec/python/test_term_bytes.py index 216738577..d3b191baf 100644 --- a/spec/python/test_term_bytes.py +++ b/spec/python/test_term_bytes.py @@ -7,6 +7,7 @@ class TestTermBytes(unittest.TestCase): def test_term_bytes(self): with TermBytes.from_file('src/term_strz.bin') as r: + self.assertEqual(r.s1, b"\x66\x6F\x6F") self.assertEqual(r.s2, b"\x62\x61\x72") self.assertEqual(r.s3, b"\x7C\x62\x61\x7A\x40") diff --git a/spec/python/test_term_strz.py b/spec/python/test_term_strz.py index ecb47b18f..680ec5fcc 100644 --- a/spec/python/test_term_strz.py +++ b/spec/python/test_term_strz.py @@ -7,6 +7,7 @@ class TestTermStrz(unittest.TestCase): def test_term_strz(self): with TermStrz.from_file('src/term_strz.bin') as r: + self.assertEqual(r.s1, u"foo") self.assertEqual(r.s2, u"bar") self.assertEqual(r.s3, u"|baz@") diff --git a/spec/python/test_ts_packet_header.py b/spec/python/test_ts_packet_header.py index a82da7fd1..c16bc0447 100644 --- a/spec/python/test_ts_packet_header.py +++ b/spec/python/test_ts_packet_header.py @@ -7,6 +7,7 @@ class TestTsPacketHeader(unittest.TestCase): def test_ts_packet_header(self): with TsPacketHeader.from_file('src/ts_packet.bin') as r: + self.assertEqual(r.sync_byte, 71) self.assertEqual(r.transport_error_indicator, False) self.assertEqual(r.payload_unit_start_indicator, False) diff --git a/spec/python/test_type_int_unary_op.py b/spec/python/test_type_int_unary_op.py index 2d1ce83c1..e08b73dbb 100644 --- a/spec/python/test_type_int_unary_op.py +++ b/spec/python/test_type_int_unary_op.py @@ -7,6 +7,7 @@ class TestTypeIntUnaryOp(unittest.TestCase): def test_type_int_unary_op(self): with TypeIntUnaryOp.from_file('src/fixed_struct.bin') as r: + self.assertEqual(r.value_s2, 16720) self.assertEqual(r.value_s8, 4706543082108963651) self.assertEqual(r.unary_s2, -16720) diff --git a/spec/python/test_type_ternary.py b/spec/python/test_type_ternary.py index ddd01dc3b..1e500854c 100644 --- a/spec/python/test_type_ternary.py +++ b/spec/python/test_type_ternary.py @@ -7,4 +7,5 @@ class TestTypeTernary(unittest.TestCase): def test_type_ternary(self): with TypeTernary.from_file('src/term_strz.bin') as r: + self.assertEqual(r.dif.value, 101) diff --git a/spec/python/test_type_ternary_2nd_falsy.py b/spec/python/test_type_ternary_2nd_falsy.py index aeaf7c562..2f0a37a4c 100644 --- a/spec/python/test_type_ternary_2nd_falsy.py +++ b/spec/python/test_type_ternary_2nd_falsy.py @@ -10,7 +10,7 @@ def test_type_ternary_2nd_falsy(self): self.assertEqual(r.v_false, False) self.assertEqual(r.v_int_zero, 0) - self.assertEqual(r.v_int_neg_zero, -0) + self.assertEqual(r.v_int_neg_zero, 0) self.assertAlmostEqual(r.v_float_zero, 0.0, 6) self.assertAlmostEqual(r.v_float_neg_zero, -0.0, 6) self.assertEqual(r.v_str_w_zero, u"0") diff --git a/spec/python/test_user_type.py b/spec/python/test_user_type.py index 793947170..b00974fe9 100644 --- a/spec/python/test_user_type.py +++ b/spec/python/test_user_type.py @@ -7,5 +7,6 @@ class TestUserType(unittest.TestCase): def test_user_type(self): with UserType.from_file('src/repeat_until_s4.bin') as r: + self.assertEqual(r.one.width, 66) self.assertEqual(r.one.height, 4919) diff --git a/spec/python/test_zlib_with_header_78.py b/spec/python/test_zlib_with_header_78.py index e4c9dc9ef..914ab51ca 100644 --- a/spec/python/test_zlib_with_header_78.py +++ b/spec/python/test_zlib_with_header_78.py @@ -7,4 +7,5 @@ class TestZlibWithHeader78(unittest.TestCase): def test_zlib_with_header_78(self): with ZlibWithHeader78.from_file('src/zlib_with_header_78.bin') as r: + self.assertEqual(r.data, b"\x61\x20\x71\x75\x69\x63\x6B\x20\x62\x72\x6F\x77\x6E\x20\x66\x6F\x78\x20\x6A\x75\x6D\x70\x73\x20\x6F\x76\x65\x72") From 85c5a8e8e13e185c57ddd9759fb570c7aa5033ee Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Fri, 17 Feb 2023 21:18:58 +0100 Subject: [PATCH 074/126] Regen newly added tests from KST to Python --- spec/python/test_bytes_eos_pad_term.py | 14 ++++++++++ spec/python/test_bytes_pad_term_empty.py | 14 ++++++++++ spec/python/test_bytes_pad_term_equal.py | 14 ++++++++++ spec/python/test_bytes_pad_term_roundtrip.py | 14 ++++++++++ spec/python/test_bytes_pad_term_zero_size.py | 14 ++++++++++ spec/python/test_expr_if_int_eq.py | 20 ++++++++++++++ spec/python/test_instance_in_repeat_expr.py | 15 +++++++++++ spec/python/test_instance_in_repeat_until.py | 16 ++++++++++++ spec/python/test_instance_in_sized.py | 20 ++++++++++++++ spec/python/test_instance_io_user_earlier.py | 26 +++++++++++++++++++ spec/python/test_params_pass_array_io.py | 12 +++++++++ spec/python/test_params_pass_io.py | 12 +++++++++ spec/python/test_process_bytes_pad_term.py | 14 ++++++++++ ...t_process_repeat_usertype_dynarg_custom.py | 15 +++++++++++ ...t_process_repeat_usertype_dynarg_rotate.py | 21 +++++++++++++++ ...test_process_repeat_usertype_dynarg_xor.py | 15 +++++++++++ spec/python/test_process_struct_pad_term.py | 14 ++++++++++ spec/python/test_process_term_struct.py | 13 ++++++++++ spec/python/test_repeat_eos_bytes.py | 14 ++++++++++ spec/python/test_repeat_eos_bytes_pad.py | 14 ++++++++++ spec/python/test_repeat_eos_bytes_pad_term.py | 14 ++++++++++ spec/python/test_repeat_eos_term_bytes.py | 13 ++++++++++ spec/python/test_repeat_eos_term_struct.py | 13 ++++++++++ spec/python/test_repeat_n_bytes.py | 14 ++++++++++ spec/python/test_repeat_n_bytes_pad.py | 14 ++++++++++ spec/python/test_repeat_n_bytes_pad_term.py | 14 ++++++++++ spec/python/test_repeat_n_term_bytes.py | 19 ++++++++++++++ spec/python/test_repeat_n_term_struct.py | 19 ++++++++++++++ spec/python/test_repeat_until_bytes.py | 14 ++++++++++ spec/python/test_repeat_until_bytes_pad.py | 14 ++++++++++ .../test_repeat_until_bytes_pad_term.py | 14 ++++++++++ spec/python/test_repeat_until_term_bytes.py | 19 ++++++++++++++ spec/python/test_repeat_until_term_struct.py | 19 ++++++++++++++ spec/python/test_str_eos_pad_term.py | 14 ++++++++++ spec/python/test_str_eos_pad_term_empty.py | 14 ++++++++++ spec/python/test_str_eos_pad_term_equal.py | 14 ++++++++++ spec/python/test_str_pad_term_equal.py | 14 ++++++++++ spec/python/test_str_pad_term_roundtrip.py | 14 ++++++++++ spec/python/test_str_pad_term_zero_size.py | 14 ++++++++++ spec/python/test_struct_pad_term.py | 14 ++++++++++ spec/python/test_struct_pad_term_equal.py | 14 ++++++++++ spec/python/test_term_bytes2.py | 13 ++++++++++ spec/python/test_term_bytes3.py | 13 ++++++++++ spec/python/test_term_bytes4.py | 13 ++++++++++ spec/python/test_term_struct.py | 13 ++++++++++ spec/python/test_term_struct2.py | 13 ++++++++++ spec/python/test_term_struct3.py | 13 ++++++++++ spec/python/test_term_struct4.py | 13 ++++++++++ spec/python/test_term_strz2.py | 13 ++++++++++ spec/python/test_term_strz3.py | 13 ++++++++++ spec/python/test_term_strz4.py | 13 ++++++++++ 51 files changed, 753 insertions(+) create mode 100644 spec/python/test_bytes_eos_pad_term.py create mode 100644 spec/python/test_bytes_pad_term_empty.py create mode 100644 spec/python/test_bytes_pad_term_equal.py create mode 100644 spec/python/test_bytes_pad_term_roundtrip.py create mode 100644 spec/python/test_bytes_pad_term_zero_size.py create mode 100644 spec/python/test_expr_if_int_eq.py create mode 100644 spec/python/test_instance_in_repeat_expr.py create mode 100644 spec/python/test_instance_in_repeat_until.py create mode 100644 spec/python/test_instance_in_sized.py create mode 100644 spec/python/test_instance_io_user_earlier.py create mode 100644 spec/python/test_params_pass_array_io.py create mode 100644 spec/python/test_params_pass_io.py create mode 100644 spec/python/test_process_bytes_pad_term.py create mode 100644 spec/python/test_process_repeat_usertype_dynarg_custom.py create mode 100644 spec/python/test_process_repeat_usertype_dynarg_rotate.py create mode 100644 spec/python/test_process_repeat_usertype_dynarg_xor.py create mode 100644 spec/python/test_process_struct_pad_term.py create mode 100644 spec/python/test_process_term_struct.py create mode 100644 spec/python/test_repeat_eos_bytes.py create mode 100644 spec/python/test_repeat_eos_bytes_pad.py create mode 100644 spec/python/test_repeat_eos_bytes_pad_term.py create mode 100644 spec/python/test_repeat_eos_term_bytes.py create mode 100644 spec/python/test_repeat_eos_term_struct.py create mode 100644 spec/python/test_repeat_n_bytes.py create mode 100644 spec/python/test_repeat_n_bytes_pad.py create mode 100644 spec/python/test_repeat_n_bytes_pad_term.py create mode 100644 spec/python/test_repeat_n_term_bytes.py create mode 100644 spec/python/test_repeat_n_term_struct.py create mode 100644 spec/python/test_repeat_until_bytes.py create mode 100644 spec/python/test_repeat_until_bytes_pad.py create mode 100644 spec/python/test_repeat_until_bytes_pad_term.py create mode 100644 spec/python/test_repeat_until_term_bytes.py create mode 100644 spec/python/test_repeat_until_term_struct.py create mode 100644 spec/python/test_str_eos_pad_term.py create mode 100644 spec/python/test_str_eos_pad_term_empty.py create mode 100644 spec/python/test_str_eos_pad_term_equal.py create mode 100644 spec/python/test_str_pad_term_equal.py create mode 100644 spec/python/test_str_pad_term_roundtrip.py create mode 100644 spec/python/test_str_pad_term_zero_size.py create mode 100644 spec/python/test_struct_pad_term.py create mode 100644 spec/python/test_struct_pad_term_equal.py create mode 100644 spec/python/test_term_bytes2.py create mode 100644 spec/python/test_term_bytes3.py create mode 100644 spec/python/test_term_bytes4.py create mode 100644 spec/python/test_term_struct.py create mode 100644 spec/python/test_term_struct2.py create mode 100644 spec/python/test_term_struct3.py create mode 100644 spec/python/test_term_struct4.py create mode 100644 spec/python/test_term_strz2.py create mode 100644 spec/python/test_term_strz3.py create mode 100644 spec/python/test_term_strz4.py diff --git a/spec/python/test_bytes_eos_pad_term.py b/spec/python/test_bytes_eos_pad_term.py new file mode 100644 index 000000000..532505d43 --- /dev/null +++ b/spec/python/test_bytes_eos_pad_term.py @@ -0,0 +1,14 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest + +from bytes_eos_pad_term import BytesEosPadTerm + +class TestBytesEosPadTerm(unittest.TestCase): + def test_bytes_eos_pad_term(self): + with BytesEosPadTerm.from_file('src/str_pad_term.bin') as r: + + self.assertEqual(r.str_pad.value, b"\x73\x74\x72\x31") + self.assertEqual(r.str_term.value, b"\x73\x74\x72\x32\x66\x6F\x6F") + self.assertEqual(r.str_term_and_pad.value, b"\x73\x74\x72\x2B\x2B\x2B\x33\x62\x61\x72\x2B\x2B\x2B") + self.assertEqual(r.str_term_include.value, b"\x73\x74\x72\x34\x62\x61\x7A\x40") diff --git a/spec/python/test_bytes_pad_term_empty.py b/spec/python/test_bytes_pad_term_empty.py new file mode 100644 index 000000000..453fd7e30 --- /dev/null +++ b/spec/python/test_bytes_pad_term_empty.py @@ -0,0 +1,14 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest + +from bytes_pad_term_empty import BytesPadTermEmpty + +class TestBytesPadTermEmpty(unittest.TestCase): + def test_bytes_pad_term_empty(self): + with BytesPadTermEmpty.from_file('src/str_pad_term_empty.bin') as r: + + self.assertEqual(r.str_pad, b"") + self.assertEqual(r.str_term, b"") + self.assertEqual(r.str_term_and_pad, b"") + self.assertEqual(r.str_term_include, b"\x40") diff --git a/spec/python/test_bytes_pad_term_equal.py b/spec/python/test_bytes_pad_term_equal.py new file mode 100644 index 000000000..9a33ac64e --- /dev/null +++ b/spec/python/test_bytes_pad_term_equal.py @@ -0,0 +1,14 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest + +from bytes_pad_term_equal import BytesPadTermEqual + +class TestBytesPadTermEqual(unittest.TestCase): + def test_bytes_pad_term_equal(self): + with BytesPadTermEqual.from_file('src/str_pad_term.bin') as r: + + self.assertEqual(r.s1, b"\x73\x74\x72\x31") + self.assertEqual(r.s2, b"\x73\x74\x72\x32\x66\x6F\x6F\x40") + self.assertEqual(r.s3, b"\x73\x74\x72") + self.assertEqual(r.s4, b"\x73\x74\x72\x34\x62\x61\x7A\x40\x2E") diff --git a/spec/python/test_bytes_pad_term_roundtrip.py b/spec/python/test_bytes_pad_term_roundtrip.py new file mode 100644 index 000000000..ed6773566 --- /dev/null +++ b/spec/python/test_bytes_pad_term_roundtrip.py @@ -0,0 +1,14 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest + +from bytes_pad_term_roundtrip import BytesPadTermRoundtrip + +class TestBytesPadTermRoundtrip(unittest.TestCase): + def test_bytes_pad_term_roundtrip(self): + with BytesPadTermRoundtrip.from_file('src/str_pad_term.bin') as r: + + self.assertEqual(r.str_pad, b"\x73\x74\x72\x31") + self.assertEqual(r.str_term, b"\x73\x74\x72\x32\x66\x6F\x6F") + self.assertEqual(r.str_term_and_pad, b"\x73\x74\x72\x2B\x2B\x2B\x33\x62\x61\x72\x2B\x2B\x2B") + self.assertEqual(r.str_term_include, b"\x73\x74\x72\x34\x62\x61\x7A\x40") diff --git a/spec/python/test_bytes_pad_term_zero_size.py b/spec/python/test_bytes_pad_term_zero_size.py new file mode 100644 index 000000000..cae9449cc --- /dev/null +++ b/spec/python/test_bytes_pad_term_zero_size.py @@ -0,0 +1,14 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest + +from bytes_pad_term_zero_size import BytesPadTermZeroSize + +class TestBytesPadTermZeroSize(unittest.TestCase): + def test_bytes_pad_term_zero_size(self): + with BytesPadTermZeroSize.from_file('src/enum_negative.bin') as r: + + self.assertEqual(r.str_pad, b"") + self.assertEqual(r.str_term, b"") + self.assertEqual(r.str_term_and_pad, b"") + self.assertEqual(r.str_term_include, b"") diff --git a/spec/python/test_expr_if_int_eq.py b/spec/python/test_expr_if_int_eq.py new file mode 100644 index 000000000..708e85f1b --- /dev/null +++ b/spec/python/test_expr_if_int_eq.py @@ -0,0 +1,20 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest + +from expr_if_int_eq import ExprIfIntEq + +class TestExprIfIntEq(unittest.TestCase): + def test_expr_if_int_eq(self): + with ExprIfIntEq.from_file('src/process_coerce_switch.bin') as r: + + self.assertEqual(r.seq_eq_lit, True) + self.assertEqual(r.seq_eq_calc, True) + self.assertEqual(r.seq_eq_calc_if, True) + self.assertEqual(r.seq_eq_seq_if, True) + self.assertEqual(r.calc_eq_lit, True) + self.assertEqual(r.calc_eq_calc_if, True) + self.assertEqual(r.calc_eq_seq_if, True) + self.assertEqual(r.calc_if_eq_lit, True) + self.assertEqual(r.calc_if_eq_seq_if, True) + self.assertEqual(r.seq_if_eq_lit, True) diff --git a/spec/python/test_instance_in_repeat_expr.py b/spec/python/test_instance_in_repeat_expr.py new file mode 100644 index 000000000..5064e1344 --- /dev/null +++ b/spec/python/test_instance_in_repeat_expr.py @@ -0,0 +1,15 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest + +from instance_in_repeat_expr import InstanceInRepeatExpr + +class TestInstanceInRepeatExpr(unittest.TestCase): + def test_instance_in_repeat_expr(self): + with InstanceInRepeatExpr.from_file('src/instance_in_repeat_expr.bin') as r: + + self.assertEqual(len(r.chunks), 2) + self.assertEqual(r.chunks[0].offset, 16) + self.assertEqual(r.chunks[0].len, 8312) + self.assertEqual(r.chunks[1].offset, 8328) + self.assertEqual(r.chunks[1].len, 15) diff --git a/spec/python/test_instance_in_repeat_until.py b/spec/python/test_instance_in_repeat_until.py new file mode 100644 index 000000000..149b07cfc --- /dev/null +++ b/spec/python/test_instance_in_repeat_until.py @@ -0,0 +1,16 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest + +from instance_in_repeat_until import InstanceInRepeatUntil + +class TestInstanceInRepeatUntil(unittest.TestCase): + def test_instance_in_repeat_until(self): + with InstanceInRepeatUntil.from_file('src/repeat_until_s4.bin') as r: + + self.assertEqual(len(r.entries), 5) + self.assertEqual(r.entries[0], 66) + self.assertEqual(r.entries[1], 0) + self.assertEqual(r.entries[2], 4919) + self.assertEqual(r.entries[3], 0) + self.assertEqual(r.entries[4], -1) diff --git a/spec/python/test_instance_in_sized.py b/spec/python/test_instance_in_sized.py new file mode 100644 index 000000000..16456a314 --- /dev/null +++ b/spec/python/test_instance_in_sized.py @@ -0,0 +1,20 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest + +from instance_in_sized import InstanceInSized + +class TestInstanceInSized(unittest.TestCase): + def test_instance_in_sized(self): + with InstanceInSized.from_file('src/process_rotate.bin') as r: + + self.assertEqual(r.cont.seq_sized.seq_f, 9) + self.assertEqual(r.cont.seq_sized.inst_invoked, 172) + self.assertEqual(r.cont.seq_sized.inst_unused_by_seq, b"\x8D\x8D") + self.assertEqual(r.cont.seq_in_stream.seq_f, 237) + self.assertEqual(r.cont.seq_in_stream.inst, b"\xBA\x7B\x93") + self.assertEqual(r.cont.inst_in_stream.seq_f, 99) + self.assertEqual(r.cont.inst_in_stream.inst, b"\x23\x01\x2A") + self.assertEqual(r.cont.inst_sized.seq_f, 52) + self.assertEqual(r.cont.inst_sized.inst_invoked, 178) + self.assertEqual(r.cont.inst_sized.inst_unused_by_seq, b"\x39\xB2") diff --git a/spec/python/test_instance_io_user_earlier.py b/spec/python/test_instance_io_user_earlier.py new file mode 100644 index 000000000..fcc54d8f4 --- /dev/null +++ b/spec/python/test_instance_io_user_earlier.py @@ -0,0 +1,26 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest + +from instance_io_user_earlier import InstanceIoUserEarlier + +class TestInstanceIoUserEarlier(unittest.TestCase): + def test_instance_io_user_earlier(self): + with InstanceIoUserEarlier.from_file('src/switch_opcodes2.bin') as r: + + self.assertEqual(r.sized_a.content, 83) + self.assertEqual(r.into_a.inst.content, 102) + self.assertEqual(r.a_mid, 28527) + self.assertEqual(r.into_a.inst.last, 0) + self.assertEqual(r.sized_a.last, 88) + self.assertEqual(r.sized_b.content, 66) + self.assertEqual(r.into_b.inst.content, 0) + self.assertEqual(r.b_mid, 0) + self.assertEqual(r.into_b.inst.last, 89) + self.assertEqual(r.sized_b.last, 254) + self.assertEqual(r.into_b.indicator, 202) + self.assertEqual(r.into_a_skipped.indicator, 0) + self.assertEqual(r.into_a_skipped.inst._io.size(), 0) + self.assertEqual(r.into_a.indicator, 0) + self.assertEqual(r.into_a.bar, 73) + self.assertEqual(r.last_accessor.v, 7) diff --git a/spec/python/test_params_pass_array_io.py b/spec/python/test_params_pass_array_io.py new file mode 100644 index 000000000..84debc19d --- /dev/null +++ b/spec/python/test_params_pass_array_io.py @@ -0,0 +1,12 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest + +from params_pass_array_io import ParamsPassArrayIo + +class TestParamsPassArrayIo(unittest.TestCase): + def test_params_pass_array_io(self): + with ParamsPassArrayIo.from_file('src/enum_negative.bin') as r: + + self.assertEqual(r.first.foo, 255) + self.assertEqual(r.one.buf, b"\x01") diff --git a/spec/python/test_params_pass_io.py b/spec/python/test_params_pass_io.py new file mode 100644 index 000000000..36161c777 --- /dev/null +++ b/spec/python/test_params_pass_io.py @@ -0,0 +1,12 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest + +from params_pass_io import ParamsPassIo + +class TestParamsPassIo(unittest.TestCase): + def test_params_pass_io(self): + with ParamsPassIo.from_file('src/enum_negative.bin') as r: + + self.assertEqual(r.first.foo, 255) + self.assertEqual(r.one.buf, b"\x01") diff --git a/spec/python/test_process_bytes_pad_term.py b/spec/python/test_process_bytes_pad_term.py new file mode 100644 index 000000000..9d7b3d248 --- /dev/null +++ b/spec/python/test_process_bytes_pad_term.py @@ -0,0 +1,14 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest + +from process_bytes_pad_term import ProcessBytesPadTerm + +class TestProcessBytesPadTerm(unittest.TestCase): + def test_process_bytes_pad_term(self): + with ProcessBytesPadTerm.from_file('src/str_pad_term.bin') as r: + + self.assertEqual(r.str_pad, b"\x66\x61\x67\x24") + self.assertEqual(r.str_term, b"\x66\x61\x67\x27\x73\x7A\x7A") + self.assertEqual(r.str_term_and_pad, b"\x66\x61\x67\x3E\x3E\x3E\x26\x77\x74\x67\x3E\x3E\x3E") + self.assertEqual(r.str_term_include, b"\x66\x61\x67\x21\x77\x74\x6F\x55") diff --git a/spec/python/test_process_repeat_usertype_dynarg_custom.py b/spec/python/test_process_repeat_usertype_dynarg_custom.py new file mode 100644 index 000000000..7de04d7d3 --- /dev/null +++ b/spec/python/test_process_repeat_usertype_dynarg_custom.py @@ -0,0 +1,15 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest + +from process_repeat_usertype_dynarg_custom import ProcessRepeatUsertypeDynargCustom + +class TestProcessRepeatUsertypeDynargCustom(unittest.TestCase): + def test_process_repeat_usertype_dynarg_custom(self): + with ProcessRepeatUsertypeDynargCustom.from_file('src/process_rotate.bin') as r: + + self.assertEqual(r.blocks[0].a, 2290657028) + self.assertEqual(r.blocks[1].a, 2057999057) + self.assertEqual(r.blocks_b.dummy, 1) + self.assertEqual(r.blocks_b.blocks_0_b, 232) + self.assertEqual(r.blocks_b.blocks_1_b, 58) diff --git a/spec/python/test_process_repeat_usertype_dynarg_rotate.py b/spec/python/test_process_repeat_usertype_dynarg_rotate.py new file mode 100644 index 000000000..75c3bf995 --- /dev/null +++ b/spec/python/test_process_repeat_usertype_dynarg_rotate.py @@ -0,0 +1,21 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest + +from process_repeat_usertype_dynarg_rotate import ProcessRepeatUsertypeDynargRotate + +class TestProcessRepeatUsertypeDynargRotate(unittest.TestCase): + def test_process_repeat_usertype_dynarg_rotate(self): + with ProcessRepeatUsertypeDynargRotate.from_file('src/process_rotate.bin') as r: + + self.assertEqual(r.blocks_rol[0].a, 25928) + self.assertEqual(r.blocks_rol[1].a, 46902) + self.assertEqual(r.blocks_ror[0].a, 29295) + self.assertEqual(r.blocks_ror[1].a, 16584) + self.assertEqual(r.blocks_ror[2].a, 22810) + self.assertEqual(r.blocks_b.dummy, 178) + self.assertEqual(r.blocks_b.blocks_rol_0_b, 108) + self.assertEqual(r.blocks_b.blocks_rol_1_b, 234) + self.assertEqual(r.blocks_b.blocks_ror_0_b, 108) + self.assertEqual(r.blocks_b.blocks_ror_1_b, 138) + self.assertEqual(r.blocks_b.blocks_ror_2_b, 156) diff --git a/spec/python/test_process_repeat_usertype_dynarg_xor.py b/spec/python/test_process_repeat_usertype_dynarg_xor.py new file mode 100644 index 000000000..3576f4926 --- /dev/null +++ b/spec/python/test_process_repeat_usertype_dynarg_xor.py @@ -0,0 +1,15 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest + +from process_repeat_usertype_dynarg_xor import ProcessRepeatUsertypeDynargXor + +class TestProcessRepeatUsertypeDynargXor(unittest.TestCase): + def test_process_repeat_usertype_dynarg_xor(self): + with ProcessRepeatUsertypeDynargXor.from_file('src/process_xor_4.bin') as r: + + self.assertEqual(r.blocks[0].a, 2319263090) + self.assertEqual(r.blocks[1].a, 263540053) + self.assertEqual(r.blocks_b.dummy, 209) + self.assertEqual(r.blocks_b.blocks_0_b, 20) + self.assertEqual(r.blocks_b.blocks_1_b, 91) diff --git a/spec/python/test_process_struct_pad_term.py b/spec/python/test_process_struct_pad_term.py new file mode 100644 index 000000000..c8c8d9334 --- /dev/null +++ b/spec/python/test_process_struct_pad_term.py @@ -0,0 +1,14 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest + +from process_struct_pad_term import ProcessStructPadTerm + +class TestProcessStructPadTerm(unittest.TestCase): + def test_process_struct_pad_term(self): + with ProcessStructPadTerm.from_file('src/str_pad_term.bin') as r: + + self.assertEqual(r.str_pad.value, b"\x66\x61\x67\x24") + self.assertEqual(r.str_term.value, b"\x66\x61\x67\x27\x73\x7A\x7A") + self.assertEqual(r.str_term_and_pad.value, b"\x66\x61\x67\x3E\x3E\x3E\x26\x77\x74\x67\x3E\x3E\x3E") + self.assertEqual(r.str_term_include.value, b"\x66\x61\x67\x21\x77\x74\x6F\x55") diff --git a/spec/python/test_process_term_struct.py b/spec/python/test_process_term_struct.py new file mode 100644 index 000000000..59823b99d --- /dev/null +++ b/spec/python/test_process_term_struct.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest + +from process_term_struct import ProcessTermStruct + +class TestProcessTermStruct(unittest.TestCase): + def test_process_term_struct(self): + with ProcessTermStruct.from_file('src/term_strz.bin') as r: + + self.assertEqual(r.s1.value, b"\x46\x4F\x4F") + self.assertEqual(r.s2.value, b"\x42\x41\x52") + self.assertEqual(r.s3.value, b"\x5C\x42\x41\x5A\x20") diff --git a/spec/python/test_repeat_eos_bytes.py b/spec/python/test_repeat_eos_bytes.py new file mode 100644 index 000000000..e59438662 --- /dev/null +++ b/spec/python/test_repeat_eos_bytes.py @@ -0,0 +1,14 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest + +from repeat_eos_bytes import RepeatEosBytes + +class TestRepeatEosBytes(unittest.TestCase): + def test_repeat_eos_bytes(self): + with RepeatEosBytes.from_file('src/repeat_until_process.bin') as r: + + self.assertEqual(len(r.records), 3) + self.assertEqual(r.records[0], b"\xE8\xBA\xAA\xAA\xAA") + self.assertEqual(r.records[1], b"\xFA\x9E\xB8\xAA\xAA") + self.assertEqual(r.records[2], b"\xAA\x55\x55\x55\x55") diff --git a/spec/python/test_repeat_eos_bytes_pad.py b/spec/python/test_repeat_eos_bytes_pad.py new file mode 100644 index 000000000..d6754084c --- /dev/null +++ b/spec/python/test_repeat_eos_bytes_pad.py @@ -0,0 +1,14 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest + +from repeat_eos_bytes_pad import RepeatEosBytesPad + +class TestRepeatEosBytesPad(unittest.TestCase): + def test_repeat_eos_bytes_pad(self): + with RepeatEosBytesPad.from_file('src/repeat_until_process.bin') as r: + + self.assertEqual(len(r.records), 3) + self.assertEqual(r.records[0], b"\xE8\xBA") + self.assertEqual(r.records[1], b"\xFA\x9E\xB8") + self.assertEqual(r.records[2], b"\xAA\x55\x55\x55\x55") diff --git a/spec/python/test_repeat_eos_bytes_pad_term.py b/spec/python/test_repeat_eos_bytes_pad_term.py new file mode 100644 index 000000000..1df902171 --- /dev/null +++ b/spec/python/test_repeat_eos_bytes_pad_term.py @@ -0,0 +1,14 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest + +from repeat_eos_bytes_pad_term import RepeatEosBytesPadTerm + +class TestRepeatEosBytesPadTerm(unittest.TestCase): + def test_repeat_eos_bytes_pad_term(self): + with RepeatEosBytesPadTerm.from_file('src/repeat_until_process.bin') as r: + + self.assertEqual(len(r.records), 3) + self.assertEqual(r.records[0], b"\xE8\xBA") + self.assertEqual(r.records[1], b"\xFA\x9E\xB8") + self.assertEqual(r.records[2], b"\xAA\x55") diff --git a/spec/python/test_repeat_eos_term_bytes.py b/spec/python/test_repeat_eos_term_bytes.py new file mode 100644 index 000000000..222b81ead --- /dev/null +++ b/spec/python/test_repeat_eos_term_bytes.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest + +from repeat_eos_term_bytes import RepeatEosTermBytes + +class TestRepeatEosTermBytes(unittest.TestCase): + def test_repeat_eos_term_bytes(self): + with RepeatEosTermBytes.from_file('src/process_rotate.bin') as r: + + self.assertEqual(len(r.records), 2) + self.assertEqual(r.records[0], b"\x09\xAC\x8D\x8D\xED\xBA\x7B\x93\x63\x23\x01\x2A\x34\xB2") + self.assertEqual(r.records[1], b"\x39\xB2") diff --git a/spec/python/test_repeat_eos_term_struct.py b/spec/python/test_repeat_eos_term_struct.py new file mode 100644 index 000000000..c5ddb9a29 --- /dev/null +++ b/spec/python/test_repeat_eos_term_struct.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest + +from repeat_eos_term_struct import RepeatEosTermStruct + +class TestRepeatEosTermStruct(unittest.TestCase): + def test_repeat_eos_term_struct(self): + with RepeatEosTermStruct.from_file('src/process_rotate.bin') as r: + + self.assertEqual(len(r.records), 2) + self.assertEqual(r.records[0].value, b"\x09\xAC\x8D\x8D\xED\xBA\x7B\x93\x63\x23\x01\x2A\x34\xB2") + self.assertEqual(r.records[1].value, b"\x39\xB2") diff --git a/spec/python/test_repeat_n_bytes.py b/spec/python/test_repeat_n_bytes.py new file mode 100644 index 000000000..00b9d1d73 --- /dev/null +++ b/spec/python/test_repeat_n_bytes.py @@ -0,0 +1,14 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest + +from repeat_n_bytes import RepeatNBytes + +class TestRepeatNBytes(unittest.TestCase): + def test_repeat_n_bytes(self): + with RepeatNBytes.from_file('src/repeat_until_process.bin') as r: + + self.assertEqual(len(r.records), 3) + self.assertEqual(r.records[0], b"\xE8\xBA\xAA\xAA\xAA") + self.assertEqual(r.records[1], b"\xFA\x9E\xB8\xAA\xAA") + self.assertEqual(r.records[2], b"\xAA\x55\x55\x55\x55") diff --git a/spec/python/test_repeat_n_bytes_pad.py b/spec/python/test_repeat_n_bytes_pad.py new file mode 100644 index 000000000..6e75c8eb5 --- /dev/null +++ b/spec/python/test_repeat_n_bytes_pad.py @@ -0,0 +1,14 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest + +from repeat_n_bytes_pad import RepeatNBytesPad + +class TestRepeatNBytesPad(unittest.TestCase): + def test_repeat_n_bytes_pad(self): + with RepeatNBytesPad.from_file('src/repeat_until_process.bin') as r: + + self.assertEqual(len(r.records), 3) + self.assertEqual(r.records[0], b"\xE8\xBA") + self.assertEqual(r.records[1], b"\xFA\x9E\xB8") + self.assertEqual(r.records[2], b"\xAA\x55\x55\x55\x55") diff --git a/spec/python/test_repeat_n_bytes_pad_term.py b/spec/python/test_repeat_n_bytes_pad_term.py new file mode 100644 index 000000000..7749b6ab5 --- /dev/null +++ b/spec/python/test_repeat_n_bytes_pad_term.py @@ -0,0 +1,14 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest + +from repeat_n_bytes_pad_term import RepeatNBytesPadTerm + +class TestRepeatNBytesPadTerm(unittest.TestCase): + def test_repeat_n_bytes_pad_term(self): + with RepeatNBytesPadTerm.from_file('src/repeat_until_process.bin') as r: + + self.assertEqual(len(r.records), 3) + self.assertEqual(r.records[0], b"\xE8\xBA") + self.assertEqual(r.records[1], b"\xFA\x9E\xB8") + self.assertEqual(r.records[2], b"\xAA\x55") diff --git a/spec/python/test_repeat_n_term_bytes.py b/spec/python/test_repeat_n_term_bytes.py new file mode 100644 index 000000000..85ef1092c --- /dev/null +++ b/spec/python/test_repeat_n_term_bytes.py @@ -0,0 +1,19 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest + +from repeat_n_term_bytes import RepeatNTermBytes + +class TestRepeatNTermBytes(unittest.TestCase): + def test_repeat_n_term_bytes(self): + with RepeatNTermBytes.from_file('src/repeat_until_process.bin') as r: + + self.assertEqual(len(r.records1), 2) + self.assertEqual(r.records1[0], b"\xE8\xBA") + self.assertEqual(r.records1[1], b"") + self.assertEqual(len(r.records2), 2) + self.assertEqual(r.records2[0], b"\xAA") + self.assertEqual(r.records2[1], b"\xFA\x9E\xB8\xAA") + self.assertEqual(len(r.records3), 2) + self.assertEqual(r.records3[0], b"\xAA\xAA") + self.assertEqual(r.records3[1], b"") diff --git a/spec/python/test_repeat_n_term_struct.py b/spec/python/test_repeat_n_term_struct.py new file mode 100644 index 000000000..b45fae986 --- /dev/null +++ b/spec/python/test_repeat_n_term_struct.py @@ -0,0 +1,19 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest + +from repeat_n_term_struct import RepeatNTermStruct + +class TestRepeatNTermStruct(unittest.TestCase): + def test_repeat_n_term_struct(self): + with RepeatNTermStruct.from_file('src/repeat_until_process.bin') as r: + + self.assertEqual(len(r.records1), 2) + self.assertEqual(r.records1[0].value, b"\xE8\xBA") + self.assertEqual(r.records1[1].value, b"") + self.assertEqual(len(r.records2), 2) + self.assertEqual(r.records2[0].value, b"\xAA") + self.assertEqual(r.records2[1].value, b"\xFA\x9E\xB8\xAA") + self.assertEqual(len(r.records3), 2) + self.assertEqual(r.records3[0].value, b"\xAA\xAA") + self.assertEqual(r.records3[1].value, b"") diff --git a/spec/python/test_repeat_until_bytes.py b/spec/python/test_repeat_until_bytes.py new file mode 100644 index 000000000..9409a6165 --- /dev/null +++ b/spec/python/test_repeat_until_bytes.py @@ -0,0 +1,14 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest + +from repeat_until_bytes import RepeatUntilBytes + +class TestRepeatUntilBytes(unittest.TestCase): + def test_repeat_until_bytes(self): + with RepeatUntilBytes.from_file('src/repeat_until_process.bin') as r: + + self.assertEqual(len(r.records), 3) + self.assertEqual(r.records[0], b"\xE8\xBA\xAA\xAA\xAA") + self.assertEqual(r.records[1], b"\xFA\x9E\xB8\xAA\xAA") + self.assertEqual(r.records[2], b"\xAA\x55\x55\x55\x55") diff --git a/spec/python/test_repeat_until_bytes_pad.py b/spec/python/test_repeat_until_bytes_pad.py new file mode 100644 index 000000000..ccd7e5676 --- /dev/null +++ b/spec/python/test_repeat_until_bytes_pad.py @@ -0,0 +1,14 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest + +from repeat_until_bytes_pad import RepeatUntilBytesPad + +class TestRepeatUntilBytesPad(unittest.TestCase): + def test_repeat_until_bytes_pad(self): + with RepeatUntilBytesPad.from_file('src/repeat_until_process.bin') as r: + + self.assertEqual(len(r.records), 3) + self.assertEqual(r.records[0], b"\xE8\xBA") + self.assertEqual(r.records[1], b"\xFA\x9E\xB8") + self.assertEqual(r.records[2], b"\xAA\x55\x55\x55\x55") diff --git a/spec/python/test_repeat_until_bytes_pad_term.py b/spec/python/test_repeat_until_bytes_pad_term.py new file mode 100644 index 000000000..172583223 --- /dev/null +++ b/spec/python/test_repeat_until_bytes_pad_term.py @@ -0,0 +1,14 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest + +from repeat_until_bytes_pad_term import RepeatUntilBytesPadTerm + +class TestRepeatUntilBytesPadTerm(unittest.TestCase): + def test_repeat_until_bytes_pad_term(self): + with RepeatUntilBytesPadTerm.from_file('src/repeat_until_process.bin') as r: + + self.assertEqual(len(r.records), 3) + self.assertEqual(r.records[0], b"\xE8\xBA") + self.assertEqual(r.records[1], b"\xFA\x9E\xB8") + self.assertEqual(r.records[2], b"\xAA\x55") diff --git a/spec/python/test_repeat_until_term_bytes.py b/spec/python/test_repeat_until_term_bytes.py new file mode 100644 index 000000000..7c2dcb6a4 --- /dev/null +++ b/spec/python/test_repeat_until_term_bytes.py @@ -0,0 +1,19 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest + +from repeat_until_term_bytes import RepeatUntilTermBytes + +class TestRepeatUntilTermBytes(unittest.TestCase): + def test_repeat_until_term_bytes(self): + with RepeatUntilTermBytes.from_file('src/repeat_until_process.bin') as r: + + self.assertEqual(len(r.records1), 2) + self.assertEqual(r.records1[0], b"\xE8\xBA") + self.assertEqual(r.records1[1], b"") + self.assertEqual(len(r.records2), 2) + self.assertEqual(r.records2[0], b"\xAA") + self.assertEqual(r.records2[1], b"\xFA\x9E\xB8\xAA") + self.assertEqual(len(r.records3), 2) + self.assertEqual(r.records3[0], b"\xAA\xAA") + self.assertEqual(r.records3[1], b"") diff --git a/spec/python/test_repeat_until_term_struct.py b/spec/python/test_repeat_until_term_struct.py new file mode 100644 index 000000000..f19c1efad --- /dev/null +++ b/spec/python/test_repeat_until_term_struct.py @@ -0,0 +1,19 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest + +from repeat_until_term_struct import RepeatUntilTermStruct + +class TestRepeatUntilTermStruct(unittest.TestCase): + def test_repeat_until_term_struct(self): + with RepeatUntilTermStruct.from_file('src/repeat_until_process.bin') as r: + + self.assertEqual(len(r.records1), 2) + self.assertEqual(r.records1[0].value, b"\xE8\xBA") + self.assertEqual(r.records1[1].value, b"") + self.assertEqual(len(r.records2), 2) + self.assertEqual(r.records2[0].value, b"\xAA") + self.assertEqual(r.records2[1].value, b"\xFA\x9E\xB8\xAA") + self.assertEqual(len(r.records3), 2) + self.assertEqual(r.records3[0].value, b"\xAA\xAA") + self.assertEqual(r.records3[1].value, b"") diff --git a/spec/python/test_str_eos_pad_term.py b/spec/python/test_str_eos_pad_term.py new file mode 100644 index 000000000..caa8d56de --- /dev/null +++ b/spec/python/test_str_eos_pad_term.py @@ -0,0 +1,14 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest + +from str_eos_pad_term import StrEosPadTerm + +class TestStrEosPadTerm(unittest.TestCase): + def test_str_eos_pad_term(self): + with StrEosPadTerm.from_file('src/str_pad_term.bin') as r: + + self.assertEqual(r.str_pad.value, u"str1") + self.assertEqual(r.str_term.value, u"str2foo") + self.assertEqual(r.str_term_and_pad.value, u"str+++3bar+++") + self.assertEqual(r.str_term_include.value, u"str4baz@") diff --git a/spec/python/test_str_eos_pad_term_empty.py b/spec/python/test_str_eos_pad_term_empty.py new file mode 100644 index 000000000..fbc4c3240 --- /dev/null +++ b/spec/python/test_str_eos_pad_term_empty.py @@ -0,0 +1,14 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest + +from str_eos_pad_term_empty import StrEosPadTermEmpty + +class TestStrEosPadTermEmpty(unittest.TestCase): + def test_str_eos_pad_term_empty(self): + with StrEosPadTermEmpty.from_file('src/str_pad_term_empty.bin') as r: + + self.assertEqual(r.str_pad.value, u"") + self.assertEqual(r.str_term.value, u"") + self.assertEqual(r.str_term_and_pad.value, u"") + self.assertEqual(r.str_term_include.value, u"@") diff --git a/spec/python/test_str_eos_pad_term_equal.py b/spec/python/test_str_eos_pad_term_equal.py new file mode 100644 index 000000000..44b142602 --- /dev/null +++ b/spec/python/test_str_eos_pad_term_equal.py @@ -0,0 +1,14 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest + +from str_eos_pad_term_equal import StrEosPadTermEqual + +class TestStrEosPadTermEqual(unittest.TestCase): + def test_str_eos_pad_term_equal(self): + with StrEosPadTermEqual.from_file('src/str_pad_term.bin') as r: + + self.assertEqual(r.s1.value, u"str1") + self.assertEqual(r.s2.value, u"str2foo@") + self.assertEqual(r.s3.value, u"str") + self.assertEqual(r.s4.value, u"str4baz@.") diff --git a/spec/python/test_str_pad_term_equal.py b/spec/python/test_str_pad_term_equal.py new file mode 100644 index 000000000..5a75e67fc --- /dev/null +++ b/spec/python/test_str_pad_term_equal.py @@ -0,0 +1,14 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest + +from str_pad_term_equal import StrPadTermEqual + +class TestStrPadTermEqual(unittest.TestCase): + def test_str_pad_term_equal(self): + with StrPadTermEqual.from_file('src/str_pad_term.bin') as r: + + self.assertEqual(r.s1, u"str1") + self.assertEqual(r.s2, u"str2foo@") + self.assertEqual(r.s3, u"str") + self.assertEqual(r.s4, u"str4baz@.") diff --git a/spec/python/test_str_pad_term_roundtrip.py b/spec/python/test_str_pad_term_roundtrip.py new file mode 100644 index 000000000..84ccf8925 --- /dev/null +++ b/spec/python/test_str_pad_term_roundtrip.py @@ -0,0 +1,14 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest + +from str_pad_term_roundtrip import StrPadTermRoundtrip + +class TestStrPadTermRoundtrip(unittest.TestCase): + def test_str_pad_term_roundtrip(self): + with StrPadTermRoundtrip.from_file('src/str_pad_term.bin') as r: + + self.assertEqual(r.str_pad, u"str1") + self.assertEqual(r.str_term, u"str2foo") + self.assertEqual(r.str_term_and_pad, u"str+++3bar+++") + self.assertEqual(r.str_term_include, u"str4baz@") diff --git a/spec/python/test_str_pad_term_zero_size.py b/spec/python/test_str_pad_term_zero_size.py new file mode 100644 index 000000000..0ea75dec3 --- /dev/null +++ b/spec/python/test_str_pad_term_zero_size.py @@ -0,0 +1,14 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest + +from str_pad_term_zero_size import StrPadTermZeroSize + +class TestStrPadTermZeroSize(unittest.TestCase): + def test_str_pad_term_zero_size(self): + with StrPadTermZeroSize.from_file('src/enum_negative.bin') as r: + + self.assertEqual(r.str_pad, u"") + self.assertEqual(r.str_term, u"") + self.assertEqual(r.str_term_and_pad, u"") + self.assertEqual(r.str_term_include, u"") diff --git a/spec/python/test_struct_pad_term.py b/spec/python/test_struct_pad_term.py new file mode 100644 index 000000000..353a2013b --- /dev/null +++ b/spec/python/test_struct_pad_term.py @@ -0,0 +1,14 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest + +from struct_pad_term import StructPadTerm + +class TestStructPadTerm(unittest.TestCase): + def test_struct_pad_term(self): + with StructPadTerm.from_file('src/str_pad_term.bin') as r: + + self.assertEqual(r.str_pad.value, b"\x73\x74\x72\x31") + self.assertEqual(r.str_term.value, b"\x73\x74\x72\x32\x66\x6F\x6F") + self.assertEqual(r.str_term_and_pad.value, b"\x73\x74\x72\x2B\x2B\x2B\x33\x62\x61\x72\x2B\x2B\x2B") + self.assertEqual(r.str_term_include.value, b"\x73\x74\x72\x34\x62\x61\x7A\x40") diff --git a/spec/python/test_struct_pad_term_equal.py b/spec/python/test_struct_pad_term_equal.py new file mode 100644 index 000000000..500641b21 --- /dev/null +++ b/spec/python/test_struct_pad_term_equal.py @@ -0,0 +1,14 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest + +from struct_pad_term_equal import StructPadTermEqual + +class TestStructPadTermEqual(unittest.TestCase): + def test_struct_pad_term_equal(self): + with StructPadTermEqual.from_file('src/str_pad_term.bin') as r: + + self.assertEqual(r.s1.value, b"\x73\x74\x72\x31") + self.assertEqual(r.s2.value, b"\x73\x74\x72\x32\x66\x6F\x6F\x40") + self.assertEqual(r.s3.value, b"\x73\x74\x72") + self.assertEqual(r.s4.value, b"\x73\x74\x72\x34\x62\x61\x7A\x40\x2E") diff --git a/spec/python/test_term_bytes2.py b/spec/python/test_term_bytes2.py new file mode 100644 index 000000000..86cccdaaf --- /dev/null +++ b/spec/python/test_term_bytes2.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest + +from term_bytes2 import TermBytes2 + +class TestTermBytes2(unittest.TestCase): + def test_term_bytes2(self): + with TermBytes2.from_file('src/term_strz.bin') as r: + + self.assertEqual(r.s1, b"\x66\x6F\x6F") + self.assertEqual(r.s2, b"\x62\x61\x72\x7C") + self.assertEqual(r.s3, b"\x62\x61\x7A") diff --git a/spec/python/test_term_bytes3.py b/spec/python/test_term_bytes3.py new file mode 100644 index 000000000..9c8638d1a --- /dev/null +++ b/spec/python/test_term_bytes3.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest + +from term_bytes3 import TermBytes3 + +class TestTermBytes3(unittest.TestCase): + def test_term_bytes3(self): + with TermBytes3.from_file('src/term_strz.bin') as r: + + self.assertEqual(r.s1, b"\x66\x6F\x6F") + self.assertEqual(r.s2, b"\x7C\x62\x61\x72\x7C\x62\x61\x7A") + self.assertEqual(r.s3, b"") diff --git a/spec/python/test_term_bytes4.py b/spec/python/test_term_bytes4.py new file mode 100644 index 000000000..fda7156e1 --- /dev/null +++ b/spec/python/test_term_bytes4.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest + +from term_bytes4 import TermBytes4 + +class TestTermBytes4(unittest.TestCase): + def test_term_bytes4(self): + with TermBytes4.from_file('src/term_strz.bin') as r: + + self.assertEqual(r.s1.value, b"\x66\x6F\x6F") + self.assertEqual(r.s2.value, b"\x62\x61\x72") + self.assertEqual(r.s3.value, b"\x62\x61\x7A") diff --git a/spec/python/test_term_struct.py b/spec/python/test_term_struct.py new file mode 100644 index 000000000..c7835b300 --- /dev/null +++ b/spec/python/test_term_struct.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest + +from term_struct import TermStruct + +class TestTermStruct(unittest.TestCase): + def test_term_struct(self): + with TermStruct.from_file('src/term_strz.bin') as r: + + self.assertEqual(r.s1.value, b"\x66\x6F\x6F") + self.assertEqual(r.s2.value, b"\x62\x61\x72") + self.assertEqual(r.s3.value, b"\x7C\x62\x61\x7A\x40") diff --git a/spec/python/test_term_struct2.py b/spec/python/test_term_struct2.py new file mode 100644 index 000000000..05949347e --- /dev/null +++ b/spec/python/test_term_struct2.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest + +from term_struct2 import TermStruct2 + +class TestTermStruct2(unittest.TestCase): + def test_term_struct2(self): + with TermStruct2.from_file('src/term_strz.bin') as r: + + self.assertEqual(r.s1.value, b"\x66\x6F\x6F") + self.assertEqual(r.s2.value, b"\x62\x61\x72\x7C") + self.assertEqual(r.s3.value, b"\x62\x61\x7A") diff --git a/spec/python/test_term_struct3.py b/spec/python/test_term_struct3.py new file mode 100644 index 000000000..5d378e62d --- /dev/null +++ b/spec/python/test_term_struct3.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest + +from term_struct3 import TermStruct3 + +class TestTermStruct3(unittest.TestCase): + def test_term_struct3(self): + with TermStruct3.from_file('src/term_strz.bin') as r: + + self.assertEqual(r.s1.value, b"\x66\x6F\x6F") + self.assertEqual(r.s2.value, b"\x7C\x62\x61\x72\x7C\x62\x61\x7A") + self.assertEqual(r.s3.value, b"") diff --git a/spec/python/test_term_struct4.py b/spec/python/test_term_struct4.py new file mode 100644 index 000000000..ed6442e0f --- /dev/null +++ b/spec/python/test_term_struct4.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest + +from term_struct4 import TermStruct4 + +class TestTermStruct4(unittest.TestCase): + def test_term_struct4(self): + with TermStruct4.from_file('src/term_strz.bin') as r: + + self.assertEqual(r.s1.value.value, b"\x66\x6F\x6F") + self.assertEqual(r.s2.value.value, b"\x62\x61\x72") + self.assertEqual(r.s3.value.value, b"\x62\x61\x7A") diff --git a/spec/python/test_term_strz2.py b/spec/python/test_term_strz2.py new file mode 100644 index 000000000..e1c55a435 --- /dev/null +++ b/spec/python/test_term_strz2.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest + +from term_strz2 import TermStrz2 + +class TestTermStrz2(unittest.TestCase): + def test_term_strz2(self): + with TermStrz2.from_file('src/term_strz.bin') as r: + + self.assertEqual(r.s1, u"foo") + self.assertEqual(r.s2, u"bar|") + self.assertEqual(r.s3, u"baz") diff --git a/spec/python/test_term_strz3.py b/spec/python/test_term_strz3.py new file mode 100644 index 000000000..43f2f73aa --- /dev/null +++ b/spec/python/test_term_strz3.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest + +from term_strz3 import TermStrz3 + +class TestTermStrz3(unittest.TestCase): + def test_term_strz3(self): + with TermStrz3.from_file('src/term_strz.bin') as r: + + self.assertEqual(r.s1, u"foo") + self.assertEqual(r.s2, u"|bar|baz") + self.assertEqual(r.s3, u"") diff --git a/spec/python/test_term_strz4.py b/spec/python/test_term_strz4.py new file mode 100644 index 000000000..04c68537d --- /dev/null +++ b/spec/python/test_term_strz4.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest + +from term_strz4 import TermStrz4 + +class TestTermStrz4(unittest.TestCase): + def test_term_strz4(self): + with TermStrz4.from_file('src/term_strz.bin') as r: + + self.assertEqual(r.s1.value, u"foo") + self.assertEqual(r.s2.value, u"bar") + self.assertEqual(r.s3.value, u"baz") From 56575bcaad794e82680951f86e208250d8da244c Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Fri, 17 Feb 2023 22:04:27 +0100 Subject: [PATCH 075/126] Fix unclosed files in manual Python tests --- spec/python/test_opaque_with_param.py | 6 +++--- spec/python/test_str_literals.py | 12 ++++++------ spec/python/test_switch_cast.py | 10 ++++++---- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/spec/python/test_opaque_with_param.py b/spec/python/test_opaque_with_param.py index 1520a331c..622829668 100644 --- a/spec/python/test_opaque_with_param.py +++ b/spec/python/test_opaque_with_param.py @@ -4,7 +4,7 @@ class TestOpaqueWithParam(unittest.TestCase): def test_opaque_with_param(self): - r = OpaqueWithParam.from_file("src/term_strz.bin") + with OpaqueWithParam.from_file('src/term_strz.bin') as r: - self.assertEqual(r.one.buf, "foo|b") - self.assertEqual(r.one.trailer, 0x61) + self.assertEqual(r.one.buf, "foo|b") + self.assertEqual(r.one.trailer, 0x61) diff --git a/spec/python/test_str_literals.py b/spec/python/test_str_literals.py index 8e053725c..f3cd1f450 100644 --- a/spec/python/test_str_literals.py +++ b/spec/python/test_str_literals.py @@ -4,13 +4,13 @@ class TestStrLiterals(unittest.TestCase): def test_str_literals(self): - r = StrLiterals.from_file("src/fixed_struct.bin") + with StrLiterals.from_file('src/fixed_struct.bin') as r: - self.assertEqual(self.str_to_arr(r.complex_str), [0, 1, 2, 7, 8, 10, 13, 9, 11, 12, 27, 61, 7, 10, 36, 9787]) - self.assertEqual(self.str_to_arr(r.double_quotes), [34, 34, 34]) - self.assertEqual(self.str_to_arr(r.backslashes), [92, 92, 92]) - self.assertEqual(self.str_to_arr(r.octal_eatup), [0, 50, 50]) - self.assertEqual(self.str_to_arr(r.octal_eatup2), [2, 50]) + self.assertEqual(self.str_to_arr(r.complex_str), [0, 1, 2, 7, 8, 10, 13, 9, 11, 12, 27, 61, 7, 10, 36, 9787]) + self.assertEqual(self.str_to_arr(r.double_quotes), [34, 34, 34]) + self.assertEqual(self.str_to_arr(r.backslashes), [92, 92, 92]) + self.assertEqual(self.str_to_arr(r.octal_eatup), [0, 50, 50]) + self.assertEqual(self.str_to_arr(r.octal_eatup2), [2, 50]) def str_to_arr(self, s): return [ord(c) for c in s] diff --git a/spec/python/test_switch_cast.py b/spec/python/test_switch_cast.py index 8f9b3f3cf..9c3ec712a 100644 --- a/spec/python/test_switch_cast.py +++ b/spec/python/test_switch_cast.py @@ -4,8 +4,10 @@ class TestSwitchCast(unittest.TestCase): def test_switch_cast(self): - r = SwitchCast.from_file("src/switch_opcodes.bin") + with SwitchCast.from_file('src/switch_opcodes.bin') as r: - self.assertEqual(r.first_obj.value, "foobar") - self.assertEqual(r.second_val, 0x42) - # unable to test "err_cast" here + self.assertEqual(r.first_obj.value, "foobar") + self.assertEqual(r.second_val, 0x42) + + self.assertNotIsInstance(r.err_cast, SwitchCast.Strval) + self.assertIsInstance(r.err_cast, SwitchCast.Intval) From 61b967b211950ee843a0b8353c8c5e8559c6a7b8 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Sun, 19 Feb 2023 21:40:18 +0100 Subject: [PATCH 076/126] Generate Python EOF error tests from KST Fixes "DeprecationWarning: invalid escape sequence '\d'" issues reported in Python Development Mode (https://docs.python.org/3.11/library/devmode.html) --- spec/python/test_eof_exception_bytes.py | 4 +++- spec/python/test_eof_exception_u4.py | 4 +++- spec/python/test_eos_exception_bytes.py | 4 +++- spec/python/test_eos_exception_u4.py | 4 +++- .../testtranslator/specgenerators/PythonSG.scala | 13 +++++++++++-- 5 files changed, 23 insertions(+), 6 deletions(-) diff --git a/spec/python/test_eof_exception_bytes.py b/spec/python/test_eof_exception_bytes.py index 7ed3f1316..6ba7ed6ff 100644 --- a/spec/python/test_eof_exception_bytes.py +++ b/spec/python/test_eof_exception_bytes.py @@ -1,3 +1,5 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + import unittest import kaitaistruct @@ -5,6 +7,6 @@ class TestEofExceptionBytes(unittest.TestCase): def test_eof_exception_bytes(self): - with self.assertRaisesRegexp(EOFError, "^requested \d+ bytes, but only \d+ bytes available$"): + with self.assertRaisesRegexp(EOFError, u"^requested \\d+ bytes, but only \\d+ bytes available$"): with EofExceptionBytes.from_file('src/term_strz.bin') as r: pass diff --git a/spec/python/test_eof_exception_u4.py b/spec/python/test_eof_exception_u4.py index 261c35c9c..8e31094ef 100644 --- a/spec/python/test_eof_exception_u4.py +++ b/spec/python/test_eof_exception_u4.py @@ -1,3 +1,5 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + import unittest import kaitaistruct @@ -5,6 +7,6 @@ class TestEofExceptionU4(unittest.TestCase): def test_eof_exception_u4(self): - with self.assertRaisesRegexp(EOFError, "^requested \d+ bytes, but only \d+ bytes available$"): + with self.assertRaisesRegexp(EOFError, u"^requested \\d+ bytes, but only \\d+ bytes available$"): with EofExceptionU4.from_file('src/term_strz.bin') as r: pass diff --git a/spec/python/test_eos_exception_bytes.py b/spec/python/test_eos_exception_bytes.py index 92543f87a..a258245a8 100644 --- a/spec/python/test_eos_exception_bytes.py +++ b/spec/python/test_eos_exception_bytes.py @@ -1,3 +1,5 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + import unittest import kaitaistruct @@ -5,6 +7,6 @@ class TestEosExceptionBytes(unittest.TestCase): def test_eos_exception_bytes(self): - with self.assertRaisesRegexp(EOFError, "^requested \d+ bytes, but only \d+ bytes available$"): + with self.assertRaisesRegexp(EOFError, u"^requested \\d+ bytes, but only \\d+ bytes available$"): with EosExceptionBytes.from_file('src/term_strz.bin') as r: pass diff --git a/spec/python/test_eos_exception_u4.py b/spec/python/test_eos_exception_u4.py index f7e3d2795..1ee7ab91f 100644 --- a/spec/python/test_eos_exception_u4.py +++ b/spec/python/test_eos_exception_u4.py @@ -1,3 +1,5 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + import unittest import kaitaistruct @@ -5,6 +7,6 @@ class TestEosExceptionU4(unittest.TestCase): def test_eos_exception_u4(self): - with self.assertRaisesRegexp(EOFError, "^requested \d+ bytes, but only \d+ bytes available$"): + with self.assertRaisesRegexp(EOFError, u"^requested \\d+ bytes, but only \\d+ bytes available$"): with EosExceptionU4.from_file('src/term_strz.bin') as r: pass diff --git a/translator/src/main/scala/io/kaitai/struct/testtranslator/specgenerators/PythonSG.scala b/translator/src/main/scala/io/kaitai/struct/testtranslator/specgenerators/PythonSG.scala index 327d3df0e..dc37f72c4 100644 --- a/translator/src/main/scala/io/kaitai/struct/testtranslator/specgenerators/PythonSG.scala +++ b/translator/src/main/scala/io/kaitai/struct/testtranslator/specgenerators/PythonSG.scala @@ -1,7 +1,7 @@ package io.kaitai.struct.testtranslator.specgenerators import _root_.io.kaitai.struct.ClassTypeProvider -import _root_.io.kaitai.struct.datatype.{DataType, KSError} +import _root_.io.kaitai.struct.datatype.{DataType, KSError, EndOfStreamError} import _root_.io.kaitai.struct.exprlang.Ast import _root_.io.kaitai.struct.languages.PythonCompiler import _root_.io.kaitai.struct.testtranslator.{Main, TestAssert, TestSpec} @@ -34,7 +34,16 @@ class PythonSG(spec: TestSpec, provider: ClassTypeProvider) extends BaseGenerato override def runParseExpectError(exception: KSError): Unit = { importList.add("import kaitaistruct") - out.puts(s"with self.assertRaises(${PythonCompiler.ksErrorName(exception)}):") + val msgRegex = exception match { + case EndOfStreamError => Some("^requested \\d+ bytes, but only \\d+ bytes available$") + case _ => None + } + msgRegex match { + case Some(msg) => + out.puts(s"with self.assertRaisesRegexp(${PythonCompiler.ksErrorName(exception)}, ${translator.translate(Ast.expr.Str(msg))}):") + case None => + out.puts(s"with self.assertRaises(${PythonCompiler.ksErrorName(exception)}):") + } out.inc runParse() out.puts("pass") From 6223ab44bbcb07827fb109ff2709f322c5be767a Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Fri, 17 Feb 2023 22:23:12 +0100 Subject: [PATCH 077/126] Move Python tests to `spec/python/spec/` (from `spec/python/`) --- .gitignore | 1 + spec/python/spec/__init__.py | 0 spec/python/{ => spec}/test_bcd_user_type_be.py | 0 spec/python/{ => spec}/test_bcd_user_type_le.py | 0 spec/python/{ => spec}/test_bits_byte_aligned.py | 0 spec/python/{ => spec}/test_bits_enum.py | 0 spec/python/{ => spec}/test_bits_seq_endian_combo.py | 0 spec/python/{ => spec}/test_bits_shift_by_b32_le.py | 0 spec/python/{ => spec}/test_bits_shift_by_b64_le.py | 0 spec/python/{ => spec}/test_bits_signed_res_b32_be.py | 0 spec/python/{ => spec}/test_bits_signed_res_b32_le.py | 0 spec/python/{ => spec}/test_bits_signed_shift_b32_le.py | 0 spec/python/{ => spec}/test_bits_signed_shift_b64_le.py | 0 spec/python/{ => spec}/test_bits_simple.py | 0 spec/python/{ => spec}/test_bits_simple_le.py | 0 spec/python/{ => spec}/test_bits_unaligned_b32_be.py | 0 spec/python/{ => spec}/test_bits_unaligned_b32_le.py | 0 spec/python/{ => spec}/test_bits_unaligned_b64_be.py | 0 spec/python/{ => spec}/test_bits_unaligned_b64_le.py | 0 spec/python/{ => spec}/test_buffered_struct.py | 0 spec/python/{ => spec}/test_bytes_eos_pad_term.py | 0 spec/python/{ => spec}/test_bytes_pad_term.py | 0 spec/python/{ => spec}/test_bytes_pad_term_empty.py | 0 spec/python/{ => spec}/test_bytes_pad_term_equal.py | 0 spec/python/{ => spec}/test_bytes_pad_term_roundtrip.py | 0 spec/python/{ => spec}/test_bytes_pad_term_zero_size.py | 0 spec/python/{ => spec}/test_cast_nested.py | 0 spec/python/{ => spec}/test_cast_to_imported.py | 0 spec/python/{ => spec}/test_cast_to_top.py | 0 spec/python/{ => spec}/test_combine_bool.py | 0 spec/python/{ => spec}/test_combine_bytes.py | 0 spec/python/{ => spec}/test_combine_enum.py | 0 spec/python/{ => spec}/test_combine_str.py | 0 spec/python/{ => spec}/test_debug_0.py | 0 spec/python/{ => spec}/test_debug_array_user.py | 0 spec/python/{ => spec}/test_debug_enum_name.py | 0 spec/python/{ => spec}/test_debug_switch_user.py | 0 spec/python/{ => spec}/test_default_big_endian.py | 0 spec/python/{ => spec}/test_default_bit_endian_mod.py | 0 spec/python/{ => spec}/test_default_endian_expr_exception.py | 0 spec/python/{ => spec}/test_default_endian_expr_inherited.py | 0 spec/python/{ => spec}/test_default_endian_expr_is_be.py | 0 spec/python/{ => spec}/test_default_endian_expr_is_le.py | 0 spec/python/{ => spec}/test_default_endian_mod.py | 0 spec/python/{ => spec}/test_docstrings.py | 0 spec/python/{ => spec}/test_docstrings_docref.py | 0 spec/python/{ => spec}/test_docstrings_docref_multi.py | 0 spec/python/{ => spec}/test_enum_0.py | 0 spec/python/{ => spec}/test_enum_1.py | 0 spec/python/{ => spec}/test_enum_deep.py | 0 spec/python/{ => spec}/test_enum_deep_literals.py | 0 spec/python/{ => spec}/test_enum_fancy.py | 0 spec/python/{ => spec}/test_enum_for_unknown_id.py | 0 spec/python/{ => spec}/test_enum_if.py | 0 spec/python/{ => spec}/test_enum_import.py | 0 spec/python/{ => spec}/test_enum_int_range_s.py | 0 spec/python/{ => spec}/test_enum_int_range_u.py | 0 spec/python/{ => spec}/test_enum_invalid.py | 0 spec/python/{ => spec}/test_enum_long_range_s.py | 0 spec/python/{ => spec}/test_enum_long_range_u.py | 0 spec/python/{ => spec}/test_enum_negative.py | 0 spec/python/{ => spec}/test_enum_of_value_inst.py | 0 spec/python/{ => spec}/test_enum_to_i.py | 0 spec/python/{ => spec}/test_enum_to_i_class_border_1.py | 0 spec/python/{ => spec}/test_eof_exception_bytes.py | 0 spec/python/{ => spec}/test_eof_exception_u4.py | 0 spec/python/{ => spec}/test_eos_exception_bytes.py | 0 spec/python/{ => spec}/test_eos_exception_u4.py | 0 spec/python/{ => spec}/test_expr_0.py | 0 spec/python/{ => spec}/test_expr_1.py | 0 spec/python/{ => spec}/test_expr_2.py | 0 spec/python/{ => spec}/test_expr_3.py | 0 spec/python/{ => spec}/test_expr_array.py | 0 spec/python/{ => spec}/test_expr_bits.py | 0 spec/python/{ => spec}/test_expr_bytes_cmp.py | 0 spec/python/{ => spec}/test_expr_bytes_non_literal.py | 0 spec/python/{ => spec}/test_expr_bytes_ops.py | 0 spec/python/{ => spec}/test_expr_calc_array_ops.py | 0 spec/python/{ => spec}/test_expr_enum.py | 0 spec/python/{ => spec}/test_expr_if_int_eq.py | 0 spec/python/{ => spec}/test_expr_if_int_ops.py | 0 spec/python/{ => spec}/test_expr_int_div.py | 0 spec/python/{ => spec}/test_expr_io_eof.py | 0 spec/python/{ => spec}/test_expr_io_pos.py | 0 spec/python/{ => spec}/test_expr_mod.py | 0 spec/python/{ => spec}/test_expr_ops_parens.py | 0 spec/python/{ => spec}/test_expr_sizeof_type_0.py | 0 spec/python/{ => spec}/test_expr_sizeof_type_1.py | 0 spec/python/{ => spec}/test_expr_sizeof_value_0.py | 0 spec/python/{ => spec}/test_expr_sizeof_value_sized.py | 0 spec/python/{ => spec}/test_expr_str_encodings.py | 0 spec/python/{ => spec}/test_expr_str_ops.py | 0 spec/python/{ => spec}/test_fixed_contents.py | 0 spec/python/{ => spec}/test_fixed_struct.py | 0 spec/python/{ => spec}/test_float_to_i.py | 0 spec/python/{ => spec}/test_floating_points.py | 0 spec/python/{ => spec}/test_hello_world.py | 0 spec/python/{ => spec}/test_if_instances.py | 0 spec/python/{ => spec}/test_if_struct.py | 0 spec/python/{ => spec}/test_if_values.py | 0 spec/python/{ => spec}/test_imports0.py | 0 spec/python/{ => spec}/test_imports_abs.py | 0 spec/python/{ => spec}/test_imports_abs_abs.py | 0 spec/python/{ => spec}/test_imports_abs_rel.py | 0 spec/python/{ => spec}/test_imports_circular_a.py | 0 spec/python/{ => spec}/test_imports_rel_1.py | 0 spec/python/{ => spec}/test_index_sizes.py | 0 spec/python/{ => spec}/test_index_to_param_eos.py | 0 spec/python/{ => spec}/test_index_to_param_expr.py | 0 spec/python/{ => spec}/test_index_to_param_until.py | 0 spec/python/{ => spec}/test_instance_in_repeat_expr.py | 0 spec/python/{ => spec}/test_instance_in_repeat_until.py | 0 spec/python/{ => spec}/test_instance_in_sized.py | 0 spec/python/{ => spec}/test_instance_io_user.py | 0 spec/python/{ => spec}/test_instance_io_user_earlier.py | 0 spec/python/{ => spec}/test_instance_std.py | 0 spec/python/{ => spec}/test_instance_std_array.py | 0 spec/python/{ => spec}/test_instance_user_array.py | 0 spec/python/{ => spec}/test_integers.py | 0 spec/python/{ => spec}/test_integers_double_overflow.py | 0 spec/python/{ => spec}/test_integers_min_max.py | 0 spec/python/{ => spec}/test_io_local_var.py | 0 spec/python/{ => spec}/test_js_signed_right_shift.py | 0 spec/python/{ => spec}/test_meta_tags.py | 0 spec/python/{ => spec}/test_meta_xref.py | 0 spec/python/{ => spec}/test_multiple_use.py | 0 spec/python/{ => spec}/test_nav_parent.py | 0 spec/python/{ => spec}/test_nav_parent2.py | 0 spec/python/{ => spec}/test_nav_parent3.py | 0 spec/python/{ => spec}/test_nav_parent_false.py | 0 spec/python/{ => spec}/test_nav_parent_false2.py | 0 spec/python/{ => spec}/test_nav_parent_override.py | 0 spec/python/{ => spec}/test_nav_parent_switch.py | 0 spec/python/{ => spec}/test_nav_parent_switch_cast.py | 0 spec/python/{ => spec}/test_nav_parent_vs_value_inst.py | 0 spec/python/{ => spec}/test_nav_root.py | 0 spec/python/{ => spec}/test_nested_same_name.py | 0 spec/python/{ => spec}/test_nested_same_name2.py | 0 spec/python/{ => spec}/test_nested_type_param.py | 0 spec/python/{ => spec}/test_nested_types.py | 0 spec/python/{ => spec}/test_nested_types2.py | 0 spec/python/{ => spec}/test_nested_types3.py | 0 spec/python/{ => spec}/test_non_standard.py | 0 spec/python/{ => spec}/test_opaque_external_type.py | 0 spec/python/{ => spec}/test_opaque_external_type_02_parent.py | 0 spec/python/{ => spec}/test_opaque_with_param.py | 0 spec/python/{ => spec}/test_optional_id.py | 0 spec/python/{ => spec}/test_params_call_extra_parens.py | 0 spec/python/{ => spec}/test_params_call_short.py | 0 spec/python/{ => spec}/test_params_def.py | 0 spec/python/{ => spec}/test_params_enum.py | 0 spec/python/{ => spec}/test_params_pass_array_int.py | 0 spec/python/{ => spec}/test_params_pass_array_io.py | 0 spec/python/{ => spec}/test_params_pass_array_str.py | 0 spec/python/{ => spec}/test_params_pass_array_struct.py | 0 spec/python/{ => spec}/test_params_pass_array_usertype.py | 0 spec/python/{ => spec}/test_params_pass_bool.py | 0 spec/python/{ => spec}/test_params_pass_io.py | 0 spec/python/{ => spec}/test_params_pass_struct.py | 0 spec/python/{ => spec}/test_params_pass_usertype.py | 0 spec/python/{ => spec}/test_position_abs.py | 0 spec/python/{ => spec}/test_position_in_seq.py | 0 spec/python/{ => spec}/test_position_to_end.py | 0 spec/python/{ => spec}/test_process_bytes_pad_term.py | 0 spec/python/{ => spec}/test_process_coerce_bytes.py | 0 spec/python/{ => spec}/test_process_coerce_switch.py | 0 spec/python/{ => spec}/test_process_coerce_usertype1.py | 0 spec/python/{ => spec}/test_process_coerce_usertype2.py | 0 spec/python/{ => spec}/test_process_custom.py | 0 spec/python/{ => spec}/test_process_custom_no_args.py | 0 spec/python/{ => spec}/test_process_repeat_bytes.py | 0 spec/python/{ => spec}/test_process_repeat_usertype.py | 0 .../{ => spec}/test_process_repeat_usertype_dynarg_custom.py | 0 .../{ => spec}/test_process_repeat_usertype_dynarg_rotate.py | 0 .../{ => spec}/test_process_repeat_usertype_dynarg_xor.py | 0 spec/python/{ => spec}/test_process_rotate.py | 0 spec/python/{ => spec}/test_process_struct_pad_term.py | 0 spec/python/{ => spec}/test_process_term_struct.py | 0 spec/python/{ => spec}/test_process_to_user.py | 0 spec/python/{ => spec}/test_process_xor4_const.py | 0 spec/python/{ => spec}/test_process_xor4_value.py | 0 spec/python/{ => spec}/test_process_xor_const.py | 0 spec/python/{ => spec}/test_process_xor_value.py | 0 spec/python/{ => spec}/test_recursive_one.py | 0 spec/python/{ => spec}/test_repeat_eos_bit.py | 0 spec/python/{ => spec}/test_repeat_eos_bytes.py | 0 spec/python/{ => spec}/test_repeat_eos_bytes_pad.py | 0 spec/python/{ => spec}/test_repeat_eos_bytes_pad_term.py | 0 spec/python/{ => spec}/test_repeat_eos_struct.py | 0 spec/python/{ => spec}/test_repeat_eos_term_bytes.py | 0 spec/python/{ => spec}/test_repeat_eos_term_struct.py | 0 spec/python/{ => spec}/test_repeat_eos_u4.py | 0 spec/python/{ => spec}/test_repeat_n_bytes.py | 0 spec/python/{ => spec}/test_repeat_n_bytes_pad.py | 0 spec/python/{ => spec}/test_repeat_n_bytes_pad_term.py | 0 spec/python/{ => spec}/test_repeat_n_struct.py | 0 spec/python/{ => spec}/test_repeat_n_strz.py | 0 spec/python/{ => spec}/test_repeat_n_strz_double.py | 0 spec/python/{ => spec}/test_repeat_n_term_bytes.py | 0 spec/python/{ => spec}/test_repeat_n_term_struct.py | 0 spec/python/{ => spec}/test_repeat_until_bytes.py | 0 spec/python/{ => spec}/test_repeat_until_bytes_pad.py | 0 spec/python/{ => spec}/test_repeat_until_bytes_pad_term.py | 0 spec/python/{ => spec}/test_repeat_until_calc_array_type.py | 0 spec/python/{ => spec}/test_repeat_until_complex.py | 0 spec/python/{ => spec}/test_repeat_until_s4.py | 0 spec/python/{ => spec}/test_repeat_until_sized.py | 0 spec/python/{ => spec}/test_repeat_until_term_bytes.py | 0 spec/python/{ => spec}/test_repeat_until_term_struct.py | 0 spec/python/{ => spec}/test_str_encodings.py | 0 spec/python/{ => spec}/test_str_encodings_default.py | 0 spec/python/{ => spec}/test_str_encodings_utf16.py | 0 spec/python/{ => spec}/test_str_eos.py | 0 spec/python/{ => spec}/test_str_eos_pad_term.py | 0 spec/python/{ => spec}/test_str_eos_pad_term_empty.py | 0 spec/python/{ => spec}/test_str_eos_pad_term_equal.py | 0 spec/python/{ => spec}/test_str_literals.py | 0 spec/python/{ => spec}/test_str_literals2.py | 0 spec/python/{ => spec}/test_str_pad_term.py | 0 spec/python/{ => spec}/test_str_pad_term_empty.py | 0 spec/python/{ => spec}/test_str_pad_term_equal.py | 0 spec/python/{ => spec}/test_str_pad_term_roundtrip.py | 0 spec/python/{ => spec}/test_str_pad_term_zero_size.py | 0 spec/python/{ => spec}/test_struct_pad_term.py | 0 spec/python/{ => spec}/test_struct_pad_term_equal.py | 0 spec/python/{ => spec}/test_switch_bytearray.py | 0 spec/python/{ => spec}/test_switch_cast.py | 0 spec/python/{ => spec}/test_switch_else_only.py | 0 spec/python/{ => spec}/test_switch_integers.py | 0 spec/python/{ => spec}/test_switch_integers2.py | 0 spec/python/{ => spec}/test_switch_manual_enum.py | 0 spec/python/{ => spec}/test_switch_manual_enum_invalid.py | 0 .../python/{ => spec}/test_switch_manual_enum_invalid_else.py | 0 spec/python/{ => spec}/test_switch_manual_int.py | 0 spec/python/{ => spec}/test_switch_manual_int_else.py | 0 spec/python/{ => spec}/test_switch_manual_int_size.py | 0 spec/python/{ => spec}/test_switch_manual_int_size_else.py | 0 spec/python/{ => spec}/test_switch_manual_int_size_eos.py | 0 spec/python/{ => spec}/test_switch_manual_str.py | 0 spec/python/{ => spec}/test_switch_manual_str_else.py | 0 spec/python/{ => spec}/test_switch_multi_bool_ops.py | 0 spec/python/{ => spec}/test_switch_repeat_expr.py | 0 spec/python/{ => spec}/test_switch_repeat_expr_invalid.py | 0 spec/python/{ => spec}/test_term_bytes.py | 0 spec/python/{ => spec}/test_term_bytes2.py | 0 spec/python/{ => spec}/test_term_bytes3.py | 0 spec/python/{ => spec}/test_term_bytes4.py | 0 spec/python/{ => spec}/test_term_struct.py | 0 spec/python/{ => spec}/test_term_struct2.py | 0 spec/python/{ => spec}/test_term_struct3.py | 0 spec/python/{ => spec}/test_term_struct4.py | 0 spec/python/{ => spec}/test_term_strz.py | 0 spec/python/{ => spec}/test_term_strz2.py | 0 spec/python/{ => spec}/test_term_strz3.py | 0 spec/python/{ => spec}/test_term_strz4.py | 0 spec/python/{ => spec}/test_term_u1_val.py | 0 spec/python/{ => spec}/test_to_string_custom.py | 0 spec/python/{ => spec}/test_ts_packet_header.py | 0 spec/python/{ => spec}/test_type_int_unary_op.py | 0 spec/python/{ => spec}/test_type_ternary.py | 0 spec/python/{ => spec}/test_type_ternary_2nd_falsy.py | 0 spec/python/{ => spec}/test_type_ternary_opaque.py | 0 spec/python/{ => spec}/test_user_type.py | 0 spec/python/{ => spec}/test_valid_eq_str_encodings.py | 0 spec/python/{ => spec}/test_valid_fail_anyof_int.py | 0 spec/python/{ => spec}/test_valid_fail_contents.py | 0 spec/python/{ => spec}/test_valid_fail_eq_bytes.py | 0 spec/python/{ => spec}/test_valid_fail_eq_int.py | 0 spec/python/{ => spec}/test_valid_fail_eq_str.py | 0 spec/python/{ => spec}/test_valid_fail_expr.py | 0 spec/python/{ => spec}/test_valid_fail_inst.py | 0 spec/python/{ => spec}/test_valid_fail_max_int.py | 0 spec/python/{ => spec}/test_valid_fail_min_int.py | 0 spec/python/{ => spec}/test_valid_fail_range_bytes.py | 0 spec/python/{ => spec}/test_valid_fail_range_float.py | 0 spec/python/{ => spec}/test_valid_fail_range_int.py | 0 spec/python/{ => spec}/test_valid_fail_range_str.py | 0 spec/python/{ => spec}/test_valid_long.py | 0 spec/python/{ => spec}/test_valid_not_parsed_if.py | 0 spec/python/{ => spec}/test_valid_optional_id.py | 0 spec/python/{ => spec}/test_valid_short.py | 0 spec/python/{ => spec}/test_valid_switch.py | 0 spec/python/{ => spec}/test_yaml_ints.py | 0 spec/python/{ => spec}/test_zlib_surrounded.py | 0 spec/python/{ => spec}/test_zlib_with_header_78.py | 0 .../struct/testtranslator/specgenerators/PythonSG.scala | 4 ++-- 286 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 spec/python/spec/__init__.py rename spec/python/{ => spec}/test_bcd_user_type_be.py (100%) rename spec/python/{ => spec}/test_bcd_user_type_le.py (100%) rename spec/python/{ => spec}/test_bits_byte_aligned.py (100%) rename spec/python/{ => spec}/test_bits_enum.py (100%) rename spec/python/{ => spec}/test_bits_seq_endian_combo.py (100%) rename spec/python/{ => spec}/test_bits_shift_by_b32_le.py (100%) rename spec/python/{ => spec}/test_bits_shift_by_b64_le.py (100%) rename spec/python/{ => spec}/test_bits_signed_res_b32_be.py (100%) rename spec/python/{ => spec}/test_bits_signed_res_b32_le.py (100%) rename spec/python/{ => spec}/test_bits_signed_shift_b32_le.py (100%) rename spec/python/{ => spec}/test_bits_signed_shift_b64_le.py (100%) rename spec/python/{ => spec}/test_bits_simple.py (100%) rename spec/python/{ => spec}/test_bits_simple_le.py (100%) rename spec/python/{ => spec}/test_bits_unaligned_b32_be.py (100%) rename spec/python/{ => spec}/test_bits_unaligned_b32_le.py (100%) rename spec/python/{ => spec}/test_bits_unaligned_b64_be.py (100%) rename spec/python/{ => spec}/test_bits_unaligned_b64_le.py (100%) rename spec/python/{ => spec}/test_buffered_struct.py (100%) rename spec/python/{ => spec}/test_bytes_eos_pad_term.py (100%) rename spec/python/{ => spec}/test_bytes_pad_term.py (100%) rename spec/python/{ => spec}/test_bytes_pad_term_empty.py (100%) rename spec/python/{ => spec}/test_bytes_pad_term_equal.py (100%) rename spec/python/{ => spec}/test_bytes_pad_term_roundtrip.py (100%) rename spec/python/{ => spec}/test_bytes_pad_term_zero_size.py (100%) rename spec/python/{ => spec}/test_cast_nested.py (100%) rename spec/python/{ => spec}/test_cast_to_imported.py (100%) rename spec/python/{ => spec}/test_cast_to_top.py (100%) rename spec/python/{ => spec}/test_combine_bool.py (100%) rename spec/python/{ => spec}/test_combine_bytes.py (100%) rename spec/python/{ => spec}/test_combine_enum.py (100%) rename spec/python/{ => spec}/test_combine_str.py (100%) rename spec/python/{ => spec}/test_debug_0.py (100%) rename spec/python/{ => spec}/test_debug_array_user.py (100%) rename spec/python/{ => spec}/test_debug_enum_name.py (100%) rename spec/python/{ => spec}/test_debug_switch_user.py (100%) rename spec/python/{ => spec}/test_default_big_endian.py (100%) rename spec/python/{ => spec}/test_default_bit_endian_mod.py (100%) rename spec/python/{ => spec}/test_default_endian_expr_exception.py (100%) rename spec/python/{ => spec}/test_default_endian_expr_inherited.py (100%) rename spec/python/{ => spec}/test_default_endian_expr_is_be.py (100%) rename spec/python/{ => spec}/test_default_endian_expr_is_le.py (100%) rename spec/python/{ => spec}/test_default_endian_mod.py (100%) rename spec/python/{ => spec}/test_docstrings.py (100%) rename spec/python/{ => spec}/test_docstrings_docref.py (100%) rename spec/python/{ => spec}/test_docstrings_docref_multi.py (100%) rename spec/python/{ => spec}/test_enum_0.py (100%) rename spec/python/{ => spec}/test_enum_1.py (100%) rename spec/python/{ => spec}/test_enum_deep.py (100%) rename spec/python/{ => spec}/test_enum_deep_literals.py (100%) rename spec/python/{ => spec}/test_enum_fancy.py (100%) rename spec/python/{ => spec}/test_enum_for_unknown_id.py (100%) rename spec/python/{ => spec}/test_enum_if.py (100%) rename spec/python/{ => spec}/test_enum_import.py (100%) rename spec/python/{ => spec}/test_enum_int_range_s.py (100%) rename spec/python/{ => spec}/test_enum_int_range_u.py (100%) rename spec/python/{ => spec}/test_enum_invalid.py (100%) rename spec/python/{ => spec}/test_enum_long_range_s.py (100%) rename spec/python/{ => spec}/test_enum_long_range_u.py (100%) rename spec/python/{ => spec}/test_enum_negative.py (100%) rename spec/python/{ => spec}/test_enum_of_value_inst.py (100%) rename spec/python/{ => spec}/test_enum_to_i.py (100%) rename spec/python/{ => spec}/test_enum_to_i_class_border_1.py (100%) rename spec/python/{ => spec}/test_eof_exception_bytes.py (100%) rename spec/python/{ => spec}/test_eof_exception_u4.py (100%) rename spec/python/{ => spec}/test_eos_exception_bytes.py (100%) rename spec/python/{ => spec}/test_eos_exception_u4.py (100%) rename spec/python/{ => spec}/test_expr_0.py (100%) rename spec/python/{ => spec}/test_expr_1.py (100%) rename spec/python/{ => spec}/test_expr_2.py (100%) rename spec/python/{ => spec}/test_expr_3.py (100%) rename spec/python/{ => spec}/test_expr_array.py (100%) rename spec/python/{ => spec}/test_expr_bits.py (100%) rename spec/python/{ => spec}/test_expr_bytes_cmp.py (100%) rename spec/python/{ => spec}/test_expr_bytes_non_literal.py (100%) rename spec/python/{ => spec}/test_expr_bytes_ops.py (100%) rename spec/python/{ => spec}/test_expr_calc_array_ops.py (100%) rename spec/python/{ => spec}/test_expr_enum.py (100%) rename spec/python/{ => spec}/test_expr_if_int_eq.py (100%) rename spec/python/{ => spec}/test_expr_if_int_ops.py (100%) rename spec/python/{ => spec}/test_expr_int_div.py (100%) rename spec/python/{ => spec}/test_expr_io_eof.py (100%) rename spec/python/{ => spec}/test_expr_io_pos.py (100%) rename spec/python/{ => spec}/test_expr_mod.py (100%) rename spec/python/{ => spec}/test_expr_ops_parens.py (100%) rename spec/python/{ => spec}/test_expr_sizeof_type_0.py (100%) rename spec/python/{ => spec}/test_expr_sizeof_type_1.py (100%) rename spec/python/{ => spec}/test_expr_sizeof_value_0.py (100%) rename spec/python/{ => spec}/test_expr_sizeof_value_sized.py (100%) rename spec/python/{ => spec}/test_expr_str_encodings.py (100%) rename spec/python/{ => spec}/test_expr_str_ops.py (100%) rename spec/python/{ => spec}/test_fixed_contents.py (100%) rename spec/python/{ => spec}/test_fixed_struct.py (100%) rename spec/python/{ => spec}/test_float_to_i.py (100%) rename spec/python/{ => spec}/test_floating_points.py (100%) rename spec/python/{ => spec}/test_hello_world.py (100%) rename spec/python/{ => spec}/test_if_instances.py (100%) rename spec/python/{ => spec}/test_if_struct.py (100%) rename spec/python/{ => spec}/test_if_values.py (100%) rename spec/python/{ => spec}/test_imports0.py (100%) rename spec/python/{ => spec}/test_imports_abs.py (100%) rename spec/python/{ => spec}/test_imports_abs_abs.py (100%) rename spec/python/{ => spec}/test_imports_abs_rel.py (100%) rename spec/python/{ => spec}/test_imports_circular_a.py (100%) rename spec/python/{ => spec}/test_imports_rel_1.py (100%) rename spec/python/{ => spec}/test_index_sizes.py (100%) rename spec/python/{ => spec}/test_index_to_param_eos.py (100%) rename spec/python/{ => spec}/test_index_to_param_expr.py (100%) rename spec/python/{ => spec}/test_index_to_param_until.py (100%) rename spec/python/{ => spec}/test_instance_in_repeat_expr.py (100%) rename spec/python/{ => spec}/test_instance_in_repeat_until.py (100%) rename spec/python/{ => spec}/test_instance_in_sized.py (100%) rename spec/python/{ => spec}/test_instance_io_user.py (100%) rename spec/python/{ => spec}/test_instance_io_user_earlier.py (100%) rename spec/python/{ => spec}/test_instance_std.py (100%) rename spec/python/{ => spec}/test_instance_std_array.py (100%) rename spec/python/{ => spec}/test_instance_user_array.py (100%) rename spec/python/{ => spec}/test_integers.py (100%) rename spec/python/{ => spec}/test_integers_double_overflow.py (100%) rename spec/python/{ => spec}/test_integers_min_max.py (100%) rename spec/python/{ => spec}/test_io_local_var.py (100%) rename spec/python/{ => spec}/test_js_signed_right_shift.py (100%) rename spec/python/{ => spec}/test_meta_tags.py (100%) rename spec/python/{ => spec}/test_meta_xref.py (100%) rename spec/python/{ => spec}/test_multiple_use.py (100%) rename spec/python/{ => spec}/test_nav_parent.py (100%) rename spec/python/{ => spec}/test_nav_parent2.py (100%) rename spec/python/{ => spec}/test_nav_parent3.py (100%) rename spec/python/{ => spec}/test_nav_parent_false.py (100%) rename spec/python/{ => spec}/test_nav_parent_false2.py (100%) rename spec/python/{ => spec}/test_nav_parent_override.py (100%) rename spec/python/{ => spec}/test_nav_parent_switch.py (100%) rename spec/python/{ => spec}/test_nav_parent_switch_cast.py (100%) rename spec/python/{ => spec}/test_nav_parent_vs_value_inst.py (100%) rename spec/python/{ => spec}/test_nav_root.py (100%) rename spec/python/{ => spec}/test_nested_same_name.py (100%) rename spec/python/{ => spec}/test_nested_same_name2.py (100%) rename spec/python/{ => spec}/test_nested_type_param.py (100%) rename spec/python/{ => spec}/test_nested_types.py (100%) rename spec/python/{ => spec}/test_nested_types2.py (100%) rename spec/python/{ => spec}/test_nested_types3.py (100%) rename spec/python/{ => spec}/test_non_standard.py (100%) rename spec/python/{ => spec}/test_opaque_external_type.py (100%) rename spec/python/{ => spec}/test_opaque_external_type_02_parent.py (100%) rename spec/python/{ => spec}/test_opaque_with_param.py (100%) rename spec/python/{ => spec}/test_optional_id.py (100%) rename spec/python/{ => spec}/test_params_call_extra_parens.py (100%) rename spec/python/{ => spec}/test_params_call_short.py (100%) rename spec/python/{ => spec}/test_params_def.py (100%) rename spec/python/{ => spec}/test_params_enum.py (100%) rename spec/python/{ => spec}/test_params_pass_array_int.py (100%) rename spec/python/{ => spec}/test_params_pass_array_io.py (100%) rename spec/python/{ => spec}/test_params_pass_array_str.py (100%) rename spec/python/{ => spec}/test_params_pass_array_struct.py (100%) rename spec/python/{ => spec}/test_params_pass_array_usertype.py (100%) rename spec/python/{ => spec}/test_params_pass_bool.py (100%) rename spec/python/{ => spec}/test_params_pass_io.py (100%) rename spec/python/{ => spec}/test_params_pass_struct.py (100%) rename spec/python/{ => spec}/test_params_pass_usertype.py (100%) rename spec/python/{ => spec}/test_position_abs.py (100%) rename spec/python/{ => spec}/test_position_in_seq.py (100%) rename spec/python/{ => spec}/test_position_to_end.py (100%) rename spec/python/{ => spec}/test_process_bytes_pad_term.py (100%) rename spec/python/{ => spec}/test_process_coerce_bytes.py (100%) rename spec/python/{ => spec}/test_process_coerce_switch.py (100%) rename spec/python/{ => spec}/test_process_coerce_usertype1.py (100%) rename spec/python/{ => spec}/test_process_coerce_usertype2.py (100%) rename spec/python/{ => spec}/test_process_custom.py (100%) rename spec/python/{ => spec}/test_process_custom_no_args.py (100%) rename spec/python/{ => spec}/test_process_repeat_bytes.py (100%) rename spec/python/{ => spec}/test_process_repeat_usertype.py (100%) rename spec/python/{ => spec}/test_process_repeat_usertype_dynarg_custom.py (100%) rename spec/python/{ => spec}/test_process_repeat_usertype_dynarg_rotate.py (100%) rename spec/python/{ => spec}/test_process_repeat_usertype_dynarg_xor.py (100%) rename spec/python/{ => spec}/test_process_rotate.py (100%) rename spec/python/{ => spec}/test_process_struct_pad_term.py (100%) rename spec/python/{ => spec}/test_process_term_struct.py (100%) rename spec/python/{ => spec}/test_process_to_user.py (100%) rename spec/python/{ => spec}/test_process_xor4_const.py (100%) rename spec/python/{ => spec}/test_process_xor4_value.py (100%) rename spec/python/{ => spec}/test_process_xor_const.py (100%) rename spec/python/{ => spec}/test_process_xor_value.py (100%) rename spec/python/{ => spec}/test_recursive_one.py (100%) rename spec/python/{ => spec}/test_repeat_eos_bit.py (100%) rename spec/python/{ => spec}/test_repeat_eos_bytes.py (100%) rename spec/python/{ => spec}/test_repeat_eos_bytes_pad.py (100%) rename spec/python/{ => spec}/test_repeat_eos_bytes_pad_term.py (100%) rename spec/python/{ => spec}/test_repeat_eos_struct.py (100%) rename spec/python/{ => spec}/test_repeat_eos_term_bytes.py (100%) rename spec/python/{ => spec}/test_repeat_eos_term_struct.py (100%) rename spec/python/{ => spec}/test_repeat_eos_u4.py (100%) rename spec/python/{ => spec}/test_repeat_n_bytes.py (100%) rename spec/python/{ => spec}/test_repeat_n_bytes_pad.py (100%) rename spec/python/{ => spec}/test_repeat_n_bytes_pad_term.py (100%) rename spec/python/{ => spec}/test_repeat_n_struct.py (100%) rename spec/python/{ => spec}/test_repeat_n_strz.py (100%) rename spec/python/{ => spec}/test_repeat_n_strz_double.py (100%) rename spec/python/{ => spec}/test_repeat_n_term_bytes.py (100%) rename spec/python/{ => spec}/test_repeat_n_term_struct.py (100%) rename spec/python/{ => spec}/test_repeat_until_bytes.py (100%) rename spec/python/{ => spec}/test_repeat_until_bytes_pad.py (100%) rename spec/python/{ => spec}/test_repeat_until_bytes_pad_term.py (100%) rename spec/python/{ => spec}/test_repeat_until_calc_array_type.py (100%) rename spec/python/{ => spec}/test_repeat_until_complex.py (100%) rename spec/python/{ => spec}/test_repeat_until_s4.py (100%) rename spec/python/{ => spec}/test_repeat_until_sized.py (100%) rename spec/python/{ => spec}/test_repeat_until_term_bytes.py (100%) rename spec/python/{ => spec}/test_repeat_until_term_struct.py (100%) rename spec/python/{ => spec}/test_str_encodings.py (100%) rename spec/python/{ => spec}/test_str_encodings_default.py (100%) rename spec/python/{ => spec}/test_str_encodings_utf16.py (100%) rename spec/python/{ => spec}/test_str_eos.py (100%) rename spec/python/{ => spec}/test_str_eos_pad_term.py (100%) rename spec/python/{ => spec}/test_str_eos_pad_term_empty.py (100%) rename spec/python/{ => spec}/test_str_eos_pad_term_equal.py (100%) rename spec/python/{ => spec}/test_str_literals.py (100%) rename spec/python/{ => spec}/test_str_literals2.py (100%) rename spec/python/{ => spec}/test_str_pad_term.py (100%) rename spec/python/{ => spec}/test_str_pad_term_empty.py (100%) rename spec/python/{ => spec}/test_str_pad_term_equal.py (100%) rename spec/python/{ => spec}/test_str_pad_term_roundtrip.py (100%) rename spec/python/{ => spec}/test_str_pad_term_zero_size.py (100%) rename spec/python/{ => spec}/test_struct_pad_term.py (100%) rename spec/python/{ => spec}/test_struct_pad_term_equal.py (100%) rename spec/python/{ => spec}/test_switch_bytearray.py (100%) rename spec/python/{ => spec}/test_switch_cast.py (100%) rename spec/python/{ => spec}/test_switch_else_only.py (100%) rename spec/python/{ => spec}/test_switch_integers.py (100%) rename spec/python/{ => spec}/test_switch_integers2.py (100%) rename spec/python/{ => spec}/test_switch_manual_enum.py (100%) rename spec/python/{ => spec}/test_switch_manual_enum_invalid.py (100%) rename spec/python/{ => spec}/test_switch_manual_enum_invalid_else.py (100%) rename spec/python/{ => spec}/test_switch_manual_int.py (100%) rename spec/python/{ => spec}/test_switch_manual_int_else.py (100%) rename spec/python/{ => spec}/test_switch_manual_int_size.py (100%) rename spec/python/{ => spec}/test_switch_manual_int_size_else.py (100%) rename spec/python/{ => spec}/test_switch_manual_int_size_eos.py (100%) rename spec/python/{ => spec}/test_switch_manual_str.py (100%) rename spec/python/{ => spec}/test_switch_manual_str_else.py (100%) rename spec/python/{ => spec}/test_switch_multi_bool_ops.py (100%) rename spec/python/{ => spec}/test_switch_repeat_expr.py (100%) rename spec/python/{ => spec}/test_switch_repeat_expr_invalid.py (100%) rename spec/python/{ => spec}/test_term_bytes.py (100%) rename spec/python/{ => spec}/test_term_bytes2.py (100%) rename spec/python/{ => spec}/test_term_bytes3.py (100%) rename spec/python/{ => spec}/test_term_bytes4.py (100%) rename spec/python/{ => spec}/test_term_struct.py (100%) rename spec/python/{ => spec}/test_term_struct2.py (100%) rename spec/python/{ => spec}/test_term_struct3.py (100%) rename spec/python/{ => spec}/test_term_struct4.py (100%) rename spec/python/{ => spec}/test_term_strz.py (100%) rename spec/python/{ => spec}/test_term_strz2.py (100%) rename spec/python/{ => spec}/test_term_strz3.py (100%) rename spec/python/{ => spec}/test_term_strz4.py (100%) rename spec/python/{ => spec}/test_term_u1_val.py (100%) rename spec/python/{ => spec}/test_to_string_custom.py (100%) rename spec/python/{ => spec}/test_ts_packet_header.py (100%) rename spec/python/{ => spec}/test_type_int_unary_op.py (100%) rename spec/python/{ => spec}/test_type_ternary.py (100%) rename spec/python/{ => spec}/test_type_ternary_2nd_falsy.py (100%) rename spec/python/{ => spec}/test_type_ternary_opaque.py (100%) rename spec/python/{ => spec}/test_user_type.py (100%) rename spec/python/{ => spec}/test_valid_eq_str_encodings.py (100%) rename spec/python/{ => spec}/test_valid_fail_anyof_int.py (100%) rename spec/python/{ => spec}/test_valid_fail_contents.py (100%) rename spec/python/{ => spec}/test_valid_fail_eq_bytes.py (100%) rename spec/python/{ => spec}/test_valid_fail_eq_int.py (100%) rename spec/python/{ => spec}/test_valid_fail_eq_str.py (100%) rename spec/python/{ => spec}/test_valid_fail_expr.py (100%) rename spec/python/{ => spec}/test_valid_fail_inst.py (100%) rename spec/python/{ => spec}/test_valid_fail_max_int.py (100%) rename spec/python/{ => spec}/test_valid_fail_min_int.py (100%) rename spec/python/{ => spec}/test_valid_fail_range_bytes.py (100%) rename spec/python/{ => spec}/test_valid_fail_range_float.py (100%) rename spec/python/{ => spec}/test_valid_fail_range_int.py (100%) rename spec/python/{ => spec}/test_valid_fail_range_str.py (100%) rename spec/python/{ => spec}/test_valid_long.py (100%) rename spec/python/{ => spec}/test_valid_not_parsed_if.py (100%) rename spec/python/{ => spec}/test_valid_optional_id.py (100%) rename spec/python/{ => spec}/test_valid_short.py (100%) rename spec/python/{ => spec}/test_valid_switch.py (100%) rename spec/python/{ => spec}/test_yaml_ints.py (100%) rename spec/python/{ => spec}/test_zlib_surrounded.py (100%) rename spec/python/{ => spec}/test_zlib_with_header_78.py (100%) diff --git a/.gitignore b/.gitignore index 1aab4ada0..1761294dc 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ __pycache__/ # Nim _* +!_*.py spec/nim/bin # Rust compiled code, cargo and rls data diff --git a/spec/python/spec/__init__.py b/spec/python/spec/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/spec/python/test_bcd_user_type_be.py b/spec/python/spec/test_bcd_user_type_be.py similarity index 100% rename from spec/python/test_bcd_user_type_be.py rename to spec/python/spec/test_bcd_user_type_be.py diff --git a/spec/python/test_bcd_user_type_le.py b/spec/python/spec/test_bcd_user_type_le.py similarity index 100% rename from spec/python/test_bcd_user_type_le.py rename to spec/python/spec/test_bcd_user_type_le.py diff --git a/spec/python/test_bits_byte_aligned.py b/spec/python/spec/test_bits_byte_aligned.py similarity index 100% rename from spec/python/test_bits_byte_aligned.py rename to spec/python/spec/test_bits_byte_aligned.py diff --git a/spec/python/test_bits_enum.py b/spec/python/spec/test_bits_enum.py similarity index 100% rename from spec/python/test_bits_enum.py rename to spec/python/spec/test_bits_enum.py diff --git a/spec/python/test_bits_seq_endian_combo.py b/spec/python/spec/test_bits_seq_endian_combo.py similarity index 100% rename from spec/python/test_bits_seq_endian_combo.py rename to spec/python/spec/test_bits_seq_endian_combo.py diff --git a/spec/python/test_bits_shift_by_b32_le.py b/spec/python/spec/test_bits_shift_by_b32_le.py similarity index 100% rename from spec/python/test_bits_shift_by_b32_le.py rename to spec/python/spec/test_bits_shift_by_b32_le.py diff --git a/spec/python/test_bits_shift_by_b64_le.py b/spec/python/spec/test_bits_shift_by_b64_le.py similarity index 100% rename from spec/python/test_bits_shift_by_b64_le.py rename to spec/python/spec/test_bits_shift_by_b64_le.py diff --git a/spec/python/test_bits_signed_res_b32_be.py b/spec/python/spec/test_bits_signed_res_b32_be.py similarity index 100% rename from spec/python/test_bits_signed_res_b32_be.py rename to spec/python/spec/test_bits_signed_res_b32_be.py diff --git a/spec/python/test_bits_signed_res_b32_le.py b/spec/python/spec/test_bits_signed_res_b32_le.py similarity index 100% rename from spec/python/test_bits_signed_res_b32_le.py rename to spec/python/spec/test_bits_signed_res_b32_le.py diff --git a/spec/python/test_bits_signed_shift_b32_le.py b/spec/python/spec/test_bits_signed_shift_b32_le.py similarity index 100% rename from spec/python/test_bits_signed_shift_b32_le.py rename to spec/python/spec/test_bits_signed_shift_b32_le.py diff --git a/spec/python/test_bits_signed_shift_b64_le.py b/spec/python/spec/test_bits_signed_shift_b64_le.py similarity index 100% rename from spec/python/test_bits_signed_shift_b64_le.py rename to spec/python/spec/test_bits_signed_shift_b64_le.py diff --git a/spec/python/test_bits_simple.py b/spec/python/spec/test_bits_simple.py similarity index 100% rename from spec/python/test_bits_simple.py rename to spec/python/spec/test_bits_simple.py diff --git a/spec/python/test_bits_simple_le.py b/spec/python/spec/test_bits_simple_le.py similarity index 100% rename from spec/python/test_bits_simple_le.py rename to spec/python/spec/test_bits_simple_le.py diff --git a/spec/python/test_bits_unaligned_b32_be.py b/spec/python/spec/test_bits_unaligned_b32_be.py similarity index 100% rename from spec/python/test_bits_unaligned_b32_be.py rename to spec/python/spec/test_bits_unaligned_b32_be.py diff --git a/spec/python/test_bits_unaligned_b32_le.py b/spec/python/spec/test_bits_unaligned_b32_le.py similarity index 100% rename from spec/python/test_bits_unaligned_b32_le.py rename to spec/python/spec/test_bits_unaligned_b32_le.py diff --git a/spec/python/test_bits_unaligned_b64_be.py b/spec/python/spec/test_bits_unaligned_b64_be.py similarity index 100% rename from spec/python/test_bits_unaligned_b64_be.py rename to spec/python/spec/test_bits_unaligned_b64_be.py diff --git a/spec/python/test_bits_unaligned_b64_le.py b/spec/python/spec/test_bits_unaligned_b64_le.py similarity index 100% rename from spec/python/test_bits_unaligned_b64_le.py rename to spec/python/spec/test_bits_unaligned_b64_le.py diff --git a/spec/python/test_buffered_struct.py b/spec/python/spec/test_buffered_struct.py similarity index 100% rename from spec/python/test_buffered_struct.py rename to spec/python/spec/test_buffered_struct.py diff --git a/spec/python/test_bytes_eos_pad_term.py b/spec/python/spec/test_bytes_eos_pad_term.py similarity index 100% rename from spec/python/test_bytes_eos_pad_term.py rename to spec/python/spec/test_bytes_eos_pad_term.py diff --git a/spec/python/test_bytes_pad_term.py b/spec/python/spec/test_bytes_pad_term.py similarity index 100% rename from spec/python/test_bytes_pad_term.py rename to spec/python/spec/test_bytes_pad_term.py diff --git a/spec/python/test_bytes_pad_term_empty.py b/spec/python/spec/test_bytes_pad_term_empty.py similarity index 100% rename from spec/python/test_bytes_pad_term_empty.py rename to spec/python/spec/test_bytes_pad_term_empty.py diff --git a/spec/python/test_bytes_pad_term_equal.py b/spec/python/spec/test_bytes_pad_term_equal.py similarity index 100% rename from spec/python/test_bytes_pad_term_equal.py rename to spec/python/spec/test_bytes_pad_term_equal.py diff --git a/spec/python/test_bytes_pad_term_roundtrip.py b/spec/python/spec/test_bytes_pad_term_roundtrip.py similarity index 100% rename from spec/python/test_bytes_pad_term_roundtrip.py rename to spec/python/spec/test_bytes_pad_term_roundtrip.py diff --git a/spec/python/test_bytes_pad_term_zero_size.py b/spec/python/spec/test_bytes_pad_term_zero_size.py similarity index 100% rename from spec/python/test_bytes_pad_term_zero_size.py rename to spec/python/spec/test_bytes_pad_term_zero_size.py diff --git a/spec/python/test_cast_nested.py b/spec/python/spec/test_cast_nested.py similarity index 100% rename from spec/python/test_cast_nested.py rename to spec/python/spec/test_cast_nested.py diff --git a/spec/python/test_cast_to_imported.py b/spec/python/spec/test_cast_to_imported.py similarity index 100% rename from spec/python/test_cast_to_imported.py rename to spec/python/spec/test_cast_to_imported.py diff --git a/spec/python/test_cast_to_top.py b/spec/python/spec/test_cast_to_top.py similarity index 100% rename from spec/python/test_cast_to_top.py rename to spec/python/spec/test_cast_to_top.py diff --git a/spec/python/test_combine_bool.py b/spec/python/spec/test_combine_bool.py similarity index 100% rename from spec/python/test_combine_bool.py rename to spec/python/spec/test_combine_bool.py diff --git a/spec/python/test_combine_bytes.py b/spec/python/spec/test_combine_bytes.py similarity index 100% rename from spec/python/test_combine_bytes.py rename to spec/python/spec/test_combine_bytes.py diff --git a/spec/python/test_combine_enum.py b/spec/python/spec/test_combine_enum.py similarity index 100% rename from spec/python/test_combine_enum.py rename to spec/python/spec/test_combine_enum.py diff --git a/spec/python/test_combine_str.py b/spec/python/spec/test_combine_str.py similarity index 100% rename from spec/python/test_combine_str.py rename to spec/python/spec/test_combine_str.py diff --git a/spec/python/test_debug_0.py b/spec/python/spec/test_debug_0.py similarity index 100% rename from spec/python/test_debug_0.py rename to spec/python/spec/test_debug_0.py diff --git a/spec/python/test_debug_array_user.py b/spec/python/spec/test_debug_array_user.py similarity index 100% rename from spec/python/test_debug_array_user.py rename to spec/python/spec/test_debug_array_user.py diff --git a/spec/python/test_debug_enum_name.py b/spec/python/spec/test_debug_enum_name.py similarity index 100% rename from spec/python/test_debug_enum_name.py rename to spec/python/spec/test_debug_enum_name.py diff --git a/spec/python/test_debug_switch_user.py b/spec/python/spec/test_debug_switch_user.py similarity index 100% rename from spec/python/test_debug_switch_user.py rename to spec/python/spec/test_debug_switch_user.py diff --git a/spec/python/test_default_big_endian.py b/spec/python/spec/test_default_big_endian.py similarity index 100% rename from spec/python/test_default_big_endian.py rename to spec/python/spec/test_default_big_endian.py diff --git a/spec/python/test_default_bit_endian_mod.py b/spec/python/spec/test_default_bit_endian_mod.py similarity index 100% rename from spec/python/test_default_bit_endian_mod.py rename to spec/python/spec/test_default_bit_endian_mod.py diff --git a/spec/python/test_default_endian_expr_exception.py b/spec/python/spec/test_default_endian_expr_exception.py similarity index 100% rename from spec/python/test_default_endian_expr_exception.py rename to spec/python/spec/test_default_endian_expr_exception.py diff --git a/spec/python/test_default_endian_expr_inherited.py b/spec/python/spec/test_default_endian_expr_inherited.py similarity index 100% rename from spec/python/test_default_endian_expr_inherited.py rename to spec/python/spec/test_default_endian_expr_inherited.py diff --git a/spec/python/test_default_endian_expr_is_be.py b/spec/python/spec/test_default_endian_expr_is_be.py similarity index 100% rename from spec/python/test_default_endian_expr_is_be.py rename to spec/python/spec/test_default_endian_expr_is_be.py diff --git a/spec/python/test_default_endian_expr_is_le.py b/spec/python/spec/test_default_endian_expr_is_le.py similarity index 100% rename from spec/python/test_default_endian_expr_is_le.py rename to spec/python/spec/test_default_endian_expr_is_le.py diff --git a/spec/python/test_default_endian_mod.py b/spec/python/spec/test_default_endian_mod.py similarity index 100% rename from spec/python/test_default_endian_mod.py rename to spec/python/spec/test_default_endian_mod.py diff --git a/spec/python/test_docstrings.py b/spec/python/spec/test_docstrings.py similarity index 100% rename from spec/python/test_docstrings.py rename to spec/python/spec/test_docstrings.py diff --git a/spec/python/test_docstrings_docref.py b/spec/python/spec/test_docstrings_docref.py similarity index 100% rename from spec/python/test_docstrings_docref.py rename to spec/python/spec/test_docstrings_docref.py diff --git a/spec/python/test_docstrings_docref_multi.py b/spec/python/spec/test_docstrings_docref_multi.py similarity index 100% rename from spec/python/test_docstrings_docref_multi.py rename to spec/python/spec/test_docstrings_docref_multi.py diff --git a/spec/python/test_enum_0.py b/spec/python/spec/test_enum_0.py similarity index 100% rename from spec/python/test_enum_0.py rename to spec/python/spec/test_enum_0.py diff --git a/spec/python/test_enum_1.py b/spec/python/spec/test_enum_1.py similarity index 100% rename from spec/python/test_enum_1.py rename to spec/python/spec/test_enum_1.py diff --git a/spec/python/test_enum_deep.py b/spec/python/spec/test_enum_deep.py similarity index 100% rename from spec/python/test_enum_deep.py rename to spec/python/spec/test_enum_deep.py diff --git a/spec/python/test_enum_deep_literals.py b/spec/python/spec/test_enum_deep_literals.py similarity index 100% rename from spec/python/test_enum_deep_literals.py rename to spec/python/spec/test_enum_deep_literals.py diff --git a/spec/python/test_enum_fancy.py b/spec/python/spec/test_enum_fancy.py similarity index 100% rename from spec/python/test_enum_fancy.py rename to spec/python/spec/test_enum_fancy.py diff --git a/spec/python/test_enum_for_unknown_id.py b/spec/python/spec/test_enum_for_unknown_id.py similarity index 100% rename from spec/python/test_enum_for_unknown_id.py rename to spec/python/spec/test_enum_for_unknown_id.py diff --git a/spec/python/test_enum_if.py b/spec/python/spec/test_enum_if.py similarity index 100% rename from spec/python/test_enum_if.py rename to spec/python/spec/test_enum_if.py diff --git a/spec/python/test_enum_import.py b/spec/python/spec/test_enum_import.py similarity index 100% rename from spec/python/test_enum_import.py rename to spec/python/spec/test_enum_import.py diff --git a/spec/python/test_enum_int_range_s.py b/spec/python/spec/test_enum_int_range_s.py similarity index 100% rename from spec/python/test_enum_int_range_s.py rename to spec/python/spec/test_enum_int_range_s.py diff --git a/spec/python/test_enum_int_range_u.py b/spec/python/spec/test_enum_int_range_u.py similarity index 100% rename from spec/python/test_enum_int_range_u.py rename to spec/python/spec/test_enum_int_range_u.py diff --git a/spec/python/test_enum_invalid.py b/spec/python/spec/test_enum_invalid.py similarity index 100% rename from spec/python/test_enum_invalid.py rename to spec/python/spec/test_enum_invalid.py diff --git a/spec/python/test_enum_long_range_s.py b/spec/python/spec/test_enum_long_range_s.py similarity index 100% rename from spec/python/test_enum_long_range_s.py rename to spec/python/spec/test_enum_long_range_s.py diff --git a/spec/python/test_enum_long_range_u.py b/spec/python/spec/test_enum_long_range_u.py similarity index 100% rename from spec/python/test_enum_long_range_u.py rename to spec/python/spec/test_enum_long_range_u.py diff --git a/spec/python/test_enum_negative.py b/spec/python/spec/test_enum_negative.py similarity index 100% rename from spec/python/test_enum_negative.py rename to spec/python/spec/test_enum_negative.py diff --git a/spec/python/test_enum_of_value_inst.py b/spec/python/spec/test_enum_of_value_inst.py similarity index 100% rename from spec/python/test_enum_of_value_inst.py rename to spec/python/spec/test_enum_of_value_inst.py diff --git a/spec/python/test_enum_to_i.py b/spec/python/spec/test_enum_to_i.py similarity index 100% rename from spec/python/test_enum_to_i.py rename to spec/python/spec/test_enum_to_i.py diff --git a/spec/python/test_enum_to_i_class_border_1.py b/spec/python/spec/test_enum_to_i_class_border_1.py similarity index 100% rename from spec/python/test_enum_to_i_class_border_1.py rename to spec/python/spec/test_enum_to_i_class_border_1.py diff --git a/spec/python/test_eof_exception_bytes.py b/spec/python/spec/test_eof_exception_bytes.py similarity index 100% rename from spec/python/test_eof_exception_bytes.py rename to spec/python/spec/test_eof_exception_bytes.py diff --git a/spec/python/test_eof_exception_u4.py b/spec/python/spec/test_eof_exception_u4.py similarity index 100% rename from spec/python/test_eof_exception_u4.py rename to spec/python/spec/test_eof_exception_u4.py diff --git a/spec/python/test_eos_exception_bytes.py b/spec/python/spec/test_eos_exception_bytes.py similarity index 100% rename from spec/python/test_eos_exception_bytes.py rename to spec/python/spec/test_eos_exception_bytes.py diff --git a/spec/python/test_eos_exception_u4.py b/spec/python/spec/test_eos_exception_u4.py similarity index 100% rename from spec/python/test_eos_exception_u4.py rename to spec/python/spec/test_eos_exception_u4.py diff --git a/spec/python/test_expr_0.py b/spec/python/spec/test_expr_0.py similarity index 100% rename from spec/python/test_expr_0.py rename to spec/python/spec/test_expr_0.py diff --git a/spec/python/test_expr_1.py b/spec/python/spec/test_expr_1.py similarity index 100% rename from spec/python/test_expr_1.py rename to spec/python/spec/test_expr_1.py diff --git a/spec/python/test_expr_2.py b/spec/python/spec/test_expr_2.py similarity index 100% rename from spec/python/test_expr_2.py rename to spec/python/spec/test_expr_2.py diff --git a/spec/python/test_expr_3.py b/spec/python/spec/test_expr_3.py similarity index 100% rename from spec/python/test_expr_3.py rename to spec/python/spec/test_expr_3.py diff --git a/spec/python/test_expr_array.py b/spec/python/spec/test_expr_array.py similarity index 100% rename from spec/python/test_expr_array.py rename to spec/python/spec/test_expr_array.py diff --git a/spec/python/test_expr_bits.py b/spec/python/spec/test_expr_bits.py similarity index 100% rename from spec/python/test_expr_bits.py rename to spec/python/spec/test_expr_bits.py diff --git a/spec/python/test_expr_bytes_cmp.py b/spec/python/spec/test_expr_bytes_cmp.py similarity index 100% rename from spec/python/test_expr_bytes_cmp.py rename to spec/python/spec/test_expr_bytes_cmp.py diff --git a/spec/python/test_expr_bytes_non_literal.py b/spec/python/spec/test_expr_bytes_non_literal.py similarity index 100% rename from spec/python/test_expr_bytes_non_literal.py rename to spec/python/spec/test_expr_bytes_non_literal.py diff --git a/spec/python/test_expr_bytes_ops.py b/spec/python/spec/test_expr_bytes_ops.py similarity index 100% rename from spec/python/test_expr_bytes_ops.py rename to spec/python/spec/test_expr_bytes_ops.py diff --git a/spec/python/test_expr_calc_array_ops.py b/spec/python/spec/test_expr_calc_array_ops.py similarity index 100% rename from spec/python/test_expr_calc_array_ops.py rename to spec/python/spec/test_expr_calc_array_ops.py diff --git a/spec/python/test_expr_enum.py b/spec/python/spec/test_expr_enum.py similarity index 100% rename from spec/python/test_expr_enum.py rename to spec/python/spec/test_expr_enum.py diff --git a/spec/python/test_expr_if_int_eq.py b/spec/python/spec/test_expr_if_int_eq.py similarity index 100% rename from spec/python/test_expr_if_int_eq.py rename to spec/python/spec/test_expr_if_int_eq.py diff --git a/spec/python/test_expr_if_int_ops.py b/spec/python/spec/test_expr_if_int_ops.py similarity index 100% rename from spec/python/test_expr_if_int_ops.py rename to spec/python/spec/test_expr_if_int_ops.py diff --git a/spec/python/test_expr_int_div.py b/spec/python/spec/test_expr_int_div.py similarity index 100% rename from spec/python/test_expr_int_div.py rename to spec/python/spec/test_expr_int_div.py diff --git a/spec/python/test_expr_io_eof.py b/spec/python/spec/test_expr_io_eof.py similarity index 100% rename from spec/python/test_expr_io_eof.py rename to spec/python/spec/test_expr_io_eof.py diff --git a/spec/python/test_expr_io_pos.py b/spec/python/spec/test_expr_io_pos.py similarity index 100% rename from spec/python/test_expr_io_pos.py rename to spec/python/spec/test_expr_io_pos.py diff --git a/spec/python/test_expr_mod.py b/spec/python/spec/test_expr_mod.py similarity index 100% rename from spec/python/test_expr_mod.py rename to spec/python/spec/test_expr_mod.py diff --git a/spec/python/test_expr_ops_parens.py b/spec/python/spec/test_expr_ops_parens.py similarity index 100% rename from spec/python/test_expr_ops_parens.py rename to spec/python/spec/test_expr_ops_parens.py diff --git a/spec/python/test_expr_sizeof_type_0.py b/spec/python/spec/test_expr_sizeof_type_0.py similarity index 100% rename from spec/python/test_expr_sizeof_type_0.py rename to spec/python/spec/test_expr_sizeof_type_0.py diff --git a/spec/python/test_expr_sizeof_type_1.py b/spec/python/spec/test_expr_sizeof_type_1.py similarity index 100% rename from spec/python/test_expr_sizeof_type_1.py rename to spec/python/spec/test_expr_sizeof_type_1.py diff --git a/spec/python/test_expr_sizeof_value_0.py b/spec/python/spec/test_expr_sizeof_value_0.py similarity index 100% rename from spec/python/test_expr_sizeof_value_0.py rename to spec/python/spec/test_expr_sizeof_value_0.py diff --git a/spec/python/test_expr_sizeof_value_sized.py b/spec/python/spec/test_expr_sizeof_value_sized.py similarity index 100% rename from spec/python/test_expr_sizeof_value_sized.py rename to spec/python/spec/test_expr_sizeof_value_sized.py diff --git a/spec/python/test_expr_str_encodings.py b/spec/python/spec/test_expr_str_encodings.py similarity index 100% rename from spec/python/test_expr_str_encodings.py rename to spec/python/spec/test_expr_str_encodings.py diff --git a/spec/python/test_expr_str_ops.py b/spec/python/spec/test_expr_str_ops.py similarity index 100% rename from spec/python/test_expr_str_ops.py rename to spec/python/spec/test_expr_str_ops.py diff --git a/spec/python/test_fixed_contents.py b/spec/python/spec/test_fixed_contents.py similarity index 100% rename from spec/python/test_fixed_contents.py rename to spec/python/spec/test_fixed_contents.py diff --git a/spec/python/test_fixed_struct.py b/spec/python/spec/test_fixed_struct.py similarity index 100% rename from spec/python/test_fixed_struct.py rename to spec/python/spec/test_fixed_struct.py diff --git a/spec/python/test_float_to_i.py b/spec/python/spec/test_float_to_i.py similarity index 100% rename from spec/python/test_float_to_i.py rename to spec/python/spec/test_float_to_i.py diff --git a/spec/python/test_floating_points.py b/spec/python/spec/test_floating_points.py similarity index 100% rename from spec/python/test_floating_points.py rename to spec/python/spec/test_floating_points.py diff --git a/spec/python/test_hello_world.py b/spec/python/spec/test_hello_world.py similarity index 100% rename from spec/python/test_hello_world.py rename to spec/python/spec/test_hello_world.py diff --git a/spec/python/test_if_instances.py b/spec/python/spec/test_if_instances.py similarity index 100% rename from spec/python/test_if_instances.py rename to spec/python/spec/test_if_instances.py diff --git a/spec/python/test_if_struct.py b/spec/python/spec/test_if_struct.py similarity index 100% rename from spec/python/test_if_struct.py rename to spec/python/spec/test_if_struct.py diff --git a/spec/python/test_if_values.py b/spec/python/spec/test_if_values.py similarity index 100% rename from spec/python/test_if_values.py rename to spec/python/spec/test_if_values.py diff --git a/spec/python/test_imports0.py b/spec/python/spec/test_imports0.py similarity index 100% rename from spec/python/test_imports0.py rename to spec/python/spec/test_imports0.py diff --git a/spec/python/test_imports_abs.py b/spec/python/spec/test_imports_abs.py similarity index 100% rename from spec/python/test_imports_abs.py rename to spec/python/spec/test_imports_abs.py diff --git a/spec/python/test_imports_abs_abs.py b/spec/python/spec/test_imports_abs_abs.py similarity index 100% rename from spec/python/test_imports_abs_abs.py rename to spec/python/spec/test_imports_abs_abs.py diff --git a/spec/python/test_imports_abs_rel.py b/spec/python/spec/test_imports_abs_rel.py similarity index 100% rename from spec/python/test_imports_abs_rel.py rename to spec/python/spec/test_imports_abs_rel.py diff --git a/spec/python/test_imports_circular_a.py b/spec/python/spec/test_imports_circular_a.py similarity index 100% rename from spec/python/test_imports_circular_a.py rename to spec/python/spec/test_imports_circular_a.py diff --git a/spec/python/test_imports_rel_1.py b/spec/python/spec/test_imports_rel_1.py similarity index 100% rename from spec/python/test_imports_rel_1.py rename to spec/python/spec/test_imports_rel_1.py diff --git a/spec/python/test_index_sizes.py b/spec/python/spec/test_index_sizes.py similarity index 100% rename from spec/python/test_index_sizes.py rename to spec/python/spec/test_index_sizes.py diff --git a/spec/python/test_index_to_param_eos.py b/spec/python/spec/test_index_to_param_eos.py similarity index 100% rename from spec/python/test_index_to_param_eos.py rename to spec/python/spec/test_index_to_param_eos.py diff --git a/spec/python/test_index_to_param_expr.py b/spec/python/spec/test_index_to_param_expr.py similarity index 100% rename from spec/python/test_index_to_param_expr.py rename to spec/python/spec/test_index_to_param_expr.py diff --git a/spec/python/test_index_to_param_until.py b/spec/python/spec/test_index_to_param_until.py similarity index 100% rename from spec/python/test_index_to_param_until.py rename to spec/python/spec/test_index_to_param_until.py diff --git a/spec/python/test_instance_in_repeat_expr.py b/spec/python/spec/test_instance_in_repeat_expr.py similarity index 100% rename from spec/python/test_instance_in_repeat_expr.py rename to spec/python/spec/test_instance_in_repeat_expr.py diff --git a/spec/python/test_instance_in_repeat_until.py b/spec/python/spec/test_instance_in_repeat_until.py similarity index 100% rename from spec/python/test_instance_in_repeat_until.py rename to spec/python/spec/test_instance_in_repeat_until.py diff --git a/spec/python/test_instance_in_sized.py b/spec/python/spec/test_instance_in_sized.py similarity index 100% rename from spec/python/test_instance_in_sized.py rename to spec/python/spec/test_instance_in_sized.py diff --git a/spec/python/test_instance_io_user.py b/spec/python/spec/test_instance_io_user.py similarity index 100% rename from spec/python/test_instance_io_user.py rename to spec/python/spec/test_instance_io_user.py diff --git a/spec/python/test_instance_io_user_earlier.py b/spec/python/spec/test_instance_io_user_earlier.py similarity index 100% rename from spec/python/test_instance_io_user_earlier.py rename to spec/python/spec/test_instance_io_user_earlier.py diff --git a/spec/python/test_instance_std.py b/spec/python/spec/test_instance_std.py similarity index 100% rename from spec/python/test_instance_std.py rename to spec/python/spec/test_instance_std.py diff --git a/spec/python/test_instance_std_array.py b/spec/python/spec/test_instance_std_array.py similarity index 100% rename from spec/python/test_instance_std_array.py rename to spec/python/spec/test_instance_std_array.py diff --git a/spec/python/test_instance_user_array.py b/spec/python/spec/test_instance_user_array.py similarity index 100% rename from spec/python/test_instance_user_array.py rename to spec/python/spec/test_instance_user_array.py diff --git a/spec/python/test_integers.py b/spec/python/spec/test_integers.py similarity index 100% rename from spec/python/test_integers.py rename to spec/python/spec/test_integers.py diff --git a/spec/python/test_integers_double_overflow.py b/spec/python/spec/test_integers_double_overflow.py similarity index 100% rename from spec/python/test_integers_double_overflow.py rename to spec/python/spec/test_integers_double_overflow.py diff --git a/spec/python/test_integers_min_max.py b/spec/python/spec/test_integers_min_max.py similarity index 100% rename from spec/python/test_integers_min_max.py rename to spec/python/spec/test_integers_min_max.py diff --git a/spec/python/test_io_local_var.py b/spec/python/spec/test_io_local_var.py similarity index 100% rename from spec/python/test_io_local_var.py rename to spec/python/spec/test_io_local_var.py diff --git a/spec/python/test_js_signed_right_shift.py b/spec/python/spec/test_js_signed_right_shift.py similarity index 100% rename from spec/python/test_js_signed_right_shift.py rename to spec/python/spec/test_js_signed_right_shift.py diff --git a/spec/python/test_meta_tags.py b/spec/python/spec/test_meta_tags.py similarity index 100% rename from spec/python/test_meta_tags.py rename to spec/python/spec/test_meta_tags.py diff --git a/spec/python/test_meta_xref.py b/spec/python/spec/test_meta_xref.py similarity index 100% rename from spec/python/test_meta_xref.py rename to spec/python/spec/test_meta_xref.py diff --git a/spec/python/test_multiple_use.py b/spec/python/spec/test_multiple_use.py similarity index 100% rename from spec/python/test_multiple_use.py rename to spec/python/spec/test_multiple_use.py diff --git a/spec/python/test_nav_parent.py b/spec/python/spec/test_nav_parent.py similarity index 100% rename from spec/python/test_nav_parent.py rename to spec/python/spec/test_nav_parent.py diff --git a/spec/python/test_nav_parent2.py b/spec/python/spec/test_nav_parent2.py similarity index 100% rename from spec/python/test_nav_parent2.py rename to spec/python/spec/test_nav_parent2.py diff --git a/spec/python/test_nav_parent3.py b/spec/python/spec/test_nav_parent3.py similarity index 100% rename from spec/python/test_nav_parent3.py rename to spec/python/spec/test_nav_parent3.py diff --git a/spec/python/test_nav_parent_false.py b/spec/python/spec/test_nav_parent_false.py similarity index 100% rename from spec/python/test_nav_parent_false.py rename to spec/python/spec/test_nav_parent_false.py diff --git a/spec/python/test_nav_parent_false2.py b/spec/python/spec/test_nav_parent_false2.py similarity index 100% rename from spec/python/test_nav_parent_false2.py rename to spec/python/spec/test_nav_parent_false2.py diff --git a/spec/python/test_nav_parent_override.py b/spec/python/spec/test_nav_parent_override.py similarity index 100% rename from spec/python/test_nav_parent_override.py rename to spec/python/spec/test_nav_parent_override.py diff --git a/spec/python/test_nav_parent_switch.py b/spec/python/spec/test_nav_parent_switch.py similarity index 100% rename from spec/python/test_nav_parent_switch.py rename to spec/python/spec/test_nav_parent_switch.py diff --git a/spec/python/test_nav_parent_switch_cast.py b/spec/python/spec/test_nav_parent_switch_cast.py similarity index 100% rename from spec/python/test_nav_parent_switch_cast.py rename to spec/python/spec/test_nav_parent_switch_cast.py diff --git a/spec/python/test_nav_parent_vs_value_inst.py b/spec/python/spec/test_nav_parent_vs_value_inst.py similarity index 100% rename from spec/python/test_nav_parent_vs_value_inst.py rename to spec/python/spec/test_nav_parent_vs_value_inst.py diff --git a/spec/python/test_nav_root.py b/spec/python/spec/test_nav_root.py similarity index 100% rename from spec/python/test_nav_root.py rename to spec/python/spec/test_nav_root.py diff --git a/spec/python/test_nested_same_name.py b/spec/python/spec/test_nested_same_name.py similarity index 100% rename from spec/python/test_nested_same_name.py rename to spec/python/spec/test_nested_same_name.py diff --git a/spec/python/test_nested_same_name2.py b/spec/python/spec/test_nested_same_name2.py similarity index 100% rename from spec/python/test_nested_same_name2.py rename to spec/python/spec/test_nested_same_name2.py diff --git a/spec/python/test_nested_type_param.py b/spec/python/spec/test_nested_type_param.py similarity index 100% rename from spec/python/test_nested_type_param.py rename to spec/python/spec/test_nested_type_param.py diff --git a/spec/python/test_nested_types.py b/spec/python/spec/test_nested_types.py similarity index 100% rename from spec/python/test_nested_types.py rename to spec/python/spec/test_nested_types.py diff --git a/spec/python/test_nested_types2.py b/spec/python/spec/test_nested_types2.py similarity index 100% rename from spec/python/test_nested_types2.py rename to spec/python/spec/test_nested_types2.py diff --git a/spec/python/test_nested_types3.py b/spec/python/spec/test_nested_types3.py similarity index 100% rename from spec/python/test_nested_types3.py rename to spec/python/spec/test_nested_types3.py diff --git a/spec/python/test_non_standard.py b/spec/python/spec/test_non_standard.py similarity index 100% rename from spec/python/test_non_standard.py rename to spec/python/spec/test_non_standard.py diff --git a/spec/python/test_opaque_external_type.py b/spec/python/spec/test_opaque_external_type.py similarity index 100% rename from spec/python/test_opaque_external_type.py rename to spec/python/spec/test_opaque_external_type.py diff --git a/spec/python/test_opaque_external_type_02_parent.py b/spec/python/spec/test_opaque_external_type_02_parent.py similarity index 100% rename from spec/python/test_opaque_external_type_02_parent.py rename to spec/python/spec/test_opaque_external_type_02_parent.py diff --git a/spec/python/test_opaque_with_param.py b/spec/python/spec/test_opaque_with_param.py similarity index 100% rename from spec/python/test_opaque_with_param.py rename to spec/python/spec/test_opaque_with_param.py diff --git a/spec/python/test_optional_id.py b/spec/python/spec/test_optional_id.py similarity index 100% rename from spec/python/test_optional_id.py rename to spec/python/spec/test_optional_id.py diff --git a/spec/python/test_params_call_extra_parens.py b/spec/python/spec/test_params_call_extra_parens.py similarity index 100% rename from spec/python/test_params_call_extra_parens.py rename to spec/python/spec/test_params_call_extra_parens.py diff --git a/spec/python/test_params_call_short.py b/spec/python/spec/test_params_call_short.py similarity index 100% rename from spec/python/test_params_call_short.py rename to spec/python/spec/test_params_call_short.py diff --git a/spec/python/test_params_def.py b/spec/python/spec/test_params_def.py similarity index 100% rename from spec/python/test_params_def.py rename to spec/python/spec/test_params_def.py diff --git a/spec/python/test_params_enum.py b/spec/python/spec/test_params_enum.py similarity index 100% rename from spec/python/test_params_enum.py rename to spec/python/spec/test_params_enum.py diff --git a/spec/python/test_params_pass_array_int.py b/spec/python/spec/test_params_pass_array_int.py similarity index 100% rename from spec/python/test_params_pass_array_int.py rename to spec/python/spec/test_params_pass_array_int.py diff --git a/spec/python/test_params_pass_array_io.py b/spec/python/spec/test_params_pass_array_io.py similarity index 100% rename from spec/python/test_params_pass_array_io.py rename to spec/python/spec/test_params_pass_array_io.py diff --git a/spec/python/test_params_pass_array_str.py b/spec/python/spec/test_params_pass_array_str.py similarity index 100% rename from spec/python/test_params_pass_array_str.py rename to spec/python/spec/test_params_pass_array_str.py diff --git a/spec/python/test_params_pass_array_struct.py b/spec/python/spec/test_params_pass_array_struct.py similarity index 100% rename from spec/python/test_params_pass_array_struct.py rename to spec/python/spec/test_params_pass_array_struct.py diff --git a/spec/python/test_params_pass_array_usertype.py b/spec/python/spec/test_params_pass_array_usertype.py similarity index 100% rename from spec/python/test_params_pass_array_usertype.py rename to spec/python/spec/test_params_pass_array_usertype.py diff --git a/spec/python/test_params_pass_bool.py b/spec/python/spec/test_params_pass_bool.py similarity index 100% rename from spec/python/test_params_pass_bool.py rename to spec/python/spec/test_params_pass_bool.py diff --git a/spec/python/test_params_pass_io.py b/spec/python/spec/test_params_pass_io.py similarity index 100% rename from spec/python/test_params_pass_io.py rename to spec/python/spec/test_params_pass_io.py diff --git a/spec/python/test_params_pass_struct.py b/spec/python/spec/test_params_pass_struct.py similarity index 100% rename from spec/python/test_params_pass_struct.py rename to spec/python/spec/test_params_pass_struct.py diff --git a/spec/python/test_params_pass_usertype.py b/spec/python/spec/test_params_pass_usertype.py similarity index 100% rename from spec/python/test_params_pass_usertype.py rename to spec/python/spec/test_params_pass_usertype.py diff --git a/spec/python/test_position_abs.py b/spec/python/spec/test_position_abs.py similarity index 100% rename from spec/python/test_position_abs.py rename to spec/python/spec/test_position_abs.py diff --git a/spec/python/test_position_in_seq.py b/spec/python/spec/test_position_in_seq.py similarity index 100% rename from spec/python/test_position_in_seq.py rename to spec/python/spec/test_position_in_seq.py diff --git a/spec/python/test_position_to_end.py b/spec/python/spec/test_position_to_end.py similarity index 100% rename from spec/python/test_position_to_end.py rename to spec/python/spec/test_position_to_end.py diff --git a/spec/python/test_process_bytes_pad_term.py b/spec/python/spec/test_process_bytes_pad_term.py similarity index 100% rename from spec/python/test_process_bytes_pad_term.py rename to spec/python/spec/test_process_bytes_pad_term.py diff --git a/spec/python/test_process_coerce_bytes.py b/spec/python/spec/test_process_coerce_bytes.py similarity index 100% rename from spec/python/test_process_coerce_bytes.py rename to spec/python/spec/test_process_coerce_bytes.py diff --git a/spec/python/test_process_coerce_switch.py b/spec/python/spec/test_process_coerce_switch.py similarity index 100% rename from spec/python/test_process_coerce_switch.py rename to spec/python/spec/test_process_coerce_switch.py diff --git a/spec/python/test_process_coerce_usertype1.py b/spec/python/spec/test_process_coerce_usertype1.py similarity index 100% rename from spec/python/test_process_coerce_usertype1.py rename to spec/python/spec/test_process_coerce_usertype1.py diff --git a/spec/python/test_process_coerce_usertype2.py b/spec/python/spec/test_process_coerce_usertype2.py similarity index 100% rename from spec/python/test_process_coerce_usertype2.py rename to spec/python/spec/test_process_coerce_usertype2.py diff --git a/spec/python/test_process_custom.py b/spec/python/spec/test_process_custom.py similarity index 100% rename from spec/python/test_process_custom.py rename to spec/python/spec/test_process_custom.py diff --git a/spec/python/test_process_custom_no_args.py b/spec/python/spec/test_process_custom_no_args.py similarity index 100% rename from spec/python/test_process_custom_no_args.py rename to spec/python/spec/test_process_custom_no_args.py diff --git a/spec/python/test_process_repeat_bytes.py b/spec/python/spec/test_process_repeat_bytes.py similarity index 100% rename from spec/python/test_process_repeat_bytes.py rename to spec/python/spec/test_process_repeat_bytes.py diff --git a/spec/python/test_process_repeat_usertype.py b/spec/python/spec/test_process_repeat_usertype.py similarity index 100% rename from spec/python/test_process_repeat_usertype.py rename to spec/python/spec/test_process_repeat_usertype.py diff --git a/spec/python/test_process_repeat_usertype_dynarg_custom.py b/spec/python/spec/test_process_repeat_usertype_dynarg_custom.py similarity index 100% rename from spec/python/test_process_repeat_usertype_dynarg_custom.py rename to spec/python/spec/test_process_repeat_usertype_dynarg_custom.py diff --git a/spec/python/test_process_repeat_usertype_dynarg_rotate.py b/spec/python/spec/test_process_repeat_usertype_dynarg_rotate.py similarity index 100% rename from spec/python/test_process_repeat_usertype_dynarg_rotate.py rename to spec/python/spec/test_process_repeat_usertype_dynarg_rotate.py diff --git a/spec/python/test_process_repeat_usertype_dynarg_xor.py b/spec/python/spec/test_process_repeat_usertype_dynarg_xor.py similarity index 100% rename from spec/python/test_process_repeat_usertype_dynarg_xor.py rename to spec/python/spec/test_process_repeat_usertype_dynarg_xor.py diff --git a/spec/python/test_process_rotate.py b/spec/python/spec/test_process_rotate.py similarity index 100% rename from spec/python/test_process_rotate.py rename to spec/python/spec/test_process_rotate.py diff --git a/spec/python/test_process_struct_pad_term.py b/spec/python/spec/test_process_struct_pad_term.py similarity index 100% rename from spec/python/test_process_struct_pad_term.py rename to spec/python/spec/test_process_struct_pad_term.py diff --git a/spec/python/test_process_term_struct.py b/spec/python/spec/test_process_term_struct.py similarity index 100% rename from spec/python/test_process_term_struct.py rename to spec/python/spec/test_process_term_struct.py diff --git a/spec/python/test_process_to_user.py b/spec/python/spec/test_process_to_user.py similarity index 100% rename from spec/python/test_process_to_user.py rename to spec/python/spec/test_process_to_user.py diff --git a/spec/python/test_process_xor4_const.py b/spec/python/spec/test_process_xor4_const.py similarity index 100% rename from spec/python/test_process_xor4_const.py rename to spec/python/spec/test_process_xor4_const.py diff --git a/spec/python/test_process_xor4_value.py b/spec/python/spec/test_process_xor4_value.py similarity index 100% rename from spec/python/test_process_xor4_value.py rename to spec/python/spec/test_process_xor4_value.py diff --git a/spec/python/test_process_xor_const.py b/spec/python/spec/test_process_xor_const.py similarity index 100% rename from spec/python/test_process_xor_const.py rename to spec/python/spec/test_process_xor_const.py diff --git a/spec/python/test_process_xor_value.py b/spec/python/spec/test_process_xor_value.py similarity index 100% rename from spec/python/test_process_xor_value.py rename to spec/python/spec/test_process_xor_value.py diff --git a/spec/python/test_recursive_one.py b/spec/python/spec/test_recursive_one.py similarity index 100% rename from spec/python/test_recursive_one.py rename to spec/python/spec/test_recursive_one.py diff --git a/spec/python/test_repeat_eos_bit.py b/spec/python/spec/test_repeat_eos_bit.py similarity index 100% rename from spec/python/test_repeat_eos_bit.py rename to spec/python/spec/test_repeat_eos_bit.py diff --git a/spec/python/test_repeat_eos_bytes.py b/spec/python/spec/test_repeat_eos_bytes.py similarity index 100% rename from spec/python/test_repeat_eos_bytes.py rename to spec/python/spec/test_repeat_eos_bytes.py diff --git a/spec/python/test_repeat_eos_bytes_pad.py b/spec/python/spec/test_repeat_eos_bytes_pad.py similarity index 100% rename from spec/python/test_repeat_eos_bytes_pad.py rename to spec/python/spec/test_repeat_eos_bytes_pad.py diff --git a/spec/python/test_repeat_eos_bytes_pad_term.py b/spec/python/spec/test_repeat_eos_bytes_pad_term.py similarity index 100% rename from spec/python/test_repeat_eos_bytes_pad_term.py rename to spec/python/spec/test_repeat_eos_bytes_pad_term.py diff --git a/spec/python/test_repeat_eos_struct.py b/spec/python/spec/test_repeat_eos_struct.py similarity index 100% rename from spec/python/test_repeat_eos_struct.py rename to spec/python/spec/test_repeat_eos_struct.py diff --git a/spec/python/test_repeat_eos_term_bytes.py b/spec/python/spec/test_repeat_eos_term_bytes.py similarity index 100% rename from spec/python/test_repeat_eos_term_bytes.py rename to spec/python/spec/test_repeat_eos_term_bytes.py diff --git a/spec/python/test_repeat_eos_term_struct.py b/spec/python/spec/test_repeat_eos_term_struct.py similarity index 100% rename from spec/python/test_repeat_eos_term_struct.py rename to spec/python/spec/test_repeat_eos_term_struct.py diff --git a/spec/python/test_repeat_eos_u4.py b/spec/python/spec/test_repeat_eos_u4.py similarity index 100% rename from spec/python/test_repeat_eos_u4.py rename to spec/python/spec/test_repeat_eos_u4.py diff --git a/spec/python/test_repeat_n_bytes.py b/spec/python/spec/test_repeat_n_bytes.py similarity index 100% rename from spec/python/test_repeat_n_bytes.py rename to spec/python/spec/test_repeat_n_bytes.py diff --git a/spec/python/test_repeat_n_bytes_pad.py b/spec/python/spec/test_repeat_n_bytes_pad.py similarity index 100% rename from spec/python/test_repeat_n_bytes_pad.py rename to spec/python/spec/test_repeat_n_bytes_pad.py diff --git a/spec/python/test_repeat_n_bytes_pad_term.py b/spec/python/spec/test_repeat_n_bytes_pad_term.py similarity index 100% rename from spec/python/test_repeat_n_bytes_pad_term.py rename to spec/python/spec/test_repeat_n_bytes_pad_term.py diff --git a/spec/python/test_repeat_n_struct.py b/spec/python/spec/test_repeat_n_struct.py similarity index 100% rename from spec/python/test_repeat_n_struct.py rename to spec/python/spec/test_repeat_n_struct.py diff --git a/spec/python/test_repeat_n_strz.py b/spec/python/spec/test_repeat_n_strz.py similarity index 100% rename from spec/python/test_repeat_n_strz.py rename to spec/python/spec/test_repeat_n_strz.py diff --git a/spec/python/test_repeat_n_strz_double.py b/spec/python/spec/test_repeat_n_strz_double.py similarity index 100% rename from spec/python/test_repeat_n_strz_double.py rename to spec/python/spec/test_repeat_n_strz_double.py diff --git a/spec/python/test_repeat_n_term_bytes.py b/spec/python/spec/test_repeat_n_term_bytes.py similarity index 100% rename from spec/python/test_repeat_n_term_bytes.py rename to spec/python/spec/test_repeat_n_term_bytes.py diff --git a/spec/python/test_repeat_n_term_struct.py b/spec/python/spec/test_repeat_n_term_struct.py similarity index 100% rename from spec/python/test_repeat_n_term_struct.py rename to spec/python/spec/test_repeat_n_term_struct.py diff --git a/spec/python/test_repeat_until_bytes.py b/spec/python/spec/test_repeat_until_bytes.py similarity index 100% rename from spec/python/test_repeat_until_bytes.py rename to spec/python/spec/test_repeat_until_bytes.py diff --git a/spec/python/test_repeat_until_bytes_pad.py b/spec/python/spec/test_repeat_until_bytes_pad.py similarity index 100% rename from spec/python/test_repeat_until_bytes_pad.py rename to spec/python/spec/test_repeat_until_bytes_pad.py diff --git a/spec/python/test_repeat_until_bytes_pad_term.py b/spec/python/spec/test_repeat_until_bytes_pad_term.py similarity index 100% rename from spec/python/test_repeat_until_bytes_pad_term.py rename to spec/python/spec/test_repeat_until_bytes_pad_term.py diff --git a/spec/python/test_repeat_until_calc_array_type.py b/spec/python/spec/test_repeat_until_calc_array_type.py similarity index 100% rename from spec/python/test_repeat_until_calc_array_type.py rename to spec/python/spec/test_repeat_until_calc_array_type.py diff --git a/spec/python/test_repeat_until_complex.py b/spec/python/spec/test_repeat_until_complex.py similarity index 100% rename from spec/python/test_repeat_until_complex.py rename to spec/python/spec/test_repeat_until_complex.py diff --git a/spec/python/test_repeat_until_s4.py b/spec/python/spec/test_repeat_until_s4.py similarity index 100% rename from spec/python/test_repeat_until_s4.py rename to spec/python/spec/test_repeat_until_s4.py diff --git a/spec/python/test_repeat_until_sized.py b/spec/python/spec/test_repeat_until_sized.py similarity index 100% rename from spec/python/test_repeat_until_sized.py rename to spec/python/spec/test_repeat_until_sized.py diff --git a/spec/python/test_repeat_until_term_bytes.py b/spec/python/spec/test_repeat_until_term_bytes.py similarity index 100% rename from spec/python/test_repeat_until_term_bytes.py rename to spec/python/spec/test_repeat_until_term_bytes.py diff --git a/spec/python/test_repeat_until_term_struct.py b/spec/python/spec/test_repeat_until_term_struct.py similarity index 100% rename from spec/python/test_repeat_until_term_struct.py rename to spec/python/spec/test_repeat_until_term_struct.py diff --git a/spec/python/test_str_encodings.py b/spec/python/spec/test_str_encodings.py similarity index 100% rename from spec/python/test_str_encodings.py rename to spec/python/spec/test_str_encodings.py diff --git a/spec/python/test_str_encodings_default.py b/spec/python/spec/test_str_encodings_default.py similarity index 100% rename from spec/python/test_str_encodings_default.py rename to spec/python/spec/test_str_encodings_default.py diff --git a/spec/python/test_str_encodings_utf16.py b/spec/python/spec/test_str_encodings_utf16.py similarity index 100% rename from spec/python/test_str_encodings_utf16.py rename to spec/python/spec/test_str_encodings_utf16.py diff --git a/spec/python/test_str_eos.py b/spec/python/spec/test_str_eos.py similarity index 100% rename from spec/python/test_str_eos.py rename to spec/python/spec/test_str_eos.py diff --git a/spec/python/test_str_eos_pad_term.py b/spec/python/spec/test_str_eos_pad_term.py similarity index 100% rename from spec/python/test_str_eos_pad_term.py rename to spec/python/spec/test_str_eos_pad_term.py diff --git a/spec/python/test_str_eos_pad_term_empty.py b/spec/python/spec/test_str_eos_pad_term_empty.py similarity index 100% rename from spec/python/test_str_eos_pad_term_empty.py rename to spec/python/spec/test_str_eos_pad_term_empty.py diff --git a/spec/python/test_str_eos_pad_term_equal.py b/spec/python/spec/test_str_eos_pad_term_equal.py similarity index 100% rename from spec/python/test_str_eos_pad_term_equal.py rename to spec/python/spec/test_str_eos_pad_term_equal.py diff --git a/spec/python/test_str_literals.py b/spec/python/spec/test_str_literals.py similarity index 100% rename from spec/python/test_str_literals.py rename to spec/python/spec/test_str_literals.py diff --git a/spec/python/test_str_literals2.py b/spec/python/spec/test_str_literals2.py similarity index 100% rename from spec/python/test_str_literals2.py rename to spec/python/spec/test_str_literals2.py diff --git a/spec/python/test_str_pad_term.py b/spec/python/spec/test_str_pad_term.py similarity index 100% rename from spec/python/test_str_pad_term.py rename to spec/python/spec/test_str_pad_term.py diff --git a/spec/python/test_str_pad_term_empty.py b/spec/python/spec/test_str_pad_term_empty.py similarity index 100% rename from spec/python/test_str_pad_term_empty.py rename to spec/python/spec/test_str_pad_term_empty.py diff --git a/spec/python/test_str_pad_term_equal.py b/spec/python/spec/test_str_pad_term_equal.py similarity index 100% rename from spec/python/test_str_pad_term_equal.py rename to spec/python/spec/test_str_pad_term_equal.py diff --git a/spec/python/test_str_pad_term_roundtrip.py b/spec/python/spec/test_str_pad_term_roundtrip.py similarity index 100% rename from spec/python/test_str_pad_term_roundtrip.py rename to spec/python/spec/test_str_pad_term_roundtrip.py diff --git a/spec/python/test_str_pad_term_zero_size.py b/spec/python/spec/test_str_pad_term_zero_size.py similarity index 100% rename from spec/python/test_str_pad_term_zero_size.py rename to spec/python/spec/test_str_pad_term_zero_size.py diff --git a/spec/python/test_struct_pad_term.py b/spec/python/spec/test_struct_pad_term.py similarity index 100% rename from spec/python/test_struct_pad_term.py rename to spec/python/spec/test_struct_pad_term.py diff --git a/spec/python/test_struct_pad_term_equal.py b/spec/python/spec/test_struct_pad_term_equal.py similarity index 100% rename from spec/python/test_struct_pad_term_equal.py rename to spec/python/spec/test_struct_pad_term_equal.py diff --git a/spec/python/test_switch_bytearray.py b/spec/python/spec/test_switch_bytearray.py similarity index 100% rename from spec/python/test_switch_bytearray.py rename to spec/python/spec/test_switch_bytearray.py diff --git a/spec/python/test_switch_cast.py b/spec/python/spec/test_switch_cast.py similarity index 100% rename from spec/python/test_switch_cast.py rename to spec/python/spec/test_switch_cast.py diff --git a/spec/python/test_switch_else_only.py b/spec/python/spec/test_switch_else_only.py similarity index 100% rename from spec/python/test_switch_else_only.py rename to spec/python/spec/test_switch_else_only.py diff --git a/spec/python/test_switch_integers.py b/spec/python/spec/test_switch_integers.py similarity index 100% rename from spec/python/test_switch_integers.py rename to spec/python/spec/test_switch_integers.py diff --git a/spec/python/test_switch_integers2.py b/spec/python/spec/test_switch_integers2.py similarity index 100% rename from spec/python/test_switch_integers2.py rename to spec/python/spec/test_switch_integers2.py diff --git a/spec/python/test_switch_manual_enum.py b/spec/python/spec/test_switch_manual_enum.py similarity index 100% rename from spec/python/test_switch_manual_enum.py rename to spec/python/spec/test_switch_manual_enum.py diff --git a/spec/python/test_switch_manual_enum_invalid.py b/spec/python/spec/test_switch_manual_enum_invalid.py similarity index 100% rename from spec/python/test_switch_manual_enum_invalid.py rename to spec/python/spec/test_switch_manual_enum_invalid.py diff --git a/spec/python/test_switch_manual_enum_invalid_else.py b/spec/python/spec/test_switch_manual_enum_invalid_else.py similarity index 100% rename from spec/python/test_switch_manual_enum_invalid_else.py rename to spec/python/spec/test_switch_manual_enum_invalid_else.py diff --git a/spec/python/test_switch_manual_int.py b/spec/python/spec/test_switch_manual_int.py similarity index 100% rename from spec/python/test_switch_manual_int.py rename to spec/python/spec/test_switch_manual_int.py diff --git a/spec/python/test_switch_manual_int_else.py b/spec/python/spec/test_switch_manual_int_else.py similarity index 100% rename from spec/python/test_switch_manual_int_else.py rename to spec/python/spec/test_switch_manual_int_else.py diff --git a/spec/python/test_switch_manual_int_size.py b/spec/python/spec/test_switch_manual_int_size.py similarity index 100% rename from spec/python/test_switch_manual_int_size.py rename to spec/python/spec/test_switch_manual_int_size.py diff --git a/spec/python/test_switch_manual_int_size_else.py b/spec/python/spec/test_switch_manual_int_size_else.py similarity index 100% rename from spec/python/test_switch_manual_int_size_else.py rename to spec/python/spec/test_switch_manual_int_size_else.py diff --git a/spec/python/test_switch_manual_int_size_eos.py b/spec/python/spec/test_switch_manual_int_size_eos.py similarity index 100% rename from spec/python/test_switch_manual_int_size_eos.py rename to spec/python/spec/test_switch_manual_int_size_eos.py diff --git a/spec/python/test_switch_manual_str.py b/spec/python/spec/test_switch_manual_str.py similarity index 100% rename from spec/python/test_switch_manual_str.py rename to spec/python/spec/test_switch_manual_str.py diff --git a/spec/python/test_switch_manual_str_else.py b/spec/python/spec/test_switch_manual_str_else.py similarity index 100% rename from spec/python/test_switch_manual_str_else.py rename to spec/python/spec/test_switch_manual_str_else.py diff --git a/spec/python/test_switch_multi_bool_ops.py b/spec/python/spec/test_switch_multi_bool_ops.py similarity index 100% rename from spec/python/test_switch_multi_bool_ops.py rename to spec/python/spec/test_switch_multi_bool_ops.py diff --git a/spec/python/test_switch_repeat_expr.py b/spec/python/spec/test_switch_repeat_expr.py similarity index 100% rename from spec/python/test_switch_repeat_expr.py rename to spec/python/spec/test_switch_repeat_expr.py diff --git a/spec/python/test_switch_repeat_expr_invalid.py b/spec/python/spec/test_switch_repeat_expr_invalid.py similarity index 100% rename from spec/python/test_switch_repeat_expr_invalid.py rename to spec/python/spec/test_switch_repeat_expr_invalid.py diff --git a/spec/python/test_term_bytes.py b/spec/python/spec/test_term_bytes.py similarity index 100% rename from spec/python/test_term_bytes.py rename to spec/python/spec/test_term_bytes.py diff --git a/spec/python/test_term_bytes2.py b/spec/python/spec/test_term_bytes2.py similarity index 100% rename from spec/python/test_term_bytes2.py rename to spec/python/spec/test_term_bytes2.py diff --git a/spec/python/test_term_bytes3.py b/spec/python/spec/test_term_bytes3.py similarity index 100% rename from spec/python/test_term_bytes3.py rename to spec/python/spec/test_term_bytes3.py diff --git a/spec/python/test_term_bytes4.py b/spec/python/spec/test_term_bytes4.py similarity index 100% rename from spec/python/test_term_bytes4.py rename to spec/python/spec/test_term_bytes4.py diff --git a/spec/python/test_term_struct.py b/spec/python/spec/test_term_struct.py similarity index 100% rename from spec/python/test_term_struct.py rename to spec/python/spec/test_term_struct.py diff --git a/spec/python/test_term_struct2.py b/spec/python/spec/test_term_struct2.py similarity index 100% rename from spec/python/test_term_struct2.py rename to spec/python/spec/test_term_struct2.py diff --git a/spec/python/test_term_struct3.py b/spec/python/spec/test_term_struct3.py similarity index 100% rename from spec/python/test_term_struct3.py rename to spec/python/spec/test_term_struct3.py diff --git a/spec/python/test_term_struct4.py b/spec/python/spec/test_term_struct4.py similarity index 100% rename from spec/python/test_term_struct4.py rename to spec/python/spec/test_term_struct4.py diff --git a/spec/python/test_term_strz.py b/spec/python/spec/test_term_strz.py similarity index 100% rename from spec/python/test_term_strz.py rename to spec/python/spec/test_term_strz.py diff --git a/spec/python/test_term_strz2.py b/spec/python/spec/test_term_strz2.py similarity index 100% rename from spec/python/test_term_strz2.py rename to spec/python/spec/test_term_strz2.py diff --git a/spec/python/test_term_strz3.py b/spec/python/spec/test_term_strz3.py similarity index 100% rename from spec/python/test_term_strz3.py rename to spec/python/spec/test_term_strz3.py diff --git a/spec/python/test_term_strz4.py b/spec/python/spec/test_term_strz4.py similarity index 100% rename from spec/python/test_term_strz4.py rename to spec/python/spec/test_term_strz4.py diff --git a/spec/python/test_term_u1_val.py b/spec/python/spec/test_term_u1_val.py similarity index 100% rename from spec/python/test_term_u1_val.py rename to spec/python/spec/test_term_u1_val.py diff --git a/spec/python/test_to_string_custom.py b/spec/python/spec/test_to_string_custom.py similarity index 100% rename from spec/python/test_to_string_custom.py rename to spec/python/spec/test_to_string_custom.py diff --git a/spec/python/test_ts_packet_header.py b/spec/python/spec/test_ts_packet_header.py similarity index 100% rename from spec/python/test_ts_packet_header.py rename to spec/python/spec/test_ts_packet_header.py diff --git a/spec/python/test_type_int_unary_op.py b/spec/python/spec/test_type_int_unary_op.py similarity index 100% rename from spec/python/test_type_int_unary_op.py rename to spec/python/spec/test_type_int_unary_op.py diff --git a/spec/python/test_type_ternary.py b/spec/python/spec/test_type_ternary.py similarity index 100% rename from spec/python/test_type_ternary.py rename to spec/python/spec/test_type_ternary.py diff --git a/spec/python/test_type_ternary_2nd_falsy.py b/spec/python/spec/test_type_ternary_2nd_falsy.py similarity index 100% rename from spec/python/test_type_ternary_2nd_falsy.py rename to spec/python/spec/test_type_ternary_2nd_falsy.py diff --git a/spec/python/test_type_ternary_opaque.py b/spec/python/spec/test_type_ternary_opaque.py similarity index 100% rename from spec/python/test_type_ternary_opaque.py rename to spec/python/spec/test_type_ternary_opaque.py diff --git a/spec/python/test_user_type.py b/spec/python/spec/test_user_type.py similarity index 100% rename from spec/python/test_user_type.py rename to spec/python/spec/test_user_type.py diff --git a/spec/python/test_valid_eq_str_encodings.py b/spec/python/spec/test_valid_eq_str_encodings.py similarity index 100% rename from spec/python/test_valid_eq_str_encodings.py rename to spec/python/spec/test_valid_eq_str_encodings.py diff --git a/spec/python/test_valid_fail_anyof_int.py b/spec/python/spec/test_valid_fail_anyof_int.py similarity index 100% rename from spec/python/test_valid_fail_anyof_int.py rename to spec/python/spec/test_valid_fail_anyof_int.py diff --git a/spec/python/test_valid_fail_contents.py b/spec/python/spec/test_valid_fail_contents.py similarity index 100% rename from spec/python/test_valid_fail_contents.py rename to spec/python/spec/test_valid_fail_contents.py diff --git a/spec/python/test_valid_fail_eq_bytes.py b/spec/python/spec/test_valid_fail_eq_bytes.py similarity index 100% rename from spec/python/test_valid_fail_eq_bytes.py rename to spec/python/spec/test_valid_fail_eq_bytes.py diff --git a/spec/python/test_valid_fail_eq_int.py b/spec/python/spec/test_valid_fail_eq_int.py similarity index 100% rename from spec/python/test_valid_fail_eq_int.py rename to spec/python/spec/test_valid_fail_eq_int.py diff --git a/spec/python/test_valid_fail_eq_str.py b/spec/python/spec/test_valid_fail_eq_str.py similarity index 100% rename from spec/python/test_valid_fail_eq_str.py rename to spec/python/spec/test_valid_fail_eq_str.py diff --git a/spec/python/test_valid_fail_expr.py b/spec/python/spec/test_valid_fail_expr.py similarity index 100% rename from spec/python/test_valid_fail_expr.py rename to spec/python/spec/test_valid_fail_expr.py diff --git a/spec/python/test_valid_fail_inst.py b/spec/python/spec/test_valid_fail_inst.py similarity index 100% rename from spec/python/test_valid_fail_inst.py rename to spec/python/spec/test_valid_fail_inst.py diff --git a/spec/python/test_valid_fail_max_int.py b/spec/python/spec/test_valid_fail_max_int.py similarity index 100% rename from spec/python/test_valid_fail_max_int.py rename to spec/python/spec/test_valid_fail_max_int.py diff --git a/spec/python/test_valid_fail_min_int.py b/spec/python/spec/test_valid_fail_min_int.py similarity index 100% rename from spec/python/test_valid_fail_min_int.py rename to spec/python/spec/test_valid_fail_min_int.py diff --git a/spec/python/test_valid_fail_range_bytes.py b/spec/python/spec/test_valid_fail_range_bytes.py similarity index 100% rename from spec/python/test_valid_fail_range_bytes.py rename to spec/python/spec/test_valid_fail_range_bytes.py diff --git a/spec/python/test_valid_fail_range_float.py b/spec/python/spec/test_valid_fail_range_float.py similarity index 100% rename from spec/python/test_valid_fail_range_float.py rename to spec/python/spec/test_valid_fail_range_float.py diff --git a/spec/python/test_valid_fail_range_int.py b/spec/python/spec/test_valid_fail_range_int.py similarity index 100% rename from spec/python/test_valid_fail_range_int.py rename to spec/python/spec/test_valid_fail_range_int.py diff --git a/spec/python/test_valid_fail_range_str.py b/spec/python/spec/test_valid_fail_range_str.py similarity index 100% rename from spec/python/test_valid_fail_range_str.py rename to spec/python/spec/test_valid_fail_range_str.py diff --git a/spec/python/test_valid_long.py b/spec/python/spec/test_valid_long.py similarity index 100% rename from spec/python/test_valid_long.py rename to spec/python/spec/test_valid_long.py diff --git a/spec/python/test_valid_not_parsed_if.py b/spec/python/spec/test_valid_not_parsed_if.py similarity index 100% rename from spec/python/test_valid_not_parsed_if.py rename to spec/python/spec/test_valid_not_parsed_if.py diff --git a/spec/python/test_valid_optional_id.py b/spec/python/spec/test_valid_optional_id.py similarity index 100% rename from spec/python/test_valid_optional_id.py rename to spec/python/spec/test_valid_optional_id.py diff --git a/spec/python/test_valid_short.py b/spec/python/spec/test_valid_short.py similarity index 100% rename from spec/python/test_valid_short.py rename to spec/python/spec/test_valid_short.py diff --git a/spec/python/test_valid_switch.py b/spec/python/spec/test_valid_switch.py similarity index 100% rename from spec/python/test_valid_switch.py rename to spec/python/spec/test_valid_switch.py diff --git a/spec/python/test_yaml_ints.py b/spec/python/spec/test_yaml_ints.py similarity index 100% rename from spec/python/test_yaml_ints.py rename to spec/python/spec/test_yaml_ints.py diff --git a/spec/python/test_zlib_surrounded.py b/spec/python/spec/test_zlib_surrounded.py similarity index 100% rename from spec/python/test_zlib_surrounded.py rename to spec/python/spec/test_zlib_surrounded.py diff --git a/spec/python/test_zlib_with_header_78.py b/spec/python/spec/test_zlib_with_header_78.py similarity index 100% rename from spec/python/test_zlib_with_header_78.py rename to spec/python/spec/test_zlib_with_header_78.py diff --git a/translator/src/main/scala/io/kaitai/struct/testtranslator/specgenerators/PythonSG.scala b/translator/src/main/scala/io/kaitai/struct/testtranslator/specgenerators/PythonSG.scala index dc37f72c4..5b845e8ca 100644 --- a/translator/src/main/scala/io/kaitai/struct/testtranslator/specgenerators/PythonSG.scala +++ b/translator/src/main/scala/io/kaitai/struct/testtranslator/specgenerators/PythonSG.scala @@ -13,13 +13,13 @@ class PythonSG(spec: TestSpec, provider: ClassTypeProvider) extends BaseGenerato val translator = new PythonTranslator(provider, importList) val className = PythonCompiler.type2class(spec.id) - override def fileName(name: String): String = s"test_$name.py" + override def fileName(name: String): String = s"spec/test_$name.py" override def indentStr: String = " " override def header(): Unit = { out.puts - out.puts(s"from ${spec.id} import $className") + out.puts(s"from testformats.${spec.id} import $className") out.puts out.puts(s"class Test$className(unittest.TestCase):") out.inc From 56b337f6c082571eaa1108a85c17be2d7170d730 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Fri, 17 Feb 2023 23:31:36 +0100 Subject: [PATCH 078/126] Generate .py modules to `testformats` and `testwrite` packages --- build-formats | 24 +++++++++++++++++-- spec/python/spec/test_bcd_user_type_be.py | 2 +- spec/python/spec/test_bcd_user_type_le.py | 2 +- spec/python/spec/test_bits_byte_aligned.py | 2 +- spec/python/spec/test_bits_enum.py | 2 +- .../python/spec/test_bits_seq_endian_combo.py | 2 +- spec/python/spec/test_bits_shift_by_b32_le.py | 2 +- spec/python/spec/test_bits_shift_by_b64_le.py | 2 +- .../spec/test_bits_signed_res_b32_be.py | 2 +- .../spec/test_bits_signed_res_b32_le.py | 2 +- .../spec/test_bits_signed_shift_b32_le.py | 2 +- .../spec/test_bits_signed_shift_b64_le.py | 2 +- spec/python/spec/test_bits_simple.py | 2 +- spec/python/spec/test_bits_simple_le.py | 2 +- .../python/spec/test_bits_unaligned_b32_be.py | 2 +- .../python/spec/test_bits_unaligned_b32_le.py | 2 +- .../python/spec/test_bits_unaligned_b64_be.py | 2 +- .../python/spec/test_bits_unaligned_b64_le.py | 2 +- spec/python/spec/test_buffered_struct.py | 2 +- spec/python/spec/test_bytes_eos_pad_term.py | 2 +- spec/python/spec/test_bytes_pad_term.py | 2 +- spec/python/spec/test_bytes_pad_term_empty.py | 2 +- spec/python/spec/test_bytes_pad_term_equal.py | 2 +- .../spec/test_bytes_pad_term_roundtrip.py | 2 +- .../spec/test_bytes_pad_term_zero_size.py | 2 +- spec/python/spec/test_cast_nested.py | 2 +- spec/python/spec/test_cast_to_imported.py | 2 +- spec/python/spec/test_cast_to_top.py | 2 +- spec/python/spec/test_combine_bool.py | 2 +- spec/python/spec/test_combine_bytes.py | 2 +- spec/python/spec/test_combine_enum.py | 2 +- spec/python/spec/test_combine_str.py | 2 +- spec/python/spec/test_debug_0.py | 2 +- spec/python/spec/test_debug_array_user.py | 6 ++--- spec/python/spec/test_debug_enum_name.py | 2 +- spec/python/spec/test_debug_switch_user.py | 2 +- spec/python/spec/test_default_big_endian.py | 2 +- .../spec/test_default_bit_endian_mod.py | 2 +- .../test_default_endian_expr_exception.py | 2 +- .../test_default_endian_expr_inherited.py | 2 +- .../spec/test_default_endian_expr_is_be.py | 2 +- .../spec/test_default_endian_expr_is_le.py | 2 +- spec/python/spec/test_default_endian_mod.py | 2 +- spec/python/spec/test_docstrings.py | 2 +- spec/python/spec/test_docstrings_docref.py | 2 +- .../spec/test_docstrings_docref_multi.py | 2 +- spec/python/spec/test_enum_0.py | 2 +- spec/python/spec/test_enum_1.py | 2 +- spec/python/spec/test_enum_deep.py | 2 +- spec/python/spec/test_enum_deep_literals.py | 2 +- spec/python/spec/test_enum_fancy.py | 2 +- spec/python/spec/test_enum_for_unknown_id.py | 2 +- spec/python/spec/test_enum_if.py | 2 +- spec/python/spec/test_enum_import.py | 6 ++--- spec/python/spec/test_enum_int_range_s.py | 2 +- spec/python/spec/test_enum_int_range_u.py | 2 +- spec/python/spec/test_enum_invalid.py | 2 +- spec/python/spec/test_enum_long_range_s.py | 2 +- spec/python/spec/test_enum_long_range_u.py | 2 +- spec/python/spec/test_enum_negative.py | 2 +- spec/python/spec/test_enum_of_value_inst.py | 2 +- spec/python/spec/test_enum_to_i.py | 2 +- .../spec/test_enum_to_i_class_border_1.py | 2 +- spec/python/spec/test_eof_exception_bytes.py | 2 +- spec/python/spec/test_eof_exception_u4.py | 2 +- spec/python/spec/test_eos_exception_bytes.py | 2 +- spec/python/spec/test_eos_exception_u4.py | 2 +- spec/python/spec/test_expr_0.py | 2 +- spec/python/spec/test_expr_1.py | 2 +- spec/python/spec/test_expr_2.py | 2 +- spec/python/spec/test_expr_3.py | 2 +- spec/python/spec/test_expr_array.py | 2 +- spec/python/spec/test_expr_bits.py | 2 +- spec/python/spec/test_expr_bytes_cmp.py | 2 +- .../spec/test_expr_bytes_non_literal.py | 2 +- spec/python/spec/test_expr_bytes_ops.py | 2 +- spec/python/spec/test_expr_calc_array_ops.py | 2 +- spec/python/spec/test_expr_enum.py | 2 +- spec/python/spec/test_expr_if_int_eq.py | 2 +- spec/python/spec/test_expr_if_int_ops.py | 2 +- spec/python/spec/test_expr_int_div.py | 2 +- spec/python/spec/test_expr_io_eof.py | 2 +- spec/python/spec/test_expr_io_pos.py | 2 +- spec/python/spec/test_expr_mod.py | 2 +- spec/python/spec/test_expr_ops_parens.py | 2 +- spec/python/spec/test_expr_sizeof_type_0.py | 2 +- spec/python/spec/test_expr_sizeof_type_1.py | 2 +- spec/python/spec/test_expr_sizeof_value_0.py | 2 +- .../spec/test_expr_sizeof_value_sized.py | 2 +- spec/python/spec/test_expr_str_encodings.py | 2 +- spec/python/spec/test_expr_str_ops.py | 2 +- spec/python/spec/test_fixed_contents.py | 2 +- spec/python/spec/test_fixed_struct.py | 2 +- spec/python/spec/test_float_to_i.py | 2 +- spec/python/spec/test_floating_points.py | 2 +- spec/python/spec/test_hello_world.py | 2 +- spec/python/spec/test_if_instances.py | 2 +- spec/python/spec/test_if_struct.py | 2 +- spec/python/spec/test_if_values.py | 2 +- spec/python/spec/test_imports0.py | 2 +- spec/python/spec/test_imports_abs.py | 2 +- spec/python/spec/test_imports_abs_abs.py | 2 +- spec/python/spec/test_imports_abs_rel.py | 2 +- spec/python/spec/test_imports_circular_a.py | 2 +- spec/python/spec/test_imports_rel_1.py | 2 +- spec/python/spec/test_index_sizes.py | 2 +- spec/python/spec/test_index_to_param_eos.py | 2 +- spec/python/spec/test_index_to_param_expr.py | 2 +- spec/python/spec/test_index_to_param_until.py | 2 +- .../spec/test_instance_in_repeat_expr.py | 2 +- .../spec/test_instance_in_repeat_until.py | 2 +- spec/python/spec/test_instance_in_sized.py | 2 +- spec/python/spec/test_instance_io_user.py | 2 +- .../spec/test_instance_io_user_earlier.py | 2 +- spec/python/spec/test_instance_std.py | 2 +- spec/python/spec/test_instance_std_array.py | 2 +- spec/python/spec/test_instance_user_array.py | 2 +- spec/python/spec/test_integers.py | 2 +- .../spec/test_integers_double_overflow.py | 2 +- spec/python/spec/test_integers_min_max.py | 2 +- spec/python/spec/test_io_local_var.py | 2 +- .../python/spec/test_js_signed_right_shift.py | 2 +- spec/python/spec/test_meta_tags.py | 2 +- spec/python/spec/test_meta_xref.py | 2 +- spec/python/spec/test_multiple_use.py | 2 +- spec/python/spec/test_nav_parent.py | 2 +- spec/python/spec/test_nav_parent2.py | 2 +- spec/python/spec/test_nav_parent3.py | 2 +- spec/python/spec/test_nav_parent_false.py | 2 +- spec/python/spec/test_nav_parent_false2.py | 2 +- spec/python/spec/test_nav_parent_override.py | 2 +- spec/python/spec/test_nav_parent_switch.py | 2 +- .../spec/test_nav_parent_switch_cast.py | 2 +- .../spec/test_nav_parent_vs_value_inst.py | 2 +- spec/python/spec/test_nav_root.py | 2 +- spec/python/spec/test_nested_same_name.py | 2 +- spec/python/spec/test_nested_same_name2.py | 2 +- spec/python/spec/test_nested_type_param.py | 2 +- spec/python/spec/test_nested_types.py | 2 +- spec/python/spec/test_nested_types2.py | 2 +- spec/python/spec/test_nested_types3.py | 2 +- spec/python/spec/test_non_standard.py | 2 +- spec/python/spec/test_opaque_external_type.py | 2 +- .../test_opaque_external_type_02_parent.py | 2 +- spec/python/spec/test_opaque_with_param.py | 2 +- spec/python/spec/test_optional_id.py | 2 +- .../spec/test_params_call_extra_parens.py | 2 +- spec/python/spec/test_params_call_short.py | 2 +- spec/python/spec/test_params_def.py | 2 +- spec/python/spec/test_params_enum.py | 2 +- .../python/spec/test_params_pass_array_int.py | 2 +- spec/python/spec/test_params_pass_array_io.py | 2 +- .../python/spec/test_params_pass_array_str.py | 2 +- .../spec/test_params_pass_array_struct.py | 2 +- .../spec/test_params_pass_array_usertype.py | 2 +- spec/python/spec/test_params_pass_bool.py | 2 +- spec/python/spec/test_params_pass_io.py | 2 +- spec/python/spec/test_params_pass_struct.py | 2 +- spec/python/spec/test_params_pass_usertype.py | 2 +- spec/python/spec/test_position_abs.py | 2 +- spec/python/spec/test_position_in_seq.py | 2 +- spec/python/spec/test_position_to_end.py | 2 +- .../spec/test_process_bytes_pad_term.py | 2 +- spec/python/spec/test_process_coerce_bytes.py | 2 +- .../python/spec/test_process_coerce_switch.py | 2 +- .../spec/test_process_coerce_usertype1.py | 2 +- .../spec/test_process_coerce_usertype2.py | 2 +- spec/python/spec/test_process_custom.py | 2 +- .../spec/test_process_custom_no_args.py | 2 +- spec/python/spec/test_process_repeat_bytes.py | 2 +- .../spec/test_process_repeat_usertype.py | 2 +- ...t_process_repeat_usertype_dynarg_custom.py | 2 +- ...t_process_repeat_usertype_dynarg_rotate.py | 2 +- ...test_process_repeat_usertype_dynarg_xor.py | 2 +- spec/python/spec/test_process_rotate.py | 2 +- .../spec/test_process_struct_pad_term.py | 2 +- spec/python/spec/test_process_term_struct.py | 2 +- spec/python/spec/test_process_to_user.py | 2 +- spec/python/spec/test_process_xor4_const.py | 2 +- spec/python/spec/test_process_xor4_value.py | 2 +- spec/python/spec/test_process_xor_const.py | 2 +- spec/python/spec/test_process_xor_value.py | 2 +- spec/python/spec/test_recursive_one.py | 2 +- spec/python/spec/test_repeat_eos_bit.py | 2 +- spec/python/spec/test_repeat_eos_bytes.py | 2 +- spec/python/spec/test_repeat_eos_bytes_pad.py | 2 +- .../spec/test_repeat_eos_bytes_pad_term.py | 2 +- spec/python/spec/test_repeat_eos_struct.py | 2 +- .../python/spec/test_repeat_eos_term_bytes.py | 2 +- .../spec/test_repeat_eos_term_struct.py | 2 +- spec/python/spec/test_repeat_eos_u4.py | 2 +- spec/python/spec/test_repeat_n_bytes.py | 2 +- spec/python/spec/test_repeat_n_bytes_pad.py | 2 +- .../spec/test_repeat_n_bytes_pad_term.py | 2 +- spec/python/spec/test_repeat_n_struct.py | 2 +- spec/python/spec/test_repeat_n_strz.py | 2 +- spec/python/spec/test_repeat_n_strz_double.py | 2 +- spec/python/spec/test_repeat_n_term_bytes.py | 2 +- spec/python/spec/test_repeat_n_term_struct.py | 2 +- spec/python/spec/test_repeat_until_bytes.py | 2 +- .../spec/test_repeat_until_bytes_pad.py | 2 +- .../spec/test_repeat_until_bytes_pad_term.py | 2 +- .../spec/test_repeat_until_calc_array_type.py | 2 +- spec/python/spec/test_repeat_until_complex.py | 2 +- spec/python/spec/test_repeat_until_s4.py | 2 +- spec/python/spec/test_repeat_until_sized.py | 2 +- .../spec/test_repeat_until_term_bytes.py | 2 +- .../spec/test_repeat_until_term_struct.py | 2 +- spec/python/spec/test_str_encodings.py | 2 +- .../python/spec/test_str_encodings_default.py | 2 +- spec/python/spec/test_str_encodings_utf16.py | 2 +- spec/python/spec/test_str_eos.py | 2 +- spec/python/spec/test_str_eos_pad_term.py | 2 +- .../spec/test_str_eos_pad_term_empty.py | 2 +- .../spec/test_str_eos_pad_term_equal.py | 2 +- spec/python/spec/test_str_literals.py | 2 +- spec/python/spec/test_str_literals2.py | 2 +- spec/python/spec/test_str_pad_term.py | 2 +- spec/python/spec/test_str_pad_term_empty.py | 2 +- spec/python/spec/test_str_pad_term_equal.py | 2 +- .../spec/test_str_pad_term_roundtrip.py | 2 +- .../spec/test_str_pad_term_zero_size.py | 2 +- spec/python/spec/test_struct_pad_term.py | 2 +- .../python/spec/test_struct_pad_term_equal.py | 2 +- spec/python/spec/test_switch_bytearray.py | 2 +- spec/python/spec/test_switch_cast.py | 2 +- spec/python/spec/test_switch_else_only.py | 2 +- spec/python/spec/test_switch_integers.py | 2 +- spec/python/spec/test_switch_integers2.py | 2 +- spec/python/spec/test_switch_manual_enum.py | 2 +- .../spec/test_switch_manual_enum_invalid.py | 2 +- .../test_switch_manual_enum_invalid_else.py | 2 +- spec/python/spec/test_switch_manual_int.py | 2 +- .../spec/test_switch_manual_int_else.py | 2 +- .../spec/test_switch_manual_int_size.py | 2 +- .../spec/test_switch_manual_int_size_else.py | 2 +- .../spec/test_switch_manual_int_size_eos.py | 2 +- spec/python/spec/test_switch_manual_str.py | 2 +- .../spec/test_switch_manual_str_else.py | 2 +- .../python/spec/test_switch_multi_bool_ops.py | 2 +- spec/python/spec/test_switch_repeat_expr.py | 2 +- .../spec/test_switch_repeat_expr_invalid.py | 2 +- spec/python/spec/test_term_bytes.py | 2 +- spec/python/spec/test_term_bytes2.py | 2 +- spec/python/spec/test_term_bytes3.py | 2 +- spec/python/spec/test_term_bytes4.py | 2 +- spec/python/spec/test_term_struct.py | 2 +- spec/python/spec/test_term_struct2.py | 2 +- spec/python/spec/test_term_struct3.py | 2 +- spec/python/spec/test_term_struct4.py | 2 +- spec/python/spec/test_term_strz.py | 2 +- spec/python/spec/test_term_strz2.py | 2 +- spec/python/spec/test_term_strz3.py | 2 +- spec/python/spec/test_term_strz4.py | 2 +- spec/python/spec/test_term_u1_val.py | 2 +- spec/python/spec/test_to_string_custom.py | 2 +- spec/python/spec/test_ts_packet_header.py | 2 +- spec/python/spec/test_type_int_unary_op.py | 2 +- spec/python/spec/test_type_ternary.py | 2 +- .../spec/test_type_ternary_2nd_falsy.py | 2 +- spec/python/spec/test_type_ternary_opaque.py | 2 +- spec/python/spec/test_user_type.py | 2 +- .../spec/test_valid_eq_str_encodings.py | 2 +- spec/python/spec/test_valid_fail_anyof_int.py | 2 +- spec/python/spec/test_valid_fail_contents.py | 2 +- spec/python/spec/test_valid_fail_eq_bytes.py | 2 +- spec/python/spec/test_valid_fail_eq_int.py | 2 +- spec/python/spec/test_valid_fail_eq_str.py | 2 +- spec/python/spec/test_valid_fail_expr.py | 2 +- spec/python/spec/test_valid_fail_inst.py | 2 +- spec/python/spec/test_valid_fail_max_int.py | 2 +- spec/python/spec/test_valid_fail_min_int.py | 2 +- .../spec/test_valid_fail_range_bytes.py | 2 +- .../spec/test_valid_fail_range_float.py | 2 +- spec/python/spec/test_valid_fail_range_int.py | 2 +- spec/python/spec/test_valid_fail_range_str.py | 2 +- spec/python/spec/test_valid_long.py | 2 +- spec/python/spec/test_valid_not_parsed_if.py | 2 +- spec/python/spec/test_valid_optional_id.py | 2 +- spec/python/spec/test_valid_short.py | 2 +- spec/python/spec/test_valid_switch.py | 2 +- spec/python/spec/test_yaml_ints.py | 2 +- spec/python/spec/test_zlib_surrounded.py | 2 +- spec/python/spec/test_zlib_with_header_78.py | 2 +- 284 files changed, 309 insertions(+), 289 deletions(-) diff --git a/build-formats b/build-formats index 33d1b4910..5f6d05d8f 100755 --- a/build-formats +++ b/build-formats @@ -1,25 +1,45 @@ -#!/bin/sh +#!/bin/sh -e . ./config rm -rf "$FORMATS_COMPILED_DIR" mkdir -p "$FORMATS_COMPILED_DIR" + "$COMPILER_DIR/jvm/target/universal/stage/bin/kaitai-struct-compiler" -- \ --verbose all -t all -d "$FORMATS_COMPILED_DIR" \ --import-path "$FORMATS_REPO_DIR" \ --import-path "$FORMATS_KSY_DIR/ks_path" \ --java-package io.kaitai.struct.testformats \ --php-namespace 'Kaitai\Struct\Tests' \ + --python-package testformats \ --go-package test_formats \ --nim-module "kaitai_struct_nim_runtime" \ --nim-opaque "../../tests/spec/nim/opaque/" \ "$FORMATS_KSY_DIR"/*.ksy || : +mv -n compiled/python compiled/python-tmp +mkdir compiled/python +mv -n compiled/python-tmp compiled/python/testformats +# __init__.py is needed in Python 2 +touch compiled/python/testformats/__init__.py + "$COMPILER_DIR/jvm/target/universal/stage/bin/kaitai-struct-compiler" -- \ - --verbose all -t java -d "$FORMATS_COMPILED_DIR/java/src" \ + --verbose file -t java -d "$FORMATS_COMPILED_DIR/java/src" \ --no-auto-read \ --read-write \ --import-path "$FORMATS_REPO_DIR" \ --import-path "$FORMATS_KSY_DIR/ks_path" \ --java-package io.kaitai.struct.testwrite \ "$FORMATS_KSY_DIR"/*.ksy || : + +"$COMPILER_DIR/jvm/target/universal/stage/bin/kaitai-struct-compiler" -- \ + --verbose file -t python -d "$FORMATS_COMPILED_DIR/python/testwrite" \ + --no-auto-read \ + --read-write \ + --import-path "$FORMATS_REPO_DIR" \ + --import-path "$FORMATS_KSY_DIR/ks_path" \ + --python-package testwrite \ + "$FORMATS_KSY_DIR"/*.ksy || : + +# __init__.py is needed in Python 2 +touch compiled/python/testwrite/__init__.py diff --git a/spec/python/spec/test_bcd_user_type_be.py b/spec/python/spec/test_bcd_user_type_be.py index 2364d1ec1..1a6f595ac 100644 --- a/spec/python/spec/test_bcd_user_type_be.py +++ b/spec/python/spec/test_bcd_user_type_be.py @@ -2,7 +2,7 @@ import unittest -from bcd_user_type_be import BcdUserTypeBe +from testformats.bcd_user_type_be import BcdUserTypeBe class TestBcdUserTypeBe(unittest.TestCase): def test_bcd_user_type_be(self): diff --git a/spec/python/spec/test_bcd_user_type_le.py b/spec/python/spec/test_bcd_user_type_le.py index eb1b96db5..87881932b 100644 --- a/spec/python/spec/test_bcd_user_type_le.py +++ b/spec/python/spec/test_bcd_user_type_le.py @@ -2,7 +2,7 @@ import unittest -from bcd_user_type_le import BcdUserTypeLe +from testformats.bcd_user_type_le import BcdUserTypeLe class TestBcdUserTypeLe(unittest.TestCase): def test_bcd_user_type_le(self): diff --git a/spec/python/spec/test_bits_byte_aligned.py b/spec/python/spec/test_bits_byte_aligned.py index 01f7ae315..268d5c9b7 100644 --- a/spec/python/spec/test_bits_byte_aligned.py +++ b/spec/python/spec/test_bits_byte_aligned.py @@ -2,7 +2,7 @@ import unittest -from bits_byte_aligned import BitsByteAligned +from testformats.bits_byte_aligned import BitsByteAligned class TestBitsByteAligned(unittest.TestCase): def test_bits_byte_aligned(self): diff --git a/spec/python/spec/test_bits_enum.py b/spec/python/spec/test_bits_enum.py index 1932db7a4..777ae2e2e 100644 --- a/spec/python/spec/test_bits_enum.py +++ b/spec/python/spec/test_bits_enum.py @@ -2,7 +2,7 @@ import unittest -from bits_enum import BitsEnum +from testformats.bits_enum import BitsEnum class TestBitsEnum(unittest.TestCase): def test_bits_enum(self): diff --git a/spec/python/spec/test_bits_seq_endian_combo.py b/spec/python/spec/test_bits_seq_endian_combo.py index 6013d29de..63d3fbd45 100644 --- a/spec/python/spec/test_bits_seq_endian_combo.py +++ b/spec/python/spec/test_bits_seq_endian_combo.py @@ -2,7 +2,7 @@ import unittest -from bits_seq_endian_combo import BitsSeqEndianCombo +from testformats.bits_seq_endian_combo import BitsSeqEndianCombo class TestBitsSeqEndianCombo(unittest.TestCase): def test_bits_seq_endian_combo(self): diff --git a/spec/python/spec/test_bits_shift_by_b32_le.py b/spec/python/spec/test_bits_shift_by_b32_le.py index beb029cf8..cea6116a0 100644 --- a/spec/python/spec/test_bits_shift_by_b32_le.py +++ b/spec/python/spec/test_bits_shift_by_b32_le.py @@ -2,7 +2,7 @@ import unittest -from bits_shift_by_b32_le import BitsShiftByB32Le +from testformats.bits_shift_by_b32_le import BitsShiftByB32Le class TestBitsShiftByB32Le(unittest.TestCase): def test_bits_shift_by_b32_le(self): diff --git a/spec/python/spec/test_bits_shift_by_b64_le.py b/spec/python/spec/test_bits_shift_by_b64_le.py index 5dd41980e..094c4108c 100644 --- a/spec/python/spec/test_bits_shift_by_b64_le.py +++ b/spec/python/spec/test_bits_shift_by_b64_le.py @@ -2,7 +2,7 @@ import unittest -from bits_shift_by_b64_le import BitsShiftByB64Le +from testformats.bits_shift_by_b64_le import BitsShiftByB64Le class TestBitsShiftByB64Le(unittest.TestCase): def test_bits_shift_by_b64_le(self): diff --git a/spec/python/spec/test_bits_signed_res_b32_be.py b/spec/python/spec/test_bits_signed_res_b32_be.py index af7bd2e79..f4f6316f0 100644 --- a/spec/python/spec/test_bits_signed_res_b32_be.py +++ b/spec/python/spec/test_bits_signed_res_b32_be.py @@ -2,7 +2,7 @@ import unittest -from bits_signed_res_b32_be import BitsSignedResB32Be +from testformats.bits_signed_res_b32_be import BitsSignedResB32Be class TestBitsSignedResB32Be(unittest.TestCase): def test_bits_signed_res_b32_be(self): diff --git a/spec/python/spec/test_bits_signed_res_b32_le.py b/spec/python/spec/test_bits_signed_res_b32_le.py index 1a0d5c82f..562407f3f 100644 --- a/spec/python/spec/test_bits_signed_res_b32_le.py +++ b/spec/python/spec/test_bits_signed_res_b32_le.py @@ -2,7 +2,7 @@ import unittest -from bits_signed_res_b32_le import BitsSignedResB32Le +from testformats.bits_signed_res_b32_le import BitsSignedResB32Le class TestBitsSignedResB32Le(unittest.TestCase): def test_bits_signed_res_b32_le(self): diff --git a/spec/python/spec/test_bits_signed_shift_b32_le.py b/spec/python/spec/test_bits_signed_shift_b32_le.py index 0a37b4d1d..c2dbda544 100644 --- a/spec/python/spec/test_bits_signed_shift_b32_le.py +++ b/spec/python/spec/test_bits_signed_shift_b32_le.py @@ -2,7 +2,7 @@ import unittest -from bits_signed_shift_b32_le import BitsSignedShiftB32Le +from testformats.bits_signed_shift_b32_le import BitsSignedShiftB32Le class TestBitsSignedShiftB32Le(unittest.TestCase): def test_bits_signed_shift_b32_le(self): diff --git a/spec/python/spec/test_bits_signed_shift_b64_le.py b/spec/python/spec/test_bits_signed_shift_b64_le.py index 4e3996f8c..39889bf4f 100644 --- a/spec/python/spec/test_bits_signed_shift_b64_le.py +++ b/spec/python/spec/test_bits_signed_shift_b64_le.py @@ -2,7 +2,7 @@ import unittest -from bits_signed_shift_b64_le import BitsSignedShiftB64Le +from testformats.bits_signed_shift_b64_le import BitsSignedShiftB64Le class TestBitsSignedShiftB64Le(unittest.TestCase): def test_bits_signed_shift_b64_le(self): diff --git a/spec/python/spec/test_bits_simple.py b/spec/python/spec/test_bits_simple.py index 6a36fc362..e0ab84e8b 100644 --- a/spec/python/spec/test_bits_simple.py +++ b/spec/python/spec/test_bits_simple.py @@ -2,7 +2,7 @@ import unittest -from bits_simple import BitsSimple +from testformats.bits_simple import BitsSimple class TestBitsSimple(unittest.TestCase): def test_bits_simple(self): diff --git a/spec/python/spec/test_bits_simple_le.py b/spec/python/spec/test_bits_simple_le.py index 903609aa1..dd4a3d655 100644 --- a/spec/python/spec/test_bits_simple_le.py +++ b/spec/python/spec/test_bits_simple_le.py @@ -2,7 +2,7 @@ import unittest -from bits_simple_le import BitsSimpleLe +from testformats.bits_simple_le import BitsSimpleLe class TestBitsSimpleLe(unittest.TestCase): def test_bits_simple_le(self): diff --git a/spec/python/spec/test_bits_unaligned_b32_be.py b/spec/python/spec/test_bits_unaligned_b32_be.py index 6d3a33abf..009942427 100644 --- a/spec/python/spec/test_bits_unaligned_b32_be.py +++ b/spec/python/spec/test_bits_unaligned_b32_be.py @@ -2,7 +2,7 @@ import unittest -from bits_unaligned_b32_be import BitsUnalignedB32Be +from testformats.bits_unaligned_b32_be import BitsUnalignedB32Be class TestBitsUnalignedB32Be(unittest.TestCase): def test_bits_unaligned_b32_be(self): diff --git a/spec/python/spec/test_bits_unaligned_b32_le.py b/spec/python/spec/test_bits_unaligned_b32_le.py index 2f7fd982e..2780451bc 100644 --- a/spec/python/spec/test_bits_unaligned_b32_le.py +++ b/spec/python/spec/test_bits_unaligned_b32_le.py @@ -2,7 +2,7 @@ import unittest -from bits_unaligned_b32_le import BitsUnalignedB32Le +from testformats.bits_unaligned_b32_le import BitsUnalignedB32Le class TestBitsUnalignedB32Le(unittest.TestCase): def test_bits_unaligned_b32_le(self): diff --git a/spec/python/spec/test_bits_unaligned_b64_be.py b/spec/python/spec/test_bits_unaligned_b64_be.py index d43dd89f5..19473a24b 100644 --- a/spec/python/spec/test_bits_unaligned_b64_be.py +++ b/spec/python/spec/test_bits_unaligned_b64_be.py @@ -2,7 +2,7 @@ import unittest -from bits_unaligned_b64_be import BitsUnalignedB64Be +from testformats.bits_unaligned_b64_be import BitsUnalignedB64Be class TestBitsUnalignedB64Be(unittest.TestCase): def test_bits_unaligned_b64_be(self): diff --git a/spec/python/spec/test_bits_unaligned_b64_le.py b/spec/python/spec/test_bits_unaligned_b64_le.py index 182c14988..5ea117ffb 100644 --- a/spec/python/spec/test_bits_unaligned_b64_le.py +++ b/spec/python/spec/test_bits_unaligned_b64_le.py @@ -2,7 +2,7 @@ import unittest -from bits_unaligned_b64_le import BitsUnalignedB64Le +from testformats.bits_unaligned_b64_le import BitsUnalignedB64Le class TestBitsUnalignedB64Le(unittest.TestCase): def test_bits_unaligned_b64_le(self): diff --git a/spec/python/spec/test_buffered_struct.py b/spec/python/spec/test_buffered_struct.py index 2933808cb..5e7fe6426 100644 --- a/spec/python/spec/test_buffered_struct.py +++ b/spec/python/spec/test_buffered_struct.py @@ -2,7 +2,7 @@ import unittest -from buffered_struct import BufferedStruct +from testformats.buffered_struct import BufferedStruct class TestBufferedStruct(unittest.TestCase): def test_buffered_struct(self): diff --git a/spec/python/spec/test_bytes_eos_pad_term.py b/spec/python/spec/test_bytes_eos_pad_term.py index 532505d43..b6a9d095c 100644 --- a/spec/python/spec/test_bytes_eos_pad_term.py +++ b/spec/python/spec/test_bytes_eos_pad_term.py @@ -2,7 +2,7 @@ import unittest -from bytes_eos_pad_term import BytesEosPadTerm +from testformats.bytes_eos_pad_term import BytesEosPadTerm class TestBytesEosPadTerm(unittest.TestCase): def test_bytes_eos_pad_term(self): diff --git a/spec/python/spec/test_bytes_pad_term.py b/spec/python/spec/test_bytes_pad_term.py index 7e6f15cd2..489b9273a 100644 --- a/spec/python/spec/test_bytes_pad_term.py +++ b/spec/python/spec/test_bytes_pad_term.py @@ -2,7 +2,7 @@ import unittest -from bytes_pad_term import BytesPadTerm +from testformats.bytes_pad_term import BytesPadTerm class TestBytesPadTerm(unittest.TestCase): def test_bytes_pad_term(self): diff --git a/spec/python/spec/test_bytes_pad_term_empty.py b/spec/python/spec/test_bytes_pad_term_empty.py index 453fd7e30..cdaa5cfc6 100644 --- a/spec/python/spec/test_bytes_pad_term_empty.py +++ b/spec/python/spec/test_bytes_pad_term_empty.py @@ -2,7 +2,7 @@ import unittest -from bytes_pad_term_empty import BytesPadTermEmpty +from testformats.bytes_pad_term_empty import BytesPadTermEmpty class TestBytesPadTermEmpty(unittest.TestCase): def test_bytes_pad_term_empty(self): diff --git a/spec/python/spec/test_bytes_pad_term_equal.py b/spec/python/spec/test_bytes_pad_term_equal.py index 9a33ac64e..eb2ef3977 100644 --- a/spec/python/spec/test_bytes_pad_term_equal.py +++ b/spec/python/spec/test_bytes_pad_term_equal.py @@ -2,7 +2,7 @@ import unittest -from bytes_pad_term_equal import BytesPadTermEqual +from testformats.bytes_pad_term_equal import BytesPadTermEqual class TestBytesPadTermEqual(unittest.TestCase): def test_bytes_pad_term_equal(self): diff --git a/spec/python/spec/test_bytes_pad_term_roundtrip.py b/spec/python/spec/test_bytes_pad_term_roundtrip.py index ed6773566..26922adeb 100644 --- a/spec/python/spec/test_bytes_pad_term_roundtrip.py +++ b/spec/python/spec/test_bytes_pad_term_roundtrip.py @@ -2,7 +2,7 @@ import unittest -from bytes_pad_term_roundtrip import BytesPadTermRoundtrip +from testformats.bytes_pad_term_roundtrip import BytesPadTermRoundtrip class TestBytesPadTermRoundtrip(unittest.TestCase): def test_bytes_pad_term_roundtrip(self): diff --git a/spec/python/spec/test_bytes_pad_term_zero_size.py b/spec/python/spec/test_bytes_pad_term_zero_size.py index cae9449cc..6a4c8e5f9 100644 --- a/spec/python/spec/test_bytes_pad_term_zero_size.py +++ b/spec/python/spec/test_bytes_pad_term_zero_size.py @@ -2,7 +2,7 @@ import unittest -from bytes_pad_term_zero_size import BytesPadTermZeroSize +from testformats.bytes_pad_term_zero_size import BytesPadTermZeroSize class TestBytesPadTermZeroSize(unittest.TestCase): def test_bytes_pad_term_zero_size(self): diff --git a/spec/python/spec/test_cast_nested.py b/spec/python/spec/test_cast_nested.py index 131e706b5..935a76a5d 100644 --- a/spec/python/spec/test_cast_nested.py +++ b/spec/python/spec/test_cast_nested.py @@ -2,7 +2,7 @@ import unittest -from cast_nested import CastNested +from testformats.cast_nested import CastNested class TestCastNested(unittest.TestCase): def test_cast_nested(self): diff --git a/spec/python/spec/test_cast_to_imported.py b/spec/python/spec/test_cast_to_imported.py index 671912b5f..797922495 100644 --- a/spec/python/spec/test_cast_to_imported.py +++ b/spec/python/spec/test_cast_to_imported.py @@ -2,7 +2,7 @@ import unittest -from cast_to_imported import CastToImported +from testformats.cast_to_imported import CastToImported class TestCastToImported(unittest.TestCase): def test_cast_to_imported(self): diff --git a/spec/python/spec/test_cast_to_top.py b/spec/python/spec/test_cast_to_top.py index 7d074781d..33fd7244d 100644 --- a/spec/python/spec/test_cast_to_top.py +++ b/spec/python/spec/test_cast_to_top.py @@ -2,7 +2,7 @@ import unittest -from cast_to_top import CastToTop +from testformats.cast_to_top import CastToTop class TestCastToTop(unittest.TestCase): def test_cast_to_top(self): diff --git a/spec/python/spec/test_combine_bool.py b/spec/python/spec/test_combine_bool.py index c49eb122b..e0c626f21 100644 --- a/spec/python/spec/test_combine_bool.py +++ b/spec/python/spec/test_combine_bool.py @@ -2,7 +2,7 @@ import unittest -from combine_bool import CombineBool +from testformats.combine_bool import CombineBool class TestCombineBool(unittest.TestCase): def test_combine_bool(self): diff --git a/spec/python/spec/test_combine_bytes.py b/spec/python/spec/test_combine_bytes.py index e8ed7d58f..0fed3eaea 100644 --- a/spec/python/spec/test_combine_bytes.py +++ b/spec/python/spec/test_combine_bytes.py @@ -2,7 +2,7 @@ import unittest -from combine_bytes import CombineBytes +from testformats.combine_bytes import CombineBytes class TestCombineBytes(unittest.TestCase): def test_combine_bytes(self): diff --git a/spec/python/spec/test_combine_enum.py b/spec/python/spec/test_combine_enum.py index b6f3255ec..a79f9d007 100644 --- a/spec/python/spec/test_combine_enum.py +++ b/spec/python/spec/test_combine_enum.py @@ -2,7 +2,7 @@ import unittest -from combine_enum import CombineEnum +from testformats.combine_enum import CombineEnum class TestCombineEnum(unittest.TestCase): def test_combine_enum(self): diff --git a/spec/python/spec/test_combine_str.py b/spec/python/spec/test_combine_str.py index 727c8a689..57e809f5d 100644 --- a/spec/python/spec/test_combine_str.py +++ b/spec/python/spec/test_combine_str.py @@ -2,7 +2,7 @@ import unittest -from combine_str import CombineStr +from testformats.combine_str import CombineStr class TestCombineStr(unittest.TestCase): def test_combine_str(self): diff --git a/spec/python/spec/test_debug_0.py b/spec/python/spec/test_debug_0.py index 6e2a96fd7..ac5de312a 100644 --- a/spec/python/spec/test_debug_0.py +++ b/spec/python/spec/test_debug_0.py @@ -1,6 +1,6 @@ import unittest -from debug_0 import Debug0 +from testformats.debug_0 import Debug0 class TestDebug0(unittest.TestCase): def test_debug_0(self): diff --git a/spec/python/spec/test_debug_array_user.py b/spec/python/spec/test_debug_array_user.py index 48a4fa7be..c249af772 100644 --- a/spec/python/spec/test_debug_array_user.py +++ b/spec/python/spec/test_debug_array_user.py @@ -1,13 +1,13 @@ import unittest -from debug_array_user import DebugArrayUser +from testformats.debug_array_user import DebugArrayUser class TestDebugArrayUser(unittest.TestCase): def test_debug_array_user(self): with DebugArrayUser.from_file('src/fixed_struct.bin') as r: - # --debug implies --no-auto-read + # --debug implies --no-auto-read r._read() - + self.assertEqual(r.one_cat.meow, 0x50) self.assertEqual(r.array_of_cats[0].meow, 0x41) self.assertEqual(r.array_of_cats[1].meow, 0x43) diff --git a/spec/python/spec/test_debug_enum_name.py b/spec/python/spec/test_debug_enum_name.py index d756951c4..8da6b9610 100644 --- a/spec/python/spec/test_debug_enum_name.py +++ b/spec/python/spec/test_debug_enum_name.py @@ -1,6 +1,6 @@ import unittest -from debug_enum_name import DebugEnumName +from testformats.debug_enum_name import DebugEnumName class TestDebugEnumName(unittest.TestCase): def test_debug_enum_name(self): diff --git a/spec/python/spec/test_debug_switch_user.py b/spec/python/spec/test_debug_switch_user.py index b5b03f5fe..a69c0a757 100644 --- a/spec/python/spec/test_debug_switch_user.py +++ b/spec/python/spec/test_debug_switch_user.py @@ -2,7 +2,7 @@ import unittest -from debug_switch_user import DebugSwitchUser +from testformats.debug_switch_user import DebugSwitchUser class TestDebugSwitchUser(unittest.TestCase): def test_debug_switch_user(self): diff --git a/spec/python/spec/test_default_big_endian.py b/spec/python/spec/test_default_big_endian.py index 04f0dbdcb..397ba8a1e 100644 --- a/spec/python/spec/test_default_big_endian.py +++ b/spec/python/spec/test_default_big_endian.py @@ -2,7 +2,7 @@ import unittest -from default_big_endian import DefaultBigEndian +from testformats.default_big_endian import DefaultBigEndian class TestDefaultBigEndian(unittest.TestCase): def test_default_big_endian(self): diff --git a/spec/python/spec/test_default_bit_endian_mod.py b/spec/python/spec/test_default_bit_endian_mod.py index be1e10981..b6308db85 100644 --- a/spec/python/spec/test_default_bit_endian_mod.py +++ b/spec/python/spec/test_default_bit_endian_mod.py @@ -2,7 +2,7 @@ import unittest -from default_bit_endian_mod import DefaultBitEndianMod +from testformats.default_bit_endian_mod import DefaultBitEndianMod class TestDefaultBitEndianMod(unittest.TestCase): def test_default_bit_endian_mod(self): diff --git a/spec/python/spec/test_default_endian_expr_exception.py b/spec/python/spec/test_default_endian_expr_exception.py index 5be2ad266..9e8f4a7ec 100644 --- a/spec/python/spec/test_default_endian_expr_exception.py +++ b/spec/python/spec/test_default_endian_expr_exception.py @@ -3,7 +3,7 @@ import unittest import kaitaistruct -from default_endian_expr_exception import DefaultEndianExprException +from testformats.default_endian_expr_exception import DefaultEndianExprException class TestDefaultEndianExprException(unittest.TestCase): def test_default_endian_expr_exception(self): diff --git a/spec/python/spec/test_default_endian_expr_inherited.py b/spec/python/spec/test_default_endian_expr_inherited.py index 01f12a53a..0bdf10a4b 100644 --- a/spec/python/spec/test_default_endian_expr_inherited.py +++ b/spec/python/spec/test_default_endian_expr_inherited.py @@ -2,7 +2,7 @@ import unittest -from default_endian_expr_inherited import DefaultEndianExprInherited +from testformats.default_endian_expr_inherited import DefaultEndianExprInherited class TestDefaultEndianExprInherited(unittest.TestCase): def test_default_endian_expr_inherited(self): diff --git a/spec/python/spec/test_default_endian_expr_is_be.py b/spec/python/spec/test_default_endian_expr_is_be.py index d75b45779..236f0f452 100644 --- a/spec/python/spec/test_default_endian_expr_is_be.py +++ b/spec/python/spec/test_default_endian_expr_is_be.py @@ -2,7 +2,7 @@ import unittest -from default_endian_expr_is_be import DefaultEndianExprIsBe +from testformats.default_endian_expr_is_be import DefaultEndianExprIsBe class TestDefaultEndianExprIsBe(unittest.TestCase): def test_default_endian_expr_is_be(self): diff --git a/spec/python/spec/test_default_endian_expr_is_le.py b/spec/python/spec/test_default_endian_expr_is_le.py index cc258985e..5d6b4f206 100644 --- a/spec/python/spec/test_default_endian_expr_is_le.py +++ b/spec/python/spec/test_default_endian_expr_is_le.py @@ -2,7 +2,7 @@ import unittest -from default_endian_expr_is_le import DefaultEndianExprIsLe +from testformats.default_endian_expr_is_le import DefaultEndianExprIsLe class TestDefaultEndianExprIsLe(unittest.TestCase): def test_default_endian_expr_is_le(self): diff --git a/spec/python/spec/test_default_endian_mod.py b/spec/python/spec/test_default_endian_mod.py index 9ca9c53f0..b30039fe9 100644 --- a/spec/python/spec/test_default_endian_mod.py +++ b/spec/python/spec/test_default_endian_mod.py @@ -2,7 +2,7 @@ import unittest -from default_endian_mod import DefaultEndianMod +from testformats.default_endian_mod import DefaultEndianMod class TestDefaultEndianMod(unittest.TestCase): def test_default_endian_mod(self): diff --git a/spec/python/spec/test_docstrings.py b/spec/python/spec/test_docstrings.py index 8db31f2e3..27f7074d3 100644 --- a/spec/python/spec/test_docstrings.py +++ b/spec/python/spec/test_docstrings.py @@ -2,7 +2,7 @@ import unittest -from docstrings import Docstrings +from testformats.docstrings import Docstrings class TestDocstrings(unittest.TestCase): def test_docstrings(self): diff --git a/spec/python/spec/test_docstrings_docref.py b/spec/python/spec/test_docstrings_docref.py index 7d15be182..c1dfd93a6 100644 --- a/spec/python/spec/test_docstrings_docref.py +++ b/spec/python/spec/test_docstrings_docref.py @@ -2,7 +2,7 @@ import unittest -from docstrings_docref import DocstringsDocref +from testformats.docstrings_docref import DocstringsDocref class TestDocstringsDocref(unittest.TestCase): def test_docstrings_docref(self): diff --git a/spec/python/spec/test_docstrings_docref_multi.py b/spec/python/spec/test_docstrings_docref_multi.py index 41b760a56..ea108c51c 100644 --- a/spec/python/spec/test_docstrings_docref_multi.py +++ b/spec/python/spec/test_docstrings_docref_multi.py @@ -2,7 +2,7 @@ import unittest -from docstrings_docref_multi import DocstringsDocrefMulti +from testformats.docstrings_docref_multi import DocstringsDocrefMulti class TestDocstringsDocrefMulti(unittest.TestCase): def test_docstrings_docref_multi(self): diff --git a/spec/python/spec/test_enum_0.py b/spec/python/spec/test_enum_0.py index 37c2fb40e..0c3c7ae4a 100644 --- a/spec/python/spec/test_enum_0.py +++ b/spec/python/spec/test_enum_0.py @@ -2,7 +2,7 @@ import unittest -from enum_0 import Enum0 +from testformats.enum_0 import Enum0 class TestEnum0(unittest.TestCase): def test_enum_0(self): diff --git a/spec/python/spec/test_enum_1.py b/spec/python/spec/test_enum_1.py index a2b23a2e1..1fc00a5aa 100644 --- a/spec/python/spec/test_enum_1.py +++ b/spec/python/spec/test_enum_1.py @@ -2,7 +2,7 @@ import unittest -from enum_1 import Enum1 +from testformats.enum_1 import Enum1 class TestEnum1(unittest.TestCase): def test_enum_1(self): diff --git a/spec/python/spec/test_enum_deep.py b/spec/python/spec/test_enum_deep.py index 4d615e41e..9cdf1aae1 100644 --- a/spec/python/spec/test_enum_deep.py +++ b/spec/python/spec/test_enum_deep.py @@ -2,7 +2,7 @@ import unittest -from enum_deep import EnumDeep +from testformats.enum_deep import EnumDeep class TestEnumDeep(unittest.TestCase): def test_enum_deep(self): diff --git a/spec/python/spec/test_enum_deep_literals.py b/spec/python/spec/test_enum_deep_literals.py index 75329c516..4b0e8bb2e 100644 --- a/spec/python/spec/test_enum_deep_literals.py +++ b/spec/python/spec/test_enum_deep_literals.py @@ -2,7 +2,7 @@ import unittest -from enum_deep_literals import EnumDeepLiterals +from testformats.enum_deep_literals import EnumDeepLiterals class TestEnumDeepLiterals(unittest.TestCase): def test_enum_deep_literals(self): diff --git a/spec/python/spec/test_enum_fancy.py b/spec/python/spec/test_enum_fancy.py index 32010c31b..a901c3921 100644 --- a/spec/python/spec/test_enum_fancy.py +++ b/spec/python/spec/test_enum_fancy.py @@ -2,7 +2,7 @@ import unittest -from enum_fancy import EnumFancy +from testformats.enum_fancy import EnumFancy class TestEnumFancy(unittest.TestCase): def test_enum_fancy(self): diff --git a/spec/python/spec/test_enum_for_unknown_id.py b/spec/python/spec/test_enum_for_unknown_id.py index 243ab246a..1883aa9a9 100644 --- a/spec/python/spec/test_enum_for_unknown_id.py +++ b/spec/python/spec/test_enum_for_unknown_id.py @@ -2,7 +2,7 @@ import unittest -from enum_for_unknown_id import EnumForUnknownId +from testformats.enum_for_unknown_id import EnumForUnknownId class TestEnumForUnknownId(unittest.TestCase): def test_enum_for_unknown_id(self): diff --git a/spec/python/spec/test_enum_if.py b/spec/python/spec/test_enum_if.py index 6b9e7e44d..3e556c308 100644 --- a/spec/python/spec/test_enum_if.py +++ b/spec/python/spec/test_enum_if.py @@ -2,7 +2,7 @@ import unittest -from enum_if import EnumIf +from testformats.enum_if import EnumIf class TestEnumIf(unittest.TestCase): def test_enum_if(self): diff --git a/spec/python/spec/test_enum_import.py b/spec/python/spec/test_enum_import.py index 50ee377ea..56e1d6b51 100644 --- a/spec/python/spec/test_enum_import.py +++ b/spec/python/spec/test_enum_import.py @@ -1,8 +1,8 @@ import unittest -from enum_import import EnumImport -from enum_0 import Enum0 -from enum_deep import EnumDeep +from testformats.enum_import import EnumImport +from testformats.enum_0 import Enum0 +from testformats.enum_deep import EnumDeep class TestEnumImport(unittest.TestCase): def test_enum_import(self): diff --git a/spec/python/spec/test_enum_int_range_s.py b/spec/python/spec/test_enum_int_range_s.py index f8cc32df4..97a040c73 100644 --- a/spec/python/spec/test_enum_int_range_s.py +++ b/spec/python/spec/test_enum_int_range_s.py @@ -2,7 +2,7 @@ import unittest -from enum_int_range_s import EnumIntRangeS +from testformats.enum_int_range_s import EnumIntRangeS class TestEnumIntRangeS(unittest.TestCase): def test_enum_int_range_s(self): diff --git a/spec/python/spec/test_enum_int_range_u.py b/spec/python/spec/test_enum_int_range_u.py index 3370fef89..b1ea250ec 100644 --- a/spec/python/spec/test_enum_int_range_u.py +++ b/spec/python/spec/test_enum_int_range_u.py @@ -2,7 +2,7 @@ import unittest -from enum_int_range_u import EnumIntRangeU +from testformats.enum_int_range_u import EnumIntRangeU class TestEnumIntRangeU(unittest.TestCase): def test_enum_int_range_u(self): diff --git a/spec/python/spec/test_enum_invalid.py b/spec/python/spec/test_enum_invalid.py index 8f1e9f618..7dddde8d0 100644 --- a/spec/python/spec/test_enum_invalid.py +++ b/spec/python/spec/test_enum_invalid.py @@ -2,7 +2,7 @@ import unittest -from enum_invalid import EnumInvalid +from testformats.enum_invalid import EnumInvalid class TestEnumInvalid(unittest.TestCase): def test_enum_invalid(self): diff --git a/spec/python/spec/test_enum_long_range_s.py b/spec/python/spec/test_enum_long_range_s.py index 9ed02e53b..e13fbcb31 100644 --- a/spec/python/spec/test_enum_long_range_s.py +++ b/spec/python/spec/test_enum_long_range_s.py @@ -2,7 +2,7 @@ import unittest -from enum_long_range_s import EnumLongRangeS +from testformats.enum_long_range_s import EnumLongRangeS class TestEnumLongRangeS(unittest.TestCase): def test_enum_long_range_s(self): diff --git a/spec/python/spec/test_enum_long_range_u.py b/spec/python/spec/test_enum_long_range_u.py index a2145a7d3..1da1cdd52 100644 --- a/spec/python/spec/test_enum_long_range_u.py +++ b/spec/python/spec/test_enum_long_range_u.py @@ -2,7 +2,7 @@ import unittest -from enum_long_range_u import EnumLongRangeU +from testformats.enum_long_range_u import EnumLongRangeU class TestEnumLongRangeU(unittest.TestCase): def test_enum_long_range_u(self): diff --git a/spec/python/spec/test_enum_negative.py b/spec/python/spec/test_enum_negative.py index f9aa2dd92..b6b551b43 100644 --- a/spec/python/spec/test_enum_negative.py +++ b/spec/python/spec/test_enum_negative.py @@ -2,7 +2,7 @@ import unittest -from enum_negative import EnumNegative +from testformats.enum_negative import EnumNegative class TestEnumNegative(unittest.TestCase): def test_enum_negative(self): diff --git a/spec/python/spec/test_enum_of_value_inst.py b/spec/python/spec/test_enum_of_value_inst.py index db4670be1..9da0ffbee 100644 --- a/spec/python/spec/test_enum_of_value_inst.py +++ b/spec/python/spec/test_enum_of_value_inst.py @@ -2,7 +2,7 @@ import unittest -from enum_of_value_inst import EnumOfValueInst +from testformats.enum_of_value_inst import EnumOfValueInst class TestEnumOfValueInst(unittest.TestCase): def test_enum_of_value_inst(self): diff --git a/spec/python/spec/test_enum_to_i.py b/spec/python/spec/test_enum_to_i.py index c68b77e3a..7fc5831f3 100644 --- a/spec/python/spec/test_enum_to_i.py +++ b/spec/python/spec/test_enum_to_i.py @@ -2,7 +2,7 @@ import unittest -from enum_to_i import EnumToI +from testformats.enum_to_i import EnumToI class TestEnumToI(unittest.TestCase): def test_enum_to_i(self): diff --git a/spec/python/spec/test_enum_to_i_class_border_1.py b/spec/python/spec/test_enum_to_i_class_border_1.py index 224bff858..62583fb6f 100644 --- a/spec/python/spec/test_enum_to_i_class_border_1.py +++ b/spec/python/spec/test_enum_to_i_class_border_1.py @@ -2,7 +2,7 @@ import unittest -from enum_to_i_class_border_1 import EnumToIClassBorder1 +from testformats.enum_to_i_class_border_1 import EnumToIClassBorder1 class TestEnumToIClassBorder1(unittest.TestCase): def test_enum_to_i_class_border_1(self): diff --git a/spec/python/spec/test_eof_exception_bytes.py b/spec/python/spec/test_eof_exception_bytes.py index 6ba7ed6ff..722f4804e 100644 --- a/spec/python/spec/test_eof_exception_bytes.py +++ b/spec/python/spec/test_eof_exception_bytes.py @@ -3,7 +3,7 @@ import unittest import kaitaistruct -from eof_exception_bytes import EofExceptionBytes +from testformats.eof_exception_bytes import EofExceptionBytes class TestEofExceptionBytes(unittest.TestCase): def test_eof_exception_bytes(self): diff --git a/spec/python/spec/test_eof_exception_u4.py b/spec/python/spec/test_eof_exception_u4.py index 8e31094ef..85e1bb3f7 100644 --- a/spec/python/spec/test_eof_exception_u4.py +++ b/spec/python/spec/test_eof_exception_u4.py @@ -3,7 +3,7 @@ import unittest import kaitaistruct -from eof_exception_u4 import EofExceptionU4 +from testformats.eof_exception_u4 import EofExceptionU4 class TestEofExceptionU4(unittest.TestCase): def test_eof_exception_u4(self): diff --git a/spec/python/spec/test_eos_exception_bytes.py b/spec/python/spec/test_eos_exception_bytes.py index a258245a8..c93f8d7c6 100644 --- a/spec/python/spec/test_eos_exception_bytes.py +++ b/spec/python/spec/test_eos_exception_bytes.py @@ -3,7 +3,7 @@ import unittest import kaitaistruct -from eos_exception_bytes import EosExceptionBytes +from testformats.eos_exception_bytes import EosExceptionBytes class TestEosExceptionBytes(unittest.TestCase): def test_eos_exception_bytes(self): diff --git a/spec/python/spec/test_eos_exception_u4.py b/spec/python/spec/test_eos_exception_u4.py index 1ee7ab91f..0da8cf14b 100644 --- a/spec/python/spec/test_eos_exception_u4.py +++ b/spec/python/spec/test_eos_exception_u4.py @@ -3,7 +3,7 @@ import unittest import kaitaistruct -from eos_exception_u4 import EosExceptionU4 +from testformats.eos_exception_u4 import EosExceptionU4 class TestEosExceptionU4(unittest.TestCase): def test_eos_exception_u4(self): diff --git a/spec/python/spec/test_expr_0.py b/spec/python/spec/test_expr_0.py index ccc99cfb2..e39c0aa97 100644 --- a/spec/python/spec/test_expr_0.py +++ b/spec/python/spec/test_expr_0.py @@ -2,7 +2,7 @@ import unittest -from expr_0 import Expr0 +from testformats.expr_0 import Expr0 class TestExpr0(unittest.TestCase): def test_expr_0(self): diff --git a/spec/python/spec/test_expr_1.py b/spec/python/spec/test_expr_1.py index bad55d35e..43b6bdd03 100644 --- a/spec/python/spec/test_expr_1.py +++ b/spec/python/spec/test_expr_1.py @@ -2,7 +2,7 @@ import unittest -from expr_1 import Expr1 +from testformats.expr_1 import Expr1 class TestExpr1(unittest.TestCase): def test_expr_1(self): diff --git a/spec/python/spec/test_expr_2.py b/spec/python/spec/test_expr_2.py index 392b352e9..4307baac0 100644 --- a/spec/python/spec/test_expr_2.py +++ b/spec/python/spec/test_expr_2.py @@ -2,7 +2,7 @@ import unittest -from expr_2 import Expr2 +from testformats.expr_2 import Expr2 class TestExpr2(unittest.TestCase): def test_expr_2(self): diff --git a/spec/python/spec/test_expr_3.py b/spec/python/spec/test_expr_3.py index 61fd1dbe3..8a44769d4 100644 --- a/spec/python/spec/test_expr_3.py +++ b/spec/python/spec/test_expr_3.py @@ -2,7 +2,7 @@ import unittest -from expr_3 import Expr3 +from testformats.expr_3 import Expr3 class TestExpr3(unittest.TestCase): def test_expr_3(self): diff --git a/spec/python/spec/test_expr_array.py b/spec/python/spec/test_expr_array.py index 1c393ab78..1877abe0f 100644 --- a/spec/python/spec/test_expr_array.py +++ b/spec/python/spec/test_expr_array.py @@ -1,6 +1,6 @@ import unittest -from expr_array import ExprArray +from testformats.expr_array import ExprArray class TestExprArray(unittest.TestCase): def test_expr_array(self): diff --git a/spec/python/spec/test_expr_bits.py b/spec/python/spec/test_expr_bits.py index 42ad46543..508c8ced7 100644 --- a/spec/python/spec/test_expr_bits.py +++ b/spec/python/spec/test_expr_bits.py @@ -2,7 +2,7 @@ import unittest -from expr_bits import ExprBits +from testformats.expr_bits import ExprBits class TestExprBits(unittest.TestCase): def test_expr_bits(self): diff --git a/spec/python/spec/test_expr_bytes_cmp.py b/spec/python/spec/test_expr_bytes_cmp.py index b319e4efe..40ed129ce 100644 --- a/spec/python/spec/test_expr_bytes_cmp.py +++ b/spec/python/spec/test_expr_bytes_cmp.py @@ -2,7 +2,7 @@ import unittest -from expr_bytes_cmp import ExprBytesCmp +from testformats.expr_bytes_cmp import ExprBytesCmp class TestExprBytesCmp(unittest.TestCase): def test_expr_bytes_cmp(self): diff --git a/spec/python/spec/test_expr_bytes_non_literal.py b/spec/python/spec/test_expr_bytes_non_literal.py index 52f8f66ca..5496e36e4 100644 --- a/spec/python/spec/test_expr_bytes_non_literal.py +++ b/spec/python/spec/test_expr_bytes_non_literal.py @@ -2,7 +2,7 @@ import unittest -from expr_bytes_non_literal import ExprBytesNonLiteral +from testformats.expr_bytes_non_literal import ExprBytesNonLiteral class TestExprBytesNonLiteral(unittest.TestCase): def test_expr_bytes_non_literal(self): diff --git a/spec/python/spec/test_expr_bytes_ops.py b/spec/python/spec/test_expr_bytes_ops.py index 7f3bf75fe..09def118b 100644 --- a/spec/python/spec/test_expr_bytes_ops.py +++ b/spec/python/spec/test_expr_bytes_ops.py @@ -2,7 +2,7 @@ import unittest -from expr_bytes_ops import ExprBytesOps +from testformats.expr_bytes_ops import ExprBytesOps class TestExprBytesOps(unittest.TestCase): def test_expr_bytes_ops(self): diff --git a/spec/python/spec/test_expr_calc_array_ops.py b/spec/python/spec/test_expr_calc_array_ops.py index 191ad7931..1f137ce8d 100644 --- a/spec/python/spec/test_expr_calc_array_ops.py +++ b/spec/python/spec/test_expr_calc_array_ops.py @@ -2,7 +2,7 @@ import unittest -from expr_calc_array_ops import ExprCalcArrayOps +from testformats.expr_calc_array_ops import ExprCalcArrayOps class TestExprCalcArrayOps(unittest.TestCase): def test_expr_calc_array_ops(self): diff --git a/spec/python/spec/test_expr_enum.py b/spec/python/spec/test_expr_enum.py index f04536e76..cf69dae9d 100644 --- a/spec/python/spec/test_expr_enum.py +++ b/spec/python/spec/test_expr_enum.py @@ -2,7 +2,7 @@ import unittest -from expr_enum import ExprEnum +from testformats.expr_enum import ExprEnum class TestExprEnum(unittest.TestCase): def test_expr_enum(self): diff --git a/spec/python/spec/test_expr_if_int_eq.py b/spec/python/spec/test_expr_if_int_eq.py index 708e85f1b..015690829 100644 --- a/spec/python/spec/test_expr_if_int_eq.py +++ b/spec/python/spec/test_expr_if_int_eq.py @@ -2,7 +2,7 @@ import unittest -from expr_if_int_eq import ExprIfIntEq +from testformats.expr_if_int_eq import ExprIfIntEq class TestExprIfIntEq(unittest.TestCase): def test_expr_if_int_eq(self): diff --git a/spec/python/spec/test_expr_if_int_ops.py b/spec/python/spec/test_expr_if_int_ops.py index 4a23d162e..ab276bcba 100644 --- a/spec/python/spec/test_expr_if_int_ops.py +++ b/spec/python/spec/test_expr_if_int_ops.py @@ -2,7 +2,7 @@ import unittest -from expr_if_int_ops import ExprIfIntOps +from testformats.expr_if_int_ops import ExprIfIntOps class TestExprIfIntOps(unittest.TestCase): def test_expr_if_int_ops(self): diff --git a/spec/python/spec/test_expr_int_div.py b/spec/python/spec/test_expr_int_div.py index 9c9af43ac..c2bca0e7e 100644 --- a/spec/python/spec/test_expr_int_div.py +++ b/spec/python/spec/test_expr_int_div.py @@ -2,7 +2,7 @@ import unittest -from expr_int_div import ExprIntDiv +from testformats.expr_int_div import ExprIntDiv class TestExprIntDiv(unittest.TestCase): def test_expr_int_div(self): diff --git a/spec/python/spec/test_expr_io_eof.py b/spec/python/spec/test_expr_io_eof.py index d0b21787d..25a5be546 100644 --- a/spec/python/spec/test_expr_io_eof.py +++ b/spec/python/spec/test_expr_io_eof.py @@ -1,6 +1,6 @@ import unittest -from expr_io_eof import ExprIoEof +from testformats.expr_io_eof import ExprIoEof class TestExprIoEof(unittest.TestCase): def test_expr_io_eof(self): diff --git a/spec/python/spec/test_expr_io_pos.py b/spec/python/spec/test_expr_io_pos.py index 1c9c92e24..dd797b83b 100644 --- a/spec/python/spec/test_expr_io_pos.py +++ b/spec/python/spec/test_expr_io_pos.py @@ -2,7 +2,7 @@ import unittest -from expr_io_pos import ExprIoPos +from testformats.expr_io_pos import ExprIoPos class TestExprIoPos(unittest.TestCase): def test_expr_io_pos(self): diff --git a/spec/python/spec/test_expr_mod.py b/spec/python/spec/test_expr_mod.py index b5f9869e8..37f586601 100644 --- a/spec/python/spec/test_expr_mod.py +++ b/spec/python/spec/test_expr_mod.py @@ -2,7 +2,7 @@ import unittest -from expr_mod import ExprMod +from testformats.expr_mod import ExprMod class TestExprMod(unittest.TestCase): def test_expr_mod(self): diff --git a/spec/python/spec/test_expr_ops_parens.py b/spec/python/spec/test_expr_ops_parens.py index 392f8a961..6a4ca90e1 100644 --- a/spec/python/spec/test_expr_ops_parens.py +++ b/spec/python/spec/test_expr_ops_parens.py @@ -2,7 +2,7 @@ import unittest -from expr_ops_parens import ExprOpsParens +from testformats.expr_ops_parens import ExprOpsParens class TestExprOpsParens(unittest.TestCase): def test_expr_ops_parens(self): diff --git a/spec/python/spec/test_expr_sizeof_type_0.py b/spec/python/spec/test_expr_sizeof_type_0.py index 4241a82fc..ed2395729 100644 --- a/spec/python/spec/test_expr_sizeof_type_0.py +++ b/spec/python/spec/test_expr_sizeof_type_0.py @@ -2,7 +2,7 @@ import unittest -from expr_sizeof_type_0 import ExprSizeofType0 +from testformats.expr_sizeof_type_0 import ExprSizeofType0 class TestExprSizeofType0(unittest.TestCase): def test_expr_sizeof_type_0(self): diff --git a/spec/python/spec/test_expr_sizeof_type_1.py b/spec/python/spec/test_expr_sizeof_type_1.py index d1b0fdfb3..f7089c81d 100644 --- a/spec/python/spec/test_expr_sizeof_type_1.py +++ b/spec/python/spec/test_expr_sizeof_type_1.py @@ -2,7 +2,7 @@ import unittest -from expr_sizeof_type_1 import ExprSizeofType1 +from testformats.expr_sizeof_type_1 import ExprSizeofType1 class TestExprSizeofType1(unittest.TestCase): def test_expr_sizeof_type_1(self): diff --git a/spec/python/spec/test_expr_sizeof_value_0.py b/spec/python/spec/test_expr_sizeof_value_0.py index 2e37cae8c..053e392d3 100644 --- a/spec/python/spec/test_expr_sizeof_value_0.py +++ b/spec/python/spec/test_expr_sizeof_value_0.py @@ -2,7 +2,7 @@ import unittest -from expr_sizeof_value_0 import ExprSizeofValue0 +from testformats.expr_sizeof_value_0 import ExprSizeofValue0 class TestExprSizeofValue0(unittest.TestCase): def test_expr_sizeof_value_0(self): diff --git a/spec/python/spec/test_expr_sizeof_value_sized.py b/spec/python/spec/test_expr_sizeof_value_sized.py index 073fd9d59..4e22ff942 100644 --- a/spec/python/spec/test_expr_sizeof_value_sized.py +++ b/spec/python/spec/test_expr_sizeof_value_sized.py @@ -2,7 +2,7 @@ import unittest -from expr_sizeof_value_sized import ExprSizeofValueSized +from testformats.expr_sizeof_value_sized import ExprSizeofValueSized class TestExprSizeofValueSized(unittest.TestCase): def test_expr_sizeof_value_sized(self): diff --git a/spec/python/spec/test_expr_str_encodings.py b/spec/python/spec/test_expr_str_encodings.py index 15f629434..74bf0c606 100644 --- a/spec/python/spec/test_expr_str_encodings.py +++ b/spec/python/spec/test_expr_str_encodings.py @@ -2,7 +2,7 @@ import unittest -from expr_str_encodings import ExprStrEncodings +from testformats.expr_str_encodings import ExprStrEncodings class TestExprStrEncodings(unittest.TestCase): def test_expr_str_encodings(self): diff --git a/spec/python/spec/test_expr_str_ops.py b/spec/python/spec/test_expr_str_ops.py index a07ed5bee..5bb75f9cc 100644 --- a/spec/python/spec/test_expr_str_ops.py +++ b/spec/python/spec/test_expr_str_ops.py @@ -2,7 +2,7 @@ import unittest -from expr_str_ops import ExprStrOps +from testformats.expr_str_ops import ExprStrOps class TestExprStrOps(unittest.TestCase): def test_expr_str_ops(self): diff --git a/spec/python/spec/test_fixed_contents.py b/spec/python/spec/test_fixed_contents.py index af55bf84c..f01c5fb34 100644 --- a/spec/python/spec/test_fixed_contents.py +++ b/spec/python/spec/test_fixed_contents.py @@ -2,7 +2,7 @@ import unittest -from fixed_contents import FixedContents +from testformats.fixed_contents import FixedContents class TestFixedContents(unittest.TestCase): def test_fixed_contents(self): diff --git a/spec/python/spec/test_fixed_struct.py b/spec/python/spec/test_fixed_struct.py index 2768402a6..2f93e5ea9 100644 --- a/spec/python/spec/test_fixed_struct.py +++ b/spec/python/spec/test_fixed_struct.py @@ -2,7 +2,7 @@ import unittest -from fixed_struct import FixedStruct +from testformats.fixed_struct import FixedStruct class TestFixedStruct(unittest.TestCase): def test_fixed_struct(self): diff --git a/spec/python/spec/test_float_to_i.py b/spec/python/spec/test_float_to_i.py index 6fdd1aa4f..a74cff35b 100644 --- a/spec/python/spec/test_float_to_i.py +++ b/spec/python/spec/test_float_to_i.py @@ -2,7 +2,7 @@ import unittest -from float_to_i import FloatToI +from testformats.float_to_i import FloatToI class TestFloatToI(unittest.TestCase): def test_float_to_i(self): diff --git a/spec/python/spec/test_floating_points.py b/spec/python/spec/test_floating_points.py index 2ee584818..0b57c2843 100644 --- a/spec/python/spec/test_floating_points.py +++ b/spec/python/spec/test_floating_points.py @@ -2,7 +2,7 @@ import unittest -from floating_points import FloatingPoints +from testformats.floating_points import FloatingPoints class TestFloatingPoints(unittest.TestCase): def test_floating_points(self): diff --git a/spec/python/spec/test_hello_world.py b/spec/python/spec/test_hello_world.py index 4ca9bcfb3..5b3820f77 100644 --- a/spec/python/spec/test_hello_world.py +++ b/spec/python/spec/test_hello_world.py @@ -2,7 +2,7 @@ import unittest -from hello_world import HelloWorld +from testformats.hello_world import HelloWorld class TestHelloWorld(unittest.TestCase): def test_hello_world(self): diff --git a/spec/python/spec/test_if_instances.py b/spec/python/spec/test_if_instances.py index ce3eba909..18b099d2e 100644 --- a/spec/python/spec/test_if_instances.py +++ b/spec/python/spec/test_if_instances.py @@ -2,7 +2,7 @@ import unittest -from if_instances import IfInstances +from testformats.if_instances import IfInstances class TestIfInstances(unittest.TestCase): def test_if_instances(self): diff --git a/spec/python/spec/test_if_struct.py b/spec/python/spec/test_if_struct.py index 6b7e868b1..c768453d6 100644 --- a/spec/python/spec/test_if_struct.py +++ b/spec/python/spec/test_if_struct.py @@ -2,7 +2,7 @@ import unittest -from if_struct import IfStruct +from testformats.if_struct import IfStruct class TestIfStruct(unittest.TestCase): def test_if_struct(self): diff --git a/spec/python/spec/test_if_values.py b/spec/python/spec/test_if_values.py index 595393302..70d78feea 100644 --- a/spec/python/spec/test_if_values.py +++ b/spec/python/spec/test_if_values.py @@ -2,7 +2,7 @@ import unittest -from if_values import IfValues +from testformats.if_values import IfValues class TestIfValues(unittest.TestCase): def test_if_values(self): diff --git a/spec/python/spec/test_imports0.py b/spec/python/spec/test_imports0.py index 4a5b1071e..871064834 100644 --- a/spec/python/spec/test_imports0.py +++ b/spec/python/spec/test_imports0.py @@ -2,7 +2,7 @@ import unittest -from imports0 import Imports0 +from testformats.imports0 import Imports0 class TestImports0(unittest.TestCase): def test_imports0(self): diff --git a/spec/python/spec/test_imports_abs.py b/spec/python/spec/test_imports_abs.py index ab177e00b..36c0aa48b 100644 --- a/spec/python/spec/test_imports_abs.py +++ b/spec/python/spec/test_imports_abs.py @@ -2,7 +2,7 @@ import unittest -from imports_abs import ImportsAbs +from testformats.imports_abs import ImportsAbs class TestImportsAbs(unittest.TestCase): def test_imports_abs(self): diff --git a/spec/python/spec/test_imports_abs_abs.py b/spec/python/spec/test_imports_abs_abs.py index 691235130..560dc9dd4 100644 --- a/spec/python/spec/test_imports_abs_abs.py +++ b/spec/python/spec/test_imports_abs_abs.py @@ -1,6 +1,6 @@ import unittest -from imports_abs_abs import ImportsAbsAbs +from testformats.imports_abs_abs import ImportsAbsAbs class TestImportsAbsAbs(unittest.TestCase): def test_imports_abs_abs(self): diff --git a/spec/python/spec/test_imports_abs_rel.py b/spec/python/spec/test_imports_abs_rel.py index 19228c1fb..f51dd5467 100644 --- a/spec/python/spec/test_imports_abs_rel.py +++ b/spec/python/spec/test_imports_abs_rel.py @@ -1,6 +1,6 @@ import unittest -from imports_abs_rel import ImportsAbsRel +from testformats.imports_abs_rel import ImportsAbsRel class TestImportsAbsRel(unittest.TestCase): def test_imports_abs_rel(self): diff --git a/spec/python/spec/test_imports_circular_a.py b/spec/python/spec/test_imports_circular_a.py index ff4e83084..8ad22975c 100644 --- a/spec/python/spec/test_imports_circular_a.py +++ b/spec/python/spec/test_imports_circular_a.py @@ -2,7 +2,7 @@ import unittest -from imports_circular_a import ImportsCircularA +from testformats.imports_circular_a import ImportsCircularA class TestImportsCircularA(unittest.TestCase): def test_imports_circular_a(self): diff --git a/spec/python/spec/test_imports_rel_1.py b/spec/python/spec/test_imports_rel_1.py index 947a92a50..7559cb490 100644 --- a/spec/python/spec/test_imports_rel_1.py +++ b/spec/python/spec/test_imports_rel_1.py @@ -2,7 +2,7 @@ import unittest -from imports_rel_1 import ImportsRel1 +from testformats.imports_rel_1 import ImportsRel1 class TestImportsRel1(unittest.TestCase): def test_imports_rel_1(self): diff --git a/spec/python/spec/test_index_sizes.py b/spec/python/spec/test_index_sizes.py index 2754a6364..912967097 100644 --- a/spec/python/spec/test_index_sizes.py +++ b/spec/python/spec/test_index_sizes.py @@ -2,7 +2,7 @@ import unittest -from index_sizes import IndexSizes +from testformats.index_sizes import IndexSizes class TestIndexSizes(unittest.TestCase): def test_index_sizes(self): diff --git a/spec/python/spec/test_index_to_param_eos.py b/spec/python/spec/test_index_to_param_eos.py index 201199794..fa29b7777 100644 --- a/spec/python/spec/test_index_to_param_eos.py +++ b/spec/python/spec/test_index_to_param_eos.py @@ -2,7 +2,7 @@ import unittest -from index_to_param_eos import IndexToParamEos +from testformats.index_to_param_eos import IndexToParamEos class TestIndexToParamEos(unittest.TestCase): def test_index_to_param_eos(self): diff --git a/spec/python/spec/test_index_to_param_expr.py b/spec/python/spec/test_index_to_param_expr.py index 17eaf1449..f87ab77fc 100644 --- a/spec/python/spec/test_index_to_param_expr.py +++ b/spec/python/spec/test_index_to_param_expr.py @@ -2,7 +2,7 @@ import unittest -from index_to_param_expr import IndexToParamExpr +from testformats.index_to_param_expr import IndexToParamExpr class TestIndexToParamExpr(unittest.TestCase): def test_index_to_param_expr(self): diff --git a/spec/python/spec/test_index_to_param_until.py b/spec/python/spec/test_index_to_param_until.py index 01f0d9878..4935f2719 100644 --- a/spec/python/spec/test_index_to_param_until.py +++ b/spec/python/spec/test_index_to_param_until.py @@ -2,7 +2,7 @@ import unittest -from index_to_param_until import IndexToParamUntil +from testformats.index_to_param_until import IndexToParamUntil class TestIndexToParamUntil(unittest.TestCase): def test_index_to_param_until(self): diff --git a/spec/python/spec/test_instance_in_repeat_expr.py b/spec/python/spec/test_instance_in_repeat_expr.py index 5064e1344..38d9b4f39 100644 --- a/spec/python/spec/test_instance_in_repeat_expr.py +++ b/spec/python/spec/test_instance_in_repeat_expr.py @@ -2,7 +2,7 @@ import unittest -from instance_in_repeat_expr import InstanceInRepeatExpr +from testformats.instance_in_repeat_expr import InstanceInRepeatExpr class TestInstanceInRepeatExpr(unittest.TestCase): def test_instance_in_repeat_expr(self): diff --git a/spec/python/spec/test_instance_in_repeat_until.py b/spec/python/spec/test_instance_in_repeat_until.py index 149b07cfc..5acf9729d 100644 --- a/spec/python/spec/test_instance_in_repeat_until.py +++ b/spec/python/spec/test_instance_in_repeat_until.py @@ -2,7 +2,7 @@ import unittest -from instance_in_repeat_until import InstanceInRepeatUntil +from testformats.instance_in_repeat_until import InstanceInRepeatUntil class TestInstanceInRepeatUntil(unittest.TestCase): def test_instance_in_repeat_until(self): diff --git a/spec/python/spec/test_instance_in_sized.py b/spec/python/spec/test_instance_in_sized.py index 16456a314..99e5c751a 100644 --- a/spec/python/spec/test_instance_in_sized.py +++ b/spec/python/spec/test_instance_in_sized.py @@ -2,7 +2,7 @@ import unittest -from instance_in_sized import InstanceInSized +from testformats.instance_in_sized import InstanceInSized class TestInstanceInSized(unittest.TestCase): def test_instance_in_sized(self): diff --git a/spec/python/spec/test_instance_io_user.py b/spec/python/spec/test_instance_io_user.py index 68d4af0e8..85b5a2037 100644 --- a/spec/python/spec/test_instance_io_user.py +++ b/spec/python/spec/test_instance_io_user.py @@ -2,7 +2,7 @@ import unittest -from instance_io_user import InstanceIoUser +from testformats.instance_io_user import InstanceIoUser class TestInstanceIoUser(unittest.TestCase): def test_instance_io_user(self): diff --git a/spec/python/spec/test_instance_io_user_earlier.py b/spec/python/spec/test_instance_io_user_earlier.py index fcc54d8f4..f3e8b8704 100644 --- a/spec/python/spec/test_instance_io_user_earlier.py +++ b/spec/python/spec/test_instance_io_user_earlier.py @@ -2,7 +2,7 @@ import unittest -from instance_io_user_earlier import InstanceIoUserEarlier +from testformats.instance_io_user_earlier import InstanceIoUserEarlier class TestInstanceIoUserEarlier(unittest.TestCase): def test_instance_io_user_earlier(self): diff --git a/spec/python/spec/test_instance_std.py b/spec/python/spec/test_instance_std.py index 5d2cf2ac0..092e4819e 100644 --- a/spec/python/spec/test_instance_std.py +++ b/spec/python/spec/test_instance_std.py @@ -2,7 +2,7 @@ import unittest -from instance_std import InstanceStd +from testformats.instance_std import InstanceStd class TestInstanceStd(unittest.TestCase): def test_instance_std(self): diff --git a/spec/python/spec/test_instance_std_array.py b/spec/python/spec/test_instance_std_array.py index ecbc6147b..5913dca1d 100644 --- a/spec/python/spec/test_instance_std_array.py +++ b/spec/python/spec/test_instance_std_array.py @@ -2,7 +2,7 @@ import unittest -from instance_std_array import InstanceStdArray +from testformats.instance_std_array import InstanceStdArray class TestInstanceStdArray(unittest.TestCase): def test_instance_std_array(self): diff --git a/spec/python/spec/test_instance_user_array.py b/spec/python/spec/test_instance_user_array.py index 487d40a0e..6c6522b8b 100644 --- a/spec/python/spec/test_instance_user_array.py +++ b/spec/python/spec/test_instance_user_array.py @@ -2,7 +2,7 @@ import unittest -from instance_user_array import InstanceUserArray +from testformats.instance_user_array import InstanceUserArray class TestInstanceUserArray(unittest.TestCase): def test_instance_user_array(self): diff --git a/spec/python/spec/test_integers.py b/spec/python/spec/test_integers.py index a3ae8771c..353794417 100644 --- a/spec/python/spec/test_integers.py +++ b/spec/python/spec/test_integers.py @@ -2,7 +2,7 @@ import unittest -from integers import Integers +from testformats.integers import Integers class TestIntegers(unittest.TestCase): def test_integers(self): diff --git a/spec/python/spec/test_integers_double_overflow.py b/spec/python/spec/test_integers_double_overflow.py index a6b334fe3..199af3657 100644 --- a/spec/python/spec/test_integers_double_overflow.py +++ b/spec/python/spec/test_integers_double_overflow.py @@ -2,7 +2,7 @@ import unittest -from integers_double_overflow import IntegersDoubleOverflow +from testformats.integers_double_overflow import IntegersDoubleOverflow class TestIntegersDoubleOverflow(unittest.TestCase): def test_integers_double_overflow(self): diff --git a/spec/python/spec/test_integers_min_max.py b/spec/python/spec/test_integers_min_max.py index 8a67d840a..2d2df9fdd 100644 --- a/spec/python/spec/test_integers_min_max.py +++ b/spec/python/spec/test_integers_min_max.py @@ -2,7 +2,7 @@ import unittest -from integers_min_max import IntegersMinMax +from testformats.integers_min_max import IntegersMinMax class TestIntegersMinMax(unittest.TestCase): def test_integers_min_max(self): diff --git a/spec/python/spec/test_io_local_var.py b/spec/python/spec/test_io_local_var.py index 4ac10f093..a1882e39e 100644 --- a/spec/python/spec/test_io_local_var.py +++ b/spec/python/spec/test_io_local_var.py @@ -2,7 +2,7 @@ import unittest -from io_local_var import IoLocalVar +from testformats.io_local_var import IoLocalVar class TestIoLocalVar(unittest.TestCase): def test_io_local_var(self): diff --git a/spec/python/spec/test_js_signed_right_shift.py b/spec/python/spec/test_js_signed_right_shift.py index b20c406d1..dac9f522b 100644 --- a/spec/python/spec/test_js_signed_right_shift.py +++ b/spec/python/spec/test_js_signed_right_shift.py @@ -2,7 +2,7 @@ import unittest -from js_signed_right_shift import JsSignedRightShift +from testformats.js_signed_right_shift import JsSignedRightShift class TestJsSignedRightShift(unittest.TestCase): def test_js_signed_right_shift(self): diff --git a/spec/python/spec/test_meta_tags.py b/spec/python/spec/test_meta_tags.py index bf417bb03..1165d8af1 100644 --- a/spec/python/spec/test_meta_tags.py +++ b/spec/python/spec/test_meta_tags.py @@ -2,7 +2,7 @@ import unittest -from meta_tags import MetaTags +from testformats.meta_tags import MetaTags class TestMetaTags(unittest.TestCase): def test_meta_tags(self): diff --git a/spec/python/spec/test_meta_xref.py b/spec/python/spec/test_meta_xref.py index f0f0d7b07..0fb0ab146 100644 --- a/spec/python/spec/test_meta_xref.py +++ b/spec/python/spec/test_meta_xref.py @@ -2,7 +2,7 @@ import unittest -from meta_xref import MetaXref +from testformats.meta_xref import MetaXref class TestMetaXref(unittest.TestCase): def test_meta_xref(self): diff --git a/spec/python/spec/test_multiple_use.py b/spec/python/spec/test_multiple_use.py index 8e85b2607..c3d74c11d 100644 --- a/spec/python/spec/test_multiple_use.py +++ b/spec/python/spec/test_multiple_use.py @@ -2,7 +2,7 @@ import unittest -from multiple_use import MultipleUse +from testformats.multiple_use import MultipleUse class TestMultipleUse(unittest.TestCase): def test_multiple_use(self): diff --git a/spec/python/spec/test_nav_parent.py b/spec/python/spec/test_nav_parent.py index 154f5651d..60dc70e7f 100644 --- a/spec/python/spec/test_nav_parent.py +++ b/spec/python/spec/test_nav_parent.py @@ -2,7 +2,7 @@ import unittest -from nav_parent import NavParent +from testformats.nav_parent import NavParent class TestNavParent(unittest.TestCase): def test_nav_parent(self): diff --git a/spec/python/spec/test_nav_parent2.py b/spec/python/spec/test_nav_parent2.py index 5d1786e8a..1b6d10adb 100644 --- a/spec/python/spec/test_nav_parent2.py +++ b/spec/python/spec/test_nav_parent2.py @@ -2,7 +2,7 @@ import unittest -from nav_parent2 import NavParent2 +from testformats.nav_parent2 import NavParent2 class TestNavParent2(unittest.TestCase): def test_nav_parent2(self): diff --git a/spec/python/spec/test_nav_parent3.py b/spec/python/spec/test_nav_parent3.py index 3f0eeae66..6971b0fbb 100644 --- a/spec/python/spec/test_nav_parent3.py +++ b/spec/python/spec/test_nav_parent3.py @@ -2,7 +2,7 @@ import unittest -from nav_parent3 import NavParent3 +from testformats.nav_parent3 import NavParent3 class TestNavParent3(unittest.TestCase): def test_nav_parent3(self): diff --git a/spec/python/spec/test_nav_parent_false.py b/spec/python/spec/test_nav_parent_false.py index 174a851fb..7ce38b313 100644 --- a/spec/python/spec/test_nav_parent_false.py +++ b/spec/python/spec/test_nav_parent_false.py @@ -2,7 +2,7 @@ import unittest -from nav_parent_false import NavParentFalse +from testformats.nav_parent_false import NavParentFalse class TestNavParentFalse(unittest.TestCase): def test_nav_parent_false(self): diff --git a/spec/python/spec/test_nav_parent_false2.py b/spec/python/spec/test_nav_parent_false2.py index 7c39970d9..dd28d1a43 100644 --- a/spec/python/spec/test_nav_parent_false2.py +++ b/spec/python/spec/test_nav_parent_false2.py @@ -2,7 +2,7 @@ import unittest -from nav_parent_false2 import NavParentFalse2 +from testformats.nav_parent_false2 import NavParentFalse2 class TestNavParentFalse2(unittest.TestCase): def test_nav_parent_false2(self): diff --git a/spec/python/spec/test_nav_parent_override.py b/spec/python/spec/test_nav_parent_override.py index 39dd0b976..afa4d2875 100644 --- a/spec/python/spec/test_nav_parent_override.py +++ b/spec/python/spec/test_nav_parent_override.py @@ -2,7 +2,7 @@ import unittest -from nav_parent_override import NavParentOverride +from testformats.nav_parent_override import NavParentOverride class TestNavParentOverride(unittest.TestCase): def test_nav_parent_override(self): diff --git a/spec/python/spec/test_nav_parent_switch.py b/spec/python/spec/test_nav_parent_switch.py index d5b9aeb05..aa45c8129 100644 --- a/spec/python/spec/test_nav_parent_switch.py +++ b/spec/python/spec/test_nav_parent_switch.py @@ -2,7 +2,7 @@ import unittest -from nav_parent_switch import NavParentSwitch +from testformats.nav_parent_switch import NavParentSwitch class TestNavParentSwitch(unittest.TestCase): def test_nav_parent_switch(self): diff --git a/spec/python/spec/test_nav_parent_switch_cast.py b/spec/python/spec/test_nav_parent_switch_cast.py index a7fbbe89c..5816cde20 100644 --- a/spec/python/spec/test_nav_parent_switch_cast.py +++ b/spec/python/spec/test_nav_parent_switch_cast.py @@ -2,7 +2,7 @@ import unittest -from nav_parent_switch_cast import NavParentSwitchCast +from testformats.nav_parent_switch_cast import NavParentSwitchCast class TestNavParentSwitchCast(unittest.TestCase): def test_nav_parent_switch_cast(self): diff --git a/spec/python/spec/test_nav_parent_vs_value_inst.py b/spec/python/spec/test_nav_parent_vs_value_inst.py index 1d9c108d8..acf4d9f6d 100644 --- a/spec/python/spec/test_nav_parent_vs_value_inst.py +++ b/spec/python/spec/test_nav_parent_vs_value_inst.py @@ -2,7 +2,7 @@ import unittest -from nav_parent_vs_value_inst import NavParentVsValueInst +from testformats.nav_parent_vs_value_inst import NavParentVsValueInst class TestNavParentVsValueInst(unittest.TestCase): def test_nav_parent_vs_value_inst(self): diff --git a/spec/python/spec/test_nav_root.py b/spec/python/spec/test_nav_root.py index ce94816f6..3e2ddc9a9 100644 --- a/spec/python/spec/test_nav_root.py +++ b/spec/python/spec/test_nav_root.py @@ -2,7 +2,7 @@ import unittest -from nav_root import NavRoot +from testformats.nav_root import NavRoot class TestNavRoot(unittest.TestCase): def test_nav_root(self): diff --git a/spec/python/spec/test_nested_same_name.py b/spec/python/spec/test_nested_same_name.py index 324f8495e..82911af88 100644 --- a/spec/python/spec/test_nested_same_name.py +++ b/spec/python/spec/test_nested_same_name.py @@ -2,7 +2,7 @@ import unittest -from nested_same_name import NestedSameName +from testformats.nested_same_name import NestedSameName class TestNestedSameName(unittest.TestCase): def test_nested_same_name(self): diff --git a/spec/python/spec/test_nested_same_name2.py b/spec/python/spec/test_nested_same_name2.py index bc00cf192..5e1d369ec 100644 --- a/spec/python/spec/test_nested_same_name2.py +++ b/spec/python/spec/test_nested_same_name2.py @@ -2,7 +2,7 @@ import unittest -from nested_same_name2 import NestedSameName2 +from testformats.nested_same_name2 import NestedSameName2 class TestNestedSameName2(unittest.TestCase): def test_nested_same_name2(self): diff --git a/spec/python/spec/test_nested_type_param.py b/spec/python/spec/test_nested_type_param.py index aeb50e72a..a9fbdd7db 100644 --- a/spec/python/spec/test_nested_type_param.py +++ b/spec/python/spec/test_nested_type_param.py @@ -2,7 +2,7 @@ import unittest -from nested_type_param import NestedTypeParam +from testformats.nested_type_param import NestedTypeParam class TestNestedTypeParam(unittest.TestCase): def test_nested_type_param(self): diff --git a/spec/python/spec/test_nested_types.py b/spec/python/spec/test_nested_types.py index fc1e77f8d..a8245b1cd 100644 --- a/spec/python/spec/test_nested_types.py +++ b/spec/python/spec/test_nested_types.py @@ -2,7 +2,7 @@ import unittest -from nested_types import NestedTypes +from testformats.nested_types import NestedTypes class TestNestedTypes(unittest.TestCase): def test_nested_types(self): diff --git a/spec/python/spec/test_nested_types2.py b/spec/python/spec/test_nested_types2.py index b48f6d869..1186ad702 100644 --- a/spec/python/spec/test_nested_types2.py +++ b/spec/python/spec/test_nested_types2.py @@ -2,7 +2,7 @@ import unittest -from nested_types2 import NestedTypes2 +from testformats.nested_types2 import NestedTypes2 class TestNestedTypes2(unittest.TestCase): def test_nested_types2(self): diff --git a/spec/python/spec/test_nested_types3.py b/spec/python/spec/test_nested_types3.py index b1151ea3b..57d4b729f 100644 --- a/spec/python/spec/test_nested_types3.py +++ b/spec/python/spec/test_nested_types3.py @@ -2,7 +2,7 @@ import unittest -from nested_types3 import NestedTypes3 +from testformats.nested_types3 import NestedTypes3 class TestNestedTypes3(unittest.TestCase): def test_nested_types3(self): diff --git a/spec/python/spec/test_non_standard.py b/spec/python/spec/test_non_standard.py index e59165b88..290f35384 100644 --- a/spec/python/spec/test_non_standard.py +++ b/spec/python/spec/test_non_standard.py @@ -2,7 +2,7 @@ import unittest -from non_standard import NonStandard +from testformats.non_standard import NonStandard class TestNonStandard(unittest.TestCase): def test_non_standard(self): diff --git a/spec/python/spec/test_opaque_external_type.py b/spec/python/spec/test_opaque_external_type.py index 92cead9d2..aaaf549da 100644 --- a/spec/python/spec/test_opaque_external_type.py +++ b/spec/python/spec/test_opaque_external_type.py @@ -2,7 +2,7 @@ import unittest -from opaque_external_type import OpaqueExternalType +from testformats.opaque_external_type import OpaqueExternalType class TestOpaqueExternalType(unittest.TestCase): def test_opaque_external_type(self): diff --git a/spec/python/spec/test_opaque_external_type_02_parent.py b/spec/python/spec/test_opaque_external_type_02_parent.py index 339ce9c94..82611c64a 100644 --- a/spec/python/spec/test_opaque_external_type_02_parent.py +++ b/spec/python/spec/test_opaque_external_type_02_parent.py @@ -1,6 +1,6 @@ import unittest -from opaque_external_type_02_parent import OpaqueExternalType02Parent +from testformats.opaque_external_type_02_parent import OpaqueExternalType02Parent class TestOpaqueExternalType02Parent(unittest.TestCase): def test_opaque_external_type_02_parent(self): diff --git a/spec/python/spec/test_opaque_with_param.py b/spec/python/spec/test_opaque_with_param.py index 622829668..75d245e52 100644 --- a/spec/python/spec/test_opaque_with_param.py +++ b/spec/python/spec/test_opaque_with_param.py @@ -1,6 +1,6 @@ import unittest -from opaque_with_param import OpaqueWithParam +from testformats.opaque_with_param import OpaqueWithParam class TestOpaqueWithParam(unittest.TestCase): def test_opaque_with_param(self): diff --git a/spec/python/spec/test_optional_id.py b/spec/python/spec/test_optional_id.py index edad828c8..b52a08cc9 100644 --- a/spec/python/spec/test_optional_id.py +++ b/spec/python/spec/test_optional_id.py @@ -1,6 +1,6 @@ import unittest -from optional_id import OptionalId +from testformats.optional_id import OptionalId class TestOptionalId(unittest.TestCase): def test_optional_id(self): diff --git a/spec/python/spec/test_params_call_extra_parens.py b/spec/python/spec/test_params_call_extra_parens.py index 5035e7de4..60ae8a166 100644 --- a/spec/python/spec/test_params_call_extra_parens.py +++ b/spec/python/spec/test_params_call_extra_parens.py @@ -2,7 +2,7 @@ import unittest -from params_call_extra_parens import ParamsCallExtraParens +from testformats.params_call_extra_parens import ParamsCallExtraParens class TestParamsCallExtraParens(unittest.TestCase): def test_params_call_extra_parens(self): diff --git a/spec/python/spec/test_params_call_short.py b/spec/python/spec/test_params_call_short.py index dba30e894..4abf985fa 100644 --- a/spec/python/spec/test_params_call_short.py +++ b/spec/python/spec/test_params_call_short.py @@ -2,7 +2,7 @@ import unittest -from params_call_short import ParamsCallShort +from testformats.params_call_short import ParamsCallShort class TestParamsCallShort(unittest.TestCase): def test_params_call_short(self): diff --git a/spec/python/spec/test_params_def.py b/spec/python/spec/test_params_def.py index 471546efa..4f21cb573 100644 --- a/spec/python/spec/test_params_def.py +++ b/spec/python/spec/test_params_def.py @@ -1,6 +1,6 @@ import unittest -from params_def import ParamsDef +from testformats.params_def import ParamsDef from kaitaistruct import KaitaiStream class TestParamsDef(unittest.TestCase): diff --git a/spec/python/spec/test_params_enum.py b/spec/python/spec/test_params_enum.py index ed0a6d530..bef46e88c 100644 --- a/spec/python/spec/test_params_enum.py +++ b/spec/python/spec/test_params_enum.py @@ -2,7 +2,7 @@ import unittest -from params_enum import ParamsEnum +from testformats.params_enum import ParamsEnum class TestParamsEnum(unittest.TestCase): def test_params_enum(self): diff --git a/spec/python/spec/test_params_pass_array_int.py b/spec/python/spec/test_params_pass_array_int.py index 4b86d23e4..3eaad8702 100644 --- a/spec/python/spec/test_params_pass_array_int.py +++ b/spec/python/spec/test_params_pass_array_int.py @@ -2,7 +2,7 @@ import unittest -from params_pass_array_int import ParamsPassArrayInt +from testformats.params_pass_array_int import ParamsPassArrayInt class TestParamsPassArrayInt(unittest.TestCase): def test_params_pass_array_int(self): diff --git a/spec/python/spec/test_params_pass_array_io.py b/spec/python/spec/test_params_pass_array_io.py index 84debc19d..63e3db9a5 100644 --- a/spec/python/spec/test_params_pass_array_io.py +++ b/spec/python/spec/test_params_pass_array_io.py @@ -2,7 +2,7 @@ import unittest -from params_pass_array_io import ParamsPassArrayIo +from testformats.params_pass_array_io import ParamsPassArrayIo class TestParamsPassArrayIo(unittest.TestCase): def test_params_pass_array_io(self): diff --git a/spec/python/spec/test_params_pass_array_str.py b/spec/python/spec/test_params_pass_array_str.py index f5bc09ea6..4c4fbeac7 100644 --- a/spec/python/spec/test_params_pass_array_str.py +++ b/spec/python/spec/test_params_pass_array_str.py @@ -2,7 +2,7 @@ import unittest -from params_pass_array_str import ParamsPassArrayStr +from testformats.params_pass_array_str import ParamsPassArrayStr class TestParamsPassArrayStr(unittest.TestCase): def test_params_pass_array_str(self): diff --git a/spec/python/spec/test_params_pass_array_struct.py b/spec/python/spec/test_params_pass_array_struct.py index af03e8b26..e7b6de84f 100644 --- a/spec/python/spec/test_params_pass_array_struct.py +++ b/spec/python/spec/test_params_pass_array_struct.py @@ -2,7 +2,7 @@ import unittest -from params_pass_array_struct import ParamsPassArrayStruct +from testformats.params_pass_array_struct import ParamsPassArrayStruct class TestParamsPassArrayStruct(unittest.TestCase): def test_params_pass_array_struct(self): diff --git a/spec/python/spec/test_params_pass_array_usertype.py b/spec/python/spec/test_params_pass_array_usertype.py index f2e438d0e..a7cd3efdb 100644 --- a/spec/python/spec/test_params_pass_array_usertype.py +++ b/spec/python/spec/test_params_pass_array_usertype.py @@ -2,7 +2,7 @@ import unittest -from params_pass_array_usertype import ParamsPassArrayUsertype +from testformats.params_pass_array_usertype import ParamsPassArrayUsertype class TestParamsPassArrayUsertype(unittest.TestCase): def test_params_pass_array_usertype(self): diff --git a/spec/python/spec/test_params_pass_bool.py b/spec/python/spec/test_params_pass_bool.py index ecd35ed9a..bc7fed258 100644 --- a/spec/python/spec/test_params_pass_bool.py +++ b/spec/python/spec/test_params_pass_bool.py @@ -2,7 +2,7 @@ import unittest -from params_pass_bool import ParamsPassBool +from testformats.params_pass_bool import ParamsPassBool class TestParamsPassBool(unittest.TestCase): def test_params_pass_bool(self): diff --git a/spec/python/spec/test_params_pass_io.py b/spec/python/spec/test_params_pass_io.py index 36161c777..833060a30 100644 --- a/spec/python/spec/test_params_pass_io.py +++ b/spec/python/spec/test_params_pass_io.py @@ -2,7 +2,7 @@ import unittest -from params_pass_io import ParamsPassIo +from testformats.params_pass_io import ParamsPassIo class TestParamsPassIo(unittest.TestCase): def test_params_pass_io(self): diff --git a/spec/python/spec/test_params_pass_struct.py b/spec/python/spec/test_params_pass_struct.py index fdede070d..8121d53c8 100644 --- a/spec/python/spec/test_params_pass_struct.py +++ b/spec/python/spec/test_params_pass_struct.py @@ -2,7 +2,7 @@ import unittest -from params_pass_struct import ParamsPassStruct +from testformats.params_pass_struct import ParamsPassStruct class TestParamsPassStruct(unittest.TestCase): def test_params_pass_struct(self): diff --git a/spec/python/spec/test_params_pass_usertype.py b/spec/python/spec/test_params_pass_usertype.py index 569670ed6..9847619ff 100644 --- a/spec/python/spec/test_params_pass_usertype.py +++ b/spec/python/spec/test_params_pass_usertype.py @@ -2,7 +2,7 @@ import unittest -from params_pass_usertype import ParamsPassUsertype +from testformats.params_pass_usertype import ParamsPassUsertype class TestParamsPassUsertype(unittest.TestCase): def test_params_pass_usertype(self): diff --git a/spec/python/spec/test_position_abs.py b/spec/python/spec/test_position_abs.py index df88e37f4..8bcc46c50 100644 --- a/spec/python/spec/test_position_abs.py +++ b/spec/python/spec/test_position_abs.py @@ -2,7 +2,7 @@ import unittest -from position_abs import PositionAbs +from testformats.position_abs import PositionAbs class TestPositionAbs(unittest.TestCase): def test_position_abs(self): diff --git a/spec/python/spec/test_position_in_seq.py b/spec/python/spec/test_position_in_seq.py index 9490beea9..f2bcebaf0 100644 --- a/spec/python/spec/test_position_in_seq.py +++ b/spec/python/spec/test_position_in_seq.py @@ -2,7 +2,7 @@ import unittest -from position_in_seq import PositionInSeq +from testformats.position_in_seq import PositionInSeq class TestPositionInSeq(unittest.TestCase): def test_position_in_seq(self): diff --git a/spec/python/spec/test_position_to_end.py b/spec/python/spec/test_position_to_end.py index f95bafb0a..e8a0690ef 100644 --- a/spec/python/spec/test_position_to_end.py +++ b/spec/python/spec/test_position_to_end.py @@ -2,7 +2,7 @@ import unittest -from position_to_end import PositionToEnd +from testformats.position_to_end import PositionToEnd class TestPositionToEnd(unittest.TestCase): def test_position_to_end(self): diff --git a/spec/python/spec/test_process_bytes_pad_term.py b/spec/python/spec/test_process_bytes_pad_term.py index 9d7b3d248..6e244e1a7 100644 --- a/spec/python/spec/test_process_bytes_pad_term.py +++ b/spec/python/spec/test_process_bytes_pad_term.py @@ -2,7 +2,7 @@ import unittest -from process_bytes_pad_term import ProcessBytesPadTerm +from testformats.process_bytes_pad_term import ProcessBytesPadTerm class TestProcessBytesPadTerm(unittest.TestCase): def test_process_bytes_pad_term(self): diff --git a/spec/python/spec/test_process_coerce_bytes.py b/spec/python/spec/test_process_coerce_bytes.py index 8b4d8ad59..69f93f834 100644 --- a/spec/python/spec/test_process_coerce_bytes.py +++ b/spec/python/spec/test_process_coerce_bytes.py @@ -2,7 +2,7 @@ import unittest -from process_coerce_bytes import ProcessCoerceBytes +from testformats.process_coerce_bytes import ProcessCoerceBytes class TestProcessCoerceBytes(unittest.TestCase): def test_process_coerce_bytes(self): diff --git a/spec/python/spec/test_process_coerce_switch.py b/spec/python/spec/test_process_coerce_switch.py index 3015bd31b..712994e9b 100644 --- a/spec/python/spec/test_process_coerce_switch.py +++ b/spec/python/spec/test_process_coerce_switch.py @@ -2,7 +2,7 @@ import unittest -from process_coerce_switch import ProcessCoerceSwitch +from testformats.process_coerce_switch import ProcessCoerceSwitch class TestProcessCoerceSwitch(unittest.TestCase): def test_process_coerce_switch(self): diff --git a/spec/python/spec/test_process_coerce_usertype1.py b/spec/python/spec/test_process_coerce_usertype1.py index 6511fe351..912b3d1e3 100644 --- a/spec/python/spec/test_process_coerce_usertype1.py +++ b/spec/python/spec/test_process_coerce_usertype1.py @@ -2,7 +2,7 @@ import unittest -from process_coerce_usertype1 import ProcessCoerceUsertype1 +from testformats.process_coerce_usertype1 import ProcessCoerceUsertype1 class TestProcessCoerceUsertype1(unittest.TestCase): def test_process_coerce_usertype1(self): diff --git a/spec/python/spec/test_process_coerce_usertype2.py b/spec/python/spec/test_process_coerce_usertype2.py index 18d6be68a..4c5dd2c8d 100644 --- a/spec/python/spec/test_process_coerce_usertype2.py +++ b/spec/python/spec/test_process_coerce_usertype2.py @@ -2,7 +2,7 @@ import unittest -from process_coerce_usertype2 import ProcessCoerceUsertype2 +from testformats.process_coerce_usertype2 import ProcessCoerceUsertype2 class TestProcessCoerceUsertype2(unittest.TestCase): def test_process_coerce_usertype2(self): diff --git a/spec/python/spec/test_process_custom.py b/spec/python/spec/test_process_custom.py index 1d229c1a2..76ed19f76 100644 --- a/spec/python/spec/test_process_custom.py +++ b/spec/python/spec/test_process_custom.py @@ -2,7 +2,7 @@ import unittest -from process_custom import ProcessCustom +from testformats.process_custom import ProcessCustom class TestProcessCustom(unittest.TestCase): def test_process_custom(self): diff --git a/spec/python/spec/test_process_custom_no_args.py b/spec/python/spec/test_process_custom_no_args.py index d710f34a3..ccce1af25 100644 --- a/spec/python/spec/test_process_custom_no_args.py +++ b/spec/python/spec/test_process_custom_no_args.py @@ -2,7 +2,7 @@ import unittest -from process_custom_no_args import ProcessCustomNoArgs +from testformats.process_custom_no_args import ProcessCustomNoArgs class TestProcessCustomNoArgs(unittest.TestCase): def test_process_custom_no_args(self): diff --git a/spec/python/spec/test_process_repeat_bytes.py b/spec/python/spec/test_process_repeat_bytes.py index 6c299444f..9b20bfc0a 100644 --- a/spec/python/spec/test_process_repeat_bytes.py +++ b/spec/python/spec/test_process_repeat_bytes.py @@ -2,7 +2,7 @@ import unittest -from process_repeat_bytes import ProcessRepeatBytes +from testformats.process_repeat_bytes import ProcessRepeatBytes class TestProcessRepeatBytes(unittest.TestCase): def test_process_repeat_bytes(self): diff --git a/spec/python/spec/test_process_repeat_usertype.py b/spec/python/spec/test_process_repeat_usertype.py index 6f0e6501a..945d07a5a 100644 --- a/spec/python/spec/test_process_repeat_usertype.py +++ b/spec/python/spec/test_process_repeat_usertype.py @@ -2,7 +2,7 @@ import unittest -from process_repeat_usertype import ProcessRepeatUsertype +from testformats.process_repeat_usertype import ProcessRepeatUsertype class TestProcessRepeatUsertype(unittest.TestCase): def test_process_repeat_usertype(self): diff --git a/spec/python/spec/test_process_repeat_usertype_dynarg_custom.py b/spec/python/spec/test_process_repeat_usertype_dynarg_custom.py index 7de04d7d3..56907bff6 100644 --- a/spec/python/spec/test_process_repeat_usertype_dynarg_custom.py +++ b/spec/python/spec/test_process_repeat_usertype_dynarg_custom.py @@ -2,7 +2,7 @@ import unittest -from process_repeat_usertype_dynarg_custom import ProcessRepeatUsertypeDynargCustom +from testformats.process_repeat_usertype_dynarg_custom import ProcessRepeatUsertypeDynargCustom class TestProcessRepeatUsertypeDynargCustom(unittest.TestCase): def test_process_repeat_usertype_dynarg_custom(self): diff --git a/spec/python/spec/test_process_repeat_usertype_dynarg_rotate.py b/spec/python/spec/test_process_repeat_usertype_dynarg_rotate.py index 75c3bf995..8f0b8d717 100644 --- a/spec/python/spec/test_process_repeat_usertype_dynarg_rotate.py +++ b/spec/python/spec/test_process_repeat_usertype_dynarg_rotate.py @@ -2,7 +2,7 @@ import unittest -from process_repeat_usertype_dynarg_rotate import ProcessRepeatUsertypeDynargRotate +from testformats.process_repeat_usertype_dynarg_rotate import ProcessRepeatUsertypeDynargRotate class TestProcessRepeatUsertypeDynargRotate(unittest.TestCase): def test_process_repeat_usertype_dynarg_rotate(self): diff --git a/spec/python/spec/test_process_repeat_usertype_dynarg_xor.py b/spec/python/spec/test_process_repeat_usertype_dynarg_xor.py index 3576f4926..85ef6aa6b 100644 --- a/spec/python/spec/test_process_repeat_usertype_dynarg_xor.py +++ b/spec/python/spec/test_process_repeat_usertype_dynarg_xor.py @@ -2,7 +2,7 @@ import unittest -from process_repeat_usertype_dynarg_xor import ProcessRepeatUsertypeDynargXor +from testformats.process_repeat_usertype_dynarg_xor import ProcessRepeatUsertypeDynargXor class TestProcessRepeatUsertypeDynargXor(unittest.TestCase): def test_process_repeat_usertype_dynarg_xor(self): diff --git a/spec/python/spec/test_process_rotate.py b/spec/python/spec/test_process_rotate.py index da8f1ba30..0fae9c79f 100644 --- a/spec/python/spec/test_process_rotate.py +++ b/spec/python/spec/test_process_rotate.py @@ -2,7 +2,7 @@ import unittest -from process_rotate import ProcessRotate +from testformats.process_rotate import ProcessRotate class TestProcessRotate(unittest.TestCase): def test_process_rotate(self): diff --git a/spec/python/spec/test_process_struct_pad_term.py b/spec/python/spec/test_process_struct_pad_term.py index c8c8d9334..fbc057060 100644 --- a/spec/python/spec/test_process_struct_pad_term.py +++ b/spec/python/spec/test_process_struct_pad_term.py @@ -2,7 +2,7 @@ import unittest -from process_struct_pad_term import ProcessStructPadTerm +from testformats.process_struct_pad_term import ProcessStructPadTerm class TestProcessStructPadTerm(unittest.TestCase): def test_process_struct_pad_term(self): diff --git a/spec/python/spec/test_process_term_struct.py b/spec/python/spec/test_process_term_struct.py index 59823b99d..39cd2365c 100644 --- a/spec/python/spec/test_process_term_struct.py +++ b/spec/python/spec/test_process_term_struct.py @@ -2,7 +2,7 @@ import unittest -from process_term_struct import ProcessTermStruct +from testformats.process_term_struct import ProcessTermStruct class TestProcessTermStruct(unittest.TestCase): def test_process_term_struct(self): diff --git a/spec/python/spec/test_process_to_user.py b/spec/python/spec/test_process_to_user.py index eb6a8ed9b..377c82f5d 100644 --- a/spec/python/spec/test_process_to_user.py +++ b/spec/python/spec/test_process_to_user.py @@ -2,7 +2,7 @@ import unittest -from process_to_user import ProcessToUser +from testformats.process_to_user import ProcessToUser class TestProcessToUser(unittest.TestCase): def test_process_to_user(self): diff --git a/spec/python/spec/test_process_xor4_const.py b/spec/python/spec/test_process_xor4_const.py index 2981c5383..ee374bac1 100644 --- a/spec/python/spec/test_process_xor4_const.py +++ b/spec/python/spec/test_process_xor4_const.py @@ -2,7 +2,7 @@ import unittest -from process_xor4_const import ProcessXor4Const +from testformats.process_xor4_const import ProcessXor4Const class TestProcessXor4Const(unittest.TestCase): def test_process_xor4_const(self): diff --git a/spec/python/spec/test_process_xor4_value.py b/spec/python/spec/test_process_xor4_value.py index 2fb4971fe..88be3ef92 100644 --- a/spec/python/spec/test_process_xor4_value.py +++ b/spec/python/spec/test_process_xor4_value.py @@ -2,7 +2,7 @@ import unittest -from process_xor4_value import ProcessXor4Value +from testformats.process_xor4_value import ProcessXor4Value class TestProcessXor4Value(unittest.TestCase): def test_process_xor4_value(self): diff --git a/spec/python/spec/test_process_xor_const.py b/spec/python/spec/test_process_xor_const.py index fdb22b5b8..7a13c3fbd 100644 --- a/spec/python/spec/test_process_xor_const.py +++ b/spec/python/spec/test_process_xor_const.py @@ -2,7 +2,7 @@ import unittest -from process_xor_const import ProcessXorConst +from testformats.process_xor_const import ProcessXorConst class TestProcessXorConst(unittest.TestCase): def test_process_xor_const(self): diff --git a/spec/python/spec/test_process_xor_value.py b/spec/python/spec/test_process_xor_value.py index f1aa2a7e5..42e16b1ca 100644 --- a/spec/python/spec/test_process_xor_value.py +++ b/spec/python/spec/test_process_xor_value.py @@ -2,7 +2,7 @@ import unittest -from process_xor_value import ProcessXorValue +from testformats.process_xor_value import ProcessXorValue class TestProcessXorValue(unittest.TestCase): def test_process_xor_value(self): diff --git a/spec/python/spec/test_recursive_one.py b/spec/python/spec/test_recursive_one.py index 30ce73da6..66073c8c0 100644 --- a/spec/python/spec/test_recursive_one.py +++ b/spec/python/spec/test_recursive_one.py @@ -2,7 +2,7 @@ import unittest -from recursive_one import RecursiveOne +from testformats.recursive_one import RecursiveOne class TestRecursiveOne(unittest.TestCase): def test_recursive_one(self): diff --git a/spec/python/spec/test_repeat_eos_bit.py b/spec/python/spec/test_repeat_eos_bit.py index a17eae884..68de6f445 100644 --- a/spec/python/spec/test_repeat_eos_bit.py +++ b/spec/python/spec/test_repeat_eos_bit.py @@ -2,7 +2,7 @@ import unittest -from repeat_eos_bit import RepeatEosBit +from testformats.repeat_eos_bit import RepeatEosBit class TestRepeatEosBit(unittest.TestCase): def test_repeat_eos_bit(self): diff --git a/spec/python/spec/test_repeat_eos_bytes.py b/spec/python/spec/test_repeat_eos_bytes.py index e59438662..87bfd6dc7 100644 --- a/spec/python/spec/test_repeat_eos_bytes.py +++ b/spec/python/spec/test_repeat_eos_bytes.py @@ -2,7 +2,7 @@ import unittest -from repeat_eos_bytes import RepeatEosBytes +from testformats.repeat_eos_bytes import RepeatEosBytes class TestRepeatEosBytes(unittest.TestCase): def test_repeat_eos_bytes(self): diff --git a/spec/python/spec/test_repeat_eos_bytes_pad.py b/spec/python/spec/test_repeat_eos_bytes_pad.py index d6754084c..ebccff5b9 100644 --- a/spec/python/spec/test_repeat_eos_bytes_pad.py +++ b/spec/python/spec/test_repeat_eos_bytes_pad.py @@ -2,7 +2,7 @@ import unittest -from repeat_eos_bytes_pad import RepeatEosBytesPad +from testformats.repeat_eos_bytes_pad import RepeatEosBytesPad class TestRepeatEosBytesPad(unittest.TestCase): def test_repeat_eos_bytes_pad(self): diff --git a/spec/python/spec/test_repeat_eos_bytes_pad_term.py b/spec/python/spec/test_repeat_eos_bytes_pad_term.py index 1df902171..b7e34b15d 100644 --- a/spec/python/spec/test_repeat_eos_bytes_pad_term.py +++ b/spec/python/spec/test_repeat_eos_bytes_pad_term.py @@ -2,7 +2,7 @@ import unittest -from repeat_eos_bytes_pad_term import RepeatEosBytesPadTerm +from testformats.repeat_eos_bytes_pad_term import RepeatEosBytesPadTerm class TestRepeatEosBytesPadTerm(unittest.TestCase): def test_repeat_eos_bytes_pad_term(self): diff --git a/spec/python/spec/test_repeat_eos_struct.py b/spec/python/spec/test_repeat_eos_struct.py index c3a554075..78e5dd4e7 100644 --- a/spec/python/spec/test_repeat_eos_struct.py +++ b/spec/python/spec/test_repeat_eos_struct.py @@ -2,7 +2,7 @@ import unittest -from repeat_eos_struct import RepeatEosStruct +from testformats.repeat_eos_struct import RepeatEosStruct class TestRepeatEosStruct(unittest.TestCase): def test_repeat_eos_struct(self): diff --git a/spec/python/spec/test_repeat_eos_term_bytes.py b/spec/python/spec/test_repeat_eos_term_bytes.py index 222b81ead..e94ac9c3b 100644 --- a/spec/python/spec/test_repeat_eos_term_bytes.py +++ b/spec/python/spec/test_repeat_eos_term_bytes.py @@ -2,7 +2,7 @@ import unittest -from repeat_eos_term_bytes import RepeatEosTermBytes +from testformats.repeat_eos_term_bytes import RepeatEosTermBytes class TestRepeatEosTermBytes(unittest.TestCase): def test_repeat_eos_term_bytes(self): diff --git a/spec/python/spec/test_repeat_eos_term_struct.py b/spec/python/spec/test_repeat_eos_term_struct.py index c5ddb9a29..21d5ea3f6 100644 --- a/spec/python/spec/test_repeat_eos_term_struct.py +++ b/spec/python/spec/test_repeat_eos_term_struct.py @@ -2,7 +2,7 @@ import unittest -from repeat_eos_term_struct import RepeatEosTermStruct +from testformats.repeat_eos_term_struct import RepeatEosTermStruct class TestRepeatEosTermStruct(unittest.TestCase): def test_repeat_eos_term_struct(self): diff --git a/spec/python/spec/test_repeat_eos_u4.py b/spec/python/spec/test_repeat_eos_u4.py index 68dbf1087..ab59350b4 100644 --- a/spec/python/spec/test_repeat_eos_u4.py +++ b/spec/python/spec/test_repeat_eos_u4.py @@ -2,7 +2,7 @@ import unittest -from repeat_eos_u4 import RepeatEosU4 +from testformats.repeat_eos_u4 import RepeatEosU4 class TestRepeatEosU4(unittest.TestCase): def test_repeat_eos_u4(self): diff --git a/spec/python/spec/test_repeat_n_bytes.py b/spec/python/spec/test_repeat_n_bytes.py index 00b9d1d73..cbb3925a0 100644 --- a/spec/python/spec/test_repeat_n_bytes.py +++ b/spec/python/spec/test_repeat_n_bytes.py @@ -2,7 +2,7 @@ import unittest -from repeat_n_bytes import RepeatNBytes +from testformats.repeat_n_bytes import RepeatNBytes class TestRepeatNBytes(unittest.TestCase): def test_repeat_n_bytes(self): diff --git a/spec/python/spec/test_repeat_n_bytes_pad.py b/spec/python/spec/test_repeat_n_bytes_pad.py index 6e75c8eb5..602036aaa 100644 --- a/spec/python/spec/test_repeat_n_bytes_pad.py +++ b/spec/python/spec/test_repeat_n_bytes_pad.py @@ -2,7 +2,7 @@ import unittest -from repeat_n_bytes_pad import RepeatNBytesPad +from testformats.repeat_n_bytes_pad import RepeatNBytesPad class TestRepeatNBytesPad(unittest.TestCase): def test_repeat_n_bytes_pad(self): diff --git a/spec/python/spec/test_repeat_n_bytes_pad_term.py b/spec/python/spec/test_repeat_n_bytes_pad_term.py index 7749b6ab5..e3317a437 100644 --- a/spec/python/spec/test_repeat_n_bytes_pad_term.py +++ b/spec/python/spec/test_repeat_n_bytes_pad_term.py @@ -2,7 +2,7 @@ import unittest -from repeat_n_bytes_pad_term import RepeatNBytesPadTerm +from testformats.repeat_n_bytes_pad_term import RepeatNBytesPadTerm class TestRepeatNBytesPadTerm(unittest.TestCase): def test_repeat_n_bytes_pad_term(self): diff --git a/spec/python/spec/test_repeat_n_struct.py b/spec/python/spec/test_repeat_n_struct.py index c54d3c420..4f3d9fded 100644 --- a/spec/python/spec/test_repeat_n_struct.py +++ b/spec/python/spec/test_repeat_n_struct.py @@ -2,7 +2,7 @@ import unittest -from repeat_n_struct import RepeatNStruct +from testformats.repeat_n_struct import RepeatNStruct class TestRepeatNStruct(unittest.TestCase): def test_repeat_n_struct(self): diff --git a/spec/python/spec/test_repeat_n_strz.py b/spec/python/spec/test_repeat_n_strz.py index 57ebb6fa0..9c70299fe 100644 --- a/spec/python/spec/test_repeat_n_strz.py +++ b/spec/python/spec/test_repeat_n_strz.py @@ -2,7 +2,7 @@ import unittest -from repeat_n_strz import RepeatNStrz +from testformats.repeat_n_strz import RepeatNStrz class TestRepeatNStrz(unittest.TestCase): def test_repeat_n_strz(self): diff --git a/spec/python/spec/test_repeat_n_strz_double.py b/spec/python/spec/test_repeat_n_strz_double.py index 3f9d6bc7f..0f5ef255e 100644 --- a/spec/python/spec/test_repeat_n_strz_double.py +++ b/spec/python/spec/test_repeat_n_strz_double.py @@ -2,7 +2,7 @@ import unittest -from repeat_n_strz_double import RepeatNStrzDouble +from testformats.repeat_n_strz_double import RepeatNStrzDouble class TestRepeatNStrzDouble(unittest.TestCase): def test_repeat_n_strz_double(self): diff --git a/spec/python/spec/test_repeat_n_term_bytes.py b/spec/python/spec/test_repeat_n_term_bytes.py index 85ef1092c..9efd2e6af 100644 --- a/spec/python/spec/test_repeat_n_term_bytes.py +++ b/spec/python/spec/test_repeat_n_term_bytes.py @@ -2,7 +2,7 @@ import unittest -from repeat_n_term_bytes import RepeatNTermBytes +from testformats.repeat_n_term_bytes import RepeatNTermBytes class TestRepeatNTermBytes(unittest.TestCase): def test_repeat_n_term_bytes(self): diff --git a/spec/python/spec/test_repeat_n_term_struct.py b/spec/python/spec/test_repeat_n_term_struct.py index b45fae986..9d2b0c6d2 100644 --- a/spec/python/spec/test_repeat_n_term_struct.py +++ b/spec/python/spec/test_repeat_n_term_struct.py @@ -2,7 +2,7 @@ import unittest -from repeat_n_term_struct import RepeatNTermStruct +from testformats.repeat_n_term_struct import RepeatNTermStruct class TestRepeatNTermStruct(unittest.TestCase): def test_repeat_n_term_struct(self): diff --git a/spec/python/spec/test_repeat_until_bytes.py b/spec/python/spec/test_repeat_until_bytes.py index 9409a6165..e5a77cf12 100644 --- a/spec/python/spec/test_repeat_until_bytes.py +++ b/spec/python/spec/test_repeat_until_bytes.py @@ -2,7 +2,7 @@ import unittest -from repeat_until_bytes import RepeatUntilBytes +from testformats.repeat_until_bytes import RepeatUntilBytes class TestRepeatUntilBytes(unittest.TestCase): def test_repeat_until_bytes(self): diff --git a/spec/python/spec/test_repeat_until_bytes_pad.py b/spec/python/spec/test_repeat_until_bytes_pad.py index ccd7e5676..9d40c0a70 100644 --- a/spec/python/spec/test_repeat_until_bytes_pad.py +++ b/spec/python/spec/test_repeat_until_bytes_pad.py @@ -2,7 +2,7 @@ import unittest -from repeat_until_bytes_pad import RepeatUntilBytesPad +from testformats.repeat_until_bytes_pad import RepeatUntilBytesPad class TestRepeatUntilBytesPad(unittest.TestCase): def test_repeat_until_bytes_pad(self): diff --git a/spec/python/spec/test_repeat_until_bytes_pad_term.py b/spec/python/spec/test_repeat_until_bytes_pad_term.py index 172583223..2b8f50162 100644 --- a/spec/python/spec/test_repeat_until_bytes_pad_term.py +++ b/spec/python/spec/test_repeat_until_bytes_pad_term.py @@ -2,7 +2,7 @@ import unittest -from repeat_until_bytes_pad_term import RepeatUntilBytesPadTerm +from testformats.repeat_until_bytes_pad_term import RepeatUntilBytesPadTerm class TestRepeatUntilBytesPadTerm(unittest.TestCase): def test_repeat_until_bytes_pad_term(self): diff --git a/spec/python/spec/test_repeat_until_calc_array_type.py b/spec/python/spec/test_repeat_until_calc_array_type.py index fd22e36b9..3bae3dd05 100644 --- a/spec/python/spec/test_repeat_until_calc_array_type.py +++ b/spec/python/spec/test_repeat_until_calc_array_type.py @@ -2,7 +2,7 @@ import unittest -from repeat_until_calc_array_type import RepeatUntilCalcArrayType +from testformats.repeat_until_calc_array_type import RepeatUntilCalcArrayType class TestRepeatUntilCalcArrayType(unittest.TestCase): def test_repeat_until_calc_array_type(self): diff --git a/spec/python/spec/test_repeat_until_complex.py b/spec/python/spec/test_repeat_until_complex.py index ce05ef1bd..1589eae00 100644 --- a/spec/python/spec/test_repeat_until_complex.py +++ b/spec/python/spec/test_repeat_until_complex.py @@ -2,7 +2,7 @@ import unittest -from repeat_until_complex import RepeatUntilComplex +from testformats.repeat_until_complex import RepeatUntilComplex class TestRepeatUntilComplex(unittest.TestCase): def test_repeat_until_complex(self): diff --git a/spec/python/spec/test_repeat_until_s4.py b/spec/python/spec/test_repeat_until_s4.py index fc81ab9c5..bd38cbac4 100644 --- a/spec/python/spec/test_repeat_until_s4.py +++ b/spec/python/spec/test_repeat_until_s4.py @@ -2,7 +2,7 @@ import unittest -from repeat_until_s4 import RepeatUntilS4 +from testformats.repeat_until_s4 import RepeatUntilS4 class TestRepeatUntilS4(unittest.TestCase): def test_repeat_until_s4(self): diff --git a/spec/python/spec/test_repeat_until_sized.py b/spec/python/spec/test_repeat_until_sized.py index 76b62f98c..b293f8536 100644 --- a/spec/python/spec/test_repeat_until_sized.py +++ b/spec/python/spec/test_repeat_until_sized.py @@ -2,7 +2,7 @@ import unittest -from repeat_until_sized import RepeatUntilSized +from testformats.repeat_until_sized import RepeatUntilSized class TestRepeatUntilSized(unittest.TestCase): def test_repeat_until_sized(self): diff --git a/spec/python/spec/test_repeat_until_term_bytes.py b/spec/python/spec/test_repeat_until_term_bytes.py index 7c2dcb6a4..e50847758 100644 --- a/spec/python/spec/test_repeat_until_term_bytes.py +++ b/spec/python/spec/test_repeat_until_term_bytes.py @@ -2,7 +2,7 @@ import unittest -from repeat_until_term_bytes import RepeatUntilTermBytes +from testformats.repeat_until_term_bytes import RepeatUntilTermBytes class TestRepeatUntilTermBytes(unittest.TestCase): def test_repeat_until_term_bytes(self): diff --git a/spec/python/spec/test_repeat_until_term_struct.py b/spec/python/spec/test_repeat_until_term_struct.py index f19c1efad..d6c3015c1 100644 --- a/spec/python/spec/test_repeat_until_term_struct.py +++ b/spec/python/spec/test_repeat_until_term_struct.py @@ -2,7 +2,7 @@ import unittest -from repeat_until_term_struct import RepeatUntilTermStruct +from testformats.repeat_until_term_struct import RepeatUntilTermStruct class TestRepeatUntilTermStruct(unittest.TestCase): def test_repeat_until_term_struct(self): diff --git a/spec/python/spec/test_str_encodings.py b/spec/python/spec/test_str_encodings.py index 6d0c38dcd..690f20a54 100644 --- a/spec/python/spec/test_str_encodings.py +++ b/spec/python/spec/test_str_encodings.py @@ -2,7 +2,7 @@ import unittest -from str_encodings import StrEncodings +from testformats.str_encodings import StrEncodings class TestStrEncodings(unittest.TestCase): def test_str_encodings(self): diff --git a/spec/python/spec/test_str_encodings_default.py b/spec/python/spec/test_str_encodings_default.py index 31c042ab4..6eb83a285 100644 --- a/spec/python/spec/test_str_encodings_default.py +++ b/spec/python/spec/test_str_encodings_default.py @@ -2,7 +2,7 @@ import unittest -from str_encodings_default import StrEncodingsDefault +from testformats.str_encodings_default import StrEncodingsDefault class TestStrEncodingsDefault(unittest.TestCase): def test_str_encodings_default(self): diff --git a/spec/python/spec/test_str_encodings_utf16.py b/spec/python/spec/test_str_encodings_utf16.py index 8927d85aa..face099b1 100644 --- a/spec/python/spec/test_str_encodings_utf16.py +++ b/spec/python/spec/test_str_encodings_utf16.py @@ -2,7 +2,7 @@ import unittest -from str_encodings_utf16 import StrEncodingsUtf16 +from testformats.str_encodings_utf16 import StrEncodingsUtf16 class TestStrEncodingsUtf16(unittest.TestCase): def test_str_encodings_utf16(self): diff --git a/spec/python/spec/test_str_eos.py b/spec/python/spec/test_str_eos.py index 3c7a2539e..1f79862ba 100644 --- a/spec/python/spec/test_str_eos.py +++ b/spec/python/spec/test_str_eos.py @@ -2,7 +2,7 @@ import unittest -from str_eos import StrEos +from testformats.str_eos import StrEos class TestStrEos(unittest.TestCase): def test_str_eos(self): diff --git a/spec/python/spec/test_str_eos_pad_term.py b/spec/python/spec/test_str_eos_pad_term.py index caa8d56de..917c53fbc 100644 --- a/spec/python/spec/test_str_eos_pad_term.py +++ b/spec/python/spec/test_str_eos_pad_term.py @@ -2,7 +2,7 @@ import unittest -from str_eos_pad_term import StrEosPadTerm +from testformats.str_eos_pad_term import StrEosPadTerm class TestStrEosPadTerm(unittest.TestCase): def test_str_eos_pad_term(self): diff --git a/spec/python/spec/test_str_eos_pad_term_empty.py b/spec/python/spec/test_str_eos_pad_term_empty.py index fbc4c3240..acb4bd219 100644 --- a/spec/python/spec/test_str_eos_pad_term_empty.py +++ b/spec/python/spec/test_str_eos_pad_term_empty.py @@ -2,7 +2,7 @@ import unittest -from str_eos_pad_term_empty import StrEosPadTermEmpty +from testformats.str_eos_pad_term_empty import StrEosPadTermEmpty class TestStrEosPadTermEmpty(unittest.TestCase): def test_str_eos_pad_term_empty(self): diff --git a/spec/python/spec/test_str_eos_pad_term_equal.py b/spec/python/spec/test_str_eos_pad_term_equal.py index 44b142602..bc56f15df 100644 --- a/spec/python/spec/test_str_eos_pad_term_equal.py +++ b/spec/python/spec/test_str_eos_pad_term_equal.py @@ -2,7 +2,7 @@ import unittest -from str_eos_pad_term_equal import StrEosPadTermEqual +from testformats.str_eos_pad_term_equal import StrEosPadTermEqual class TestStrEosPadTermEqual(unittest.TestCase): def test_str_eos_pad_term_equal(self): diff --git a/spec/python/spec/test_str_literals.py b/spec/python/spec/test_str_literals.py index f3cd1f450..c528ee58d 100644 --- a/spec/python/spec/test_str_literals.py +++ b/spec/python/spec/test_str_literals.py @@ -1,6 +1,6 @@ import unittest -from str_literals import StrLiterals +from testformats.str_literals import StrLiterals class TestStrLiterals(unittest.TestCase): def test_str_literals(self): diff --git a/spec/python/spec/test_str_literals2.py b/spec/python/spec/test_str_literals2.py index 39a3f779c..fed773e76 100644 --- a/spec/python/spec/test_str_literals2.py +++ b/spec/python/spec/test_str_literals2.py @@ -2,7 +2,7 @@ import unittest -from str_literals2 import StrLiterals2 +from testformats.str_literals2 import StrLiterals2 class TestStrLiterals2(unittest.TestCase): def test_str_literals2(self): diff --git a/spec/python/spec/test_str_pad_term.py b/spec/python/spec/test_str_pad_term.py index 8234a4f58..88c7beafb 100644 --- a/spec/python/spec/test_str_pad_term.py +++ b/spec/python/spec/test_str_pad_term.py @@ -2,7 +2,7 @@ import unittest -from str_pad_term import StrPadTerm +from testformats.str_pad_term import StrPadTerm class TestStrPadTerm(unittest.TestCase): def test_str_pad_term(self): diff --git a/spec/python/spec/test_str_pad_term_empty.py b/spec/python/spec/test_str_pad_term_empty.py index 64a64cff3..4e3a1d63a 100644 --- a/spec/python/spec/test_str_pad_term_empty.py +++ b/spec/python/spec/test_str_pad_term_empty.py @@ -2,7 +2,7 @@ import unittest -from str_pad_term_empty import StrPadTermEmpty +from testformats.str_pad_term_empty import StrPadTermEmpty class TestStrPadTermEmpty(unittest.TestCase): def test_str_pad_term_empty(self): diff --git a/spec/python/spec/test_str_pad_term_equal.py b/spec/python/spec/test_str_pad_term_equal.py index 5a75e67fc..8484dc6db 100644 --- a/spec/python/spec/test_str_pad_term_equal.py +++ b/spec/python/spec/test_str_pad_term_equal.py @@ -2,7 +2,7 @@ import unittest -from str_pad_term_equal import StrPadTermEqual +from testformats.str_pad_term_equal import StrPadTermEqual class TestStrPadTermEqual(unittest.TestCase): def test_str_pad_term_equal(self): diff --git a/spec/python/spec/test_str_pad_term_roundtrip.py b/spec/python/spec/test_str_pad_term_roundtrip.py index 84ccf8925..204e32583 100644 --- a/spec/python/spec/test_str_pad_term_roundtrip.py +++ b/spec/python/spec/test_str_pad_term_roundtrip.py @@ -2,7 +2,7 @@ import unittest -from str_pad_term_roundtrip import StrPadTermRoundtrip +from testformats.str_pad_term_roundtrip import StrPadTermRoundtrip class TestStrPadTermRoundtrip(unittest.TestCase): def test_str_pad_term_roundtrip(self): diff --git a/spec/python/spec/test_str_pad_term_zero_size.py b/spec/python/spec/test_str_pad_term_zero_size.py index 0ea75dec3..bf2c06e1c 100644 --- a/spec/python/spec/test_str_pad_term_zero_size.py +++ b/spec/python/spec/test_str_pad_term_zero_size.py @@ -2,7 +2,7 @@ import unittest -from str_pad_term_zero_size import StrPadTermZeroSize +from testformats.str_pad_term_zero_size import StrPadTermZeroSize class TestStrPadTermZeroSize(unittest.TestCase): def test_str_pad_term_zero_size(self): diff --git a/spec/python/spec/test_struct_pad_term.py b/spec/python/spec/test_struct_pad_term.py index 353a2013b..981cb5b60 100644 --- a/spec/python/spec/test_struct_pad_term.py +++ b/spec/python/spec/test_struct_pad_term.py @@ -2,7 +2,7 @@ import unittest -from struct_pad_term import StructPadTerm +from testformats.struct_pad_term import StructPadTerm class TestStructPadTerm(unittest.TestCase): def test_struct_pad_term(self): diff --git a/spec/python/spec/test_struct_pad_term_equal.py b/spec/python/spec/test_struct_pad_term_equal.py index 500641b21..894ba7e9c 100644 --- a/spec/python/spec/test_struct_pad_term_equal.py +++ b/spec/python/spec/test_struct_pad_term_equal.py @@ -2,7 +2,7 @@ import unittest -from struct_pad_term_equal import StructPadTermEqual +from testformats.struct_pad_term_equal import StructPadTermEqual class TestStructPadTermEqual(unittest.TestCase): def test_struct_pad_term_equal(self): diff --git a/spec/python/spec/test_switch_bytearray.py b/spec/python/spec/test_switch_bytearray.py index 253e636d6..0ded79272 100644 --- a/spec/python/spec/test_switch_bytearray.py +++ b/spec/python/spec/test_switch_bytearray.py @@ -2,7 +2,7 @@ import unittest -from switch_bytearray import SwitchBytearray +from testformats.switch_bytearray import SwitchBytearray class TestSwitchBytearray(unittest.TestCase): def test_switch_bytearray(self): diff --git a/spec/python/spec/test_switch_cast.py b/spec/python/spec/test_switch_cast.py index 9c3ec712a..7b595b5c3 100644 --- a/spec/python/spec/test_switch_cast.py +++ b/spec/python/spec/test_switch_cast.py @@ -1,6 +1,6 @@ import unittest -from switch_cast import SwitchCast +from testformats.switch_cast import SwitchCast class TestSwitchCast(unittest.TestCase): def test_switch_cast(self): diff --git a/spec/python/spec/test_switch_else_only.py b/spec/python/spec/test_switch_else_only.py index 0f2ec2fd2..42ce6db9b 100644 --- a/spec/python/spec/test_switch_else_only.py +++ b/spec/python/spec/test_switch_else_only.py @@ -2,7 +2,7 @@ import unittest -from switch_else_only import SwitchElseOnly +from testformats.switch_else_only import SwitchElseOnly class TestSwitchElseOnly(unittest.TestCase): def test_switch_else_only(self): diff --git a/spec/python/spec/test_switch_integers.py b/spec/python/spec/test_switch_integers.py index 84baad1d9..90423c108 100644 --- a/spec/python/spec/test_switch_integers.py +++ b/spec/python/spec/test_switch_integers.py @@ -2,7 +2,7 @@ import unittest -from switch_integers import SwitchIntegers +from testformats.switch_integers import SwitchIntegers class TestSwitchIntegers(unittest.TestCase): def test_switch_integers(self): diff --git a/spec/python/spec/test_switch_integers2.py b/spec/python/spec/test_switch_integers2.py index 8544ee43c..b6e0470e6 100644 --- a/spec/python/spec/test_switch_integers2.py +++ b/spec/python/spec/test_switch_integers2.py @@ -2,7 +2,7 @@ import unittest -from switch_integers2 import SwitchIntegers2 +from testformats.switch_integers2 import SwitchIntegers2 class TestSwitchIntegers2(unittest.TestCase): def test_switch_integers2(self): diff --git a/spec/python/spec/test_switch_manual_enum.py b/spec/python/spec/test_switch_manual_enum.py index 57ee2b2ef..5db904295 100644 --- a/spec/python/spec/test_switch_manual_enum.py +++ b/spec/python/spec/test_switch_manual_enum.py @@ -2,7 +2,7 @@ import unittest -from switch_manual_enum import SwitchManualEnum +from testformats.switch_manual_enum import SwitchManualEnum class TestSwitchManualEnum(unittest.TestCase): def test_switch_manual_enum(self): diff --git a/spec/python/spec/test_switch_manual_enum_invalid.py b/spec/python/spec/test_switch_manual_enum_invalid.py index ae5f09c7e..5897efb62 100644 --- a/spec/python/spec/test_switch_manual_enum_invalid.py +++ b/spec/python/spec/test_switch_manual_enum_invalid.py @@ -1,6 +1,6 @@ import unittest -from switch_manual_enum_invalid import SwitchManualEnumInvalid +from testformats.switch_manual_enum_invalid import SwitchManualEnumInvalid class TestSwitchManualEnumInvalid(unittest.TestCase): def test_switch_manual_enum_invalid(self): diff --git a/spec/python/spec/test_switch_manual_enum_invalid_else.py b/spec/python/spec/test_switch_manual_enum_invalid_else.py index 80b3b6dd2..4b9d26bec 100644 --- a/spec/python/spec/test_switch_manual_enum_invalid_else.py +++ b/spec/python/spec/test_switch_manual_enum_invalid_else.py @@ -2,7 +2,7 @@ import unittest -from switch_manual_enum_invalid_else import SwitchManualEnumInvalidElse +from testformats.switch_manual_enum_invalid_else import SwitchManualEnumInvalidElse class TestSwitchManualEnumInvalidElse(unittest.TestCase): def test_switch_manual_enum_invalid_else(self): diff --git a/spec/python/spec/test_switch_manual_int.py b/spec/python/spec/test_switch_manual_int.py index 7d7febc6e..3d131ae18 100644 --- a/spec/python/spec/test_switch_manual_int.py +++ b/spec/python/spec/test_switch_manual_int.py @@ -2,7 +2,7 @@ import unittest -from switch_manual_int import SwitchManualInt +from testformats.switch_manual_int import SwitchManualInt class TestSwitchManualInt(unittest.TestCase): def test_switch_manual_int(self): diff --git a/spec/python/spec/test_switch_manual_int_else.py b/spec/python/spec/test_switch_manual_int_else.py index 06f4e3c1d..ed57908f1 100644 --- a/spec/python/spec/test_switch_manual_int_else.py +++ b/spec/python/spec/test_switch_manual_int_else.py @@ -2,7 +2,7 @@ import unittest -from switch_manual_int_else import SwitchManualIntElse +from testformats.switch_manual_int_else import SwitchManualIntElse class TestSwitchManualIntElse(unittest.TestCase): def test_switch_manual_int_else(self): diff --git a/spec/python/spec/test_switch_manual_int_size.py b/spec/python/spec/test_switch_manual_int_size.py index ddced486e..ffb9e69df 100644 --- a/spec/python/spec/test_switch_manual_int_size.py +++ b/spec/python/spec/test_switch_manual_int_size.py @@ -2,7 +2,7 @@ import unittest -from switch_manual_int_size import SwitchManualIntSize +from testformats.switch_manual_int_size import SwitchManualIntSize class TestSwitchManualIntSize(unittest.TestCase): def test_switch_manual_int_size(self): diff --git a/spec/python/spec/test_switch_manual_int_size_else.py b/spec/python/spec/test_switch_manual_int_size_else.py index e2eae2e93..8a74147ad 100644 --- a/spec/python/spec/test_switch_manual_int_size_else.py +++ b/spec/python/spec/test_switch_manual_int_size_else.py @@ -2,7 +2,7 @@ import unittest -from switch_manual_int_size_else import SwitchManualIntSizeElse +from testformats.switch_manual_int_size_else import SwitchManualIntSizeElse class TestSwitchManualIntSizeElse(unittest.TestCase): def test_switch_manual_int_size_else(self): diff --git a/spec/python/spec/test_switch_manual_int_size_eos.py b/spec/python/spec/test_switch_manual_int_size_eos.py index c303d146e..f0ddcd12a 100644 --- a/spec/python/spec/test_switch_manual_int_size_eos.py +++ b/spec/python/spec/test_switch_manual_int_size_eos.py @@ -2,7 +2,7 @@ import unittest -from switch_manual_int_size_eos import SwitchManualIntSizeEos +from testformats.switch_manual_int_size_eos import SwitchManualIntSizeEos class TestSwitchManualIntSizeEos(unittest.TestCase): def test_switch_manual_int_size_eos(self): diff --git a/spec/python/spec/test_switch_manual_str.py b/spec/python/spec/test_switch_manual_str.py index 2143e215b..ad8f272be 100644 --- a/spec/python/spec/test_switch_manual_str.py +++ b/spec/python/spec/test_switch_manual_str.py @@ -2,7 +2,7 @@ import unittest -from switch_manual_str import SwitchManualStr +from testformats.switch_manual_str import SwitchManualStr class TestSwitchManualStr(unittest.TestCase): def test_switch_manual_str(self): diff --git a/spec/python/spec/test_switch_manual_str_else.py b/spec/python/spec/test_switch_manual_str_else.py index 60e15b47e..3f411a03e 100644 --- a/spec/python/spec/test_switch_manual_str_else.py +++ b/spec/python/spec/test_switch_manual_str_else.py @@ -2,7 +2,7 @@ import unittest -from switch_manual_str_else import SwitchManualStrElse +from testformats.switch_manual_str_else import SwitchManualStrElse class TestSwitchManualStrElse(unittest.TestCase): def test_switch_manual_str_else(self): diff --git a/spec/python/spec/test_switch_multi_bool_ops.py b/spec/python/spec/test_switch_multi_bool_ops.py index 298dcc7e9..e57fb98bf 100644 --- a/spec/python/spec/test_switch_multi_bool_ops.py +++ b/spec/python/spec/test_switch_multi_bool_ops.py @@ -2,7 +2,7 @@ import unittest -from switch_multi_bool_ops import SwitchMultiBoolOps +from testformats.switch_multi_bool_ops import SwitchMultiBoolOps class TestSwitchMultiBoolOps(unittest.TestCase): def test_switch_multi_bool_ops(self): diff --git a/spec/python/spec/test_switch_repeat_expr.py b/spec/python/spec/test_switch_repeat_expr.py index 9df15b511..720ea996c 100644 --- a/spec/python/spec/test_switch_repeat_expr.py +++ b/spec/python/spec/test_switch_repeat_expr.py @@ -2,7 +2,7 @@ import unittest -from switch_repeat_expr import SwitchRepeatExpr +from testformats.switch_repeat_expr import SwitchRepeatExpr class TestSwitchRepeatExpr(unittest.TestCase): def test_switch_repeat_expr(self): diff --git a/spec/python/spec/test_switch_repeat_expr_invalid.py b/spec/python/spec/test_switch_repeat_expr_invalid.py index 64230df5c..67fdc4539 100644 --- a/spec/python/spec/test_switch_repeat_expr_invalid.py +++ b/spec/python/spec/test_switch_repeat_expr_invalid.py @@ -2,7 +2,7 @@ import unittest -from switch_repeat_expr_invalid import SwitchRepeatExprInvalid +from testformats.switch_repeat_expr_invalid import SwitchRepeatExprInvalid class TestSwitchRepeatExprInvalid(unittest.TestCase): def test_switch_repeat_expr_invalid(self): diff --git a/spec/python/spec/test_term_bytes.py b/spec/python/spec/test_term_bytes.py index d3b191baf..496febb13 100644 --- a/spec/python/spec/test_term_bytes.py +++ b/spec/python/spec/test_term_bytes.py @@ -2,7 +2,7 @@ import unittest -from term_bytes import TermBytes +from testformats.term_bytes import TermBytes class TestTermBytes(unittest.TestCase): def test_term_bytes(self): diff --git a/spec/python/spec/test_term_bytes2.py b/spec/python/spec/test_term_bytes2.py index 86cccdaaf..e1bc0a725 100644 --- a/spec/python/spec/test_term_bytes2.py +++ b/spec/python/spec/test_term_bytes2.py @@ -2,7 +2,7 @@ import unittest -from term_bytes2 import TermBytes2 +from testformats.term_bytes2 import TermBytes2 class TestTermBytes2(unittest.TestCase): def test_term_bytes2(self): diff --git a/spec/python/spec/test_term_bytes3.py b/spec/python/spec/test_term_bytes3.py index 9c8638d1a..34c06310b 100644 --- a/spec/python/spec/test_term_bytes3.py +++ b/spec/python/spec/test_term_bytes3.py @@ -2,7 +2,7 @@ import unittest -from term_bytes3 import TermBytes3 +from testformats.term_bytes3 import TermBytes3 class TestTermBytes3(unittest.TestCase): def test_term_bytes3(self): diff --git a/spec/python/spec/test_term_bytes4.py b/spec/python/spec/test_term_bytes4.py index fda7156e1..cc5294811 100644 --- a/spec/python/spec/test_term_bytes4.py +++ b/spec/python/spec/test_term_bytes4.py @@ -2,7 +2,7 @@ import unittest -from term_bytes4 import TermBytes4 +from testformats.term_bytes4 import TermBytes4 class TestTermBytes4(unittest.TestCase): def test_term_bytes4(self): diff --git a/spec/python/spec/test_term_struct.py b/spec/python/spec/test_term_struct.py index c7835b300..63a0724a4 100644 --- a/spec/python/spec/test_term_struct.py +++ b/spec/python/spec/test_term_struct.py @@ -2,7 +2,7 @@ import unittest -from term_struct import TermStruct +from testformats.term_struct import TermStruct class TestTermStruct(unittest.TestCase): def test_term_struct(self): diff --git a/spec/python/spec/test_term_struct2.py b/spec/python/spec/test_term_struct2.py index 05949347e..37f03a693 100644 --- a/spec/python/spec/test_term_struct2.py +++ b/spec/python/spec/test_term_struct2.py @@ -2,7 +2,7 @@ import unittest -from term_struct2 import TermStruct2 +from testformats.term_struct2 import TermStruct2 class TestTermStruct2(unittest.TestCase): def test_term_struct2(self): diff --git a/spec/python/spec/test_term_struct3.py b/spec/python/spec/test_term_struct3.py index 5d378e62d..bfb98ab73 100644 --- a/spec/python/spec/test_term_struct3.py +++ b/spec/python/spec/test_term_struct3.py @@ -2,7 +2,7 @@ import unittest -from term_struct3 import TermStruct3 +from testformats.term_struct3 import TermStruct3 class TestTermStruct3(unittest.TestCase): def test_term_struct3(self): diff --git a/spec/python/spec/test_term_struct4.py b/spec/python/spec/test_term_struct4.py index ed6442e0f..e4ddcf6e9 100644 --- a/spec/python/spec/test_term_struct4.py +++ b/spec/python/spec/test_term_struct4.py @@ -2,7 +2,7 @@ import unittest -from term_struct4 import TermStruct4 +from testformats.term_struct4 import TermStruct4 class TestTermStruct4(unittest.TestCase): def test_term_struct4(self): diff --git a/spec/python/spec/test_term_strz.py b/spec/python/spec/test_term_strz.py index 680ec5fcc..516b1671c 100644 --- a/spec/python/spec/test_term_strz.py +++ b/spec/python/spec/test_term_strz.py @@ -2,7 +2,7 @@ import unittest -from term_strz import TermStrz +from testformats.term_strz import TermStrz class TestTermStrz(unittest.TestCase): def test_term_strz(self): diff --git a/spec/python/spec/test_term_strz2.py b/spec/python/spec/test_term_strz2.py index e1c55a435..60c587e7d 100644 --- a/spec/python/spec/test_term_strz2.py +++ b/spec/python/spec/test_term_strz2.py @@ -2,7 +2,7 @@ import unittest -from term_strz2 import TermStrz2 +from testformats.term_strz2 import TermStrz2 class TestTermStrz2(unittest.TestCase): def test_term_strz2(self): diff --git a/spec/python/spec/test_term_strz3.py b/spec/python/spec/test_term_strz3.py index 43f2f73aa..7a1e2da65 100644 --- a/spec/python/spec/test_term_strz3.py +++ b/spec/python/spec/test_term_strz3.py @@ -2,7 +2,7 @@ import unittest -from term_strz3 import TermStrz3 +from testformats.term_strz3 import TermStrz3 class TestTermStrz3(unittest.TestCase): def test_term_strz3(self): diff --git a/spec/python/spec/test_term_strz4.py b/spec/python/spec/test_term_strz4.py index 04c68537d..2b014bb82 100644 --- a/spec/python/spec/test_term_strz4.py +++ b/spec/python/spec/test_term_strz4.py @@ -2,7 +2,7 @@ import unittest -from term_strz4 import TermStrz4 +from testformats.term_strz4 import TermStrz4 class TestTermStrz4(unittest.TestCase): def test_term_strz4(self): diff --git a/spec/python/spec/test_term_u1_val.py b/spec/python/spec/test_term_u1_val.py index 43f808997..5d98275fa 100644 --- a/spec/python/spec/test_term_u1_val.py +++ b/spec/python/spec/test_term_u1_val.py @@ -2,7 +2,7 @@ import unittest -from term_u1_val import TermU1Val +from testformats.term_u1_val import TermU1Val class TestTermU1Val(unittest.TestCase): def test_term_u1_val(self): diff --git a/spec/python/spec/test_to_string_custom.py b/spec/python/spec/test_to_string_custom.py index 9c17c6ae2..cd51248f7 100644 --- a/spec/python/spec/test_to_string_custom.py +++ b/spec/python/spec/test_to_string_custom.py @@ -1,6 +1,6 @@ import unittest -from to_string_custom import ToStringCustom +from testformats.to_string_custom import ToStringCustom class TestToStringCustom(unittest.TestCase): def test_to_string_custom(self): diff --git a/spec/python/spec/test_ts_packet_header.py b/spec/python/spec/test_ts_packet_header.py index c16bc0447..29747a76e 100644 --- a/spec/python/spec/test_ts_packet_header.py +++ b/spec/python/spec/test_ts_packet_header.py @@ -2,7 +2,7 @@ import unittest -from ts_packet_header import TsPacketHeader +from testformats.ts_packet_header import TsPacketHeader class TestTsPacketHeader(unittest.TestCase): def test_ts_packet_header(self): diff --git a/spec/python/spec/test_type_int_unary_op.py b/spec/python/spec/test_type_int_unary_op.py index e08b73dbb..e0c496a84 100644 --- a/spec/python/spec/test_type_int_unary_op.py +++ b/spec/python/spec/test_type_int_unary_op.py @@ -2,7 +2,7 @@ import unittest -from type_int_unary_op import TypeIntUnaryOp +from testformats.type_int_unary_op import TypeIntUnaryOp class TestTypeIntUnaryOp(unittest.TestCase): def test_type_int_unary_op(self): diff --git a/spec/python/spec/test_type_ternary.py b/spec/python/spec/test_type_ternary.py index 1e500854c..4e6b2b588 100644 --- a/spec/python/spec/test_type_ternary.py +++ b/spec/python/spec/test_type_ternary.py @@ -2,7 +2,7 @@ import unittest -from type_ternary import TypeTernary +from testformats.type_ternary import TypeTernary class TestTypeTernary(unittest.TestCase): def test_type_ternary(self): diff --git a/spec/python/spec/test_type_ternary_2nd_falsy.py b/spec/python/spec/test_type_ternary_2nd_falsy.py index 2f0a37a4c..8b32f4d32 100644 --- a/spec/python/spec/test_type_ternary_2nd_falsy.py +++ b/spec/python/spec/test_type_ternary_2nd_falsy.py @@ -2,7 +2,7 @@ import unittest -from type_ternary_2nd_falsy import TypeTernary2ndFalsy +from testformats.type_ternary_2nd_falsy import TypeTernary2ndFalsy class TestTypeTernary2ndFalsy(unittest.TestCase): def test_type_ternary_2nd_falsy(self): diff --git a/spec/python/spec/test_type_ternary_opaque.py b/spec/python/spec/test_type_ternary_opaque.py index 042273fc1..2dd229c36 100644 --- a/spec/python/spec/test_type_ternary_opaque.py +++ b/spec/python/spec/test_type_ternary_opaque.py @@ -2,7 +2,7 @@ import unittest -from type_ternary_opaque import TypeTernaryOpaque +from testformats.type_ternary_opaque import TypeTernaryOpaque class TestTypeTernaryOpaque(unittest.TestCase): def test_type_ternary_opaque(self): diff --git a/spec/python/spec/test_user_type.py b/spec/python/spec/test_user_type.py index b00974fe9..b21d5ac08 100644 --- a/spec/python/spec/test_user_type.py +++ b/spec/python/spec/test_user_type.py @@ -2,7 +2,7 @@ import unittest -from user_type import UserType +from testformats.user_type import UserType class TestUserType(unittest.TestCase): def test_user_type(self): diff --git a/spec/python/spec/test_valid_eq_str_encodings.py b/spec/python/spec/test_valid_eq_str_encodings.py index 20f946546..514d27551 100644 --- a/spec/python/spec/test_valid_eq_str_encodings.py +++ b/spec/python/spec/test_valid_eq_str_encodings.py @@ -2,7 +2,7 @@ import unittest -from valid_eq_str_encodings import ValidEqStrEncodings +from testformats.valid_eq_str_encodings import ValidEqStrEncodings class TestValidEqStrEncodings(unittest.TestCase): def test_valid_eq_str_encodings(self): diff --git a/spec/python/spec/test_valid_fail_anyof_int.py b/spec/python/spec/test_valid_fail_anyof_int.py index 6d92c56c5..b889fc2cf 100644 --- a/spec/python/spec/test_valid_fail_anyof_int.py +++ b/spec/python/spec/test_valid_fail_anyof_int.py @@ -3,7 +3,7 @@ import unittest import kaitaistruct -from valid_fail_anyof_int import ValidFailAnyofInt +from testformats.valid_fail_anyof_int import ValidFailAnyofInt class TestValidFailAnyofInt(unittest.TestCase): def test_valid_fail_anyof_int(self): diff --git a/spec/python/spec/test_valid_fail_contents.py b/spec/python/spec/test_valid_fail_contents.py index dfa011198..6ee0b491e 100644 --- a/spec/python/spec/test_valid_fail_contents.py +++ b/spec/python/spec/test_valid_fail_contents.py @@ -3,7 +3,7 @@ import unittest import kaitaistruct -from valid_fail_contents import ValidFailContents +from testformats.valid_fail_contents import ValidFailContents class TestValidFailContents(unittest.TestCase): def test_valid_fail_contents(self): diff --git a/spec/python/spec/test_valid_fail_eq_bytes.py b/spec/python/spec/test_valid_fail_eq_bytes.py index 073bcd7a0..13177409c 100644 --- a/spec/python/spec/test_valid_fail_eq_bytes.py +++ b/spec/python/spec/test_valid_fail_eq_bytes.py @@ -3,7 +3,7 @@ import unittest import kaitaistruct -from valid_fail_eq_bytes import ValidFailEqBytes +from testformats.valid_fail_eq_bytes import ValidFailEqBytes class TestValidFailEqBytes(unittest.TestCase): def test_valid_fail_eq_bytes(self): diff --git a/spec/python/spec/test_valid_fail_eq_int.py b/spec/python/spec/test_valid_fail_eq_int.py index 3437e696c..46852b8d0 100644 --- a/spec/python/spec/test_valid_fail_eq_int.py +++ b/spec/python/spec/test_valid_fail_eq_int.py @@ -3,7 +3,7 @@ import unittest import kaitaistruct -from valid_fail_eq_int import ValidFailEqInt +from testformats.valid_fail_eq_int import ValidFailEqInt class TestValidFailEqInt(unittest.TestCase): def test_valid_fail_eq_int(self): diff --git a/spec/python/spec/test_valid_fail_eq_str.py b/spec/python/spec/test_valid_fail_eq_str.py index f962e186f..58c20f8ab 100644 --- a/spec/python/spec/test_valid_fail_eq_str.py +++ b/spec/python/spec/test_valid_fail_eq_str.py @@ -3,7 +3,7 @@ import unittest import kaitaistruct -from valid_fail_eq_str import ValidFailEqStr +from testformats.valid_fail_eq_str import ValidFailEqStr class TestValidFailEqStr(unittest.TestCase): def test_valid_fail_eq_str(self): diff --git a/spec/python/spec/test_valid_fail_expr.py b/spec/python/spec/test_valid_fail_expr.py index 720f6327e..f1f64887a 100644 --- a/spec/python/spec/test_valid_fail_expr.py +++ b/spec/python/spec/test_valid_fail_expr.py @@ -3,7 +3,7 @@ import unittest import kaitaistruct -from valid_fail_expr import ValidFailExpr +from testformats.valid_fail_expr import ValidFailExpr class TestValidFailExpr(unittest.TestCase): def test_valid_fail_expr(self): diff --git a/spec/python/spec/test_valid_fail_inst.py b/spec/python/spec/test_valid_fail_inst.py index a694cd092..26bfbedd4 100644 --- a/spec/python/spec/test_valid_fail_inst.py +++ b/spec/python/spec/test_valid_fail_inst.py @@ -3,7 +3,7 @@ import unittest import kaitaistruct -from valid_fail_inst import ValidFailInst +from testformats.valid_fail_inst import ValidFailInst class TestValidFailInst(unittest.TestCase): def test_valid_fail_inst(self): diff --git a/spec/python/spec/test_valid_fail_max_int.py b/spec/python/spec/test_valid_fail_max_int.py index 894a5b9e3..68387d67f 100644 --- a/spec/python/spec/test_valid_fail_max_int.py +++ b/spec/python/spec/test_valid_fail_max_int.py @@ -3,7 +3,7 @@ import unittest import kaitaistruct -from valid_fail_max_int import ValidFailMaxInt +from testformats.valid_fail_max_int import ValidFailMaxInt class TestValidFailMaxInt(unittest.TestCase): def test_valid_fail_max_int(self): diff --git a/spec/python/spec/test_valid_fail_min_int.py b/spec/python/spec/test_valid_fail_min_int.py index b67339961..aa5a1a5f0 100644 --- a/spec/python/spec/test_valid_fail_min_int.py +++ b/spec/python/spec/test_valid_fail_min_int.py @@ -3,7 +3,7 @@ import unittest import kaitaistruct -from valid_fail_min_int import ValidFailMinInt +from testformats.valid_fail_min_int import ValidFailMinInt class TestValidFailMinInt(unittest.TestCase): def test_valid_fail_min_int(self): diff --git a/spec/python/spec/test_valid_fail_range_bytes.py b/spec/python/spec/test_valid_fail_range_bytes.py index 238d444a8..ed7c4a13d 100644 --- a/spec/python/spec/test_valid_fail_range_bytes.py +++ b/spec/python/spec/test_valid_fail_range_bytes.py @@ -3,7 +3,7 @@ import unittest import kaitaistruct -from valid_fail_range_bytes import ValidFailRangeBytes +from testformats.valid_fail_range_bytes import ValidFailRangeBytes class TestValidFailRangeBytes(unittest.TestCase): def test_valid_fail_range_bytes(self): diff --git a/spec/python/spec/test_valid_fail_range_float.py b/spec/python/spec/test_valid_fail_range_float.py index cd02be90a..f6b8bbb82 100644 --- a/spec/python/spec/test_valid_fail_range_float.py +++ b/spec/python/spec/test_valid_fail_range_float.py @@ -3,7 +3,7 @@ import unittest import kaitaistruct -from valid_fail_range_float import ValidFailRangeFloat +from testformats.valid_fail_range_float import ValidFailRangeFloat class TestValidFailRangeFloat(unittest.TestCase): def test_valid_fail_range_float(self): diff --git a/spec/python/spec/test_valid_fail_range_int.py b/spec/python/spec/test_valid_fail_range_int.py index 912b3eb00..63f08f79a 100644 --- a/spec/python/spec/test_valid_fail_range_int.py +++ b/spec/python/spec/test_valid_fail_range_int.py @@ -3,7 +3,7 @@ import unittest import kaitaistruct -from valid_fail_range_int import ValidFailRangeInt +from testformats.valid_fail_range_int import ValidFailRangeInt class TestValidFailRangeInt(unittest.TestCase): def test_valid_fail_range_int(self): diff --git a/spec/python/spec/test_valid_fail_range_str.py b/spec/python/spec/test_valid_fail_range_str.py index 2afeb981c..905d310eb 100644 --- a/spec/python/spec/test_valid_fail_range_str.py +++ b/spec/python/spec/test_valid_fail_range_str.py @@ -3,7 +3,7 @@ import unittest import kaitaistruct -from valid_fail_range_str import ValidFailRangeStr +from testformats.valid_fail_range_str import ValidFailRangeStr class TestValidFailRangeStr(unittest.TestCase): def test_valid_fail_range_str(self): diff --git a/spec/python/spec/test_valid_long.py b/spec/python/spec/test_valid_long.py index 74b43eb3d..5e5a45301 100644 --- a/spec/python/spec/test_valid_long.py +++ b/spec/python/spec/test_valid_long.py @@ -2,7 +2,7 @@ import unittest -from valid_long import ValidLong +from testformats.valid_long import ValidLong class TestValidLong(unittest.TestCase): def test_valid_long(self): diff --git a/spec/python/spec/test_valid_not_parsed_if.py b/spec/python/spec/test_valid_not_parsed_if.py index 2224a5673..f785aa82c 100644 --- a/spec/python/spec/test_valid_not_parsed_if.py +++ b/spec/python/spec/test_valid_not_parsed_if.py @@ -2,7 +2,7 @@ import unittest -from valid_not_parsed_if import ValidNotParsedIf +from testformats.valid_not_parsed_if import ValidNotParsedIf class TestValidNotParsedIf(unittest.TestCase): def test_valid_not_parsed_if(self): diff --git a/spec/python/spec/test_valid_optional_id.py b/spec/python/spec/test_valid_optional_id.py index 7a4b5cc4e..7d0ba6d5d 100644 --- a/spec/python/spec/test_valid_optional_id.py +++ b/spec/python/spec/test_valid_optional_id.py @@ -2,7 +2,7 @@ import unittest -from valid_optional_id import ValidOptionalId +from testformats.valid_optional_id import ValidOptionalId class TestValidOptionalId(unittest.TestCase): def test_valid_optional_id(self): diff --git a/spec/python/spec/test_valid_short.py b/spec/python/spec/test_valid_short.py index 44235b62f..b2b085cf5 100644 --- a/spec/python/spec/test_valid_short.py +++ b/spec/python/spec/test_valid_short.py @@ -2,7 +2,7 @@ import unittest -from valid_short import ValidShort +from testformats.valid_short import ValidShort class TestValidShort(unittest.TestCase): def test_valid_short(self): diff --git a/spec/python/spec/test_valid_switch.py b/spec/python/spec/test_valid_switch.py index 926eff722..35a37fee5 100644 --- a/spec/python/spec/test_valid_switch.py +++ b/spec/python/spec/test_valid_switch.py @@ -2,7 +2,7 @@ import unittest -from valid_switch import ValidSwitch +from testformats.valid_switch import ValidSwitch class TestValidSwitch(unittest.TestCase): def test_valid_switch(self): diff --git a/spec/python/spec/test_yaml_ints.py b/spec/python/spec/test_yaml_ints.py index d38c42c45..402991c1f 100644 --- a/spec/python/spec/test_yaml_ints.py +++ b/spec/python/spec/test_yaml_ints.py @@ -2,7 +2,7 @@ import unittest -from yaml_ints import YamlInts +from testformats.yaml_ints import YamlInts class TestYamlInts(unittest.TestCase): def test_yaml_ints(self): diff --git a/spec/python/spec/test_zlib_surrounded.py b/spec/python/spec/test_zlib_surrounded.py index 4a22da881..857140495 100644 --- a/spec/python/spec/test_zlib_surrounded.py +++ b/spec/python/spec/test_zlib_surrounded.py @@ -2,7 +2,7 @@ import unittest -from zlib_surrounded import ZlibSurrounded +from testformats.zlib_surrounded import ZlibSurrounded class TestZlibSurrounded(unittest.TestCase): def test_zlib_surrounded(self): diff --git a/spec/python/spec/test_zlib_with_header_78.py b/spec/python/spec/test_zlib_with_header_78.py index 914ab51ca..f220f0bd2 100644 --- a/spec/python/spec/test_zlib_with_header_78.py +++ b/spec/python/spec/test_zlib_with_header_78.py @@ -2,7 +2,7 @@ import unittest -from zlib_with_header_78 import ZlibWithHeader78 +from testformats.zlib_with_header_78 import ZlibWithHeader78 class TestZlibWithHeader78(unittest.TestCase): def test_zlib_with_header_78(self): From c7062c36f7d356791e610e1db9fdeac2f5e3fb9c Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Sun, 26 Feb 2023 18:17:24 +0100 Subject: [PATCH 079/126] Port read-write roundtrip test code to specwrite/common_spec.py See https://github.com/kaitai-io/kaitai_struct_tests/blob/9bbbc1af/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java --- spec/python/specwrite/__init__.py | 0 spec/python/specwrite/common_spec.py | 109 +++++++++++++++++++++++++++ 2 files changed, 109 insertions(+) create mode 100644 spec/python/specwrite/__init__.py create mode 100644 spec/python/specwrite/common_spec.py diff --git a/spec/python/specwrite/__init__.py b/spec/python/specwrite/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/spec/python/specwrite/common_spec.py b/spec/python/specwrite/common_spec.py new file mode 100644 index 000000000..4dfc6430a --- /dev/null +++ b/spec/python/specwrite/common_spec.py @@ -0,0 +1,109 @@ +import unittest +import io +from kaitaistruct import KaitaiStream, KaitaiStruct + +import binascii + +# A little hack from https://stackoverflow.com/a/25695512 to trick 'unittest' +# into thinking that CommonSpec.Base is not a test by itself. +class CommonSpec: + + class Base(unittest.TestCase): + def test_read_write_roundtrip(self): + orig_f = io.open(self.src_filename, 'rb') + + try: + orig_ks = self.struct_class.from_io(orig_f) + orig_ks._read() + + orig_dump = CommonSpec.Base.dump_struct(orig_ks) + + orig_io_size = orig_ks._io.size() + finally: + orig_f.close() + + with KaitaiStream(io.BytesIO(bytes(orig_io_size))) as new_io: + orig_ks._write(new_io) + new_io.seek(0) + + new_ks = self.struct_class(new_io) + new_ks._read() + + new_dump = CommonSpec.Base.dump_struct(new_ks) + + self.assertEqual(orig_dump, new_dump) + + @staticmethod + def dump_struct(obj): + return CommonSpec.Base.dump_struct_value(obj, [], 50, '/') + + @staticmethod + def dump_struct_value(value, parent_structs, recursion_depth_limit, current_path): + if recursion_depth_limit < 0: + raise RuntimeError("recursion depth limit reached") + + if isinstance(value, KaitaiStruct): + dump = {} + for obj, ref in parent_structs: + if value is obj: + dump['$ref'] = ref + return dump + + parent_structs.append((value, current_path)) + + for prop_name in dir(value): + if prop_name.startswith('__'): + continue + prop_value = getattr(value, prop_name) + + if isinstance(prop_value, type): + continue + + # call all _check*() methods + if prop_name.startswith('_check'): + prop_value() + continue + + if callable(prop_value): + continue + + if ( + prop_name == '_io' or \ + prop_name.startswith('_raw_') + ): + continue + + if ( + prop_name.startswith('_should_write') or \ + prop_name.endswith('__outer_size') or \ + prop_name.endswith('__inner_size') or \ + prop_name.endswith('__to_write') + ): + continue + + dump[prop_name] = CommonSpec.Base.dump_struct_value( + prop_value, parent_structs, recursion_depth_limit - 1, + current_path + ('' if current_path == '/' else '/') + prop_name + ) + + assert parent_structs.pop()[0] is value + + return dump + + if isinstance(value, list): + dump = [ + CommonSpec.Base.dump_struct_value( + item, parent_structs, recursion_depth_limit - 1, + current_path + ('' if current_path == '/' else '/') + str(i) + ) + for i, item in enumerate(value) + ] + return dump + + if isinstance(value, KaitaiStream): + value = value.to_byte_array() + + if isinstance(value, (bytes, bytearray)): + value = binascii.hexlify(value, ' ').decode('ascii') + + return value From c50da9ac4c53af8d2c57a0dfa823c1eef4304b11 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Sun, 26 Feb 2023 18:20:58 +0100 Subject: [PATCH 080/126] Add PythonWriteSG to KST translator See https://github.com/kaitai-io/kaitai_struct_tests/commit/8732152330e2777bbae0e3d86251977b079982dc --- .../testtranslator/TestTranslator.scala | 6 +- .../specgenerators/PythonWriteSG.scala | 57 +++++++++++++++++++ 2 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 translator/src/main/scala/io/kaitai/struct/testtranslator/specgenerators/PythonWriteSG.scala diff --git a/translator/src/main/scala/io/kaitai/struct/testtranslator/TestTranslator.scala b/translator/src/main/scala/io/kaitai/struct/testtranslator/TestTranslator.scala index ea876c203..53674817e 100644 --- a/translator/src/main/scala/io/kaitai/struct/testtranslator/TestTranslator.scala +++ b/translator/src/main/scala/io/kaitai/struct/testtranslator/TestTranslator.scala @@ -122,7 +122,11 @@ class TestTranslator(options: CLIOptions) { case "nim" => new NimSG(testSpec, provider) case "perl" => new PerlSG(testSpec, provider) case "php" => new PHPSG(testSpec, provider) - case "python" => new PythonSG(testSpec, provider) + case "python" => if (options.readWrite) { + new PythonWriteSG(testSpec, provider) + } else { + new PythonSG(testSpec, provider) + } case "ruby" => new RubySG(testSpec, provider) case "rust" => new RustSG(testSpec, provider) } diff --git a/translator/src/main/scala/io/kaitai/struct/testtranslator/specgenerators/PythonWriteSG.scala b/translator/src/main/scala/io/kaitai/struct/testtranslator/specgenerators/PythonWriteSG.scala new file mode 100644 index 000000000..c6e73c824 --- /dev/null +++ b/translator/src/main/scala/io/kaitai/struct/testtranslator/specgenerators/PythonWriteSG.scala @@ -0,0 +1,57 @@ +package io.kaitai.struct.testtranslator.specgenerators + +import _root_.io.kaitai.struct.ClassTypeProvider +import _root_.io.kaitai.struct.datatype.{DataType, KSError, EndOfStreamError} +import _root_.io.kaitai.struct.exprlang.Ast +import _root_.io.kaitai.struct.languages.PythonCompiler +import _root_.io.kaitai.struct.testtranslator.{Main, TestAssert, TestSpec} +import _root_.io.kaitai.struct.translators.PythonTranslator + +class PythonWriteSG(spec: TestSpec, provider: ClassTypeProvider) extends BaseGenerator(spec) { + importList.add("import unittest") + importList.add("from specwrite.common_spec import CommonSpec") + + val translator = new PythonTranslator(provider, importList) + val className = PythonCompiler.type2class(spec.id) + + override def fileName(name: String): String = s"specwrite/test_$name.py" + + override def indentStr: String = " " + + override def header(): Unit = { + out.puts + out.puts(s"from testwrite.${spec.id} import $className") + out.puts + val testClassName = s"Test$className" + out.puts(s"class $testClassName(CommonSpec.Base):") + out.inc + + out.puts("def __init__(self, *args, **kwargs):") + out.inc + out.puts(s"super($testClassName, self).__init__(*args, **kwargs)") + out.puts(s"self.struct_class = $className") + out.puts(s"self.src_filename = 'src/${spec.data}'") + out.dec + } + + override def runParse(): Unit = {} + + override def runParseExpectError(exception: KSError): Unit = { + out.puts + out.puts("def test_read_write_roundtrip(self):") + out.inc + out.puts("""self.skipTest("cannot use roundtrip because parsing is expected to fail")""") + out.dec + } + + override def footer(): Unit = {} + + override def runAsserts(): Unit = {} + + override def simpleAssert(check: TestAssert): Unit = ??? + override def nullAssert(actual: Ast.expr): Unit = ??? + override def trueArrayAssert(check: TestAssert, elType: DataType, elts: Seq[Ast.expr]): Unit = ??? + + override def results: String = + "# " + AUTOGEN_COMMENT + "\n\n" + super.results +} From ef856baa63b9634953347619a0852fb094ea5ce1 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Sun, 26 Feb 2023 18:21:28 +0100 Subject: [PATCH 081/126] Regen Python write tests from KST --- spec/python/specwrite/test_bcd_user_type_be.py | 13 +++++++++++++ spec/python/specwrite/test_bcd_user_type_le.py | 13 +++++++++++++ spec/python/specwrite/test_bits_byte_aligned.py | 13 +++++++++++++ spec/python/specwrite/test_bits_enum.py | 13 +++++++++++++ .../specwrite/test_bits_seq_endian_combo.py | 13 +++++++++++++ .../python/specwrite/test_bits_shift_by_b32_le.py | 13 +++++++++++++ .../python/specwrite/test_bits_shift_by_b64_le.py | 13 +++++++++++++ .../specwrite/test_bits_signed_res_b32_be.py | 13 +++++++++++++ .../specwrite/test_bits_signed_res_b32_le.py | 13 +++++++++++++ .../specwrite/test_bits_signed_shift_b32_le.py | 13 +++++++++++++ .../specwrite/test_bits_signed_shift_b64_le.py | 13 +++++++++++++ spec/python/specwrite/test_bits_simple.py | 13 +++++++++++++ spec/python/specwrite/test_bits_simple_le.py | 13 +++++++++++++ .../specwrite/test_bits_unaligned_b32_be.py | 13 +++++++++++++ .../specwrite/test_bits_unaligned_b32_le.py | 13 +++++++++++++ .../specwrite/test_bits_unaligned_b64_be.py | 13 +++++++++++++ .../specwrite/test_bits_unaligned_b64_le.py | 13 +++++++++++++ spec/python/specwrite/test_buffered_struct.py | 13 +++++++++++++ spec/python/specwrite/test_bytes_eos_pad_term.py | 13 +++++++++++++ spec/python/specwrite/test_bytes_pad_term.py | 13 +++++++++++++ .../python/specwrite/test_bytes_pad_term_empty.py | 13 +++++++++++++ .../python/specwrite/test_bytes_pad_term_equal.py | 13 +++++++++++++ .../specwrite/test_bytes_pad_term_roundtrip.py | 13 +++++++++++++ .../specwrite/test_bytes_pad_term_zero_size.py | 13 +++++++++++++ spec/python/specwrite/test_cast_nested.py | 13 +++++++++++++ spec/python/specwrite/test_cast_to_imported.py | 13 +++++++++++++ spec/python/specwrite/test_cast_to_top.py | 13 +++++++++++++ spec/python/specwrite/test_combine_bool.py | 13 +++++++++++++ spec/python/specwrite/test_combine_bytes.py | 13 +++++++++++++ spec/python/specwrite/test_combine_enum.py | 13 +++++++++++++ spec/python/specwrite/test_combine_str.py | 13 +++++++++++++ spec/python/specwrite/test_debug_0.py | 13 +++++++++++++ spec/python/specwrite/test_debug_array_user.py | 13 +++++++++++++ spec/python/specwrite/test_debug_enum_name.py | 13 +++++++++++++ spec/python/specwrite/test_debug_switch_user.py | 13 +++++++++++++ spec/python/specwrite/test_default_big_endian.py | 13 +++++++++++++ .../specwrite/test_default_bit_endian_mod.py | 13 +++++++++++++ .../test_default_endian_expr_exception.py | 15 +++++++++++++++ .../test_default_endian_expr_inherited.py | 13 +++++++++++++ .../specwrite/test_default_endian_expr_is_be.py | 13 +++++++++++++ .../specwrite/test_default_endian_expr_is_le.py | 13 +++++++++++++ spec/python/specwrite/test_default_endian_mod.py | 13 +++++++++++++ spec/python/specwrite/test_docstrings.py | 13 +++++++++++++ spec/python/specwrite/test_docstrings_docref.py | 13 +++++++++++++ .../specwrite/test_docstrings_docref_multi.py | 13 +++++++++++++ spec/python/specwrite/test_enum_0.py | 13 +++++++++++++ spec/python/specwrite/test_enum_1.py | 13 +++++++++++++ spec/python/specwrite/test_enum_deep.py | 13 +++++++++++++ spec/python/specwrite/test_enum_deep_literals.py | 13 +++++++++++++ spec/python/specwrite/test_enum_fancy.py | 13 +++++++++++++ spec/python/specwrite/test_enum_for_unknown_id.py | 13 +++++++++++++ spec/python/specwrite/test_enum_if.py | 13 +++++++++++++ spec/python/specwrite/test_enum_import.py | 13 +++++++++++++ spec/python/specwrite/test_enum_int_range_s.py | 13 +++++++++++++ spec/python/specwrite/test_enum_int_range_u.py | 13 +++++++++++++ spec/python/specwrite/test_enum_invalid.py | 13 +++++++++++++ spec/python/specwrite/test_enum_long_range_s.py | 13 +++++++++++++ spec/python/specwrite/test_enum_long_range_u.py | 13 +++++++++++++ spec/python/specwrite/test_enum_negative.py | 13 +++++++++++++ spec/python/specwrite/test_enum_of_value_inst.py | 13 +++++++++++++ spec/python/specwrite/test_enum_to_i.py | 13 +++++++++++++ .../specwrite/test_enum_to_i_class_border_1.py | 13 +++++++++++++ spec/python/specwrite/test_eof_exception_bytes.py | 15 +++++++++++++++ spec/python/specwrite/test_eof_exception_u4.py | 15 +++++++++++++++ spec/python/specwrite/test_eos_exception_bytes.py | 15 +++++++++++++++ spec/python/specwrite/test_eos_exception_u4.py | 15 +++++++++++++++ spec/python/specwrite/test_expr_0.py | 13 +++++++++++++ spec/python/specwrite/test_expr_1.py | 13 +++++++++++++ spec/python/specwrite/test_expr_2.py | 13 +++++++++++++ spec/python/specwrite/test_expr_3.py | 13 +++++++++++++ spec/python/specwrite/test_expr_array.py | 13 +++++++++++++ spec/python/specwrite/test_expr_bits.py | 13 +++++++++++++ spec/python/specwrite/test_expr_bytes_cmp.py | 13 +++++++++++++ .../specwrite/test_expr_bytes_non_literal.py | 13 +++++++++++++ spec/python/specwrite/test_expr_bytes_ops.py | 13 +++++++++++++ spec/python/specwrite/test_expr_calc_array_ops.py | 13 +++++++++++++ spec/python/specwrite/test_expr_enum.py | 13 +++++++++++++ spec/python/specwrite/test_expr_if_int_eq.py | 13 +++++++++++++ spec/python/specwrite/test_expr_if_int_ops.py | 13 +++++++++++++ spec/python/specwrite/test_expr_int_div.py | 13 +++++++++++++ spec/python/specwrite/test_expr_io_eof.py | 13 +++++++++++++ spec/python/specwrite/test_expr_io_pos.py | 13 +++++++++++++ spec/python/specwrite/test_expr_mod.py | 13 +++++++++++++ spec/python/specwrite/test_expr_ops_parens.py | 13 +++++++++++++ spec/python/specwrite/test_expr_sizeof_type_0.py | 13 +++++++++++++ spec/python/specwrite/test_expr_sizeof_type_1.py | 13 +++++++++++++ spec/python/specwrite/test_expr_sizeof_value_0.py | 13 +++++++++++++ .../specwrite/test_expr_sizeof_value_sized.py | 13 +++++++++++++ spec/python/specwrite/test_expr_str_encodings.py | 13 +++++++++++++ spec/python/specwrite/test_expr_str_ops.py | 13 +++++++++++++ spec/python/specwrite/test_fixed_contents.py | 13 +++++++++++++ spec/python/specwrite/test_fixed_struct.py | 13 +++++++++++++ spec/python/specwrite/test_float_to_i.py | 13 +++++++++++++ spec/python/specwrite/test_floating_points.py | 13 +++++++++++++ spec/python/specwrite/test_hello_world.py | 13 +++++++++++++ spec/python/specwrite/test_if_instances.py | 13 +++++++++++++ spec/python/specwrite/test_if_struct.py | 13 +++++++++++++ spec/python/specwrite/test_if_values.py | 13 +++++++++++++ spec/python/specwrite/test_imports0.py | 13 +++++++++++++ spec/python/specwrite/test_imports_abs.py | 13 +++++++++++++ spec/python/specwrite/test_imports_circular_a.py | 13 +++++++++++++ spec/python/specwrite/test_imports_rel_1.py | 13 +++++++++++++ spec/python/specwrite/test_index_sizes.py | 13 +++++++++++++ spec/python/specwrite/test_index_to_param_eos.py | 13 +++++++++++++ spec/python/specwrite/test_index_to_param_expr.py | 13 +++++++++++++ .../python/specwrite/test_index_to_param_until.py | 13 +++++++++++++ .../specwrite/test_instance_in_repeat_expr.py | 13 +++++++++++++ .../specwrite/test_instance_in_repeat_until.py | 13 +++++++++++++ spec/python/specwrite/test_instance_in_sized.py | 13 +++++++++++++ spec/python/specwrite/test_instance_io_user.py | 13 +++++++++++++ .../specwrite/test_instance_io_user_earlier.py | 13 +++++++++++++ spec/python/specwrite/test_instance_std.py | 13 +++++++++++++ spec/python/specwrite/test_instance_std_array.py | 13 +++++++++++++ spec/python/specwrite/test_instance_user_array.py | 13 +++++++++++++ spec/python/specwrite/test_integers.py | 13 +++++++++++++ .../specwrite/test_integers_double_overflow.py | 13 +++++++++++++ spec/python/specwrite/test_integers_min_max.py | 13 +++++++++++++ spec/python/specwrite/test_io_local_var.py | 13 +++++++++++++ .../specwrite/test_js_signed_right_shift.py | 13 +++++++++++++ spec/python/specwrite/test_meta_tags.py | 13 +++++++++++++ spec/python/specwrite/test_meta_xref.py | 13 +++++++++++++ spec/python/specwrite/test_multiple_use.py | 13 +++++++++++++ spec/python/specwrite/test_nav_parent.py | 13 +++++++++++++ spec/python/specwrite/test_nav_parent2.py | 13 +++++++++++++ spec/python/specwrite/test_nav_parent3.py | 13 +++++++++++++ spec/python/specwrite/test_nav_parent_false.py | 13 +++++++++++++ spec/python/specwrite/test_nav_parent_false2.py | 13 +++++++++++++ spec/python/specwrite/test_nav_parent_override.py | 13 +++++++++++++ spec/python/specwrite/test_nav_parent_switch.py | 13 +++++++++++++ .../specwrite/test_nav_parent_switch_cast.py | 13 +++++++++++++ .../specwrite/test_nav_parent_vs_value_inst.py | 13 +++++++++++++ spec/python/specwrite/test_nav_root.py | 13 +++++++++++++ spec/python/specwrite/test_nested_same_name.py | 13 +++++++++++++ spec/python/specwrite/test_nested_same_name2.py | 13 +++++++++++++ spec/python/specwrite/test_nested_type_param.py | 13 +++++++++++++ spec/python/specwrite/test_nested_types.py | 13 +++++++++++++ spec/python/specwrite/test_nested_types2.py | 13 +++++++++++++ spec/python/specwrite/test_nested_types3.py | 13 +++++++++++++ spec/python/specwrite/test_non_standard.py | 13 +++++++++++++ .../python/specwrite/test_opaque_external_type.py | 13 +++++++++++++ spec/python/specwrite/test_optional_id.py | 13 +++++++++++++ .../specwrite/test_params_call_extra_parens.py | 13 +++++++++++++ spec/python/specwrite/test_params_call_short.py | 13 +++++++++++++ spec/python/specwrite/test_params_enum.py | 13 +++++++++++++ .../specwrite/test_params_pass_array_int.py | 13 +++++++++++++ .../python/specwrite/test_params_pass_array_io.py | 13 +++++++++++++ .../specwrite/test_params_pass_array_str.py | 13 +++++++++++++ .../specwrite/test_params_pass_array_struct.py | 13 +++++++++++++ .../specwrite/test_params_pass_array_usertype.py | 13 +++++++++++++ spec/python/specwrite/test_params_pass_bool.py | 13 +++++++++++++ spec/python/specwrite/test_params_pass_io.py | 13 +++++++++++++ spec/python/specwrite/test_params_pass_struct.py | 13 +++++++++++++ .../python/specwrite/test_params_pass_usertype.py | 13 +++++++++++++ spec/python/specwrite/test_position_abs.py | 13 +++++++++++++ spec/python/specwrite/test_position_in_seq.py | 13 +++++++++++++ spec/python/specwrite/test_position_to_end.py | 13 +++++++++++++ .../specwrite/test_process_bytes_pad_term.py | 13 +++++++++++++ .../python/specwrite/test_process_coerce_bytes.py | 13 +++++++++++++ .../specwrite/test_process_coerce_switch.py | 13 +++++++++++++ .../specwrite/test_process_coerce_usertype1.py | 13 +++++++++++++ .../specwrite/test_process_coerce_usertype2.py | 13 +++++++++++++ spec/python/specwrite/test_process_custom.py | 13 +++++++++++++ .../specwrite/test_process_custom_no_args.py | 13 +++++++++++++ .../python/specwrite/test_process_repeat_bytes.py | 13 +++++++++++++ .../specwrite/test_process_repeat_usertype.py | 13 +++++++++++++ .../test_process_repeat_usertype_dynarg_custom.py | 13 +++++++++++++ .../test_process_repeat_usertype_dynarg_rotate.py | 13 +++++++++++++ .../test_process_repeat_usertype_dynarg_xor.py | 13 +++++++++++++ spec/python/specwrite/test_process_rotate.py | 13 +++++++++++++ .../specwrite/test_process_struct_pad_term.py | 13 +++++++++++++ spec/python/specwrite/test_process_term_struct.py | 13 +++++++++++++ spec/python/specwrite/test_process_to_user.py | 13 +++++++++++++ spec/python/specwrite/test_process_xor4_const.py | 13 +++++++++++++ spec/python/specwrite/test_process_xor4_value.py | 13 +++++++++++++ spec/python/specwrite/test_process_xor_const.py | 13 +++++++++++++ spec/python/specwrite/test_process_xor_value.py | 13 +++++++++++++ spec/python/specwrite/test_recursive_one.py | 13 +++++++++++++ spec/python/specwrite/test_repeat_eos_bit.py | 13 +++++++++++++ spec/python/specwrite/test_repeat_eos_bytes.py | 13 +++++++++++++ .../python/specwrite/test_repeat_eos_bytes_pad.py | 13 +++++++++++++ .../specwrite/test_repeat_eos_bytes_pad_term.py | 13 +++++++++++++ spec/python/specwrite/test_repeat_eos_struct.py | 13 +++++++++++++ .../specwrite/test_repeat_eos_term_bytes.py | 13 +++++++++++++ .../specwrite/test_repeat_eos_term_struct.py | 13 +++++++++++++ spec/python/specwrite/test_repeat_eos_u4.py | 13 +++++++++++++ spec/python/specwrite/test_repeat_n_bytes.py | 13 +++++++++++++ spec/python/specwrite/test_repeat_n_bytes_pad.py | 13 +++++++++++++ .../specwrite/test_repeat_n_bytes_pad_term.py | 13 +++++++++++++ spec/python/specwrite/test_repeat_n_struct.py | 13 +++++++++++++ spec/python/specwrite/test_repeat_n_strz.py | 13 +++++++++++++ .../python/specwrite/test_repeat_n_strz_double.py | 13 +++++++++++++ spec/python/specwrite/test_repeat_n_term_bytes.py | 13 +++++++++++++ .../python/specwrite/test_repeat_n_term_struct.py | 13 +++++++++++++ spec/python/specwrite/test_repeat_until_bytes.py | 13 +++++++++++++ .../specwrite/test_repeat_until_bytes_pad.py | 13 +++++++++++++ .../specwrite/test_repeat_until_bytes_pad_term.py | 13 +++++++++++++ .../test_repeat_until_calc_array_type.py | 13 +++++++++++++ .../python/specwrite/test_repeat_until_complex.py | 13 +++++++++++++ spec/python/specwrite/test_repeat_until_s4.py | 13 +++++++++++++ spec/python/specwrite/test_repeat_until_sized.py | 13 +++++++++++++ .../specwrite/test_repeat_until_term_bytes.py | 13 +++++++++++++ .../specwrite/test_repeat_until_term_struct.py | 13 +++++++++++++ spec/python/specwrite/test_str_encodings.py | 13 +++++++++++++ .../specwrite/test_str_encodings_default.py | 13 +++++++++++++ spec/python/specwrite/test_str_encodings_utf16.py | 13 +++++++++++++ spec/python/specwrite/test_str_eos.py | 13 +++++++++++++ spec/python/specwrite/test_str_eos_pad_term.py | 13 +++++++++++++ .../specwrite/test_str_eos_pad_term_empty.py | 13 +++++++++++++ .../specwrite/test_str_eos_pad_term_equal.py | 13 +++++++++++++ spec/python/specwrite/test_str_literals2.py | 13 +++++++++++++ spec/python/specwrite/test_str_pad_term.py | 13 +++++++++++++ spec/python/specwrite/test_str_pad_term_empty.py | 13 +++++++++++++ spec/python/specwrite/test_str_pad_term_equal.py | 13 +++++++++++++ .../specwrite/test_str_pad_term_roundtrip.py | 13 +++++++++++++ .../specwrite/test_str_pad_term_zero_size.py | 13 +++++++++++++ spec/python/specwrite/test_struct_pad_term.py | 13 +++++++++++++ .../specwrite/test_struct_pad_term_equal.py | 13 +++++++++++++ spec/python/specwrite/test_switch_bytearray.py | 13 +++++++++++++ spec/python/specwrite/test_switch_else_only.py | 13 +++++++++++++ spec/python/specwrite/test_switch_integers.py | 13 +++++++++++++ spec/python/specwrite/test_switch_integers2.py | 13 +++++++++++++ spec/python/specwrite/test_switch_manual_enum.py | 13 +++++++++++++ .../specwrite/test_switch_manual_enum_invalid.py | 13 +++++++++++++ .../test_switch_manual_enum_invalid_else.py | 13 +++++++++++++ spec/python/specwrite/test_switch_manual_int.py | 13 +++++++++++++ .../specwrite/test_switch_manual_int_else.py | 13 +++++++++++++ .../specwrite/test_switch_manual_int_size.py | 13 +++++++++++++ .../specwrite/test_switch_manual_int_size_else.py | 13 +++++++++++++ .../specwrite/test_switch_manual_int_size_eos.py | 13 +++++++++++++ spec/python/specwrite/test_switch_manual_str.py | 13 +++++++++++++ .../specwrite/test_switch_manual_str_else.py | 13 +++++++++++++ .../specwrite/test_switch_multi_bool_ops.py | 13 +++++++++++++ spec/python/specwrite/test_switch_repeat_expr.py | 13 +++++++++++++ .../specwrite/test_switch_repeat_expr_invalid.py | 13 +++++++++++++ spec/python/specwrite/test_term_bytes.py | 13 +++++++++++++ spec/python/specwrite/test_term_bytes2.py | 13 +++++++++++++ spec/python/specwrite/test_term_bytes3.py | 13 +++++++++++++ spec/python/specwrite/test_term_bytes4.py | 13 +++++++++++++ spec/python/specwrite/test_term_struct.py | 13 +++++++++++++ spec/python/specwrite/test_term_struct2.py | 13 +++++++++++++ spec/python/specwrite/test_term_struct3.py | 13 +++++++++++++ spec/python/specwrite/test_term_struct4.py | 13 +++++++++++++ spec/python/specwrite/test_term_strz.py | 13 +++++++++++++ spec/python/specwrite/test_term_strz2.py | 13 +++++++++++++ spec/python/specwrite/test_term_strz3.py | 13 +++++++++++++ spec/python/specwrite/test_term_strz4.py | 13 +++++++++++++ spec/python/specwrite/test_term_u1_val.py | 13 +++++++++++++ spec/python/specwrite/test_ts_packet_header.py | 13 +++++++++++++ spec/python/specwrite/test_type_int_unary_op.py | 13 +++++++++++++ spec/python/specwrite/test_type_ternary.py | 13 +++++++++++++ .../specwrite/test_type_ternary_2nd_falsy.py | 13 +++++++++++++ spec/python/specwrite/test_type_ternary_opaque.py | 13 +++++++++++++ spec/python/specwrite/test_user_type.py | 13 +++++++++++++ .../specwrite/test_valid_eq_str_encodings.py | 13 +++++++++++++ .../python/specwrite/test_valid_fail_anyof_int.py | 15 +++++++++++++++ spec/python/specwrite/test_valid_fail_contents.py | 15 +++++++++++++++ spec/python/specwrite/test_valid_fail_eq_bytes.py | 15 +++++++++++++++ spec/python/specwrite/test_valid_fail_eq_int.py | 15 +++++++++++++++ spec/python/specwrite/test_valid_fail_eq_str.py | 15 +++++++++++++++ spec/python/specwrite/test_valid_fail_expr.py | 15 +++++++++++++++ spec/python/specwrite/test_valid_fail_inst.py | 15 +++++++++++++++ spec/python/specwrite/test_valid_fail_max_int.py | 15 +++++++++++++++ spec/python/specwrite/test_valid_fail_min_int.py | 15 +++++++++++++++ .../specwrite/test_valid_fail_range_bytes.py | 15 +++++++++++++++ .../specwrite/test_valid_fail_range_float.py | 15 +++++++++++++++ .../python/specwrite/test_valid_fail_range_int.py | 15 +++++++++++++++ .../python/specwrite/test_valid_fail_range_str.py | 15 +++++++++++++++ spec/python/specwrite/test_valid_long.py | 13 +++++++++++++ spec/python/specwrite/test_valid_not_parsed_if.py | 13 +++++++++++++ spec/python/specwrite/test_valid_optional_id.py | 13 +++++++++++++ spec/python/specwrite/test_valid_short.py | 13 +++++++++++++ spec/python/specwrite/test_valid_switch.py | 13 +++++++++++++ spec/python/specwrite/test_yaml_ints.py | 13 +++++++++++++ spec/python/specwrite/test_zlib_surrounded.py | 13 +++++++++++++ spec/python/specwrite/test_zlib_with_header_78.py | 13 +++++++++++++ 275 files changed, 3611 insertions(+) create mode 100644 spec/python/specwrite/test_bcd_user_type_be.py create mode 100644 spec/python/specwrite/test_bcd_user_type_le.py create mode 100644 spec/python/specwrite/test_bits_byte_aligned.py create mode 100644 spec/python/specwrite/test_bits_enum.py create mode 100644 spec/python/specwrite/test_bits_seq_endian_combo.py create mode 100644 spec/python/specwrite/test_bits_shift_by_b32_le.py create mode 100644 spec/python/specwrite/test_bits_shift_by_b64_le.py create mode 100644 spec/python/specwrite/test_bits_signed_res_b32_be.py create mode 100644 spec/python/specwrite/test_bits_signed_res_b32_le.py create mode 100644 spec/python/specwrite/test_bits_signed_shift_b32_le.py create mode 100644 spec/python/specwrite/test_bits_signed_shift_b64_le.py create mode 100644 spec/python/specwrite/test_bits_simple.py create mode 100644 spec/python/specwrite/test_bits_simple_le.py create mode 100644 spec/python/specwrite/test_bits_unaligned_b32_be.py create mode 100644 spec/python/specwrite/test_bits_unaligned_b32_le.py create mode 100644 spec/python/specwrite/test_bits_unaligned_b64_be.py create mode 100644 spec/python/specwrite/test_bits_unaligned_b64_le.py create mode 100644 spec/python/specwrite/test_buffered_struct.py create mode 100644 spec/python/specwrite/test_bytes_eos_pad_term.py create mode 100644 spec/python/specwrite/test_bytes_pad_term.py create mode 100644 spec/python/specwrite/test_bytes_pad_term_empty.py create mode 100644 spec/python/specwrite/test_bytes_pad_term_equal.py create mode 100644 spec/python/specwrite/test_bytes_pad_term_roundtrip.py create mode 100644 spec/python/specwrite/test_bytes_pad_term_zero_size.py create mode 100644 spec/python/specwrite/test_cast_nested.py create mode 100644 spec/python/specwrite/test_cast_to_imported.py create mode 100644 spec/python/specwrite/test_cast_to_top.py create mode 100644 spec/python/specwrite/test_combine_bool.py create mode 100644 spec/python/specwrite/test_combine_bytes.py create mode 100644 spec/python/specwrite/test_combine_enum.py create mode 100644 spec/python/specwrite/test_combine_str.py create mode 100644 spec/python/specwrite/test_debug_0.py create mode 100644 spec/python/specwrite/test_debug_array_user.py create mode 100644 spec/python/specwrite/test_debug_enum_name.py create mode 100644 spec/python/specwrite/test_debug_switch_user.py create mode 100644 spec/python/specwrite/test_default_big_endian.py create mode 100644 spec/python/specwrite/test_default_bit_endian_mod.py create mode 100644 spec/python/specwrite/test_default_endian_expr_exception.py create mode 100644 spec/python/specwrite/test_default_endian_expr_inherited.py create mode 100644 spec/python/specwrite/test_default_endian_expr_is_be.py create mode 100644 spec/python/specwrite/test_default_endian_expr_is_le.py create mode 100644 spec/python/specwrite/test_default_endian_mod.py create mode 100644 spec/python/specwrite/test_docstrings.py create mode 100644 spec/python/specwrite/test_docstrings_docref.py create mode 100644 spec/python/specwrite/test_docstrings_docref_multi.py create mode 100644 spec/python/specwrite/test_enum_0.py create mode 100644 spec/python/specwrite/test_enum_1.py create mode 100644 spec/python/specwrite/test_enum_deep.py create mode 100644 spec/python/specwrite/test_enum_deep_literals.py create mode 100644 spec/python/specwrite/test_enum_fancy.py create mode 100644 spec/python/specwrite/test_enum_for_unknown_id.py create mode 100644 spec/python/specwrite/test_enum_if.py create mode 100644 spec/python/specwrite/test_enum_import.py create mode 100644 spec/python/specwrite/test_enum_int_range_s.py create mode 100644 spec/python/specwrite/test_enum_int_range_u.py create mode 100644 spec/python/specwrite/test_enum_invalid.py create mode 100644 spec/python/specwrite/test_enum_long_range_s.py create mode 100644 spec/python/specwrite/test_enum_long_range_u.py create mode 100644 spec/python/specwrite/test_enum_negative.py create mode 100644 spec/python/specwrite/test_enum_of_value_inst.py create mode 100644 spec/python/specwrite/test_enum_to_i.py create mode 100644 spec/python/specwrite/test_enum_to_i_class_border_1.py create mode 100644 spec/python/specwrite/test_eof_exception_bytes.py create mode 100644 spec/python/specwrite/test_eof_exception_u4.py create mode 100644 spec/python/specwrite/test_eos_exception_bytes.py create mode 100644 spec/python/specwrite/test_eos_exception_u4.py create mode 100644 spec/python/specwrite/test_expr_0.py create mode 100644 spec/python/specwrite/test_expr_1.py create mode 100644 spec/python/specwrite/test_expr_2.py create mode 100644 spec/python/specwrite/test_expr_3.py create mode 100644 spec/python/specwrite/test_expr_array.py create mode 100644 spec/python/specwrite/test_expr_bits.py create mode 100644 spec/python/specwrite/test_expr_bytes_cmp.py create mode 100644 spec/python/specwrite/test_expr_bytes_non_literal.py create mode 100644 spec/python/specwrite/test_expr_bytes_ops.py create mode 100644 spec/python/specwrite/test_expr_calc_array_ops.py create mode 100644 spec/python/specwrite/test_expr_enum.py create mode 100644 spec/python/specwrite/test_expr_if_int_eq.py create mode 100644 spec/python/specwrite/test_expr_if_int_ops.py create mode 100644 spec/python/specwrite/test_expr_int_div.py create mode 100644 spec/python/specwrite/test_expr_io_eof.py create mode 100644 spec/python/specwrite/test_expr_io_pos.py create mode 100644 spec/python/specwrite/test_expr_mod.py create mode 100644 spec/python/specwrite/test_expr_ops_parens.py create mode 100644 spec/python/specwrite/test_expr_sizeof_type_0.py create mode 100644 spec/python/specwrite/test_expr_sizeof_type_1.py create mode 100644 spec/python/specwrite/test_expr_sizeof_value_0.py create mode 100644 spec/python/specwrite/test_expr_sizeof_value_sized.py create mode 100644 spec/python/specwrite/test_expr_str_encodings.py create mode 100644 spec/python/specwrite/test_expr_str_ops.py create mode 100644 spec/python/specwrite/test_fixed_contents.py create mode 100644 spec/python/specwrite/test_fixed_struct.py create mode 100644 spec/python/specwrite/test_float_to_i.py create mode 100644 spec/python/specwrite/test_floating_points.py create mode 100644 spec/python/specwrite/test_hello_world.py create mode 100644 spec/python/specwrite/test_if_instances.py create mode 100644 spec/python/specwrite/test_if_struct.py create mode 100644 spec/python/specwrite/test_if_values.py create mode 100644 spec/python/specwrite/test_imports0.py create mode 100644 spec/python/specwrite/test_imports_abs.py create mode 100644 spec/python/specwrite/test_imports_circular_a.py create mode 100644 spec/python/specwrite/test_imports_rel_1.py create mode 100644 spec/python/specwrite/test_index_sizes.py create mode 100644 spec/python/specwrite/test_index_to_param_eos.py create mode 100644 spec/python/specwrite/test_index_to_param_expr.py create mode 100644 spec/python/specwrite/test_index_to_param_until.py create mode 100644 spec/python/specwrite/test_instance_in_repeat_expr.py create mode 100644 spec/python/specwrite/test_instance_in_repeat_until.py create mode 100644 spec/python/specwrite/test_instance_in_sized.py create mode 100644 spec/python/specwrite/test_instance_io_user.py create mode 100644 spec/python/specwrite/test_instance_io_user_earlier.py create mode 100644 spec/python/specwrite/test_instance_std.py create mode 100644 spec/python/specwrite/test_instance_std_array.py create mode 100644 spec/python/specwrite/test_instance_user_array.py create mode 100644 spec/python/specwrite/test_integers.py create mode 100644 spec/python/specwrite/test_integers_double_overflow.py create mode 100644 spec/python/specwrite/test_integers_min_max.py create mode 100644 spec/python/specwrite/test_io_local_var.py create mode 100644 spec/python/specwrite/test_js_signed_right_shift.py create mode 100644 spec/python/specwrite/test_meta_tags.py create mode 100644 spec/python/specwrite/test_meta_xref.py create mode 100644 spec/python/specwrite/test_multiple_use.py create mode 100644 spec/python/specwrite/test_nav_parent.py create mode 100644 spec/python/specwrite/test_nav_parent2.py create mode 100644 spec/python/specwrite/test_nav_parent3.py create mode 100644 spec/python/specwrite/test_nav_parent_false.py create mode 100644 spec/python/specwrite/test_nav_parent_false2.py create mode 100644 spec/python/specwrite/test_nav_parent_override.py create mode 100644 spec/python/specwrite/test_nav_parent_switch.py create mode 100644 spec/python/specwrite/test_nav_parent_switch_cast.py create mode 100644 spec/python/specwrite/test_nav_parent_vs_value_inst.py create mode 100644 spec/python/specwrite/test_nav_root.py create mode 100644 spec/python/specwrite/test_nested_same_name.py create mode 100644 spec/python/specwrite/test_nested_same_name2.py create mode 100644 spec/python/specwrite/test_nested_type_param.py create mode 100644 spec/python/specwrite/test_nested_types.py create mode 100644 spec/python/specwrite/test_nested_types2.py create mode 100644 spec/python/specwrite/test_nested_types3.py create mode 100644 spec/python/specwrite/test_non_standard.py create mode 100644 spec/python/specwrite/test_opaque_external_type.py create mode 100644 spec/python/specwrite/test_optional_id.py create mode 100644 spec/python/specwrite/test_params_call_extra_parens.py create mode 100644 spec/python/specwrite/test_params_call_short.py create mode 100644 spec/python/specwrite/test_params_enum.py create mode 100644 spec/python/specwrite/test_params_pass_array_int.py create mode 100644 spec/python/specwrite/test_params_pass_array_io.py create mode 100644 spec/python/specwrite/test_params_pass_array_str.py create mode 100644 spec/python/specwrite/test_params_pass_array_struct.py create mode 100644 spec/python/specwrite/test_params_pass_array_usertype.py create mode 100644 spec/python/specwrite/test_params_pass_bool.py create mode 100644 spec/python/specwrite/test_params_pass_io.py create mode 100644 spec/python/specwrite/test_params_pass_struct.py create mode 100644 spec/python/specwrite/test_params_pass_usertype.py create mode 100644 spec/python/specwrite/test_position_abs.py create mode 100644 spec/python/specwrite/test_position_in_seq.py create mode 100644 spec/python/specwrite/test_position_to_end.py create mode 100644 spec/python/specwrite/test_process_bytes_pad_term.py create mode 100644 spec/python/specwrite/test_process_coerce_bytes.py create mode 100644 spec/python/specwrite/test_process_coerce_switch.py create mode 100644 spec/python/specwrite/test_process_coerce_usertype1.py create mode 100644 spec/python/specwrite/test_process_coerce_usertype2.py create mode 100644 spec/python/specwrite/test_process_custom.py create mode 100644 spec/python/specwrite/test_process_custom_no_args.py create mode 100644 spec/python/specwrite/test_process_repeat_bytes.py create mode 100644 spec/python/specwrite/test_process_repeat_usertype.py create mode 100644 spec/python/specwrite/test_process_repeat_usertype_dynarg_custom.py create mode 100644 spec/python/specwrite/test_process_repeat_usertype_dynarg_rotate.py create mode 100644 spec/python/specwrite/test_process_repeat_usertype_dynarg_xor.py create mode 100644 spec/python/specwrite/test_process_rotate.py create mode 100644 spec/python/specwrite/test_process_struct_pad_term.py create mode 100644 spec/python/specwrite/test_process_term_struct.py create mode 100644 spec/python/specwrite/test_process_to_user.py create mode 100644 spec/python/specwrite/test_process_xor4_const.py create mode 100644 spec/python/specwrite/test_process_xor4_value.py create mode 100644 spec/python/specwrite/test_process_xor_const.py create mode 100644 spec/python/specwrite/test_process_xor_value.py create mode 100644 spec/python/specwrite/test_recursive_one.py create mode 100644 spec/python/specwrite/test_repeat_eos_bit.py create mode 100644 spec/python/specwrite/test_repeat_eos_bytes.py create mode 100644 spec/python/specwrite/test_repeat_eos_bytes_pad.py create mode 100644 spec/python/specwrite/test_repeat_eos_bytes_pad_term.py create mode 100644 spec/python/specwrite/test_repeat_eos_struct.py create mode 100644 spec/python/specwrite/test_repeat_eos_term_bytes.py create mode 100644 spec/python/specwrite/test_repeat_eos_term_struct.py create mode 100644 spec/python/specwrite/test_repeat_eos_u4.py create mode 100644 spec/python/specwrite/test_repeat_n_bytes.py create mode 100644 spec/python/specwrite/test_repeat_n_bytes_pad.py create mode 100644 spec/python/specwrite/test_repeat_n_bytes_pad_term.py create mode 100644 spec/python/specwrite/test_repeat_n_struct.py create mode 100644 spec/python/specwrite/test_repeat_n_strz.py create mode 100644 spec/python/specwrite/test_repeat_n_strz_double.py create mode 100644 spec/python/specwrite/test_repeat_n_term_bytes.py create mode 100644 spec/python/specwrite/test_repeat_n_term_struct.py create mode 100644 spec/python/specwrite/test_repeat_until_bytes.py create mode 100644 spec/python/specwrite/test_repeat_until_bytes_pad.py create mode 100644 spec/python/specwrite/test_repeat_until_bytes_pad_term.py create mode 100644 spec/python/specwrite/test_repeat_until_calc_array_type.py create mode 100644 spec/python/specwrite/test_repeat_until_complex.py create mode 100644 spec/python/specwrite/test_repeat_until_s4.py create mode 100644 spec/python/specwrite/test_repeat_until_sized.py create mode 100644 spec/python/specwrite/test_repeat_until_term_bytes.py create mode 100644 spec/python/specwrite/test_repeat_until_term_struct.py create mode 100644 spec/python/specwrite/test_str_encodings.py create mode 100644 spec/python/specwrite/test_str_encodings_default.py create mode 100644 spec/python/specwrite/test_str_encodings_utf16.py create mode 100644 spec/python/specwrite/test_str_eos.py create mode 100644 spec/python/specwrite/test_str_eos_pad_term.py create mode 100644 spec/python/specwrite/test_str_eos_pad_term_empty.py create mode 100644 spec/python/specwrite/test_str_eos_pad_term_equal.py create mode 100644 spec/python/specwrite/test_str_literals2.py create mode 100644 spec/python/specwrite/test_str_pad_term.py create mode 100644 spec/python/specwrite/test_str_pad_term_empty.py create mode 100644 spec/python/specwrite/test_str_pad_term_equal.py create mode 100644 spec/python/specwrite/test_str_pad_term_roundtrip.py create mode 100644 spec/python/specwrite/test_str_pad_term_zero_size.py create mode 100644 spec/python/specwrite/test_struct_pad_term.py create mode 100644 spec/python/specwrite/test_struct_pad_term_equal.py create mode 100644 spec/python/specwrite/test_switch_bytearray.py create mode 100644 spec/python/specwrite/test_switch_else_only.py create mode 100644 spec/python/specwrite/test_switch_integers.py create mode 100644 spec/python/specwrite/test_switch_integers2.py create mode 100644 spec/python/specwrite/test_switch_manual_enum.py create mode 100644 spec/python/specwrite/test_switch_manual_enum_invalid.py create mode 100644 spec/python/specwrite/test_switch_manual_enum_invalid_else.py create mode 100644 spec/python/specwrite/test_switch_manual_int.py create mode 100644 spec/python/specwrite/test_switch_manual_int_else.py create mode 100644 spec/python/specwrite/test_switch_manual_int_size.py create mode 100644 spec/python/specwrite/test_switch_manual_int_size_else.py create mode 100644 spec/python/specwrite/test_switch_manual_int_size_eos.py create mode 100644 spec/python/specwrite/test_switch_manual_str.py create mode 100644 spec/python/specwrite/test_switch_manual_str_else.py create mode 100644 spec/python/specwrite/test_switch_multi_bool_ops.py create mode 100644 spec/python/specwrite/test_switch_repeat_expr.py create mode 100644 spec/python/specwrite/test_switch_repeat_expr_invalid.py create mode 100644 spec/python/specwrite/test_term_bytes.py create mode 100644 spec/python/specwrite/test_term_bytes2.py create mode 100644 spec/python/specwrite/test_term_bytes3.py create mode 100644 spec/python/specwrite/test_term_bytes4.py create mode 100644 spec/python/specwrite/test_term_struct.py create mode 100644 spec/python/specwrite/test_term_struct2.py create mode 100644 spec/python/specwrite/test_term_struct3.py create mode 100644 spec/python/specwrite/test_term_struct4.py create mode 100644 spec/python/specwrite/test_term_strz.py create mode 100644 spec/python/specwrite/test_term_strz2.py create mode 100644 spec/python/specwrite/test_term_strz3.py create mode 100644 spec/python/specwrite/test_term_strz4.py create mode 100644 spec/python/specwrite/test_term_u1_val.py create mode 100644 spec/python/specwrite/test_ts_packet_header.py create mode 100644 spec/python/specwrite/test_type_int_unary_op.py create mode 100644 spec/python/specwrite/test_type_ternary.py create mode 100644 spec/python/specwrite/test_type_ternary_2nd_falsy.py create mode 100644 spec/python/specwrite/test_type_ternary_opaque.py create mode 100644 spec/python/specwrite/test_user_type.py create mode 100644 spec/python/specwrite/test_valid_eq_str_encodings.py create mode 100644 spec/python/specwrite/test_valid_fail_anyof_int.py create mode 100644 spec/python/specwrite/test_valid_fail_contents.py create mode 100644 spec/python/specwrite/test_valid_fail_eq_bytes.py create mode 100644 spec/python/specwrite/test_valid_fail_eq_int.py create mode 100644 spec/python/specwrite/test_valid_fail_eq_str.py create mode 100644 spec/python/specwrite/test_valid_fail_expr.py create mode 100644 spec/python/specwrite/test_valid_fail_inst.py create mode 100644 spec/python/specwrite/test_valid_fail_max_int.py create mode 100644 spec/python/specwrite/test_valid_fail_min_int.py create mode 100644 spec/python/specwrite/test_valid_fail_range_bytes.py create mode 100644 spec/python/specwrite/test_valid_fail_range_float.py create mode 100644 spec/python/specwrite/test_valid_fail_range_int.py create mode 100644 spec/python/specwrite/test_valid_fail_range_str.py create mode 100644 spec/python/specwrite/test_valid_long.py create mode 100644 spec/python/specwrite/test_valid_not_parsed_if.py create mode 100644 spec/python/specwrite/test_valid_optional_id.py create mode 100644 spec/python/specwrite/test_valid_short.py create mode 100644 spec/python/specwrite/test_valid_switch.py create mode 100644 spec/python/specwrite/test_yaml_ints.py create mode 100644 spec/python/specwrite/test_zlib_surrounded.py create mode 100644 spec/python/specwrite/test_zlib_with_header_78.py diff --git a/spec/python/specwrite/test_bcd_user_type_be.py b/spec/python/specwrite/test_bcd_user_type_be.py new file mode 100644 index 000000000..26b833dcc --- /dev/null +++ b/spec/python/specwrite/test_bcd_user_type_be.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.bcd_user_type_be import BcdUserTypeBe + +class TestBcdUserTypeBe(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestBcdUserTypeBe, self).__init__(*args, **kwargs) + self.struct_class = BcdUserTypeBe + self.src_filename = 'src/bcd_user_type_be.bin' + diff --git a/spec/python/specwrite/test_bcd_user_type_le.py b/spec/python/specwrite/test_bcd_user_type_le.py new file mode 100644 index 000000000..e9f6a86ff --- /dev/null +++ b/spec/python/specwrite/test_bcd_user_type_le.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.bcd_user_type_le import BcdUserTypeLe + +class TestBcdUserTypeLe(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestBcdUserTypeLe, self).__init__(*args, **kwargs) + self.struct_class = BcdUserTypeLe + self.src_filename = 'src/bcd_user_type_le.bin' + diff --git a/spec/python/specwrite/test_bits_byte_aligned.py b/spec/python/specwrite/test_bits_byte_aligned.py new file mode 100644 index 000000000..b1f7e5091 --- /dev/null +++ b/spec/python/specwrite/test_bits_byte_aligned.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.bits_byte_aligned import BitsByteAligned + +class TestBitsByteAligned(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestBitsByteAligned, self).__init__(*args, **kwargs) + self.struct_class = BitsByteAligned + self.src_filename = 'src/fixed_struct.bin' + diff --git a/spec/python/specwrite/test_bits_enum.py b/spec/python/specwrite/test_bits_enum.py new file mode 100644 index 000000000..f99249231 --- /dev/null +++ b/spec/python/specwrite/test_bits_enum.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.bits_enum import BitsEnum + +class TestBitsEnum(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestBitsEnum, self).__init__(*args, **kwargs) + self.struct_class = BitsEnum + self.src_filename = 'src/fixed_struct.bin' + diff --git a/spec/python/specwrite/test_bits_seq_endian_combo.py b/spec/python/specwrite/test_bits_seq_endian_combo.py new file mode 100644 index 000000000..538dfee75 --- /dev/null +++ b/spec/python/specwrite/test_bits_seq_endian_combo.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.bits_seq_endian_combo import BitsSeqEndianCombo + +class TestBitsSeqEndianCombo(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestBitsSeqEndianCombo, self).__init__(*args, **kwargs) + self.struct_class = BitsSeqEndianCombo + self.src_filename = 'src/process_xor_4.bin' + diff --git a/spec/python/specwrite/test_bits_shift_by_b32_le.py b/spec/python/specwrite/test_bits_shift_by_b32_le.py new file mode 100644 index 000000000..596f84583 --- /dev/null +++ b/spec/python/specwrite/test_bits_shift_by_b32_le.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.bits_shift_by_b32_le import BitsShiftByB32Le + +class TestBitsShiftByB32Le(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestBitsShiftByB32Le, self).__init__(*args, **kwargs) + self.struct_class = BitsShiftByB32Le + self.src_filename = 'src/bits_shift_by_b32_le.bin' + diff --git a/spec/python/specwrite/test_bits_shift_by_b64_le.py b/spec/python/specwrite/test_bits_shift_by_b64_le.py new file mode 100644 index 000000000..0db262c08 --- /dev/null +++ b/spec/python/specwrite/test_bits_shift_by_b64_le.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.bits_shift_by_b64_le import BitsShiftByB64Le + +class TestBitsShiftByB64Le(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestBitsShiftByB64Le, self).__init__(*args, **kwargs) + self.struct_class = BitsShiftByB64Le + self.src_filename = 'src/bits_shift_by_b64_le.bin' + diff --git a/spec/python/specwrite/test_bits_signed_res_b32_be.py b/spec/python/specwrite/test_bits_signed_res_b32_be.py new file mode 100644 index 000000000..9558f42bc --- /dev/null +++ b/spec/python/specwrite/test_bits_signed_res_b32_be.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.bits_signed_res_b32_be import BitsSignedResB32Be + +class TestBitsSignedResB32Be(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestBitsSignedResB32Be, self).__init__(*args, **kwargs) + self.struct_class = BitsSignedResB32Be + self.src_filename = 'src/bits_shift_by_b32_le.bin' + diff --git a/spec/python/specwrite/test_bits_signed_res_b32_le.py b/spec/python/specwrite/test_bits_signed_res_b32_le.py new file mode 100644 index 000000000..35a742c69 --- /dev/null +++ b/spec/python/specwrite/test_bits_signed_res_b32_le.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.bits_signed_res_b32_le import BitsSignedResB32Le + +class TestBitsSignedResB32Le(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestBitsSignedResB32Le, self).__init__(*args, **kwargs) + self.struct_class = BitsSignedResB32Le + self.src_filename = 'src/bits_shift_by_b32_le.bin' + diff --git a/spec/python/specwrite/test_bits_signed_shift_b32_le.py b/spec/python/specwrite/test_bits_signed_shift_b32_le.py new file mode 100644 index 000000000..3fe551e6f --- /dev/null +++ b/spec/python/specwrite/test_bits_signed_shift_b32_le.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.bits_signed_shift_b32_le import BitsSignedShiftB32Le + +class TestBitsSignedShiftB32Le(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestBitsSignedShiftB32Le, self).__init__(*args, **kwargs) + self.struct_class = BitsSignedShiftB32Le + self.src_filename = 'src/bits_signed_shift_b32_le.bin' + diff --git a/spec/python/specwrite/test_bits_signed_shift_b64_le.py b/spec/python/specwrite/test_bits_signed_shift_b64_le.py new file mode 100644 index 000000000..f251b4ad6 --- /dev/null +++ b/spec/python/specwrite/test_bits_signed_shift_b64_le.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.bits_signed_shift_b64_le import BitsSignedShiftB64Le + +class TestBitsSignedShiftB64Le(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestBitsSignedShiftB64Le, self).__init__(*args, **kwargs) + self.struct_class = BitsSignedShiftB64Le + self.src_filename = 'src/bits_signed_shift_b64_le.bin' + diff --git a/spec/python/specwrite/test_bits_simple.py b/spec/python/specwrite/test_bits_simple.py new file mode 100644 index 000000000..51b4141e0 --- /dev/null +++ b/spec/python/specwrite/test_bits_simple.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.bits_simple import BitsSimple + +class TestBitsSimple(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestBitsSimple, self).__init__(*args, **kwargs) + self.struct_class = BitsSimple + self.src_filename = 'src/fixed_struct.bin' + diff --git a/spec/python/specwrite/test_bits_simple_le.py b/spec/python/specwrite/test_bits_simple_le.py new file mode 100644 index 000000000..5e7dcae13 --- /dev/null +++ b/spec/python/specwrite/test_bits_simple_le.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.bits_simple_le import BitsSimpleLe + +class TestBitsSimpleLe(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestBitsSimpleLe, self).__init__(*args, **kwargs) + self.struct_class = BitsSimpleLe + self.src_filename = 'src/fixed_struct.bin' + diff --git a/spec/python/specwrite/test_bits_unaligned_b32_be.py b/spec/python/specwrite/test_bits_unaligned_b32_be.py new file mode 100644 index 000000000..bea9edaec --- /dev/null +++ b/spec/python/specwrite/test_bits_unaligned_b32_be.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.bits_unaligned_b32_be import BitsUnalignedB32Be + +class TestBitsUnalignedB32Be(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestBitsUnalignedB32Be, self).__init__(*args, **kwargs) + self.struct_class = BitsUnalignedB32Be + self.src_filename = 'src/process_xor_4.bin' + diff --git a/spec/python/specwrite/test_bits_unaligned_b32_le.py b/spec/python/specwrite/test_bits_unaligned_b32_le.py new file mode 100644 index 000000000..9bcbdb445 --- /dev/null +++ b/spec/python/specwrite/test_bits_unaligned_b32_le.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.bits_unaligned_b32_le import BitsUnalignedB32Le + +class TestBitsUnalignedB32Le(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestBitsUnalignedB32Le, self).__init__(*args, **kwargs) + self.struct_class = BitsUnalignedB32Le + self.src_filename = 'src/process_xor_4.bin' + diff --git a/spec/python/specwrite/test_bits_unaligned_b64_be.py b/spec/python/specwrite/test_bits_unaligned_b64_be.py new file mode 100644 index 000000000..0aeab09fa --- /dev/null +++ b/spec/python/specwrite/test_bits_unaligned_b64_be.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.bits_unaligned_b64_be import BitsUnalignedB64Be + +class TestBitsUnalignedB64Be(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestBitsUnalignedB64Be, self).__init__(*args, **kwargs) + self.struct_class = BitsUnalignedB64Be + self.src_filename = 'src/process_xor_4.bin' + diff --git a/spec/python/specwrite/test_bits_unaligned_b64_le.py b/spec/python/specwrite/test_bits_unaligned_b64_le.py new file mode 100644 index 000000000..375a24635 --- /dev/null +++ b/spec/python/specwrite/test_bits_unaligned_b64_le.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.bits_unaligned_b64_le import BitsUnalignedB64Le + +class TestBitsUnalignedB64Le(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestBitsUnalignedB64Le, self).__init__(*args, **kwargs) + self.struct_class = BitsUnalignedB64Le + self.src_filename = 'src/process_xor_4.bin' + diff --git a/spec/python/specwrite/test_buffered_struct.py b/spec/python/specwrite/test_buffered_struct.py new file mode 100644 index 000000000..acf97f9c3 --- /dev/null +++ b/spec/python/specwrite/test_buffered_struct.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.buffered_struct import BufferedStruct + +class TestBufferedStruct(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestBufferedStruct, self).__init__(*args, **kwargs) + self.struct_class = BufferedStruct + self.src_filename = 'src/buffered_struct.bin' + diff --git a/spec/python/specwrite/test_bytes_eos_pad_term.py b/spec/python/specwrite/test_bytes_eos_pad_term.py new file mode 100644 index 000000000..08983ca5c --- /dev/null +++ b/spec/python/specwrite/test_bytes_eos_pad_term.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.bytes_eos_pad_term import BytesEosPadTerm + +class TestBytesEosPadTerm(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestBytesEosPadTerm, self).__init__(*args, **kwargs) + self.struct_class = BytesEosPadTerm + self.src_filename = 'src/str_pad_term.bin' + diff --git a/spec/python/specwrite/test_bytes_pad_term.py b/spec/python/specwrite/test_bytes_pad_term.py new file mode 100644 index 000000000..7766e2282 --- /dev/null +++ b/spec/python/specwrite/test_bytes_pad_term.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.bytes_pad_term import BytesPadTerm + +class TestBytesPadTerm(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestBytesPadTerm, self).__init__(*args, **kwargs) + self.struct_class = BytesPadTerm + self.src_filename = 'src/str_pad_term.bin' + diff --git a/spec/python/specwrite/test_bytes_pad_term_empty.py b/spec/python/specwrite/test_bytes_pad_term_empty.py new file mode 100644 index 000000000..d33c0b076 --- /dev/null +++ b/spec/python/specwrite/test_bytes_pad_term_empty.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.bytes_pad_term_empty import BytesPadTermEmpty + +class TestBytesPadTermEmpty(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestBytesPadTermEmpty, self).__init__(*args, **kwargs) + self.struct_class = BytesPadTermEmpty + self.src_filename = 'src/str_pad_term_empty.bin' + diff --git a/spec/python/specwrite/test_bytes_pad_term_equal.py b/spec/python/specwrite/test_bytes_pad_term_equal.py new file mode 100644 index 000000000..219ae4147 --- /dev/null +++ b/spec/python/specwrite/test_bytes_pad_term_equal.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.bytes_pad_term_equal import BytesPadTermEqual + +class TestBytesPadTermEqual(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestBytesPadTermEqual, self).__init__(*args, **kwargs) + self.struct_class = BytesPadTermEqual + self.src_filename = 'src/str_pad_term.bin' + diff --git a/spec/python/specwrite/test_bytes_pad_term_roundtrip.py b/spec/python/specwrite/test_bytes_pad_term_roundtrip.py new file mode 100644 index 000000000..3d145f75d --- /dev/null +++ b/spec/python/specwrite/test_bytes_pad_term_roundtrip.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.bytes_pad_term_roundtrip import BytesPadTermRoundtrip + +class TestBytesPadTermRoundtrip(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestBytesPadTermRoundtrip, self).__init__(*args, **kwargs) + self.struct_class = BytesPadTermRoundtrip + self.src_filename = 'src/str_pad_term.bin' + diff --git a/spec/python/specwrite/test_bytes_pad_term_zero_size.py b/spec/python/specwrite/test_bytes_pad_term_zero_size.py new file mode 100644 index 000000000..5c12d3c0a --- /dev/null +++ b/spec/python/specwrite/test_bytes_pad_term_zero_size.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.bytes_pad_term_zero_size import BytesPadTermZeroSize + +class TestBytesPadTermZeroSize(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestBytesPadTermZeroSize, self).__init__(*args, **kwargs) + self.struct_class = BytesPadTermZeroSize + self.src_filename = 'src/enum_negative.bin' + diff --git a/spec/python/specwrite/test_cast_nested.py b/spec/python/specwrite/test_cast_nested.py new file mode 100644 index 000000000..d50e318ed --- /dev/null +++ b/spec/python/specwrite/test_cast_nested.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.cast_nested import CastNested + +class TestCastNested(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestCastNested, self).__init__(*args, **kwargs) + self.struct_class = CastNested + self.src_filename = 'src/switch_opcodes.bin' + diff --git a/spec/python/specwrite/test_cast_to_imported.py b/spec/python/specwrite/test_cast_to_imported.py new file mode 100644 index 000000000..1c835f33b --- /dev/null +++ b/spec/python/specwrite/test_cast_to_imported.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.cast_to_imported import CastToImported + +class TestCastToImported(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestCastToImported, self).__init__(*args, **kwargs) + self.struct_class = CastToImported + self.src_filename = 'src/fixed_struct.bin' + diff --git a/spec/python/specwrite/test_cast_to_top.py b/spec/python/specwrite/test_cast_to_top.py new file mode 100644 index 000000000..68cc69bf2 --- /dev/null +++ b/spec/python/specwrite/test_cast_to_top.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.cast_to_top import CastToTop + +class TestCastToTop(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestCastToTop, self).__init__(*args, **kwargs) + self.struct_class = CastToTop + self.src_filename = 'src/fixed_struct.bin' + diff --git a/spec/python/specwrite/test_combine_bool.py b/spec/python/specwrite/test_combine_bool.py new file mode 100644 index 000000000..ee6128fc5 --- /dev/null +++ b/spec/python/specwrite/test_combine_bool.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.combine_bool import CombineBool + +class TestCombineBool(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestCombineBool, self).__init__(*args, **kwargs) + self.struct_class = CombineBool + self.src_filename = 'src/enum_negative.bin' + diff --git a/spec/python/specwrite/test_combine_bytes.py b/spec/python/specwrite/test_combine_bytes.py new file mode 100644 index 000000000..0f37d7f3f --- /dev/null +++ b/spec/python/specwrite/test_combine_bytes.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.combine_bytes import CombineBytes + +class TestCombineBytes(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestCombineBytes, self).__init__(*args, **kwargs) + self.struct_class = CombineBytes + self.src_filename = 'src/term_strz.bin' + diff --git a/spec/python/specwrite/test_combine_enum.py b/spec/python/specwrite/test_combine_enum.py new file mode 100644 index 000000000..cbefdb98e --- /dev/null +++ b/spec/python/specwrite/test_combine_enum.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.combine_enum import CombineEnum + +class TestCombineEnum(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestCombineEnum, self).__init__(*args, **kwargs) + self.struct_class = CombineEnum + self.src_filename = 'src/enum_0.bin' + diff --git a/spec/python/specwrite/test_combine_str.py b/spec/python/specwrite/test_combine_str.py new file mode 100644 index 000000000..670b05179 --- /dev/null +++ b/spec/python/specwrite/test_combine_str.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.combine_str import CombineStr + +class TestCombineStr(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestCombineStr, self).__init__(*args, **kwargs) + self.struct_class = CombineStr + self.src_filename = 'src/term_strz.bin' + diff --git a/spec/python/specwrite/test_debug_0.py b/spec/python/specwrite/test_debug_0.py new file mode 100644 index 000000000..278725930 --- /dev/null +++ b/spec/python/specwrite/test_debug_0.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.debug_0 import Debug0 + +class TestDebug0(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestDebug0, self).__init__(*args, **kwargs) + self.struct_class = Debug0 + self.src_filename = 'src/fixed_struct.bin' + diff --git a/spec/python/specwrite/test_debug_array_user.py b/spec/python/specwrite/test_debug_array_user.py new file mode 100644 index 000000000..31d065241 --- /dev/null +++ b/spec/python/specwrite/test_debug_array_user.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.debug_array_user import DebugArrayUser + +class TestDebugArrayUser(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestDebugArrayUser, self).__init__(*args, **kwargs) + self.struct_class = DebugArrayUser + self.src_filename = 'src/fixed_struct.bin' + diff --git a/spec/python/specwrite/test_debug_enum_name.py b/spec/python/specwrite/test_debug_enum_name.py new file mode 100644 index 000000000..65322cd5e --- /dev/null +++ b/spec/python/specwrite/test_debug_enum_name.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.debug_enum_name import DebugEnumName + +class TestDebugEnumName(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestDebugEnumName, self).__init__(*args, **kwargs) + self.struct_class = DebugEnumName + self.src_filename = 'src/fixed_struct.bin' + diff --git a/spec/python/specwrite/test_debug_switch_user.py b/spec/python/specwrite/test_debug_switch_user.py new file mode 100644 index 000000000..3e965d174 --- /dev/null +++ b/spec/python/specwrite/test_debug_switch_user.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.debug_switch_user import DebugSwitchUser + +class TestDebugSwitchUser(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestDebugSwitchUser, self).__init__(*args, **kwargs) + self.struct_class = DebugSwitchUser + self.src_filename = 'src/nav_parent_switch.bin' + diff --git a/spec/python/specwrite/test_default_big_endian.py b/spec/python/specwrite/test_default_big_endian.py new file mode 100644 index 000000000..aaa4ed05c --- /dev/null +++ b/spec/python/specwrite/test_default_big_endian.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.default_big_endian import DefaultBigEndian + +class TestDefaultBigEndian(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestDefaultBigEndian, self).__init__(*args, **kwargs) + self.struct_class = DefaultBigEndian + self.src_filename = 'src/enum_0.bin' + diff --git a/spec/python/specwrite/test_default_bit_endian_mod.py b/spec/python/specwrite/test_default_bit_endian_mod.py new file mode 100644 index 000000000..b319fc2e7 --- /dev/null +++ b/spec/python/specwrite/test_default_bit_endian_mod.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.default_bit_endian_mod import DefaultBitEndianMod + +class TestDefaultBitEndianMod(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestDefaultBitEndianMod, self).__init__(*args, **kwargs) + self.struct_class = DefaultBitEndianMod + self.src_filename = 'src/fixed_struct.bin' + diff --git a/spec/python/specwrite/test_default_endian_expr_exception.py b/spec/python/specwrite/test_default_endian_expr_exception.py new file mode 100644 index 000000000..61412decb --- /dev/null +++ b/spec/python/specwrite/test_default_endian_expr_exception.py @@ -0,0 +1,15 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.default_endian_expr_exception import DefaultEndianExprException + +class TestDefaultEndianExprException(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestDefaultEndianExprException, self).__init__(*args, **kwargs) + self.struct_class = DefaultEndianExprException + self.src_filename = 'src/endian_expr.bin' + + def test_read_write_roundtrip(self): + self.skipTest("cannot use roundtrip because parsing is expected to fail") diff --git a/spec/python/specwrite/test_default_endian_expr_inherited.py b/spec/python/specwrite/test_default_endian_expr_inherited.py new file mode 100644 index 000000000..21dfe9479 --- /dev/null +++ b/spec/python/specwrite/test_default_endian_expr_inherited.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.default_endian_expr_inherited import DefaultEndianExprInherited + +class TestDefaultEndianExprInherited(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestDefaultEndianExprInherited, self).__init__(*args, **kwargs) + self.struct_class = DefaultEndianExprInherited + self.src_filename = 'src/endian_expr.bin' + diff --git a/spec/python/specwrite/test_default_endian_expr_is_be.py b/spec/python/specwrite/test_default_endian_expr_is_be.py new file mode 100644 index 000000000..beb31befc --- /dev/null +++ b/spec/python/specwrite/test_default_endian_expr_is_be.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.default_endian_expr_is_be import DefaultEndianExprIsBe + +class TestDefaultEndianExprIsBe(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestDefaultEndianExprIsBe, self).__init__(*args, **kwargs) + self.struct_class = DefaultEndianExprIsBe + self.src_filename = 'src/endian_expr.bin' + diff --git a/spec/python/specwrite/test_default_endian_expr_is_le.py b/spec/python/specwrite/test_default_endian_expr_is_le.py new file mode 100644 index 000000000..929342076 --- /dev/null +++ b/spec/python/specwrite/test_default_endian_expr_is_le.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.default_endian_expr_is_le import DefaultEndianExprIsLe + +class TestDefaultEndianExprIsLe(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestDefaultEndianExprIsLe, self).__init__(*args, **kwargs) + self.struct_class = DefaultEndianExprIsLe + self.src_filename = 'src/endian_expr.bin' + diff --git a/spec/python/specwrite/test_default_endian_mod.py b/spec/python/specwrite/test_default_endian_mod.py new file mode 100644 index 000000000..b127d2e90 --- /dev/null +++ b/spec/python/specwrite/test_default_endian_mod.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.default_endian_mod import DefaultEndianMod + +class TestDefaultEndianMod(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestDefaultEndianMod, self).__init__(*args, **kwargs) + self.struct_class = DefaultEndianMod + self.src_filename = 'src/fixed_struct.bin' + diff --git a/spec/python/specwrite/test_docstrings.py b/spec/python/specwrite/test_docstrings.py new file mode 100644 index 000000000..4cbec5378 --- /dev/null +++ b/spec/python/specwrite/test_docstrings.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.docstrings import Docstrings + +class TestDocstrings(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestDocstrings, self).__init__(*args, **kwargs) + self.struct_class = Docstrings + self.src_filename = 'src/fixed_struct.bin' + diff --git a/spec/python/specwrite/test_docstrings_docref.py b/spec/python/specwrite/test_docstrings_docref.py new file mode 100644 index 000000000..1ce19a530 --- /dev/null +++ b/spec/python/specwrite/test_docstrings_docref.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.docstrings_docref import DocstringsDocref + +class TestDocstringsDocref(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestDocstringsDocref, self).__init__(*args, **kwargs) + self.struct_class = DocstringsDocref + self.src_filename = 'src/fixed_struct.bin' + diff --git a/spec/python/specwrite/test_docstrings_docref_multi.py b/spec/python/specwrite/test_docstrings_docref_multi.py new file mode 100644 index 000000000..729f210ec --- /dev/null +++ b/spec/python/specwrite/test_docstrings_docref_multi.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.docstrings_docref_multi import DocstringsDocrefMulti + +class TestDocstringsDocrefMulti(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestDocstringsDocrefMulti, self).__init__(*args, **kwargs) + self.struct_class = DocstringsDocrefMulti + self.src_filename = 'src/fixed_struct.bin' + diff --git a/spec/python/specwrite/test_enum_0.py b/spec/python/specwrite/test_enum_0.py new file mode 100644 index 000000000..09e1fe240 --- /dev/null +++ b/spec/python/specwrite/test_enum_0.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.enum_0 import Enum0 + +class TestEnum0(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestEnum0, self).__init__(*args, **kwargs) + self.struct_class = Enum0 + self.src_filename = 'src/enum_0.bin' + diff --git a/spec/python/specwrite/test_enum_1.py b/spec/python/specwrite/test_enum_1.py new file mode 100644 index 000000000..db4d7e861 --- /dev/null +++ b/spec/python/specwrite/test_enum_1.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.enum_1 import Enum1 + +class TestEnum1(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestEnum1, self).__init__(*args, **kwargs) + self.struct_class = Enum1 + self.src_filename = 'src/enum_0.bin' + diff --git a/spec/python/specwrite/test_enum_deep.py b/spec/python/specwrite/test_enum_deep.py new file mode 100644 index 000000000..2631d057a --- /dev/null +++ b/spec/python/specwrite/test_enum_deep.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.enum_deep import EnumDeep + +class TestEnumDeep(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestEnumDeep, self).__init__(*args, **kwargs) + self.struct_class = EnumDeep + self.src_filename = 'src/enum_0.bin' + diff --git a/spec/python/specwrite/test_enum_deep_literals.py b/spec/python/specwrite/test_enum_deep_literals.py new file mode 100644 index 000000000..a4e1f438a --- /dev/null +++ b/spec/python/specwrite/test_enum_deep_literals.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.enum_deep_literals import EnumDeepLiterals + +class TestEnumDeepLiterals(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestEnumDeepLiterals, self).__init__(*args, **kwargs) + self.struct_class = EnumDeepLiterals + self.src_filename = 'src/enum_0.bin' + diff --git a/spec/python/specwrite/test_enum_fancy.py b/spec/python/specwrite/test_enum_fancy.py new file mode 100644 index 000000000..8186c5104 --- /dev/null +++ b/spec/python/specwrite/test_enum_fancy.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.enum_fancy import EnumFancy + +class TestEnumFancy(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestEnumFancy, self).__init__(*args, **kwargs) + self.struct_class = EnumFancy + self.src_filename = 'src/enum_0.bin' + diff --git a/spec/python/specwrite/test_enum_for_unknown_id.py b/spec/python/specwrite/test_enum_for_unknown_id.py new file mode 100644 index 000000000..6d38caed2 --- /dev/null +++ b/spec/python/specwrite/test_enum_for_unknown_id.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.enum_for_unknown_id import EnumForUnknownId + +class TestEnumForUnknownId(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestEnumForUnknownId, self).__init__(*args, **kwargs) + self.struct_class = EnumForUnknownId + self.src_filename = 'src/fixed_struct.bin' + diff --git a/spec/python/specwrite/test_enum_if.py b/spec/python/specwrite/test_enum_if.py new file mode 100644 index 000000000..102202a05 --- /dev/null +++ b/spec/python/specwrite/test_enum_if.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.enum_if import EnumIf + +class TestEnumIf(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestEnumIf, self).__init__(*args, **kwargs) + self.struct_class = EnumIf + self.src_filename = 'src/if_struct.bin' + diff --git a/spec/python/specwrite/test_enum_import.py b/spec/python/specwrite/test_enum_import.py new file mode 100644 index 000000000..567e954d2 --- /dev/null +++ b/spec/python/specwrite/test_enum_import.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.enum_import import EnumImport + +class TestEnumImport(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestEnumImport, self).__init__(*args, **kwargs) + self.struct_class = EnumImport + self.src_filename = 'src/enum_0.bin' + diff --git a/spec/python/specwrite/test_enum_int_range_s.py b/spec/python/specwrite/test_enum_int_range_s.py new file mode 100644 index 000000000..a9343b7fe --- /dev/null +++ b/spec/python/specwrite/test_enum_int_range_s.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.enum_int_range_s import EnumIntRangeS + +class TestEnumIntRangeS(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestEnumIntRangeS, self).__init__(*args, **kwargs) + self.struct_class = EnumIntRangeS + self.src_filename = 'src/enum_int_range_s.bin' + diff --git a/spec/python/specwrite/test_enum_int_range_u.py b/spec/python/specwrite/test_enum_int_range_u.py new file mode 100644 index 000000000..8bb1c7361 --- /dev/null +++ b/spec/python/specwrite/test_enum_int_range_u.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.enum_int_range_u import EnumIntRangeU + +class TestEnumIntRangeU(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestEnumIntRangeU, self).__init__(*args, **kwargs) + self.struct_class = EnumIntRangeU + self.src_filename = 'src/enum_int_range_u.bin' + diff --git a/spec/python/specwrite/test_enum_invalid.py b/spec/python/specwrite/test_enum_invalid.py new file mode 100644 index 000000000..bdcb0634b --- /dev/null +++ b/spec/python/specwrite/test_enum_invalid.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.enum_invalid import EnumInvalid + +class TestEnumInvalid(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestEnumInvalid, self).__init__(*args, **kwargs) + self.struct_class = EnumInvalid + self.src_filename = 'src/term_strz.bin' + diff --git a/spec/python/specwrite/test_enum_long_range_s.py b/spec/python/specwrite/test_enum_long_range_s.py new file mode 100644 index 000000000..3543246e2 --- /dev/null +++ b/spec/python/specwrite/test_enum_long_range_s.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.enum_long_range_s import EnumLongRangeS + +class TestEnumLongRangeS(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestEnumLongRangeS, self).__init__(*args, **kwargs) + self.struct_class = EnumLongRangeS + self.src_filename = 'src/enum_long_range_s.bin' + diff --git a/spec/python/specwrite/test_enum_long_range_u.py b/spec/python/specwrite/test_enum_long_range_u.py new file mode 100644 index 000000000..b76f64bf2 --- /dev/null +++ b/spec/python/specwrite/test_enum_long_range_u.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.enum_long_range_u import EnumLongRangeU + +class TestEnumLongRangeU(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestEnumLongRangeU, self).__init__(*args, **kwargs) + self.struct_class = EnumLongRangeU + self.src_filename = 'src/enum_long_range_u.bin' + diff --git a/spec/python/specwrite/test_enum_negative.py b/spec/python/specwrite/test_enum_negative.py new file mode 100644 index 000000000..b3a758130 --- /dev/null +++ b/spec/python/specwrite/test_enum_negative.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.enum_negative import EnumNegative + +class TestEnumNegative(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestEnumNegative, self).__init__(*args, **kwargs) + self.struct_class = EnumNegative + self.src_filename = 'src/enum_negative.bin' + diff --git a/spec/python/specwrite/test_enum_of_value_inst.py b/spec/python/specwrite/test_enum_of_value_inst.py new file mode 100644 index 000000000..9b6f2ba8c --- /dev/null +++ b/spec/python/specwrite/test_enum_of_value_inst.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.enum_of_value_inst import EnumOfValueInst + +class TestEnumOfValueInst(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestEnumOfValueInst, self).__init__(*args, **kwargs) + self.struct_class = EnumOfValueInst + self.src_filename = 'src/enum_0.bin' + diff --git a/spec/python/specwrite/test_enum_to_i.py b/spec/python/specwrite/test_enum_to_i.py new file mode 100644 index 000000000..1122103af --- /dev/null +++ b/spec/python/specwrite/test_enum_to_i.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.enum_to_i import EnumToI + +class TestEnumToI(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestEnumToI, self).__init__(*args, **kwargs) + self.struct_class = EnumToI + self.src_filename = 'src/enum_0.bin' + diff --git a/spec/python/specwrite/test_enum_to_i_class_border_1.py b/spec/python/specwrite/test_enum_to_i_class_border_1.py new file mode 100644 index 000000000..bcbb97e80 --- /dev/null +++ b/spec/python/specwrite/test_enum_to_i_class_border_1.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.enum_to_i_class_border_1 import EnumToIClassBorder1 + +class TestEnumToIClassBorder1(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestEnumToIClassBorder1, self).__init__(*args, **kwargs) + self.struct_class = EnumToIClassBorder1 + self.src_filename = 'src/enum_0.bin' + diff --git a/spec/python/specwrite/test_eof_exception_bytes.py b/spec/python/specwrite/test_eof_exception_bytes.py new file mode 100644 index 000000000..dea68a7ec --- /dev/null +++ b/spec/python/specwrite/test_eof_exception_bytes.py @@ -0,0 +1,15 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.eof_exception_bytes import EofExceptionBytes + +class TestEofExceptionBytes(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestEofExceptionBytes, self).__init__(*args, **kwargs) + self.struct_class = EofExceptionBytes + self.src_filename = 'src/term_strz.bin' + + def test_read_write_roundtrip(self): + self.skipTest("cannot use roundtrip because parsing is expected to fail") diff --git a/spec/python/specwrite/test_eof_exception_u4.py b/spec/python/specwrite/test_eof_exception_u4.py new file mode 100644 index 000000000..c27cf3d42 --- /dev/null +++ b/spec/python/specwrite/test_eof_exception_u4.py @@ -0,0 +1,15 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.eof_exception_u4 import EofExceptionU4 + +class TestEofExceptionU4(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestEofExceptionU4, self).__init__(*args, **kwargs) + self.struct_class = EofExceptionU4 + self.src_filename = 'src/term_strz.bin' + + def test_read_write_roundtrip(self): + self.skipTest("cannot use roundtrip because parsing is expected to fail") diff --git a/spec/python/specwrite/test_eos_exception_bytes.py b/spec/python/specwrite/test_eos_exception_bytes.py new file mode 100644 index 000000000..c89e87172 --- /dev/null +++ b/spec/python/specwrite/test_eos_exception_bytes.py @@ -0,0 +1,15 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.eos_exception_bytes import EosExceptionBytes + +class TestEosExceptionBytes(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestEosExceptionBytes, self).__init__(*args, **kwargs) + self.struct_class = EosExceptionBytes + self.src_filename = 'src/term_strz.bin' + + def test_read_write_roundtrip(self): + self.skipTest("cannot use roundtrip because parsing is expected to fail") diff --git a/spec/python/specwrite/test_eos_exception_u4.py b/spec/python/specwrite/test_eos_exception_u4.py new file mode 100644 index 000000000..b2b1ae442 --- /dev/null +++ b/spec/python/specwrite/test_eos_exception_u4.py @@ -0,0 +1,15 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.eos_exception_u4 import EosExceptionU4 + +class TestEosExceptionU4(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestEosExceptionU4, self).__init__(*args, **kwargs) + self.struct_class = EosExceptionU4 + self.src_filename = 'src/term_strz.bin' + + def test_read_write_roundtrip(self): + self.skipTest("cannot use roundtrip because parsing is expected to fail") diff --git a/spec/python/specwrite/test_expr_0.py b/spec/python/specwrite/test_expr_0.py new file mode 100644 index 000000000..00cb030dd --- /dev/null +++ b/spec/python/specwrite/test_expr_0.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.expr_0 import Expr0 + +class TestExpr0(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestExpr0, self).__init__(*args, **kwargs) + self.struct_class = Expr0 + self.src_filename = 'src/str_encodings.bin' + diff --git a/spec/python/specwrite/test_expr_1.py b/spec/python/specwrite/test_expr_1.py new file mode 100644 index 000000000..1b291d3aa --- /dev/null +++ b/spec/python/specwrite/test_expr_1.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.expr_1 import Expr1 + +class TestExpr1(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestExpr1, self).__init__(*args, **kwargs) + self.struct_class = Expr1 + self.src_filename = 'src/str_encodings.bin' + diff --git a/spec/python/specwrite/test_expr_2.py b/spec/python/specwrite/test_expr_2.py new file mode 100644 index 000000000..ff33130a1 --- /dev/null +++ b/spec/python/specwrite/test_expr_2.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.expr_2 import Expr2 + +class TestExpr2(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestExpr2, self).__init__(*args, **kwargs) + self.struct_class = Expr2 + self.src_filename = 'src/str_encodings.bin' + diff --git a/spec/python/specwrite/test_expr_3.py b/spec/python/specwrite/test_expr_3.py new file mode 100644 index 000000000..5f7b97ac1 --- /dev/null +++ b/spec/python/specwrite/test_expr_3.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.expr_3 import Expr3 + +class TestExpr3(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestExpr3, self).__init__(*args, **kwargs) + self.struct_class = Expr3 + self.src_filename = 'src/fixed_struct.bin' + diff --git a/spec/python/specwrite/test_expr_array.py b/spec/python/specwrite/test_expr_array.py new file mode 100644 index 000000000..1e047d072 --- /dev/null +++ b/spec/python/specwrite/test_expr_array.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.expr_array import ExprArray + +class TestExprArray(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestExprArray, self).__init__(*args, **kwargs) + self.struct_class = ExprArray + self.src_filename = 'src/expr_array.bin' + diff --git a/spec/python/specwrite/test_expr_bits.py b/spec/python/specwrite/test_expr_bits.py new file mode 100644 index 000000000..c5f3ad67f --- /dev/null +++ b/spec/python/specwrite/test_expr_bits.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.expr_bits import ExprBits + +class TestExprBits(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestExprBits, self).__init__(*args, **kwargs) + self.struct_class = ExprBits + self.src_filename = 'src/switch_opcodes.bin' + diff --git a/spec/python/specwrite/test_expr_bytes_cmp.py b/spec/python/specwrite/test_expr_bytes_cmp.py new file mode 100644 index 000000000..091b76341 --- /dev/null +++ b/spec/python/specwrite/test_expr_bytes_cmp.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.expr_bytes_cmp import ExprBytesCmp + +class TestExprBytesCmp(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestExprBytesCmp, self).__init__(*args, **kwargs) + self.struct_class = ExprBytesCmp + self.src_filename = 'src/fixed_struct.bin' + diff --git a/spec/python/specwrite/test_expr_bytes_non_literal.py b/spec/python/specwrite/test_expr_bytes_non_literal.py new file mode 100644 index 000000000..0caa32526 --- /dev/null +++ b/spec/python/specwrite/test_expr_bytes_non_literal.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.expr_bytes_non_literal import ExprBytesNonLiteral + +class TestExprBytesNonLiteral(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestExprBytesNonLiteral, self).__init__(*args, **kwargs) + self.struct_class = ExprBytesNonLiteral + self.src_filename = 'src/enum_negative.bin' + diff --git a/spec/python/specwrite/test_expr_bytes_ops.py b/spec/python/specwrite/test_expr_bytes_ops.py new file mode 100644 index 000000000..2a93eff9f --- /dev/null +++ b/spec/python/specwrite/test_expr_bytes_ops.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.expr_bytes_ops import ExprBytesOps + +class TestExprBytesOps(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestExprBytesOps, self).__init__(*args, **kwargs) + self.struct_class = ExprBytesOps + self.src_filename = 'src/nav_parent_switch.bin' + diff --git a/spec/python/specwrite/test_expr_calc_array_ops.py b/spec/python/specwrite/test_expr_calc_array_ops.py new file mode 100644 index 000000000..388a2bd37 --- /dev/null +++ b/spec/python/specwrite/test_expr_calc_array_ops.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.expr_calc_array_ops import ExprCalcArrayOps + +class TestExprCalcArrayOps(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestExprCalcArrayOps, self).__init__(*args, **kwargs) + self.struct_class = ExprCalcArrayOps + self.src_filename = 'src/fixed_struct.bin' + diff --git a/spec/python/specwrite/test_expr_enum.py b/spec/python/specwrite/test_expr_enum.py new file mode 100644 index 000000000..5f7af1b5e --- /dev/null +++ b/spec/python/specwrite/test_expr_enum.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.expr_enum import ExprEnum + +class TestExprEnum(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestExprEnum, self).__init__(*args, **kwargs) + self.struct_class = ExprEnum + self.src_filename = 'src/term_strz.bin' + diff --git a/spec/python/specwrite/test_expr_if_int_eq.py b/spec/python/specwrite/test_expr_if_int_eq.py new file mode 100644 index 000000000..060925d84 --- /dev/null +++ b/spec/python/specwrite/test_expr_if_int_eq.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.expr_if_int_eq import ExprIfIntEq + +class TestExprIfIntEq(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestExprIfIntEq, self).__init__(*args, **kwargs) + self.struct_class = ExprIfIntEq + self.src_filename = 'src/process_coerce_switch.bin' + diff --git a/spec/python/specwrite/test_expr_if_int_ops.py b/spec/python/specwrite/test_expr_if_int_ops.py new file mode 100644 index 000000000..c789bc777 --- /dev/null +++ b/spec/python/specwrite/test_expr_if_int_ops.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.expr_if_int_ops import ExprIfIntOps + +class TestExprIfIntOps(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestExprIfIntOps, self).__init__(*args, **kwargs) + self.struct_class = ExprIfIntOps + self.src_filename = 'src/instance_io.bin' + diff --git a/spec/python/specwrite/test_expr_int_div.py b/spec/python/specwrite/test_expr_int_div.py new file mode 100644 index 000000000..74f5dba5f --- /dev/null +++ b/spec/python/specwrite/test_expr_int_div.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.expr_int_div import ExprIntDiv + +class TestExprIntDiv(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestExprIntDiv, self).__init__(*args, **kwargs) + self.struct_class = ExprIntDiv + self.src_filename = 'src/fixed_struct.bin' + diff --git a/spec/python/specwrite/test_expr_io_eof.py b/spec/python/specwrite/test_expr_io_eof.py new file mode 100644 index 000000000..a834423bc --- /dev/null +++ b/spec/python/specwrite/test_expr_io_eof.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.expr_io_eof import ExprIoEof + +class TestExprIoEof(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestExprIoEof, self).__init__(*args, **kwargs) + self.struct_class = ExprIoEof + self.src_filename = 'src/fixed_struct.bin' + diff --git a/spec/python/specwrite/test_expr_io_pos.py b/spec/python/specwrite/test_expr_io_pos.py new file mode 100644 index 000000000..b37289aea --- /dev/null +++ b/spec/python/specwrite/test_expr_io_pos.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.expr_io_pos import ExprIoPos + +class TestExprIoPos(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestExprIoPos, self).__init__(*args, **kwargs) + self.struct_class = ExprIoPos + self.src_filename = 'src/expr_io_pos.bin' + diff --git a/spec/python/specwrite/test_expr_mod.py b/spec/python/specwrite/test_expr_mod.py new file mode 100644 index 000000000..f62276a27 --- /dev/null +++ b/spec/python/specwrite/test_expr_mod.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.expr_mod import ExprMod + +class TestExprMod(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestExprMod, self).__init__(*args, **kwargs) + self.struct_class = ExprMod + self.src_filename = 'src/fixed_struct.bin' + diff --git a/spec/python/specwrite/test_expr_ops_parens.py b/spec/python/specwrite/test_expr_ops_parens.py new file mode 100644 index 000000000..98d71ef7b --- /dev/null +++ b/spec/python/specwrite/test_expr_ops_parens.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.expr_ops_parens import ExprOpsParens + +class TestExprOpsParens(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestExprOpsParens, self).__init__(*args, **kwargs) + self.struct_class = ExprOpsParens + self.src_filename = 'src/enum_negative.bin' + diff --git a/spec/python/specwrite/test_expr_sizeof_type_0.py b/spec/python/specwrite/test_expr_sizeof_type_0.py new file mode 100644 index 000000000..df7d46875 --- /dev/null +++ b/spec/python/specwrite/test_expr_sizeof_type_0.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.expr_sizeof_type_0 import ExprSizeofType0 + +class TestExprSizeofType0(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestExprSizeofType0, self).__init__(*args, **kwargs) + self.struct_class = ExprSizeofType0 + self.src_filename = 'src/fixed_struct.bin' + diff --git a/spec/python/specwrite/test_expr_sizeof_type_1.py b/spec/python/specwrite/test_expr_sizeof_type_1.py new file mode 100644 index 000000000..03e030695 --- /dev/null +++ b/spec/python/specwrite/test_expr_sizeof_type_1.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.expr_sizeof_type_1 import ExprSizeofType1 + +class TestExprSizeofType1(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestExprSizeofType1, self).__init__(*args, **kwargs) + self.struct_class = ExprSizeofType1 + self.src_filename = 'src/fixed_struct.bin' + diff --git a/spec/python/specwrite/test_expr_sizeof_value_0.py b/spec/python/specwrite/test_expr_sizeof_value_0.py new file mode 100644 index 000000000..d175bfa99 --- /dev/null +++ b/spec/python/specwrite/test_expr_sizeof_value_0.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.expr_sizeof_value_0 import ExprSizeofValue0 + +class TestExprSizeofValue0(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestExprSizeofValue0, self).__init__(*args, **kwargs) + self.struct_class = ExprSizeofValue0 + self.src_filename = 'src/fixed_struct.bin' + diff --git a/spec/python/specwrite/test_expr_sizeof_value_sized.py b/spec/python/specwrite/test_expr_sizeof_value_sized.py new file mode 100644 index 000000000..dd6e3d570 --- /dev/null +++ b/spec/python/specwrite/test_expr_sizeof_value_sized.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.expr_sizeof_value_sized import ExprSizeofValueSized + +class TestExprSizeofValueSized(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestExprSizeofValueSized, self).__init__(*args, **kwargs) + self.struct_class = ExprSizeofValueSized + self.src_filename = 'src/fixed_struct.bin' + diff --git a/spec/python/specwrite/test_expr_str_encodings.py b/spec/python/specwrite/test_expr_str_encodings.py new file mode 100644 index 000000000..e1a0432ff --- /dev/null +++ b/spec/python/specwrite/test_expr_str_encodings.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.expr_str_encodings import ExprStrEncodings + +class TestExprStrEncodings(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestExprStrEncodings, self).__init__(*args, **kwargs) + self.struct_class = ExprStrEncodings + self.src_filename = 'src/str_encodings.bin' + diff --git a/spec/python/specwrite/test_expr_str_ops.py b/spec/python/specwrite/test_expr_str_ops.py new file mode 100644 index 000000000..50f3b3e14 --- /dev/null +++ b/spec/python/specwrite/test_expr_str_ops.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.expr_str_ops import ExprStrOps + +class TestExprStrOps(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestExprStrOps, self).__init__(*args, **kwargs) + self.struct_class = ExprStrOps + self.src_filename = 'src/term_strz.bin' + diff --git a/spec/python/specwrite/test_fixed_contents.py b/spec/python/specwrite/test_fixed_contents.py new file mode 100644 index 000000000..b5f681492 --- /dev/null +++ b/spec/python/specwrite/test_fixed_contents.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.fixed_contents import FixedContents + +class TestFixedContents(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestFixedContents, self).__init__(*args, **kwargs) + self.struct_class = FixedContents + self.src_filename = 'src/fixed_struct.bin' + diff --git a/spec/python/specwrite/test_fixed_struct.py b/spec/python/specwrite/test_fixed_struct.py new file mode 100644 index 000000000..cd7ae7a14 --- /dev/null +++ b/spec/python/specwrite/test_fixed_struct.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.fixed_struct import FixedStruct + +class TestFixedStruct(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestFixedStruct, self).__init__(*args, **kwargs) + self.struct_class = FixedStruct + self.src_filename = 'src/fixed_struct.bin' + diff --git a/spec/python/specwrite/test_float_to_i.py b/spec/python/specwrite/test_float_to_i.py new file mode 100644 index 000000000..c3cd8d459 --- /dev/null +++ b/spec/python/specwrite/test_float_to_i.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.float_to_i import FloatToI + +class TestFloatToI(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestFloatToI, self).__init__(*args, **kwargs) + self.struct_class = FloatToI + self.src_filename = 'src/floating_points.bin' + diff --git a/spec/python/specwrite/test_floating_points.py b/spec/python/specwrite/test_floating_points.py new file mode 100644 index 000000000..7bd138f95 --- /dev/null +++ b/spec/python/specwrite/test_floating_points.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.floating_points import FloatingPoints + +class TestFloatingPoints(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestFloatingPoints, self).__init__(*args, **kwargs) + self.struct_class = FloatingPoints + self.src_filename = 'src/floating_points.bin' + diff --git a/spec/python/specwrite/test_hello_world.py b/spec/python/specwrite/test_hello_world.py new file mode 100644 index 000000000..4f36f9b5f --- /dev/null +++ b/spec/python/specwrite/test_hello_world.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.hello_world import HelloWorld + +class TestHelloWorld(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestHelloWorld, self).__init__(*args, **kwargs) + self.struct_class = HelloWorld + self.src_filename = 'src/fixed_struct.bin' + diff --git a/spec/python/specwrite/test_if_instances.py b/spec/python/specwrite/test_if_instances.py new file mode 100644 index 000000000..293d6f83e --- /dev/null +++ b/spec/python/specwrite/test_if_instances.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.if_instances import IfInstances + +class TestIfInstances(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestIfInstances, self).__init__(*args, **kwargs) + self.struct_class = IfInstances + self.src_filename = 'src/fixed_struct.bin' + diff --git a/spec/python/specwrite/test_if_struct.py b/spec/python/specwrite/test_if_struct.py new file mode 100644 index 000000000..85f29296b --- /dev/null +++ b/spec/python/specwrite/test_if_struct.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.if_struct import IfStruct + +class TestIfStruct(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestIfStruct, self).__init__(*args, **kwargs) + self.struct_class = IfStruct + self.src_filename = 'src/if_struct.bin' + diff --git a/spec/python/specwrite/test_if_values.py b/spec/python/specwrite/test_if_values.py new file mode 100644 index 000000000..0cf2e8588 --- /dev/null +++ b/spec/python/specwrite/test_if_values.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.if_values import IfValues + +class TestIfValues(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestIfValues, self).__init__(*args, **kwargs) + self.struct_class = IfValues + self.src_filename = 'src/fixed_struct.bin' + diff --git a/spec/python/specwrite/test_imports0.py b/spec/python/specwrite/test_imports0.py new file mode 100644 index 000000000..97010d898 --- /dev/null +++ b/spec/python/specwrite/test_imports0.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.imports0 import Imports0 + +class TestImports0(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestImports0, self).__init__(*args, **kwargs) + self.struct_class = Imports0 + self.src_filename = 'src/fixed_struct.bin' + diff --git a/spec/python/specwrite/test_imports_abs.py b/spec/python/specwrite/test_imports_abs.py new file mode 100644 index 000000000..d2d92e85c --- /dev/null +++ b/spec/python/specwrite/test_imports_abs.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.imports_abs import ImportsAbs + +class TestImportsAbs(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestImportsAbs, self).__init__(*args, **kwargs) + self.struct_class = ImportsAbs + self.src_filename = 'src/fixed_struct.bin' + diff --git a/spec/python/specwrite/test_imports_circular_a.py b/spec/python/specwrite/test_imports_circular_a.py new file mode 100644 index 000000000..67003140c --- /dev/null +++ b/spec/python/specwrite/test_imports_circular_a.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.imports_circular_a import ImportsCircularA + +class TestImportsCircularA(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestImportsCircularA, self).__init__(*args, **kwargs) + self.struct_class = ImportsCircularA + self.src_filename = 'src/fixed_struct.bin' + diff --git a/spec/python/specwrite/test_imports_rel_1.py b/spec/python/specwrite/test_imports_rel_1.py new file mode 100644 index 000000000..e5b476cc1 --- /dev/null +++ b/spec/python/specwrite/test_imports_rel_1.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.imports_rel_1 import ImportsRel1 + +class TestImportsRel1(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestImportsRel1, self).__init__(*args, **kwargs) + self.struct_class = ImportsRel1 + self.src_filename = 'src/fixed_struct.bin' + diff --git a/spec/python/specwrite/test_index_sizes.py b/spec/python/specwrite/test_index_sizes.py new file mode 100644 index 000000000..33429dbc1 --- /dev/null +++ b/spec/python/specwrite/test_index_sizes.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.index_sizes import IndexSizes + +class TestIndexSizes(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestIndexSizes, self).__init__(*args, **kwargs) + self.struct_class = IndexSizes + self.src_filename = 'src/index_sizes.bin' + diff --git a/spec/python/specwrite/test_index_to_param_eos.py b/spec/python/specwrite/test_index_to_param_eos.py new file mode 100644 index 000000000..5794e42cc --- /dev/null +++ b/spec/python/specwrite/test_index_to_param_eos.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.index_to_param_eos import IndexToParamEos + +class TestIndexToParamEos(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestIndexToParamEos, self).__init__(*args, **kwargs) + self.struct_class = IndexToParamEos + self.src_filename = 'src/index_sizes.bin' + diff --git a/spec/python/specwrite/test_index_to_param_expr.py b/spec/python/specwrite/test_index_to_param_expr.py new file mode 100644 index 000000000..35a9ca543 --- /dev/null +++ b/spec/python/specwrite/test_index_to_param_expr.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.index_to_param_expr import IndexToParamExpr + +class TestIndexToParamExpr(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestIndexToParamExpr, self).__init__(*args, **kwargs) + self.struct_class = IndexToParamExpr + self.src_filename = 'src/index_sizes.bin' + diff --git a/spec/python/specwrite/test_index_to_param_until.py b/spec/python/specwrite/test_index_to_param_until.py new file mode 100644 index 000000000..843cdd496 --- /dev/null +++ b/spec/python/specwrite/test_index_to_param_until.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.index_to_param_until import IndexToParamUntil + +class TestIndexToParamUntil(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestIndexToParamUntil, self).__init__(*args, **kwargs) + self.struct_class = IndexToParamUntil + self.src_filename = 'src/index_sizes.bin' + diff --git a/spec/python/specwrite/test_instance_in_repeat_expr.py b/spec/python/specwrite/test_instance_in_repeat_expr.py new file mode 100644 index 000000000..df85a0470 --- /dev/null +++ b/spec/python/specwrite/test_instance_in_repeat_expr.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.instance_in_repeat_expr import InstanceInRepeatExpr + +class TestInstanceInRepeatExpr(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestInstanceInRepeatExpr, self).__init__(*args, **kwargs) + self.struct_class = InstanceInRepeatExpr + self.src_filename = 'src/instance_in_repeat_expr.bin' + diff --git a/spec/python/specwrite/test_instance_in_repeat_until.py b/spec/python/specwrite/test_instance_in_repeat_until.py new file mode 100644 index 000000000..5f8ecd4e8 --- /dev/null +++ b/spec/python/specwrite/test_instance_in_repeat_until.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.instance_in_repeat_until import InstanceInRepeatUntil + +class TestInstanceInRepeatUntil(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestInstanceInRepeatUntil, self).__init__(*args, **kwargs) + self.struct_class = InstanceInRepeatUntil + self.src_filename = 'src/repeat_until_s4.bin' + diff --git a/spec/python/specwrite/test_instance_in_sized.py b/spec/python/specwrite/test_instance_in_sized.py new file mode 100644 index 000000000..7af81ce1d --- /dev/null +++ b/spec/python/specwrite/test_instance_in_sized.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.instance_in_sized import InstanceInSized + +class TestInstanceInSized(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestInstanceInSized, self).__init__(*args, **kwargs) + self.struct_class = InstanceInSized + self.src_filename = 'src/process_rotate.bin' + diff --git a/spec/python/specwrite/test_instance_io_user.py b/spec/python/specwrite/test_instance_io_user.py new file mode 100644 index 000000000..e7b3f14bf --- /dev/null +++ b/spec/python/specwrite/test_instance_io_user.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.instance_io_user import InstanceIoUser + +class TestInstanceIoUser(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestInstanceIoUser, self).__init__(*args, **kwargs) + self.struct_class = InstanceIoUser + self.src_filename = 'src/instance_io.bin' + diff --git a/spec/python/specwrite/test_instance_io_user_earlier.py b/spec/python/specwrite/test_instance_io_user_earlier.py new file mode 100644 index 000000000..35fc46c75 --- /dev/null +++ b/spec/python/specwrite/test_instance_io_user_earlier.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.instance_io_user_earlier import InstanceIoUserEarlier + +class TestInstanceIoUserEarlier(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestInstanceIoUserEarlier, self).__init__(*args, **kwargs) + self.struct_class = InstanceIoUserEarlier + self.src_filename = 'src/switch_opcodes2.bin' + diff --git a/spec/python/specwrite/test_instance_std.py b/spec/python/specwrite/test_instance_std.py new file mode 100644 index 000000000..ea589bed5 --- /dev/null +++ b/spec/python/specwrite/test_instance_std.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.instance_std import InstanceStd + +class TestInstanceStd(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestInstanceStd, self).__init__(*args, **kwargs) + self.struct_class = InstanceStd + self.src_filename = 'src/str_encodings.bin' + diff --git a/spec/python/specwrite/test_instance_std_array.py b/spec/python/specwrite/test_instance_std_array.py new file mode 100644 index 000000000..8e2a19767 --- /dev/null +++ b/spec/python/specwrite/test_instance_std_array.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.instance_std_array import InstanceStdArray + +class TestInstanceStdArray(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestInstanceStdArray, self).__init__(*args, **kwargs) + self.struct_class = InstanceStdArray + self.src_filename = 'src/instance_std_array.bin' + diff --git a/spec/python/specwrite/test_instance_user_array.py b/spec/python/specwrite/test_instance_user_array.py new file mode 100644 index 000000000..0ad2aad38 --- /dev/null +++ b/spec/python/specwrite/test_instance_user_array.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.instance_user_array import InstanceUserArray + +class TestInstanceUserArray(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestInstanceUserArray, self).__init__(*args, **kwargs) + self.struct_class = InstanceUserArray + self.src_filename = 'src/instance_std_array.bin' + diff --git a/spec/python/specwrite/test_integers.py b/spec/python/specwrite/test_integers.py new file mode 100644 index 000000000..d4dedf346 --- /dev/null +++ b/spec/python/specwrite/test_integers.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.integers import Integers + +class TestIntegers(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestIntegers, self).__init__(*args, **kwargs) + self.struct_class = Integers + self.src_filename = 'src/fixed_struct.bin' + diff --git a/spec/python/specwrite/test_integers_double_overflow.py b/spec/python/specwrite/test_integers_double_overflow.py new file mode 100644 index 000000000..7e6dffb6c --- /dev/null +++ b/spec/python/specwrite/test_integers_double_overflow.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.integers_double_overflow import IntegersDoubleOverflow + +class TestIntegersDoubleOverflow(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestIntegersDoubleOverflow, self).__init__(*args, **kwargs) + self.struct_class = IntegersDoubleOverflow + self.src_filename = 'src/integers_double_overflow.bin' + diff --git a/spec/python/specwrite/test_integers_min_max.py b/spec/python/specwrite/test_integers_min_max.py new file mode 100644 index 000000000..f819d5e8c --- /dev/null +++ b/spec/python/specwrite/test_integers_min_max.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.integers_min_max import IntegersMinMax + +class TestIntegersMinMax(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestIntegersMinMax, self).__init__(*args, **kwargs) + self.struct_class = IntegersMinMax + self.src_filename = 'src/integers_min_max.bin' + diff --git a/spec/python/specwrite/test_io_local_var.py b/spec/python/specwrite/test_io_local_var.py new file mode 100644 index 000000000..cffa02c47 --- /dev/null +++ b/spec/python/specwrite/test_io_local_var.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.io_local_var import IoLocalVar + +class TestIoLocalVar(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestIoLocalVar, self).__init__(*args, **kwargs) + self.struct_class = IoLocalVar + self.src_filename = 'src/full256.bin' + diff --git a/spec/python/specwrite/test_js_signed_right_shift.py b/spec/python/specwrite/test_js_signed_right_shift.py new file mode 100644 index 000000000..b0d85513c --- /dev/null +++ b/spec/python/specwrite/test_js_signed_right_shift.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.js_signed_right_shift import JsSignedRightShift + +class TestJsSignedRightShift(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestJsSignedRightShift, self).__init__(*args, **kwargs) + self.struct_class = JsSignedRightShift + self.src_filename = 'src/fixed_struct.bin' + diff --git a/spec/python/specwrite/test_meta_tags.py b/spec/python/specwrite/test_meta_tags.py new file mode 100644 index 000000000..9b94f25af --- /dev/null +++ b/spec/python/specwrite/test_meta_tags.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.meta_tags import MetaTags + +class TestMetaTags(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestMetaTags, self).__init__(*args, **kwargs) + self.struct_class = MetaTags + self.src_filename = 'src/fixed_struct.bin' + diff --git a/spec/python/specwrite/test_meta_xref.py b/spec/python/specwrite/test_meta_xref.py new file mode 100644 index 000000000..5365e2652 --- /dev/null +++ b/spec/python/specwrite/test_meta_xref.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.meta_xref import MetaXref + +class TestMetaXref(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestMetaXref, self).__init__(*args, **kwargs) + self.struct_class = MetaXref + self.src_filename = 'src/fixed_struct.bin' + diff --git a/spec/python/specwrite/test_multiple_use.py b/spec/python/specwrite/test_multiple_use.py new file mode 100644 index 000000000..ca3c706c0 --- /dev/null +++ b/spec/python/specwrite/test_multiple_use.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.multiple_use import MultipleUse + +class TestMultipleUse(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestMultipleUse, self).__init__(*args, **kwargs) + self.struct_class = MultipleUse + self.src_filename = 'src/position_abs.bin' + diff --git a/spec/python/specwrite/test_nav_parent.py b/spec/python/specwrite/test_nav_parent.py new file mode 100644 index 000000000..a54627d7d --- /dev/null +++ b/spec/python/specwrite/test_nav_parent.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.nav_parent import NavParent + +class TestNavParent(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestNavParent, self).__init__(*args, **kwargs) + self.struct_class = NavParent + self.src_filename = 'src/nav.bin' + diff --git a/spec/python/specwrite/test_nav_parent2.py b/spec/python/specwrite/test_nav_parent2.py new file mode 100644 index 000000000..6bb03ad2f --- /dev/null +++ b/spec/python/specwrite/test_nav_parent2.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.nav_parent2 import NavParent2 + +class TestNavParent2(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestNavParent2, self).__init__(*args, **kwargs) + self.struct_class = NavParent2 + self.src_filename = 'src/nav_parent2.bin' + diff --git a/spec/python/specwrite/test_nav_parent3.py b/spec/python/specwrite/test_nav_parent3.py new file mode 100644 index 000000000..f005147b5 --- /dev/null +++ b/spec/python/specwrite/test_nav_parent3.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.nav_parent3 import NavParent3 + +class TestNavParent3(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestNavParent3, self).__init__(*args, **kwargs) + self.struct_class = NavParent3 + self.src_filename = 'src/nav_parent2.bin' + diff --git a/spec/python/specwrite/test_nav_parent_false.py b/spec/python/specwrite/test_nav_parent_false.py new file mode 100644 index 000000000..bee36d8cb --- /dev/null +++ b/spec/python/specwrite/test_nav_parent_false.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.nav_parent_false import NavParentFalse + +class TestNavParentFalse(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestNavParentFalse, self).__init__(*args, **kwargs) + self.struct_class = NavParentFalse + self.src_filename = 'src/nav_parent_codes.bin' + diff --git a/spec/python/specwrite/test_nav_parent_false2.py b/spec/python/specwrite/test_nav_parent_false2.py new file mode 100644 index 000000000..719ac40d2 --- /dev/null +++ b/spec/python/specwrite/test_nav_parent_false2.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.nav_parent_false2 import NavParentFalse2 + +class TestNavParentFalse2(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestNavParentFalse2, self).__init__(*args, **kwargs) + self.struct_class = NavParentFalse2 + self.src_filename = 'src/fixed_struct.bin' + diff --git a/spec/python/specwrite/test_nav_parent_override.py b/spec/python/specwrite/test_nav_parent_override.py new file mode 100644 index 000000000..5c9d5616d --- /dev/null +++ b/spec/python/specwrite/test_nav_parent_override.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.nav_parent_override import NavParentOverride + +class TestNavParentOverride(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestNavParentOverride, self).__init__(*args, **kwargs) + self.struct_class = NavParentOverride + self.src_filename = 'src/nav_parent_codes.bin' + diff --git a/spec/python/specwrite/test_nav_parent_switch.py b/spec/python/specwrite/test_nav_parent_switch.py new file mode 100644 index 000000000..403bf904b --- /dev/null +++ b/spec/python/specwrite/test_nav_parent_switch.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.nav_parent_switch import NavParentSwitch + +class TestNavParentSwitch(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestNavParentSwitch, self).__init__(*args, **kwargs) + self.struct_class = NavParentSwitch + self.src_filename = 'src/nav_parent_switch.bin' + diff --git a/spec/python/specwrite/test_nav_parent_switch_cast.py b/spec/python/specwrite/test_nav_parent_switch_cast.py new file mode 100644 index 000000000..b8bf17e50 --- /dev/null +++ b/spec/python/specwrite/test_nav_parent_switch_cast.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.nav_parent_switch_cast import NavParentSwitchCast + +class TestNavParentSwitchCast(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestNavParentSwitchCast, self).__init__(*args, **kwargs) + self.struct_class = NavParentSwitchCast + self.src_filename = 'src/switch_integers.bin' + diff --git a/spec/python/specwrite/test_nav_parent_vs_value_inst.py b/spec/python/specwrite/test_nav_parent_vs_value_inst.py new file mode 100644 index 000000000..102cb9c00 --- /dev/null +++ b/spec/python/specwrite/test_nav_parent_vs_value_inst.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.nav_parent_vs_value_inst import NavParentVsValueInst + +class TestNavParentVsValueInst(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestNavParentVsValueInst, self).__init__(*args, **kwargs) + self.struct_class = NavParentVsValueInst + self.src_filename = 'src/term_strz.bin' + diff --git a/spec/python/specwrite/test_nav_root.py b/spec/python/specwrite/test_nav_root.py new file mode 100644 index 000000000..94f697114 --- /dev/null +++ b/spec/python/specwrite/test_nav_root.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.nav_root import NavRoot + +class TestNavRoot(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestNavRoot, self).__init__(*args, **kwargs) + self.struct_class = NavRoot + self.src_filename = 'src/nav.bin' + diff --git a/spec/python/specwrite/test_nested_same_name.py b/spec/python/specwrite/test_nested_same_name.py new file mode 100644 index 000000000..19feee092 --- /dev/null +++ b/spec/python/specwrite/test_nested_same_name.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.nested_same_name import NestedSameName + +class TestNestedSameName(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestNestedSameName, self).__init__(*args, **kwargs) + self.struct_class = NestedSameName + self.src_filename = 'src/repeat_n_struct.bin' + diff --git a/spec/python/specwrite/test_nested_same_name2.py b/spec/python/specwrite/test_nested_same_name2.py new file mode 100644 index 000000000..808bd1d64 --- /dev/null +++ b/spec/python/specwrite/test_nested_same_name2.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.nested_same_name2 import NestedSameName2 + +class TestNestedSameName2(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestNestedSameName2, self).__init__(*args, **kwargs) + self.struct_class = NestedSameName2 + self.src_filename = 'src/nested_same_name2.bin' + diff --git a/spec/python/specwrite/test_nested_type_param.py b/spec/python/specwrite/test_nested_type_param.py new file mode 100644 index 000000000..bb2050b9d --- /dev/null +++ b/spec/python/specwrite/test_nested_type_param.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.nested_type_param import NestedTypeParam + +class TestNestedTypeParam(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestNestedTypeParam, self).__init__(*args, **kwargs) + self.struct_class = NestedTypeParam + self.src_filename = 'src/term_strz.bin' + diff --git a/spec/python/specwrite/test_nested_types.py b/spec/python/specwrite/test_nested_types.py new file mode 100644 index 000000000..f6e1b9a60 --- /dev/null +++ b/spec/python/specwrite/test_nested_types.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.nested_types import NestedTypes + +class TestNestedTypes(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestNestedTypes, self).__init__(*args, **kwargs) + self.struct_class = NestedTypes + self.src_filename = 'src/fixed_struct.bin' + diff --git a/spec/python/specwrite/test_nested_types2.py b/spec/python/specwrite/test_nested_types2.py new file mode 100644 index 000000000..530875df5 --- /dev/null +++ b/spec/python/specwrite/test_nested_types2.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.nested_types2 import NestedTypes2 + +class TestNestedTypes2(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestNestedTypes2, self).__init__(*args, **kwargs) + self.struct_class = NestedTypes2 + self.src_filename = 'src/fixed_struct.bin' + diff --git a/spec/python/specwrite/test_nested_types3.py b/spec/python/specwrite/test_nested_types3.py new file mode 100644 index 000000000..31388b428 --- /dev/null +++ b/spec/python/specwrite/test_nested_types3.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.nested_types3 import NestedTypes3 + +class TestNestedTypes3(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestNestedTypes3, self).__init__(*args, **kwargs) + self.struct_class = NestedTypes3 + self.src_filename = 'src/fixed_struct.bin' + diff --git a/spec/python/specwrite/test_non_standard.py b/spec/python/specwrite/test_non_standard.py new file mode 100644 index 000000000..8d1a8c0c2 --- /dev/null +++ b/spec/python/specwrite/test_non_standard.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.non_standard import NonStandard + +class TestNonStandard(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestNonStandard, self).__init__(*args, **kwargs) + self.struct_class = NonStandard + self.src_filename = 'src/fixed_struct.bin' + diff --git a/spec/python/specwrite/test_opaque_external_type.py b/spec/python/specwrite/test_opaque_external_type.py new file mode 100644 index 000000000..456c93d83 --- /dev/null +++ b/spec/python/specwrite/test_opaque_external_type.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.opaque_external_type import OpaqueExternalType + +class TestOpaqueExternalType(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestOpaqueExternalType, self).__init__(*args, **kwargs) + self.struct_class = OpaqueExternalType + self.src_filename = 'src/term_strz.bin' + diff --git a/spec/python/specwrite/test_optional_id.py b/spec/python/specwrite/test_optional_id.py new file mode 100644 index 000000000..ec9d4dd1c --- /dev/null +++ b/spec/python/specwrite/test_optional_id.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.optional_id import OptionalId + +class TestOptionalId(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestOptionalId, self).__init__(*args, **kwargs) + self.struct_class = OptionalId + self.src_filename = 'src/fixed_struct.bin' + diff --git a/spec/python/specwrite/test_params_call_extra_parens.py b/spec/python/specwrite/test_params_call_extra_parens.py new file mode 100644 index 000000000..256e1d976 --- /dev/null +++ b/spec/python/specwrite/test_params_call_extra_parens.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.params_call_extra_parens import ParamsCallExtraParens + +class TestParamsCallExtraParens(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestParamsCallExtraParens, self).__init__(*args, **kwargs) + self.struct_class = ParamsCallExtraParens + self.src_filename = 'src/term_strz.bin' + diff --git a/spec/python/specwrite/test_params_call_short.py b/spec/python/specwrite/test_params_call_short.py new file mode 100644 index 000000000..6d201ef81 --- /dev/null +++ b/spec/python/specwrite/test_params_call_short.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.params_call_short import ParamsCallShort + +class TestParamsCallShort(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestParamsCallShort, self).__init__(*args, **kwargs) + self.struct_class = ParamsCallShort + self.src_filename = 'src/term_strz.bin' + diff --git a/spec/python/specwrite/test_params_enum.py b/spec/python/specwrite/test_params_enum.py new file mode 100644 index 000000000..711793fe1 --- /dev/null +++ b/spec/python/specwrite/test_params_enum.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.params_enum import ParamsEnum + +class TestParamsEnum(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestParamsEnum, self).__init__(*args, **kwargs) + self.struct_class = ParamsEnum + self.src_filename = 'src/enum_0.bin' + diff --git a/spec/python/specwrite/test_params_pass_array_int.py b/spec/python/specwrite/test_params_pass_array_int.py new file mode 100644 index 000000000..438b0542c --- /dev/null +++ b/spec/python/specwrite/test_params_pass_array_int.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.params_pass_array_int import ParamsPassArrayInt + +class TestParamsPassArrayInt(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestParamsPassArrayInt, self).__init__(*args, **kwargs) + self.struct_class = ParamsPassArrayInt + self.src_filename = 'src/position_to_end.bin' + diff --git a/spec/python/specwrite/test_params_pass_array_io.py b/spec/python/specwrite/test_params_pass_array_io.py new file mode 100644 index 000000000..ab080e9fc --- /dev/null +++ b/spec/python/specwrite/test_params_pass_array_io.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.params_pass_array_io import ParamsPassArrayIo + +class TestParamsPassArrayIo(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestParamsPassArrayIo, self).__init__(*args, **kwargs) + self.struct_class = ParamsPassArrayIo + self.src_filename = 'src/enum_negative.bin' + diff --git a/spec/python/specwrite/test_params_pass_array_str.py b/spec/python/specwrite/test_params_pass_array_str.py new file mode 100644 index 000000000..987f970ab --- /dev/null +++ b/spec/python/specwrite/test_params_pass_array_str.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.params_pass_array_str import ParamsPassArrayStr + +class TestParamsPassArrayStr(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestParamsPassArrayStr, self).__init__(*args, **kwargs) + self.struct_class = ParamsPassArrayStr + self.src_filename = 'src/term_strz.bin' + diff --git a/spec/python/specwrite/test_params_pass_array_struct.py b/spec/python/specwrite/test_params_pass_array_struct.py new file mode 100644 index 000000000..33e3f2dd8 --- /dev/null +++ b/spec/python/specwrite/test_params_pass_array_struct.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.params_pass_array_struct import ParamsPassArrayStruct + +class TestParamsPassArrayStruct(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestParamsPassArrayStruct, self).__init__(*args, **kwargs) + self.struct_class = ParamsPassArrayStruct + self.src_filename = 'src/position_to_end.bin' + diff --git a/spec/python/specwrite/test_params_pass_array_usertype.py b/spec/python/specwrite/test_params_pass_array_usertype.py new file mode 100644 index 000000000..760816f3e --- /dev/null +++ b/spec/python/specwrite/test_params_pass_array_usertype.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.params_pass_array_usertype import ParamsPassArrayUsertype + +class TestParamsPassArrayUsertype(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestParamsPassArrayUsertype, self).__init__(*args, **kwargs) + self.struct_class = ParamsPassArrayUsertype + self.src_filename = 'src/position_to_end.bin' + diff --git a/spec/python/specwrite/test_params_pass_bool.py b/spec/python/specwrite/test_params_pass_bool.py new file mode 100644 index 000000000..587d4a0c4 --- /dev/null +++ b/spec/python/specwrite/test_params_pass_bool.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.params_pass_bool import ParamsPassBool + +class TestParamsPassBool(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestParamsPassBool, self).__init__(*args, **kwargs) + self.struct_class = ParamsPassBool + self.src_filename = 'src/term_strz.bin' + diff --git a/spec/python/specwrite/test_params_pass_io.py b/spec/python/specwrite/test_params_pass_io.py new file mode 100644 index 000000000..a57cf760f --- /dev/null +++ b/spec/python/specwrite/test_params_pass_io.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.params_pass_io import ParamsPassIo + +class TestParamsPassIo(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestParamsPassIo, self).__init__(*args, **kwargs) + self.struct_class = ParamsPassIo + self.src_filename = 'src/enum_negative.bin' + diff --git a/spec/python/specwrite/test_params_pass_struct.py b/spec/python/specwrite/test_params_pass_struct.py new file mode 100644 index 000000000..85bc0f9ac --- /dev/null +++ b/spec/python/specwrite/test_params_pass_struct.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.params_pass_struct import ParamsPassStruct + +class TestParamsPassStruct(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestParamsPassStruct, self).__init__(*args, **kwargs) + self.struct_class = ParamsPassStruct + self.src_filename = 'src/enum_negative.bin' + diff --git a/spec/python/specwrite/test_params_pass_usertype.py b/spec/python/specwrite/test_params_pass_usertype.py new file mode 100644 index 000000000..b547fc456 --- /dev/null +++ b/spec/python/specwrite/test_params_pass_usertype.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.params_pass_usertype import ParamsPassUsertype + +class TestParamsPassUsertype(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestParamsPassUsertype, self).__init__(*args, **kwargs) + self.struct_class = ParamsPassUsertype + self.src_filename = 'src/position_in_seq.bin' + diff --git a/spec/python/specwrite/test_position_abs.py b/spec/python/specwrite/test_position_abs.py new file mode 100644 index 000000000..a3b739719 --- /dev/null +++ b/spec/python/specwrite/test_position_abs.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.position_abs import PositionAbs + +class TestPositionAbs(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestPositionAbs, self).__init__(*args, **kwargs) + self.struct_class = PositionAbs + self.src_filename = 'src/position_abs.bin' + diff --git a/spec/python/specwrite/test_position_in_seq.py b/spec/python/specwrite/test_position_in_seq.py new file mode 100644 index 000000000..fae4fc1e6 --- /dev/null +++ b/spec/python/specwrite/test_position_in_seq.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.position_in_seq import PositionInSeq + +class TestPositionInSeq(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestPositionInSeq, self).__init__(*args, **kwargs) + self.struct_class = PositionInSeq + self.src_filename = 'src/position_in_seq.bin' + diff --git a/spec/python/specwrite/test_position_to_end.py b/spec/python/specwrite/test_position_to_end.py new file mode 100644 index 000000000..6de1d2bb9 --- /dev/null +++ b/spec/python/specwrite/test_position_to_end.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.position_to_end import PositionToEnd + +class TestPositionToEnd(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestPositionToEnd, self).__init__(*args, **kwargs) + self.struct_class = PositionToEnd + self.src_filename = 'src/position_to_end.bin' + diff --git a/spec/python/specwrite/test_process_bytes_pad_term.py b/spec/python/specwrite/test_process_bytes_pad_term.py new file mode 100644 index 000000000..10eaee668 --- /dev/null +++ b/spec/python/specwrite/test_process_bytes_pad_term.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.process_bytes_pad_term import ProcessBytesPadTerm + +class TestProcessBytesPadTerm(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestProcessBytesPadTerm, self).__init__(*args, **kwargs) + self.struct_class = ProcessBytesPadTerm + self.src_filename = 'src/str_pad_term.bin' + diff --git a/spec/python/specwrite/test_process_coerce_bytes.py b/spec/python/specwrite/test_process_coerce_bytes.py new file mode 100644 index 000000000..513437348 --- /dev/null +++ b/spec/python/specwrite/test_process_coerce_bytes.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.process_coerce_bytes import ProcessCoerceBytes + +class TestProcessCoerceBytes(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestProcessCoerceBytes, self).__init__(*args, **kwargs) + self.struct_class = ProcessCoerceBytes + self.src_filename = 'src/process_coerce_bytes.bin' + diff --git a/spec/python/specwrite/test_process_coerce_switch.py b/spec/python/specwrite/test_process_coerce_switch.py new file mode 100644 index 000000000..2fa936dfb --- /dev/null +++ b/spec/python/specwrite/test_process_coerce_switch.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.process_coerce_switch import ProcessCoerceSwitch + +class TestProcessCoerceSwitch(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestProcessCoerceSwitch, self).__init__(*args, **kwargs) + self.struct_class = ProcessCoerceSwitch + self.src_filename = 'src/process_coerce_switch.bin' + diff --git a/spec/python/specwrite/test_process_coerce_usertype1.py b/spec/python/specwrite/test_process_coerce_usertype1.py new file mode 100644 index 000000000..6b8a04cf1 --- /dev/null +++ b/spec/python/specwrite/test_process_coerce_usertype1.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.process_coerce_usertype1 import ProcessCoerceUsertype1 + +class TestProcessCoerceUsertype1(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestProcessCoerceUsertype1, self).__init__(*args, **kwargs) + self.struct_class = ProcessCoerceUsertype1 + self.src_filename = 'src/process_coerce_bytes.bin' + diff --git a/spec/python/specwrite/test_process_coerce_usertype2.py b/spec/python/specwrite/test_process_coerce_usertype2.py new file mode 100644 index 000000000..4b80c592e --- /dev/null +++ b/spec/python/specwrite/test_process_coerce_usertype2.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.process_coerce_usertype2 import ProcessCoerceUsertype2 + +class TestProcessCoerceUsertype2(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestProcessCoerceUsertype2, self).__init__(*args, **kwargs) + self.struct_class = ProcessCoerceUsertype2 + self.src_filename = 'src/process_coerce_bytes.bin' + diff --git a/spec/python/specwrite/test_process_custom.py b/spec/python/specwrite/test_process_custom.py new file mode 100644 index 000000000..209e47b77 --- /dev/null +++ b/spec/python/specwrite/test_process_custom.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.process_custom import ProcessCustom + +class TestProcessCustom(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestProcessCustom, self).__init__(*args, **kwargs) + self.struct_class = ProcessCustom + self.src_filename = 'src/process_rotate.bin' + diff --git a/spec/python/specwrite/test_process_custom_no_args.py b/spec/python/specwrite/test_process_custom_no_args.py new file mode 100644 index 000000000..8371c6d69 --- /dev/null +++ b/spec/python/specwrite/test_process_custom_no_args.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.process_custom_no_args import ProcessCustomNoArgs + +class TestProcessCustomNoArgs(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestProcessCustomNoArgs, self).__init__(*args, **kwargs) + self.struct_class = ProcessCustomNoArgs + self.src_filename = 'src/process_rotate.bin' + diff --git a/spec/python/specwrite/test_process_repeat_bytes.py b/spec/python/specwrite/test_process_repeat_bytes.py new file mode 100644 index 000000000..fbb558252 --- /dev/null +++ b/spec/python/specwrite/test_process_repeat_bytes.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.process_repeat_bytes import ProcessRepeatBytes + +class TestProcessRepeatBytes(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestProcessRepeatBytes, self).__init__(*args, **kwargs) + self.struct_class = ProcessRepeatBytes + self.src_filename = 'src/process_xor_4.bin' + diff --git a/spec/python/specwrite/test_process_repeat_usertype.py b/spec/python/specwrite/test_process_repeat_usertype.py new file mode 100644 index 000000000..a9b01880a --- /dev/null +++ b/spec/python/specwrite/test_process_repeat_usertype.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.process_repeat_usertype import ProcessRepeatUsertype + +class TestProcessRepeatUsertype(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestProcessRepeatUsertype, self).__init__(*args, **kwargs) + self.struct_class = ProcessRepeatUsertype + self.src_filename = 'src/process_xor_4.bin' + diff --git a/spec/python/specwrite/test_process_repeat_usertype_dynarg_custom.py b/spec/python/specwrite/test_process_repeat_usertype_dynarg_custom.py new file mode 100644 index 000000000..a8227788b --- /dev/null +++ b/spec/python/specwrite/test_process_repeat_usertype_dynarg_custom.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.process_repeat_usertype_dynarg_custom import ProcessRepeatUsertypeDynargCustom + +class TestProcessRepeatUsertypeDynargCustom(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestProcessRepeatUsertypeDynargCustom, self).__init__(*args, **kwargs) + self.struct_class = ProcessRepeatUsertypeDynargCustom + self.src_filename = 'src/process_rotate.bin' + diff --git a/spec/python/specwrite/test_process_repeat_usertype_dynarg_rotate.py b/spec/python/specwrite/test_process_repeat_usertype_dynarg_rotate.py new file mode 100644 index 000000000..fe775cfbf --- /dev/null +++ b/spec/python/specwrite/test_process_repeat_usertype_dynarg_rotate.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.process_repeat_usertype_dynarg_rotate import ProcessRepeatUsertypeDynargRotate + +class TestProcessRepeatUsertypeDynargRotate(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestProcessRepeatUsertypeDynargRotate, self).__init__(*args, **kwargs) + self.struct_class = ProcessRepeatUsertypeDynargRotate + self.src_filename = 'src/process_rotate.bin' + diff --git a/spec/python/specwrite/test_process_repeat_usertype_dynarg_xor.py b/spec/python/specwrite/test_process_repeat_usertype_dynarg_xor.py new file mode 100644 index 000000000..21e51addc --- /dev/null +++ b/spec/python/specwrite/test_process_repeat_usertype_dynarg_xor.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.process_repeat_usertype_dynarg_xor import ProcessRepeatUsertypeDynargXor + +class TestProcessRepeatUsertypeDynargXor(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestProcessRepeatUsertypeDynargXor, self).__init__(*args, **kwargs) + self.struct_class = ProcessRepeatUsertypeDynargXor + self.src_filename = 'src/process_xor_4.bin' + diff --git a/spec/python/specwrite/test_process_rotate.py b/spec/python/specwrite/test_process_rotate.py new file mode 100644 index 000000000..a02e795ee --- /dev/null +++ b/spec/python/specwrite/test_process_rotate.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.process_rotate import ProcessRotate + +class TestProcessRotate(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestProcessRotate, self).__init__(*args, **kwargs) + self.struct_class = ProcessRotate + self.src_filename = 'src/process_rotate.bin' + diff --git a/spec/python/specwrite/test_process_struct_pad_term.py b/spec/python/specwrite/test_process_struct_pad_term.py new file mode 100644 index 000000000..610381987 --- /dev/null +++ b/spec/python/specwrite/test_process_struct_pad_term.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.process_struct_pad_term import ProcessStructPadTerm + +class TestProcessStructPadTerm(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestProcessStructPadTerm, self).__init__(*args, **kwargs) + self.struct_class = ProcessStructPadTerm + self.src_filename = 'src/str_pad_term.bin' + diff --git a/spec/python/specwrite/test_process_term_struct.py b/spec/python/specwrite/test_process_term_struct.py new file mode 100644 index 000000000..0a4279fa3 --- /dev/null +++ b/spec/python/specwrite/test_process_term_struct.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.process_term_struct import ProcessTermStruct + +class TestProcessTermStruct(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestProcessTermStruct, self).__init__(*args, **kwargs) + self.struct_class = ProcessTermStruct + self.src_filename = 'src/term_strz.bin' + diff --git a/spec/python/specwrite/test_process_to_user.py b/spec/python/specwrite/test_process_to_user.py new file mode 100644 index 000000000..b8d04025a --- /dev/null +++ b/spec/python/specwrite/test_process_to_user.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.process_to_user import ProcessToUser + +class TestProcessToUser(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestProcessToUser, self).__init__(*args, **kwargs) + self.struct_class = ProcessToUser + self.src_filename = 'src/process_rotate.bin' + diff --git a/spec/python/specwrite/test_process_xor4_const.py b/spec/python/specwrite/test_process_xor4_const.py new file mode 100644 index 000000000..37de705b2 --- /dev/null +++ b/spec/python/specwrite/test_process_xor4_const.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.process_xor4_const import ProcessXor4Const + +class TestProcessXor4Const(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestProcessXor4Const, self).__init__(*args, **kwargs) + self.struct_class = ProcessXor4Const + self.src_filename = 'src/process_xor_4.bin' + diff --git a/spec/python/specwrite/test_process_xor4_value.py b/spec/python/specwrite/test_process_xor4_value.py new file mode 100644 index 000000000..94cadcf00 --- /dev/null +++ b/spec/python/specwrite/test_process_xor4_value.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.process_xor4_value import ProcessXor4Value + +class TestProcessXor4Value(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestProcessXor4Value, self).__init__(*args, **kwargs) + self.struct_class = ProcessXor4Value + self.src_filename = 'src/process_xor_4.bin' + diff --git a/spec/python/specwrite/test_process_xor_const.py b/spec/python/specwrite/test_process_xor_const.py new file mode 100644 index 000000000..c88d6aa43 --- /dev/null +++ b/spec/python/specwrite/test_process_xor_const.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.process_xor_const import ProcessXorConst + +class TestProcessXorConst(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestProcessXorConst, self).__init__(*args, **kwargs) + self.struct_class = ProcessXorConst + self.src_filename = 'src/process_xor_1.bin' + diff --git a/spec/python/specwrite/test_process_xor_value.py b/spec/python/specwrite/test_process_xor_value.py new file mode 100644 index 000000000..44bce26bf --- /dev/null +++ b/spec/python/specwrite/test_process_xor_value.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.process_xor_value import ProcessXorValue + +class TestProcessXorValue(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestProcessXorValue, self).__init__(*args, **kwargs) + self.struct_class = ProcessXorValue + self.src_filename = 'src/process_xor_1.bin' + diff --git a/spec/python/specwrite/test_recursive_one.py b/spec/python/specwrite/test_recursive_one.py new file mode 100644 index 000000000..88a3a4009 --- /dev/null +++ b/spec/python/specwrite/test_recursive_one.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.recursive_one import RecursiveOne + +class TestRecursiveOne(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestRecursiveOne, self).__init__(*args, **kwargs) + self.struct_class = RecursiveOne + self.src_filename = 'src/fixed_struct.bin' + diff --git a/spec/python/specwrite/test_repeat_eos_bit.py b/spec/python/specwrite/test_repeat_eos_bit.py new file mode 100644 index 000000000..c13e11d03 --- /dev/null +++ b/spec/python/specwrite/test_repeat_eos_bit.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.repeat_eos_bit import RepeatEosBit + +class TestRepeatEosBit(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestRepeatEosBit, self).__init__(*args, **kwargs) + self.struct_class = RepeatEosBit + self.src_filename = 'src/enum_0.bin' + diff --git a/spec/python/specwrite/test_repeat_eos_bytes.py b/spec/python/specwrite/test_repeat_eos_bytes.py new file mode 100644 index 000000000..1cefbc3c4 --- /dev/null +++ b/spec/python/specwrite/test_repeat_eos_bytes.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.repeat_eos_bytes import RepeatEosBytes + +class TestRepeatEosBytes(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestRepeatEosBytes, self).__init__(*args, **kwargs) + self.struct_class = RepeatEosBytes + self.src_filename = 'src/repeat_until_process.bin' + diff --git a/spec/python/specwrite/test_repeat_eos_bytes_pad.py b/spec/python/specwrite/test_repeat_eos_bytes_pad.py new file mode 100644 index 000000000..dcc58ae12 --- /dev/null +++ b/spec/python/specwrite/test_repeat_eos_bytes_pad.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.repeat_eos_bytes_pad import RepeatEosBytesPad + +class TestRepeatEosBytesPad(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestRepeatEosBytesPad, self).__init__(*args, **kwargs) + self.struct_class = RepeatEosBytesPad + self.src_filename = 'src/repeat_until_process.bin' + diff --git a/spec/python/specwrite/test_repeat_eos_bytes_pad_term.py b/spec/python/specwrite/test_repeat_eos_bytes_pad_term.py new file mode 100644 index 000000000..aa62f3505 --- /dev/null +++ b/spec/python/specwrite/test_repeat_eos_bytes_pad_term.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.repeat_eos_bytes_pad_term import RepeatEosBytesPadTerm + +class TestRepeatEosBytesPadTerm(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestRepeatEosBytesPadTerm, self).__init__(*args, **kwargs) + self.struct_class = RepeatEosBytesPadTerm + self.src_filename = 'src/repeat_until_process.bin' + diff --git a/spec/python/specwrite/test_repeat_eos_struct.py b/spec/python/specwrite/test_repeat_eos_struct.py new file mode 100644 index 000000000..9ea490a92 --- /dev/null +++ b/spec/python/specwrite/test_repeat_eos_struct.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.repeat_eos_struct import RepeatEosStruct + +class TestRepeatEosStruct(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestRepeatEosStruct, self).__init__(*args, **kwargs) + self.struct_class = RepeatEosStruct + self.src_filename = 'src/repeat_eos_struct.bin' + diff --git a/spec/python/specwrite/test_repeat_eos_term_bytes.py b/spec/python/specwrite/test_repeat_eos_term_bytes.py new file mode 100644 index 000000000..957c7cb03 --- /dev/null +++ b/spec/python/specwrite/test_repeat_eos_term_bytes.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.repeat_eos_term_bytes import RepeatEosTermBytes + +class TestRepeatEosTermBytes(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestRepeatEosTermBytes, self).__init__(*args, **kwargs) + self.struct_class = RepeatEosTermBytes + self.src_filename = 'src/process_rotate.bin' + diff --git a/spec/python/specwrite/test_repeat_eos_term_struct.py b/spec/python/specwrite/test_repeat_eos_term_struct.py new file mode 100644 index 000000000..76ffc471e --- /dev/null +++ b/spec/python/specwrite/test_repeat_eos_term_struct.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.repeat_eos_term_struct import RepeatEosTermStruct + +class TestRepeatEosTermStruct(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestRepeatEosTermStruct, self).__init__(*args, **kwargs) + self.struct_class = RepeatEosTermStruct + self.src_filename = 'src/process_rotate.bin' + diff --git a/spec/python/specwrite/test_repeat_eos_u4.py b/spec/python/specwrite/test_repeat_eos_u4.py new file mode 100644 index 000000000..25f651697 --- /dev/null +++ b/spec/python/specwrite/test_repeat_eos_u4.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.repeat_eos_u4 import RepeatEosU4 + +class TestRepeatEosU4(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestRepeatEosU4, self).__init__(*args, **kwargs) + self.struct_class = RepeatEosU4 + self.src_filename = 'src/repeat_eos_struct.bin' + diff --git a/spec/python/specwrite/test_repeat_n_bytes.py b/spec/python/specwrite/test_repeat_n_bytes.py new file mode 100644 index 000000000..e0b9ccac8 --- /dev/null +++ b/spec/python/specwrite/test_repeat_n_bytes.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.repeat_n_bytes import RepeatNBytes + +class TestRepeatNBytes(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestRepeatNBytes, self).__init__(*args, **kwargs) + self.struct_class = RepeatNBytes + self.src_filename = 'src/repeat_until_process.bin' + diff --git a/spec/python/specwrite/test_repeat_n_bytes_pad.py b/spec/python/specwrite/test_repeat_n_bytes_pad.py new file mode 100644 index 000000000..a9b62b88b --- /dev/null +++ b/spec/python/specwrite/test_repeat_n_bytes_pad.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.repeat_n_bytes_pad import RepeatNBytesPad + +class TestRepeatNBytesPad(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestRepeatNBytesPad, self).__init__(*args, **kwargs) + self.struct_class = RepeatNBytesPad + self.src_filename = 'src/repeat_until_process.bin' + diff --git a/spec/python/specwrite/test_repeat_n_bytes_pad_term.py b/spec/python/specwrite/test_repeat_n_bytes_pad_term.py new file mode 100644 index 000000000..e0cd188b2 --- /dev/null +++ b/spec/python/specwrite/test_repeat_n_bytes_pad_term.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.repeat_n_bytes_pad_term import RepeatNBytesPadTerm + +class TestRepeatNBytesPadTerm(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestRepeatNBytesPadTerm, self).__init__(*args, **kwargs) + self.struct_class = RepeatNBytesPadTerm + self.src_filename = 'src/repeat_until_process.bin' + diff --git a/spec/python/specwrite/test_repeat_n_struct.py b/spec/python/specwrite/test_repeat_n_struct.py new file mode 100644 index 000000000..eb4fe6985 --- /dev/null +++ b/spec/python/specwrite/test_repeat_n_struct.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.repeat_n_struct import RepeatNStruct + +class TestRepeatNStruct(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestRepeatNStruct, self).__init__(*args, **kwargs) + self.struct_class = RepeatNStruct + self.src_filename = 'src/repeat_n_struct.bin' + diff --git a/spec/python/specwrite/test_repeat_n_strz.py b/spec/python/specwrite/test_repeat_n_strz.py new file mode 100644 index 000000000..263d24406 --- /dev/null +++ b/spec/python/specwrite/test_repeat_n_strz.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.repeat_n_strz import RepeatNStrz + +class TestRepeatNStrz(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestRepeatNStrz, self).__init__(*args, **kwargs) + self.struct_class = RepeatNStrz + self.src_filename = 'src/repeat_n_strz.bin' + diff --git a/spec/python/specwrite/test_repeat_n_strz_double.py b/spec/python/specwrite/test_repeat_n_strz_double.py new file mode 100644 index 000000000..5be076206 --- /dev/null +++ b/spec/python/specwrite/test_repeat_n_strz_double.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.repeat_n_strz_double import RepeatNStrzDouble + +class TestRepeatNStrzDouble(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestRepeatNStrzDouble, self).__init__(*args, **kwargs) + self.struct_class = RepeatNStrzDouble + self.src_filename = 'src/repeat_n_strz.bin' + diff --git a/spec/python/specwrite/test_repeat_n_term_bytes.py b/spec/python/specwrite/test_repeat_n_term_bytes.py new file mode 100644 index 000000000..af7bd91e4 --- /dev/null +++ b/spec/python/specwrite/test_repeat_n_term_bytes.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.repeat_n_term_bytes import RepeatNTermBytes + +class TestRepeatNTermBytes(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestRepeatNTermBytes, self).__init__(*args, **kwargs) + self.struct_class = RepeatNTermBytes + self.src_filename = 'src/repeat_until_process.bin' + diff --git a/spec/python/specwrite/test_repeat_n_term_struct.py b/spec/python/specwrite/test_repeat_n_term_struct.py new file mode 100644 index 000000000..f83c98f67 --- /dev/null +++ b/spec/python/specwrite/test_repeat_n_term_struct.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.repeat_n_term_struct import RepeatNTermStruct + +class TestRepeatNTermStruct(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestRepeatNTermStruct, self).__init__(*args, **kwargs) + self.struct_class = RepeatNTermStruct + self.src_filename = 'src/repeat_until_process.bin' + diff --git a/spec/python/specwrite/test_repeat_until_bytes.py b/spec/python/specwrite/test_repeat_until_bytes.py new file mode 100644 index 000000000..2e15a611f --- /dev/null +++ b/spec/python/specwrite/test_repeat_until_bytes.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.repeat_until_bytes import RepeatUntilBytes + +class TestRepeatUntilBytes(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestRepeatUntilBytes, self).__init__(*args, **kwargs) + self.struct_class = RepeatUntilBytes + self.src_filename = 'src/repeat_until_process.bin' + diff --git a/spec/python/specwrite/test_repeat_until_bytes_pad.py b/spec/python/specwrite/test_repeat_until_bytes_pad.py new file mode 100644 index 000000000..e17e38166 --- /dev/null +++ b/spec/python/specwrite/test_repeat_until_bytes_pad.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.repeat_until_bytes_pad import RepeatUntilBytesPad + +class TestRepeatUntilBytesPad(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestRepeatUntilBytesPad, self).__init__(*args, **kwargs) + self.struct_class = RepeatUntilBytesPad + self.src_filename = 'src/repeat_until_process.bin' + diff --git a/spec/python/specwrite/test_repeat_until_bytes_pad_term.py b/spec/python/specwrite/test_repeat_until_bytes_pad_term.py new file mode 100644 index 000000000..3a5e2303c --- /dev/null +++ b/spec/python/specwrite/test_repeat_until_bytes_pad_term.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.repeat_until_bytes_pad_term import RepeatUntilBytesPadTerm + +class TestRepeatUntilBytesPadTerm(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestRepeatUntilBytesPadTerm, self).__init__(*args, **kwargs) + self.struct_class = RepeatUntilBytesPadTerm + self.src_filename = 'src/repeat_until_process.bin' + diff --git a/spec/python/specwrite/test_repeat_until_calc_array_type.py b/spec/python/specwrite/test_repeat_until_calc_array_type.py new file mode 100644 index 000000000..b561ebe69 --- /dev/null +++ b/spec/python/specwrite/test_repeat_until_calc_array_type.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.repeat_until_calc_array_type import RepeatUntilCalcArrayType + +class TestRepeatUntilCalcArrayType(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestRepeatUntilCalcArrayType, self).__init__(*args, **kwargs) + self.struct_class = RepeatUntilCalcArrayType + self.src_filename = 'src/repeat_until_process.bin' + diff --git a/spec/python/specwrite/test_repeat_until_complex.py b/spec/python/specwrite/test_repeat_until_complex.py new file mode 100644 index 000000000..6ca09754a --- /dev/null +++ b/spec/python/specwrite/test_repeat_until_complex.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.repeat_until_complex import RepeatUntilComplex + +class TestRepeatUntilComplex(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestRepeatUntilComplex, self).__init__(*args, **kwargs) + self.struct_class = RepeatUntilComplex + self.src_filename = 'src/repeat_until_complex.bin' + diff --git a/spec/python/specwrite/test_repeat_until_s4.py b/spec/python/specwrite/test_repeat_until_s4.py new file mode 100644 index 000000000..79fd33cb2 --- /dev/null +++ b/spec/python/specwrite/test_repeat_until_s4.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.repeat_until_s4 import RepeatUntilS4 + +class TestRepeatUntilS4(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestRepeatUntilS4, self).__init__(*args, **kwargs) + self.struct_class = RepeatUntilS4 + self.src_filename = 'src/repeat_until_s4.bin' + diff --git a/spec/python/specwrite/test_repeat_until_sized.py b/spec/python/specwrite/test_repeat_until_sized.py new file mode 100644 index 000000000..b01b88f1a --- /dev/null +++ b/spec/python/specwrite/test_repeat_until_sized.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.repeat_until_sized import RepeatUntilSized + +class TestRepeatUntilSized(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestRepeatUntilSized, self).__init__(*args, **kwargs) + self.struct_class = RepeatUntilSized + self.src_filename = 'src/repeat_until_process.bin' + diff --git a/spec/python/specwrite/test_repeat_until_term_bytes.py b/spec/python/specwrite/test_repeat_until_term_bytes.py new file mode 100644 index 000000000..9f09345c7 --- /dev/null +++ b/spec/python/specwrite/test_repeat_until_term_bytes.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.repeat_until_term_bytes import RepeatUntilTermBytes + +class TestRepeatUntilTermBytes(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestRepeatUntilTermBytes, self).__init__(*args, **kwargs) + self.struct_class = RepeatUntilTermBytes + self.src_filename = 'src/repeat_until_process.bin' + diff --git a/spec/python/specwrite/test_repeat_until_term_struct.py b/spec/python/specwrite/test_repeat_until_term_struct.py new file mode 100644 index 000000000..27a9d1747 --- /dev/null +++ b/spec/python/specwrite/test_repeat_until_term_struct.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.repeat_until_term_struct import RepeatUntilTermStruct + +class TestRepeatUntilTermStruct(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestRepeatUntilTermStruct, self).__init__(*args, **kwargs) + self.struct_class = RepeatUntilTermStruct + self.src_filename = 'src/repeat_until_process.bin' + diff --git a/spec/python/specwrite/test_str_encodings.py b/spec/python/specwrite/test_str_encodings.py new file mode 100644 index 000000000..d088aa98e --- /dev/null +++ b/spec/python/specwrite/test_str_encodings.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.str_encodings import StrEncodings + +class TestStrEncodings(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestStrEncodings, self).__init__(*args, **kwargs) + self.struct_class = StrEncodings + self.src_filename = 'src/str_encodings.bin' + diff --git a/spec/python/specwrite/test_str_encodings_default.py b/spec/python/specwrite/test_str_encodings_default.py new file mode 100644 index 000000000..b6691d5ad --- /dev/null +++ b/spec/python/specwrite/test_str_encodings_default.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.str_encodings_default import StrEncodingsDefault + +class TestStrEncodingsDefault(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestStrEncodingsDefault, self).__init__(*args, **kwargs) + self.struct_class = StrEncodingsDefault + self.src_filename = 'src/str_encodings.bin' + diff --git a/spec/python/specwrite/test_str_encodings_utf16.py b/spec/python/specwrite/test_str_encodings_utf16.py new file mode 100644 index 000000000..734fa3a5d --- /dev/null +++ b/spec/python/specwrite/test_str_encodings_utf16.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.str_encodings_utf16 import StrEncodingsUtf16 + +class TestStrEncodingsUtf16(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestStrEncodingsUtf16, self).__init__(*args, **kwargs) + self.struct_class = StrEncodingsUtf16 + self.src_filename = 'src/str_encodings_utf16.bin' + diff --git a/spec/python/specwrite/test_str_eos.py b/spec/python/specwrite/test_str_eos.py new file mode 100644 index 000000000..45536a1f6 --- /dev/null +++ b/spec/python/specwrite/test_str_eos.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.str_eos import StrEos + +class TestStrEos(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestStrEos, self).__init__(*args, **kwargs) + self.struct_class = StrEos + self.src_filename = 'src/term_strz.bin' + diff --git a/spec/python/specwrite/test_str_eos_pad_term.py b/spec/python/specwrite/test_str_eos_pad_term.py new file mode 100644 index 000000000..838507b0f --- /dev/null +++ b/spec/python/specwrite/test_str_eos_pad_term.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.str_eos_pad_term import StrEosPadTerm + +class TestStrEosPadTerm(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestStrEosPadTerm, self).__init__(*args, **kwargs) + self.struct_class = StrEosPadTerm + self.src_filename = 'src/str_pad_term.bin' + diff --git a/spec/python/specwrite/test_str_eos_pad_term_empty.py b/spec/python/specwrite/test_str_eos_pad_term_empty.py new file mode 100644 index 000000000..8897f50bb --- /dev/null +++ b/spec/python/specwrite/test_str_eos_pad_term_empty.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.str_eos_pad_term_empty import StrEosPadTermEmpty + +class TestStrEosPadTermEmpty(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestStrEosPadTermEmpty, self).__init__(*args, **kwargs) + self.struct_class = StrEosPadTermEmpty + self.src_filename = 'src/str_pad_term_empty.bin' + diff --git a/spec/python/specwrite/test_str_eos_pad_term_equal.py b/spec/python/specwrite/test_str_eos_pad_term_equal.py new file mode 100644 index 000000000..c2ba5dd14 --- /dev/null +++ b/spec/python/specwrite/test_str_eos_pad_term_equal.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.str_eos_pad_term_equal import StrEosPadTermEqual + +class TestStrEosPadTermEqual(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestStrEosPadTermEqual, self).__init__(*args, **kwargs) + self.struct_class = StrEosPadTermEqual + self.src_filename = 'src/str_pad_term.bin' + diff --git a/spec/python/specwrite/test_str_literals2.py b/spec/python/specwrite/test_str_literals2.py new file mode 100644 index 000000000..83f9e66f1 --- /dev/null +++ b/spec/python/specwrite/test_str_literals2.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.str_literals2 import StrLiterals2 + +class TestStrLiterals2(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestStrLiterals2, self).__init__(*args, **kwargs) + self.struct_class = StrLiterals2 + self.src_filename = 'src/fixed_struct.bin' + diff --git a/spec/python/specwrite/test_str_pad_term.py b/spec/python/specwrite/test_str_pad_term.py new file mode 100644 index 000000000..4b79dfa9d --- /dev/null +++ b/spec/python/specwrite/test_str_pad_term.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.str_pad_term import StrPadTerm + +class TestStrPadTerm(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestStrPadTerm, self).__init__(*args, **kwargs) + self.struct_class = StrPadTerm + self.src_filename = 'src/str_pad_term.bin' + diff --git a/spec/python/specwrite/test_str_pad_term_empty.py b/spec/python/specwrite/test_str_pad_term_empty.py new file mode 100644 index 000000000..0c0d17da8 --- /dev/null +++ b/spec/python/specwrite/test_str_pad_term_empty.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.str_pad_term_empty import StrPadTermEmpty + +class TestStrPadTermEmpty(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestStrPadTermEmpty, self).__init__(*args, **kwargs) + self.struct_class = StrPadTermEmpty + self.src_filename = 'src/str_pad_term_empty.bin' + diff --git a/spec/python/specwrite/test_str_pad_term_equal.py b/spec/python/specwrite/test_str_pad_term_equal.py new file mode 100644 index 000000000..2d1b28f30 --- /dev/null +++ b/spec/python/specwrite/test_str_pad_term_equal.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.str_pad_term_equal import StrPadTermEqual + +class TestStrPadTermEqual(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestStrPadTermEqual, self).__init__(*args, **kwargs) + self.struct_class = StrPadTermEqual + self.src_filename = 'src/str_pad_term.bin' + diff --git a/spec/python/specwrite/test_str_pad_term_roundtrip.py b/spec/python/specwrite/test_str_pad_term_roundtrip.py new file mode 100644 index 000000000..d7fbe7602 --- /dev/null +++ b/spec/python/specwrite/test_str_pad_term_roundtrip.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.str_pad_term_roundtrip import StrPadTermRoundtrip + +class TestStrPadTermRoundtrip(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestStrPadTermRoundtrip, self).__init__(*args, **kwargs) + self.struct_class = StrPadTermRoundtrip + self.src_filename = 'src/str_pad_term.bin' + diff --git a/spec/python/specwrite/test_str_pad_term_zero_size.py b/spec/python/specwrite/test_str_pad_term_zero_size.py new file mode 100644 index 000000000..dfb523993 --- /dev/null +++ b/spec/python/specwrite/test_str_pad_term_zero_size.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.str_pad_term_zero_size import StrPadTermZeroSize + +class TestStrPadTermZeroSize(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestStrPadTermZeroSize, self).__init__(*args, **kwargs) + self.struct_class = StrPadTermZeroSize + self.src_filename = 'src/enum_negative.bin' + diff --git a/spec/python/specwrite/test_struct_pad_term.py b/spec/python/specwrite/test_struct_pad_term.py new file mode 100644 index 000000000..cb579e5b4 --- /dev/null +++ b/spec/python/specwrite/test_struct_pad_term.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.struct_pad_term import StructPadTerm + +class TestStructPadTerm(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestStructPadTerm, self).__init__(*args, **kwargs) + self.struct_class = StructPadTerm + self.src_filename = 'src/str_pad_term.bin' + diff --git a/spec/python/specwrite/test_struct_pad_term_equal.py b/spec/python/specwrite/test_struct_pad_term_equal.py new file mode 100644 index 000000000..c3f7ae606 --- /dev/null +++ b/spec/python/specwrite/test_struct_pad_term_equal.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.struct_pad_term_equal import StructPadTermEqual + +class TestStructPadTermEqual(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestStructPadTermEqual, self).__init__(*args, **kwargs) + self.struct_class = StructPadTermEqual + self.src_filename = 'src/str_pad_term.bin' + diff --git a/spec/python/specwrite/test_switch_bytearray.py b/spec/python/specwrite/test_switch_bytearray.py new file mode 100644 index 000000000..ff4953644 --- /dev/null +++ b/spec/python/specwrite/test_switch_bytearray.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.switch_bytearray import SwitchBytearray + +class TestSwitchBytearray(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestSwitchBytearray, self).__init__(*args, **kwargs) + self.struct_class = SwitchBytearray + self.src_filename = 'src/switch_opcodes.bin' + diff --git a/spec/python/specwrite/test_switch_else_only.py b/spec/python/specwrite/test_switch_else_only.py new file mode 100644 index 000000000..203c76362 --- /dev/null +++ b/spec/python/specwrite/test_switch_else_only.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.switch_else_only import SwitchElseOnly + +class TestSwitchElseOnly(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestSwitchElseOnly, self).__init__(*args, **kwargs) + self.struct_class = SwitchElseOnly + self.src_filename = 'src/switch_opcodes.bin' + diff --git a/spec/python/specwrite/test_switch_integers.py b/spec/python/specwrite/test_switch_integers.py new file mode 100644 index 000000000..fa2bd56ce --- /dev/null +++ b/spec/python/specwrite/test_switch_integers.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.switch_integers import SwitchIntegers + +class TestSwitchIntegers(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestSwitchIntegers, self).__init__(*args, **kwargs) + self.struct_class = SwitchIntegers + self.src_filename = 'src/switch_integers.bin' + diff --git a/spec/python/specwrite/test_switch_integers2.py b/spec/python/specwrite/test_switch_integers2.py new file mode 100644 index 000000000..294701eb0 --- /dev/null +++ b/spec/python/specwrite/test_switch_integers2.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.switch_integers2 import SwitchIntegers2 + +class TestSwitchIntegers2(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestSwitchIntegers2, self).__init__(*args, **kwargs) + self.struct_class = SwitchIntegers2 + self.src_filename = 'src/switch_integers.bin' + diff --git a/spec/python/specwrite/test_switch_manual_enum.py b/spec/python/specwrite/test_switch_manual_enum.py new file mode 100644 index 000000000..9acfe1c86 --- /dev/null +++ b/spec/python/specwrite/test_switch_manual_enum.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.switch_manual_enum import SwitchManualEnum + +class TestSwitchManualEnum(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestSwitchManualEnum, self).__init__(*args, **kwargs) + self.struct_class = SwitchManualEnum + self.src_filename = 'src/switch_opcodes.bin' + diff --git a/spec/python/specwrite/test_switch_manual_enum_invalid.py b/spec/python/specwrite/test_switch_manual_enum_invalid.py new file mode 100644 index 000000000..80530da5a --- /dev/null +++ b/spec/python/specwrite/test_switch_manual_enum_invalid.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.switch_manual_enum_invalid import SwitchManualEnumInvalid + +class TestSwitchManualEnumInvalid(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestSwitchManualEnumInvalid, self).__init__(*args, **kwargs) + self.struct_class = SwitchManualEnumInvalid + self.src_filename = 'src/enum_negative.bin' + diff --git a/spec/python/specwrite/test_switch_manual_enum_invalid_else.py b/spec/python/specwrite/test_switch_manual_enum_invalid_else.py new file mode 100644 index 000000000..cdeebea1d --- /dev/null +++ b/spec/python/specwrite/test_switch_manual_enum_invalid_else.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.switch_manual_enum_invalid_else import SwitchManualEnumInvalidElse + +class TestSwitchManualEnumInvalidElse(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestSwitchManualEnumInvalidElse, self).__init__(*args, **kwargs) + self.struct_class = SwitchManualEnumInvalidElse + self.src_filename = 'src/enum_negative.bin' + diff --git a/spec/python/specwrite/test_switch_manual_int.py b/spec/python/specwrite/test_switch_manual_int.py new file mode 100644 index 000000000..e76cdd570 --- /dev/null +++ b/spec/python/specwrite/test_switch_manual_int.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.switch_manual_int import SwitchManualInt + +class TestSwitchManualInt(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestSwitchManualInt, self).__init__(*args, **kwargs) + self.struct_class = SwitchManualInt + self.src_filename = 'src/switch_opcodes.bin' + diff --git a/spec/python/specwrite/test_switch_manual_int_else.py b/spec/python/specwrite/test_switch_manual_int_else.py new file mode 100644 index 000000000..2aa67c355 --- /dev/null +++ b/spec/python/specwrite/test_switch_manual_int_else.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.switch_manual_int_else import SwitchManualIntElse + +class TestSwitchManualIntElse(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestSwitchManualIntElse, self).__init__(*args, **kwargs) + self.struct_class = SwitchManualIntElse + self.src_filename = 'src/switch_opcodes2.bin' + diff --git a/spec/python/specwrite/test_switch_manual_int_size.py b/spec/python/specwrite/test_switch_manual_int_size.py new file mode 100644 index 000000000..ae9d7c9ff --- /dev/null +++ b/spec/python/specwrite/test_switch_manual_int_size.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.switch_manual_int_size import SwitchManualIntSize + +class TestSwitchManualIntSize(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestSwitchManualIntSize, self).__init__(*args, **kwargs) + self.struct_class = SwitchManualIntSize + self.src_filename = 'src/switch_tlv.bin' + diff --git a/spec/python/specwrite/test_switch_manual_int_size_else.py b/spec/python/specwrite/test_switch_manual_int_size_else.py new file mode 100644 index 000000000..f2a2d4e66 --- /dev/null +++ b/spec/python/specwrite/test_switch_manual_int_size_else.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.switch_manual_int_size_else import SwitchManualIntSizeElse + +class TestSwitchManualIntSizeElse(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestSwitchManualIntSizeElse, self).__init__(*args, **kwargs) + self.struct_class = SwitchManualIntSizeElse + self.src_filename = 'src/switch_tlv.bin' + diff --git a/spec/python/specwrite/test_switch_manual_int_size_eos.py b/spec/python/specwrite/test_switch_manual_int_size_eos.py new file mode 100644 index 000000000..9a06fcb74 --- /dev/null +++ b/spec/python/specwrite/test_switch_manual_int_size_eos.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.switch_manual_int_size_eos import SwitchManualIntSizeEos + +class TestSwitchManualIntSizeEos(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestSwitchManualIntSizeEos, self).__init__(*args, **kwargs) + self.struct_class = SwitchManualIntSizeEos + self.src_filename = 'src/switch_tlv.bin' + diff --git a/spec/python/specwrite/test_switch_manual_str.py b/spec/python/specwrite/test_switch_manual_str.py new file mode 100644 index 000000000..341890139 --- /dev/null +++ b/spec/python/specwrite/test_switch_manual_str.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.switch_manual_str import SwitchManualStr + +class TestSwitchManualStr(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestSwitchManualStr, self).__init__(*args, **kwargs) + self.struct_class = SwitchManualStr + self.src_filename = 'src/switch_opcodes.bin' + diff --git a/spec/python/specwrite/test_switch_manual_str_else.py b/spec/python/specwrite/test_switch_manual_str_else.py new file mode 100644 index 000000000..80a9ea39f --- /dev/null +++ b/spec/python/specwrite/test_switch_manual_str_else.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.switch_manual_str_else import SwitchManualStrElse + +class TestSwitchManualStrElse(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestSwitchManualStrElse, self).__init__(*args, **kwargs) + self.struct_class = SwitchManualStrElse + self.src_filename = 'src/switch_opcodes2.bin' + diff --git a/spec/python/specwrite/test_switch_multi_bool_ops.py b/spec/python/specwrite/test_switch_multi_bool_ops.py new file mode 100644 index 000000000..99bb7a153 --- /dev/null +++ b/spec/python/specwrite/test_switch_multi_bool_ops.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.switch_multi_bool_ops import SwitchMultiBoolOps + +class TestSwitchMultiBoolOps(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestSwitchMultiBoolOps, self).__init__(*args, **kwargs) + self.struct_class = SwitchMultiBoolOps + self.src_filename = 'src/switch_integers.bin' + diff --git a/spec/python/specwrite/test_switch_repeat_expr.py b/spec/python/specwrite/test_switch_repeat_expr.py new file mode 100644 index 000000000..a506e5f38 --- /dev/null +++ b/spec/python/specwrite/test_switch_repeat_expr.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.switch_repeat_expr import SwitchRepeatExpr + +class TestSwitchRepeatExpr(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestSwitchRepeatExpr, self).__init__(*args, **kwargs) + self.struct_class = SwitchRepeatExpr + self.src_filename = 'src/switch_tlv.bin' + diff --git a/spec/python/specwrite/test_switch_repeat_expr_invalid.py b/spec/python/specwrite/test_switch_repeat_expr_invalid.py new file mode 100644 index 000000000..cbc445aaa --- /dev/null +++ b/spec/python/specwrite/test_switch_repeat_expr_invalid.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.switch_repeat_expr_invalid import SwitchRepeatExprInvalid + +class TestSwitchRepeatExprInvalid(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestSwitchRepeatExprInvalid, self).__init__(*args, **kwargs) + self.struct_class = SwitchRepeatExprInvalid + self.src_filename = 'src/switch_tlv.bin' + diff --git a/spec/python/specwrite/test_term_bytes.py b/spec/python/specwrite/test_term_bytes.py new file mode 100644 index 000000000..8d3a669eb --- /dev/null +++ b/spec/python/specwrite/test_term_bytes.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.term_bytes import TermBytes + +class TestTermBytes(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestTermBytes, self).__init__(*args, **kwargs) + self.struct_class = TermBytes + self.src_filename = 'src/term_strz.bin' + diff --git a/spec/python/specwrite/test_term_bytes2.py b/spec/python/specwrite/test_term_bytes2.py new file mode 100644 index 000000000..b96372d0f --- /dev/null +++ b/spec/python/specwrite/test_term_bytes2.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.term_bytes2 import TermBytes2 + +class TestTermBytes2(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestTermBytes2, self).__init__(*args, **kwargs) + self.struct_class = TermBytes2 + self.src_filename = 'src/term_strz.bin' + diff --git a/spec/python/specwrite/test_term_bytes3.py b/spec/python/specwrite/test_term_bytes3.py new file mode 100644 index 000000000..e946361d4 --- /dev/null +++ b/spec/python/specwrite/test_term_bytes3.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.term_bytes3 import TermBytes3 + +class TestTermBytes3(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestTermBytes3, self).__init__(*args, **kwargs) + self.struct_class = TermBytes3 + self.src_filename = 'src/term_strz.bin' + diff --git a/spec/python/specwrite/test_term_bytes4.py b/spec/python/specwrite/test_term_bytes4.py new file mode 100644 index 000000000..35ee6a257 --- /dev/null +++ b/spec/python/specwrite/test_term_bytes4.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.term_bytes4 import TermBytes4 + +class TestTermBytes4(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestTermBytes4, self).__init__(*args, **kwargs) + self.struct_class = TermBytes4 + self.src_filename = 'src/term_strz.bin' + diff --git a/spec/python/specwrite/test_term_struct.py b/spec/python/specwrite/test_term_struct.py new file mode 100644 index 000000000..1d512bd3e --- /dev/null +++ b/spec/python/specwrite/test_term_struct.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.term_struct import TermStruct + +class TestTermStruct(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestTermStruct, self).__init__(*args, **kwargs) + self.struct_class = TermStruct + self.src_filename = 'src/term_strz.bin' + diff --git a/spec/python/specwrite/test_term_struct2.py b/spec/python/specwrite/test_term_struct2.py new file mode 100644 index 000000000..74ba0181f --- /dev/null +++ b/spec/python/specwrite/test_term_struct2.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.term_struct2 import TermStruct2 + +class TestTermStruct2(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestTermStruct2, self).__init__(*args, **kwargs) + self.struct_class = TermStruct2 + self.src_filename = 'src/term_strz.bin' + diff --git a/spec/python/specwrite/test_term_struct3.py b/spec/python/specwrite/test_term_struct3.py new file mode 100644 index 000000000..ea99c7d6e --- /dev/null +++ b/spec/python/specwrite/test_term_struct3.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.term_struct3 import TermStruct3 + +class TestTermStruct3(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestTermStruct3, self).__init__(*args, **kwargs) + self.struct_class = TermStruct3 + self.src_filename = 'src/term_strz.bin' + diff --git a/spec/python/specwrite/test_term_struct4.py b/spec/python/specwrite/test_term_struct4.py new file mode 100644 index 000000000..7d57efa6a --- /dev/null +++ b/spec/python/specwrite/test_term_struct4.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.term_struct4 import TermStruct4 + +class TestTermStruct4(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestTermStruct4, self).__init__(*args, **kwargs) + self.struct_class = TermStruct4 + self.src_filename = 'src/term_strz.bin' + diff --git a/spec/python/specwrite/test_term_strz.py b/spec/python/specwrite/test_term_strz.py new file mode 100644 index 000000000..c1a405604 --- /dev/null +++ b/spec/python/specwrite/test_term_strz.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.term_strz import TermStrz + +class TestTermStrz(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestTermStrz, self).__init__(*args, **kwargs) + self.struct_class = TermStrz + self.src_filename = 'src/term_strz.bin' + diff --git a/spec/python/specwrite/test_term_strz2.py b/spec/python/specwrite/test_term_strz2.py new file mode 100644 index 000000000..37e6aae4b --- /dev/null +++ b/spec/python/specwrite/test_term_strz2.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.term_strz2 import TermStrz2 + +class TestTermStrz2(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestTermStrz2, self).__init__(*args, **kwargs) + self.struct_class = TermStrz2 + self.src_filename = 'src/term_strz.bin' + diff --git a/spec/python/specwrite/test_term_strz3.py b/spec/python/specwrite/test_term_strz3.py new file mode 100644 index 000000000..cada96aa5 --- /dev/null +++ b/spec/python/specwrite/test_term_strz3.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.term_strz3 import TermStrz3 + +class TestTermStrz3(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestTermStrz3, self).__init__(*args, **kwargs) + self.struct_class = TermStrz3 + self.src_filename = 'src/term_strz.bin' + diff --git a/spec/python/specwrite/test_term_strz4.py b/spec/python/specwrite/test_term_strz4.py new file mode 100644 index 000000000..159079931 --- /dev/null +++ b/spec/python/specwrite/test_term_strz4.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.term_strz4 import TermStrz4 + +class TestTermStrz4(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestTermStrz4, self).__init__(*args, **kwargs) + self.struct_class = TermStrz4 + self.src_filename = 'src/term_strz.bin' + diff --git a/spec/python/specwrite/test_term_u1_val.py b/spec/python/specwrite/test_term_u1_val.py new file mode 100644 index 000000000..4c58638d3 --- /dev/null +++ b/spec/python/specwrite/test_term_u1_val.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.term_u1_val import TermU1Val + +class TestTermU1Val(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestTermU1Val, self).__init__(*args, **kwargs) + self.struct_class = TermU1Val + self.src_filename = 'src/str_encodings.bin' + diff --git a/spec/python/specwrite/test_ts_packet_header.py b/spec/python/specwrite/test_ts_packet_header.py new file mode 100644 index 000000000..5534871f8 --- /dev/null +++ b/spec/python/specwrite/test_ts_packet_header.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.ts_packet_header import TsPacketHeader + +class TestTsPacketHeader(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestTsPacketHeader, self).__init__(*args, **kwargs) + self.struct_class = TsPacketHeader + self.src_filename = 'src/ts_packet.bin' + diff --git a/spec/python/specwrite/test_type_int_unary_op.py b/spec/python/specwrite/test_type_int_unary_op.py new file mode 100644 index 000000000..c24ea693e --- /dev/null +++ b/spec/python/specwrite/test_type_int_unary_op.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.type_int_unary_op import TypeIntUnaryOp + +class TestTypeIntUnaryOp(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestTypeIntUnaryOp, self).__init__(*args, **kwargs) + self.struct_class = TypeIntUnaryOp + self.src_filename = 'src/fixed_struct.bin' + diff --git a/spec/python/specwrite/test_type_ternary.py b/spec/python/specwrite/test_type_ternary.py new file mode 100644 index 000000000..f04105fae --- /dev/null +++ b/spec/python/specwrite/test_type_ternary.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.type_ternary import TypeTernary + +class TestTypeTernary(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestTypeTernary, self).__init__(*args, **kwargs) + self.struct_class = TypeTernary + self.src_filename = 'src/term_strz.bin' + diff --git a/spec/python/specwrite/test_type_ternary_2nd_falsy.py b/spec/python/specwrite/test_type_ternary_2nd_falsy.py new file mode 100644 index 000000000..44ca6d269 --- /dev/null +++ b/spec/python/specwrite/test_type_ternary_2nd_falsy.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.type_ternary_2nd_falsy import TypeTernary2ndFalsy + +class TestTypeTernary2ndFalsy(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestTypeTernary2ndFalsy, self).__init__(*args, **kwargs) + self.struct_class = TypeTernary2ndFalsy + self.src_filename = 'src/switch_integers.bin' + diff --git a/spec/python/specwrite/test_type_ternary_opaque.py b/spec/python/specwrite/test_type_ternary_opaque.py new file mode 100644 index 000000000..9516e3f27 --- /dev/null +++ b/spec/python/specwrite/test_type_ternary_opaque.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.type_ternary_opaque import TypeTernaryOpaque + +class TestTypeTernaryOpaque(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestTypeTernaryOpaque, self).__init__(*args, **kwargs) + self.struct_class = TypeTernaryOpaque + self.src_filename = 'src/term_strz.bin' + diff --git a/spec/python/specwrite/test_user_type.py b/spec/python/specwrite/test_user_type.py new file mode 100644 index 000000000..34f60e352 --- /dev/null +++ b/spec/python/specwrite/test_user_type.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.user_type import UserType + +class TestUserType(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestUserType, self).__init__(*args, **kwargs) + self.struct_class = UserType + self.src_filename = 'src/repeat_until_s4.bin' + diff --git a/spec/python/specwrite/test_valid_eq_str_encodings.py b/spec/python/specwrite/test_valid_eq_str_encodings.py new file mode 100644 index 000000000..957e24bf2 --- /dev/null +++ b/spec/python/specwrite/test_valid_eq_str_encodings.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.valid_eq_str_encodings import ValidEqStrEncodings + +class TestValidEqStrEncodings(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestValidEqStrEncodings, self).__init__(*args, **kwargs) + self.struct_class = ValidEqStrEncodings + self.src_filename = 'src/str_encodings.bin' + diff --git a/spec/python/specwrite/test_valid_fail_anyof_int.py b/spec/python/specwrite/test_valid_fail_anyof_int.py new file mode 100644 index 000000000..2c3ea0339 --- /dev/null +++ b/spec/python/specwrite/test_valid_fail_anyof_int.py @@ -0,0 +1,15 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.valid_fail_anyof_int import ValidFailAnyofInt + +class TestValidFailAnyofInt(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestValidFailAnyofInt, self).__init__(*args, **kwargs) + self.struct_class = ValidFailAnyofInt + self.src_filename = 'src/fixed_struct.bin' + + def test_read_write_roundtrip(self): + self.skipTest("cannot use roundtrip because parsing is expected to fail") diff --git a/spec/python/specwrite/test_valid_fail_contents.py b/spec/python/specwrite/test_valid_fail_contents.py new file mode 100644 index 000000000..a9b3bf330 --- /dev/null +++ b/spec/python/specwrite/test_valid_fail_contents.py @@ -0,0 +1,15 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.valid_fail_contents import ValidFailContents + +class TestValidFailContents(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestValidFailContents, self).__init__(*args, **kwargs) + self.struct_class = ValidFailContents + self.src_filename = 'src/fixed_struct.bin' + + def test_read_write_roundtrip(self): + self.skipTest("cannot use roundtrip because parsing is expected to fail") diff --git a/spec/python/specwrite/test_valid_fail_eq_bytes.py b/spec/python/specwrite/test_valid_fail_eq_bytes.py new file mode 100644 index 000000000..1d47d14be --- /dev/null +++ b/spec/python/specwrite/test_valid_fail_eq_bytes.py @@ -0,0 +1,15 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.valid_fail_eq_bytes import ValidFailEqBytes + +class TestValidFailEqBytes(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestValidFailEqBytes, self).__init__(*args, **kwargs) + self.struct_class = ValidFailEqBytes + self.src_filename = 'src/fixed_struct.bin' + + def test_read_write_roundtrip(self): + self.skipTest("cannot use roundtrip because parsing is expected to fail") diff --git a/spec/python/specwrite/test_valid_fail_eq_int.py b/spec/python/specwrite/test_valid_fail_eq_int.py new file mode 100644 index 000000000..465243ff1 --- /dev/null +++ b/spec/python/specwrite/test_valid_fail_eq_int.py @@ -0,0 +1,15 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.valid_fail_eq_int import ValidFailEqInt + +class TestValidFailEqInt(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestValidFailEqInt, self).__init__(*args, **kwargs) + self.struct_class = ValidFailEqInt + self.src_filename = 'src/fixed_struct.bin' + + def test_read_write_roundtrip(self): + self.skipTest("cannot use roundtrip because parsing is expected to fail") diff --git a/spec/python/specwrite/test_valid_fail_eq_str.py b/spec/python/specwrite/test_valid_fail_eq_str.py new file mode 100644 index 000000000..0c781ce4a --- /dev/null +++ b/spec/python/specwrite/test_valid_fail_eq_str.py @@ -0,0 +1,15 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.valid_fail_eq_str import ValidFailEqStr + +class TestValidFailEqStr(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestValidFailEqStr, self).__init__(*args, **kwargs) + self.struct_class = ValidFailEqStr + self.src_filename = 'src/fixed_struct.bin' + + def test_read_write_roundtrip(self): + self.skipTest("cannot use roundtrip because parsing is expected to fail") diff --git a/spec/python/specwrite/test_valid_fail_expr.py b/spec/python/specwrite/test_valid_fail_expr.py new file mode 100644 index 000000000..1786cc74a --- /dev/null +++ b/spec/python/specwrite/test_valid_fail_expr.py @@ -0,0 +1,15 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.valid_fail_expr import ValidFailExpr + +class TestValidFailExpr(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestValidFailExpr, self).__init__(*args, **kwargs) + self.struct_class = ValidFailExpr + self.src_filename = 'src/nav_parent_switch.bin' + + def test_read_write_roundtrip(self): + self.skipTest("cannot use roundtrip because parsing is expected to fail") diff --git a/spec/python/specwrite/test_valid_fail_inst.py b/spec/python/specwrite/test_valid_fail_inst.py new file mode 100644 index 000000000..ef5b9ff52 --- /dev/null +++ b/spec/python/specwrite/test_valid_fail_inst.py @@ -0,0 +1,15 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.valid_fail_inst import ValidFailInst + +class TestValidFailInst(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestValidFailInst, self).__init__(*args, **kwargs) + self.struct_class = ValidFailInst + self.src_filename = 'src/fixed_struct.bin' + + def test_read_write_roundtrip(self): + self.skipTest("cannot use roundtrip because parsing is expected to fail") diff --git a/spec/python/specwrite/test_valid_fail_max_int.py b/spec/python/specwrite/test_valid_fail_max_int.py new file mode 100644 index 000000000..ecd3d25fe --- /dev/null +++ b/spec/python/specwrite/test_valid_fail_max_int.py @@ -0,0 +1,15 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.valid_fail_max_int import ValidFailMaxInt + +class TestValidFailMaxInt(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestValidFailMaxInt, self).__init__(*args, **kwargs) + self.struct_class = ValidFailMaxInt + self.src_filename = 'src/fixed_struct.bin' + + def test_read_write_roundtrip(self): + self.skipTest("cannot use roundtrip because parsing is expected to fail") diff --git a/spec/python/specwrite/test_valid_fail_min_int.py b/spec/python/specwrite/test_valid_fail_min_int.py new file mode 100644 index 000000000..9e607db12 --- /dev/null +++ b/spec/python/specwrite/test_valid_fail_min_int.py @@ -0,0 +1,15 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.valid_fail_min_int import ValidFailMinInt + +class TestValidFailMinInt(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestValidFailMinInt, self).__init__(*args, **kwargs) + self.struct_class = ValidFailMinInt + self.src_filename = 'src/fixed_struct.bin' + + def test_read_write_roundtrip(self): + self.skipTest("cannot use roundtrip because parsing is expected to fail") diff --git a/spec/python/specwrite/test_valid_fail_range_bytes.py b/spec/python/specwrite/test_valid_fail_range_bytes.py new file mode 100644 index 000000000..c3c3f94d4 --- /dev/null +++ b/spec/python/specwrite/test_valid_fail_range_bytes.py @@ -0,0 +1,15 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.valid_fail_range_bytes import ValidFailRangeBytes + +class TestValidFailRangeBytes(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestValidFailRangeBytes, self).__init__(*args, **kwargs) + self.struct_class = ValidFailRangeBytes + self.src_filename = 'src/fixed_struct.bin' + + def test_read_write_roundtrip(self): + self.skipTest("cannot use roundtrip because parsing is expected to fail") diff --git a/spec/python/specwrite/test_valid_fail_range_float.py b/spec/python/specwrite/test_valid_fail_range_float.py new file mode 100644 index 000000000..644646ccd --- /dev/null +++ b/spec/python/specwrite/test_valid_fail_range_float.py @@ -0,0 +1,15 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.valid_fail_range_float import ValidFailRangeFloat + +class TestValidFailRangeFloat(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestValidFailRangeFloat, self).__init__(*args, **kwargs) + self.struct_class = ValidFailRangeFloat + self.src_filename = 'src/floating_points.bin' + + def test_read_write_roundtrip(self): + self.skipTest("cannot use roundtrip because parsing is expected to fail") diff --git a/spec/python/specwrite/test_valid_fail_range_int.py b/spec/python/specwrite/test_valid_fail_range_int.py new file mode 100644 index 000000000..86c2c40ee --- /dev/null +++ b/spec/python/specwrite/test_valid_fail_range_int.py @@ -0,0 +1,15 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.valid_fail_range_int import ValidFailRangeInt + +class TestValidFailRangeInt(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestValidFailRangeInt, self).__init__(*args, **kwargs) + self.struct_class = ValidFailRangeInt + self.src_filename = 'src/fixed_struct.bin' + + def test_read_write_roundtrip(self): + self.skipTest("cannot use roundtrip because parsing is expected to fail") diff --git a/spec/python/specwrite/test_valid_fail_range_str.py b/spec/python/specwrite/test_valid_fail_range_str.py new file mode 100644 index 000000000..4611e660f --- /dev/null +++ b/spec/python/specwrite/test_valid_fail_range_str.py @@ -0,0 +1,15 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.valid_fail_range_str import ValidFailRangeStr + +class TestValidFailRangeStr(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestValidFailRangeStr, self).__init__(*args, **kwargs) + self.struct_class = ValidFailRangeStr + self.src_filename = 'src/fixed_struct.bin' + + def test_read_write_roundtrip(self): + self.skipTest("cannot use roundtrip because parsing is expected to fail") diff --git a/spec/python/specwrite/test_valid_long.py b/spec/python/specwrite/test_valid_long.py new file mode 100644 index 000000000..f348195c0 --- /dev/null +++ b/spec/python/specwrite/test_valid_long.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.valid_long import ValidLong + +class TestValidLong(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestValidLong, self).__init__(*args, **kwargs) + self.struct_class = ValidLong + self.src_filename = 'src/fixed_struct.bin' + diff --git a/spec/python/specwrite/test_valid_not_parsed_if.py b/spec/python/specwrite/test_valid_not_parsed_if.py new file mode 100644 index 000000000..74bf3718b --- /dev/null +++ b/spec/python/specwrite/test_valid_not_parsed_if.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.valid_not_parsed_if import ValidNotParsedIf + +class TestValidNotParsedIf(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestValidNotParsedIf, self).__init__(*args, **kwargs) + self.struct_class = ValidNotParsedIf + self.src_filename = 'src/fixed_struct.bin' + diff --git a/spec/python/specwrite/test_valid_optional_id.py b/spec/python/specwrite/test_valid_optional_id.py new file mode 100644 index 000000000..ca42e7678 --- /dev/null +++ b/spec/python/specwrite/test_valid_optional_id.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.valid_optional_id import ValidOptionalId + +class TestValidOptionalId(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestValidOptionalId, self).__init__(*args, **kwargs) + self.struct_class = ValidOptionalId + self.src_filename = 'src/fixed_struct.bin' + diff --git a/spec/python/specwrite/test_valid_short.py b/spec/python/specwrite/test_valid_short.py new file mode 100644 index 000000000..011cc7e73 --- /dev/null +++ b/spec/python/specwrite/test_valid_short.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.valid_short import ValidShort + +class TestValidShort(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestValidShort, self).__init__(*args, **kwargs) + self.struct_class = ValidShort + self.src_filename = 'src/fixed_struct.bin' + diff --git a/spec/python/specwrite/test_valid_switch.py b/spec/python/specwrite/test_valid_switch.py new file mode 100644 index 000000000..5870ff563 --- /dev/null +++ b/spec/python/specwrite/test_valid_switch.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.valid_switch import ValidSwitch + +class TestValidSwitch(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestValidSwitch, self).__init__(*args, **kwargs) + self.struct_class = ValidSwitch + self.src_filename = 'src/fixed_struct.bin' + diff --git a/spec/python/specwrite/test_yaml_ints.py b/spec/python/specwrite/test_yaml_ints.py new file mode 100644 index 000000000..5116b8b4d --- /dev/null +++ b/spec/python/specwrite/test_yaml_ints.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.yaml_ints import YamlInts + +class TestYamlInts(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestYamlInts, self).__init__(*args, **kwargs) + self.struct_class = YamlInts + self.src_filename = 'src/fixed_struct.bin' + diff --git a/spec/python/specwrite/test_zlib_surrounded.py b/spec/python/specwrite/test_zlib_surrounded.py new file mode 100644 index 000000000..ae5acf28d --- /dev/null +++ b/spec/python/specwrite/test_zlib_surrounded.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.zlib_surrounded import ZlibSurrounded + +class TestZlibSurrounded(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestZlibSurrounded, self).__init__(*args, **kwargs) + self.struct_class = ZlibSurrounded + self.src_filename = 'src/zlib_surrounded.bin' + diff --git a/spec/python/specwrite/test_zlib_with_header_78.py b/spec/python/specwrite/test_zlib_with_header_78.py new file mode 100644 index 000000000..ac84bb5f0 --- /dev/null +++ b/spec/python/specwrite/test_zlib_with_header_78.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.zlib_with_header_78 import ZlibWithHeader78 + +class TestZlibWithHeader78(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestZlibWithHeader78, self).__init__(*args, **kwargs) + self.struct_class = ZlibWithHeader78 + self.src_filename = 'src/zlib_with_header_78.bin' + From d4ba1038c6de7c6e69fde1489ca9e2cd79b2e9f8 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Sat, 4 Mar 2023 14:31:39 +0100 Subject: [PATCH 082/126] specwrite/common_spec.py: fix Python 2 compatibility See https://github.com/kaitai-io/kaitai_struct_compiler/commit/d986731cf72499b7cef219ba6dc9876f3239acfc --- spec/python/specwrite/common_spec.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/spec/python/specwrite/common_spec.py b/spec/python/specwrite/common_spec.py index 4dfc6430a..3a5ea2fad 100644 --- a/spec/python/specwrite/common_spec.py +++ b/spec/python/specwrite/common_spec.py @@ -1,8 +1,6 @@ import unittest import io -from kaitaistruct import KaitaiStream, KaitaiStruct - -import binascii +from kaitaistruct import KaitaiStream, KaitaiStruct, PY2 # A little hack from https://stackoverflow.com/a/25695512 to trick 'unittest' # into thinking that CommonSpec.Base is not a test by itself. @@ -22,7 +20,7 @@ def test_read_write_roundtrip(self): finally: orig_f.close() - with KaitaiStream(io.BytesIO(bytes(orig_io_size))) as new_io: + with KaitaiStream(io.BytesIO(bytearray(orig_io_size))) as new_io: orig_ks._write(new_io) new_io.seek(0) @@ -103,7 +101,11 @@ def dump_struct_value(value, parent_structs, recursion_depth_limit, current_path if isinstance(value, KaitaiStream): value = value.to_byte_array() + if PY2 and isinstance(value, bytes): + value = bytearray(value) + if isinstance(value, (bytes, bytearray)): - value = binascii.hexlify(value, ' ').decode('ascii') + # https://stackoverflow.com/a/19210468 + value = ' '.join('%02x' % b for b in value) return value From a7fd288393fe5a63db187b19e29b0f3044973bdd Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Sat, 4 Mar 2023 16:16:59 +0100 Subject: [PATCH 083/126] Python: implement encode() in custom processors --- spec/python/extra/custom_fx_no_args.py | 6 ++++++ spec/python/extra/my_custom_fx.py | 7 +++++++ spec/python/extra/nested/deeply.py | 6 ++++++ 3 files changed, 19 insertions(+) diff --git a/spec/python/extra/custom_fx_no_args.py b/spec/python/extra/custom_fx_no_args.py index ef3d0702a..9706b658f 100644 --- a/spec/python/extra/custom_fx_no_args.py +++ b/spec/python/extra/custom_fx_no_args.py @@ -4,3 +4,9 @@ def __init__(self): def decode(self, data): return b"_" + data + b"_" + + def encode(self, data): + assert len(data) >= 2 and data[:1] == b"_" and data[-1:] == b"_", \ + "CustomFxNoArgs can only encode data like '_(.*)_'" + + return data[1:-1] diff --git a/spec/python/extra/my_custom_fx.py b/spec/python/extra/my_custom_fx.py index e668e29a8..2ec4defe0 100644 --- a/spec/python/extra/my_custom_fx.py +++ b/spec/python/extra/my_custom_fx.py @@ -7,3 +7,10 @@ def decode(self, data): for i in range(len(r)): r[i] = (r[i] + self.key) % 0x100 return bytes(r) + + def encode(self, data): + old_key = self.key + self.key = -self.key + res = self.decode(data) + self.key = old_key + return res diff --git a/spec/python/extra/nested/deeply.py b/spec/python/extra/nested/deeply.py index 695824f43..661afe62a 100644 --- a/spec/python/extra/nested/deeply.py +++ b/spec/python/extra/nested/deeply.py @@ -4,3 +4,9 @@ def __init__(self, foo): def decode(self, data): return b"_" + data + b"_" + + def encode(self, data): + assert len(data) >= 2 and data[:1] == b"_" and data[-1:] == b"_", \ + "CustomFx can only encode data like '_(.*)_'" + + return data[1:-1] From f53b1bae3788f058ec460e74171973d4783a3397 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Mon, 6 Mar 2023 16:27:02 +0100 Subject: [PATCH 084/126] Add ExprIo{Eof,Pos}Bits --- formats/expr_io_eof_bits.ksy | 31 +++++++++++++ formats/expr_io_pos_bits.ksy | 14 ++++++ .../kaitai/struct/spec/TestExprIoEofBits.java | 24 ++++++++++ .../kaitai/struct/spec/TestExprIoPosBits.java | 19 ++++++++ .../struct/specwrite/TestExprIoEofBits.java | 46 +++++++++++++++++++ .../struct/specwrite/TestExprIoPosBits.java | 20 ++++++++ spec/ks/expr_io_eof_bits.kst | 8 ++++ spec/ks/expr_io_pos_bits.kst | 11 +++++ spec/python/spec/test_expr_io_eof_bits.py | 15 ++++++ spec/python/spec/test_expr_io_pos_bits.py | 14 ++++++ .../python/specwrite/test_expr_io_eof_bits.py | 33 +++++++++++++ .../python/specwrite/test_expr_io_pos_bits.py | 13 ++++++ 12 files changed, 248 insertions(+) create mode 100644 formats/expr_io_eof_bits.ksy create mode 100644 formats/expr_io_pos_bits.ksy create mode 100644 spec/java/src/io/kaitai/struct/spec/TestExprIoEofBits.java create mode 100644 spec/java/src/io/kaitai/struct/spec/TestExprIoPosBits.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestExprIoEofBits.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestExprIoPosBits.java create mode 100644 spec/ks/expr_io_eof_bits.kst create mode 100644 spec/ks/expr_io_pos_bits.kst create mode 100644 spec/python/spec/test_expr_io_eof_bits.py create mode 100644 spec/python/spec/test_expr_io_pos_bits.py create mode 100644 spec/python/specwrite/test_expr_io_eof_bits.py create mode 100644 spec/python/specwrite/test_expr_io_pos_bits.py diff --git a/formats/expr_io_eof_bits.ksy b/formats/expr_io_eof_bits.ksy new file mode 100644 index 000000000..83dccf29c --- /dev/null +++ b/formats/expr_io_eof_bits.ksy @@ -0,0 +1,31 @@ +# Tests _io.eof operation when bit-sized integers are involved +meta: + id: expr_io_eof_bits + bit-endian: be + ks-debug: true +seq: + - id: foo + type: b20 + - id: bar + type: b4 + if: not _io.eof + # `_io.eof` is expected to be true, so we "assert" it like this - if `_io.eof` + # is false, it will attempt to consume 8 bytes, which would trigger a EOF + # exception. + - id: assert_io_eof_before_baz + size: '_io.eof ? 0 : 8' + + # 0 bits available at this point. When parsing, this is basically guaranteed + # to fail with EOF exception immediately (because it would translate to + # requesting more bytes, which are not available). But when writing, it + # would succeed until an attempt to align the stream to a byte position is + # done - which should happen at the latest when the stream is closed. + - id: baz + type: b3 + + # `_io.eof` is expected to be true, so we "assert" it like this - if `_io.eof` + # is false, it will attempt to consume 8 bytes, which would trigger a EOF + # exception. + - id: assert_io_eof_after_baz + size: 8 + if: not _io.eof diff --git a/formats/expr_io_pos_bits.ksy b/formats/expr_io_pos_bits.ksy new file mode 100644 index 000000000..326573006 --- /dev/null +++ b/formats/expr_io_pos_bits.ksy @@ -0,0 +1,14 @@ +meta: + id: expr_io_pos_bits +seq: + - id: foo + type: b3 + - id: bar + type: b5 + if: _io.pos == 1 + - id: baz + type: b1 + if: _io.pos == 1 + - id: qux + type: b7 + if: _io.pos == 2 diff --git a/spec/java/src/io/kaitai/struct/spec/TestExprIoEofBits.java b/spec/java/src/io/kaitai/struct/spec/TestExprIoEofBits.java new file mode 100644 index 000000000..738c2ffed --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestExprIoEofBits.java @@ -0,0 +1,24 @@ +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.ExprIoEofBits; +import org.testng.annotations.Test; +import static org.testng.Assert.*; +import io.kaitai.struct.KaitaiStream; +public class TestExprIoEofBits extends CommonSpec { + + @Test + public void testExprIoEofBits() throws Exception { + ExprIoEofBits r = ExprIoEofBits.fromFile(SRC_DIR + "nav_parent_switch.bin"); + + assertThrows(java.nio.BufferUnderflowException.class, new ThrowingRunnable() { + @Override + public void run() throws Throwable { + r._read(); + } + }); + + assertIntEquals(r.foo(), 5167); + assertIntEquals(r.bar(), 15); + assertEquals(r.assertIoEofBeforeBaz(), new byte[] { }); + } +} diff --git a/spec/java/src/io/kaitai/struct/spec/TestExprIoPosBits.java b/spec/java/src/io/kaitai/struct/spec/TestExprIoPosBits.java new file mode 100644 index 000000000..cf1507e99 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestExprIoPosBits.java @@ -0,0 +1,19 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.ExprIoPosBits; +import org.testng.annotations.Test; +import static org.testng.Assert.*; +public class TestExprIoPosBits extends CommonSpec { + + @Test + public void testExprIoPosBits() throws Exception { + ExprIoPosBits r = ExprIoPosBits.fromFile(SRC_DIR + "process_xor_4.bin"); + + assertIntEquals(r.foo(), 7); + assertIntEquals(r.bar(), 12); + assertIntEquals(r.baz(), true); + assertIntEquals(r.qux(), 59); + } +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestExprIoEofBits.java b/spec/java/src/io/kaitai/struct/specwrite/TestExprIoEofBits.java new file mode 100644 index 000000000..bb79a191d --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestExprIoEofBits.java @@ -0,0 +1,46 @@ +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.ByteBufferKaitaiStream; +import io.kaitai.struct.KaitaiStream; +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ExprIoEofBits; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +public class TestExprIoEofBits extends CommonSpec { + @Override + protected Class getStructClass() { + throw new UnsupportedOperationException(); + } + + @Override + protected String getSrcFilename() { + throw new UnsupportedOperationException(); + } + + @Test + public void testExprIoEofBits() throws Exception { + long ioSize; + try (KaitaiStream io = new ByteBufferKaitaiStream(SRC_DIR + "nav_parent_switch.bin")) { + ioSize = io.size(); + } + + ExprIoEofBits r = new ExprIoEofBits(); + r.setFoo(5167); + r.setBar(15L); + r.setAssertIoEofBeforeBaz(new byte[] { }); + r.setBaz(6); + r.setAssertIoEofAfterBaz(new byte[8]); // doesn't matter + r._check(); + + KaitaiStream newIo = new ByteBufferKaitaiStream(ioSize); + r._write_Seq(newIo); + + assertThrows(java.nio.BufferOverflowException.class, new ThrowingRunnable() { + @Override + public void run() throws Throwable { + newIo.close(); + } + }); + } +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestExprIoPosBits.java b/spec/java/src/io/kaitai/struct/specwrite/TestExprIoPosBits.java new file mode 100644 index 000000000..e789b35d0 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestExprIoPosBits.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.ExprIoPosBits; +import org.testng.annotations.Test; + +public class TestExprIoPosBits extends CommonSpec { + @Override + protected Class getStructClass() { + return ExprIoPosBits.class; + } + + @Override + protected String getSrcFilename() { + return "process_xor_4.bin"; + } + +} diff --git a/spec/ks/expr_io_eof_bits.kst b/spec/ks/expr_io_eof_bits.kst new file mode 100644 index 000000000..fcbe65c1b --- /dev/null +++ b/spec/ks/expr_io_eof_bits.kst @@ -0,0 +1,8 @@ +id: expr_io_eof_bits +data: nav_parent_switch.bin +exception: EndOfStreamError +# asserts: +# - actual: foo +# expected: 0x01_42_f +# - actual: bar +# expected: 0xf diff --git a/spec/ks/expr_io_pos_bits.kst b/spec/ks/expr_io_pos_bits.kst new file mode 100644 index 000000000..c1f5df32d --- /dev/null +++ b/spec/ks/expr_io_pos_bits.kst @@ -0,0 +1,11 @@ +id: expr_io_pos_bits +data: process_xor_4.bin +asserts: + - actual: foo + expected: 0b111 + - actual: bar + expected: 0b0_1100 + - actual: baz + expected: true + - actual: qux + expected: 0b011_1011 diff --git a/spec/python/spec/test_expr_io_eof_bits.py b/spec/python/spec/test_expr_io_eof_bits.py new file mode 100644 index 000000000..2c67746fc --- /dev/null +++ b/spec/python/spec/test_expr_io_eof_bits.py @@ -0,0 +1,15 @@ +import unittest +import kaitaistruct + +from testformats.expr_io_eof_bits import ExprIoEofBits + +class TestExprIoEofBits(unittest.TestCase): + def test_expr_io_eof_bits(self): + with ExprIoEofBits.from_file('src/nav_parent_switch.bin') as r: + with self.assertRaisesRegexp(EOFError, u"^requested 1 bytes, but only 0 bytes available$"): + r._read() + self.assertEqual(r.foo, 5167) + self.assertEqual(r.bar, 15) + self.assertEqual(r.assert_io_eof_before_baz, b"") + self.assertFalse(hasattr(r, 'baz')) + self.assertFalse(hasattr(r, 'assert_io_eof_after_baz')) diff --git a/spec/python/spec/test_expr_io_pos_bits.py b/spec/python/spec/test_expr_io_pos_bits.py new file mode 100644 index 000000000..cc163b526 --- /dev/null +++ b/spec/python/spec/test_expr_io_pos_bits.py @@ -0,0 +1,14 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest + +from testformats.expr_io_pos_bits import ExprIoPosBits + +class TestExprIoPosBits(unittest.TestCase): + def test_expr_io_pos_bits(self): + with ExprIoPosBits.from_file('src/process_xor_4.bin') as r: + + self.assertEqual(r.foo, 7) + self.assertEqual(r.bar, 12) + self.assertEqual(r.baz, True) + self.assertEqual(r.qux, 59) diff --git a/spec/python/specwrite/test_expr_io_eof_bits.py b/spec/python/specwrite/test_expr_io_eof_bits.py new file mode 100644 index 000000000..a3fd8d6c7 --- /dev/null +++ b/spec/python/specwrite/test_expr_io_eof_bits.py @@ -0,0 +1,33 @@ +import unittest +import io +from kaitaistruct import KaitaiStream +from specwrite.common_spec import CommonSpec + +from testwrite.expr_io_eof_bits import ExprIoEofBits + +class TestExprIoEofBits(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestExprIoEofBits, self).__init__(*args, **kwargs) + self.struct_class = ExprIoEofBits + self.src_filename = 'src/nav_parent_switch.bin' + + def test_read_write_roundtrip(self): + self.skipTest("cannot use roundtrip because parsing is expected to fail") + + def test_expr_io_eof_bits(self): + with KaitaiStream(io.open(self.src_filename, 'rb')) as orig_io: + orig_io_size = orig_io.size() + + r = ExprIoEofBits() + r.foo = 5167 + r.bar = 15 + r.assert_io_eof_before_baz = b"" + r.baz = 6 + r.assert_io_eof_after_baz = b"\x00" * 8 # doesn't matter + r._check() + + new_io = KaitaiStream(io.BytesIO(bytearray(orig_io_size))) + r._write__seq(new_io) + + with self.assertRaisesRegexp(EOFError, u"^requested to write 1 bytes, but only 0 bytes left in the stream$"): + r.close() diff --git a/spec/python/specwrite/test_expr_io_pos_bits.py b/spec/python/specwrite/test_expr_io_pos_bits.py new file mode 100644 index 000000000..f56afcc4e --- /dev/null +++ b/spec/python/specwrite/test_expr_io_pos_bits.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.expr_io_pos_bits import ExprIoPosBits + +class TestExprIoPosBits(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestExprIoPosBits, self).__init__(*args, **kwargs) + self.struct_class = ExprIoPosBits + self.src_filename = 'src/process_xor_4.bin' + From f8483a7e78ecf8d923b76b7af3b9e4fc797a2b99 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Mon, 6 Mar 2023 17:30:53 +0100 Subject: [PATCH 085/126] Port {Eof,Eos}Exception{Bytes,U4} to Java, Python writing tests --- .../specwrite/TestEofExceptionBytes.java | 15 +++++++++++-- .../struct/specwrite/TestEofExceptionU4.java | 16 ++++++++++++-- .../specwrite/TestEosExceptionBytes.java | 20 ++++++++++++++++-- .../struct/specwrite/TestEosExceptionU4.java | 21 +++++++++++++++++-- .../specwrite/test_eof_exception_bytes.py | 13 ++++++++++-- .../python/specwrite/test_eof_exception_u4.py | 14 +++++++++++-- .../specwrite/test_eos_exception_bytes.py | 18 ++++++++++++++-- .../python/specwrite/test_eos_exception_u4.py | 19 +++++++++++++++-- 8 files changed, 120 insertions(+), 16 deletions(-) diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBytes.java b/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBytes.java index a35019466..8f0d3cb9d 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBytes.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBytes.java @@ -1,7 +1,7 @@ -// Autogenerated from KST: please remove this line if doing any edits by hand! - package io.kaitai.struct.specwrite; +import io.kaitai.struct.ByteBufferKaitaiStream; +import io.kaitai.struct.KaitaiStream; import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.EofExceptionBytes; import org.testng.annotations.Test; @@ -16,4 +16,15 @@ protected Class getStructClass() { protected String getSrcFilename() { throw new UnsupportedOperationException(); } + + @Test(expectedExceptions = java.nio.BufferOverflowException.class) + public void testEofExceptionBytes() throws Exception { + EofExceptionBytes r = new EofExceptionBytes(); + r.setBuf(new byte[] { 120, 121, 122, 123, 124, 125, 126, 127, -1, -2, -3, -4, -5 }); + r._check(); + + try (KaitaiStream io = new ByteBufferKaitaiStream(12)) { + r._write(io); + } + } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionU4.java b/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionU4.java index 28b19afab..401540118 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionU4.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionU4.java @@ -1,7 +1,7 @@ -// Autogenerated from KST: please remove this line if doing any edits by hand! - package io.kaitai.struct.specwrite; +import io.kaitai.struct.ByteBufferKaitaiStream; +import io.kaitai.struct.KaitaiStream; import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.EofExceptionU4; import org.testng.annotations.Test; @@ -16,4 +16,16 @@ protected Class getStructClass() { protected String getSrcFilename() { throw new UnsupportedOperationException(); } + + @Test(expectedExceptions = java.nio.BufferOverflowException.class) + public void testEofExceptionU4() throws Exception { + EofExceptionU4 r = new EofExceptionU4(); + r.setPrebuf(new byte[] { 120, 121, 122, 123, 124, 125, 126, 127, -128 }); + r.setFailInt(3000500200L); + r._check(); + + try (KaitaiStream io = new ByteBufferKaitaiStream(12)) { + r._write(io); + } + } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEosExceptionBytes.java b/spec/java/src/io/kaitai/struct/specwrite/TestEosExceptionBytes.java index b87359522..574f5a028 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestEosExceptionBytes.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEosExceptionBytes.java @@ -1,7 +1,7 @@ -// Autogenerated from KST: please remove this line if doing any edits by hand! - package io.kaitai.struct.specwrite; +import io.kaitai.struct.ByteBufferKaitaiStream; +import io.kaitai.struct.KaitaiStream; import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.EosExceptionBytes; import org.testng.annotations.Test; @@ -16,4 +16,20 @@ protected Class getStructClass() { protected String getSrcFilename() { throw new UnsupportedOperationException(); } + + @Test(expectedExceptions = java.nio.BufferOverflowException.class) + public void testEosExceptionBytes() throws Exception { + EosExceptionBytes r = new EosExceptionBytes(); + + EosExceptionBytes.Data data = new EosExceptionBytes.Data(null, r, r._root()); + data.setBuf(new byte[] { 0, -1, -2, -3, -4, -5, -6 }); + data._check(); + + r.setEnvelope(data); + r._check(); + + try (KaitaiStream io = new ByteBufferKaitaiStream(12)) { + r._write(io); + } + } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEosExceptionU4.java b/spec/java/src/io/kaitai/struct/specwrite/TestEosExceptionU4.java index 4384684fe..5fae851ff 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestEosExceptionU4.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEosExceptionU4.java @@ -1,7 +1,7 @@ -// Autogenerated from KST: please remove this line if doing any edits by hand! - package io.kaitai.struct.specwrite; +import io.kaitai.struct.ByteBufferKaitaiStream; +import io.kaitai.struct.KaitaiStream; import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.EosExceptionU4; import org.testng.annotations.Test; @@ -16,4 +16,21 @@ protected Class getStructClass() { protected String getSrcFilename() { throw new UnsupportedOperationException(); } + + @Test(expectedExceptions = java.nio.BufferOverflowException.class) + public void testEosExceptionU4() throws Exception { + EosExceptionU4 r = new EosExceptionU4(); + + EosExceptionU4.Data data = new EosExceptionU4.Data(null, r, r._root()); + data.setPrebuf(new byte[] { 0, -1, -2 }); + data.setFailInt(3000500200L); + data._check(); + + r.setEnvelope(data); + r._check(); + + try (KaitaiStream io = new ByteBufferKaitaiStream(12)) { + r._write(io); + } + } } diff --git a/spec/python/specwrite/test_eof_exception_bytes.py b/spec/python/specwrite/test_eof_exception_bytes.py index dea68a7ec..0d8d8280e 100644 --- a/spec/python/specwrite/test_eof_exception_bytes.py +++ b/spec/python/specwrite/test_eof_exception_bytes.py @@ -1,6 +1,6 @@ -# Autogenerated from KST: please remove this line if doing any edits by hand! - import unittest +import io +from kaitaistruct import KaitaiStream from specwrite.common_spec import CommonSpec from testwrite.eof_exception_bytes import EofExceptionBytes @@ -13,3 +13,12 @@ def __init__(self, *args, **kwargs): def test_read_write_roundtrip(self): self.skipTest("cannot use roundtrip because parsing is expected to fail") + + def test_eof_exception_bytes(self): + r = EofExceptionBytes() + r.buf = b"\x78\x79\x7A\x7B\x7C\x7D\x7E\x7F\xFF\xFE\xFD\xFC\xFB" + r._check() + + with KaitaiStream(io.BytesIO(bytearray(12))) as out_io: + with self.assertRaisesRegexp(EOFError, u"^requested to write 13 bytes, but only 12 bytes left in the stream$"): + r._write(out_io) diff --git a/spec/python/specwrite/test_eof_exception_u4.py b/spec/python/specwrite/test_eof_exception_u4.py index c27cf3d42..cd1921bac 100644 --- a/spec/python/specwrite/test_eof_exception_u4.py +++ b/spec/python/specwrite/test_eof_exception_u4.py @@ -1,6 +1,6 @@ -# Autogenerated from KST: please remove this line if doing any edits by hand! - import unittest +import io +from kaitaistruct import KaitaiStream from specwrite.common_spec import CommonSpec from testwrite.eof_exception_u4 import EofExceptionU4 @@ -13,3 +13,13 @@ def __init__(self, *args, **kwargs): def test_read_write_roundtrip(self): self.skipTest("cannot use roundtrip because parsing is expected to fail") + + def test_eof_exception_u4(self): + r = EofExceptionU4() + r.prebuf = b"\x78\x79\x7A\x7B\x7C\x7D\x7E\x7F\x80" + r.fail_int = 3000500200 + r._check() + + with KaitaiStream(io.BytesIO(bytearray(12))) as out_io: + with self.assertRaisesRegexp(EOFError, u"^requested to write 4 bytes, but only 3 bytes left in the stream$"): + r._write(out_io) diff --git a/spec/python/specwrite/test_eos_exception_bytes.py b/spec/python/specwrite/test_eos_exception_bytes.py index c89e87172..dd84f731e 100644 --- a/spec/python/specwrite/test_eos_exception_bytes.py +++ b/spec/python/specwrite/test_eos_exception_bytes.py @@ -1,6 +1,6 @@ -# Autogenerated from KST: please remove this line if doing any edits by hand! - import unittest +import io +from kaitaistruct import KaitaiStream from specwrite.common_spec import CommonSpec from testwrite.eos_exception_bytes import EosExceptionBytes @@ -13,3 +13,17 @@ def __init__(self, *args, **kwargs): def test_read_write_roundtrip(self): self.skipTest("cannot use roundtrip because parsing is expected to fail") + + def test_eos_exception_bytes(self): + r = EosExceptionBytes() + + data = EosExceptionBytes.Data(None, r, r._root) + data.buf = b"\x00\xFF\xFE\xFD\xFC\xFB\xFA" + data._check() + + r.envelope = data + r._check() + + with KaitaiStream(io.BytesIO(bytearray(12))) as out_io: + with self.assertRaisesRegexp(EOFError, u"^requested to write 7 bytes, but only 6 bytes left in the stream$"): + r._write(out_io) diff --git a/spec/python/specwrite/test_eos_exception_u4.py b/spec/python/specwrite/test_eos_exception_u4.py index b2b1ae442..0da977f84 100644 --- a/spec/python/specwrite/test_eos_exception_u4.py +++ b/spec/python/specwrite/test_eos_exception_u4.py @@ -1,6 +1,6 @@ -# Autogenerated from KST: please remove this line if doing any edits by hand! - import unittest +import io +from kaitaistruct import KaitaiStream from specwrite.common_spec import CommonSpec from testwrite.eos_exception_u4 import EosExceptionU4 @@ -13,3 +13,18 @@ def __init__(self, *args, **kwargs): def test_read_write_roundtrip(self): self.skipTest("cannot use roundtrip because parsing is expected to fail") + + def test_eos_exception_u4(self): + r = EosExceptionU4() + + data = EosExceptionU4.Data(None, r, r._root) + data.prebuf = b"\x00\xFF\xFE" + data.fail_int = 3000500200 + data._check() + + r.envelope = data + r._check() + + with KaitaiStream(io.BytesIO(bytearray(12))) as out_io: + with self.assertRaisesRegexp(EOFError, u"^requested to write 4 bytes, but only 3 bytes left in the stream$"): + r._write(out_io) From 619a1c3494f2899a7649afbdc0c49c2b87595124 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Mon, 6 Mar 2023 17:36:48 +0100 Subject: [PATCH 086/126] specwrite/common_spec.py: remove maximum length of diffs --- spec/python/specwrite/common_spec.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spec/python/specwrite/common_spec.py b/spec/python/specwrite/common_spec.py index 3a5ea2fad..3f0341f0b 100644 --- a/spec/python/specwrite/common_spec.py +++ b/spec/python/specwrite/common_spec.py @@ -7,6 +7,10 @@ class CommonSpec: class Base(unittest.TestCase): + def __init__(self, *args, **kwargs): + super(CommonSpec.Base, self).__init__(*args, **kwargs) + self.maxDiff = None + def test_read_write_roundtrip(self): orig_f = io.open(self.src_filename, 'rb') From 1a9c26813eae7799311702e7f6b428e42b8f7daa Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Sat, 11 Mar 2023 15:47:37 +0100 Subject: [PATCH 087/126] Java specwrite: only write to streams with expected size --- .../kaitai/struct/specwrite/CommonSpec.java | 43 +++++-------------- .../specwrite/TestBytesPadTermRoundtrip.java | 2 +- .../struct/specwrite/TestProcessRotate.java | 2 +- .../struct/specwrite/TestProcessToUser.java | 20 ++++++++- .../specwrite/TestStrPadTermRoundtrip.java | 2 +- 5 files changed, 33 insertions(+), 36 deletions(-) diff --git a/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java b/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java index 2f8ac6f30..5d14a4646 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java +++ b/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java @@ -1,6 +1,5 @@ package io.kaitai.struct.specwrite; -import java.io.FileInputStream; import java.io.IOException; import java.lang.reflect.Method; import java.lang.reflect.Modifier; @@ -11,8 +10,6 @@ import java.util.Map; import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; - import org.testng.annotations.Test; import io.kaitai.struct.ByteBufferKaitaiStream; @@ -60,41 +57,23 @@ protected void testReadWriteRoundtrip() throws Exception { } protected void assertEqualToFullFile(KaitaiStruct.ReadWrite struct, String fn) throws IOException { - byte[] actual = structToByteArray(struct); - - KaitaiStream expFile = new ByteBufferKaitaiStream(SRC_DIR + fn); - byte[] expected = expFile.readBytesFull(); - expFile.close(); + byte[] expected; + try (KaitaiStream expFile = new ByteBufferKaitaiStream(SRC_DIR + fn)) { + expected = expFile.toByteArray(); + } + struct._check(); + byte[] actual = new byte[expected.length]; + try (KaitaiStream actIo = new ByteBufferKaitaiStream(actual)) { + struct._write(actIo); + } - assertEquals(byteArrayToHex(actual), byteArrayToHex(expected)); + assertByteArrayEquals(actual, expected); } - protected void assertEqualToFile(KaitaiStruct.ReadWrite struct, String fn) throws IOException { - byte[] actual = structToByteArray(struct); - - assertTrue(actual.length > 0, "no data was written"); - - FileInputStream fis = new FileInputStream(SRC_DIR + fn); - byte[] expected = new byte[actual.length]; - fis.read(expected); - fis.close(); - + protected void assertByteArrayEquals(byte[] actual, byte[] expected) { assertEquals(byteArrayToHex(actual), byteArrayToHex(expected)); } - protected byte[] structToByteArray(KaitaiStruct.ReadWrite struct) { - struct._check(); - KaitaiStream io = new ByteBufferKaitaiStream(1024 * 1024); - struct._write(io); - long size = io.pos(); - io.seek(0); - return io.readBytes(size); - } - - protected KaitaiStream structToReadStream(KaitaiStruct.ReadWrite struct) { - return new ByteBufferKaitaiStream(structToByteArray(struct)); - } - protected static Object dumpStruct(KaitaiStruct.ReadWrite struct) throws Exception { return dumpStructValue(struct, new IdentityHashMap<>(), 50, "/"); } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTermRoundtrip.java b/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTermRoundtrip.java index 532b2e6a7..31d1e3623 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTermRoundtrip.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTermRoundtrip.java @@ -18,7 +18,7 @@ public void testBytesPadTermRoundtrip() throws Exception { r.setStrTermAndPad("str+++3bar+++".getBytes()); r.setStrTermInclude("str4baz@".getBytes()); - assertEqualToFile(r, "str_pad_term.bin"); + assertEqualToFullFile(r, "str_pad_term.bin"); } @Override diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestProcessRotate.java b/spec/java/src/io/kaitai/struct/specwrite/TestProcessRotate.java index e9aa64677..70f0e9456 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestProcessRotate.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestProcessRotate.java @@ -19,7 +19,7 @@ public void testProcessRotate() throws Exception { r.setKey(1); r.setBuf3("There".getBytes()); - assertEqualToFile(r, "process_rotate.bin"); + assertEqualToFullFile(r, "process_rotate.bin"); } @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: buf2,.*") diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestProcessToUser.java b/spec/java/src/io/kaitai/struct/specwrite/TestProcessToUser.java index 1a596e388..3e02be629 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestProcessToUser.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestProcessToUser.java @@ -1,7 +1,12 @@ package io.kaitai.struct.specwrite; +import io.kaitai.struct.ByteBufferKaitaiStream; +import io.kaitai.struct.KaitaiStream; import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.ProcessToUser; + +import java.io.FileInputStream; + import org.testng.annotations.Test; public class TestProcessToUser extends CommonSpec { @@ -14,9 +19,22 @@ public void testProcessToUser() throws Exception { ProcessToUser.JustStr buf1 = new ProcessToUser.JustStr(null, r, r._root()); buf1.setStr("Hello"); + buf1._check(); r.setBuf1(buf1); - assertEqualToFile(r, "process_rotate.bin"); + r._check(); + + byte[] expected = new byte[5]; + try (FileInputStream fis = new FileInputStream(SRC_DIR + "process_rotate.bin")) { + fis.read(expected); + } + + byte[] actual = new byte[expected.length]; + try (KaitaiStream io = new ByteBufferKaitaiStream(actual)) { + r._write(io); + } + + assertByteArrayEquals(actual, expected); } @Override diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestStrPadTermRoundtrip.java b/spec/java/src/io/kaitai/struct/specwrite/TestStrPadTermRoundtrip.java index df2ec4d70..ab3cff44d 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestStrPadTermRoundtrip.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestStrPadTermRoundtrip.java @@ -20,7 +20,7 @@ public void testStrPadTermRoundtrip() throws Exception { r.setStrTermAndPad("str+++3bar+++"); r.setStrTermInclude("str4baz@"); - assertEqualToFile(r, "str_pad_term.bin"); + assertEqualToFullFile(r, "str_pad_term.bin"); } @Override From c166c870cd8b9f957b1f413fc1b64137b0cc7183 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Sat, 11 Mar 2023 17:43:43 +0100 Subject: [PATCH 088/126] Java: add assertThrowsEofError supporting both BB and RAF streams --- build-formats | 2 + .../src/io/kaitai/struct/spec/CommonSpec.java | 43 +++++++++++++ .../struct/spec/TestEofExceptionBytes.java | 10 +++- .../struct/spec/TestEofExceptionU4.java | 10 +++- .../struct/spec/TestEosExceptionBytes.java | 10 +++- .../struct/spec/TestEosExceptionU4.java | 10 +++- .../kaitai/struct/spec/TestExprIoEofBits.java | 2 +- .../specwrite/TestEofExceptionBytes.java | 50 ++++++++++++++-- .../struct/specwrite/TestEofExceptionU4.java | 50 ++++++++++++++-- .../struct/specwrite/TestExprIoEofBits.java | 60 +++++++++++++++---- src/scratch/.gitignore | 2 + .../specgenerators/JavaSG.scala | 27 +++++++-- 12 files changed, 236 insertions(+), 40 deletions(-) create mode 100644 src/scratch/.gitignore diff --git a/build-formats b/build-formats index 5f6d05d8f..a7ef6b414 100755 --- a/build-formats +++ b/build-formats @@ -5,6 +5,8 @@ rm -rf "$FORMATS_COMPILED_DIR" mkdir -p "$FORMATS_COMPILED_DIR" +# --java-from-file-class io.kaitai.struct.RandomAccessFileKaitaiStream \ + "$COMPILER_DIR/jvm/target/universal/stage/bin/kaitai-struct-compiler" -- \ --verbose all -t all -d "$FORMATS_COMPILED_DIR" \ --import-path "$FORMATS_REPO_DIR" \ diff --git a/spec/java/src/io/kaitai/struct/spec/CommonSpec.java b/spec/java/src/io/kaitai/struct/spec/CommonSpec.java index b2e5ae09b..4690265c2 100644 --- a/spec/java/src/io/kaitai/struct/spec/CommonSpec.java +++ b/spec/java/src/io/kaitai/struct/spec/CommonSpec.java @@ -1,9 +1,14 @@ package io.kaitai.struct.spec; import static org.testng.Assert.assertEquals; +import static org.testng.Assert.expectThrows; + +import java.io.EOFException; +import org.testng.Assert.ThrowingRunnable; public class CommonSpec { public static String SRC_DIR = "../../src/"; + public static String SCRATCH_DIR = "../../src/scratch/"; // Family of assertIntEquals methods helps to compare integer-like values in Java, // ignoring whether the value was a boxed type (Integer) or primitive type (int). @@ -47,4 +52,42 @@ public void assertIntEquals(boolean actual, boolean expected) { public void assertIntEquals(Boolean actual, boolean expected) { assertEquals(actual.booleanValue(), expected); } + + protected void assertThrowsEofError(ThrowingRunnable runnable) { + expectThrowsEofError(runnable); + } + + protected Throwable expectThrowsEofError(ThrowingRunnable runnable) { + RuntimeException t = expectThrows(RuntimeException.class, runnable); + if (t instanceof java.nio.BufferUnderflowException) { + // OK + } else if (t instanceof java.nio.BufferOverflowException) { + // OK + } else { + if (t.getCause() instanceof EOFException) { + // OK + return t.getCause(); + } else { + String mismatchMessage; + if (t.getClass().equals(RuntimeException.class)) { + mismatchMessage = String.format( + "Expected the cause of %s to be %s, but it was %s", + RuntimeException.class.getSimpleName(), + EOFException.class.getSimpleName(), + t.getCause() == null ? "null" : t.getCause().getClass().getSimpleName() + ); + } else { + mismatchMessage = String.format( + "Expected %s with cause %s, but %s was thrown", + RuntimeException.class.getSimpleName(), + EOFException.class.getSimpleName(), + t.getClass().getSimpleName() + ); + } + throw new AssertionError(mismatchMessage, t.getCause()); + } + } + + return t; + } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestEofExceptionBytes.java b/spec/java/src/io/kaitai/struct/spec/TestEofExceptionBytes.java index 91f24f527..f3c8cebac 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestEofExceptionBytes.java +++ b/spec/java/src/io/kaitai/struct/spec/TestEofExceptionBytes.java @@ -5,11 +5,15 @@ import io.kaitai.struct.testformats.EofExceptionBytes; import org.testng.annotations.Test; import static org.testng.Assert.*; -import io.kaitai.struct.KaitaiStream; public class TestEofExceptionBytes extends CommonSpec { - @Test(expectedExceptions = java.nio.BufferUnderflowException.class) + @Test public void testEofExceptionBytes() throws Exception { - EofExceptionBytes r = EofExceptionBytes.fromFile(SRC_DIR + "term_strz.bin"); + assertThrowsEofError(new ThrowingRunnable() { + @Override + public void run() throws Throwable { + EofExceptionBytes r = EofExceptionBytes.fromFile(SRC_DIR + "term_strz.bin"); + } + }); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestEofExceptionU4.java b/spec/java/src/io/kaitai/struct/spec/TestEofExceptionU4.java index 9988d36d0..ec0986d64 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestEofExceptionU4.java +++ b/spec/java/src/io/kaitai/struct/spec/TestEofExceptionU4.java @@ -5,11 +5,15 @@ import io.kaitai.struct.testformats.EofExceptionU4; import org.testng.annotations.Test; import static org.testng.Assert.*; -import io.kaitai.struct.KaitaiStream; public class TestEofExceptionU4 extends CommonSpec { - @Test(expectedExceptions = java.nio.BufferUnderflowException.class) + @Test public void testEofExceptionU4() throws Exception { - EofExceptionU4 r = EofExceptionU4.fromFile(SRC_DIR + "term_strz.bin"); + assertThrowsEofError(new ThrowingRunnable() { + @Override + public void run() throws Throwable { + EofExceptionU4 r = EofExceptionU4.fromFile(SRC_DIR + "term_strz.bin"); + } + }); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestEosExceptionBytes.java b/spec/java/src/io/kaitai/struct/spec/TestEosExceptionBytes.java index 7eccd877d..2a4a2d67d 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestEosExceptionBytes.java +++ b/spec/java/src/io/kaitai/struct/spec/TestEosExceptionBytes.java @@ -5,11 +5,15 @@ import io.kaitai.struct.testformats.EosExceptionBytes; import org.testng.annotations.Test; import static org.testng.Assert.*; -import io.kaitai.struct.KaitaiStream; public class TestEosExceptionBytes extends CommonSpec { - @Test(expectedExceptions = java.nio.BufferUnderflowException.class) + @Test public void testEosExceptionBytes() throws Exception { - EosExceptionBytes r = EosExceptionBytes.fromFile(SRC_DIR + "term_strz.bin"); + assertThrowsEofError(new ThrowingRunnable() { + @Override + public void run() throws Throwable { + EosExceptionBytes r = EosExceptionBytes.fromFile(SRC_DIR + "term_strz.bin"); + } + }); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestEosExceptionU4.java b/spec/java/src/io/kaitai/struct/spec/TestEosExceptionU4.java index c56b41f15..ba0cc8160 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestEosExceptionU4.java +++ b/spec/java/src/io/kaitai/struct/spec/TestEosExceptionU4.java @@ -5,11 +5,15 @@ import io.kaitai.struct.testformats.EosExceptionU4; import org.testng.annotations.Test; import static org.testng.Assert.*; -import io.kaitai.struct.KaitaiStream; public class TestEosExceptionU4 extends CommonSpec { - @Test(expectedExceptions = java.nio.BufferUnderflowException.class) + @Test public void testEosExceptionU4() throws Exception { - EosExceptionU4 r = EosExceptionU4.fromFile(SRC_DIR + "term_strz.bin"); + assertThrowsEofError(new ThrowingRunnable() { + @Override + public void run() throws Throwable { + EosExceptionU4 r = EosExceptionU4.fromFile(SRC_DIR + "term_strz.bin"); + } + }); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestExprIoEofBits.java b/spec/java/src/io/kaitai/struct/spec/TestExprIoEofBits.java index 738c2ffed..b029db43d 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestExprIoEofBits.java +++ b/spec/java/src/io/kaitai/struct/spec/TestExprIoEofBits.java @@ -10,7 +10,7 @@ public class TestExprIoEofBits extends CommonSpec { public void testExprIoEofBits() throws Exception { ExprIoEofBits r = ExprIoEofBits.fromFile(SRC_DIR + "nav_parent_switch.bin"); - assertThrows(java.nio.BufferUnderflowException.class, new ThrowingRunnable() { + assertThrowsEofError(new ThrowingRunnable() { @Override public void run() throws Throwable { r._read(); diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBytes.java b/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBytes.java index 8f0d3cb9d..a867d947b 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBytes.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBytes.java @@ -2,9 +2,16 @@ import io.kaitai.struct.ByteBufferKaitaiStream; import io.kaitai.struct.KaitaiStream; +import io.kaitai.struct.RandomAccessFileKaitaiStream; import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.EofExceptionBytes; + +import java.io.File; +import java.io.RandomAccessFile; + +import org.testng.Assert.ThrowingRunnable; import org.testng.annotations.Test; +import static org.testng.Assert.assertEquals; public class TestEofExceptionBytes extends CommonSpec { @Override @@ -17,14 +24,47 @@ protected String getSrcFilename() { throw new UnsupportedOperationException(); } - @Test(expectedExceptions = java.nio.BufferOverflowException.class) - public void testEofExceptionBytes() throws Exception { + @Test + public void testEofExceptionBytesBB() throws Exception { + EofExceptionBytes r = getEofExceptionBytes(); + + try (KaitaiStream io = new ByteBufferKaitaiStream(12)) { + assertThrowsEofError(new ThrowingRunnable() { + @Override + public void run() throws Throwable { + r._write(io); + } + }); + } + } + + @Test + public void testEofExceptionBytesRAF() throws Exception { + EofExceptionBytes r = getEofExceptionBytes(); + + File file = new File(SCRATCH_DIR + "specwrite_TestEofExceptionBytes.bin"); + RandomAccessFile raf = new RandomAccessFile(file, "rw"); + raf.setLength(12); + + Throwable thr; + try (KaitaiStream io = new RandomAccessFileKaitaiStream(raf)) { + thr = expectThrowsEofError(new ThrowingRunnable() { + @Override + public void run() throws Throwable { + r._write(io); + } + }); + } finally { + file.delete(); + } + assertEquals(thr.getMessage(), "requested to write 13 bytes, but only 12 bytes left in the stream"); + } + + protected EofExceptionBytes getEofExceptionBytes() { EofExceptionBytes r = new EofExceptionBytes(); r.setBuf(new byte[] { 120, 121, 122, 123, 124, 125, 126, 127, -1, -2, -3, -4, -5 }); r._check(); - try (KaitaiStream io = new ByteBufferKaitaiStream(12)) { - r._write(io); - } + return r; } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionU4.java b/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionU4.java index 401540118..e53ec8203 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionU4.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionU4.java @@ -2,9 +2,16 @@ import io.kaitai.struct.ByteBufferKaitaiStream; import io.kaitai.struct.KaitaiStream; +import io.kaitai.struct.RandomAccessFileKaitaiStream; import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.EofExceptionU4; + +import java.io.File; +import java.io.RandomAccessFile; + +import org.testng.Assert.ThrowingRunnable; import org.testng.annotations.Test; +import static org.testng.Assert.assertEquals; public class TestEofExceptionU4 extends CommonSpec { @Override @@ -17,15 +24,48 @@ protected String getSrcFilename() { throw new UnsupportedOperationException(); } - @Test(expectedExceptions = java.nio.BufferOverflowException.class) - public void testEofExceptionU4() throws Exception { + @Test + public void testEofExceptionU4BB() throws Exception { + EofExceptionU4 r = getEofExceptionU4(); + + try (KaitaiStream io = new ByteBufferKaitaiStream(12)) { + assertThrowsEofError(new ThrowingRunnable() { + @Override + public void run() throws Throwable { + r._write(io); + } + }); + } + } + + @Test + public void testEofExceptionU4RAF() throws Exception { + EofExceptionU4 r = getEofExceptionU4(); + + File file = new File(SCRATCH_DIR + "specwrite_TestEofExceptionU4.bin"); + RandomAccessFile raf = new RandomAccessFile(file, "rw"); + raf.setLength(12); + + Throwable thr; + try (KaitaiStream io = new RandomAccessFileKaitaiStream(raf)) { + thr = expectThrowsEofError(new ThrowingRunnable() { + @Override + public void run() throws Throwable { + r._write(io); + } + }); + } finally { + file.delete(); + } + assertEquals(thr.getMessage(), "requested to write 4 bytes, but only 3 bytes left in the stream"); + } + + protected EofExceptionU4 getEofExceptionU4() { EofExceptionU4 r = new EofExceptionU4(); r.setPrebuf(new byte[] { 120, 121, 122, 123, 124, 125, 126, 127, -128 }); r.setFailInt(3000500200L); r._check(); - try (KaitaiStream io = new ByteBufferKaitaiStream(12)) { - r._write(io); - } + return r; } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestExprIoEofBits.java b/spec/java/src/io/kaitai/struct/specwrite/TestExprIoEofBits.java index bb79a191d..4436013ac 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestExprIoEofBits.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestExprIoEofBits.java @@ -2,11 +2,15 @@ import io.kaitai.struct.ByteBufferKaitaiStream; import io.kaitai.struct.KaitaiStream; +import io.kaitai.struct.RandomAccessFileKaitaiStream; import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.ExprIoEofBits; import org.testng.annotations.Test; import static org.testng.Assert.*; +import java.io.File; +import java.io.RandomAccessFile; + public class TestExprIoEofBits extends CommonSpec { @Override protected Class getStructClass() { @@ -19,12 +23,50 @@ protected String getSrcFilename() { } @Test - public void testExprIoEofBits() throws Exception { - long ioSize; - try (KaitaiStream io = new ByteBufferKaitaiStream(SRC_DIR + "nav_parent_switch.bin")) { - ioSize = io.size(); + public void testExprIoEofBitsBB() throws Exception { + ExprIoEofBits r = getExprIoEofBits(); + + KaitaiStream newIo = new ByteBufferKaitaiStream(3); + r._write_Seq(newIo); + + assertThrowsEofError(new ThrowingRunnable() { + @Override + public void run() throws Throwable { + newIo.close(); + } + }); + // shouldn't do anything (especially not throw any exception), + // because close() is supposed to be idempotent + newIo.close(); + } + + @Test + public void testExprIoEofBitsRAF() throws Exception { + ExprIoEofBits r = getExprIoEofBits(); + + File file = new File(SCRATCH_DIR + "specwrite_TestExprIoEofBits.bin"); + RandomAccessFile raf = new RandomAccessFile(file, "rw"); + raf.setLength(3); + + try { + KaitaiStream newIo = new RandomAccessFileKaitaiStream(raf); + r._write_Seq(newIo); + + Throwable thr = expectThrowsEofError(new ThrowingRunnable() { + @Override + public void run() throws Throwable { + newIo.close(); + } + }); + // shouldn't do anything (especially not throw any exception), + // because close() is supposed to be idempotent + newIo.close(); + } finally { + file.delete(); } + } + protected ExprIoEofBits getExprIoEofBits() { ExprIoEofBits r = new ExprIoEofBits(); r.setFoo(5167); r.setBar(15L); @@ -33,14 +75,6 @@ public void testExprIoEofBits() throws Exception { r.setAssertIoEofAfterBaz(new byte[8]); // doesn't matter r._check(); - KaitaiStream newIo = new ByteBufferKaitaiStream(ioSize); - r._write_Seq(newIo); - - assertThrows(java.nio.BufferOverflowException.class, new ThrowingRunnable() { - @Override - public void run() throws Throwable { - newIo.close(); - } - }); + return r; } } diff --git a/src/scratch/.gitignore b/src/scratch/.gitignore new file mode 100644 index 000000000..d6b7ef32c --- /dev/null +++ b/src/scratch/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/translator/src/main/scala/io/kaitai/struct/testtranslator/specgenerators/JavaSG.scala b/translator/src/main/scala/io/kaitai/struct/testtranslator/specgenerators/JavaSG.scala index 9125d80cc..5f8d077e9 100644 --- a/translator/src/main/scala/io/kaitai/struct/testtranslator/specgenerators/JavaSG.scala +++ b/translator/src/main/scala/io/kaitai/struct/testtranslator/specgenerators/JavaSG.scala @@ -2,7 +2,7 @@ package io.kaitai.struct.testtranslator.specgenerators import io.kaitai.struct.{ClassTypeProvider, RuntimeConfig} import io.kaitai.struct.datatype.DataType._ -import io.kaitai.struct.datatype.{DataType, KSError} +import io.kaitai.struct.datatype.{DataType, KSError, EndOfStreamError} import io.kaitai.struct.exprlang.Ast import io.kaitai.struct.languages.JavaCompiler import io.kaitai.struct.testtranslator.{Main, TestAssert, TestSpec} @@ -36,9 +36,28 @@ class JavaSG(spec: TestSpec, provider: ClassTypeProvider) extends BaseGenerator( } override def runParseExpectError(exception: KSError): Unit = { - importList.add("io.kaitai.struct.KaitaiStream") - out.puts(s"@Test(expectedExceptions = ${compiler.ksErrorName(exception)}.class)") - runParseCommon() + if (exception == EndOfStreamError) { + out.puts("@Test") + out.puts(s"public void test$className() throws Exception {") + out.inc + + out.puts("assertThrowsEofError(new ThrowingRunnable() {") + out.inc + + out.puts("@Override") + out.puts("public void run() throws Throwable {") + out.inc + out.puts(s"$className r = $className.fromFile(SRC_DIR + " + "\"" + spec.data + "\");") + out.dec + out.puts("}") + + out.dec + out.puts("});") + } else { + importList.add("io.kaitai.struct.KaitaiStream") + out.puts(s"@Test(expectedExceptions = ${compiler.ksErrorName(exception)}.class)") + runParseCommon() + } } def runParseCommon(): Unit = { From 5c2ba6e48cf0a41cbc1eca0b49fbdf60116aa7fb Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Sat, 11 Mar 2023 19:15:52 +0100 Subject: [PATCH 089/126] JavaSG: delete redundant empty line in output, regen Java from KST --- .../struct/spec/TestBitsSeqEndianCombo.java | 1 - .../struct/spec/TestBitsShiftByB32Le.java | 1 - .../struct/spec/TestBitsShiftByB64Le.java | 1 - .../struct/spec/TestBitsSignedResB32Be.java | 1 - .../struct/spec/TestBitsSignedResB32Le.java | 1 - .../struct/spec/TestBitsSignedShiftB32Le.java | 1 - .../struct/spec/TestBitsSignedShiftB64Le.java | 1 - .../kaitai/struct/spec/TestBitsSimpleLe.java | 1 - .../struct/spec/TestBitsUnalignedB32Be.java | 1 - .../struct/spec/TestBitsUnalignedB32Le.java | 1 - .../struct/spec/TestBitsUnalignedB64Be.java | 1 - .../struct/spec/TestBitsUnalignedB64Le.java | 1 - .../struct/spec/TestBytesEosPadTerm.java | 1 - .../struct/spec/TestBytesPadTermEmpty.java | 1 - .../struct/spec/TestBytesPadTermEqual.java | 1 - .../spec/TestBytesPadTermRoundtrip.java | 1 - .../struct/spec/TestBytesPadTermZeroSize.java | 1 - .../struct/spec/TestCastToImported.java | 1 + .../kaitai/struct/spec/TestCombineBool.java | 1 - .../kaitai/struct/spec/TestCombineBytes.java | 1 - .../kaitai/struct/spec/TestCombineEnum.java | 1 - .../io/kaitai/struct/spec/TestCombineStr.java | 1 - .../struct/spec/TestDefaultBitEndianMod.java | 1 - .../spec/TestDefaultEndianExprException.java | 1 - .../spec/TestDefaultEndianExprInherited.java | 30 ++++++++-------- .../spec/TestDefaultEndianExprIsBe.java | 36 +++++++++---------- .../spec/TestDefaultEndianExprIsLe.java | 24 ++++++------- .../io/kaitai/struct/spec/TestEnumImport.java | 1 - .../kaitai/struct/spec/TestEnumIntRangeS.java | 1 - .../kaitai/struct/spec/TestEnumIntRangeU.java | 1 - .../struct/spec/TestEnumLongRangeS.java | 1 - .../struct/spec/TestEnumLongRangeU.java | 1 - .../io/kaitai/struct/spec/TestEnumToI.java | 1 - .../struct/spec/TestEnumToIClassBorder1.java | 2 +- .../struct/spec/TestEofExceptionBytes.java | 1 - .../struct/spec/TestEofExceptionU4.java | 1 - .../struct/spec/TestEosExceptionBytes.java | 1 - .../struct/spec/TestEosExceptionU4.java | 1 - .../io/kaitai/struct/spec/TestExprBits.java | 5 ++- .../struct/spec/TestExprBytesNonLiteral.java | 5 ++- .../kaitai/struct/spec/TestExprBytesOps.java | 1 - .../struct/spec/TestExprCalcArrayOps.java | 1 - .../kaitai/struct/spec/TestExprIfIntEq.java | 1 - .../kaitai/struct/spec/TestExprIfIntOps.java | 1 - .../io/kaitai/struct/spec/TestExprIntDiv.java | 1 - .../io/kaitai/struct/spec/TestExprIoEof.java | 1 - .../kaitai/struct/spec/TestExprIoPosBits.java | 1 - .../kaitai/struct/spec/TestExprOpsParens.java | 1 - .../struct/spec/TestExprStrEncodings.java | 1 - .../io/kaitai/struct/spec/TestExprStrOps.java | 1 - .../io/kaitai/struct/spec/TestFloatToI.java | 1 - .../struct/spec/TestFloatingPoints.java | 4 +-- .../io/kaitai/struct/spec/TestIfValues.java | 12 +++---- .../io/kaitai/struct/spec/TestImports0.java | 1 + .../io/kaitai/struct/spec/TestImportsAbs.java | 1 + .../struct/spec/TestImportsCircularA.java | 1 - .../kaitai/struct/spec/TestImportsRel1.java | 1 - .../io/kaitai/struct/spec/TestIndexSizes.java | 12 +++---- .../struct/spec/TestIndexToParamEos.java | 12 +++---- .../struct/spec/TestIndexToParamExpr.java | 12 +++---- .../struct/spec/TestIndexToParamUntil.java | 12 +++---- .../struct/spec/TestInstanceInRepeatExpr.java | 1 - .../spec/TestInstanceInRepeatUntil.java | 1 - .../struct/spec/TestInstanceInSized.java | 1 - .../struct/spec/TestInstanceIoUser.java | 6 ++-- .../spec/TestInstanceIoUserEarlier.java | 1 - .../struct/spec/TestInstanceStdArray.java | 6 ++-- .../struct/spec/TestInstanceUserArray.java | 12 +++---- .../spec/TestIntegersDoubleOverflow.java | 1 - .../struct/spec/TestIntegersMinMax.java | 9 +++-- .../io/kaitai/struct/spec/TestNavParent.java | 4 +-- .../io/kaitai/struct/spec/TestNavParent2.java | 16 ++++----- .../io/kaitai/struct/spec/TestNavParent3.java | 16 ++++----- .../struct/spec/TestNavParentSwitchCast.java | 1 - .../io/kaitai/struct/spec/TestNavRoot.java | 4 +-- .../struct/spec/TestNestedTypeParam.java | 1 - .../struct/spec/TestOpaqueExternalType.java | 5 +-- .../io/kaitai/struct/spec/TestOptionalId.java | 1 - .../spec/TestParamsCallExtraParens.java | 1 - .../struct/spec/TestParamsPassArrayInt.java | 11 +++--- .../struct/spec/TestParamsPassArrayIo.java | 1 - .../struct/spec/TestParamsPassArrayStr.java | 11 +++--- .../spec/TestParamsPassArrayStruct.java | 5 ++- .../spec/TestParamsPassArrayUsertype.java | 5 ++- .../struct/spec/TestParamsPassBool.java | 1 - .../kaitai/struct/spec/TestParamsPassIo.java | 1 - .../struct/spec/TestParamsPassStruct.java | 1 - .../struct/spec/TestProcessBytesPadTerm.java | 1 - .../struct/spec/TestProcessCoerceBytes.java | 8 ++--- .../spec/TestProcessCoerceUsertype1.java | 8 ++--- .../spec/TestProcessCoerceUsertype2.java | 8 ++--- .../struct/spec/TestProcessCustomNoArgs.java | 1 - .../struct/spec/TestProcessRepeatBytes.java | 5 ++- .../spec/TestProcessRepeatUsertype.java | 9 +++-- ...TestProcessRepeatUsertypeDynargCustom.java | 1 - ...TestProcessRepeatUsertypeDynargRotate.java | 1 - .../TestProcessRepeatUsertypeDynargXor.java | 1 - .../struct/spec/TestProcessStructPadTerm.java | 1 - .../struct/spec/TestProcessTermStruct.java | 1 - .../struct/spec/TestRepeatEosBytes.java | 7 ++-- .../struct/spec/TestRepeatEosBytesPad.java | 7 ++-- .../spec/TestRepeatEosBytesPadTerm.java | 7 ++-- .../struct/spec/TestRepeatEosStruct.java | 8 ++--- .../struct/spec/TestRepeatEosTermBytes.java | 5 ++- .../struct/spec/TestRepeatEosTermStruct.java | 1 - .../kaitai/struct/spec/TestRepeatEosU4.java | 12 ++++--- .../kaitai/struct/spec/TestRepeatNBytes.java | 7 ++-- .../struct/spec/TestRepeatNBytesPad.java | 7 ++-- .../struct/spec/TestRepeatNBytesPadTerm.java | 7 ++-- .../kaitai/struct/spec/TestRepeatNStruct.java | 8 ++--- .../struct/spec/TestRepeatNTermBytes.java | 13 ++++--- .../struct/spec/TestRepeatNTermStruct.java | 1 - .../struct/spec/TestRepeatUntilBytes.java | 7 ++-- .../struct/spec/TestRepeatUntilBytesPad.java | 7 ++-- .../spec/TestRepeatUntilBytesPadTerm.java | 7 ++-- .../spec/TestRepeatUntilCalcArrayType.java | 13 ++++--- .../struct/spec/TestRepeatUntilComplex.java | 24 ++++++------- .../struct/spec/TestRepeatUntilSized.java | 12 +++---- .../struct/spec/TestRepeatUntilTermBytes.java | 13 ++++--- .../spec/TestRepeatUntilTermStruct.java | 1 - .../struct/spec/TestStrEncodingsUtf16.java | 1 - .../kaitai/struct/spec/TestStrEosPadTerm.java | 1 - .../struct/spec/TestStrEosPadTermEmpty.java | 1 - .../struct/spec/TestStrEosPadTermEqual.java | 1 - .../struct/spec/TestStrPadTermEqual.java | 1 - .../struct/spec/TestStrPadTermRoundtrip.java | 1 - .../struct/spec/TestStrPadTermZeroSize.java | 1 - .../kaitai/struct/spec/TestStructPadTerm.java | 1 - .../struct/spec/TestStructPadTermEqual.java | 1 - .../struct/spec/TestSwitchBytearray.java | 16 ++++----- .../struct/spec/TestSwitchElseOnly.java | 1 - .../struct/spec/TestSwitchIntegers.java | 16 ++++----- .../struct/spec/TestSwitchManualEnum.java | 16 ++++----- .../struct/spec/TestSwitchManualInt.java | 16 ++++----- .../struct/spec/TestSwitchManualIntElse.java | 16 ++++----- .../struct/spec/TestSwitchManualIntSize.java | 19 +++++----- .../spec/TestSwitchManualIntSizeElse.java | 18 +++++----- .../spec/TestSwitchManualIntSizeEos.java | 19 +++++----- .../struct/spec/TestSwitchManualStr.java | 16 ++++----- .../struct/spec/TestSwitchManualStrElse.java | 16 ++++----- .../struct/spec/TestSwitchMultiBoolOps.java | 17 +++++---- .../struct/spec/TestSwitchRepeatExpr.java | 3 +- .../spec/TestSwitchRepeatExprInvalid.java | 3 +- .../io/kaitai/struct/spec/TestTermBytes2.java | 1 - .../io/kaitai/struct/spec/TestTermBytes3.java | 1 - .../io/kaitai/struct/spec/TestTermBytes4.java | 1 - .../io/kaitai/struct/spec/TestTermStruct.java | 1 - .../kaitai/struct/spec/TestTermStruct2.java | 1 - .../kaitai/struct/spec/TestTermStruct3.java | 1 - .../kaitai/struct/spec/TestTermStruct4.java | 1 - .../io/kaitai/struct/spec/TestTermStrz2.java | 1 - .../io/kaitai/struct/spec/TestTermStrz3.java | 1 - .../io/kaitai/struct/spec/TestTermStrz4.java | 1 - .../io/kaitai/struct/spec/TestTermU1Val.java | 1 - .../struct/spec/TestTypeTernary2ndFalsy.java | 7 ++-- .../struct/spec/TestTypeTernaryOpaque.java | 5 +-- .../struct/spec/TestValidEqStrEncodings.java | 1 - .../struct/spec/TestValidFailAnyofInt.java | 1 - .../struct/spec/TestValidFailContents.java | 1 - .../struct/spec/TestValidFailEqBytes.java | 1 - .../struct/spec/TestValidFailEqInt.java | 1 - .../struct/spec/TestValidFailEqStr.java | 1 - .../kaitai/struct/spec/TestValidFailExpr.java | 1 - .../kaitai/struct/spec/TestValidFailInst.java | 1 - .../struct/spec/TestValidFailMaxInt.java | 1 - .../struct/spec/TestValidFailMinInt.java | 1 - .../struct/spec/TestValidFailRangeBytes.java | 1 - .../struct/spec/TestValidFailRangeFloat.java | 1 - .../struct/spec/TestValidFailRangeInt.java | 1 - .../struct/spec/TestValidFailRangeStr.java | 1 - .../io/kaitai/struct/spec/TestValidLong.java | 1 - .../struct/spec/TestValidNotParsedIf.java | 1 - .../struct/spec/TestValidOptionalId.java | 1 - .../io/kaitai/struct/spec/TestValidShort.java | 1 - .../kaitai/struct/spec/TestValidSwitch.java | 1 - .../struct/spec/TestZlibSurrounded.java | 1 - spec/ks/repeat_eos_u4.kst | 12 +++++-- .../specgenerators/JavaSG.scala | 1 - 178 files changed, 346 insertions(+), 468 deletions(-) diff --git a/spec/java/src/io/kaitai/struct/spec/TestBitsSeqEndianCombo.java b/spec/java/src/io/kaitai/struct/spec/TestBitsSeqEndianCombo.java index b6e04de47..d546ece80 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestBitsSeqEndianCombo.java +++ b/spec/java/src/io/kaitai/struct/spec/TestBitsSeqEndianCombo.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestBitsSeqEndianCombo extends CommonSpec { - @Test public void testBitsSeqEndianCombo() throws Exception { BitsSeqEndianCombo r = BitsSeqEndianCombo.fromFile(SRC_DIR + "process_xor_4.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestBitsShiftByB32Le.java b/spec/java/src/io/kaitai/struct/spec/TestBitsShiftByB32Le.java index ce24ac08b..86c15770e 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestBitsShiftByB32Le.java +++ b/spec/java/src/io/kaitai/struct/spec/TestBitsShiftByB32Le.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestBitsShiftByB32Le extends CommonSpec { - @Test public void testBitsShiftByB32Le() throws Exception { BitsShiftByB32Le r = BitsShiftByB32Le.fromFile(SRC_DIR + "bits_shift_by_b32_le.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestBitsShiftByB64Le.java b/spec/java/src/io/kaitai/struct/spec/TestBitsShiftByB64Le.java index 55f25b2bf..ef3790db7 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestBitsShiftByB64Le.java +++ b/spec/java/src/io/kaitai/struct/spec/TestBitsShiftByB64Le.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestBitsShiftByB64Le extends CommonSpec { - @Test public void testBitsShiftByB64Le() throws Exception { BitsShiftByB64Le r = BitsShiftByB64Le.fromFile(SRC_DIR + "bits_shift_by_b64_le.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestBitsSignedResB32Be.java b/spec/java/src/io/kaitai/struct/spec/TestBitsSignedResB32Be.java index 3d89f12af..a0873e668 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestBitsSignedResB32Be.java +++ b/spec/java/src/io/kaitai/struct/spec/TestBitsSignedResB32Be.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestBitsSignedResB32Be extends CommonSpec { - @Test public void testBitsSignedResB32Be() throws Exception { BitsSignedResB32Be r = BitsSignedResB32Be.fromFile(SRC_DIR + "bits_shift_by_b32_le.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestBitsSignedResB32Le.java b/spec/java/src/io/kaitai/struct/spec/TestBitsSignedResB32Le.java index f853fc732..06ca3afd2 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestBitsSignedResB32Le.java +++ b/spec/java/src/io/kaitai/struct/spec/TestBitsSignedResB32Le.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestBitsSignedResB32Le extends CommonSpec { - @Test public void testBitsSignedResB32Le() throws Exception { BitsSignedResB32Le r = BitsSignedResB32Le.fromFile(SRC_DIR + "bits_shift_by_b32_le.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestBitsSignedShiftB32Le.java b/spec/java/src/io/kaitai/struct/spec/TestBitsSignedShiftB32Le.java index 4204a9338..46796ee37 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestBitsSignedShiftB32Le.java +++ b/spec/java/src/io/kaitai/struct/spec/TestBitsSignedShiftB32Le.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestBitsSignedShiftB32Le extends CommonSpec { - @Test public void testBitsSignedShiftB32Le() throws Exception { BitsSignedShiftB32Le r = BitsSignedShiftB32Le.fromFile(SRC_DIR + "bits_signed_shift_b32_le.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestBitsSignedShiftB64Le.java b/spec/java/src/io/kaitai/struct/spec/TestBitsSignedShiftB64Le.java index ca03fbeb0..e621c7327 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestBitsSignedShiftB64Le.java +++ b/spec/java/src/io/kaitai/struct/spec/TestBitsSignedShiftB64Le.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestBitsSignedShiftB64Le extends CommonSpec { - @Test public void testBitsSignedShiftB64Le() throws Exception { BitsSignedShiftB64Le r = BitsSignedShiftB64Le.fromFile(SRC_DIR + "bits_signed_shift_b64_le.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestBitsSimpleLe.java b/spec/java/src/io/kaitai/struct/spec/TestBitsSimpleLe.java index f9d2d29a3..e301e385c 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestBitsSimpleLe.java +++ b/spec/java/src/io/kaitai/struct/spec/TestBitsSimpleLe.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestBitsSimpleLe extends CommonSpec { - @Test public void testBitsSimpleLe() throws Exception { BitsSimpleLe r = BitsSimpleLe.fromFile(SRC_DIR + "fixed_struct.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestBitsUnalignedB32Be.java b/spec/java/src/io/kaitai/struct/spec/TestBitsUnalignedB32Be.java index 756ee3592..967f55394 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestBitsUnalignedB32Be.java +++ b/spec/java/src/io/kaitai/struct/spec/TestBitsUnalignedB32Be.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestBitsUnalignedB32Be extends CommonSpec { - @Test public void testBitsUnalignedB32Be() throws Exception { BitsUnalignedB32Be r = BitsUnalignedB32Be.fromFile(SRC_DIR + "process_xor_4.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestBitsUnalignedB32Le.java b/spec/java/src/io/kaitai/struct/spec/TestBitsUnalignedB32Le.java index d8ffa084e..dadcde6c2 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestBitsUnalignedB32Le.java +++ b/spec/java/src/io/kaitai/struct/spec/TestBitsUnalignedB32Le.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestBitsUnalignedB32Le extends CommonSpec { - @Test public void testBitsUnalignedB32Le() throws Exception { BitsUnalignedB32Le r = BitsUnalignedB32Le.fromFile(SRC_DIR + "process_xor_4.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestBitsUnalignedB64Be.java b/spec/java/src/io/kaitai/struct/spec/TestBitsUnalignedB64Be.java index b9c9d59d5..1c6326a52 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestBitsUnalignedB64Be.java +++ b/spec/java/src/io/kaitai/struct/spec/TestBitsUnalignedB64Be.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestBitsUnalignedB64Be extends CommonSpec { - @Test public void testBitsUnalignedB64Be() throws Exception { BitsUnalignedB64Be r = BitsUnalignedB64Be.fromFile(SRC_DIR + "process_xor_4.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestBitsUnalignedB64Le.java b/spec/java/src/io/kaitai/struct/spec/TestBitsUnalignedB64Le.java index cdf472b9e..beb096a33 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestBitsUnalignedB64Le.java +++ b/spec/java/src/io/kaitai/struct/spec/TestBitsUnalignedB64Le.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestBitsUnalignedB64Le extends CommonSpec { - @Test public void testBitsUnalignedB64Le() throws Exception { BitsUnalignedB64Le r = BitsUnalignedB64Le.fromFile(SRC_DIR + "process_xor_4.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestBytesEosPadTerm.java b/spec/java/src/io/kaitai/struct/spec/TestBytesEosPadTerm.java index 2f7871d72..902b5958b 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestBytesEosPadTerm.java +++ b/spec/java/src/io/kaitai/struct/spec/TestBytesEosPadTerm.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestBytesEosPadTerm extends CommonSpec { - @Test public void testBytesEosPadTerm() throws Exception { BytesEosPadTerm r = BytesEosPadTerm.fromFile(SRC_DIR + "str_pad_term.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestBytesPadTermEmpty.java b/spec/java/src/io/kaitai/struct/spec/TestBytesPadTermEmpty.java index 651a248e3..7ce01e40b 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestBytesPadTermEmpty.java +++ b/spec/java/src/io/kaitai/struct/spec/TestBytesPadTermEmpty.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestBytesPadTermEmpty extends CommonSpec { - @Test public void testBytesPadTermEmpty() throws Exception { BytesPadTermEmpty r = BytesPadTermEmpty.fromFile(SRC_DIR + "str_pad_term_empty.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestBytesPadTermEqual.java b/spec/java/src/io/kaitai/struct/spec/TestBytesPadTermEqual.java index 9505fe90e..007d4d789 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestBytesPadTermEqual.java +++ b/spec/java/src/io/kaitai/struct/spec/TestBytesPadTermEqual.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestBytesPadTermEqual extends CommonSpec { - @Test public void testBytesPadTermEqual() throws Exception { BytesPadTermEqual r = BytesPadTermEqual.fromFile(SRC_DIR + "str_pad_term.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestBytesPadTermRoundtrip.java b/spec/java/src/io/kaitai/struct/spec/TestBytesPadTermRoundtrip.java index c81831389..6c057fbc9 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestBytesPadTermRoundtrip.java +++ b/spec/java/src/io/kaitai/struct/spec/TestBytesPadTermRoundtrip.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestBytesPadTermRoundtrip extends CommonSpec { - @Test public void testBytesPadTermRoundtrip() throws Exception { BytesPadTermRoundtrip r = BytesPadTermRoundtrip.fromFile(SRC_DIR + "str_pad_term.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestBytesPadTermZeroSize.java b/spec/java/src/io/kaitai/struct/spec/TestBytesPadTermZeroSize.java index 8404d6040..c37f2c7b0 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestBytesPadTermZeroSize.java +++ b/spec/java/src/io/kaitai/struct/spec/TestBytesPadTermZeroSize.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestBytesPadTermZeroSize extends CommonSpec { - @Test public void testBytesPadTermZeroSize() throws Exception { BytesPadTermZeroSize r = BytesPadTermZeroSize.fromFile(SRC_DIR + "enum_negative.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestCastToImported.java b/spec/java/src/io/kaitai/struct/spec/TestCastToImported.java index 6eb504928..1939365f5 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestCastToImported.java +++ b/spec/java/src/io/kaitai/struct/spec/TestCastToImported.java @@ -3,6 +3,7 @@ package io.kaitai.struct.spec; import io.kaitai.struct.testformats.CastToImported; +import io.kaitai.struct.testformats.HelloWorld; import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestCastToImported extends CommonSpec { diff --git a/spec/java/src/io/kaitai/struct/spec/TestCombineBool.java b/spec/java/src/io/kaitai/struct/spec/TestCombineBool.java index 9eb589174..5c772a259 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestCombineBool.java +++ b/spec/java/src/io/kaitai/struct/spec/TestCombineBool.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestCombineBool extends CommonSpec { - @Test public void testCombineBool() throws Exception { CombineBool r = CombineBool.fromFile(SRC_DIR + "enum_negative.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestCombineBytes.java b/spec/java/src/io/kaitai/struct/spec/TestCombineBytes.java index 8ceafb342..5441fa4fb 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestCombineBytes.java +++ b/spec/java/src/io/kaitai/struct/spec/TestCombineBytes.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestCombineBytes extends CommonSpec { - @Test public void testCombineBytes() throws Exception { CombineBytes r = CombineBytes.fromFile(SRC_DIR + "term_strz.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestCombineEnum.java b/spec/java/src/io/kaitai/struct/spec/TestCombineEnum.java index 2897d9657..69d6b29f6 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestCombineEnum.java +++ b/spec/java/src/io/kaitai/struct/spec/TestCombineEnum.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestCombineEnum extends CommonSpec { - @Test public void testCombineEnum() throws Exception { CombineEnum r = CombineEnum.fromFile(SRC_DIR + "enum_0.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestCombineStr.java b/spec/java/src/io/kaitai/struct/spec/TestCombineStr.java index d410693d4..4c1188e1e 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestCombineStr.java +++ b/spec/java/src/io/kaitai/struct/spec/TestCombineStr.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestCombineStr extends CommonSpec { - @Test public void testCombineStr() throws Exception { CombineStr r = CombineStr.fromFile(SRC_DIR + "term_strz.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestDefaultBitEndianMod.java b/spec/java/src/io/kaitai/struct/spec/TestDefaultBitEndianMod.java index 815538113..fbae2199b 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestDefaultBitEndianMod.java +++ b/spec/java/src/io/kaitai/struct/spec/TestDefaultBitEndianMod.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestDefaultBitEndianMod extends CommonSpec { - @Test public void testDefaultBitEndianMod() throws Exception { DefaultBitEndianMod r = DefaultBitEndianMod.fromFile(SRC_DIR + "fixed_struct.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestDefaultEndianExprException.java b/spec/java/src/io/kaitai/struct/spec/TestDefaultEndianExprException.java index ed40b184e..07a8a269c 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestDefaultEndianExprException.java +++ b/spec/java/src/io/kaitai/struct/spec/TestDefaultEndianExprException.java @@ -7,7 +7,6 @@ import static org.testng.Assert.*; import io.kaitai.struct.KaitaiStream; public class TestDefaultEndianExprException extends CommonSpec { - @Test(expectedExceptions = KaitaiStream.UndecidedEndiannessError.class) public void testDefaultEndianExprException() throws Exception { DefaultEndianExprException r = DefaultEndianExprException.fromFile(SRC_DIR + "endian_expr.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestDefaultEndianExprInherited.java b/spec/java/src/io/kaitai/struct/spec/TestDefaultEndianExprInherited.java index 8864c52f5..fb8d05fea 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestDefaultEndianExprInherited.java +++ b/spec/java/src/io/kaitai/struct/spec/TestDefaultEndianExprInherited.java @@ -10,20 +10,20 @@ public class TestDefaultEndianExprInherited extends CommonSpec { public void testDefaultEndianExprInherited() throws Exception { DefaultEndianExprInherited r = DefaultEndianExprInherited.fromFile(SRC_DIR + "endian_expr.bin"); - assertEquals(r.docs().get((int) 0).indicator(), new byte[] { 73, 73 }); - assertIntEquals(r.docs().get((int) 0).main().insides().someInt(), 66); - assertIntEquals(r.docs().get((int) 0).main().insides().more().someInt1(), 16896); - assertIntEquals(r.docs().get((int) 0).main().insides().more().someInt2(), 66); - assertIntEquals(r.docs().get((int) 0).main().insides().more().someInst(), 66); - assertEquals(r.docs().get((int) 1).indicator(), new byte[] { 77, 77 }); - assertIntEquals(r.docs().get((int) 1).main().insides().someInt(), 66); - assertIntEquals(r.docs().get((int) 1).main().insides().more().someInt1(), 66); - assertIntEquals(r.docs().get((int) 1).main().insides().more().someInt2(), 16896); - assertIntEquals(r.docs().get((int) 1).main().insides().more().someInst(), 1107296256); - assertEquals(r.docs().get((int) 2).indicator(), new byte[] { 88, 88 }); - assertIntEquals(r.docs().get((int) 2).main().insides().someInt(), 66); - assertIntEquals(r.docs().get((int) 2).main().insides().more().someInt1(), 66); - assertIntEquals(r.docs().get((int) 2).main().insides().more().someInt2(), 16896); - assertIntEquals(r.docs().get((int) 2).main().insides().more().someInst(), 1107296256); + assertEquals(r.docs().get(((int) 0)).indicator(), new byte[] { 73, 73 }); + assertIntEquals(r.docs().get(((int) 0)).main().insides().someInt(), 66); + assertIntEquals(r.docs().get(((int) 0)).main().insides().more().someInt1(), 16896); + assertIntEquals(r.docs().get(((int) 0)).main().insides().more().someInt2(), 66); + assertIntEquals(r.docs().get(((int) 0)).main().insides().more().someInst(), 66); + assertEquals(r.docs().get(((int) 1)).indicator(), new byte[] { 77, 77 }); + assertIntEquals(r.docs().get(((int) 1)).main().insides().someInt(), 66); + assertIntEquals(r.docs().get(((int) 1)).main().insides().more().someInt1(), 66); + assertIntEquals(r.docs().get(((int) 1)).main().insides().more().someInt2(), 16896); + assertIntEquals(r.docs().get(((int) 1)).main().insides().more().someInst(), 1107296256); + assertEquals(r.docs().get(((int) 2)).indicator(), new byte[] { 88, 88 }); + assertIntEquals(r.docs().get(((int) 2)).main().insides().someInt(), 66); + assertIntEquals(r.docs().get(((int) 2)).main().insides().more().someInt1(), 66); + assertIntEquals(r.docs().get(((int) 2)).main().insides().more().someInt2(), 16896); + assertIntEquals(r.docs().get(((int) 2)).main().insides().more().someInst(), 1107296256); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestDefaultEndianExprIsBe.java b/spec/java/src/io/kaitai/struct/spec/TestDefaultEndianExprIsBe.java index f66990164..32b841630 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestDefaultEndianExprIsBe.java +++ b/spec/java/src/io/kaitai/struct/spec/TestDefaultEndianExprIsBe.java @@ -10,23 +10,23 @@ public class TestDefaultEndianExprIsBe extends CommonSpec { public void testDefaultEndianExprIsBe() throws Exception { DefaultEndianExprIsBe r = DefaultEndianExprIsBe.fromFile(SRC_DIR + "endian_expr.bin"); - assertEquals(r.docs().get((int) 0).indicator(), new byte[] { 73, 73 }); - assertIntEquals(r.docs().get((int) 0).main().someInt(), 66); - assertIntEquals(r.docs().get((int) 0).main().someIntBe(), 66); - assertIntEquals(r.docs().get((int) 0).main().someIntLe(), 66); - assertIntEquals(r.docs().get((int) 0).main().instInt(), 66); - assertIntEquals(r.docs().get((int) 0).main().instSub().foo(), 66); - assertEquals(r.docs().get((int) 1).indicator(), new byte[] { 77, 77 }); - assertIntEquals(r.docs().get((int) 1).main().someInt(), 66); - assertIntEquals(r.docs().get((int) 1).main().someIntBe(), 66); - assertIntEquals(r.docs().get((int) 1).main().someIntLe(), 66); - assertIntEquals(r.docs().get((int) 1).main().instInt(), 1107296256); - assertIntEquals(r.docs().get((int) 1).main().instSub().foo(), 1107296256); - assertEquals(r.docs().get((int) 2).indicator(), new byte[] { 88, 88 }); - assertIntEquals(r.docs().get((int) 2).main().someInt(), 1107296256); - assertIntEquals(r.docs().get((int) 2).main().someIntBe(), 66); - assertIntEquals(r.docs().get((int) 2).main().someIntLe(), 66); - assertIntEquals(r.docs().get((int) 2).main().instInt(), 66); - assertIntEquals(r.docs().get((int) 2).main().instSub().foo(), 66); + assertEquals(r.docs().get(((int) 0)).indicator(), new byte[] { 73, 73 }); + assertIntEquals(r.docs().get(((int) 0)).main().someInt(), 66); + assertIntEquals(r.docs().get(((int) 0)).main().someIntBe(), 66); + assertIntEquals(r.docs().get(((int) 0)).main().someIntLe(), 66); + assertIntEquals(r.docs().get(((int) 0)).main().instInt(), 66); + assertIntEquals(r.docs().get(((int) 0)).main().instSub().foo(), 66); + assertEquals(r.docs().get(((int) 1)).indicator(), new byte[] { 77, 77 }); + assertIntEquals(r.docs().get(((int) 1)).main().someInt(), 66); + assertIntEquals(r.docs().get(((int) 1)).main().someIntBe(), 66); + assertIntEquals(r.docs().get(((int) 1)).main().someIntLe(), 66); + assertIntEquals(r.docs().get(((int) 1)).main().instInt(), 1107296256); + assertIntEquals(r.docs().get(((int) 1)).main().instSub().foo(), 1107296256); + assertEquals(r.docs().get(((int) 2)).indicator(), new byte[] { 88, 88 }); + assertIntEquals(r.docs().get(((int) 2)).main().someInt(), 1107296256); + assertIntEquals(r.docs().get(((int) 2)).main().someIntBe(), 66); + assertIntEquals(r.docs().get(((int) 2)).main().someIntLe(), 66); + assertIntEquals(r.docs().get(((int) 2)).main().instInt(), 66); + assertIntEquals(r.docs().get(((int) 2)).main().instSub().foo(), 66); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestDefaultEndianExprIsLe.java b/spec/java/src/io/kaitai/struct/spec/TestDefaultEndianExprIsLe.java index 6d5bc6ac0..c0f8fb52c 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestDefaultEndianExprIsLe.java +++ b/spec/java/src/io/kaitai/struct/spec/TestDefaultEndianExprIsLe.java @@ -10,17 +10,17 @@ public class TestDefaultEndianExprIsLe extends CommonSpec { public void testDefaultEndianExprIsLe() throws Exception { DefaultEndianExprIsLe r = DefaultEndianExprIsLe.fromFile(SRC_DIR + "endian_expr.bin"); - assertEquals(r.docs().get((int) 0).indicator(), new byte[] { 73, 73 }); - assertIntEquals(r.docs().get((int) 0).main().someInt(), 66); - assertIntEquals(r.docs().get((int) 0).main().someIntBe(), 66); - assertIntEquals(r.docs().get((int) 0).main().someIntLe(), 66); - assertEquals(r.docs().get((int) 1).indicator(), new byte[] { 77, 77 }); - assertIntEquals(r.docs().get((int) 1).main().someInt(), 66); - assertIntEquals(r.docs().get((int) 1).main().someIntBe(), 66); - assertIntEquals(r.docs().get((int) 1).main().someIntLe(), 66); - assertEquals(r.docs().get((int) 2).indicator(), new byte[] { 88, 88 }); - assertIntEquals(r.docs().get((int) 2).main().someInt(), 66); - assertIntEquals(r.docs().get((int) 2).main().someIntBe(), 66); - assertIntEquals(r.docs().get((int) 2).main().someIntLe(), 66); + assertEquals(r.docs().get(((int) 0)).indicator(), new byte[] { 73, 73 }); + assertIntEquals(r.docs().get(((int) 0)).main().someInt(), 66); + assertIntEquals(r.docs().get(((int) 0)).main().someIntBe(), 66); + assertIntEquals(r.docs().get(((int) 0)).main().someIntLe(), 66); + assertEquals(r.docs().get(((int) 1)).indicator(), new byte[] { 77, 77 }); + assertIntEquals(r.docs().get(((int) 1)).main().someInt(), 66); + assertIntEquals(r.docs().get(((int) 1)).main().someIntBe(), 66); + assertIntEquals(r.docs().get(((int) 1)).main().someIntLe(), 66); + assertEquals(r.docs().get(((int) 2)).indicator(), new byte[] { 88, 88 }); + assertIntEquals(r.docs().get(((int) 2)).main().someInt(), 66); + assertIntEquals(r.docs().get(((int) 2)).main().someIntBe(), 66); + assertIntEquals(r.docs().get(((int) 2)).main().someIntLe(), 66); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestEnumImport.java b/spec/java/src/io/kaitai/struct/spec/TestEnumImport.java index e951fa7e7..046484baf 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestEnumImport.java +++ b/spec/java/src/io/kaitai/struct/spec/TestEnumImport.java @@ -8,7 +8,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestEnumImport extends CommonSpec { - @Test public void testEnumImport() throws Exception { EnumImport r = EnumImport.fromFile(SRC_DIR + "enum_0.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestEnumIntRangeS.java b/spec/java/src/io/kaitai/struct/spec/TestEnumIntRangeS.java index 61774cdf6..48afc60f7 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestEnumIntRangeS.java +++ b/spec/java/src/io/kaitai/struct/spec/TestEnumIntRangeS.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestEnumIntRangeS extends CommonSpec { - @Test public void testEnumIntRangeS() throws Exception { EnumIntRangeS r = EnumIntRangeS.fromFile(SRC_DIR + "enum_int_range_s.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestEnumIntRangeU.java b/spec/java/src/io/kaitai/struct/spec/TestEnumIntRangeU.java index 1b3763305..b3c5e8e9b 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestEnumIntRangeU.java +++ b/spec/java/src/io/kaitai/struct/spec/TestEnumIntRangeU.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestEnumIntRangeU extends CommonSpec { - @Test public void testEnumIntRangeU() throws Exception { EnumIntRangeU r = EnumIntRangeU.fromFile(SRC_DIR + "enum_int_range_u.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestEnumLongRangeS.java b/spec/java/src/io/kaitai/struct/spec/TestEnumLongRangeS.java index 4fc878a83..ef7c75c0c 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestEnumLongRangeS.java +++ b/spec/java/src/io/kaitai/struct/spec/TestEnumLongRangeS.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestEnumLongRangeS extends CommonSpec { - @Test public void testEnumLongRangeS() throws Exception { EnumLongRangeS r = EnumLongRangeS.fromFile(SRC_DIR + "enum_long_range_s.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestEnumLongRangeU.java b/spec/java/src/io/kaitai/struct/spec/TestEnumLongRangeU.java index 18ed3a609..cbfa77711 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestEnumLongRangeU.java +++ b/spec/java/src/io/kaitai/struct/spec/TestEnumLongRangeU.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestEnumLongRangeU extends CommonSpec { - @Test public void testEnumLongRangeU() throws Exception { EnumLongRangeU r = EnumLongRangeU.fromFile(SRC_DIR + "enum_long_range_u.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestEnumToI.java b/spec/java/src/io/kaitai/struct/spec/TestEnumToI.java index db23aa1a7..3e07c92a1 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestEnumToI.java +++ b/spec/java/src/io/kaitai/struct/spec/TestEnumToI.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestEnumToI extends CommonSpec { - @Test public void testEnumToI() throws Exception { EnumToI r = EnumToI.fromFile(SRC_DIR + "enum_0.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestEnumToIClassBorder1.java b/spec/java/src/io/kaitai/struct/spec/TestEnumToIClassBorder1.java index 39d5b7fbc..fc7e88c78 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestEnumToIClassBorder1.java +++ b/spec/java/src/io/kaitai/struct/spec/TestEnumToIClassBorder1.java @@ -3,10 +3,10 @@ package io.kaitai.struct.spec; import io.kaitai.struct.testformats.EnumToIClassBorder1; +import io.kaitai.struct.testformats.EnumToIClassBorder2; import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestEnumToIClassBorder1 extends CommonSpec { - @Test public void testEnumToIClassBorder1() throws Exception { EnumToIClassBorder1 r = EnumToIClassBorder1.fromFile(SRC_DIR + "enum_0.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestEofExceptionBytes.java b/spec/java/src/io/kaitai/struct/spec/TestEofExceptionBytes.java index f3c8cebac..fa8eb534b 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestEofExceptionBytes.java +++ b/spec/java/src/io/kaitai/struct/spec/TestEofExceptionBytes.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestEofExceptionBytes extends CommonSpec { - @Test public void testEofExceptionBytes() throws Exception { assertThrowsEofError(new ThrowingRunnable() { diff --git a/spec/java/src/io/kaitai/struct/spec/TestEofExceptionU4.java b/spec/java/src/io/kaitai/struct/spec/TestEofExceptionU4.java index ec0986d64..f81203eb4 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestEofExceptionU4.java +++ b/spec/java/src/io/kaitai/struct/spec/TestEofExceptionU4.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestEofExceptionU4 extends CommonSpec { - @Test public void testEofExceptionU4() throws Exception { assertThrowsEofError(new ThrowingRunnable() { diff --git a/spec/java/src/io/kaitai/struct/spec/TestEosExceptionBytes.java b/spec/java/src/io/kaitai/struct/spec/TestEosExceptionBytes.java index 2a4a2d67d..1f46bd392 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestEosExceptionBytes.java +++ b/spec/java/src/io/kaitai/struct/spec/TestEosExceptionBytes.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestEosExceptionBytes extends CommonSpec { - @Test public void testEosExceptionBytes() throws Exception { assertThrowsEofError(new ThrowingRunnable() { diff --git a/spec/java/src/io/kaitai/struct/spec/TestEosExceptionU4.java b/spec/java/src/io/kaitai/struct/spec/TestEosExceptionU4.java index ba0cc8160..8472609d7 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestEosExceptionU4.java +++ b/spec/java/src/io/kaitai/struct/spec/TestEosExceptionU4.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestEosExceptionU4 extends CommonSpec { - @Test public void testEosExceptionU4() throws Exception { assertThrowsEofError(new ThrowingRunnable() { diff --git a/spec/java/src/io/kaitai/struct/spec/TestExprBits.java b/spec/java/src/io/kaitai/struct/spec/TestExprBits.java index 46dcbb1e5..2c0a56190 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestExprBits.java +++ b/spec/java/src/io/kaitai/struct/spec/TestExprBits.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestExprBits extends CommonSpec { - @Test public void testExprBits() throws Exception { ExprBits r = ExprBits.fromFile(SRC_DIR + "switch_opcodes.bin"); @@ -15,8 +14,8 @@ public void testExprBits() throws Exception { assertEquals(r.enumSeq(), ExprBits.Items.FOO); assertEquals(r.byteSize(), new byte[] { 102, 111 }); assertIntEquals(r.repeatExpr().size(), 2); - assertIntEquals(r.repeatExpr().get((int) 0), 111); - assertIntEquals(r.repeatExpr().get((int) 1), 98); + assertIntEquals(r.repeatExpr().get(((int) 0)), 111); + assertIntEquals(r.repeatExpr().get(((int) 1)), 98); assertIntEquals(r.switchOnType(), 97); assertIntEquals(r.switchOnEndian().foo(), 29184); assertEquals(r.enumInst(), ExprBits.Items.BAR); diff --git a/spec/java/src/io/kaitai/struct/spec/TestExprBytesNonLiteral.java b/spec/java/src/io/kaitai/struct/spec/TestExprBytesNonLiteral.java index 199a69ba2..3cebb9e86 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestExprBytesNonLiteral.java +++ b/spec/java/src/io/kaitai/struct/spec/TestExprBytesNonLiteral.java @@ -6,13 +6,12 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestExprBytesNonLiteral extends CommonSpec { - @Test public void testExprBytesNonLiteral() throws Exception { ExprBytesNonLiteral r = ExprBytesNonLiteral.fromFile(SRC_DIR + "enum_negative.bin"); assertIntEquals(r.calcBytes().length, 2); - assertIntEquals(r.calcBytes()[0], 255); - assertIntEquals(r.calcBytes()[1], 1); + assertIntEquals((r.calcBytes()[((int) 0)] & 0xff), 255); + assertIntEquals((r.calcBytes()[((int) 1)] & 0xff), 1); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestExprBytesOps.java b/spec/java/src/io/kaitai/struct/spec/TestExprBytesOps.java index f78e30104..7a6fa1080 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestExprBytesOps.java +++ b/spec/java/src/io/kaitai/struct/spec/TestExprBytesOps.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestExprBytesOps extends CommonSpec { - @Test public void testExprBytesOps() throws Exception { ExprBytesOps r = ExprBytesOps.fromFile(SRC_DIR + "nav_parent_switch.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestExprCalcArrayOps.java b/spec/java/src/io/kaitai/struct/spec/TestExprCalcArrayOps.java index ebaf108cb..601a18a40 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestExprCalcArrayOps.java +++ b/spec/java/src/io/kaitai/struct/spec/TestExprCalcArrayOps.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestExprCalcArrayOps extends CommonSpec { - @Test public void testExprCalcArrayOps() throws Exception { ExprCalcArrayOps r = ExprCalcArrayOps.fromFile(SRC_DIR + "fixed_struct.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestExprIfIntEq.java b/spec/java/src/io/kaitai/struct/spec/TestExprIfIntEq.java index 123f8d018..3a9aa8490 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestExprIfIntEq.java +++ b/spec/java/src/io/kaitai/struct/spec/TestExprIfIntEq.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestExprIfIntEq extends CommonSpec { - @Test public void testExprIfIntEq() throws Exception { ExprIfIntEq r = ExprIfIntEq.fromFile(SRC_DIR + "process_coerce_switch.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestExprIfIntOps.java b/spec/java/src/io/kaitai/struct/spec/TestExprIfIntOps.java index 730266e7a..c7704d04c 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestExprIfIntOps.java +++ b/spec/java/src/io/kaitai/struct/spec/TestExprIfIntOps.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestExprIfIntOps extends CommonSpec { - @Test public void testExprIfIntOps() throws Exception { ExprIfIntOps r = ExprIfIntOps.fromFile(SRC_DIR + "instance_io.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestExprIntDiv.java b/spec/java/src/io/kaitai/struct/spec/TestExprIntDiv.java index 4cdf0869b..d4cd0de4f 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestExprIntDiv.java +++ b/spec/java/src/io/kaitai/struct/spec/TestExprIntDiv.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestExprIntDiv extends CommonSpec { - @Test public void testExprIntDiv() throws Exception { ExprIntDiv r = ExprIntDiv.fromFile(SRC_DIR + "fixed_struct.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestExprIoEof.java b/spec/java/src/io/kaitai/struct/spec/TestExprIoEof.java index 9611e0c04..8aba83d79 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestExprIoEof.java +++ b/spec/java/src/io/kaitai/struct/spec/TestExprIoEof.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestExprIoEof extends CommonSpec { - @Test public void testExprIoEof() throws Exception { ExprIoEof r = ExprIoEof.fromFile(SRC_DIR + "fixed_struct.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestExprIoPosBits.java b/spec/java/src/io/kaitai/struct/spec/TestExprIoPosBits.java index cf1507e99..8db9a49d5 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestExprIoPosBits.java +++ b/spec/java/src/io/kaitai/struct/spec/TestExprIoPosBits.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestExprIoPosBits extends CommonSpec { - @Test public void testExprIoPosBits() throws Exception { ExprIoPosBits r = ExprIoPosBits.fromFile(SRC_DIR + "process_xor_4.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestExprOpsParens.java b/spec/java/src/io/kaitai/struct/spec/TestExprOpsParens.java index 4b22783b2..59327d3fd 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestExprOpsParens.java +++ b/spec/java/src/io/kaitai/struct/spec/TestExprOpsParens.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestExprOpsParens extends CommonSpec { - @Test public void testExprOpsParens() throws Exception { ExprOpsParens r = ExprOpsParens.fromFile(SRC_DIR + "enum_negative.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestExprStrEncodings.java b/spec/java/src/io/kaitai/struct/spec/TestExprStrEncodings.java index 188992663..d0e8dbcb4 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestExprStrEncodings.java +++ b/spec/java/src/io/kaitai/struct/spec/TestExprStrEncodings.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestExprStrEncodings extends CommonSpec { - @Test public void testExprStrEncodings() throws Exception { ExprStrEncodings r = ExprStrEncodings.fromFile(SRC_DIR + "str_encodings.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestExprStrOps.java b/spec/java/src/io/kaitai/struct/spec/TestExprStrOps.java index d77a22642..a2ddbb9f7 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestExprStrOps.java +++ b/spec/java/src/io/kaitai/struct/spec/TestExprStrOps.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestExprStrOps extends CommonSpec { - @Test public void testExprStrOps() throws Exception { ExprStrOps r = ExprStrOps.fromFile(SRC_DIR + "term_strz.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestFloatToI.java b/spec/java/src/io/kaitai/struct/spec/TestFloatToI.java index 4749e9a9b..f1759de43 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestFloatToI.java +++ b/spec/java/src/io/kaitai/struct/spec/TestFloatToI.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestFloatToI extends CommonSpec { - @Test public void testFloatToI() throws Exception { FloatToI r = FloatToI.fromFile(SRC_DIR + "floating_points.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestFloatingPoints.java b/spec/java/src/io/kaitai/struct/spec/TestFloatingPoints.java index 63ff90f05..dba9ef963 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestFloatingPoints.java +++ b/spec/java/src/io/kaitai/struct/spec/TestFloatingPoints.java @@ -10,8 +10,8 @@ public class TestFloatingPoints extends CommonSpec { public void testFloatingPoints() throws Exception { FloatingPoints r = FloatingPoints.fromFile(SRC_DIR + "floating_points.bin"); - assertEquals(r.singleValue(), ((float) (0.5)), 1e-6); - assertEquals(r.singleValueBe(), ((float) (0.5)), 1e-6); + assertEquals(r.singleValue(), ((float) 0.5), 1e-6); + assertEquals(r.singleValueBe(), ((float) 0.5), 1e-6); assertEquals(r.doubleValue(), 0.25, 1e-6); assertEquals(r.doubleValueBe(), 0.25, 1e-6); assertEquals(r.approximateValue(), 1.2345, 1e-6); diff --git a/spec/java/src/io/kaitai/struct/spec/TestIfValues.java b/spec/java/src/io/kaitai/struct/spec/TestIfValues.java index e3528d5bb..03340e78b 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestIfValues.java +++ b/spec/java/src/io/kaitai/struct/spec/TestIfValues.java @@ -10,11 +10,11 @@ public class TestIfValues extends CommonSpec { public void testIfValues() throws Exception { IfValues r = IfValues.fromFile(SRC_DIR + "fixed_struct.bin"); - assertIntEquals(r.codes().get((int) 0).opcode(), 80); - assertIntEquals(r.codes().get((int) 0).halfOpcode(), 40); - assertIntEquals(r.codes().get((int) 1).opcode(), 65); - assertNull(r.codes().get((int) 1).halfOpcode()); - assertIntEquals(r.codes().get((int) 2).opcode(), 67); - assertNull(r.codes().get((int) 2).halfOpcode()); + assertIntEquals(r.codes().get(((int) 0)).opcode(), 80); + assertIntEquals(r.codes().get(((int) 0)).halfOpcode(), 40); + assertIntEquals(r.codes().get(((int) 1)).opcode(), 65); + assertNull(r.codes().get(((int) 1)).halfOpcode()); + assertIntEquals(r.codes().get(((int) 2)).opcode(), 67); + assertNull(r.codes().get(((int) 2)).halfOpcode()); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestImports0.java b/spec/java/src/io/kaitai/struct/spec/TestImports0.java index 3114ebe33..1f95bed8f 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestImports0.java +++ b/spec/java/src/io/kaitai/struct/spec/TestImports0.java @@ -3,6 +3,7 @@ package io.kaitai.struct.spec; import io.kaitai.struct.testformats.Imports0; +import io.kaitai.struct.testformats.HelloWorld; import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestImports0 extends CommonSpec { diff --git a/spec/java/src/io/kaitai/struct/spec/TestImportsAbs.java b/spec/java/src/io/kaitai/struct/spec/TestImportsAbs.java index 6c4bfb982..5e13d8fe8 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestImportsAbs.java +++ b/spec/java/src/io/kaitai/struct/spec/TestImportsAbs.java @@ -3,6 +3,7 @@ package io.kaitai.struct.spec; import io.kaitai.struct.testformats.ImportsAbs; +import io.kaitai.struct.testformats.VlqBase128Le; import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestImportsAbs extends CommonSpec { diff --git a/spec/java/src/io/kaitai/struct/spec/TestImportsCircularA.java b/spec/java/src/io/kaitai/struct/spec/TestImportsCircularA.java index 28e75b361..84f2e290c 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestImportsCircularA.java +++ b/spec/java/src/io/kaitai/struct/spec/TestImportsCircularA.java @@ -7,7 +7,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestImportsCircularA extends CommonSpec { - @Test public void testImportsCircularA() throws Exception { ImportsCircularA r = ImportsCircularA.fromFile(SRC_DIR + "fixed_struct.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestImportsRel1.java b/spec/java/src/io/kaitai/struct/spec/TestImportsRel1.java index e4d2d8f90..27bede29f 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestImportsRel1.java +++ b/spec/java/src/io/kaitai/struct/spec/TestImportsRel1.java @@ -8,7 +8,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestImportsRel1 extends CommonSpec { - @Test public void testImportsRel1() throws Exception { ImportsRel1 r = ImportsRel1.fromFile(SRC_DIR + "fixed_struct.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestIndexSizes.java b/spec/java/src/io/kaitai/struct/spec/TestIndexSizes.java index f1995d9ee..200ea67e6 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestIndexSizes.java +++ b/spec/java/src/io/kaitai/struct/spec/TestIndexSizes.java @@ -11,11 +11,11 @@ public void testIndexSizes() throws Exception { IndexSizes r = IndexSizes.fromFile(SRC_DIR + "index_sizes.bin"); assertIntEquals(r.qty(), 3); - assertIntEquals(r.sizes().get((int) 0), 1); - assertIntEquals(r.sizes().get((int) 1), 8); - assertIntEquals(r.sizes().get((int) 2), 4); - assertEquals(r.bufs().get((int) 0), "A"); - assertEquals(r.bufs().get((int) 1), "BBBBBBBB"); - assertEquals(r.bufs().get((int) 2), "CCCC"); + assertIntEquals(r.sizes().get(((int) 0)), 1); + assertIntEquals(r.sizes().get(((int) 1)), 8); + assertIntEquals(r.sizes().get(((int) 2)), 4); + assertEquals(r.bufs().get(((int) 0)), "A"); + assertEquals(r.bufs().get(((int) 1)), "BBBBBBBB"); + assertEquals(r.bufs().get(((int) 2)), "CCCC"); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestIndexToParamEos.java b/spec/java/src/io/kaitai/struct/spec/TestIndexToParamEos.java index 8d7d9743a..d9af23c77 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestIndexToParamEos.java +++ b/spec/java/src/io/kaitai/struct/spec/TestIndexToParamEos.java @@ -11,11 +11,11 @@ public void testIndexToParamEos() throws Exception { IndexToParamEos r = IndexToParamEos.fromFile(SRC_DIR + "index_sizes.bin"); assertIntEquals(r.qty(), 3); - assertIntEquals(r.sizes().get((int) 0), 1); - assertIntEquals(r.sizes().get((int) 1), 8); - assertIntEquals(r.sizes().get((int) 2), 4); - assertEquals(r.blocks().get((int) 0).buf(), "A"); - assertEquals(r.blocks().get((int) 1).buf(), "BBBBBBBB"); - assertEquals(r.blocks().get((int) 2).buf(), "CCCC"); + assertIntEquals(r.sizes().get(((int) 0)), 1); + assertIntEquals(r.sizes().get(((int) 1)), 8); + assertIntEquals(r.sizes().get(((int) 2)), 4); + assertEquals(r.blocks().get(((int) 0)).buf(), "A"); + assertEquals(r.blocks().get(((int) 1)).buf(), "BBBBBBBB"); + assertEquals(r.blocks().get(((int) 2)).buf(), "CCCC"); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestIndexToParamExpr.java b/spec/java/src/io/kaitai/struct/spec/TestIndexToParamExpr.java index d7d2c859e..895afcdae 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestIndexToParamExpr.java +++ b/spec/java/src/io/kaitai/struct/spec/TestIndexToParamExpr.java @@ -11,11 +11,11 @@ public void testIndexToParamExpr() throws Exception { IndexToParamExpr r = IndexToParamExpr.fromFile(SRC_DIR + "index_sizes.bin"); assertIntEquals(r.qty(), 3); - assertIntEquals(r.sizes().get((int) 0), 1); - assertIntEquals(r.sizes().get((int) 1), 8); - assertIntEquals(r.sizes().get((int) 2), 4); - assertEquals(r.blocks().get((int) 0).buf(), "A"); - assertEquals(r.blocks().get((int) 1).buf(), "BBBBBBBB"); - assertEquals(r.blocks().get((int) 2).buf(), "CCCC"); + assertIntEquals(r.sizes().get(((int) 0)), 1); + assertIntEquals(r.sizes().get(((int) 1)), 8); + assertIntEquals(r.sizes().get(((int) 2)), 4); + assertEquals(r.blocks().get(((int) 0)).buf(), "A"); + assertEquals(r.blocks().get(((int) 1)).buf(), "BBBBBBBB"); + assertEquals(r.blocks().get(((int) 2)).buf(), "CCCC"); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestIndexToParamUntil.java b/spec/java/src/io/kaitai/struct/spec/TestIndexToParamUntil.java index e38a7567a..8fd556662 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestIndexToParamUntil.java +++ b/spec/java/src/io/kaitai/struct/spec/TestIndexToParamUntil.java @@ -11,11 +11,11 @@ public void testIndexToParamUntil() throws Exception { IndexToParamUntil r = IndexToParamUntil.fromFile(SRC_DIR + "index_sizes.bin"); assertIntEquals(r.qty(), 3); - assertIntEquals(r.sizes().get((int) 0), 1); - assertIntEquals(r.sizes().get((int) 1), 8); - assertIntEquals(r.sizes().get((int) 2), 4); - assertEquals(r.blocks().get((int) 0).buf(), "A"); - assertEquals(r.blocks().get((int) 1).buf(), "BBBBBBBB"); - assertEquals(r.blocks().get((int) 2).buf(), "CCCC"); + assertIntEquals(r.sizes().get(((int) 0)), 1); + assertIntEquals(r.sizes().get(((int) 1)), 8); + assertIntEquals(r.sizes().get(((int) 2)), 4); + assertEquals(r.blocks().get(((int) 0)).buf(), "A"); + assertEquals(r.blocks().get(((int) 1)).buf(), "BBBBBBBB"); + assertEquals(r.blocks().get(((int) 2)).buf(), "CCCC"); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestInstanceInRepeatExpr.java b/spec/java/src/io/kaitai/struct/spec/TestInstanceInRepeatExpr.java index e92eca8e8..4f88b5f6e 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestInstanceInRepeatExpr.java +++ b/spec/java/src/io/kaitai/struct/spec/TestInstanceInRepeatExpr.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestInstanceInRepeatExpr extends CommonSpec { - @Test public void testInstanceInRepeatExpr() throws Exception { InstanceInRepeatExpr r = InstanceInRepeatExpr.fromFile(SRC_DIR + "instance_in_repeat_expr.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestInstanceInRepeatUntil.java b/spec/java/src/io/kaitai/struct/spec/TestInstanceInRepeatUntil.java index 5c0cfcd00..743861a6d 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestInstanceInRepeatUntil.java +++ b/spec/java/src/io/kaitai/struct/spec/TestInstanceInRepeatUntil.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestInstanceInRepeatUntil extends CommonSpec { - @Test public void testInstanceInRepeatUntil() throws Exception { InstanceInRepeatUntil r = InstanceInRepeatUntil.fromFile(SRC_DIR + "repeat_until_s4.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestInstanceInSized.java b/spec/java/src/io/kaitai/struct/spec/TestInstanceInSized.java index 774ae465f..4b77621e3 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestInstanceInSized.java +++ b/spec/java/src/io/kaitai/struct/spec/TestInstanceInSized.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestInstanceInSized extends CommonSpec { - @Test public void testInstanceInSized() throws Exception { InstanceInSized r = InstanceInSized.fromFile(SRC_DIR + "process_rotate.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestInstanceIoUser.java b/spec/java/src/io/kaitai/struct/spec/TestInstanceIoUser.java index b4664bbd4..26721601b 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestInstanceIoUser.java +++ b/spec/java/src/io/kaitai/struct/spec/TestInstanceIoUser.java @@ -11,8 +11,8 @@ public void testInstanceIoUser() throws Exception { InstanceIoUser r = InstanceIoUser.fromFile(SRC_DIR + "instance_io.bin"); assertIntEquals(r.qtyEntries(), 3); - assertEquals(r.entries().get((int) 0).name(), "the"); - assertEquals(r.entries().get((int) 1).name(), "rainy"); - assertEquals(r.entries().get((int) 2).name(), "day it is"); + assertEquals(r.entries().get(((int) 0)).name(), "the"); + assertEquals(r.entries().get(((int) 1)).name(), "rainy"); + assertEquals(r.entries().get(((int) 2)).name(), "day it is"); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestInstanceIoUserEarlier.java b/spec/java/src/io/kaitai/struct/spec/TestInstanceIoUserEarlier.java index 8185052f4..b6a1b0d5a 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestInstanceIoUserEarlier.java +++ b/spec/java/src/io/kaitai/struct/spec/TestInstanceIoUserEarlier.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestInstanceIoUserEarlier extends CommonSpec { - @Test public void testInstanceIoUserEarlier() throws Exception { InstanceIoUserEarlier r = InstanceIoUserEarlier.fromFile(SRC_DIR + "switch_opcodes2.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestInstanceStdArray.java b/spec/java/src/io/kaitai/struct/spec/TestInstanceStdArray.java index cf95865fd..02a363fa8 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestInstanceStdArray.java +++ b/spec/java/src/io/kaitai/struct/spec/TestInstanceStdArray.java @@ -14,8 +14,8 @@ public void testInstanceStdArray() throws Exception { assertIntEquals(r.qtyEntries(), 3); assertIntEquals(r.entrySize(), 4); assertIntEquals(r.entries().size(), 3); - assertEquals(r.entries().get((int) 0), new byte[] { 17, 17, 17, 17 }); - assertEquals(r.entries().get((int) 1), new byte[] { 34, 34, 34, 34 }); - assertEquals(r.entries().get((int) 2), new byte[] { 51, 51, 51, 51 }); + assertEquals(r.entries().get(((int) 0)), new byte[] { 17, 17, 17, 17 }); + assertEquals(r.entries().get(((int) 1)), new byte[] { 34, 34, 34, 34 }); + assertEquals(r.entries().get(((int) 2)), new byte[] { 51, 51, 51, 51 }); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestInstanceUserArray.java b/spec/java/src/io/kaitai/struct/spec/TestInstanceUserArray.java index 72c99d44c..f7162fd53 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestInstanceUserArray.java +++ b/spec/java/src/io/kaitai/struct/spec/TestInstanceUserArray.java @@ -14,11 +14,11 @@ public void testInstanceUserArray() throws Exception { assertIntEquals(r.qtyEntries(), 3); assertIntEquals(r.entrySize(), 4); assertIntEquals(r.userEntries().size(), 3); - assertIntEquals(r.userEntries().get((int) 0).word1(), 4369); - assertIntEquals(r.userEntries().get((int) 0).word2(), 4369); - assertIntEquals(r.userEntries().get((int) 1).word1(), 8738); - assertIntEquals(r.userEntries().get((int) 1).word2(), 8738); - assertIntEquals(r.userEntries().get((int) 2).word1(), 13107); - assertIntEquals(r.userEntries().get((int) 2).word2(), 13107); + assertIntEquals(r.userEntries().get(((int) 0)).word1(), 4369); + assertIntEquals(r.userEntries().get(((int) 0)).word2(), 4369); + assertIntEquals(r.userEntries().get(((int) 1)).word1(), 8738); + assertIntEquals(r.userEntries().get(((int) 1)).word2(), 8738); + assertIntEquals(r.userEntries().get(((int) 2)).word1(), 13107); + assertIntEquals(r.userEntries().get(((int) 2)).word2(), 13107); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestIntegersDoubleOverflow.java b/spec/java/src/io/kaitai/struct/spec/TestIntegersDoubleOverflow.java index 20a3a7b45..49a3157a1 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestIntegersDoubleOverflow.java +++ b/spec/java/src/io/kaitai/struct/spec/TestIntegersDoubleOverflow.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestIntegersDoubleOverflow extends CommonSpec { - @Test public void testIntegersDoubleOverflow() throws Exception { IntegersDoubleOverflow r = IntegersDoubleOverflow.fromFile(SRC_DIR + "integers_double_overflow.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestIntegersMinMax.java b/spec/java/src/io/kaitai/struct/spec/TestIntegersMinMax.java index 0316fd57a..bea751ee3 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestIntegersMinMax.java +++ b/spec/java/src/io/kaitai/struct/spec/TestIntegersMinMax.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestIntegersMinMax extends CommonSpec { - @Test public void testIntegersMinMax() throws Exception { IntegersMinMax r = IntegersMinMax.fromFile(SRC_DIR + "integers_min_max.bin"); @@ -27,11 +26,11 @@ public void testIntegersMinMax() throws Exception { assertIntEquals(r.unsignedMax().u8be(), 0xffffffffffffffffL); assertIntEquals(r.signedMin().s1(), -128); assertIntEquals(r.signedMin().s2le(), -32768); - assertIntEquals(r.signedMin().s4le(), -2147483648L); - assertIntEquals(r.signedMin().s8le(), -0x8000000000000000L); + assertIntEquals(r.signedMin().s4le(), -2147483648); + assertIntEquals(r.signedMin().s8le(), -9223372036854775808L); assertIntEquals(r.signedMin().s2be(), -32768); - assertIntEquals(r.signedMin().s4be(), -2147483648L); - assertIntEquals(r.signedMin().s8be(), -0x8000000000000000L); + assertIntEquals(r.signedMin().s4be(), -2147483648); + assertIntEquals(r.signedMin().s8be(), -9223372036854775808L); assertIntEquals(r.signedMax().s1(), 127); assertIntEquals(r.signedMax().s2le(), 32767); assertIntEquals(r.signedMax().s4le(), 2147483647); diff --git a/spec/java/src/io/kaitai/struct/spec/TestNavParent.java b/spec/java/src/io/kaitai/struct/spec/TestNavParent.java index 7f09a528a..b5c713cfc 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestNavParent.java +++ b/spec/java/src/io/kaitai/struct/spec/TestNavParent.java @@ -13,7 +13,7 @@ public void testNavParent() throws Exception { assertIntEquals(r.header().qtyEntries(), 2); assertIntEquals(r.header().filenameLen(), 8); assertIntEquals(r.index().entries().size(), 2); - assertEquals(r.index().entries().get((int) 0).filename(), "FIRST___"); - assertEquals(r.index().entries().get((int) 1).filename(), "SECOND__"); + assertEquals(r.index().entries().get(((int) 0)).filename(), "FIRST___"); + assertEquals(r.index().entries().get(((int) 1)).filename(), "SECOND__"); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestNavParent2.java b/spec/java/src/io/kaitai/struct/spec/TestNavParent2.java index 7facaf3fa..7fc100a5c 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestNavParent2.java +++ b/spec/java/src/io/kaitai/struct/spec/TestNavParent2.java @@ -12,13 +12,13 @@ public void testNavParent2() throws Exception { assertIntEquals(r.ofsTags(), 8); assertIntEquals(r.numTags(), 2); - assertEquals(r.tags().get((int) 0).name(), "RAHC"); - assertIntEquals(r.tags().get((int) 0).ofs(), 32); - assertIntEquals(r.tags().get((int) 0).numItems(), 3); - assertEquals(r.tags().get((int) 0).tagContent().content(), "foo"); - assertEquals(r.tags().get((int) 1).name(), "RAHC"); - assertIntEquals(r.tags().get((int) 1).ofs(), 35); - assertIntEquals(r.tags().get((int) 1).numItems(), 6); - assertEquals(r.tags().get((int) 1).tagContent().content(), "barbaz"); + assertEquals(r.tags().get(((int) 0)).name(), "RAHC"); + assertIntEquals(r.tags().get(((int) 0)).ofs(), 32); + assertIntEquals(r.tags().get(((int) 0)).numItems(), 3); + assertEquals(r.tags().get(((int) 0)).tagContent().content(), "foo"); + assertEquals(r.tags().get(((int) 1)).name(), "RAHC"); + assertIntEquals(r.tags().get(((int) 1)).ofs(), 35); + assertIntEquals(r.tags().get(((int) 1)).numItems(), 6); + assertEquals(r.tags().get(((int) 1)).tagContent().content(), "barbaz"); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestNavParent3.java b/spec/java/src/io/kaitai/struct/spec/TestNavParent3.java index 78242acf4..e32f74234 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestNavParent3.java +++ b/spec/java/src/io/kaitai/struct/spec/TestNavParent3.java @@ -12,13 +12,13 @@ public void testNavParent3() throws Exception { assertIntEquals(r.ofsTags(), 8); assertIntEquals(r.numTags(), 2); - assertEquals(r.tags().get((int) 0).name(), "RAHC"); - assertIntEquals(r.tags().get((int) 0).ofs(), 32); - assertIntEquals(r.tags().get((int) 0).numItems(), 3); - assertEquals(r.tags().get((int) 0).tagContent().content(), "foo"); - assertEquals(r.tags().get((int) 1).name(), "RAHC"); - assertIntEquals(r.tags().get((int) 1).ofs(), 35); - assertIntEquals(r.tags().get((int) 1).numItems(), 6); - assertEquals(r.tags().get((int) 1).tagContent().content(), "barbaz"); + assertEquals(r.tags().get(((int) 0)).name(), "RAHC"); + assertIntEquals(r.tags().get(((int) 0)).ofs(), 32); + assertIntEquals(r.tags().get(((int) 0)).numItems(), 3); + assertEquals(r.tags().get(((int) 0)).tagContent().content(), "foo"); + assertEquals(r.tags().get(((int) 1)).name(), "RAHC"); + assertIntEquals(r.tags().get(((int) 1)).ofs(), 35); + assertIntEquals(r.tags().get(((int) 1)).numItems(), 6); + assertEquals(r.tags().get(((int) 1)).tagContent().content(), "barbaz"); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestNavParentSwitchCast.java b/spec/java/src/io/kaitai/struct/spec/TestNavParentSwitchCast.java index bb0abbc8f..7fb0d9a89 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestNavParentSwitchCast.java +++ b/spec/java/src/io/kaitai/struct/spec/TestNavParentSwitchCast.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestNavParentSwitchCast extends CommonSpec { - @Test public void testNavParentSwitchCast() throws Exception { NavParentSwitchCast r = NavParentSwitchCast.fromFile(SRC_DIR + "switch_integers.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestNavRoot.java b/spec/java/src/io/kaitai/struct/spec/TestNavRoot.java index 64ffbb603..19c3b1868 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestNavRoot.java +++ b/spec/java/src/io/kaitai/struct/spec/TestNavRoot.java @@ -13,7 +13,7 @@ public void testNavRoot() throws Exception { assertIntEquals(r.header().qtyEntries(), 2); assertIntEquals(r.header().filenameLen(), 8); assertIntEquals(r.index().entries().size(), 2); - assertEquals(r.index().entries().get((int) 0).filename(), "FIRST___"); - assertEquals(r.index().entries().get((int) 1).filename(), "SECOND__"); + assertEquals(r.index().entries().get(((int) 0)).filename(), "FIRST___"); + assertEquals(r.index().entries().get(((int) 1)).filename(), "SECOND__"); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestNestedTypeParam.java b/spec/java/src/io/kaitai/struct/spec/TestNestedTypeParam.java index e5aa885de..ff94eb689 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestNestedTypeParam.java +++ b/spec/java/src/io/kaitai/struct/spec/TestNestedTypeParam.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestNestedTypeParam extends CommonSpec { - @Test public void testNestedTypeParam() throws Exception { NestedTypeParam r = NestedTypeParam.fromFile(SRC_DIR + "term_strz.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestOpaqueExternalType.java b/spec/java/src/io/kaitai/struct/spec/TestOpaqueExternalType.java index 18ab1d8ed..4d7a678ca 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestOpaqueExternalType.java +++ b/spec/java/src/io/kaitai/struct/spec/TestOpaqueExternalType.java @@ -1,14 +1,15 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + package io.kaitai.struct.spec; import io.kaitai.struct.testformats.OpaqueExternalType; import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestOpaqueExternalType extends CommonSpec { - @Test public void testOpaqueExternalType() throws Exception { OpaqueExternalType r = OpaqueExternalType.fromFile(SRC_DIR + "term_strz.bin"); - assertIntEquals(r.hw().one(), 102); + assertIntEquals(((Number) (r.hw().one())).intValue(), 102); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestOptionalId.java b/spec/java/src/io/kaitai/struct/spec/TestOptionalId.java index b85a60350..d27d4a808 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestOptionalId.java +++ b/spec/java/src/io/kaitai/struct/spec/TestOptionalId.java @@ -4,7 +4,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestOptionalId extends CommonSpec { - @Test public void testOptionalId() throws Exception { OptionalId r = OptionalId.fromFile(SRC_DIR + "fixed_struct.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestParamsCallExtraParens.java b/spec/java/src/io/kaitai/struct/spec/TestParamsCallExtraParens.java index 70bc26f22..9f6bdeaa8 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestParamsCallExtraParens.java +++ b/spec/java/src/io/kaitai/struct/spec/TestParamsCallExtraParens.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestParamsCallExtraParens extends CommonSpec { - @Test public void testParamsCallExtraParens() throws Exception { ParamsCallExtraParens r = ParamsCallExtraParens.fromFile(SRC_DIR + "term_strz.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestParamsPassArrayInt.java b/spec/java/src/io/kaitai/struct/spec/TestParamsPassArrayInt.java index 3709e2bce..6ec95bfd0 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestParamsPassArrayInt.java +++ b/spec/java/src/io/kaitai/struct/spec/TestParamsPassArrayInt.java @@ -6,17 +6,16 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestParamsPassArrayInt extends CommonSpec { - @Test public void testParamsPassArrayInt() throws Exception { ParamsPassArrayInt r = ParamsPassArrayInt.fromFile(SRC_DIR + "position_to_end.bin"); assertIntEquals(r.passInts().nums().size(), 3); - assertIntEquals(r.passInts().nums().get((int) 0), 513); - assertIntEquals(r.passInts().nums().get((int) 1), 1027); - assertIntEquals(r.passInts().nums().get((int) 2), 1541); + assertIntEquals(r.passInts().nums().get(((int) 0)), 513); + assertIntEquals(r.passInts().nums().get(((int) 1)), 1027); + assertIntEquals(r.passInts().nums().get(((int) 2)), 1541); assertIntEquals(r.passIntsCalc().nums().size(), 2); - assertIntEquals(r.passIntsCalc().nums().get((int) 0), 27643); - assertIntEquals(r.passIntsCalc().nums().get((int) 1), 7); + assertIntEquals(r.passIntsCalc().nums().get(((int) 0)), 27643); + assertIntEquals(r.passIntsCalc().nums().get(((int) 1)), 7); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestParamsPassArrayIo.java b/spec/java/src/io/kaitai/struct/spec/TestParamsPassArrayIo.java index 45799518b..b0b0aa7a7 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestParamsPassArrayIo.java +++ b/spec/java/src/io/kaitai/struct/spec/TestParamsPassArrayIo.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestParamsPassArrayIo extends CommonSpec { - @Test public void testParamsPassArrayIo() throws Exception { ParamsPassArrayIo r = ParamsPassArrayIo.fromFile(SRC_DIR + "enum_negative.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestParamsPassArrayStr.java b/spec/java/src/io/kaitai/struct/spec/TestParamsPassArrayStr.java index b29d97ee4..9702a013b 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestParamsPassArrayStr.java +++ b/spec/java/src/io/kaitai/struct/spec/TestParamsPassArrayStr.java @@ -6,17 +6,16 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestParamsPassArrayStr extends CommonSpec { - @Test public void testParamsPassArrayStr() throws Exception { ParamsPassArrayStr r = ParamsPassArrayStr.fromFile(SRC_DIR + "term_strz.bin"); assertIntEquals(r.passStrArray().strs().size(), 3); - assertEquals(r.passStrArray().strs().get((int) 0), "fo"); - assertEquals(r.passStrArray().strs().get((int) 1), "o|"); - assertEquals(r.passStrArray().strs().get((int) 2), "ba"); + assertEquals(r.passStrArray().strs().get(((int) 0)), "fo"); + assertEquals(r.passStrArray().strs().get(((int) 1)), "o|"); + assertEquals(r.passStrArray().strs().get(((int) 2)), "ba"); assertIntEquals(r.passStrArrayCalc().strs().size(), 2); - assertEquals(r.passStrArrayCalc().strs().get((int) 0), "aB"); - assertEquals(r.passStrArrayCalc().strs().get((int) 1), "Cd"); + assertEquals(r.passStrArrayCalc().strs().get(((int) 0)), "aB"); + assertEquals(r.passStrArrayCalc().strs().get(((int) 1)), "Cd"); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestParamsPassArrayStruct.java b/spec/java/src/io/kaitai/struct/spec/TestParamsPassArrayStruct.java index 2c5a4258e..88e995241 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestParamsPassArrayStruct.java +++ b/spec/java/src/io/kaitai/struct/spec/TestParamsPassArrayStruct.java @@ -6,13 +6,12 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestParamsPassArrayStruct extends CommonSpec { - @Test public void testParamsPassArrayStruct() throws Exception { ParamsPassArrayStruct r = ParamsPassArrayStruct.fromFile(SRC_DIR + "position_to_end.bin"); assertIntEquals(r.passStructs().structs().size(), 2); - assertIntEquals(((ParamsPassArrayStruct.Foo) (r.passStructs().structs().get((int) 0))).f(), 1); - assertIntEquals(((ParamsPassArrayStruct.Bar) (r.passStructs().structs().get((int) 1))).b(), 2); + assertIntEquals(((ParamsPassArrayStruct.Foo) (r.passStructs().structs().get(((int) 0)))).f(), 1); + assertIntEquals(((ParamsPassArrayStruct.Bar) (r.passStructs().structs().get(((int) 1)))).b(), 2); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestParamsPassArrayUsertype.java b/spec/java/src/io/kaitai/struct/spec/TestParamsPassArrayUsertype.java index 8d30bdeab..44d483d07 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestParamsPassArrayUsertype.java +++ b/spec/java/src/io/kaitai/struct/spec/TestParamsPassArrayUsertype.java @@ -6,14 +6,13 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestParamsPassArrayUsertype extends CommonSpec { - @Test public void testParamsPassArrayUsertype() throws Exception { ParamsPassArrayUsertype r = ParamsPassArrayUsertype.fromFile(SRC_DIR + "position_to_end.bin"); assertIntEquals(r.passBlocks().bar().size(), 2); - assertIntEquals(r.passBlocks().bar().get((int) 0).foo(), 1); - assertIntEquals(r.passBlocks().bar().get((int) 1).foo(), 2); + assertIntEquals(r.passBlocks().bar().get(((int) 0)).foo(), 1); + assertIntEquals(r.passBlocks().bar().get(((int) 1)).foo(), 2); assertEquals(r.passBlocks().one(), new byte[] { 3 }); assertEquals(r.passBlocks().two(), new byte[] { 4, 5 }); } diff --git a/spec/java/src/io/kaitai/struct/spec/TestParamsPassBool.java b/spec/java/src/io/kaitai/struct/spec/TestParamsPassBool.java index 047f1119e..59a13332d 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestParamsPassBool.java +++ b/spec/java/src/io/kaitai/struct/spec/TestParamsPassBool.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestParamsPassBool extends CommonSpec { - @Test public void testParamsPassBool() throws Exception { ParamsPassBool r = ParamsPassBool.fromFile(SRC_DIR + "term_strz.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestParamsPassIo.java b/spec/java/src/io/kaitai/struct/spec/TestParamsPassIo.java index f3efafdde..a53ea01c5 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestParamsPassIo.java +++ b/spec/java/src/io/kaitai/struct/spec/TestParamsPassIo.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestParamsPassIo extends CommonSpec { - @Test public void testParamsPassIo() throws Exception { ParamsPassIo r = ParamsPassIo.fromFile(SRC_DIR + "enum_negative.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestParamsPassStruct.java b/spec/java/src/io/kaitai/struct/spec/TestParamsPassStruct.java index 0c8c85257..b1a95ba8d 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestParamsPassStruct.java +++ b/spec/java/src/io/kaitai/struct/spec/TestParamsPassStruct.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestParamsPassStruct extends CommonSpec { - @Test public void testParamsPassStruct() throws Exception { ParamsPassStruct r = ParamsPassStruct.fromFile(SRC_DIR + "enum_negative.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestProcessBytesPadTerm.java b/spec/java/src/io/kaitai/struct/spec/TestProcessBytesPadTerm.java index 4394a7eae..bebb041de 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestProcessBytesPadTerm.java +++ b/spec/java/src/io/kaitai/struct/spec/TestProcessBytesPadTerm.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestProcessBytesPadTerm extends CommonSpec { - @Test public void testProcessBytesPadTerm() throws Exception { ProcessBytesPadTerm r = ProcessBytesPadTerm.fromFile(SRC_DIR + "str_pad_term.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestProcessCoerceBytes.java b/spec/java/src/io/kaitai/struct/spec/TestProcessCoerceBytes.java index 8bd1fd333..473d7a599 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestProcessCoerceBytes.java +++ b/spec/java/src/io/kaitai/struct/spec/TestProcessCoerceBytes.java @@ -10,9 +10,9 @@ public class TestProcessCoerceBytes extends CommonSpec { public void testProcessCoerceBytes() throws Exception { ProcessCoerceBytes r = ProcessCoerceBytes.fromFile(SRC_DIR + "process_coerce_bytes.bin"); - assertIntEquals(r.records().get((int) 0).flag(), 0); - assertEquals(r.records().get((int) 0).buf(), new byte[] { 65, 65, 65, 65 }); - assertIntEquals(r.records().get((int) 1).flag(), 1); - assertEquals(r.records().get((int) 1).buf(), new byte[] { 66, 66, 66, 66 }); + assertIntEquals(r.records().get(((int) 0)).flag(), 0); + assertEquals(r.records().get(((int) 0)).buf(), new byte[] { 65, 65, 65, 65 }); + assertIntEquals(r.records().get(((int) 1)).flag(), 1); + assertEquals(r.records().get(((int) 1)).buf(), new byte[] { 66, 66, 66, 66 }); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestProcessCoerceUsertype1.java b/spec/java/src/io/kaitai/struct/spec/TestProcessCoerceUsertype1.java index 88e422cbb..0057a8103 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestProcessCoerceUsertype1.java +++ b/spec/java/src/io/kaitai/struct/spec/TestProcessCoerceUsertype1.java @@ -10,9 +10,9 @@ public class TestProcessCoerceUsertype1 extends CommonSpec { public void testProcessCoerceUsertype1() throws Exception { ProcessCoerceUsertype1 r = ProcessCoerceUsertype1.fromFile(SRC_DIR + "process_coerce_bytes.bin"); - assertIntEquals(r.records().get((int) 0).flag(), 0); - assertIntEquals(r.records().get((int) 0).buf().value(), 1094795585); - assertIntEquals(r.records().get((int) 1).flag(), 1); - assertIntEquals(r.records().get((int) 1).buf().value(), 1111638594); + assertIntEquals(r.records().get(((int) 0)).flag(), 0); + assertIntEquals(r.records().get(((int) 0)).buf().value(), 1094795585); + assertIntEquals(r.records().get(((int) 1)).flag(), 1); + assertIntEquals(r.records().get(((int) 1)).buf().value(), 1111638594); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestProcessCoerceUsertype2.java b/spec/java/src/io/kaitai/struct/spec/TestProcessCoerceUsertype2.java index 015dd025d..81a4ca362 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestProcessCoerceUsertype2.java +++ b/spec/java/src/io/kaitai/struct/spec/TestProcessCoerceUsertype2.java @@ -10,9 +10,9 @@ public class TestProcessCoerceUsertype2 extends CommonSpec { public void testProcessCoerceUsertype2() throws Exception { ProcessCoerceUsertype2 r = ProcessCoerceUsertype2.fromFile(SRC_DIR + "process_coerce_bytes.bin"); - assertIntEquals(r.records().get((int) 0).flag(), 0); - assertIntEquals(r.records().get((int) 0).buf().value(), 1094795585); - assertIntEquals(r.records().get((int) 1).flag(), 1); - assertIntEquals(r.records().get((int) 1).buf().value(), 1111638594); + assertIntEquals(r.records().get(((int) 0)).flag(), 0); + assertIntEquals(r.records().get(((int) 0)).buf().value(), 1094795585); + assertIntEquals(r.records().get(((int) 1)).flag(), 1); + assertIntEquals(r.records().get(((int) 1)).buf().value(), 1111638594); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestProcessCustomNoArgs.java b/spec/java/src/io/kaitai/struct/spec/TestProcessCustomNoArgs.java index 31293365a..a78c7bc92 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestProcessCustomNoArgs.java +++ b/spec/java/src/io/kaitai/struct/spec/TestProcessCustomNoArgs.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestProcessCustomNoArgs extends CommonSpec { - @Test public void testProcessCustomNoArgs() throws Exception { ProcessCustomNoArgs r = ProcessCustomNoArgs.fromFile(SRC_DIR + "process_rotate.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestProcessRepeatBytes.java b/spec/java/src/io/kaitai/struct/spec/TestProcessRepeatBytes.java index 86dd335ab..3a68f3d12 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestProcessRepeatBytes.java +++ b/spec/java/src/io/kaitai/struct/spec/TestProcessRepeatBytes.java @@ -6,12 +6,11 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestProcessRepeatBytes extends CommonSpec { - @Test public void testProcessRepeatBytes() throws Exception { ProcessRepeatBytes r = ProcessRepeatBytes.fromFile(SRC_DIR + "process_xor_4.bin"); - assertEquals(r.bufs().get((int) 0), new byte[] { 114, 37, 61, -118, 20 }); - assertEquals(r.bufs().get((int) 1), new byte[] { 74, 82, -86, 16, 68 }); + assertEquals(r.bufs().get(((int) 0)), new byte[] { 114, 37, 61, -118, 20 }); + assertEquals(r.bufs().get(((int) 1)), new byte[] { 74, 82, -86, 16, 68 }); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestProcessRepeatUsertype.java b/spec/java/src/io/kaitai/struct/spec/TestProcessRepeatUsertype.java index 315308f7d..548a3ac31 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestProcessRepeatUsertype.java +++ b/spec/java/src/io/kaitai/struct/spec/TestProcessRepeatUsertype.java @@ -6,14 +6,13 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestProcessRepeatUsertype extends CommonSpec { - @Test public void testProcessRepeatUsertype() throws Exception { ProcessRepeatUsertype r = ProcessRepeatUsertype.fromFile(SRC_DIR + "process_xor_4.bin"); - assertIntEquals(r.blocks().get((int) 0).a(), -1975704206); - assertIntEquals(r.blocks().get((int) 0).b(), 20); - assertIntEquals(r.blocks().get((int) 1).a(), 279597642); - assertIntEquals(r.blocks().get((int) 1).b(), 68); + assertIntEquals(r.blocks().get(((int) 0)).a(), -1975704206); + assertIntEquals(r.blocks().get(((int) 0)).b(), 20); + assertIntEquals(r.blocks().get(((int) 1)).a(), 279597642); + assertIntEquals(r.blocks().get(((int) 1)).b(), 68); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestProcessRepeatUsertypeDynargCustom.java b/spec/java/src/io/kaitai/struct/spec/TestProcessRepeatUsertypeDynargCustom.java index fd294a561..05f374507 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestProcessRepeatUsertypeDynargCustom.java +++ b/spec/java/src/io/kaitai/struct/spec/TestProcessRepeatUsertypeDynargCustom.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestProcessRepeatUsertypeDynargCustom extends CommonSpec { - @Test public void testProcessRepeatUsertypeDynargCustom() throws Exception { ProcessRepeatUsertypeDynargCustom r = ProcessRepeatUsertypeDynargCustom.fromFile(SRC_DIR + "process_rotate.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestProcessRepeatUsertypeDynargRotate.java b/spec/java/src/io/kaitai/struct/spec/TestProcessRepeatUsertypeDynargRotate.java index 7e2ab23e6..de49bcb70 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestProcessRepeatUsertypeDynargRotate.java +++ b/spec/java/src/io/kaitai/struct/spec/TestProcessRepeatUsertypeDynargRotate.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestProcessRepeatUsertypeDynargRotate extends CommonSpec { - @Test public void testProcessRepeatUsertypeDynargRotate() throws Exception { ProcessRepeatUsertypeDynargRotate r = ProcessRepeatUsertypeDynargRotate.fromFile(SRC_DIR + "process_rotate.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestProcessRepeatUsertypeDynargXor.java b/spec/java/src/io/kaitai/struct/spec/TestProcessRepeatUsertypeDynargXor.java index 511d56238..7540e110d 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestProcessRepeatUsertypeDynargXor.java +++ b/spec/java/src/io/kaitai/struct/spec/TestProcessRepeatUsertypeDynargXor.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestProcessRepeatUsertypeDynargXor extends CommonSpec { - @Test public void testProcessRepeatUsertypeDynargXor() throws Exception { ProcessRepeatUsertypeDynargXor r = ProcessRepeatUsertypeDynargXor.fromFile(SRC_DIR + "process_xor_4.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestProcessStructPadTerm.java b/spec/java/src/io/kaitai/struct/spec/TestProcessStructPadTerm.java index 0ac742060..267f314d7 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestProcessStructPadTerm.java +++ b/spec/java/src/io/kaitai/struct/spec/TestProcessStructPadTerm.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestProcessStructPadTerm extends CommonSpec { - @Test public void testProcessStructPadTerm() throws Exception { ProcessStructPadTerm r = ProcessStructPadTerm.fromFile(SRC_DIR + "str_pad_term.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestProcessTermStruct.java b/spec/java/src/io/kaitai/struct/spec/TestProcessTermStruct.java index 71031d196..e2226794b 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestProcessTermStruct.java +++ b/spec/java/src/io/kaitai/struct/spec/TestProcessTermStruct.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestProcessTermStruct extends CommonSpec { - @Test public void testProcessTermStruct() throws Exception { ProcessTermStruct r = ProcessTermStruct.fromFile(SRC_DIR + "term_strz.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestRepeatEosBytes.java b/spec/java/src/io/kaitai/struct/spec/TestRepeatEosBytes.java index 4cac2eb0c..469ef57df 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestRepeatEosBytes.java +++ b/spec/java/src/io/kaitai/struct/spec/TestRepeatEosBytes.java @@ -6,14 +6,13 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestRepeatEosBytes extends CommonSpec { - @Test public void testRepeatEosBytes() throws Exception { RepeatEosBytes r = RepeatEosBytes.fromFile(SRC_DIR + "repeat_until_process.bin"); assertIntEquals(r.records().size(), 3); - assertEquals(r.records().get((int) 0), new byte[] { -24, -70, -86, -86, -86 }); - assertEquals(r.records().get((int) 1), new byte[] { -6, -98, -72, -86, -86 }); - assertEquals(r.records().get((int) 2), new byte[] { -86, 85, 85, 85, 85 }); + assertEquals(r.records().get(((int) 0)), new byte[] { -24, -70, -86, -86, -86 }); + assertEquals(r.records().get(((int) 1)), new byte[] { -6, -98, -72, -86, -86 }); + assertEquals(r.records().get(((int) 2)), new byte[] { -86, 85, 85, 85, 85 }); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestRepeatEosBytesPad.java b/spec/java/src/io/kaitai/struct/spec/TestRepeatEosBytesPad.java index 63d24633a..97ed85d76 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestRepeatEosBytesPad.java +++ b/spec/java/src/io/kaitai/struct/spec/TestRepeatEosBytesPad.java @@ -6,14 +6,13 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestRepeatEosBytesPad extends CommonSpec { - @Test public void testRepeatEosBytesPad() throws Exception { RepeatEosBytesPad r = RepeatEosBytesPad.fromFile(SRC_DIR + "repeat_until_process.bin"); assertIntEquals(r.records().size(), 3); - assertEquals(r.records().get((int) 0), new byte[] { -24, -70 }); - assertEquals(r.records().get((int) 1), new byte[] { -6, -98, -72 }); - assertEquals(r.records().get((int) 2), new byte[] { -86, 85, 85, 85, 85 }); + assertEquals(r.records().get(((int) 0)), new byte[] { -24, -70 }); + assertEquals(r.records().get(((int) 1)), new byte[] { -6, -98, -72 }); + assertEquals(r.records().get(((int) 2)), new byte[] { -86, 85, 85, 85, 85 }); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestRepeatEosBytesPadTerm.java b/spec/java/src/io/kaitai/struct/spec/TestRepeatEosBytesPadTerm.java index 8e689e200..4cdbe0772 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestRepeatEosBytesPadTerm.java +++ b/spec/java/src/io/kaitai/struct/spec/TestRepeatEosBytesPadTerm.java @@ -6,14 +6,13 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestRepeatEosBytesPadTerm extends CommonSpec { - @Test public void testRepeatEosBytesPadTerm() throws Exception { RepeatEosBytesPadTerm r = RepeatEosBytesPadTerm.fromFile(SRC_DIR + "repeat_until_process.bin"); assertIntEquals(r.records().size(), 3); - assertEquals(r.records().get((int) 0), new byte[] { -24, -70 }); - assertEquals(r.records().get((int) 1), new byte[] { -6, -98, -72 }); - assertEquals(r.records().get((int) 2), new byte[] { -86, 85 }); + assertEquals(r.records().get(((int) 0)), new byte[] { -24, -70 }); + assertEquals(r.records().get(((int) 1)), new byte[] { -6, -98, -72 }); + assertEquals(r.records().get(((int) 2)), new byte[] { -86, 85 }); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestRepeatEosStruct.java b/spec/java/src/io/kaitai/struct/spec/TestRepeatEosStruct.java index e7857b7f3..da812a32c 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestRepeatEosStruct.java +++ b/spec/java/src/io/kaitai/struct/spec/TestRepeatEosStruct.java @@ -11,9 +11,9 @@ public void testRepeatEosStruct() throws Exception { RepeatEosStruct r = RepeatEosStruct.fromFile(SRC_DIR + "repeat_eos_struct.bin"); assertIntEquals(r.chunks().size(), 2); - assertIntEquals(r.chunks().get((int) 0).offset(), 0); - assertIntEquals(r.chunks().get((int) 0).len(), 66); - assertIntEquals(r.chunks().get((int) 1).offset(), 66); - assertIntEquals(r.chunks().get((int) 1).len(), 2069); + assertIntEquals(r.chunks().get(((int) 0)).offset(), 0); + assertIntEquals(r.chunks().get(((int) 0)).len(), 66); + assertIntEquals(r.chunks().get(((int) 1)).offset(), 66); + assertIntEquals(r.chunks().get(((int) 1)).len(), 2069); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestRepeatEosTermBytes.java b/spec/java/src/io/kaitai/struct/spec/TestRepeatEosTermBytes.java index 143b0022a..41dd18c53 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestRepeatEosTermBytes.java +++ b/spec/java/src/io/kaitai/struct/spec/TestRepeatEosTermBytes.java @@ -6,13 +6,12 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestRepeatEosTermBytes extends CommonSpec { - @Test public void testRepeatEosTermBytes() throws Exception { RepeatEosTermBytes r = RepeatEosTermBytes.fromFile(SRC_DIR + "process_rotate.bin"); assertIntEquals(r.records().size(), 2); - assertEquals(r.records().get((int) 0), new byte[] { 9, -84, -115, -115, -19, -70, 123, -109, 99, 35, 1, 42, 52, -78 }); - assertEquals(r.records().get((int) 1), new byte[] { 57, -78 }); + assertEquals(r.records().get(((int) 0)), new byte[] { 9, -84, -115, -115, -19, -70, 123, -109, 99, 35, 1, 42, 52, -78 }); + assertEquals(r.records().get(((int) 1)), new byte[] { 57, -78 }); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestRepeatEosTermStruct.java b/spec/java/src/io/kaitai/struct/spec/TestRepeatEosTermStruct.java index fb1e966f7..0466dae22 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestRepeatEosTermStruct.java +++ b/spec/java/src/io/kaitai/struct/spec/TestRepeatEosTermStruct.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestRepeatEosTermStruct extends CommonSpec { - @Test public void testRepeatEosTermStruct() throws Exception { RepeatEosTermStruct r = RepeatEosTermStruct.fromFile(SRC_DIR + "process_rotate.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestRepeatEosU4.java b/spec/java/src/io/kaitai/struct/spec/TestRepeatEosU4.java index dcb8ab142..f41c380fa 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestRepeatEosU4.java +++ b/spec/java/src/io/kaitai/struct/spec/TestRepeatEosU4.java @@ -1,15 +1,19 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + package io.kaitai.struct.spec; import io.kaitai.struct.testformats.RepeatEosU4; import org.testng.annotations.Test; - -import static org.testng.Assert.assertEquals; - +import static org.testng.Assert.*; public class TestRepeatEosU4 extends CommonSpec { @Test public void testRepeatEosU4() throws Exception { RepeatEosU4 r = RepeatEosU4.fromFile(SRC_DIR + "repeat_eos_struct.bin"); - assertEquals(r.numbers().toArray(), new Long[] { 0L, 0x42L, 0x42L, 0x815L }); + assertIntEquals(r.numbers().size(), 4); + assertIntEquals(r.numbers().get(((int) 0)), 0); + assertIntEquals(r.numbers().get(((int) 1)), 66); + assertIntEquals(r.numbers().get(((int) 2)), 66); + assertIntEquals(r.numbers().get(((int) 3)), 2069); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestRepeatNBytes.java b/spec/java/src/io/kaitai/struct/spec/TestRepeatNBytes.java index 344a09888..8d60994b7 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestRepeatNBytes.java +++ b/spec/java/src/io/kaitai/struct/spec/TestRepeatNBytes.java @@ -6,14 +6,13 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestRepeatNBytes extends CommonSpec { - @Test public void testRepeatNBytes() throws Exception { RepeatNBytes r = RepeatNBytes.fromFile(SRC_DIR + "repeat_until_process.bin"); assertIntEquals(r.records().size(), 3); - assertEquals(r.records().get((int) 0), new byte[] { -24, -70, -86, -86, -86 }); - assertEquals(r.records().get((int) 1), new byte[] { -6, -98, -72, -86, -86 }); - assertEquals(r.records().get((int) 2), new byte[] { -86, 85, 85, 85, 85 }); + assertEquals(r.records().get(((int) 0)), new byte[] { -24, -70, -86, -86, -86 }); + assertEquals(r.records().get(((int) 1)), new byte[] { -6, -98, -72, -86, -86 }); + assertEquals(r.records().get(((int) 2)), new byte[] { -86, 85, 85, 85, 85 }); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestRepeatNBytesPad.java b/spec/java/src/io/kaitai/struct/spec/TestRepeatNBytesPad.java index daa353545..b7ed29ec5 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestRepeatNBytesPad.java +++ b/spec/java/src/io/kaitai/struct/spec/TestRepeatNBytesPad.java @@ -6,14 +6,13 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestRepeatNBytesPad extends CommonSpec { - @Test public void testRepeatNBytesPad() throws Exception { RepeatNBytesPad r = RepeatNBytesPad.fromFile(SRC_DIR + "repeat_until_process.bin"); assertIntEquals(r.records().size(), 3); - assertEquals(r.records().get((int) 0), new byte[] { -24, -70 }); - assertEquals(r.records().get((int) 1), new byte[] { -6, -98, -72 }); - assertEquals(r.records().get((int) 2), new byte[] { -86, 85, 85, 85, 85 }); + assertEquals(r.records().get(((int) 0)), new byte[] { -24, -70 }); + assertEquals(r.records().get(((int) 1)), new byte[] { -6, -98, -72 }); + assertEquals(r.records().get(((int) 2)), new byte[] { -86, 85, 85, 85, 85 }); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestRepeatNBytesPadTerm.java b/spec/java/src/io/kaitai/struct/spec/TestRepeatNBytesPadTerm.java index 4c221094d..2fa98748c 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestRepeatNBytesPadTerm.java +++ b/spec/java/src/io/kaitai/struct/spec/TestRepeatNBytesPadTerm.java @@ -6,14 +6,13 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestRepeatNBytesPadTerm extends CommonSpec { - @Test public void testRepeatNBytesPadTerm() throws Exception { RepeatNBytesPadTerm r = RepeatNBytesPadTerm.fromFile(SRC_DIR + "repeat_until_process.bin"); assertIntEquals(r.records().size(), 3); - assertEquals(r.records().get((int) 0), new byte[] { -24, -70 }); - assertEquals(r.records().get((int) 1), new byte[] { -6, -98, -72 }); - assertEquals(r.records().get((int) 2), new byte[] { -86, 85 }); + assertEquals(r.records().get(((int) 0)), new byte[] { -24, -70 }); + assertEquals(r.records().get(((int) 1)), new byte[] { -6, -98, -72 }); + assertEquals(r.records().get(((int) 2)), new byte[] { -86, 85 }); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestRepeatNStruct.java b/spec/java/src/io/kaitai/struct/spec/TestRepeatNStruct.java index d775ee8ea..58b939cfc 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestRepeatNStruct.java +++ b/spec/java/src/io/kaitai/struct/spec/TestRepeatNStruct.java @@ -11,9 +11,9 @@ public void testRepeatNStruct() throws Exception { RepeatNStruct r = RepeatNStruct.fromFile(SRC_DIR + "repeat_n_struct.bin"); assertIntEquals(r.chunks().size(), 2); - assertIntEquals(r.chunks().get((int) 0).offset(), 16); - assertIntEquals(r.chunks().get((int) 0).len(), 8312); - assertIntEquals(r.chunks().get((int) 1).offset(), 8328); - assertIntEquals(r.chunks().get((int) 1).len(), 15); + assertIntEquals(r.chunks().get(((int) 0)).offset(), 16); + assertIntEquals(r.chunks().get(((int) 0)).len(), 8312); + assertIntEquals(r.chunks().get(((int) 1)).offset(), 8328); + assertIntEquals(r.chunks().get(((int) 1)).len(), 15); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestRepeatNTermBytes.java b/spec/java/src/io/kaitai/struct/spec/TestRepeatNTermBytes.java index 5846f13f9..b12084c22 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestRepeatNTermBytes.java +++ b/spec/java/src/io/kaitai/struct/spec/TestRepeatNTermBytes.java @@ -6,19 +6,18 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestRepeatNTermBytes extends CommonSpec { - @Test public void testRepeatNTermBytes() throws Exception { RepeatNTermBytes r = RepeatNTermBytes.fromFile(SRC_DIR + "repeat_until_process.bin"); assertIntEquals(r.records1().size(), 2); - assertEquals(r.records1().get((int) 0), new byte[] { -24, -70 }); - assertEquals(r.records1().get((int) 1), new byte[] { }); + assertEquals(r.records1().get(((int) 0)), new byte[] { -24, -70 }); + assertEquals(r.records1().get(((int) 1)), new byte[] { }); assertIntEquals(r.records2().size(), 2); - assertEquals(r.records2().get((int) 0), new byte[] { -86 }); - assertEquals(r.records2().get((int) 1), new byte[] { -6, -98, -72, -86 }); + assertEquals(r.records2().get(((int) 0)), new byte[] { -86 }); + assertEquals(r.records2().get(((int) 1)), new byte[] { -6, -98, -72, -86 }); assertIntEquals(r.records3().size(), 2); - assertEquals(r.records3().get((int) 0), new byte[] { -86, -86 }); - assertEquals(r.records3().get((int) 1), new byte[] { }); + assertEquals(r.records3().get(((int) 0)), new byte[] { -86, -86 }); + assertEquals(r.records3().get(((int) 1)), new byte[] { }); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestRepeatNTermStruct.java b/spec/java/src/io/kaitai/struct/spec/TestRepeatNTermStruct.java index 2bbdd60e0..13b33194e 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestRepeatNTermStruct.java +++ b/spec/java/src/io/kaitai/struct/spec/TestRepeatNTermStruct.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestRepeatNTermStruct extends CommonSpec { - @Test public void testRepeatNTermStruct() throws Exception { RepeatNTermStruct r = RepeatNTermStruct.fromFile(SRC_DIR + "repeat_until_process.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestRepeatUntilBytes.java b/spec/java/src/io/kaitai/struct/spec/TestRepeatUntilBytes.java index 37b0a13d9..8b1ebeb5d 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestRepeatUntilBytes.java +++ b/spec/java/src/io/kaitai/struct/spec/TestRepeatUntilBytes.java @@ -6,14 +6,13 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestRepeatUntilBytes extends CommonSpec { - @Test public void testRepeatUntilBytes() throws Exception { RepeatUntilBytes r = RepeatUntilBytes.fromFile(SRC_DIR + "repeat_until_process.bin"); assertIntEquals(r.records().size(), 3); - assertEquals(r.records().get((int) 0), new byte[] { -24, -70, -86, -86, -86 }); - assertEquals(r.records().get((int) 1), new byte[] { -6, -98, -72, -86, -86 }); - assertEquals(r.records().get((int) 2), new byte[] { -86, 85, 85, 85, 85 }); + assertEquals(r.records().get(((int) 0)), new byte[] { -24, -70, -86, -86, -86 }); + assertEquals(r.records().get(((int) 1)), new byte[] { -6, -98, -72, -86, -86 }); + assertEquals(r.records().get(((int) 2)), new byte[] { -86, 85, 85, 85, 85 }); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestRepeatUntilBytesPad.java b/spec/java/src/io/kaitai/struct/spec/TestRepeatUntilBytesPad.java index 4bdf0b751..709098fba 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestRepeatUntilBytesPad.java +++ b/spec/java/src/io/kaitai/struct/spec/TestRepeatUntilBytesPad.java @@ -6,14 +6,13 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestRepeatUntilBytesPad extends CommonSpec { - @Test public void testRepeatUntilBytesPad() throws Exception { RepeatUntilBytesPad r = RepeatUntilBytesPad.fromFile(SRC_DIR + "repeat_until_process.bin"); assertIntEquals(r.records().size(), 3); - assertEquals(r.records().get((int) 0), new byte[] { -24, -70 }); - assertEquals(r.records().get((int) 1), new byte[] { -6, -98, -72 }); - assertEquals(r.records().get((int) 2), new byte[] { -86, 85, 85, 85, 85 }); + assertEquals(r.records().get(((int) 0)), new byte[] { -24, -70 }); + assertEquals(r.records().get(((int) 1)), new byte[] { -6, -98, -72 }); + assertEquals(r.records().get(((int) 2)), new byte[] { -86, 85, 85, 85, 85 }); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestRepeatUntilBytesPadTerm.java b/spec/java/src/io/kaitai/struct/spec/TestRepeatUntilBytesPadTerm.java index a3d86dd3b..8133c4d5b 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestRepeatUntilBytesPadTerm.java +++ b/spec/java/src/io/kaitai/struct/spec/TestRepeatUntilBytesPadTerm.java @@ -6,14 +6,13 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestRepeatUntilBytesPadTerm extends CommonSpec { - @Test public void testRepeatUntilBytesPadTerm() throws Exception { RepeatUntilBytesPadTerm r = RepeatUntilBytesPadTerm.fromFile(SRC_DIR + "repeat_until_process.bin"); assertIntEquals(r.records().size(), 3); - assertEquals(r.records().get((int) 0), new byte[] { -24, -70 }); - assertEquals(r.records().get((int) 1), new byte[] { -6, -98, -72 }); - assertEquals(r.records().get((int) 2), new byte[] { -86, 85 }); + assertEquals(r.records().get(((int) 0)), new byte[] { -24, -70 }); + assertEquals(r.records().get(((int) 1)), new byte[] { -6, -98, -72 }); + assertEquals(r.records().get(((int) 2)), new byte[] { -86, 85 }); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestRepeatUntilCalcArrayType.java b/spec/java/src/io/kaitai/struct/spec/TestRepeatUntilCalcArrayType.java index 3157588ba..f4a049161 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestRepeatUntilCalcArrayType.java +++ b/spec/java/src/io/kaitai/struct/spec/TestRepeatUntilCalcArrayType.java @@ -6,17 +6,16 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestRepeatUntilCalcArrayType extends CommonSpec { - @Test public void testRepeatUntilCalcArrayType() throws Exception { RepeatUntilCalcArrayType r = RepeatUntilCalcArrayType.fromFile(SRC_DIR + "repeat_until_process.bin"); assertIntEquals(r.records().size(), 3); - assertIntEquals(r.records().get((int) 0).marker(), 232); - assertIntEquals(r.records().get((int) 0).body(), 2863311546L); - assertIntEquals(r.records().get((int) 1).marker(), 250); - assertIntEquals(r.records().get((int) 1).body(), 2863315102L); - assertIntEquals(r.records().get((int) 2).marker(), 170); - assertIntEquals(r.records().get((int) 2).body(), 1431655765); + assertIntEquals(r.records().get(((int) 0)).marker(), 232); + assertIntEquals(r.records().get(((int) 0)).body(), 2863311546L); + assertIntEquals(r.records().get(((int) 1)).marker(), 250); + assertIntEquals(r.records().get(((int) 1)).body(), 2863315102L); + assertIntEquals(r.records().get(((int) 2)).marker(), 170); + assertIntEquals(r.records().get(((int) 2)).body(), 1431655765); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestRepeatUntilComplex.java b/spec/java/src/io/kaitai/struct/spec/TestRepeatUntilComplex.java index 777538613..689322c25 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestRepeatUntilComplex.java +++ b/spec/java/src/io/kaitai/struct/spec/TestRepeatUntilComplex.java @@ -13,19 +13,19 @@ public void testRepeatUntilComplex() throws Exception { RepeatUntilComplex r = RepeatUntilComplex.fromFile(SRC_DIR + "repeat_until_complex.bin"); assertIntEquals(r.first().size(), 3); - assertIntEquals(r.first().get((int) 0).count(), 4); - assertEquals(r.first().get((int) 0).values(), new ArrayList(Arrays.asList((0 + 1), 2, 3, 4))); - assertIntEquals(r.first().get((int) 1).count(), 2); - assertEquals(r.first().get((int) 1).values(), new ArrayList(Arrays.asList((0 + 1), 2))); - assertIntEquals(r.first().get((int) 2).count(), 0); + assertIntEquals(r.first().get(((int) 0)).count(), 4); + assertEquals(r.first().get(((int) 0)).values(), new ArrayList(Arrays.asList((0 + 1), 2, 3, 4))); + assertIntEquals(r.first().get(((int) 1)).count(), 2); + assertEquals(r.first().get(((int) 1)).values(), new ArrayList(Arrays.asList((0 + 1), 2))); + assertIntEquals(r.first().get(((int) 2)).count(), 0); assertIntEquals(r.second().size(), 4); - assertIntEquals(r.second().get((int) 0).count(), 6); - assertEquals(r.second().get((int) 0).values(), new ArrayList(Arrays.asList((0 + 1), 2, 3, 4, 5, 6))); - assertIntEquals(r.second().get((int) 1).count(), 3); - assertEquals(r.second().get((int) 1).values(), new ArrayList(Arrays.asList((0 + 1), 2, 3))); - assertIntEquals(r.second().get((int) 2).count(), 4); - assertEquals(r.second().get((int) 2).values(), new ArrayList(Arrays.asList((0 + 1), 2, 3, 4))); - assertIntEquals(r.second().get((int) 3).count(), 0); + assertIntEquals(r.second().get(((int) 0)).count(), 6); + assertEquals(r.second().get(((int) 0)).values(), new ArrayList(Arrays.asList((0 + 1), 2, 3, 4, 5, 6))); + assertIntEquals(r.second().get(((int) 1)).count(), 3); + assertEquals(r.second().get(((int) 1)).values(), new ArrayList(Arrays.asList((0 + 1), 2, 3))); + assertIntEquals(r.second().get(((int) 2)).count(), 4); + assertEquals(r.second().get(((int) 2)).values(), new ArrayList(Arrays.asList((0 + 1), 2, 3, 4))); + assertIntEquals(r.second().get(((int) 3)).count(), 0); assertEquals(r.third(), new ArrayList(Arrays.asList((0 + 102), 111, 111, 98, 97, 114, 0))); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestRepeatUntilSized.java b/spec/java/src/io/kaitai/struct/spec/TestRepeatUntilSized.java index aa568d33d..939235770 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestRepeatUntilSized.java +++ b/spec/java/src/io/kaitai/struct/spec/TestRepeatUntilSized.java @@ -11,11 +11,11 @@ public void testRepeatUntilSized() throws Exception { RepeatUntilSized r = RepeatUntilSized.fromFile(SRC_DIR + "repeat_until_process.bin"); assertIntEquals(r.records().size(), 3); - assertIntEquals(r.records().get((int) 0).marker(), 232); - assertIntEquals(r.records().get((int) 0).body(), 2863311546L); - assertIntEquals(r.records().get((int) 1).marker(), 250); - assertIntEquals(r.records().get((int) 1).body(), 2863315102L); - assertIntEquals(r.records().get((int) 2).marker(), 170); - assertIntEquals(r.records().get((int) 2).body(), 1431655765); + assertIntEquals(r.records().get(((int) 0)).marker(), 232); + assertIntEquals(r.records().get(((int) 0)).body(), 2863311546L); + assertIntEquals(r.records().get(((int) 1)).marker(), 250); + assertIntEquals(r.records().get(((int) 1)).body(), 2863315102L); + assertIntEquals(r.records().get(((int) 2)).marker(), 170); + assertIntEquals(r.records().get(((int) 2)).body(), 1431655765); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestRepeatUntilTermBytes.java b/spec/java/src/io/kaitai/struct/spec/TestRepeatUntilTermBytes.java index fb5009bd8..908fa2c56 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestRepeatUntilTermBytes.java +++ b/spec/java/src/io/kaitai/struct/spec/TestRepeatUntilTermBytes.java @@ -6,19 +6,18 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestRepeatUntilTermBytes extends CommonSpec { - @Test public void testRepeatUntilTermBytes() throws Exception { RepeatUntilTermBytes r = RepeatUntilTermBytes.fromFile(SRC_DIR + "repeat_until_process.bin"); assertIntEquals(r.records1().size(), 2); - assertEquals(r.records1().get((int) 0), new byte[] { -24, -70 }); - assertEquals(r.records1().get((int) 1), new byte[] { }); + assertEquals(r.records1().get(((int) 0)), new byte[] { -24, -70 }); + assertEquals(r.records1().get(((int) 1)), new byte[] { }); assertIntEquals(r.records2().size(), 2); - assertEquals(r.records2().get((int) 0), new byte[] { -86 }); - assertEquals(r.records2().get((int) 1), new byte[] { -6, -98, -72, -86 }); + assertEquals(r.records2().get(((int) 0)), new byte[] { -86 }); + assertEquals(r.records2().get(((int) 1)), new byte[] { -6, -98, -72, -86 }); assertIntEquals(r.records3().size(), 2); - assertEquals(r.records3().get((int) 0), new byte[] { -86, -86 }); - assertEquals(r.records3().get((int) 1), new byte[] { }); + assertEquals(r.records3().get(((int) 0)), new byte[] { -86, -86 }); + assertEquals(r.records3().get(((int) 1)), new byte[] { }); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestRepeatUntilTermStruct.java b/spec/java/src/io/kaitai/struct/spec/TestRepeatUntilTermStruct.java index 23262af8c..e87038845 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestRepeatUntilTermStruct.java +++ b/spec/java/src/io/kaitai/struct/spec/TestRepeatUntilTermStruct.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestRepeatUntilTermStruct extends CommonSpec { - @Test public void testRepeatUntilTermStruct() throws Exception { RepeatUntilTermStruct r = RepeatUntilTermStruct.fromFile(SRC_DIR + "repeat_until_process.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestStrEncodingsUtf16.java b/spec/java/src/io/kaitai/struct/spec/TestStrEncodingsUtf16.java index bf61158cf..23ff59f5a 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestStrEncodingsUtf16.java +++ b/spec/java/src/io/kaitai/struct/spec/TestStrEncodingsUtf16.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestStrEncodingsUtf16 extends CommonSpec { - @Test public void testStrEncodingsUtf16() throws Exception { StrEncodingsUtf16 r = StrEncodingsUtf16.fromFile(SRC_DIR + "str_encodings_utf16.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestStrEosPadTerm.java b/spec/java/src/io/kaitai/struct/spec/TestStrEosPadTerm.java index ab94151b6..55e2652df 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestStrEosPadTerm.java +++ b/spec/java/src/io/kaitai/struct/spec/TestStrEosPadTerm.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestStrEosPadTerm extends CommonSpec { - @Test public void testStrEosPadTerm() throws Exception { StrEosPadTerm r = StrEosPadTerm.fromFile(SRC_DIR + "str_pad_term.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestStrEosPadTermEmpty.java b/spec/java/src/io/kaitai/struct/spec/TestStrEosPadTermEmpty.java index aa7fd6158..96316bfe3 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestStrEosPadTermEmpty.java +++ b/spec/java/src/io/kaitai/struct/spec/TestStrEosPadTermEmpty.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestStrEosPadTermEmpty extends CommonSpec { - @Test public void testStrEosPadTermEmpty() throws Exception { StrEosPadTermEmpty r = StrEosPadTermEmpty.fromFile(SRC_DIR + "str_pad_term_empty.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestStrEosPadTermEqual.java b/spec/java/src/io/kaitai/struct/spec/TestStrEosPadTermEqual.java index 526caee54..825575b14 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestStrEosPadTermEqual.java +++ b/spec/java/src/io/kaitai/struct/spec/TestStrEosPadTermEqual.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestStrEosPadTermEqual extends CommonSpec { - @Test public void testStrEosPadTermEqual() throws Exception { StrEosPadTermEqual r = StrEosPadTermEqual.fromFile(SRC_DIR + "str_pad_term.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestStrPadTermEqual.java b/spec/java/src/io/kaitai/struct/spec/TestStrPadTermEqual.java index 1c94db5fa..ce664d00d 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestStrPadTermEqual.java +++ b/spec/java/src/io/kaitai/struct/spec/TestStrPadTermEqual.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestStrPadTermEqual extends CommonSpec { - @Test public void testStrPadTermEqual() throws Exception { StrPadTermEqual r = StrPadTermEqual.fromFile(SRC_DIR + "str_pad_term.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestStrPadTermRoundtrip.java b/spec/java/src/io/kaitai/struct/spec/TestStrPadTermRoundtrip.java index 0acdcd90a..31a323b94 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestStrPadTermRoundtrip.java +++ b/spec/java/src/io/kaitai/struct/spec/TestStrPadTermRoundtrip.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestStrPadTermRoundtrip extends CommonSpec { - @Test public void testStrPadTermRoundtrip() throws Exception { StrPadTermRoundtrip r = StrPadTermRoundtrip.fromFile(SRC_DIR + "str_pad_term.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestStrPadTermZeroSize.java b/spec/java/src/io/kaitai/struct/spec/TestStrPadTermZeroSize.java index 596741910..237351faa 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestStrPadTermZeroSize.java +++ b/spec/java/src/io/kaitai/struct/spec/TestStrPadTermZeroSize.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestStrPadTermZeroSize extends CommonSpec { - @Test public void testStrPadTermZeroSize() throws Exception { StrPadTermZeroSize r = StrPadTermZeroSize.fromFile(SRC_DIR + "enum_negative.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestStructPadTerm.java b/spec/java/src/io/kaitai/struct/spec/TestStructPadTerm.java index 2339a481c..6c51b95cb 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestStructPadTerm.java +++ b/spec/java/src/io/kaitai/struct/spec/TestStructPadTerm.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestStructPadTerm extends CommonSpec { - @Test public void testStructPadTerm() throws Exception { StructPadTerm r = StructPadTerm.fromFile(SRC_DIR + "str_pad_term.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestStructPadTermEqual.java b/spec/java/src/io/kaitai/struct/spec/TestStructPadTermEqual.java index d4dde2a12..00732a3ea 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestStructPadTermEqual.java +++ b/spec/java/src/io/kaitai/struct/spec/TestStructPadTermEqual.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestStructPadTermEqual extends CommonSpec { - @Test public void testStructPadTermEqual() throws Exception { StructPadTermEqual r = StructPadTermEqual.fromFile(SRC_DIR + "str_pad_term.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestSwitchBytearray.java b/spec/java/src/io/kaitai/struct/spec/TestSwitchBytearray.java index fb426c2ff..43635ce39 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestSwitchBytearray.java +++ b/spec/java/src/io/kaitai/struct/spec/TestSwitchBytearray.java @@ -11,13 +11,13 @@ public void testSwitchBytearray() throws Exception { SwitchBytearray r = SwitchBytearray.fromFile(SRC_DIR + "switch_opcodes.bin"); assertIntEquals(r.opcodes().size(), 4); - assertEquals(r.opcodes().get((int) 0).code(), new byte[] { 83 }); - assertEquals(((SwitchBytearray.Opcode.Strval) (r.opcodes().get((int) 0).body())).value(), "foobar"); - assertEquals(r.opcodes().get((int) 1).code(), new byte[] { 73 }); - assertIntEquals(((SwitchBytearray.Opcode.Intval) (r.opcodes().get((int) 1).body())).value(), 66); - assertEquals(r.opcodes().get((int) 2).code(), new byte[] { 73 }); - assertIntEquals(((SwitchBytearray.Opcode.Intval) (r.opcodes().get((int) 2).body())).value(), 55); - assertEquals(r.opcodes().get((int) 3).code(), new byte[] { 83 }); - assertEquals(((SwitchBytearray.Opcode.Strval) (r.opcodes().get((int) 3).body())).value(), ""); + assertEquals(r.opcodes().get(((int) 0)).code(), new byte[] { 83 }); + assertEquals(((SwitchBytearray.Opcode.Strval) (r.opcodes().get(((int) 0)).body())).value(), "foobar"); + assertEquals(r.opcodes().get(((int) 1)).code(), new byte[] { 73 }); + assertIntEquals(((SwitchBytearray.Opcode.Intval) (r.opcodes().get(((int) 1)).body())).value(), 66); + assertEquals(r.opcodes().get(((int) 2)).code(), new byte[] { 73 }); + assertIntEquals(((SwitchBytearray.Opcode.Intval) (r.opcodes().get(((int) 2)).body())).value(), 55); + assertEquals(r.opcodes().get(((int) 3)).code(), new byte[] { 83 }); + assertEquals(((SwitchBytearray.Opcode.Strval) (r.opcodes().get(((int) 3)).body())).value(), ""); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestSwitchElseOnly.java b/spec/java/src/io/kaitai/struct/spec/TestSwitchElseOnly.java index 2ef6cc2a3..0e4ed13d1 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestSwitchElseOnly.java +++ b/spec/java/src/io/kaitai/struct/spec/TestSwitchElseOnly.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestSwitchElseOnly extends CommonSpec { - @Test public void testSwitchElseOnly() throws Exception { SwitchElseOnly r = SwitchElseOnly.fromFile(SRC_DIR + "switch_opcodes.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestSwitchIntegers.java b/spec/java/src/io/kaitai/struct/spec/TestSwitchIntegers.java index 4041cce7c..1627c7606 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestSwitchIntegers.java +++ b/spec/java/src/io/kaitai/struct/spec/TestSwitchIntegers.java @@ -11,13 +11,13 @@ public void testSwitchIntegers() throws Exception { SwitchIntegers r = SwitchIntegers.fromFile(SRC_DIR + "switch_integers.bin"); assertIntEquals(r.opcodes().size(), 4); - assertIntEquals(r.opcodes().get((int) 0).code(), 1); - assertIntEquals(r.opcodes().get((int) 0).body(), 7); - assertIntEquals(r.opcodes().get((int) 1).code(), 2); - assertIntEquals(r.opcodes().get((int) 1).body(), 16448); - assertIntEquals(r.opcodes().get((int) 2).code(), 4); - assertIntEquals(r.opcodes().get((int) 2).body(), 4919); - assertIntEquals(r.opcodes().get((int) 3).code(), 8); - assertIntEquals(r.opcodes().get((int) 3).body(), 4919); + assertIntEquals(r.opcodes().get(((int) 0)).code(), 1); + assertIntEquals(r.opcodes().get(((int) 0)).body(), 7); + assertIntEquals(r.opcodes().get(((int) 1)).code(), 2); + assertIntEquals(r.opcodes().get(((int) 1)).body(), 16448); + assertIntEquals(r.opcodes().get(((int) 2)).code(), 4); + assertIntEquals(r.opcodes().get(((int) 2)).body(), 4919); + assertIntEquals(r.opcodes().get(((int) 3)).code(), 8); + assertIntEquals(r.opcodes().get(((int) 3)).body(), 4919); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestSwitchManualEnum.java b/spec/java/src/io/kaitai/struct/spec/TestSwitchManualEnum.java index 39a81e475..97f67c055 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestSwitchManualEnum.java +++ b/spec/java/src/io/kaitai/struct/spec/TestSwitchManualEnum.java @@ -11,13 +11,13 @@ public void testSwitchManualEnum() throws Exception { SwitchManualEnum r = SwitchManualEnum.fromFile(SRC_DIR + "switch_opcodes.bin"); assertIntEquals(r.opcodes().size(), 4); - assertEquals(r.opcodes().get((int) 0).code(), SwitchManualEnum.Opcode.CodeEnum.STRVAL); - assertEquals(((SwitchManualEnum.Opcode.Strval) (r.opcodes().get((int) 0).body())).value(), "foobar"); - assertEquals(r.opcodes().get((int) 1).code(), SwitchManualEnum.Opcode.CodeEnum.INTVAL); - assertIntEquals(((SwitchManualEnum.Opcode.Intval) (r.opcodes().get((int) 1).body())).value(), 66); - assertEquals(r.opcodes().get((int) 2).code(), SwitchManualEnum.Opcode.CodeEnum.INTVAL); - assertIntEquals(((SwitchManualEnum.Opcode.Intval) (r.opcodes().get((int) 2).body())).value(), 55); - assertEquals(r.opcodes().get((int) 3).code(), SwitchManualEnum.Opcode.CodeEnum.STRVAL); - assertEquals(((SwitchManualEnum.Opcode.Strval) (r.opcodes().get((int) 3).body())).value(), ""); + assertEquals(r.opcodes().get(((int) 0)).code(), SwitchManualEnum.Opcode.CodeEnum.STRVAL); + assertEquals(((SwitchManualEnum.Opcode.Strval) (r.opcodes().get(((int) 0)).body())).value(), "foobar"); + assertEquals(r.opcodes().get(((int) 1)).code(), SwitchManualEnum.Opcode.CodeEnum.INTVAL); + assertIntEquals(((SwitchManualEnum.Opcode.Intval) (r.opcodes().get(((int) 1)).body())).value(), 66); + assertEquals(r.opcodes().get(((int) 2)).code(), SwitchManualEnum.Opcode.CodeEnum.INTVAL); + assertIntEquals(((SwitchManualEnum.Opcode.Intval) (r.opcodes().get(((int) 2)).body())).value(), 55); + assertEquals(r.opcodes().get(((int) 3)).code(), SwitchManualEnum.Opcode.CodeEnum.STRVAL); + assertEquals(((SwitchManualEnum.Opcode.Strval) (r.opcodes().get(((int) 3)).body())).value(), ""); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestSwitchManualInt.java b/spec/java/src/io/kaitai/struct/spec/TestSwitchManualInt.java index dcf60d436..9e01b109f 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestSwitchManualInt.java +++ b/spec/java/src/io/kaitai/struct/spec/TestSwitchManualInt.java @@ -11,13 +11,13 @@ public void testSwitchManualInt() throws Exception { SwitchManualInt r = SwitchManualInt.fromFile(SRC_DIR + "switch_opcodes.bin"); assertIntEquals(r.opcodes().size(), 4); - assertIntEquals(r.opcodes().get((int) 0).code(), 83); - assertEquals(((SwitchManualInt.Opcode.Strval) (r.opcodes().get((int) 0).body())).value(), "foobar"); - assertIntEquals(r.opcodes().get((int) 1).code(), 73); - assertIntEquals(((SwitchManualInt.Opcode.Intval) (r.opcodes().get((int) 1).body())).value(), 66); - assertIntEquals(r.opcodes().get((int) 2).code(), 73); - assertIntEquals(((SwitchManualInt.Opcode.Intval) (r.opcodes().get((int) 2).body())).value(), 55); - assertIntEquals(r.opcodes().get((int) 3).code(), 83); - assertEquals(((SwitchManualInt.Opcode.Strval) (r.opcodes().get((int) 3).body())).value(), ""); + assertIntEquals(r.opcodes().get(((int) 0)).code(), 83); + assertEquals(((SwitchManualInt.Opcode.Strval) (r.opcodes().get(((int) 0)).body())).value(), "foobar"); + assertIntEquals(r.opcodes().get(((int) 1)).code(), 73); + assertIntEquals(((SwitchManualInt.Opcode.Intval) (r.opcodes().get(((int) 1)).body())).value(), 66); + assertIntEquals(r.opcodes().get(((int) 2)).code(), 73); + assertIntEquals(((SwitchManualInt.Opcode.Intval) (r.opcodes().get(((int) 2)).body())).value(), 55); + assertIntEquals(r.opcodes().get(((int) 3)).code(), 83); + assertEquals(((SwitchManualInt.Opcode.Strval) (r.opcodes().get(((int) 3)).body())).value(), ""); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestSwitchManualIntElse.java b/spec/java/src/io/kaitai/struct/spec/TestSwitchManualIntElse.java index ac60d4eb4..c2547e909 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestSwitchManualIntElse.java +++ b/spec/java/src/io/kaitai/struct/spec/TestSwitchManualIntElse.java @@ -11,13 +11,13 @@ public void testSwitchManualIntElse() throws Exception { SwitchManualIntElse r = SwitchManualIntElse.fromFile(SRC_DIR + "switch_opcodes2.bin"); assertIntEquals(r.opcodes().size(), 4); - assertIntEquals(r.opcodes().get((int) 0).code(), 83); - assertEquals(((SwitchManualIntElse.Opcode.Strval) (r.opcodes().get((int) 0).body())).value(), "foo"); - assertIntEquals(r.opcodes().get((int) 1).code(), 88); - assertIntEquals(((SwitchManualIntElse.Opcode.Noneval) (r.opcodes().get((int) 1).body())).filler(), 66); - assertIntEquals(r.opcodes().get((int) 2).code(), 89); - assertIntEquals(((SwitchManualIntElse.Opcode.Noneval) (r.opcodes().get((int) 2).body())).filler(), 51966); - assertIntEquals(r.opcodes().get((int) 3).code(), 73); - assertIntEquals(((SwitchManualIntElse.Opcode.Intval) (r.opcodes().get((int) 3).body())).value(), 7); + assertIntEquals(r.opcodes().get(((int) 0)).code(), 83); + assertEquals(((SwitchManualIntElse.Opcode.Strval) (r.opcodes().get(((int) 0)).body())).value(), "foo"); + assertIntEquals(r.opcodes().get(((int) 1)).code(), 88); + assertIntEquals(((SwitchManualIntElse.Opcode.Noneval) (r.opcodes().get(((int) 1)).body())).filler(), 66); + assertIntEquals(r.opcodes().get(((int) 2)).code(), 89); + assertIntEquals(((SwitchManualIntElse.Opcode.Noneval) (r.opcodes().get(((int) 2)).body())).filler(), 51966); + assertIntEquals(r.opcodes().get(((int) 3)).code(), 73); + assertIntEquals(((SwitchManualIntElse.Opcode.Intval) (r.opcodes().get(((int) 3)).body())).value(), 7); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestSwitchManualIntSize.java b/spec/java/src/io/kaitai/struct/spec/TestSwitchManualIntSize.java index e75b4d426..4e6b0bf81 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestSwitchManualIntSize.java +++ b/spec/java/src/io/kaitai/struct/spec/TestSwitchManualIntSize.java @@ -8,20 +8,19 @@ import java.util.ArrayList; import java.util.Arrays; public class TestSwitchManualIntSize extends CommonSpec { - @Test public void testSwitchManualIntSize() throws Exception { SwitchManualIntSize r = SwitchManualIntSize.fromFile(SRC_DIR + "switch_tlv.bin"); assertIntEquals(r.chunks().size(), 4); - assertIntEquals(r.chunks().get((int) 0).code(), 17); - assertEquals(((SwitchManualIntSize.Chunk.ChunkMeta) (r.chunks().get((int) 0).body())).title(), "Stuff"); - assertEquals(((SwitchManualIntSize.Chunk.ChunkMeta) (r.chunks().get((int) 0).body())).author(), "Me"); - assertIntEquals(r.chunks().get((int) 1).code(), 34); - assertEquals(((SwitchManualIntSize.Chunk.ChunkDir) (r.chunks().get((int) 1).body())).entries(), new ArrayList(Arrays.asList("AAAA", "BBBB", "CCCC"))); - assertIntEquals(r.chunks().get((int) 2).code(), 51); - assertEquals(((byte[]) (r.chunks().get((int) 2).body())), new byte[] { 16, 32, 48, 64, 80, 96, 112, -128 }); - assertIntEquals(r.chunks().get((int) 3).code(), 255); - assertEquals(((byte[]) (r.chunks().get((int) 3).body())), new byte[] { }); + assertIntEquals(r.chunks().get(((int) 0)).code(), 17); + assertEquals(((SwitchManualIntSize.Chunk.ChunkMeta) (r.chunks().get(((int) 0)).body())).title(), "Stuff"); + assertEquals(((SwitchManualIntSize.Chunk.ChunkMeta) (r.chunks().get(((int) 0)).body())).author(), "Me"); + assertIntEquals(r.chunks().get(((int) 1)).code(), 34); + assertEquals(((SwitchManualIntSize.Chunk.ChunkDir) (r.chunks().get(((int) 1)).body())).entries(), new ArrayList(Arrays.asList("AAAA", "BBBB", "CCCC"))); + assertIntEquals(r.chunks().get(((int) 2)).code(), 51); + assertEquals(((byte[]) (r.chunks().get(((int) 2)).body())), new byte[] { 16, 32, 48, 64, 80, 96, 112, -128 }); + assertIntEquals(r.chunks().get(((int) 3)).code(), 255); + assertEquals(((byte[]) (r.chunks().get(((int) 3)).body())), new byte[] { }); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestSwitchManualIntSizeElse.java b/spec/java/src/io/kaitai/struct/spec/TestSwitchManualIntSizeElse.java index a8b1cca20..8db8a1cad 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestSwitchManualIntSizeElse.java +++ b/spec/java/src/io/kaitai/struct/spec/TestSwitchManualIntSizeElse.java @@ -13,14 +13,14 @@ public void testSwitchManualIntSizeElse() throws Exception { SwitchManualIntSizeElse r = SwitchManualIntSizeElse.fromFile(SRC_DIR + "switch_tlv.bin"); assertIntEquals(r.chunks().size(), 4); - assertIntEquals(r.chunks().get((int) 0).code(), 17); - assertEquals(((SwitchManualIntSizeElse.Chunk.ChunkMeta) (r.chunks().get((int) 0).body())).title(), "Stuff"); - assertEquals(((SwitchManualIntSizeElse.Chunk.ChunkMeta) (r.chunks().get((int) 0).body())).author(), "Me"); - assertIntEquals(r.chunks().get((int) 1).code(), 34); - assertEquals(((SwitchManualIntSizeElse.Chunk.ChunkDir) (r.chunks().get((int) 1).body())).entries(), new ArrayList(Arrays.asList("AAAA", "BBBB", "CCCC"))); - assertIntEquals(r.chunks().get((int) 2).code(), 51); - assertEquals(((SwitchManualIntSizeElse.Chunk.Dummy) (r.chunks().get((int) 2).body())).rest(), new byte[] { 16, 32, 48, 64, 80, 96, 112, -128 }); - assertIntEquals(r.chunks().get((int) 3).code(), 255); - assertEquals(((SwitchManualIntSizeElse.Chunk.Dummy) (r.chunks().get((int) 3).body())).rest(), new byte[] { }); + assertIntEquals(r.chunks().get(((int) 0)).code(), 17); + assertEquals(((SwitchManualIntSizeElse.Chunk.ChunkMeta) (r.chunks().get(((int) 0)).body())).title(), "Stuff"); + assertEquals(((SwitchManualIntSizeElse.Chunk.ChunkMeta) (r.chunks().get(((int) 0)).body())).author(), "Me"); + assertIntEquals(r.chunks().get(((int) 1)).code(), 34); + assertEquals(((SwitchManualIntSizeElse.Chunk.ChunkDir) (r.chunks().get(((int) 1)).body())).entries(), new ArrayList(Arrays.asList("AAAA", "BBBB", "CCCC"))); + assertIntEquals(r.chunks().get(((int) 2)).code(), 51); + assertEquals(((SwitchManualIntSizeElse.Chunk.Dummy) (r.chunks().get(((int) 2)).body())).rest(), new byte[] { 16, 32, 48, 64, 80, 96, 112, -128 }); + assertIntEquals(r.chunks().get(((int) 3)).code(), 255); + assertEquals(((SwitchManualIntSizeElse.Chunk.Dummy) (r.chunks().get(((int) 3)).body())).rest(), new byte[] { }); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestSwitchManualIntSizeEos.java b/spec/java/src/io/kaitai/struct/spec/TestSwitchManualIntSizeEos.java index b217257cc..84b8357e7 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestSwitchManualIntSizeEos.java +++ b/spec/java/src/io/kaitai/struct/spec/TestSwitchManualIntSizeEos.java @@ -8,20 +8,19 @@ import java.util.ArrayList; import java.util.Arrays; public class TestSwitchManualIntSizeEos extends CommonSpec { - @Test public void testSwitchManualIntSizeEos() throws Exception { SwitchManualIntSizeEos r = SwitchManualIntSizeEos.fromFile(SRC_DIR + "switch_tlv.bin"); assertIntEquals(r.chunks().size(), 4); - assertIntEquals(r.chunks().get((int) 0).code(), 17); - assertEquals(((SwitchManualIntSizeEos.ChunkBody.ChunkMeta) (r.chunks().get((int) 0).body().body())).title(), "Stuff"); - assertEquals(((SwitchManualIntSizeEos.ChunkBody.ChunkMeta) (r.chunks().get((int) 0).body().body())).author(), "Me"); - assertIntEquals(r.chunks().get((int) 1).code(), 34); - assertEquals(((SwitchManualIntSizeEos.ChunkBody.ChunkDir) (r.chunks().get((int) 1).body().body())).entries(), new ArrayList(Arrays.asList("AAAA", "BBBB", "CCCC"))); - assertIntEquals(r.chunks().get((int) 2).code(), 51); - assertEquals(((byte[]) (r.chunks().get((int) 2).body().body())), new byte[] { 16, 32, 48, 64, 80, 96, 112, -128 }); - assertIntEquals(r.chunks().get((int) 3).code(), 255); - assertEquals(((byte[]) (r.chunks().get((int) 3).body().body())), new byte[] { }); + assertIntEquals(r.chunks().get(((int) 0)).code(), 17); + assertEquals(((SwitchManualIntSizeEos.ChunkBody.ChunkMeta) (r.chunks().get(((int) 0)).body().body())).title(), "Stuff"); + assertEquals(((SwitchManualIntSizeEos.ChunkBody.ChunkMeta) (r.chunks().get(((int) 0)).body().body())).author(), "Me"); + assertIntEquals(r.chunks().get(((int) 1)).code(), 34); + assertEquals(((SwitchManualIntSizeEos.ChunkBody.ChunkDir) (r.chunks().get(((int) 1)).body().body())).entries(), new ArrayList(Arrays.asList("AAAA", "BBBB", "CCCC"))); + assertIntEquals(r.chunks().get(((int) 2)).code(), 51); + assertEquals(((byte[]) (r.chunks().get(((int) 2)).body().body())), new byte[] { 16, 32, 48, 64, 80, 96, 112, -128 }); + assertIntEquals(r.chunks().get(((int) 3)).code(), 255); + assertEquals(((byte[]) (r.chunks().get(((int) 3)).body().body())), new byte[] { }); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestSwitchManualStr.java b/spec/java/src/io/kaitai/struct/spec/TestSwitchManualStr.java index 8a4e63b29..9ad2ad226 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestSwitchManualStr.java +++ b/spec/java/src/io/kaitai/struct/spec/TestSwitchManualStr.java @@ -11,13 +11,13 @@ public void testSwitchManualStr() throws Exception { SwitchManualStr r = SwitchManualStr.fromFile(SRC_DIR + "switch_opcodes.bin"); assertIntEquals(r.opcodes().size(), 4); - assertEquals(r.opcodes().get((int) 0).code(), "S"); - assertEquals(((SwitchManualStr.Opcode.Strval) (r.opcodes().get((int) 0).body())).value(), "foobar"); - assertEquals(r.opcodes().get((int) 1).code(), "I"); - assertIntEquals(((SwitchManualStr.Opcode.Intval) (r.opcodes().get((int) 1).body())).value(), 66); - assertEquals(r.opcodes().get((int) 2).code(), "I"); - assertIntEquals(((SwitchManualStr.Opcode.Intval) (r.opcodes().get((int) 2).body())).value(), 55); - assertEquals(r.opcodes().get((int) 3).code(), "S"); - assertEquals(((SwitchManualStr.Opcode.Strval) (r.opcodes().get((int) 3).body())).value(), ""); + assertEquals(r.opcodes().get(((int) 0)).code(), "S"); + assertEquals(((SwitchManualStr.Opcode.Strval) (r.opcodes().get(((int) 0)).body())).value(), "foobar"); + assertEquals(r.opcodes().get(((int) 1)).code(), "I"); + assertIntEquals(((SwitchManualStr.Opcode.Intval) (r.opcodes().get(((int) 1)).body())).value(), 66); + assertEquals(r.opcodes().get(((int) 2)).code(), "I"); + assertIntEquals(((SwitchManualStr.Opcode.Intval) (r.opcodes().get(((int) 2)).body())).value(), 55); + assertEquals(r.opcodes().get(((int) 3)).code(), "S"); + assertEquals(((SwitchManualStr.Opcode.Strval) (r.opcodes().get(((int) 3)).body())).value(), ""); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestSwitchManualStrElse.java b/spec/java/src/io/kaitai/struct/spec/TestSwitchManualStrElse.java index 9a0db621d..8640b42fd 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestSwitchManualStrElse.java +++ b/spec/java/src/io/kaitai/struct/spec/TestSwitchManualStrElse.java @@ -11,13 +11,13 @@ public void testSwitchManualStrElse() throws Exception { SwitchManualStrElse r = SwitchManualStrElse.fromFile(SRC_DIR + "switch_opcodes2.bin"); assertIntEquals(r.opcodes().size(), 4); - assertEquals(r.opcodes().get((int) 0).code(), "S"); - assertEquals(((SwitchManualStrElse.Opcode.Strval) (r.opcodes().get((int) 0).body())).value(), "foo"); - assertEquals(r.opcodes().get((int) 1).code(), "X"); - assertIntEquals(((SwitchManualStrElse.Opcode.Noneval) (r.opcodes().get((int) 1).body())).filler(), 66); - assertEquals(r.opcodes().get((int) 2).code(), "Y"); - assertIntEquals(((SwitchManualStrElse.Opcode.Noneval) (r.opcodes().get((int) 2).body())).filler(), 51966); - assertEquals(r.opcodes().get((int) 3).code(), "I"); - assertIntEquals(((SwitchManualStrElse.Opcode.Intval) (r.opcodes().get((int) 3).body())).value(), 7); + assertEquals(r.opcodes().get(((int) 0)).code(), "S"); + assertEquals(((SwitchManualStrElse.Opcode.Strval) (r.opcodes().get(((int) 0)).body())).value(), "foo"); + assertEquals(r.opcodes().get(((int) 1)).code(), "X"); + assertIntEquals(((SwitchManualStrElse.Opcode.Noneval) (r.opcodes().get(((int) 1)).body())).filler(), 66); + assertEquals(r.opcodes().get(((int) 2)).code(), "Y"); + assertIntEquals(((SwitchManualStrElse.Opcode.Noneval) (r.opcodes().get(((int) 2)).body())).filler(), 51966); + assertEquals(r.opcodes().get(((int) 3)).code(), "I"); + assertIntEquals(((SwitchManualStrElse.Opcode.Intval) (r.opcodes().get(((int) 3)).body())).value(), 7); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestSwitchMultiBoolOps.java b/spec/java/src/io/kaitai/struct/spec/TestSwitchMultiBoolOps.java index d48ed2956..f146b9d0c 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestSwitchMultiBoolOps.java +++ b/spec/java/src/io/kaitai/struct/spec/TestSwitchMultiBoolOps.java @@ -6,19 +6,18 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestSwitchMultiBoolOps extends CommonSpec { - @Test public void testSwitchMultiBoolOps() throws Exception { SwitchMultiBoolOps r = SwitchMultiBoolOps.fromFile(SRC_DIR + "switch_integers.bin"); assertIntEquals(r.opcodes().size(), 4); - assertIntEquals(r.opcodes().get((int) 0).code(), 1); - assertIntEquals(r.opcodes().get((int) 0).body(), 7); - assertIntEquals(r.opcodes().get((int) 1).code(), 2); - assertIntEquals(r.opcodes().get((int) 1).body(), 16448); - assertIntEquals(r.opcodes().get((int) 2).code(), 4); - assertIntEquals(r.opcodes().get((int) 2).body(), 4919); - assertIntEquals(r.opcodes().get((int) 3).code(), 8); - assertIntEquals(r.opcodes().get((int) 3).body(), 4919); + assertIntEquals(r.opcodes().get(((int) 0)).code(), 1); + assertIntEquals(r.opcodes().get(((int) 0)).body(), 7); + assertIntEquals(r.opcodes().get(((int) 1)).code(), 2); + assertIntEquals(r.opcodes().get(((int) 1)).body(), 16448); + assertIntEquals(r.opcodes().get(((int) 2)).code(), 4); + assertIntEquals(r.opcodes().get(((int) 2)).body(), 4919); + assertIntEquals(r.opcodes().get(((int) 3)).code(), 8); + assertIntEquals(r.opcodes().get(((int) 3)).body(), 4919); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestSwitchRepeatExpr.java b/spec/java/src/io/kaitai/struct/spec/TestSwitchRepeatExpr.java index c2a0f1135..dc81cbcbe 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestSwitchRepeatExpr.java +++ b/spec/java/src/io/kaitai/struct/spec/TestSwitchRepeatExpr.java @@ -6,13 +6,12 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestSwitchRepeatExpr extends CommonSpec { - @Test public void testSwitchRepeatExpr() throws Exception { SwitchRepeatExpr r = SwitchRepeatExpr.fromFile(SRC_DIR + "switch_tlv.bin"); assertIntEquals(r.code(), 17); assertIntEquals(r.size(), 9); - assertEquals(((SwitchRepeatExpr.One) (r.body().get((int) 0))).first(), new byte[] { 83, 116, 117, 102, 102, 0, 77, 101, 0 }); + assertEquals(((SwitchRepeatExpr.One) (r.body().get(((int) 0)))).first(), new byte[] { 83, 116, 117, 102, 102, 0, 77, 101, 0 }); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestSwitchRepeatExprInvalid.java b/spec/java/src/io/kaitai/struct/spec/TestSwitchRepeatExprInvalid.java index 894c3cdbe..b1bea3f94 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestSwitchRepeatExprInvalid.java +++ b/spec/java/src/io/kaitai/struct/spec/TestSwitchRepeatExprInvalid.java @@ -6,13 +6,12 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestSwitchRepeatExprInvalid extends CommonSpec { - @Test public void testSwitchRepeatExprInvalid() throws Exception { SwitchRepeatExprInvalid r = SwitchRepeatExprInvalid.fromFile(SRC_DIR + "switch_tlv.bin"); assertIntEquals(r.code(), 17); assertIntEquals(r.size(), 9); - assertEquals(((byte[]) (r.body().get((int) 0))), new byte[] { 83, 116, 117, 102, 102, 0, 77, 101, 0 }); + assertEquals(((byte[]) (r.body().get(((int) 0)))), new byte[] { 83, 116, 117, 102, 102, 0, 77, 101, 0 }); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestTermBytes2.java b/spec/java/src/io/kaitai/struct/spec/TestTermBytes2.java index 439171287..965524045 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestTermBytes2.java +++ b/spec/java/src/io/kaitai/struct/spec/TestTermBytes2.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestTermBytes2 extends CommonSpec { - @Test public void testTermBytes2() throws Exception { TermBytes2 r = TermBytes2.fromFile(SRC_DIR + "term_strz.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestTermBytes3.java b/spec/java/src/io/kaitai/struct/spec/TestTermBytes3.java index 3e3d91fee..bc7598a98 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestTermBytes3.java +++ b/spec/java/src/io/kaitai/struct/spec/TestTermBytes3.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestTermBytes3 extends CommonSpec { - @Test public void testTermBytes3() throws Exception { TermBytes3 r = TermBytes3.fromFile(SRC_DIR + "term_strz.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestTermBytes4.java b/spec/java/src/io/kaitai/struct/spec/TestTermBytes4.java index 2e5c6665d..48846f4b8 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestTermBytes4.java +++ b/spec/java/src/io/kaitai/struct/spec/TestTermBytes4.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestTermBytes4 extends CommonSpec { - @Test public void testTermBytes4() throws Exception { TermBytes4 r = TermBytes4.fromFile(SRC_DIR + "term_strz.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestTermStruct.java b/spec/java/src/io/kaitai/struct/spec/TestTermStruct.java index b35d795de..22e19f2db 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestTermStruct.java +++ b/spec/java/src/io/kaitai/struct/spec/TestTermStruct.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestTermStruct extends CommonSpec { - @Test public void testTermStruct() throws Exception { TermStruct r = TermStruct.fromFile(SRC_DIR + "term_strz.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestTermStruct2.java b/spec/java/src/io/kaitai/struct/spec/TestTermStruct2.java index a8c637089..5f8a1c0c2 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestTermStruct2.java +++ b/spec/java/src/io/kaitai/struct/spec/TestTermStruct2.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestTermStruct2 extends CommonSpec { - @Test public void testTermStruct2() throws Exception { TermStruct2 r = TermStruct2.fromFile(SRC_DIR + "term_strz.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestTermStruct3.java b/spec/java/src/io/kaitai/struct/spec/TestTermStruct3.java index ba016f346..4ef2e701d 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestTermStruct3.java +++ b/spec/java/src/io/kaitai/struct/spec/TestTermStruct3.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestTermStruct3 extends CommonSpec { - @Test public void testTermStruct3() throws Exception { TermStruct3 r = TermStruct3.fromFile(SRC_DIR + "term_strz.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestTermStruct4.java b/spec/java/src/io/kaitai/struct/spec/TestTermStruct4.java index 53bf51cdf..21976c92c 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestTermStruct4.java +++ b/spec/java/src/io/kaitai/struct/spec/TestTermStruct4.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestTermStruct4 extends CommonSpec { - @Test public void testTermStruct4() throws Exception { TermStruct4 r = TermStruct4.fromFile(SRC_DIR + "term_strz.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestTermStrz2.java b/spec/java/src/io/kaitai/struct/spec/TestTermStrz2.java index 7c4e1d49d..0921a6549 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestTermStrz2.java +++ b/spec/java/src/io/kaitai/struct/spec/TestTermStrz2.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestTermStrz2 extends CommonSpec { - @Test public void testTermStrz2() throws Exception { TermStrz2 r = TermStrz2.fromFile(SRC_DIR + "term_strz.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestTermStrz3.java b/spec/java/src/io/kaitai/struct/spec/TestTermStrz3.java index 1974d22a3..351424924 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestTermStrz3.java +++ b/spec/java/src/io/kaitai/struct/spec/TestTermStrz3.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestTermStrz3 extends CommonSpec { - @Test public void testTermStrz3() throws Exception { TermStrz3 r = TermStrz3.fromFile(SRC_DIR + "term_strz.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestTermStrz4.java b/spec/java/src/io/kaitai/struct/spec/TestTermStrz4.java index 74b16f639..9c1eeee07 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestTermStrz4.java +++ b/spec/java/src/io/kaitai/struct/spec/TestTermStrz4.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestTermStrz4 extends CommonSpec { - @Test public void testTermStrz4() throws Exception { TermStrz4 r = TermStrz4.fromFile(SRC_DIR + "term_strz.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestTermU1Val.java b/spec/java/src/io/kaitai/struct/spec/TestTermU1Val.java index 7013b6a2a..5e970a115 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestTermU1Val.java +++ b/spec/java/src/io/kaitai/struct/spec/TestTermU1Val.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestTermU1Val extends CommonSpec { - @Test public void testTermU1Val() throws Exception { TermU1Val r = TermU1Val.fromFile(SRC_DIR + "str_encodings.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestTypeTernary2ndFalsy.java b/spec/java/src/io/kaitai/struct/spec/TestTypeTernary2ndFalsy.java index 1823ece3c..8d046eca3 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestTypeTernary2ndFalsy.java +++ b/spec/java/src/io/kaitai/struct/spec/TestTypeTernary2ndFalsy.java @@ -6,22 +6,21 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestTypeTernary2ndFalsy extends CommonSpec { - @Test public void testTypeTernary2ndFalsy() throws Exception { TypeTernary2ndFalsy r = TypeTernary2ndFalsy.fromFile(SRC_DIR + "switch_integers.bin"); assertIntEquals(r.vFalse(), false); assertIntEquals(r.vIntZero(), 0); - assertIntEquals(r.vIntNegZero(), -0); + assertIntEquals(r.vIntNegZero(), 0); assertEquals(r.vFloatZero(), 0.0, 1e-6); assertEquals(r.vFloatNegZero(), -0.0, 1e-6); assertEquals(r.vStrWZero(), "0"); - assertIntEquals(r.vStrWZero().length(), 1); + assertIntEquals((r.vStrWZero()).length(), 1); assertIntEquals(r.ut().m(), 7); assertNull(r.vNullUt()); assertEquals(r.vStrEmpty(), ""); - assertIntEquals(r.vStrEmpty().length(), 0); + assertIntEquals((r.vStrEmpty()).length(), 0); assertIntEquals(r.intArray().size(), 2); assertIntEquals(r.vIntArrayEmpty().size(), 0); } diff --git a/spec/java/src/io/kaitai/struct/spec/TestTypeTernaryOpaque.java b/spec/java/src/io/kaitai/struct/spec/TestTypeTernaryOpaque.java index dadc4d63c..4a2747590 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestTypeTernaryOpaque.java +++ b/spec/java/src/io/kaitai/struct/spec/TestTypeTernaryOpaque.java @@ -1,14 +1,15 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + package io.kaitai.struct.spec; import io.kaitai.struct.testformats.TypeTernaryOpaque; import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestTypeTernaryOpaque extends CommonSpec { - @Test public void testTypeTernaryOpaque() throws Exception { TypeTernaryOpaque r = TypeTernaryOpaque.fromFile(SRC_DIR + "term_strz.bin"); - assertIntEquals(r.dif().one(), 102); + assertIntEquals(((Number) (r.dif().one())).intValue(), 102); } } diff --git a/spec/java/src/io/kaitai/struct/spec/TestValidEqStrEncodings.java b/spec/java/src/io/kaitai/struct/spec/TestValidEqStrEncodings.java index 0a2c9f32b..c5ce7edb7 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestValidEqStrEncodings.java +++ b/spec/java/src/io/kaitai/struct/spec/TestValidEqStrEncodings.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestValidEqStrEncodings extends CommonSpec { - @Test public void testValidEqStrEncodings() throws Exception { ValidEqStrEncodings r = ValidEqStrEncodings.fromFile(SRC_DIR + "str_encodings.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestValidFailAnyofInt.java b/spec/java/src/io/kaitai/struct/spec/TestValidFailAnyofInt.java index 6564046dd..77bc7437f 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestValidFailAnyofInt.java +++ b/spec/java/src/io/kaitai/struct/spec/TestValidFailAnyofInt.java @@ -7,7 +7,6 @@ import static org.testng.Assert.*; import io.kaitai.struct.KaitaiStream; public class TestValidFailAnyofInt extends CommonSpec { - @Test(expectedExceptions = KaitaiStream.ValidationNotAnyOfError.class) public void testValidFailAnyofInt() throws Exception { ValidFailAnyofInt r = ValidFailAnyofInt.fromFile(SRC_DIR + "fixed_struct.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestValidFailContents.java b/spec/java/src/io/kaitai/struct/spec/TestValidFailContents.java index 5a3953336..ab4d5bda4 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestValidFailContents.java +++ b/spec/java/src/io/kaitai/struct/spec/TestValidFailContents.java @@ -7,7 +7,6 @@ import static org.testng.Assert.*; import io.kaitai.struct.KaitaiStream; public class TestValidFailContents extends CommonSpec { - @Test(expectedExceptions = KaitaiStream.ValidationNotEqualError.class) public void testValidFailContents() throws Exception { ValidFailContents r = ValidFailContents.fromFile(SRC_DIR + "fixed_struct.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestValidFailEqBytes.java b/spec/java/src/io/kaitai/struct/spec/TestValidFailEqBytes.java index 0211b35c0..39c4c5902 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestValidFailEqBytes.java +++ b/spec/java/src/io/kaitai/struct/spec/TestValidFailEqBytes.java @@ -7,7 +7,6 @@ import static org.testng.Assert.*; import io.kaitai.struct.KaitaiStream; public class TestValidFailEqBytes extends CommonSpec { - @Test(expectedExceptions = KaitaiStream.ValidationNotEqualError.class) public void testValidFailEqBytes() throws Exception { ValidFailEqBytes r = ValidFailEqBytes.fromFile(SRC_DIR + "fixed_struct.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestValidFailEqInt.java b/spec/java/src/io/kaitai/struct/spec/TestValidFailEqInt.java index 9e93fd438..4080647db 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestValidFailEqInt.java +++ b/spec/java/src/io/kaitai/struct/spec/TestValidFailEqInt.java @@ -7,7 +7,6 @@ import static org.testng.Assert.*; import io.kaitai.struct.KaitaiStream; public class TestValidFailEqInt extends CommonSpec { - @Test(expectedExceptions = KaitaiStream.ValidationNotEqualError.class) public void testValidFailEqInt() throws Exception { ValidFailEqInt r = ValidFailEqInt.fromFile(SRC_DIR + "fixed_struct.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestValidFailEqStr.java b/spec/java/src/io/kaitai/struct/spec/TestValidFailEqStr.java index d45151068..9be4ef84d 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestValidFailEqStr.java +++ b/spec/java/src/io/kaitai/struct/spec/TestValidFailEqStr.java @@ -7,7 +7,6 @@ import static org.testng.Assert.*; import io.kaitai.struct.KaitaiStream; public class TestValidFailEqStr extends CommonSpec { - @Test(expectedExceptions = KaitaiStream.ValidationNotEqualError.class) public void testValidFailEqStr() throws Exception { ValidFailEqStr r = ValidFailEqStr.fromFile(SRC_DIR + "fixed_struct.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestValidFailExpr.java b/spec/java/src/io/kaitai/struct/spec/TestValidFailExpr.java index aaa67feb4..7e7439515 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestValidFailExpr.java +++ b/spec/java/src/io/kaitai/struct/spec/TestValidFailExpr.java @@ -7,7 +7,6 @@ import static org.testng.Assert.*; import io.kaitai.struct.KaitaiStream; public class TestValidFailExpr extends CommonSpec { - @Test(expectedExceptions = KaitaiStream.ValidationExprError.class) public void testValidFailExpr() throws Exception { ValidFailExpr r = ValidFailExpr.fromFile(SRC_DIR + "nav_parent_switch.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestValidFailInst.java b/spec/java/src/io/kaitai/struct/spec/TestValidFailInst.java index c52184b5e..308e9e646 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestValidFailInst.java +++ b/spec/java/src/io/kaitai/struct/spec/TestValidFailInst.java @@ -7,7 +7,6 @@ import static org.testng.Assert.*; import io.kaitai.struct.KaitaiStream; public class TestValidFailInst extends CommonSpec { - @Test(expectedExceptions = KaitaiStream.ValidationNotEqualError.class) public void testValidFailInst() throws Exception { ValidFailInst r = ValidFailInst.fromFile(SRC_DIR + "fixed_struct.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestValidFailMaxInt.java b/spec/java/src/io/kaitai/struct/spec/TestValidFailMaxInt.java index 69cb925d1..3690729c4 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestValidFailMaxInt.java +++ b/spec/java/src/io/kaitai/struct/spec/TestValidFailMaxInt.java @@ -7,7 +7,6 @@ import static org.testng.Assert.*; import io.kaitai.struct.KaitaiStream; public class TestValidFailMaxInt extends CommonSpec { - @Test(expectedExceptions = KaitaiStream.ValidationGreaterThanError.class) public void testValidFailMaxInt() throws Exception { ValidFailMaxInt r = ValidFailMaxInt.fromFile(SRC_DIR + "fixed_struct.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestValidFailMinInt.java b/spec/java/src/io/kaitai/struct/spec/TestValidFailMinInt.java index 68d69002c..a09a35c39 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestValidFailMinInt.java +++ b/spec/java/src/io/kaitai/struct/spec/TestValidFailMinInt.java @@ -7,7 +7,6 @@ import static org.testng.Assert.*; import io.kaitai.struct.KaitaiStream; public class TestValidFailMinInt extends CommonSpec { - @Test(expectedExceptions = KaitaiStream.ValidationLessThanError.class) public void testValidFailMinInt() throws Exception { ValidFailMinInt r = ValidFailMinInt.fromFile(SRC_DIR + "fixed_struct.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestValidFailRangeBytes.java b/spec/java/src/io/kaitai/struct/spec/TestValidFailRangeBytes.java index af38c3e32..b2e0bbe04 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestValidFailRangeBytes.java +++ b/spec/java/src/io/kaitai/struct/spec/TestValidFailRangeBytes.java @@ -7,7 +7,6 @@ import static org.testng.Assert.*; import io.kaitai.struct.KaitaiStream; public class TestValidFailRangeBytes extends CommonSpec { - @Test(expectedExceptions = KaitaiStream.ValidationGreaterThanError.class) public void testValidFailRangeBytes() throws Exception { ValidFailRangeBytes r = ValidFailRangeBytes.fromFile(SRC_DIR + "fixed_struct.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestValidFailRangeFloat.java b/spec/java/src/io/kaitai/struct/spec/TestValidFailRangeFloat.java index f8efa168e..2c76234e0 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestValidFailRangeFloat.java +++ b/spec/java/src/io/kaitai/struct/spec/TestValidFailRangeFloat.java @@ -7,7 +7,6 @@ import static org.testng.Assert.*; import io.kaitai.struct.KaitaiStream; public class TestValidFailRangeFloat extends CommonSpec { - @Test(expectedExceptions = KaitaiStream.ValidationGreaterThanError.class) public void testValidFailRangeFloat() throws Exception { ValidFailRangeFloat r = ValidFailRangeFloat.fromFile(SRC_DIR + "floating_points.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestValidFailRangeInt.java b/spec/java/src/io/kaitai/struct/spec/TestValidFailRangeInt.java index 922932237..43fe03a93 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestValidFailRangeInt.java +++ b/spec/java/src/io/kaitai/struct/spec/TestValidFailRangeInt.java @@ -7,7 +7,6 @@ import static org.testng.Assert.*; import io.kaitai.struct.KaitaiStream; public class TestValidFailRangeInt extends CommonSpec { - @Test(expectedExceptions = KaitaiStream.ValidationGreaterThanError.class) public void testValidFailRangeInt() throws Exception { ValidFailRangeInt r = ValidFailRangeInt.fromFile(SRC_DIR + "fixed_struct.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestValidFailRangeStr.java b/spec/java/src/io/kaitai/struct/spec/TestValidFailRangeStr.java index 8c0103af2..fe8590333 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestValidFailRangeStr.java +++ b/spec/java/src/io/kaitai/struct/spec/TestValidFailRangeStr.java @@ -7,7 +7,6 @@ import static org.testng.Assert.*; import io.kaitai.struct.KaitaiStream; public class TestValidFailRangeStr extends CommonSpec { - @Test(expectedExceptions = KaitaiStream.ValidationGreaterThanError.class) public void testValidFailRangeStr() throws Exception { ValidFailRangeStr r = ValidFailRangeStr.fromFile(SRC_DIR + "fixed_struct.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestValidLong.java b/spec/java/src/io/kaitai/struct/spec/TestValidLong.java index 416367470..504927023 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestValidLong.java +++ b/spec/java/src/io/kaitai/struct/spec/TestValidLong.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestValidLong extends CommonSpec { - @Test public void testValidLong() throws Exception { ValidLong r = ValidLong.fromFile(SRC_DIR + "fixed_struct.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestValidNotParsedIf.java b/spec/java/src/io/kaitai/struct/spec/TestValidNotParsedIf.java index 8dfb116c4..94041aaae 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestValidNotParsedIf.java +++ b/spec/java/src/io/kaitai/struct/spec/TestValidNotParsedIf.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestValidNotParsedIf extends CommonSpec { - @Test public void testValidNotParsedIf() throws Exception { ValidNotParsedIf r = ValidNotParsedIf.fromFile(SRC_DIR + "fixed_struct.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestValidOptionalId.java b/spec/java/src/io/kaitai/struct/spec/TestValidOptionalId.java index 8350ffd3f..bbbde48c1 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestValidOptionalId.java +++ b/spec/java/src/io/kaitai/struct/spec/TestValidOptionalId.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestValidOptionalId extends CommonSpec { - @Test public void testValidOptionalId() throws Exception { ValidOptionalId r = ValidOptionalId.fromFile(SRC_DIR + "fixed_struct.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestValidShort.java b/spec/java/src/io/kaitai/struct/spec/TestValidShort.java index 3a7688f43..bc5a3a4a7 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestValidShort.java +++ b/spec/java/src/io/kaitai/struct/spec/TestValidShort.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestValidShort extends CommonSpec { - @Test public void testValidShort() throws Exception { ValidShort r = ValidShort.fromFile(SRC_DIR + "fixed_struct.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestValidSwitch.java b/spec/java/src/io/kaitai/struct/spec/TestValidSwitch.java index 31209d98b..4402ed0b1 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestValidSwitch.java +++ b/spec/java/src/io/kaitai/struct/spec/TestValidSwitch.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestValidSwitch extends CommonSpec { - @Test public void testValidSwitch() throws Exception { ValidSwitch r = ValidSwitch.fromFile(SRC_DIR + "fixed_struct.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestZlibSurrounded.java b/spec/java/src/io/kaitai/struct/spec/TestZlibSurrounded.java index ec49d5d9b..0b4215803 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestZlibSurrounded.java +++ b/spec/java/src/io/kaitai/struct/spec/TestZlibSurrounded.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestZlibSurrounded extends CommonSpec { - @Test public void testZlibSurrounded() throws Exception { ZlibSurrounded r = ZlibSurrounded.fromFile(SRC_DIR + "zlib_surrounded.bin"); diff --git a/spec/ks/repeat_eos_u4.kst b/spec/ks/repeat_eos_u4.kst index 1989deb6f..836c74a6c 100644 --- a/spec/ks/repeat_eos_u4.kst +++ b/spec/ks/repeat_eos_u4.kst @@ -1,5 +1,13 @@ id: repeat_eos_u4 data: repeat_eos_struct.bin asserts: - - actual: numbers - expected: '[0, 0x42, 0x42, 0x815]' + - actual: numbers.size + expected: 4 + - actual: numbers[0] + expected: 0 + - actual: numbers[1] + expected: 0x42 + - actual: numbers[2] + expected: 0x42 + - actual: numbers[3] + expected: 0x815 diff --git a/translator/src/main/scala/io/kaitai/struct/testtranslator/specgenerators/JavaSG.scala b/translator/src/main/scala/io/kaitai/struct/testtranslator/specgenerators/JavaSG.scala index 5f8d077e9..29be9ef34 100644 --- a/translator/src/main/scala/io/kaitai/struct/testtranslator/specgenerators/JavaSG.scala +++ b/translator/src/main/scala/io/kaitai/struct/testtranslator/specgenerators/JavaSG.scala @@ -27,7 +27,6 @@ class JavaSG(spec: TestSpec, provider: ClassTypeProvider) extends BaseGenerator( override def header(): Unit = { out.puts(s"public class Test$className extends CommonSpec {") out.inc - out.puts } override def runParse(): Unit = { From 3d5cc8ae3bc3cf8a37331caf8c60e2e64256a0ef Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Sat, 1 Apr 2023 15:15:50 +0200 Subject: [PATCH 090/126] Java: simplify reading all bytes from a file in assertEqualToFullFile --- spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java b/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java index 5d14a4646..01b5404d1 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java +++ b/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java @@ -3,6 +3,8 @@ import java.io.IOException; import java.lang.reflect.Method; import java.lang.reflect.Modifier; +import java.nio.file.Files; +import java.nio.file.Paths; import java.util.ArrayList; import java.util.HashMap; import java.util.IdentityHashMap; @@ -57,10 +59,7 @@ protected void testReadWriteRoundtrip() throws Exception { } protected void assertEqualToFullFile(KaitaiStruct.ReadWrite struct, String fn) throws IOException { - byte[] expected; - try (KaitaiStream expFile = new ByteBufferKaitaiStream(SRC_DIR + fn)) { - expected = expFile.toByteArray(); - } + byte[] expected = Files.readAllBytes(Paths.get(SRC_DIR + fn)); struct._check(); byte[] actual = new byte[expected.length]; try (KaitaiStream actIo = new ByteBufferKaitaiStream(actual)) { From edd6a44536152f8c1c4bf795ef4c85a4ba660f3e Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Fri, 21 Jul 2023 17:43:26 +0200 Subject: [PATCH 091/126] Add EofExceptionBits{Be,Le}{,2}, add Python read+write specs for it See https://github.com/kaitai-io/kaitai_struct_python_runtime/commit/ced78c44b448427396170e41350763dd60e4ba99 --- formats/eof_exception_bits_be.ksy | 11 ++++++++ formats/eof_exception_bits_be2.ksy | 11 ++++++++ formats/eof_exception_bits_le.ksy | 12 +++++++++ formats/eof_exception_bits_le2.ksy | 12 +++++++++ spec/ks/eof_exception_bits_be.kst | 3 +++ spec/ks/eof_exception_bits_be2.kst | 3 +++ spec/ks/eof_exception_bits_le.kst | 3 +++ spec/ks/eof_exception_bits_le2.kst | 3 +++ .../python/spec/test_eof_exception_bits_be.py | 17 ++++++++++++ .../spec/test_eof_exception_bits_be2.py | 17 ++++++++++++ .../python/spec/test_eof_exception_bits_le.py | 17 ++++++++++++ .../spec/test_eof_exception_bits_le2.py | 17 ++++++++++++ .../specwrite/test_eof_exception_bits_be.py | 26 +++++++++++++++++++ .../specwrite/test_eof_exception_bits_be2.py | 26 +++++++++++++++++++ .../specwrite/test_eof_exception_bits_le.py | 26 +++++++++++++++++++ .../specwrite/test_eof_exception_bits_le2.py | 26 +++++++++++++++++++ 16 files changed, 230 insertions(+) create mode 100644 formats/eof_exception_bits_be.ksy create mode 100644 formats/eof_exception_bits_be2.ksy create mode 100644 formats/eof_exception_bits_le.ksy create mode 100644 formats/eof_exception_bits_le2.ksy create mode 100644 spec/ks/eof_exception_bits_be.kst create mode 100644 spec/ks/eof_exception_bits_be2.kst create mode 100644 spec/ks/eof_exception_bits_le.kst create mode 100644 spec/ks/eof_exception_bits_le2.kst create mode 100644 spec/python/spec/test_eof_exception_bits_be.py create mode 100644 spec/python/spec/test_eof_exception_bits_be2.py create mode 100644 spec/python/spec/test_eof_exception_bits_le.py create mode 100644 spec/python/spec/test_eof_exception_bits_le2.py create mode 100644 spec/python/specwrite/test_eof_exception_bits_be.py create mode 100644 spec/python/specwrite/test_eof_exception_bits_be2.py create mode 100644 spec/python/specwrite/test_eof_exception_bits_le.py create mode 100644 spec/python/specwrite/test_eof_exception_bits_le2.py diff --git a/formats/eof_exception_bits_be.ksy b/formats/eof_exception_bits_be.ksy new file mode 100644 index 000000000..ac110e15b --- /dev/null +++ b/formats/eof_exception_bits_be.ksy @@ -0,0 +1,11 @@ +meta: + id: eof_exception_bits_be + bit-endian: be + ks-debug: true +seq: + - id: pre_bits + type: b7 + # only 2 full bytes (17 bits) available in the stream, should fail with EOF + # exception + - id: fail_bits + type: b18 diff --git a/formats/eof_exception_bits_be2.ksy b/formats/eof_exception_bits_be2.ksy new file mode 100644 index 000000000..ec01386d1 --- /dev/null +++ b/formats/eof_exception_bits_be2.ksy @@ -0,0 +1,11 @@ +meta: + id: eof_exception_bits_be2 + bit-endian: be + ks-debug: true +seq: + - id: pre_bits + type: b8 + # only 2 full bytes (16 bits) available in the stream, should fail with EOF + # exception + - id: fail_bits + type: b17 diff --git a/formats/eof_exception_bits_le.ksy b/formats/eof_exception_bits_le.ksy new file mode 100644 index 000000000..215acdfb5 --- /dev/null +++ b/formats/eof_exception_bits_le.ksy @@ -0,0 +1,12 @@ +# Like "eof_exception_bits_be", but for little-endian order. +meta: + id: eof_exception_bits_le + bit-endian: le + ks-debug: true +seq: + - id: pre_bits + type: b7 + # only 2 full bytes (17 bits) available in the stream, should fail with EOF + # exception + - id: fail_bits + type: b18 diff --git a/formats/eof_exception_bits_le2.ksy b/formats/eof_exception_bits_le2.ksy new file mode 100644 index 000000000..d6a514304 --- /dev/null +++ b/formats/eof_exception_bits_le2.ksy @@ -0,0 +1,12 @@ +# Like "eof_exception_bits_be2", but for little-endian order. +meta: + id: eof_exception_bits_le2 + bit-endian: le + ks-debug: true +seq: + - id: pre_bits + type: b8 + # only 2 full bytes (16 bits) available in the stream, should fail with EOF + # exception + - id: fail_bits + type: b17 diff --git a/spec/ks/eof_exception_bits_be.kst b/spec/ks/eof_exception_bits_be.kst new file mode 100644 index 000000000..68449b967 --- /dev/null +++ b/spec/ks/eof_exception_bits_be.kst @@ -0,0 +1,3 @@ +id: eof_exception_bits_be +data: nav_parent_switch.bin +exception: EndOfStreamError diff --git a/spec/ks/eof_exception_bits_be2.kst b/spec/ks/eof_exception_bits_be2.kst new file mode 100644 index 000000000..8e4ba0967 --- /dev/null +++ b/spec/ks/eof_exception_bits_be2.kst @@ -0,0 +1,3 @@ +id: eof_exception_bits_be2 +data: nav_parent_switch.bin +exception: EndOfStreamError diff --git a/spec/ks/eof_exception_bits_le.kst b/spec/ks/eof_exception_bits_le.kst new file mode 100644 index 000000000..9a025be1d --- /dev/null +++ b/spec/ks/eof_exception_bits_le.kst @@ -0,0 +1,3 @@ +id: eof_exception_bits_le +data: nav_parent_switch.bin +exception: EndOfStreamError diff --git a/spec/ks/eof_exception_bits_le2.kst b/spec/ks/eof_exception_bits_le2.kst new file mode 100644 index 000000000..37de92307 --- /dev/null +++ b/spec/ks/eof_exception_bits_le2.kst @@ -0,0 +1,3 @@ +id: eof_exception_bits_le2 +data: nav_parent_switch.bin +exception: EndOfStreamError diff --git a/spec/python/spec/test_eof_exception_bits_be.py b/spec/python/spec/test_eof_exception_bits_be.py new file mode 100644 index 000000000..abc78a60d --- /dev/null +++ b/spec/python/spec/test_eof_exception_bits_be.py @@ -0,0 +1,17 @@ +import unittest +import kaitaistruct + +from testformats.eof_exception_bits_be import EofExceptionBitsBe + +class TestEofExceptionBitsBe(unittest.TestCase): + def test_eof_exception_bits_be(self): + with EofExceptionBitsBe.from_file('src/nav_parent_switch.bin') as r: + with self.assertRaisesRegexp(EOFError, u"^requested 3 bytes, but only 2 bytes available$"): + r._read() + + self.assertEqual(r._io.pos(), 1) + + self.assertEqual(r.pre_bits, 0b0000000) # 0b0000_000 + self.assertEqual(r._debug['fail_bits']['start'], 1) + self.assertFalse(hasattr(r, 'fail_bits')) + self.assertFalse(hasattr(r._debug['fail_bits'], 'end')) diff --git a/spec/python/spec/test_eof_exception_bits_be2.py b/spec/python/spec/test_eof_exception_bits_be2.py new file mode 100644 index 000000000..26ea93d62 --- /dev/null +++ b/spec/python/spec/test_eof_exception_bits_be2.py @@ -0,0 +1,17 @@ +import unittest +import kaitaistruct + +from testformats.eof_exception_bits_be2 import EofExceptionBitsBe2 + +class TestEofExceptionBitsBe2(unittest.TestCase): + def test_eof_exception_bits_be2(self): + with EofExceptionBitsBe2.from_file('src/nav_parent_switch.bin') as r: + with self.assertRaisesRegexp(EOFError, u"^requested 3 bytes, but only 2 bytes available$"): + r._read() + + self.assertEqual(r._io.pos(), 1) + + self.assertEqual(r.pre_bits, 0x01) + self.assertEqual(r._debug['fail_bits']['start'], 1) + self.assertFalse(hasattr(r, 'fail_bits')) + self.assertFalse(hasattr(r._debug['fail_bits'], 'end')) diff --git a/spec/python/spec/test_eof_exception_bits_le.py b/spec/python/spec/test_eof_exception_bits_le.py new file mode 100644 index 000000000..a1a74dfa8 --- /dev/null +++ b/spec/python/spec/test_eof_exception_bits_le.py @@ -0,0 +1,17 @@ +import unittest +import kaitaistruct + +from testformats.eof_exception_bits_le import EofExceptionBitsLe + +class TestEofExceptionBitsLe(unittest.TestCase): + def test_eof_exception_bits_le(self): + with EofExceptionBitsLe.from_file('src/nav_parent_switch.bin') as r: + with self.assertRaisesRegexp(EOFError, u"^requested 3 bytes, but only 2 bytes available$"): + r._read() + + self.assertEqual(r._io.pos(), 1) + + self.assertEqual(r.pre_bits, 0b0000001) # 0b000_0001 + self.assertEqual(r._debug['fail_bits']['start'], 1) + self.assertFalse(hasattr(r, 'fail_bits')) + self.assertFalse(hasattr(r._debug['fail_bits'], 'end')) diff --git a/spec/python/spec/test_eof_exception_bits_le2.py b/spec/python/spec/test_eof_exception_bits_le2.py new file mode 100644 index 000000000..224ad8ada --- /dev/null +++ b/spec/python/spec/test_eof_exception_bits_le2.py @@ -0,0 +1,17 @@ +import unittest +import kaitaistruct + +from testformats.eof_exception_bits_le2 import EofExceptionBitsLe2 + +class TestEofExceptionBitsLe2(unittest.TestCase): + def test_eof_exception_bits_le2(self): + with EofExceptionBitsLe2.from_file('src/nav_parent_switch.bin') as r: + with self.assertRaisesRegexp(EOFError, u"^requested 3 bytes, but only 2 bytes available$"): + r._read() + + self.assertEqual(r._io.pos(), 1) + + self.assertEqual(r.pre_bits, 0x01) + self.assertEqual(r._debug['fail_bits']['start'], 1) + self.assertFalse(hasattr(r, 'fail_bits')) + self.assertFalse(hasattr(r._debug['fail_bits'], 'end')) diff --git a/spec/python/specwrite/test_eof_exception_bits_be.py b/spec/python/specwrite/test_eof_exception_bits_be.py new file mode 100644 index 000000000..772787486 --- /dev/null +++ b/spec/python/specwrite/test_eof_exception_bits_be.py @@ -0,0 +1,26 @@ +import unittest +import io +from kaitaistruct import KaitaiStream +from specwrite.common_spec import CommonSpec + +from testwrite.eof_exception_bits_be import EofExceptionBitsBe + +class TestEofExceptionBitsBe(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestEofExceptionBitsBe, self).__init__(*args, **kwargs) + self.struct_class = EofExceptionBitsBe + self.src_filename = 'src/nav_parent_switch.bin' + + def test_read_write_roundtrip(self): + self.skipTest("cannot use roundtrip because parsing is expected to fail") + + def test_eof_exception_bits_be(self): + r = EofExceptionBitsBe() + r.pre_bits = 0b0000000 # 0b0000_000 + r.fail_bits = 0b101000010111111110 # 0b1_01000010_11111111_0 + r._check() + + with KaitaiStream(io.BytesIO(bytearray(3))) as out_io: + with self.assertRaisesRegexp(EOFError, u"^requested to write 3 bytes, but only 2 bytes left in the stream$"): + r._write__seq(out_io) + self.assertEqual(out_io.pos(), 1) diff --git a/spec/python/specwrite/test_eof_exception_bits_be2.py b/spec/python/specwrite/test_eof_exception_bits_be2.py new file mode 100644 index 000000000..ae6868b9f --- /dev/null +++ b/spec/python/specwrite/test_eof_exception_bits_be2.py @@ -0,0 +1,26 @@ +import unittest +import io +from kaitaistruct import KaitaiStream +from specwrite.common_spec import CommonSpec + +from testwrite.eof_exception_bits_be2 import EofExceptionBitsBe2 + +class TestEofExceptionBitsBe2(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestEofExceptionBitsBe2, self).__init__(*args, **kwargs) + self.struct_class = EofExceptionBitsBe2 + self.src_filename = 'src/nav_parent_switch.bin' + + def test_read_write_roundtrip(self): + self.skipTest("cannot use roundtrip because parsing is expected to fail") + + def test_eof_exception_bits_be2(self): + r = EofExceptionBitsBe2() + r.pre_bits = 0x01 + r.fail_bits = 0b01000010111111110 # 0b01000010_11111111_0 + r._check() + + with KaitaiStream(io.BytesIO(bytearray(3))) as out_io: + with self.assertRaisesRegexp(EOFError, u"^requested to write 3 bytes, but only 2 bytes left in the stream$"): + r._write__seq(out_io) + self.assertEqual(out_io.pos(), 1) diff --git a/spec/python/specwrite/test_eof_exception_bits_le.py b/spec/python/specwrite/test_eof_exception_bits_le.py new file mode 100644 index 000000000..b7fa601d5 --- /dev/null +++ b/spec/python/specwrite/test_eof_exception_bits_le.py @@ -0,0 +1,26 @@ +import unittest +import io +from kaitaistruct import KaitaiStream +from specwrite.common_spec import CommonSpec + +from testwrite.eof_exception_bits_le import EofExceptionBitsLe + +class TestEofExceptionBitsLe(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestEofExceptionBitsLe, self).__init__(*args, **kwargs) + self.struct_class = EofExceptionBitsLe + self.src_filename = 'src/nav_parent_switch.bin' + + def test_read_write_roundtrip(self): + self.skipTest("cannot use roundtrip because parsing is expected to fail") + + def test_eof_exception_bits_le(self): + r = EofExceptionBitsLe() + r.pre_bits = 0b0000001 # 0b000_0001 + r.fail_bits = 0b011111111010000100 # 0b0_11111111_01000010_0 + r._check() + + with KaitaiStream(io.BytesIO(bytearray(3))) as out_io: + with self.assertRaisesRegexp(EOFError, u"^requested to write 3 bytes, but only 2 bytes left in the stream$"): + r._write__seq(out_io) + self.assertEqual(out_io.pos(), 1) diff --git a/spec/python/specwrite/test_eof_exception_bits_le2.py b/spec/python/specwrite/test_eof_exception_bits_le2.py new file mode 100644 index 000000000..3e1b0cec7 --- /dev/null +++ b/spec/python/specwrite/test_eof_exception_bits_le2.py @@ -0,0 +1,26 @@ +import unittest +import io +from kaitaistruct import KaitaiStream +from specwrite.common_spec import CommonSpec + +from testwrite.eof_exception_bits_le2 import EofExceptionBitsLe2 + +class TestEofExceptionBitsLe2(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestEofExceptionBitsLe2, self).__init__(*args, **kwargs) + self.struct_class = EofExceptionBitsLe2 + self.src_filename = 'src/nav_parent_switch.bin' + + def test_read_write_roundtrip(self): + self.skipTest("cannot use roundtrip because parsing is expected to fail") + + def test_eof_exception_bits_le2(self): + r = EofExceptionBitsLe2() + r.pre_bits = 0x01 + r.fail_bits = 0b01111111101000010 # 0b0_11111111_01000010 + r._check() + + with KaitaiStream(io.BytesIO(bytearray(3))) as out_io: + with self.assertRaisesRegexp(EOFError, u"^requested to write 3 bytes, but only 2 bytes left in the stream$"): + r._write__seq(out_io) + self.assertEqual(out_io.pos(), 1) From 9a950cfec8b7ffbd2e3a9a24f313ac84ce8c9d59 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Fri, 21 Jul 2023 17:44:58 +0200 Subject: [PATCH 092/126] Simplify ExprIoEofBits, adjust Python test specs --- formats/expr_io_eof_bits.ksy | 25 ++++++------------- spec/ks/expr_io_eof_bits.kst | 17 ++++++++----- spec/python/spec/test_expr_io_eof_bits.py | 9 +++---- .../python/specwrite/test_expr_io_eof_bits.py | 24 ++---------------- 4 files changed, 24 insertions(+), 51 deletions(-) diff --git a/formats/expr_io_eof_bits.ksy b/formats/expr_io_eof_bits.ksy index 83dccf29c..2868e8289 100644 --- a/formats/expr_io_eof_bits.ksy +++ b/formats/expr_io_eof_bits.ksy @@ -9,23 +9,12 @@ seq: - id: bar type: b4 if: not _io.eof - # `_io.eof` is expected to be true, so we "assert" it like this - if `_io.eof` - # is false, it will attempt to consume 8 bytes, which would trigger a EOF - # exception. - - id: assert_io_eof_before_baz - size: '_io.eof ? 0 : 8' - - # 0 bits available at this point. When parsing, this is basically guaranteed - # to fail with EOF exception immediately (because it would translate to - # requesting more bytes, which are not available). But when writing, it - # would succeed until an attempt to align the stream to a byte position is - # done - which should happen at the latest when the stream is closed. + # EOF reached here - id: baz - type: b3 - - # `_io.eof` is expected to be true, so we "assert" it like this - if `_io.eof` - # is false, it will attempt to consume 8 bytes, which would trigger a EOF - # exception. - - id: assert_io_eof_after_baz - size: 8 + type: b16 + if: not _io.eof + - id: align + size: 0 + - id: qux + type: b16 if: not _io.eof diff --git a/spec/ks/expr_io_eof_bits.kst b/spec/ks/expr_io_eof_bits.kst index fcbe65c1b..52bb6eace 100644 --- a/spec/ks/expr_io_eof_bits.kst +++ b/spec/ks/expr_io_eof_bits.kst @@ -1,8 +1,13 @@ id: expr_io_eof_bits data: nav_parent_switch.bin -exception: EndOfStreamError -# asserts: -# - actual: foo -# expected: 0x01_42_f -# - actual: bar -# expected: 0xf +asserts: + - actual: foo + expected: 0x01_42_f + - actual: bar + expected: 0xf + - actual: baz + expected: 'null' + - actual: align + expected: '[].as' + - actual: qux + expected: 'null' diff --git a/spec/python/spec/test_expr_io_eof_bits.py b/spec/python/spec/test_expr_io_eof_bits.py index 2c67746fc..dd9c61a01 100644 --- a/spec/python/spec/test_expr_io_eof_bits.py +++ b/spec/python/spec/test_expr_io_eof_bits.py @@ -1,15 +1,14 @@ import unittest -import kaitaistruct from testformats.expr_io_eof_bits import ExprIoEofBits class TestExprIoEofBits(unittest.TestCase): def test_expr_io_eof_bits(self): with ExprIoEofBits.from_file('src/nav_parent_switch.bin') as r: - with self.assertRaisesRegexp(EOFError, u"^requested 1 bytes, but only 0 bytes available$"): - r._read() + r._read() + self.assertEqual(r.foo, 5167) self.assertEqual(r.bar, 15) - self.assertEqual(r.assert_io_eof_before_baz, b"") self.assertFalse(hasattr(r, 'baz')) - self.assertFalse(hasattr(r, 'assert_io_eof_after_baz')) + self.assertEqual(r.align, b'') + self.assertFalse(hasattr(r, 'qux')) diff --git a/spec/python/specwrite/test_expr_io_eof_bits.py b/spec/python/specwrite/test_expr_io_eof_bits.py index a3fd8d6c7..e30c0980e 100644 --- a/spec/python/specwrite/test_expr_io_eof_bits.py +++ b/spec/python/specwrite/test_expr_io_eof_bits.py @@ -1,6 +1,6 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + import unittest -import io -from kaitaistruct import KaitaiStream from specwrite.common_spec import CommonSpec from testwrite.expr_io_eof_bits import ExprIoEofBits @@ -11,23 +11,3 @@ def __init__(self, *args, **kwargs): self.struct_class = ExprIoEofBits self.src_filename = 'src/nav_parent_switch.bin' - def test_read_write_roundtrip(self): - self.skipTest("cannot use roundtrip because parsing is expected to fail") - - def test_expr_io_eof_bits(self): - with KaitaiStream(io.open(self.src_filename, 'rb')) as orig_io: - orig_io_size = orig_io.size() - - r = ExprIoEofBits() - r.foo = 5167 - r.bar = 15 - r.assert_io_eof_before_baz = b"" - r.baz = 6 - r.assert_io_eof_after_baz = b"\x00" * 8 # doesn't matter - r._check() - - new_io = KaitaiStream(io.BytesIO(bytearray(orig_io_size))) - r._write__seq(new_io) - - with self.assertRaisesRegexp(EOFError, u"^requested to write 1 bytes, but only 0 bytes left in the stream$"): - r.close() From 8bc02aa185f4204f83f2f5147149c223ed8d05ae Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Wed, 26 Jul 2023 00:00:21 +0200 Subject: [PATCH 093/126] Fix EofExceptionBits{Be,Le}{,2} Python specs --- spec/python/spec/test_eof_exception_bits_be.py | 3 ++- spec/python/spec/test_eof_exception_bits_be2.py | 3 ++- spec/python/spec/test_eof_exception_bits_le.py | 3 ++- spec/python/spec/test_eof_exception_bits_le2.py | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/spec/python/spec/test_eof_exception_bits_be.py b/spec/python/spec/test_eof_exception_bits_be.py index abc78a60d..f7440f9db 100644 --- a/spec/python/spec/test_eof_exception_bits_be.py +++ b/spec/python/spec/test_eof_exception_bits_be.py @@ -12,6 +12,7 @@ def test_eof_exception_bits_be(self): self.assertEqual(r._io.pos(), 1) self.assertEqual(r.pre_bits, 0b0000000) # 0b0000_000 + self.assertIn('start', r._debug['fail_bits']) self.assertEqual(r._debug['fail_bits']['start'], 1) self.assertFalse(hasattr(r, 'fail_bits')) - self.assertFalse(hasattr(r._debug['fail_bits'], 'end')) + self.assertNotIn('end', r._debug['fail_bits']) diff --git a/spec/python/spec/test_eof_exception_bits_be2.py b/spec/python/spec/test_eof_exception_bits_be2.py index 26ea93d62..5df04ff59 100644 --- a/spec/python/spec/test_eof_exception_bits_be2.py +++ b/spec/python/spec/test_eof_exception_bits_be2.py @@ -12,6 +12,7 @@ def test_eof_exception_bits_be2(self): self.assertEqual(r._io.pos(), 1) self.assertEqual(r.pre_bits, 0x01) + self.assertIn('start', r._debug['fail_bits']) self.assertEqual(r._debug['fail_bits']['start'], 1) self.assertFalse(hasattr(r, 'fail_bits')) - self.assertFalse(hasattr(r._debug['fail_bits'], 'end')) + self.assertNotIn('end', r._debug['fail_bits']) diff --git a/spec/python/spec/test_eof_exception_bits_le.py b/spec/python/spec/test_eof_exception_bits_le.py index a1a74dfa8..2832b96cb 100644 --- a/spec/python/spec/test_eof_exception_bits_le.py +++ b/spec/python/spec/test_eof_exception_bits_le.py @@ -12,6 +12,7 @@ def test_eof_exception_bits_le(self): self.assertEqual(r._io.pos(), 1) self.assertEqual(r.pre_bits, 0b0000001) # 0b000_0001 + self.assertIn('start', r._debug['fail_bits']) self.assertEqual(r._debug['fail_bits']['start'], 1) self.assertFalse(hasattr(r, 'fail_bits')) - self.assertFalse(hasattr(r._debug['fail_bits'], 'end')) + self.assertNotIn('end', r._debug['fail_bits']) diff --git a/spec/python/spec/test_eof_exception_bits_le2.py b/spec/python/spec/test_eof_exception_bits_le2.py index 224ad8ada..4c1111dd2 100644 --- a/spec/python/spec/test_eof_exception_bits_le2.py +++ b/spec/python/spec/test_eof_exception_bits_le2.py @@ -12,6 +12,7 @@ def test_eof_exception_bits_le2(self): self.assertEqual(r._io.pos(), 1) self.assertEqual(r.pre_bits, 0x01) + self.assertIn('start', r._debug['fail_bits']) self.assertEqual(r._debug['fail_bits']['start'], 1) self.assertFalse(hasattr(r, 'fail_bits')) - self.assertFalse(hasattr(r._debug['fail_bits'], 'end')) + self.assertNotIn('end', r._debug['fail_bits']) From 03939b68521eec6814f230a10f38015ad7388075 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Wed, 26 Jul 2023 20:55:07 +0200 Subject: [PATCH 094/126] Port EofExceptionBits{Be,Le}{,2} and regen ExprIoEofBits to Java --- .../struct/spec/TestEofExceptionBitsBe.java | 23 ++++++ .../struct/spec/TestEofExceptionBitsBe2.java | 25 +++++++ .../struct/spec/TestEofExceptionBitsLe.java | 25 +++++++ .../struct/spec/TestEofExceptionBitsLe2.java | 25 +++++++ .../kaitai/struct/spec/TestExprIoEofBits.java | 14 +--- .../specwrite/TestEofExceptionBitsBe.java | 73 +++++++++++++++++++ .../specwrite/TestEofExceptionBitsBe2.java | 73 +++++++++++++++++++ .../specwrite/TestEofExceptionBitsLe.java | 73 +++++++++++++++++++ .../specwrite/TestEofExceptionBitsLe2.java | 73 +++++++++++++++++++ .../struct/specwrite/TestExprIoEofBits.java | 68 +---------------- spec/ks/eof_exception_bits_be.kst | 5 ++ spec/ks/eof_exception_bits_be2.kst | 5 ++ spec/ks/eof_exception_bits_le.kst | 5 ++ spec/ks/eof_exception_bits_le2.kst | 5 ++ 14 files changed, 418 insertions(+), 74 deletions(-) create mode 100644 spec/java/src/io/kaitai/struct/spec/TestEofExceptionBitsBe.java create mode 100644 spec/java/src/io/kaitai/struct/spec/TestEofExceptionBitsBe2.java create mode 100644 spec/java/src/io/kaitai/struct/spec/TestEofExceptionBitsLe.java create mode 100644 spec/java/src/io/kaitai/struct/spec/TestEofExceptionBitsLe2.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBitsBe.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBitsBe2.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBitsLe.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBitsLe2.java diff --git a/spec/java/src/io/kaitai/struct/spec/TestEofExceptionBitsBe.java b/spec/java/src/io/kaitai/struct/spec/TestEofExceptionBitsBe.java new file mode 100644 index 000000000..d55f52c14 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestEofExceptionBitsBe.java @@ -0,0 +1,23 @@ +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.EofExceptionBitsBe; +import org.testng.annotations.Test; +import static org.testng.Assert.*; +public class TestEofExceptionBitsBe extends CommonSpec { + @Test + public void testEofExceptionBitsBe() throws Exception { + EofExceptionBitsBe r = EofExceptionBitsBe.fromFile(SRC_DIR + "nav_parent_switch.bin"); + assertThrowsEofError(new ThrowingRunnable() { + @Override + public void run() throws Throwable { + r._read(); + } + }); + assertIntEquals(r._io().pos(), 1); + assertIntEquals(r.preBits(), 0); + assertTrue(r._attrStart.containsKey("failBits")); + assertIntEquals(r._attrStart.get("failBits"), 1); + assertIntEquals(r.failBits(), 0); // actually uninitialized, hence 0 in Java + assertFalse(r._attrEnd.containsKey("failBits")); + } +} diff --git a/spec/java/src/io/kaitai/struct/spec/TestEofExceptionBitsBe2.java b/spec/java/src/io/kaitai/struct/spec/TestEofExceptionBitsBe2.java new file mode 100644 index 000000000..6b7f91310 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestEofExceptionBitsBe2.java @@ -0,0 +1,25 @@ +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.EofExceptionBitsBe2; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +import org.testng.Assert.ThrowingRunnable; +public class TestEofExceptionBitsBe2 extends CommonSpec { + @Test + public void testEofExceptionBitsBe2() throws Exception { + EofExceptionBitsBe2 r = EofExceptionBitsBe2.fromFile(SRC_DIR + "nav_parent_switch.bin"); + assertThrowsEofError(new ThrowingRunnable() { + @Override + public void run() throws Throwable { + r._read(); + } + }); + assertIntEquals(r._io().pos(), 1); + assertIntEquals(r.preBits(), 1); + assertTrue(r._attrStart.containsKey("failBits")); + assertIntEquals(r._attrStart.get("failBits"), 1); + assertIntEquals(r.failBits(), 0); // actually uninitialized, hence 0 in Java + assertFalse(r._attrEnd.containsKey("failBits")); + } +} diff --git a/spec/java/src/io/kaitai/struct/spec/TestEofExceptionBitsLe.java b/spec/java/src/io/kaitai/struct/spec/TestEofExceptionBitsLe.java new file mode 100644 index 000000000..10ed19d12 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestEofExceptionBitsLe.java @@ -0,0 +1,25 @@ +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.EofExceptionBitsLe; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +import org.testng.Assert.ThrowingRunnable; +public class TestEofExceptionBitsLe extends CommonSpec { + @Test + public void testEofExceptionBitsLe() throws Exception { + EofExceptionBitsLe r = EofExceptionBitsLe.fromFile(SRC_DIR + "nav_parent_switch.bin"); + assertThrowsEofError(new ThrowingRunnable() { + @Override + public void run() throws Throwable { + r._read(); + } + }); + assertIntEquals(r._io().pos(), 1); + assertIntEquals(r.preBits(), 1); + assertTrue(r._attrStart.containsKey("failBits")); + assertIntEquals(r._attrStart.get("failBits"), 1); + assertIntEquals(r.failBits(), 0); // actually uninitialized, hence 0 in Java + assertFalse(r._attrEnd.containsKey("failBits")); + } +} diff --git a/spec/java/src/io/kaitai/struct/spec/TestEofExceptionBitsLe2.java b/spec/java/src/io/kaitai/struct/spec/TestEofExceptionBitsLe2.java new file mode 100644 index 000000000..be2fc9a27 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestEofExceptionBitsLe2.java @@ -0,0 +1,25 @@ +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.EofExceptionBitsLe2; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +import org.testng.Assert.ThrowingRunnable; +public class TestEofExceptionBitsLe2 extends CommonSpec { + @Test + public void testEofExceptionBitsLe2() throws Exception { + EofExceptionBitsLe2 r = EofExceptionBitsLe2.fromFile(SRC_DIR + "nav_parent_switch.bin"); + assertThrowsEofError(new ThrowingRunnable() { + @Override + public void run() throws Throwable { + r._read(); + } + }); + assertIntEquals(r._io().pos(), 1); + assertIntEquals(r.preBits(), 1); + assertTrue(r._attrStart.containsKey("failBits")); + assertIntEquals(r._attrStart.get("failBits"), 1); + assertIntEquals(r.failBits(), 0); // actually uninitialized, hence 0 in Java + assertFalse(r._attrEnd.containsKey("failBits")); + } +} diff --git a/spec/java/src/io/kaitai/struct/spec/TestExprIoEofBits.java b/spec/java/src/io/kaitai/struct/spec/TestExprIoEofBits.java index b029db43d..ffce635a4 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestExprIoEofBits.java +++ b/spec/java/src/io/kaitai/struct/spec/TestExprIoEofBits.java @@ -3,22 +3,16 @@ import io.kaitai.struct.testformats.ExprIoEofBits; import org.testng.annotations.Test; import static org.testng.Assert.*; -import io.kaitai.struct.KaitaiStream; public class TestExprIoEofBits extends CommonSpec { - @Test public void testExprIoEofBits() throws Exception { ExprIoEofBits r = ExprIoEofBits.fromFile(SRC_DIR + "nav_parent_switch.bin"); - - assertThrowsEofError(new ThrowingRunnable() { - @Override - public void run() throws Throwable { - r._read(); - } - }); + r._read(); assertIntEquals(r.foo(), 5167); assertIntEquals(r.bar(), 15); - assertEquals(r.assertIoEofBeforeBaz(), new byte[] { }); + assertNull(r.baz()); + assertEquals(r.align(), new byte[] { }); + assertNull(r.qux()); } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBitsBe.java b/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBitsBe.java new file mode 100644 index 000000000..0f8def5ee --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBitsBe.java @@ -0,0 +1,73 @@ +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.ByteBufferKaitaiStream; +import io.kaitai.struct.KaitaiStream; +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.RandomAccessFileKaitaiStream; +import io.kaitai.struct.testwrite.EofExceptionBitsBe; + +import java.io.File; +import java.io.RandomAccessFile; + +import org.testng.Assert.ThrowingRunnable; +import org.testng.annotations.Test; +import static org.testng.Assert.assertEquals; + +public class TestEofExceptionBitsBe extends CommonSpec { + @Override + protected Class getStructClass() { + throw new UnsupportedOperationException(); + } + + @Override + protected String getSrcFilename() { + throw new UnsupportedOperationException(); + } + + @Test + public void testEofExceptionBitsBeBB() throws Exception { + EofExceptionBitsBe r = getEofExceptionBitsBe(); + + try (KaitaiStream io = new ByteBufferKaitaiStream(3)) { + assertThrowsEofError(new ThrowingRunnable() { + @Override + public void run() throws Throwable { + r._write_Seq(io); + } + }); + assertIntEquals(io.pos(), 1); + } + } + + @Test + public void testEofExceptionBitsBeRAF() throws Exception { + EofExceptionBitsBe r = getEofExceptionBitsBe(); + + File file = new File(SCRATCH_DIR + "specwrite_TestEofExceptionBitsBe.bin"); + RandomAccessFile raf = new RandomAccessFile(file, "rw"); + raf.setLength(3); + + Throwable thr; + try (KaitaiStream io = new RandomAccessFileKaitaiStream(raf)) { + thr = expectThrowsEofError(new ThrowingRunnable() { + @Override + public void run() throws Throwable { + r._write_Seq(io); + } + }); + assertIntEquals(io.pos(), 1); + } finally { + file.delete(); + } + assertEquals(thr.getMessage(), "requested to write 3 bytes, but only 2 bytes left in the stream"); + } + + protected EofExceptionBitsBe getEofExceptionBitsBe() { + EofExceptionBitsBe r = new EofExceptionBitsBe(); + r.setPreBits(0b0000_000); + r.setFailBits(0b1_01000010_11111111_0); + r._check(); + + return r; + } +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBitsBe2.java b/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBitsBe2.java new file mode 100644 index 000000000..825921e5a --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBitsBe2.java @@ -0,0 +1,73 @@ +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.ByteBufferKaitaiStream; +import io.kaitai.struct.KaitaiStream; +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.RandomAccessFileKaitaiStream; +import io.kaitai.struct.testwrite.EofExceptionBitsBe2; + +import java.io.File; +import java.io.RandomAccessFile; + +import org.testng.Assert.ThrowingRunnable; +import org.testng.annotations.Test; +import static org.testng.Assert.assertEquals; + +public class TestEofExceptionBitsBe2 extends CommonSpec { + @Override + protected Class getStructClass() { + throw new UnsupportedOperationException(); + } + + @Override + protected String getSrcFilename() { + throw new UnsupportedOperationException(); + } + + @Test + public void testEofExceptionBitsBe2BB() throws Exception { + EofExceptionBitsBe2 r = getEofExceptionBitsBe2(); + + try (KaitaiStream io = new ByteBufferKaitaiStream(3)) { + assertThrowsEofError(new ThrowingRunnable() { + @Override + public void run() throws Throwable { + r._write_Seq(io); + } + }); + assertIntEquals(io.pos(), 1); + } + } + + @Test + public void testEofExceptionBitsBe2RAF() throws Exception { + EofExceptionBitsBe2 r = getEofExceptionBitsBe2(); + + File file = new File(SCRATCH_DIR + "specwrite_TestEofExceptionBitsBe2.bin"); + RandomAccessFile raf = new RandomAccessFile(file, "rw"); + raf.setLength(3); + + Throwable thr; + try (KaitaiStream io = new RandomAccessFileKaitaiStream(raf)) { + thr = expectThrowsEofError(new ThrowingRunnable() { + @Override + public void run() throws Throwable { + r._write_Seq(io); + } + }); + assertIntEquals(io.pos(), 1); + } finally { + file.delete(); + } + assertEquals(thr.getMessage(), "requested to write 3 bytes, but only 2 bytes left in the stream"); + } + + protected EofExceptionBitsBe2 getEofExceptionBitsBe2() { + EofExceptionBitsBe2 r = new EofExceptionBitsBe2(); + r.setPreBits(0x01); + r.setFailBits(0b01000010_11111111_0); + r._check(); + + return r; + } +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBitsLe.java b/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBitsLe.java new file mode 100644 index 000000000..1ec86d9e8 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBitsLe.java @@ -0,0 +1,73 @@ +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.ByteBufferKaitaiStream; +import io.kaitai.struct.KaitaiStream; +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.RandomAccessFileKaitaiStream; +import io.kaitai.struct.testwrite.EofExceptionBitsLe; + +import java.io.File; +import java.io.RandomAccessFile; + +import org.testng.Assert.ThrowingRunnable; +import org.testng.annotations.Test; +import static org.testng.Assert.assertEquals; + +public class TestEofExceptionBitsLe extends CommonSpec { + @Override + protected Class getStructClass() { + throw new UnsupportedOperationException(); + } + + @Override + protected String getSrcFilename() { + throw new UnsupportedOperationException(); + } + + @Test + public void testEofExceptionBitsLeBB() throws Exception { + EofExceptionBitsLe r = getEofExceptionBitsLe(); + + try (KaitaiStream io = new ByteBufferKaitaiStream(3)) { + assertThrowsEofError(new ThrowingRunnable() { + @Override + public void run() throws Throwable { + r._write_Seq(io); + } + }); + assertIntEquals(io.pos(), 1); + } + } + + @Test + public void testEofExceptionBitsLeRAF() throws Exception { + EofExceptionBitsLe r = getEofExceptionBitsLe(); + + File file = new File(SCRATCH_DIR + "specwrite_TestEofExceptionBitsLe.bin"); + RandomAccessFile raf = new RandomAccessFile(file, "rw"); + raf.setLength(3); + + Throwable thr; + try (KaitaiStream io = new RandomAccessFileKaitaiStream(raf)) { + thr = expectThrowsEofError(new ThrowingRunnable() { + @Override + public void run() throws Throwable { + r._write_Seq(io); + } + }); + assertIntEquals(io.pos(), 1); + } finally { + file.delete(); + } + assertEquals(thr.getMessage(), "requested to write 3 bytes, but only 2 bytes left in the stream"); + } + + protected EofExceptionBitsLe getEofExceptionBitsLe() { + EofExceptionBitsLe r = new EofExceptionBitsLe(); + r.setPreBits(0b000_0001); + r.setFailBits(0b0_11111111_01000010_0); + r._check(); + + return r; + } +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBitsLe2.java b/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBitsLe2.java new file mode 100644 index 000000000..a399db7bd --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBitsLe2.java @@ -0,0 +1,73 @@ +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.ByteBufferKaitaiStream; +import io.kaitai.struct.KaitaiStream; +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.RandomAccessFileKaitaiStream; +import io.kaitai.struct.testwrite.EofExceptionBitsLe2; + +import java.io.File; +import java.io.RandomAccessFile; + +import org.testng.Assert.ThrowingRunnable; +import org.testng.annotations.Test; +import static org.testng.Assert.assertEquals; + +public class TestEofExceptionBitsLe2 extends CommonSpec { + @Override + protected Class getStructClass() { + throw new UnsupportedOperationException(); + } + + @Override + protected String getSrcFilename() { + throw new UnsupportedOperationException(); + } + + @Test + public void testEofExceptionBitsLe2BB() throws Exception { + EofExceptionBitsLe2 r = getEofExceptionBitsLe2(); + + try (KaitaiStream io = new ByteBufferKaitaiStream(3)) { + assertThrowsEofError(new ThrowingRunnable() { + @Override + public void run() throws Throwable { + r._write_Seq(io); + } + }); + assertIntEquals(io.pos(), 1); + } + } + + @Test + public void testEofExceptionBitsLe2RAF() throws Exception { + EofExceptionBitsLe2 r = getEofExceptionBitsLe2(); + + File file = new File(SCRATCH_DIR + "specwrite_TestEofExceptionBitsLe2.bin"); + RandomAccessFile raf = new RandomAccessFile(file, "rw"); + raf.setLength(3); + + Throwable thr; + try (KaitaiStream io = new RandomAccessFileKaitaiStream(raf)) { + thr = expectThrowsEofError(new ThrowingRunnable() { + @Override + public void run() throws Throwable { + r._write_Seq(io); + } + }); + assertIntEquals(io.pos(), 1); + } finally { + file.delete(); + } + assertEquals(thr.getMessage(), "requested to write 3 bytes, but only 2 bytes left in the stream"); + } + + protected EofExceptionBitsLe2 getEofExceptionBitsLe2() { + EofExceptionBitsLe2 r = new EofExceptionBitsLe2(); + r.setPreBits(0x01); + r.setFailBits(0b0_11111111_01000010); + r._check(); + + return r; + } +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestExprIoEofBits.java b/spec/java/src/io/kaitai/struct/specwrite/TestExprIoEofBits.java index 4436013ac..b3e43cc82 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestExprIoEofBits.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestExprIoEofBits.java @@ -1,80 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + package io.kaitai.struct.specwrite; -import io.kaitai.struct.ByteBufferKaitaiStream; -import io.kaitai.struct.KaitaiStream; -import io.kaitai.struct.RandomAccessFileKaitaiStream; import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.ExprIoEofBits; import org.testng.annotations.Test; -import static org.testng.Assert.*; - -import java.io.File; -import java.io.RandomAccessFile; public class TestExprIoEofBits extends CommonSpec { @Override protected Class getStructClass() { - throw new UnsupportedOperationException(); + return ExprIoEofBits.class; } @Override protected String getSrcFilename() { - throw new UnsupportedOperationException(); + return "nav_parent_switch.bin"; } - @Test - public void testExprIoEofBitsBB() throws Exception { - ExprIoEofBits r = getExprIoEofBits(); - - KaitaiStream newIo = new ByteBufferKaitaiStream(3); - r._write_Seq(newIo); - - assertThrowsEofError(new ThrowingRunnable() { - @Override - public void run() throws Throwable { - newIo.close(); - } - }); - // shouldn't do anything (especially not throw any exception), - // because close() is supposed to be idempotent - newIo.close(); - } - - @Test - public void testExprIoEofBitsRAF() throws Exception { - ExprIoEofBits r = getExprIoEofBits(); - - File file = new File(SCRATCH_DIR + "specwrite_TestExprIoEofBits.bin"); - RandomAccessFile raf = new RandomAccessFile(file, "rw"); - raf.setLength(3); - - try { - KaitaiStream newIo = new RandomAccessFileKaitaiStream(raf); - r._write_Seq(newIo); - - Throwable thr = expectThrowsEofError(new ThrowingRunnable() { - @Override - public void run() throws Throwable { - newIo.close(); - } - }); - // shouldn't do anything (especially not throw any exception), - // because close() is supposed to be idempotent - newIo.close(); - } finally { - file.delete(); - } - } - - protected ExprIoEofBits getExprIoEofBits() { - ExprIoEofBits r = new ExprIoEofBits(); - r.setFoo(5167); - r.setBar(15L); - r.setAssertIoEofBeforeBaz(new byte[] { }); - r.setBaz(6); - r.setAssertIoEofAfterBaz(new byte[8]); // doesn't matter - r._check(); - - return r; - } } diff --git a/spec/ks/eof_exception_bits_be.kst b/spec/ks/eof_exception_bits_be.kst index 68449b967..3910cd986 100644 --- a/spec/ks/eof_exception_bits_be.kst +++ b/spec/ks/eof_exception_bits_be.kst @@ -1,3 +1,8 @@ id: eof_exception_bits_be data: nav_parent_switch.bin exception: EndOfStreamError +# asserts: +# - actual: _io.pos +# expected: 1 +# - actual: pre_bits +# expected: 0b0000_000 diff --git a/spec/ks/eof_exception_bits_be2.kst b/spec/ks/eof_exception_bits_be2.kst index 8e4ba0967..add95d8c8 100644 --- a/spec/ks/eof_exception_bits_be2.kst +++ b/spec/ks/eof_exception_bits_be2.kst @@ -1,3 +1,8 @@ id: eof_exception_bits_be2 data: nav_parent_switch.bin exception: EndOfStreamError +# asserts: +# - actual: _io.pos +# expected: 1 +# - actual: pre_bits +# expected: 0x01 diff --git a/spec/ks/eof_exception_bits_le.kst b/spec/ks/eof_exception_bits_le.kst index 9a025be1d..51168b65c 100644 --- a/spec/ks/eof_exception_bits_le.kst +++ b/spec/ks/eof_exception_bits_le.kst @@ -1,3 +1,8 @@ id: eof_exception_bits_le data: nav_parent_switch.bin exception: EndOfStreamError +# asserts: +# - actual: _io.pos +# expected: 1 +# - actual: pre_bits +# expected: 0b000_0001 diff --git a/spec/ks/eof_exception_bits_le2.kst b/spec/ks/eof_exception_bits_le2.kst index 37de92307..daaae8cdc 100644 --- a/spec/ks/eof_exception_bits_le2.kst +++ b/spec/ks/eof_exception_bits_le2.kst @@ -1,3 +1,8 @@ id: eof_exception_bits_le2 data: nav_parent_switch.bin exception: EndOfStreamError +# asserts: +# - actual: _io.pos +# expected: 1 +# - actual: pre_bits +# expected: 0x01 From 4c041720cce4a4b1a34d39843701f07f7099e52e Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Wed, 26 Jul 2023 21:24:34 +0200 Subject: [PATCH 095/126] Remove "Autogenerated from KST" from modified Java write specs --- spec/java/src/io/kaitai/struct/specwrite/TestExpr2.java | 2 -- spec/java/src/io/kaitai/struct/specwrite/TestInstanceStd.java | 2 -- spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilS4.java | 2 -- .../src/io/kaitai/struct/specwrite/TestStrPadTermRoundtrip.java | 2 -- 4 files changed, 8 deletions(-) diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestExpr2.java b/spec/java/src/io/kaitai/struct/specwrite/TestExpr2.java index ff3bc1b0a..2d86baa90 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestExpr2.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestExpr2.java @@ -1,5 +1,3 @@ -// Autogenerated from KST: please remove this line if doing any edits by hand! - package io.kaitai.struct.specwrite; import io.kaitai.struct.ByteBufferKaitaiStream; diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestInstanceStd.java b/spec/java/src/io/kaitai/struct/specwrite/TestInstanceStd.java index 20f2afbe2..56e5d6640 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestInstanceStd.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestInstanceStd.java @@ -1,5 +1,3 @@ -// Autogenerated from KST: please remove this line if doing any edits by hand! - package io.kaitai.struct.specwrite; import io.kaitai.struct.ByteBufferKaitaiStream; diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilS4.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilS4.java index dc3066728..59a332152 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilS4.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilS4.java @@ -1,5 +1,3 @@ -// Autogenerated from KST: please remove this line if doing any edits by hand! - package io.kaitai.struct.specwrite; import io.kaitai.struct.ConsistencyError; diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestStrPadTermRoundtrip.java b/spec/java/src/io/kaitai/struct/specwrite/TestStrPadTermRoundtrip.java index ab3cff44d..60a1c7c63 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestStrPadTermRoundtrip.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestStrPadTermRoundtrip.java @@ -1,5 +1,3 @@ -// Autogenerated from KST: please remove this line if doing any edits by hand! - package io.kaitai.struct.specwrite; import io.kaitai.struct.KaitaiStruct.ReadWrite; From 4901dead821fb153efc6c34985e93f2017f21858 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Thu, 27 Jul 2023 13:13:39 +0200 Subject: [PATCH 096/126] Java specwrite: minor improvements in manual tests --- spec/java/src/io/kaitai/struct/specwrite/TestInstanceStd.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStrz.java | 3 ++- .../java/src/io/kaitai/struct/specwrite/TestStrEncodings.java | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestInstanceStd.java b/spec/java/src/io/kaitai/struct/specwrite/TestInstanceStd.java index 56e5d6640..dd883bd09 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestInstanceStd.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestInstanceStd.java @@ -62,7 +62,6 @@ public void testWrite() throws Exception { KaitaiStream io = new ByteBufferKaitaiStream(2 + 5); r._write(io); io.seek(0); - r._writeHeader(); InstanceStd newR = new InstanceStd(io); newR._read(); diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStrz.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStrz.java index e1acd71cf..712f7e8c4 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStrz.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStrz.java @@ -19,9 +19,10 @@ public void checkMismatch() throws Exception { r._check(); } - @Test(expectedExceptions = NullPointerException.class) + @Test(expectedExceptions = NullPointerException.class, expectedExceptionsMessageRegExp = ".*\\blines\\b.*") public void checkNull() throws Exception { RepeatNStrz r = new RepeatNStrz(); + r.setQty(0); r._check(); } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestStrEncodings.java b/spec/java/src/io/kaitai/struct/specwrite/TestStrEncodings.java index 04a20b58c..238a57715 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestStrEncodings.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestStrEncodings.java @@ -6,13 +6,15 @@ import org.testng.annotations.Test; public class TestStrEncodings extends CommonSpec { - @Test(expectedExceptions = NullPointerException.class) + @Test(expectedExceptions = NullPointerException.class, expectedExceptionsMessageRegExp = ".*\\bstr2\\b.*") public void checkNull() throws Exception { StrEncodings r = new StrEncodings(); r.setStr1("woo"); r.setLenOf1(3); + r.setLenOf2(15); + r._check(); } From 6a3c0f11d19b26212323c3763d67483752169fa7 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Thu, 27 Jul 2023 16:41:11 +0200 Subject: [PATCH 097/126] Port manual Java specwrite tests to Python --- spec/python/specwrite/common_spec.py | 25 ++- spec/python/specwrite/test_bytes_pad_term.py | 160 +++++++++++++++++- .../specwrite/test_bytes_pad_term_equal.py | 158 ++++++++++++++++- .../test_bytes_pad_term_roundtrip.py | 15 +- spec/python/specwrite/test_expr_2.py | 45 ++++- spec/python/specwrite/test_instance_std.py | 42 ++++- spec/python/specwrite/test_process_rotate.py | 52 +++++- spec/python/specwrite/test_process_to_user.py | 27 ++- .../python/specwrite/test_repeat_eos_bytes.py | 18 +- spec/python/specwrite/test_repeat_n_strz.py | 18 +- spec/python/specwrite/test_repeat_until_s4.py | 32 +++- spec/python/specwrite/test_str_encodings.py | 30 +++- spec/python/specwrite/test_str_eos.py | 13 +- .../specwrite/test_str_pad_term_roundtrip.py | 15 +- .../specwrite/test_switch_manual_int_size.py | 12 +- spec/python/specwrite/test_term_bytes4.py | 41 ++++- 16 files changed, 671 insertions(+), 32 deletions(-) diff --git a/spec/python/specwrite/common_spec.py b/spec/python/specwrite/common_spec.py index 3f0341f0b..2598d6828 100644 --- a/spec/python/specwrite/common_spec.py +++ b/spec/python/specwrite/common_spec.py @@ -35,6 +35,20 @@ def test_read_write_roundtrip(self): self.assertEqual(orig_dump, new_dump) + def assert_equal_to_full_file(self, struct_obj, file_name): + with io.open(file_name, 'rb') as f: + expected_bytes = f.read() + struct_obj._check() + with KaitaiStream(io.BytesIO(bytearray(len(expected_bytes)))) as out_io: + struct_obj._write(out_io) + self.assert_byte_array_equal(out_io.to_byte_array(), expected_bytes) + + def assert_byte_array_equal(self, actual, expected): + self.assertEqual( + CommonSpec.Base.byte_array_to_hex(actual), + CommonSpec.Base.byte_array_to_hex(expected), + ) + @staticmethod def dump_struct(obj): return CommonSpec.Base.dump_struct_value(obj, [], 50, '/') @@ -71,7 +85,10 @@ def dump_struct_value(value, parent_structs, recursion_depth_limit, current_path if ( prop_name == '_io' or \ - prop_name.startswith('_raw_') + prop_name == '_debug' or \ + prop_name == 'SEQ_FIELDS' or \ + prop_name.startswith('_raw_') or \ + prop_name.startswith('_m_') ): continue @@ -110,6 +127,10 @@ def dump_struct_value(value, parent_structs, recursion_depth_limit, current_path if isinstance(value, (bytes, bytearray)): # https://stackoverflow.com/a/19210468 - value = ' '.join('%02x' % b for b in value) + value = CommonSpec.Base.byte_array_to_hex(value) return value + + @staticmethod + def byte_array_to_hex(arr): + return ' '.join('%02x' % b for b in arr) diff --git a/spec/python/specwrite/test_bytes_pad_term.py b/spec/python/specwrite/test_bytes_pad_term.py index 7766e2282..a9bb63dac 100644 --- a/spec/python/specwrite/test_bytes_pad_term.py +++ b/spec/python/specwrite/test_bytes_pad_term.py @@ -1,6 +1,5 @@ -# Autogenerated from KST: please remove this line if doing any edits by hand! - import unittest +from kaitaistruct import ConsistencyError from specwrite.common_spec import CommonSpec from testwrite.bytes_pad_term import BytesPadTerm @@ -11,3 +10,160 @@ def __init__(self, *args, **kwargs): self.struct_class = BytesPadTerm self.src_filename = 'src/str_pad_term.bin' + def test_check_good_max_lengths(self): + r = BytesPadTerm() + r.str_pad = b"12345678901234567890" + r.str_term = b"12345678901234567890" + r.str_term_and_pad = b"12345678901234567890" + r.str_term_include = b"12345678901234567890" + r._check() + + def test_check_good_min_lengths(self): + r = BytesPadTerm() + r.str_pad = b"" + r.str_term = b"" + r.str_term_and_pad = b"" + r.str_term_include = b"@" + r._check() + + def test_check_longer_str_pad(self): + r = BytesPadTerm() + r.str_pad = b"123456789012345678901" + with self.assertRaisesRegexp(ConsistencyError, u"^Check failed: str_pad,"): + r._check() + + def test_check_good_last_byte_str_pad(self): + r = BytesPadTerm() + r.str_pad = b"@@@@@" b"@@@@@" b"@@@@@" b"@@@@?" + r.str_term = b"12345678901234567890" + r.str_term_and_pad = b"12345678901234567890" + r.str_term_include = b"12345678901234567890" + r._check() + + def test_check_bad_last_byte_str_pad(self): + r = BytesPadTerm() + r.str_pad = b"123456789012345678@" + with self.assertRaisesRegexp(ConsistencyError, u"^Check failed: str_pad,"): + r._check() + + def test_check_longer_str_term(self): + r = BytesPadTerm() + r.str_pad = b"12345678901234567890" + r.str_term = b"123456789012345678901" + with self.assertRaisesRegexp(ConsistencyError, u"^Check failed: str_term,"): + r._check() + + def test_check_bad_has_terminator1_str_term(self): + r = BytesPadTerm() + r.str_pad = b"12345678901234567890" + r.str_term = b"123456789012@4567890" + with self.assertRaisesRegexp(ConsistencyError, u"^Check failed: str_term,"): + r._check() + + def test_check_bad_has_terminator2_str_term(self): + r = BytesPadTerm() + r.str_pad = b"12345678901234567890" + r.str_term = b"1234567890123456789@" + with self.assertRaisesRegexp(ConsistencyError, u"^Check failed: str_term,"): + r._check() + + def test_check_longer_str_term_and_pad(self): + r = BytesPadTerm() + r.str_pad = b"12345678901234567890" + r.str_term = b"12345678901234567890" + r.str_term_and_pad = b"123456789012345678901" + with self.assertRaisesRegexp(ConsistencyError, u"^Check failed: str_term_and_pad,"): + r._check() + + def test_check_bad_has_terminator_str_term_and_pad(self): + r = BytesPadTerm() + r.str_pad = b"12345678901234567890" + r.str_term = b"12345678901234567890" + r.str_term_and_pad = b"@2345678901234567890" + with self.assertRaisesRegexp(ConsistencyError, u"^Check failed: str_term_and_pad,"): + r._check() + + def test_check_good_last_byte1_str_term_and_pad(self): + r = BytesPadTerm() + r.str_pad = b"12345678901234567890" + r.str_term = b"12345678901234567890" + r.str_term_and_pad = b"+++++" b"+++++" b"+++++" b"++++" + r.str_term_include = b"12345678901234567890" + r._check() + + def test_check_good_last_byte2_str_term_and_pad(self): + r = BytesPadTerm() + r.str_pad = b"12345678901234567890" + r.str_term = b"12345678901234567890" + r.str_term_and_pad = b"+++++" b"+++++" b"+++++" b"++++0" + r.str_term_include = b"12345678901234567890" + r._check() + + def test_check_bad_last_byte_str_term_and_pad(self): + r = BytesPadTerm() + r.str_pad = b"12345678901234567890" + r.str_term = b"12345678901234567890" + r.str_term_and_pad = b"1234567890123456789+" + with self.assertRaisesRegexp(ConsistencyError, u"^Check failed: str_term_and_pad,"): + r._check() + + def test_check_longer_str_term_include(self): + r = BytesPadTerm() + r.str_pad = b"12345678901234567890" + r.str_term = b"12345678901234567890" + r.str_term_and_pad = b"12345678901234567890" + r.str_term_include = b"123456789012345678901" + with self.assertRaisesRegexp(ConsistencyError, u"^Check failed: str_term_include,"): + r._check() + + def test_check_empty_str_term_include(self): + r = BytesPadTerm() + r.str_pad = b"12345678901234567890" + r.str_term = b"12345678901234567890" + r.str_term_and_pad = b"12345678901234567890" + r.str_term_include = b"" + with self.assertRaisesRegexp(ConsistencyError, u"^Check failed: str_term_include,"): + r._check() + + def test_check_bad_no_terminator_str_term_include(self): + r = BytesPadTerm() + r.str_pad = b"12345678901234567890" + r.str_term = b"12345678901234567890" + r.str_term_and_pad = b"12345678901234567890" + r.str_term_include = b"123" + with self.assertRaisesRegexp(ConsistencyError, u"^Check failed: str_term_include,"): + r._check() + + def test_check_good_terminator1_str_term_include(self): + r = BytesPadTerm() + r.str_pad = b"12345678901234567890" + r.str_term = b"12345678901234567890" + r.str_term_and_pad = b"12345678901234567890" + r.str_term_include = b"12@" + r._check() + + def test_check_early_terminator1_str_term_include(self): + r = BytesPadTerm() + r.str_pad = b"12345678901234567890" + r.str_term = b"12345678901234567890" + r.str_term_and_pad = b"12345678901234567890" + r.str_term_include = b"1@@" + with self.assertRaisesRegexp(ConsistencyError, u"^Check failed: str_term_include,"): + r._check() + + def test_check_good_terminator2_str_term_include(self): + r = BytesPadTerm() + r.str_pad = b"12345678901234567890" + r.str_term = b"12345678901234567890" + r.str_term_and_pad = b"12345678901234567890" + r.str_term_include = b"1234567890123456789@" + r._check() + + def test_check_early_terminator2_str_term_include(self): + r = BytesPadTerm() + r.str_pad = b"12345678901234567890" + r.str_term = b"12345678901234567890" + r.str_term_and_pad = b"12345678901234567890" + r.str_term_include = b"123456789012345678@@" + with self.assertRaisesRegexp(ConsistencyError, u"^Check failed: str_term_include,"): + r._check() diff --git a/spec/python/specwrite/test_bytes_pad_term_equal.py b/spec/python/specwrite/test_bytes_pad_term_equal.py index 219ae4147..65c76f5e5 100644 --- a/spec/python/specwrite/test_bytes_pad_term_equal.py +++ b/spec/python/specwrite/test_bytes_pad_term_equal.py @@ -1,6 +1,5 @@ -# Autogenerated from KST: please remove this line if doing any edits by hand! - import unittest +from kaitaistruct import ConsistencyError from specwrite.common_spec import CommonSpec from testwrite.bytes_pad_term_equal import BytesPadTermEqual @@ -11,3 +10,158 @@ def __init__(self, *args, **kwargs): self.struct_class = BytesPadTermEqual self.src_filename = 'src/str_pad_term.bin' + def test_check_good_max_lengths(self): + r = BytesPadTermEqual() + r.s1 = b"12345678901234567890" + r.s2 = b"12345678901234567890" + r.s3 = b"12345678901234567890" + r.s4 = b"12345678901234567890" + r._check() + + def test_check_good_min_lengths(self): + r = BytesPadTermEqual() + r.s1 = b"" + r.s2 = b"" + r.s3 = b"" + r.s4 = b"." + r._check() + + def test_check_longer_s1(self): + r = BytesPadTermEqual() + r.s1 = b"123456789012345678901" + with self.assertRaisesRegexp(ConsistencyError, u"^Check failed: s1,"): + r._check() + + def test_check_bad_has_terminator1_s1(self): + r = BytesPadTermEqual() + r.s1 = b"123456789012@4567890" + with self.assertRaisesRegexp(ConsistencyError, u"^Check failed: s1,"): + r._check() + + def test_check_bad_has_terminator2_s1(self): + r = BytesPadTermEqual() + r.s1 = b"1234567890123456789@" + with self.assertRaisesRegexp(ConsistencyError, u"^Check failed: s1,"): + r._check() + + def test_check_longer_s2(self): + r = BytesPadTermEqual() + r.s1 = b"12345678901234567890" + r.s2 = b"123456789012345678901" + with self.assertRaisesRegexp(ConsistencyError, u"^Check failed: s2,"): + r._check() + + def test_check_good_terminator1_s2(self): + r = BytesPadTermEqual() + r.s1 = b"12345678901234567890" + r.s2 = b"123456789012345678@" + r.s3 = b"12345678901234567890" + r.s4 = b"12345678901234567890" + r._check() + + def test_check_early_terminator1_s2(self): + r = BytesPadTermEqual() + r.s1 = b"12345678901234567890" + r.s2 = b"1234567890123456@8@" + with self.assertRaisesRegexp(ConsistencyError, u"^Check failed: s2,"): + r._check() + + def test_check_good_last_byte_s2(self): + r = BytesPadTermEqual() + r.s1 = b"12345678901234567890" + r.s2 = b"+++++" b"+++++" b"+++++" b"+++9" + r.s3 = b"12345678901234567890" + r.s4 = b"12345678901234567890" + r._check() + + def test_check_bad_last_byte_s2(self): + r = BytesPadTermEqual() + r.s1 = b"12345678901234567890" + r.s2 = b"123456789012345678+" + with self.assertRaisesRegexp(ConsistencyError, u"^Check failed: s2,"): + r._check() + + def test_check_longer_s3(self): + r = BytesPadTermEqual() + r.s1 = b"12345678901234567890" + r.s2 = b"12345678901234567890" + r.s3 = b"123456789012345678901" + with self.assertRaisesRegexp(ConsistencyError, u"^Check failed: s3,"): + r._check() + + def test_check_bad_has_terminator1_s3(self): + r = BytesPadTermEqual() + r.s1 = b"12345678901234567890" + r.s2 = b"12345678901234567890" + r.s3 = b"1234567890123456789+" + with self.assertRaisesRegexp(ConsistencyError, u"^Check failed: s3,"): + r._check() + + def test_check_bad_has_terminator2_s3(self): + r = BytesPadTermEqual() + r.s1 = b"12345678901234567890" + r.s2 = b"12345678901234567890" + r.s3 = b"12345678901234567+9" + with self.assertRaisesRegexp(ConsistencyError, u"^Check failed: s3,"): + r._check() + + def test_check_longer_s4(self): + r = BytesPadTermEqual() + r.s1 = b"12345678901234567890" + r.s2 = b"12345678901234567890" + r.s3 = b"12345678901234567890" + r.s4 = b"123456789012345678901" + with self.assertRaisesRegexp(ConsistencyError, u"^Check failed: s4,"): + r._check() + + def test_check_empty_s4(self): + r = BytesPadTermEqual() + r.s1 = b"12345678901234567890" + r.s2 = b"12345678901234567890" + r.s3 = b"12345678901234567890" + r.s4 = b"" + with self.assertRaisesRegexp(ConsistencyError, u"^Check failed: s4,"): + r._check() + + def test_check_bad_no_terminator_s4(self): + r = BytesPadTermEqual() + r.s1 = b"12345678901234567890" + r.s2 = b"12345678901234567890" + r.s3 = b"12345678901234567890" + r.s4 = b"1234567890123456789" + with self.assertRaisesRegexp(ConsistencyError, u"^Check failed: s4,"): + r._check() + + def test_check_good_terminator1_s4(self): + r = BytesPadTermEqual() + r.s1 = b"12345678901234567890" + r.s2 = b"12345678901234567890" + r.s3 = b"12345678901234567890" + r.s4 = b"123456789012345678." + r._check() + + def test_check_early_terminator1_s4(self): + r = BytesPadTermEqual() + r.s1 = b"12345678901234567890" + r.s2 = b"12345678901234567890" + r.s3 = b"12345678901234567890" + r.s4 = b".23456789012345678." + with self.assertRaisesRegexp(ConsistencyError, u"^Check failed: s4,"): + r._check() + + def test_check_good_terminator2_s4(self): + r = BytesPadTermEqual() + r.s1 = b"12345678901234567890" + r.s2 = b"12345678901234567890" + r.s3 = b"12345678901234567890" + r.s4 = b"1234567890123456789." + r._check() + + def test_check_early_terminator2_s4(self): + r = BytesPadTermEqual() + r.s1 = b"12345678901234567890" + r.s2 = b"12345678901234567890" + r.s3 = b"12345678901234567890" + r.s4 = b"123456789012345678.." + with self.assertRaisesRegexp(ConsistencyError, u"^Check failed: s4,"): + r._check() diff --git a/spec/python/specwrite/test_bytes_pad_term_roundtrip.py b/spec/python/specwrite/test_bytes_pad_term_roundtrip.py index 3d145f75d..eddd5bd86 100644 --- a/spec/python/specwrite/test_bytes_pad_term_roundtrip.py +++ b/spec/python/specwrite/test_bytes_pad_term_roundtrip.py @@ -1,5 +1,3 @@ -# Autogenerated from KST: please remove this line if doing any edits by hand! - import unittest from specwrite.common_spec import CommonSpec @@ -11,3 +9,16 @@ def __init__(self, *args, **kwargs): self.struct_class = BytesPadTermRoundtrip self.src_filename = 'src/str_pad_term.bin' + def test_bytes_pad_term_roundtrip(self): + # NOTE: here it makes sense to prefer a manual test over the automatic + # testReadWriteRoundtrip, because the roundtrip can't always recognize whether the + # `pad-right` is correct (i.e. whether the serialized field is padded correctly) + + r = BytesPadTermRoundtrip() + + r.str_pad = b"str1" + r.str_term = b"str2foo" + r.str_term_and_pad = b"str+++3bar+++" + r.str_term_include = b"str4baz@" + + self.assert_equal_to_full_file(r, 'src/str_pad_term.bin') diff --git a/spec/python/specwrite/test_expr_2.py b/spec/python/specwrite/test_expr_2.py index ff33130a1..734584bf6 100644 --- a/spec/python/specwrite/test_expr_2.py +++ b/spec/python/specwrite/test_expr_2.py @@ -1,6 +1,6 @@ -# Autogenerated from KST: please remove this line if doing any edits by hand! - +import io import unittest +from kaitaistruct import KaitaiStream from specwrite.common_spec import CommonSpec from testwrite.expr_2 import Expr2 @@ -11,3 +11,44 @@ def __init__(self, *args, **kwargs): self.struct_class = Expr2 self.src_filename = 'src/str_encodings.bin' + def test_edit(self): + r = Expr2.from_file(self.src_filename) + r._read() + + old_len_mod = r.str2.len_mod + old_str2_rest_avg = r.str2.rest.avg + + r.str2.str = "Kaitai Struct カ" + r.str2._invalidate_len_mod() + + str2_size = len(r.str2.str.encode(u"UTF-8")) + r.str2.len_orig = str2_size + 3 + self.assertNotEqual(r.str2.len_mod, old_len_mod) + self.assertEqual(r.str2.len_mod, str2_size) + + r.str2.rest.byte0 = 0xfa + r.str2.rest._invalidate_avg() + r.str2.rest.byte1 = 0x44 + r.str2.rest.byte2 = 0x88 + self.assertNotEqual(r.str2.rest.avg, old_str2_rest_avg) + + # see .test_read_write_roundtrip + orig_dump = CommonSpec.Base.dump_struct(r) + + new_io = KaitaiStream(io.BytesIO(bytearray( + 2 + # str1.len_orig + r.str1.len_mod + # str1.str + 3 + # str1.rest + 2 + # str2.len_orig + r.str2.len_mod + # str2.str + 3 # str2.rest + ))) + r._write(new_io) + new_io.seek(0) + + new_r = Expr2(new_io) + new_r._read() + + new_dump = CommonSpec.Base.dump_struct(new_r) + + self.assertEqual(new_dump, orig_dump) diff --git a/spec/python/specwrite/test_instance_std.py b/spec/python/specwrite/test_instance_std.py index ea589bed5..28f5724b9 100644 --- a/spec/python/specwrite/test_instance_std.py +++ b/spec/python/specwrite/test_instance_std.py @@ -1,6 +1,6 @@ -# Autogenerated from KST: please remove this line if doing any edits by hand! - +import io import unittest +from kaitaistruct import ConsistencyError, KaitaiStream from specwrite.common_spec import CommonSpec from testwrite.instance_std import InstanceStd @@ -11,3 +11,41 @@ def __init__(self, *args, **kwargs): self.struct_class = InstanceStd self.src_filename = 'src/str_encodings.bin' + def test_check_shorter_header(self): + r = InstanceStd() + r._check() + r.header = "1234" + with self.assertRaisesRegexp(ConsistencyError, u"^Check failed: header,"): + r._check_header() + + def test_check_longer_header(self): + r = InstanceStd() + r._check() + r.header = "123456" + with self.assertRaisesRegexp(ConsistencyError, u"^Check failed: header,"): + r._check_header() + + def test_check_empty_header_via_dump(self): + r = InstanceStd() + r.header = "" + with self.assertRaisesRegexp(ConsistencyError, u"^Check failed: header,"): + # calls all _check*() methods + CommonSpec.Base.dump_struct(r) + + def test_write(self): + r = InstanceStd() + r.header = "Hello" + + # see .test_read_write_roundtrip + orig_dump = CommonSpec.Base.dump_struct(r) + + ks_io = KaitaiStream(io.BytesIO(bytearray(2 + 5))) + r._write(ks_io) + ks_io.seek(0) + + new_r = InstanceStd(ks_io) + new_r._read() + + new_dump = CommonSpec.Base.dump_struct(new_r) + + self.assertEqual(new_dump, orig_dump) diff --git a/spec/python/specwrite/test_process_rotate.py b/spec/python/specwrite/test_process_rotate.py index a02e795ee..b57c8e572 100644 --- a/spec/python/specwrite/test_process_rotate.py +++ b/spec/python/specwrite/test_process_rotate.py @@ -1,6 +1,6 @@ -# Autogenerated from KST: please remove this line if doing any edits by hand! - +import io import unittest +from kaitaistruct import ConsistencyError, KaitaiStream from specwrite.common_spec import CommonSpec from testwrite.process_rotate import ProcessRotate @@ -11,3 +11,51 @@ def __init__(self, *args, **kwargs): self.struct_class = ProcessRotate self.src_filename = 'src/process_rotate.bin' + def test_process_rotate(self): + # NOTE: unlike the automatic roundtrip test, the `_raw_*` fields are unset in this + # manual test, so "cheating" by just writing them is impossible + + r = ProcessRotate() + + r.buf1 = b"Hello" + r.buf2 = b"World" + r.key = 1 + r.buf3 = b"There" + + self.assert_equal_to_full_file(r, 'src/process_rotate.bin') + + def test_check_size_mismatch_check(self): + r = ProcessRotate() + + r.buf1 = b"Hello" + r.buf2 = b"Way too long" + + with self.assertRaisesRegexp(ConsistencyError, u"^Check failed: buf2,"): + r._check() + + def test_check_size_mismatch_check_or_write(self): + r = ProcessRotate() + + r.buf1 = b"Hello" + r.buf2 = b"Way too long" + r.key = 1 + r.buf3 = b"There" + + len_io = ( + 5 + # buf1 + 5 + # buf2 + 1 + # key + 5 # buf3 + ) + ks_io = KaitaiStream(io.BytesIO(bytearray(len_io))) + + with self.assertRaisesRegexp(ConsistencyError, u"^Check failed: buf2,"): + r._check() + + # It would be more user-friendly if the size mismatch of `buf2` was caught already in + # _check(), as tested by the previous test case test_check_size_mismatch_check() (this + # is possible because it's known that `process: rol/ror(...)` preserve the input length, + # so the length of `buf2` is the same as the length of `_raw_buf2` which actually gets + # written). But if the compiler implementation doesn't want to distinguish among + # `process` types here, just a check in _write() is probably acceptable as well. + r._write(ks_io) diff --git a/spec/python/specwrite/test_process_to_user.py b/spec/python/specwrite/test_process_to_user.py index b8d04025a..255834270 100644 --- a/spec/python/specwrite/test_process_to_user.py +++ b/spec/python/specwrite/test_process_to_user.py @@ -1,6 +1,6 @@ -# Autogenerated from KST: please remove this line if doing any edits by hand! - +import io import unittest +from kaitaistruct import KaitaiStream from specwrite.common_spec import CommonSpec from testwrite.process_to_user import ProcessToUser @@ -11,3 +11,26 @@ def __init__(self, *args, **kwargs): self.struct_class = ProcessToUser self.src_filename = 'src/process_rotate.bin' + def test_process_to_user(self): + # NOTE: unlike the automatic roundtrip test, the `_raw_*` fields are unset in this + # manual test, so "cheating" by just writing them is impossible + + r = ProcessToUser() + + buf1 = ProcessToUser.JustStr(None, r, r._root) + buf1.str = "Hello" + buf1._check() + r.buf1 = buf1 + + r._check() + + with io.open('src/process_rotate.bin', 'rb') as f: + expected = f.read(5) + self.assertEqual(len(expected), 5) + + ks_io = KaitaiStream(io.BytesIO(bytearray(len(expected)))) + r._write(ks_io) + + actual = ks_io.to_byte_array() + + self.assert_byte_array_equal(actual, expected) diff --git a/spec/python/specwrite/test_repeat_eos_bytes.py b/spec/python/specwrite/test_repeat_eos_bytes.py index 1cefbc3c4..dc0976457 100644 --- a/spec/python/specwrite/test_repeat_eos_bytes.py +++ b/spec/python/specwrite/test_repeat_eos_bytes.py @@ -1,6 +1,6 @@ -# Autogenerated from KST: please remove this line if doing any edits by hand! - +import io import unittest +from kaitaistruct import ConsistencyError, KaitaiStream from specwrite.common_spec import CommonSpec from testwrite.repeat_eos_bytes import RepeatEosBytes @@ -11,3 +11,17 @@ def __init__(self, *args, **kwargs): self.struct_class = RepeatEosBytes self.src_filename = 'src/repeat_until_process.bin' + def test_check_longer_io(self): + r = RepeatEosBytes() + + r.records = [ + b"\xE8\xBA\xAA\xAA\xAA", + b"\xFA\x9E\xB8\xAA\xAA", + b"\xAA\x55\x55\x55\x55", + ] + + r._check() + + ks_io = KaitaiStream(io.BytesIO(bytearray(15 + 3))) + with self.assertRaisesRegexp(ConsistencyError, u"^Check failed: records, expected: 0, actual: 3$"): + r._write(ks_io) diff --git a/spec/python/specwrite/test_repeat_n_strz.py b/spec/python/specwrite/test_repeat_n_strz.py index 263d24406..25d934242 100644 --- a/spec/python/specwrite/test_repeat_n_strz.py +++ b/spec/python/specwrite/test_repeat_n_strz.py @@ -1,6 +1,5 @@ -# Autogenerated from KST: please remove this line if doing any edits by hand! - import unittest +from kaitaistruct import ConsistencyError from specwrite.common_spec import CommonSpec from testwrite.repeat_n_strz import RepeatNStrz @@ -11,3 +10,18 @@ def __init__(self, *args, **kwargs): self.struct_class = RepeatNStrz self.src_filename = 'src/repeat_n_strz.bin' + def test_check_mismatch(self): + r = RepeatNStrz() + + r.qty = 7 + r.lines = ["foo", "bar"] + + with self.assertRaisesRegexp(ConsistencyError, u"^Check failed: lines,"): + r._check() + + def test_check_null(self): + r = RepeatNStrz() + r.qty = 0 + + with self.assertRaisesRegexp(AttributeError, u"\\blines\\b"): + r._check() diff --git a/spec/python/specwrite/test_repeat_until_s4.py b/spec/python/specwrite/test_repeat_until_s4.py index 79fd33cb2..0887b0155 100644 --- a/spec/python/specwrite/test_repeat_until_s4.py +++ b/spec/python/specwrite/test_repeat_until_s4.py @@ -1,6 +1,5 @@ -# Autogenerated from KST: please remove this line if doing any edits by hand! - import unittest +from kaitaistruct import ConsistencyError from specwrite.common_spec import CommonSpec from testwrite.repeat_until_s4 import RepeatUntilS4 @@ -11,3 +10,32 @@ def __init__(self, *args, **kwargs): self.struct_class = RepeatUntilS4 self.src_filename = 'src/repeat_until_s4.bin' + def test_check_bad_no_entries(self): + r = RepeatUntilS4() + r.entries = [0] + with self.assertRaisesRegexp(ConsistencyError, u"^Check failed: entries,"): + r._check() + + def test_check_good_one_entry(self): + r = RepeatUntilS4() + r.entries = [-1] + r.afterall = "" + r._check() + + def test_check_bad_early_until_entry(self): + r = RepeatUntilS4() + r.entries = [-3, 275000, -1, 0, -1] + with self.assertRaisesRegexp(ConsistencyError, u"^Check failed: entries,"): + r._check() + + def test_check_bad_no_until_entry(self): + r = RepeatUntilS4() + r.entries = [-3, 275000, -2, 0] + with self.assertRaisesRegexp(ConsistencyError, u"^Check failed: entries,"): + r._check() + + def test_check_good_until_entry(self): + r = RepeatUntilS4() + r.entries = [-3, 275000, -2, 0, -1] + r.afterall = "" + r._check() diff --git a/spec/python/specwrite/test_str_encodings.py b/spec/python/specwrite/test_str_encodings.py index d088aa98e..3b768d3d1 100644 --- a/spec/python/specwrite/test_str_encodings.py +++ b/spec/python/specwrite/test_str_encodings.py @@ -1,6 +1,5 @@ -# Autogenerated from KST: please remove this line if doing any edits by hand! - import unittest +from kaitaistruct import ConsistencyError from specwrite.common_spec import CommonSpec from testwrite.str_encodings import StrEncodings @@ -11,3 +10,30 @@ def __init__(self, *args, **kwargs): self.struct_class = StrEncodings self.src_filename = 'src/str_encodings.bin' + def test_check_null(self): + r = StrEncodings() + + r.str1 = "woo" + r.len_of_1 = 3 + + r.len_of_2 = 15 + + with self.assertRaisesRegexp(AttributeError, u"\\bstr2\\b"): + r._check() + + def test_check_mismatch(self): + r = StrEncodings() + + r.str1 = "Some ASCII" + r.str2 = "こんにちは" + r.str3 = "こんにちは" + r.str4 = "░▒▓" + + # To be auto-derived + r.len_of_1 = 10 + r.len_of_2 = 12 # should be 15 + r.len_of_3 = 10 + r.len_of_4 = 3 + + with self.assertRaisesRegexp(ConsistencyError, u"^Check failed: str2,"): + r._check() diff --git a/spec/python/specwrite/test_str_eos.py b/spec/python/specwrite/test_str_eos.py index 45536a1f6..0370a60a1 100644 --- a/spec/python/specwrite/test_str_eos.py +++ b/spec/python/specwrite/test_str_eos.py @@ -1,6 +1,6 @@ -# Autogenerated from KST: please remove this line if doing any edits by hand! - +import io import unittest +from kaitaistruct import ConsistencyError, KaitaiStream from specwrite.common_spec import CommonSpec from testwrite.str_eos import StrEos @@ -11,3 +11,12 @@ def __init__(self, *args, **kwargs): self.struct_class = StrEos self.src_filename = 'src/term_strz.bin' + def test_check_longer_io(self): + r = StrEos() + + r.str = "Hello" + + r._check() + + with self.assertRaisesRegexp(ConsistencyError, u"^Check failed: str, expected: 0, actual: 2$"): + r._write(KaitaiStream(io.BytesIO(bytearray(5 + 2)))) diff --git a/spec/python/specwrite/test_str_pad_term_roundtrip.py b/spec/python/specwrite/test_str_pad_term_roundtrip.py index d7fbe7602..de4a51e17 100644 --- a/spec/python/specwrite/test_str_pad_term_roundtrip.py +++ b/spec/python/specwrite/test_str_pad_term_roundtrip.py @@ -1,5 +1,3 @@ -# Autogenerated from KST: please remove this line if doing any edits by hand! - import unittest from specwrite.common_spec import CommonSpec @@ -11,3 +9,16 @@ def __init__(self, *args, **kwargs): self.struct_class = StrPadTermRoundtrip self.src_filename = 'src/str_pad_term.bin' + def test_str_pad_term_roundtrip(self): + # NOTE: here it makes sense to prefer a manual test over the automatic + # testReadWriteRoundtrip, because the roundtrip can't always recognize whether the + # `pad-right` is correct (i.e. whether the serialized field is padded correctly) + + r = StrPadTermRoundtrip() + + r.str_pad = "str1" + r.str_term = "str2foo" + r.str_term_and_pad = "str+++3bar+++" + r.str_term_include = "str4baz@" + + self.assert_equal_to_full_file(r, 'src/str_pad_term.bin') diff --git a/spec/python/specwrite/test_switch_manual_int_size.py b/spec/python/specwrite/test_switch_manual_int_size.py index ae9d7c9ff..ee74be269 100644 --- a/spec/python/specwrite/test_switch_manual_int_size.py +++ b/spec/python/specwrite/test_switch_manual_int_size.py @@ -1,6 +1,5 @@ -# Autogenerated from KST: please remove this line if doing any edits by hand! - import unittest +from kaitaistruct import ConsistencyError from specwrite.common_spec import CommonSpec from testwrite.switch_manual_int_size import SwitchManualIntSize @@ -11,3 +10,12 @@ def __init__(self, *args, **kwargs): self.struct_class = SwitchManualIntSize self.src_filename = 'src/switch_tlv.bin' + def test_check_switch_bytes_size_mismatch(self): + chunk = SwitchManualIntSize.Chunk() + chunk.code = 0x33 + chunk.size = 3 + # should cause the consistency check to fail because it's 2 bytes, not 3 + chunk.body = b"\x10\x20" + + with self.assertRaisesRegexp(ConsistencyError, u"^Check failed: body, expected: 3, actual: 2$"): + chunk._check() diff --git a/spec/python/specwrite/test_term_bytes4.py b/spec/python/specwrite/test_term_bytes4.py index 35ee6a257..d043817c4 100644 --- a/spec/python/specwrite/test_term_bytes4.py +++ b/spec/python/specwrite/test_term_bytes4.py @@ -1,6 +1,6 @@ -# Autogenerated from KST: please remove this line if doing any edits by hand! - +import io import unittest +from kaitaistruct import ConsistencyError, KaitaiStream from specwrite.common_spec import CommonSpec from testwrite.term_bytes4 import TermBytes4 @@ -11,3 +11,40 @@ def __init__(self, *args, **kwargs): self.struct_class = TermBytes4 self.src_filename = 'src/term_strz.bin' + def test_check_is_eof_after_include_term_missing(self): + r = TermBytes4() + + s1 = TermBytes4.S1Type(None, r, r._root) + s1.value = b"foo" + s1._check() + r.s1 = s1 + + r.skip_term1 = 0x7c + + s2 = TermBytes4.S2Type(None, r, r._root) + s2.value = b"bar" + s2._check() + r.s2 = s2 + + r.skip_term2 = 0x7c + + s3 = TermBytes4.S3Type(None, r, r._root) + # this field with `include: true` and `eos-error: false` does not end with the terminator, + # but there is 1 byte left in the stream => consistency error + s3.value = b"ba" + s3._check() + r.s3 = s3 + + r._check() + + len_io = ( + 3 + # s1 + 1 + # skip_term1 + 3 + # s2 + 1 + # skip_term2 + 3 # s3 + ) + out_io = KaitaiStream(io.BytesIO(bytearray(len_io))) + + with self.assertRaisesRegexp(ConsistencyError, u"^Check failed: value, expected: 0, actual: 1$"): + r._write(out_io) # should throw a ConsistencyError From cc36a88b3f4b5ae1473e6cae44b464cfea48ae12 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Fri, 28 Jul 2023 14:21:32 +0200 Subject: [PATCH 098/126] Add BitsByteAlignedEof{Be,Le} + regen from KST to Java and Python --- formats/bits_byte_aligned_eof_be.ksy | 16 +++++++++++++++ formats/bits_byte_aligned_eof_le.ksy | 11 ++++++++++ .../struct/spec/TestBitsByteAlignedEofBe.java | 16 +++++++++++++++ .../struct/spec/TestBitsByteAlignedEofLe.java | 16 +++++++++++++++ .../specwrite/TestBitsByteAlignedEofBe.java | 20 +++++++++++++++++++ .../specwrite/TestBitsByteAlignedEofLe.java | 20 +++++++++++++++++++ spec/ks/bits_byte_aligned_eof_be.kst | 7 +++++++ spec/ks/bits_byte_aligned_eof_le.kst | 7 +++++++ .../spec/test_bits_byte_aligned_eof_be.py | 12 +++++++++++ .../spec/test_bits_byte_aligned_eof_le.py | 12 +++++++++++ .../test_bits_byte_aligned_eof_be.py | 13 ++++++++++++ .../test_bits_byte_aligned_eof_le.py | 13 ++++++++++++ 12 files changed, 163 insertions(+) create mode 100644 formats/bits_byte_aligned_eof_be.ksy create mode 100644 formats/bits_byte_aligned_eof_le.ksy create mode 100644 spec/java/src/io/kaitai/struct/spec/TestBitsByteAlignedEofBe.java create mode 100644 spec/java/src/io/kaitai/struct/spec/TestBitsByteAlignedEofLe.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestBitsByteAlignedEofBe.java create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestBitsByteAlignedEofLe.java create mode 100644 spec/ks/bits_byte_aligned_eof_be.kst create mode 100644 spec/ks/bits_byte_aligned_eof_le.kst create mode 100644 spec/python/spec/test_bits_byte_aligned_eof_be.py create mode 100644 spec/python/spec/test_bits_byte_aligned_eof_le.py create mode 100644 spec/python/specwrite/test_bits_byte_aligned_eof_be.py create mode 100644 spec/python/specwrite/test_bits_byte_aligned_eof_le.py diff --git a/formats/bits_byte_aligned_eof_be.ksy b/formats/bits_byte_aligned_eof_be.ksy new file mode 100644 index 000000000..1c8bd0ef2 --- /dev/null +++ b/formats/bits_byte_aligned_eof_be.ksy @@ -0,0 +1,16 @@ +meta: + id: bits_byte_aligned_eof_be + bit-endian: be +seq: + - id: prebuf + size: 8 + - id: bits + type: b31 + # 1 bit left until the end of file. This means that during serialization, when + # the stream is closed / `seek()` is called by the test code, the stream + # position must be "aligned" to a byte boundary so that the buffered bits are + # written into the final byte. + # + # We're specifically testing the alignment right before the EOF here to ensure + # that the EOF check in the implicitly called "write_align_to_byte()" method + # works properly, i.e. that it doesn't wrongly throw an EOF error here. diff --git a/formats/bits_byte_aligned_eof_le.ksy b/formats/bits_byte_aligned_eof_le.ksy new file mode 100644 index 000000000..c399a0758 --- /dev/null +++ b/formats/bits_byte_aligned_eof_le.ksy @@ -0,0 +1,11 @@ +# Like "bits_byte_aligned_eof_be", but for little-endian order. +meta: + id: bits_byte_aligned_eof_le + bit-endian: le +seq: + - id: prebuf + size: 8 + - id: bits + type: b31 + # 1 bit left until the end of file. (... - see "bits_byte_aligned_eof_be" + # for more details) diff --git a/spec/java/src/io/kaitai/struct/spec/TestBitsByteAlignedEofBe.java b/spec/java/src/io/kaitai/struct/spec/TestBitsByteAlignedEofBe.java new file mode 100644 index 000000000..0de92d057 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestBitsByteAlignedEofBe.java @@ -0,0 +1,16 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.BitsByteAlignedEofBe; +import org.testng.annotations.Test; +import static org.testng.Assert.*; +public class TestBitsByteAlignedEofBe extends CommonSpec { + @Test + public void testBitsByteAlignedEofBe() throws Exception { + BitsByteAlignedEofBe r = BitsByteAlignedEofBe.fromFile(SRC_DIR + "bcd_user_type_be.bin"); + + assertEquals(r.prebuf(), new byte[] { 18, 52, 86, 120, 18, 52, 86, 120 }); + assertIntEquals(r.bits(), 596523); + } +} diff --git a/spec/java/src/io/kaitai/struct/spec/TestBitsByteAlignedEofLe.java b/spec/java/src/io/kaitai/struct/spec/TestBitsByteAlignedEofLe.java new file mode 100644 index 000000000..46b1984f7 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/spec/TestBitsByteAlignedEofLe.java @@ -0,0 +1,16 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.spec; + +import io.kaitai.struct.testformats.BitsByteAlignedEofLe; +import org.testng.annotations.Test; +import static org.testng.Assert.*; +public class TestBitsByteAlignedEofLe extends CommonSpec { + @Test + public void testBitsByteAlignedEofLe() throws Exception { + BitsByteAlignedEofLe r = BitsByteAlignedEofLe.fromFile(SRC_DIR + "bcd_user_type_be.bin"); + + assertEquals(r.prebuf(), new byte[] { 18, 52, 86, 120, 18, 52, 86, 120 }); + assertIntEquals(r.bits(), 1446253056); + } +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBitsByteAlignedEofBe.java b/spec/java/src/io/kaitai/struct/specwrite/TestBitsByteAlignedEofBe.java new file mode 100644 index 000000000..9bda88c46 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBitsByteAlignedEofBe.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.BitsByteAlignedEofBe; +import org.testng.annotations.Test; + +public class TestBitsByteAlignedEofBe extends CommonSpec { + @Override + protected Class getStructClass() { + return BitsByteAlignedEofBe.class; + } + + @Override + protected String getSrcFilename() { + return "bcd_user_type_be.bin"; + } + +} diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBitsByteAlignedEofLe.java b/spec/java/src/io/kaitai/struct/specwrite/TestBitsByteAlignedEofLe.java new file mode 100644 index 000000000..551ccedf0 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBitsByteAlignedEofLe.java @@ -0,0 +1,20 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.BitsByteAlignedEofLe; +import org.testng.annotations.Test; + +public class TestBitsByteAlignedEofLe extends CommonSpec { + @Override + protected Class getStructClass() { + return BitsByteAlignedEofLe.class; + } + + @Override + protected String getSrcFilename() { + return "bcd_user_type_be.bin"; + } + +} diff --git a/spec/ks/bits_byte_aligned_eof_be.kst b/spec/ks/bits_byte_aligned_eof_be.kst new file mode 100644 index 000000000..a10f70769 --- /dev/null +++ b/spec/ks/bits_byte_aligned_eof_be.kst @@ -0,0 +1,7 @@ +id: bits_byte_aligned_eof_be +data: bcd_user_type_be.bin +asserts: + - actual: prebuf + expected: '[0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x56, 0x78]' + - actual: bits + expected: 0b0000_0000_0001_0010_0011_0100_0101_011 diff --git a/spec/ks/bits_byte_aligned_eof_le.kst b/spec/ks/bits_byte_aligned_eof_le.kst new file mode 100644 index 000000000..033727ee2 --- /dev/null +++ b/spec/ks/bits_byte_aligned_eof_le.kst @@ -0,0 +1,7 @@ +id: bits_byte_aligned_eof_le +data: bcd_user_type_be.bin +asserts: + - actual: prebuf + expected: '[0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x56, 0x78]' + - actual: bits + expected: 0b101_0110_0011_0100_0001_0010_0000_0000 diff --git a/spec/python/spec/test_bits_byte_aligned_eof_be.py b/spec/python/spec/test_bits_byte_aligned_eof_be.py new file mode 100644 index 000000000..eea91d415 --- /dev/null +++ b/spec/python/spec/test_bits_byte_aligned_eof_be.py @@ -0,0 +1,12 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest + +from testformats.bits_byte_aligned_eof_be import BitsByteAlignedEofBe + +class TestBitsByteAlignedEofBe(unittest.TestCase): + def test_bits_byte_aligned_eof_be(self): + with BitsByteAlignedEofBe.from_file('src/bcd_user_type_be.bin') as r: + + self.assertEqual(r.prebuf, b"\x12\x34\x56\x78\x12\x34\x56\x78") + self.assertEqual(r.bits, 596523) diff --git a/spec/python/spec/test_bits_byte_aligned_eof_le.py b/spec/python/spec/test_bits_byte_aligned_eof_le.py new file mode 100644 index 000000000..ea39066ad --- /dev/null +++ b/spec/python/spec/test_bits_byte_aligned_eof_le.py @@ -0,0 +1,12 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest + +from testformats.bits_byte_aligned_eof_le import BitsByteAlignedEofLe + +class TestBitsByteAlignedEofLe(unittest.TestCase): + def test_bits_byte_aligned_eof_le(self): + with BitsByteAlignedEofLe.from_file('src/bcd_user_type_be.bin') as r: + + self.assertEqual(r.prebuf, b"\x12\x34\x56\x78\x12\x34\x56\x78") + self.assertEqual(r.bits, 1446253056) diff --git a/spec/python/specwrite/test_bits_byte_aligned_eof_be.py b/spec/python/specwrite/test_bits_byte_aligned_eof_be.py new file mode 100644 index 000000000..353221ad1 --- /dev/null +++ b/spec/python/specwrite/test_bits_byte_aligned_eof_be.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.bits_byte_aligned_eof_be import BitsByteAlignedEofBe + +class TestBitsByteAlignedEofBe(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestBitsByteAlignedEofBe, self).__init__(*args, **kwargs) + self.struct_class = BitsByteAlignedEofBe + self.src_filename = 'src/bcd_user_type_be.bin' + diff --git a/spec/python/specwrite/test_bits_byte_aligned_eof_le.py b/spec/python/specwrite/test_bits_byte_aligned_eof_le.py new file mode 100644 index 000000000..b9122575a --- /dev/null +++ b/spec/python/specwrite/test_bits_byte_aligned_eof_le.py @@ -0,0 +1,13 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.bits_byte_aligned_eof_le import BitsByteAlignedEofLe + +class TestBitsByteAlignedEofLe(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestBitsByteAlignedEofLe, self).__init__(*args, **kwargs) + self.struct_class = BitsByteAlignedEofLe + self.src_filename = 'src/bcd_user_type_be.bin' + From 59ce9230aa6e062161d75181e643931b492eeb2a Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Fri, 28 Jul 2023 19:30:28 +0200 Subject: [PATCH 099/126] JavaWriteSG: throw a `SkipException` for skipped roundtrip tests so that the TestNG correctly reports the tests as skipped. Many webpages on the Internet suggest using `@Test(enabled=false)`, but that completely omits the test from the test results, instead of indicating that it was skipped. --- .../testtranslator/TestTranslator.scala | 2 +- .../specgenerators/JavaWriteSG.scala | 45 +++++++------------ 2 files changed, 17 insertions(+), 30 deletions(-) diff --git a/translator/src/main/scala/io/kaitai/struct/testtranslator/TestTranslator.scala b/translator/src/main/scala/io/kaitai/struct/testtranslator/TestTranslator.scala index 53674817e..626553b14 100644 --- a/translator/src/main/scala/io/kaitai/struct/testtranslator/TestTranslator.scala +++ b/translator/src/main/scala/io/kaitai/struct/testtranslator/TestTranslator.scala @@ -106,7 +106,7 @@ class TestTranslator(options: CLIOptions) { origSpecs } - def getSG(lang: String, testSpec: TestSpec, provider: ClassTypeProvider): BaseGenerator = lang match { + def getSG(lang: String, testSpec: TestSpec, provider: ClassTypeProvider): SpecGenerator = lang match { case "construct" => new ConstructSG(testSpec, provider) case "cpp_stl_98" => new CppStlSG(testSpec, provider, CppRuntimeConfig().copyAsCpp98()) case "cpp_stl_11" => new CppStlSG(testSpec, provider, CppRuntimeConfig().copyAsCpp11()) diff --git a/translator/src/main/scala/io/kaitai/struct/testtranslator/specgenerators/JavaWriteSG.scala b/translator/src/main/scala/io/kaitai/struct/testtranslator/specgenerators/JavaWriteSG.scala index 0fba1b241..bf8445f3c 100644 --- a/translator/src/main/scala/io/kaitai/struct/testtranslator/specgenerators/JavaWriteSG.scala +++ b/translator/src/main/scala/io/kaitai/struct/testtranslator/specgenerators/JavaWriteSG.scala @@ -8,7 +8,7 @@ import io.kaitai.struct.languages.JavaCompiler import io.kaitai.struct.testtranslator.{Main, TestAssert, TestSpec} import io.kaitai.struct.translators.JavaTranslator -class JavaWriteSG(spec: TestSpec, provider: ClassTypeProvider) extends BaseGenerator(spec) { +class JavaWriteSG(spec: TestSpec, provider: ClassTypeProvider) extends SpecGenerator { val config = RuntimeConfig() val className = JavaCompiler.type2class(spec.id) val translator = new JavaTranslator(provider, importList, config) @@ -21,12 +21,10 @@ class JavaWriteSG(spec: TestSpec, provider: ClassTypeProvider) extends BaseGener override def fileName(name: String): String = s"src/io/kaitai/struct/specwrite/Test$className.java" - override def header(): Unit = { + override def run(): Unit = { out.puts(s"public class Test$className extends CommonSpec {") out.inc - } - override def runParse(): Unit = { out.puts("@Override") out.puts("protected Class getStructClass() {") out.inc @@ -40,37 +38,26 @@ class JavaWriteSG(spec: TestSpec, provider: ClassTypeProvider) extends BaseGener out.puts("return \"" + spec.data + "\";") out.dec out.puts("}") - } - override def runParseExpectError(exception: KSError): Unit = { - out.puts("@Override") - out.puts("protected Class getStructClass() {") - out.inc - out.puts("throw new UnsupportedOperationException();") - out.dec - out.puts("}") - out.puts - out.puts("@Override") - out.puts("protected String getSrcFilename() {") - out.inc - out.puts("throw new UnsupportedOperationException();") - out.dec - out.puts("}") - } + spec.exception match { + case None => + case Some(_) => + importList.add("org.testng.SkipException") + + out.puts + out.puts("@Override") + out.puts("@Test") + out.puts("protected void testReadWriteRoundtrip() throws Exception {") + out.inc + out.puts("""throw new SkipException("cannot use roundtrip because parsing is expected to fail");""") + out.dec + out.puts("}") + } - override def footer(): Unit = { out.dec out.puts("}") } - override def runAsserts(): Unit = {} - - def simpleAssert(check: TestAssert): Unit = ??? - - def nullAssert(actual: Ast.expr): Unit = ??? - - def trueArrayAssert(check: TestAssert, elType: DataType, elts: Seq[Ast.expr]): Unit = ??? - override def indentStr: String = " " override def results: String = { From d0fb3f91bfb1276a94a6b37118f15a4f387b5436 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Fri, 28 Jul 2023 18:55:42 +0200 Subject: [PATCH 100/126] Regen Java specwrite tests from KST: remove useless newline --- spec/java/src/io/kaitai/struct/specwrite/TestBcdUserTypeBe.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestBcdUserTypeLe.java | 1 - .../java/src/io/kaitai/struct/specwrite/TestBitsByteAligned.java | 1 - .../src/io/kaitai/struct/specwrite/TestBitsByteAlignedEofBe.java | 1 - .../src/io/kaitai/struct/specwrite/TestBitsByteAlignedEofLe.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestBitsEnum.java | 1 - .../src/io/kaitai/struct/specwrite/TestBitsSeqEndianCombo.java | 1 - .../src/io/kaitai/struct/specwrite/TestBitsShiftByB32Le.java | 1 - .../src/io/kaitai/struct/specwrite/TestBitsShiftByB64Le.java | 1 - .../src/io/kaitai/struct/specwrite/TestBitsSignedResB32Be.java | 1 - .../src/io/kaitai/struct/specwrite/TestBitsSignedResB32Le.java | 1 - .../src/io/kaitai/struct/specwrite/TestBitsSignedShiftB32Le.java | 1 - .../src/io/kaitai/struct/specwrite/TestBitsSignedShiftB64Le.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestBitsSimple.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestBitsSimpleLe.java | 1 - .../src/io/kaitai/struct/specwrite/TestBitsUnalignedB32Be.java | 1 - .../src/io/kaitai/struct/specwrite/TestBitsUnalignedB32Le.java | 1 - .../src/io/kaitai/struct/specwrite/TestBitsUnalignedB64Be.java | 1 - .../src/io/kaitai/struct/specwrite/TestBitsUnalignedB64Le.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestBufferedStruct.java | 1 - .../java/src/io/kaitai/struct/specwrite/TestBytesEosPadTerm.java | 1 - .../src/io/kaitai/struct/specwrite/TestBytesPadTermEmpty.java | 1 - .../io/kaitai/struct/specwrite/TestBytesPadTermRoundtrip.java | 1 - .../src/io/kaitai/struct/specwrite/TestBytesPadTermZeroSize.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestCastNested.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestCastToImported.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestCastToTop.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestCombineBool.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestCombineBytes.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestCombineEnum.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestCombineStr.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestDebug0.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestDebugArrayUser.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestDebugEnumName.java | 1 - .../java/src/io/kaitai/struct/specwrite/TestDebugSwitchUser.java | 1 - .../src/io/kaitai/struct/specwrite/TestDefaultBigEndian.java | 1 - .../src/io/kaitai/struct/specwrite/TestDefaultBitEndianMod.java | 1 - .../kaitai/struct/specwrite/TestDefaultEndianExprInherited.java | 1 - .../io/kaitai/struct/specwrite/TestDefaultEndianExprIsBe.java | 1 - .../io/kaitai/struct/specwrite/TestDefaultEndianExprIsLe.java | 1 - .../src/io/kaitai/struct/specwrite/TestDefaultEndianMod.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestDocstrings.java | 1 - .../src/io/kaitai/struct/specwrite/TestDocstringsDocref.java | 1 - .../io/kaitai/struct/specwrite/TestDocstringsDocrefMulti.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestEnum0.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestEnum1.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestEnumDeep.java | 1 - .../src/io/kaitai/struct/specwrite/TestEnumDeepLiterals.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestEnumFancy.java | 1 - .../src/io/kaitai/struct/specwrite/TestEnumForUnknownId.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestEnumIf.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestEnumImport.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestEnumIntRangeS.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestEnumIntRangeU.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestEnumInvalid.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestEnumLongRangeS.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestEnumLongRangeU.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestEnumNegative.java | 1 - .../java/src/io/kaitai/struct/specwrite/TestEnumOfValueInst.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestEnumToI.java | 1 - .../src/io/kaitai/struct/specwrite/TestEnumToIClassBorder1.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestExpr0.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestExpr1.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestExpr3.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestExprArray.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestExprBits.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestExprBytesCmp.java | 1 - .../src/io/kaitai/struct/specwrite/TestExprBytesNonLiteral.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestExprBytesOps.java | 1 - .../src/io/kaitai/struct/specwrite/TestExprCalcArrayOps.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestExprEnum.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestExprIfIntEq.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestExprIfIntOps.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestExprIntDiv.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestExprIoEof.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestExprIoEofBits.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestExprIoPos.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestExprIoPosBits.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestExprMod.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestExprOpsParens.java | 1 - .../java/src/io/kaitai/struct/specwrite/TestExprSizeofType0.java | 1 - .../java/src/io/kaitai/struct/specwrite/TestExprSizeofType1.java | 1 - .../src/io/kaitai/struct/specwrite/TestExprSizeofValue0.java | 1 - .../src/io/kaitai/struct/specwrite/TestExprSizeofValueSized.java | 1 - .../src/io/kaitai/struct/specwrite/TestExprStrEncodings.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestExprStrOps.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestFixedContents.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestFixedStruct.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestFloatToI.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestFloatingPoints.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestHelloWorld.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestIfInstances.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestIfStruct.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestIfValues.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestImports0.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestImportsAbs.java | 1 - .../src/io/kaitai/struct/specwrite/TestImportsCircularA.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestImportsRel1.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestIndexSizes.java | 1 - .../java/src/io/kaitai/struct/specwrite/TestIndexToParamEos.java | 1 - .../src/io/kaitai/struct/specwrite/TestIndexToParamExpr.java | 1 - .../src/io/kaitai/struct/specwrite/TestIndexToParamUntil.java | 1 - .../src/io/kaitai/struct/specwrite/TestInstanceInRepeatExpr.java | 1 - .../io/kaitai/struct/specwrite/TestInstanceInRepeatUntil.java | 1 - .../java/src/io/kaitai/struct/specwrite/TestInstanceInSized.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestInstanceIoUser.java | 1 - .../io/kaitai/struct/specwrite/TestInstanceIoUserEarlier.java | 1 - .../src/io/kaitai/struct/specwrite/TestInstanceStdArray.java | 1 - .../src/io/kaitai/struct/specwrite/TestInstanceUserArray.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestIntegers.java | 1 - .../io/kaitai/struct/specwrite/TestIntegersDoubleOverflow.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestIntegersMinMax.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestIoLocalVar.java | 1 - .../src/io/kaitai/struct/specwrite/TestJsSignedRightShift.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestMetaTags.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestMetaXref.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestMultipleUse.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestNavParent.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestNavParent2.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestNavParent3.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestNavParentFalse.java | 1 - .../java/src/io/kaitai/struct/specwrite/TestNavParentFalse2.java | 1 - .../src/io/kaitai/struct/specwrite/TestNavParentOverride.java | 1 - .../java/src/io/kaitai/struct/specwrite/TestNavParentSwitch.java | 1 - .../src/io/kaitai/struct/specwrite/TestNavParentSwitchCast.java | 1 - .../src/io/kaitai/struct/specwrite/TestNavParentVsValueInst.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestNavRoot.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestNestedSameName.java | 1 - .../java/src/io/kaitai/struct/specwrite/TestNestedSameName2.java | 1 - .../java/src/io/kaitai/struct/specwrite/TestNestedTypeParam.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestNestedTypes.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestNestedTypes2.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestNestedTypes3.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestNonStandard.java | 1 - .../src/io/kaitai/struct/specwrite/TestOpaqueExternalType.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestOptionalId.java | 1 - .../io/kaitai/struct/specwrite/TestParamsCallExtraParens.java | 1 - .../java/src/io/kaitai/struct/specwrite/TestParamsCallShort.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestParamsEnum.java | 1 - .../src/io/kaitai/struct/specwrite/TestParamsPassArrayInt.java | 1 - .../src/io/kaitai/struct/specwrite/TestParamsPassArrayIo.java | 1 - .../src/io/kaitai/struct/specwrite/TestParamsPassArrayStr.java | 1 - .../io/kaitai/struct/specwrite/TestParamsPassArrayStruct.java | 1 - .../io/kaitai/struct/specwrite/TestParamsPassArrayUsertype.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestParamsPassBool.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestParamsPassIo.java | 1 - .../src/io/kaitai/struct/specwrite/TestParamsPassStruct.java | 1 - .../src/io/kaitai/struct/specwrite/TestParamsPassUsertype.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestPositionAbs.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestPositionInSeq.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestPositionToEnd.java | 1 - .../src/io/kaitai/struct/specwrite/TestProcessBytesPadTerm.java | 1 - .../src/io/kaitai/struct/specwrite/TestProcessCoerceBytes.java | 1 - .../src/io/kaitai/struct/specwrite/TestProcessCoerceSwitch.java | 1 - .../io/kaitai/struct/specwrite/TestProcessCoerceUsertype1.java | 1 - .../io/kaitai/struct/specwrite/TestProcessCoerceUsertype2.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestProcessCustom.java | 1 - .../src/io/kaitai/struct/specwrite/TestProcessCustomNoArgs.java | 1 - .../src/io/kaitai/struct/specwrite/TestProcessRepeatBytes.java | 1 - .../io/kaitai/struct/specwrite/TestProcessRepeatUsertype.java | 1 - .../struct/specwrite/TestProcessRepeatUsertypeDynargCustom.java | 1 - .../struct/specwrite/TestProcessRepeatUsertypeDynargRotate.java | 1 - .../struct/specwrite/TestProcessRepeatUsertypeDynargXor.java | 1 - .../src/io/kaitai/struct/specwrite/TestProcessStructPadTerm.java | 1 - .../src/io/kaitai/struct/specwrite/TestProcessTermStruct.java | 1 - .../src/io/kaitai/struct/specwrite/TestProcessXor4Const.java | 1 - .../src/io/kaitai/struct/specwrite/TestProcessXor4Value.java | 1 - .../java/src/io/kaitai/struct/specwrite/TestProcessXorConst.java | 1 - .../java/src/io/kaitai/struct/specwrite/TestProcessXorValue.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestRecursiveOne.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosBit.java | 1 - .../src/io/kaitai/struct/specwrite/TestRepeatEosBytesPad.java | 1 - .../io/kaitai/struct/specwrite/TestRepeatEosBytesPadTerm.java | 1 - .../java/src/io/kaitai/struct/specwrite/TestRepeatEosStruct.java | 1 - .../src/io/kaitai/struct/specwrite/TestRepeatEosTermBytes.java | 1 - .../src/io/kaitai/struct/specwrite/TestRepeatEosTermStruct.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosU4.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestRepeatNBytes.java | 1 - .../java/src/io/kaitai/struct/specwrite/TestRepeatNBytesPad.java | 1 - .../src/io/kaitai/struct/specwrite/TestRepeatNBytesPadTerm.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStruct.java | 1 - .../src/io/kaitai/struct/specwrite/TestRepeatNStrzDouble.java | 1 - .../src/io/kaitai/struct/specwrite/TestRepeatNTermBytes.java | 1 - .../src/io/kaitai/struct/specwrite/TestRepeatNTermStruct.java | 1 - .../src/io/kaitai/struct/specwrite/TestRepeatUntilBytes.java | 1 - .../src/io/kaitai/struct/specwrite/TestRepeatUntilBytesPad.java | 1 - .../io/kaitai/struct/specwrite/TestRepeatUntilBytesPadTerm.java | 1 - .../io/kaitai/struct/specwrite/TestRepeatUntilCalcArrayType.java | 1 - .../src/io/kaitai/struct/specwrite/TestRepeatUntilComplex.java | 1 - .../src/io/kaitai/struct/specwrite/TestRepeatUntilSized.java | 1 - .../src/io/kaitai/struct/specwrite/TestRepeatUntilTermBytes.java | 1 - .../io/kaitai/struct/specwrite/TestRepeatUntilTermStruct.java | 1 - .../src/io/kaitai/struct/specwrite/TestStrEncodingsDefault.java | 1 - .../src/io/kaitai/struct/specwrite/TestStrEncodingsUtf16.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestStrEosPadTerm.java | 1 - .../src/io/kaitai/struct/specwrite/TestStrEosPadTermEmpty.java | 1 - .../src/io/kaitai/struct/specwrite/TestStrEosPadTermEqual.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestStrLiterals2.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestStrPadTerm.java | 1 - .../java/src/io/kaitai/struct/specwrite/TestStrPadTermEmpty.java | 1 - .../java/src/io/kaitai/struct/specwrite/TestStrPadTermEqual.java | 1 - .../src/io/kaitai/struct/specwrite/TestStrPadTermRoundtrip.java | 1 - .../src/io/kaitai/struct/specwrite/TestStrPadTermZeroSize.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestStructPadTerm.java | 1 - .../src/io/kaitai/struct/specwrite/TestStructPadTermEqual.java | 1 - .../java/src/io/kaitai/struct/specwrite/TestSwitchBytearray.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestSwitchElseOnly.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestSwitchIntegers.java | 1 - .../java/src/io/kaitai/struct/specwrite/TestSwitchIntegers2.java | 1 - .../src/io/kaitai/struct/specwrite/TestSwitchManualEnum.java | 1 - .../io/kaitai/struct/specwrite/TestSwitchManualEnumInvalid.java | 1 - .../kaitai/struct/specwrite/TestSwitchManualEnumInvalidElse.java | 1 - .../java/src/io/kaitai/struct/specwrite/TestSwitchManualInt.java | 1 - .../src/io/kaitai/struct/specwrite/TestSwitchManualIntElse.java | 1 - .../io/kaitai/struct/specwrite/TestSwitchManualIntSizeElse.java | 1 - .../io/kaitai/struct/specwrite/TestSwitchManualIntSizeEos.java | 1 - .../java/src/io/kaitai/struct/specwrite/TestSwitchManualStr.java | 1 - .../src/io/kaitai/struct/specwrite/TestSwitchManualStrElse.java | 1 - .../src/io/kaitai/struct/specwrite/TestSwitchMultiBoolOps.java | 1 - .../src/io/kaitai/struct/specwrite/TestSwitchRepeatExpr.java | 1 - .../io/kaitai/struct/specwrite/TestSwitchRepeatExprInvalid.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestTermBytes.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestTermBytes2.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestTermBytes3.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestTermStruct.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestTermStruct2.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestTermStruct3.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestTermStruct4.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestTermStrz.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestTermStrz2.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestTermStrz3.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestTermStrz4.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestTermU1Val.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestTsPacketHeader.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestTypeIntUnaryOp.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestTypeTernary.java | 1 - .../src/io/kaitai/struct/specwrite/TestTypeTernary2ndFalsy.java | 1 - .../src/io/kaitai/struct/specwrite/TestTypeTernaryOpaque.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestUserType.java | 1 - .../src/io/kaitai/struct/specwrite/TestValidEqStrEncodings.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestValidLong.java | 1 - .../src/io/kaitai/struct/specwrite/TestValidNotParsedIf.java | 1 - .../java/src/io/kaitai/struct/specwrite/TestValidOptionalId.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestValidShort.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestValidSwitch.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestYamlInts.java | 1 - spec/java/src/io/kaitai/struct/specwrite/TestZlibSurrounded.java | 1 - .../src/io/kaitai/struct/specwrite/TestZlibWithHeader78.java | 1 - 248 files changed, 248 deletions(-) diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBcdUserTypeBe.java b/spec/java/src/io/kaitai/struct/specwrite/TestBcdUserTypeBe.java index 679420520..ed0fa79a4 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestBcdUserTypeBe.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBcdUserTypeBe.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "bcd_user_type_be.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBcdUserTypeLe.java b/spec/java/src/io/kaitai/struct/specwrite/TestBcdUserTypeLe.java index aa3d277b3..a0ae2a650 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestBcdUserTypeLe.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBcdUserTypeLe.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "bcd_user_type_le.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBitsByteAligned.java b/spec/java/src/io/kaitai/struct/specwrite/TestBitsByteAligned.java index 32f770ba6..7e09a7327 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestBitsByteAligned.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBitsByteAligned.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "fixed_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBitsByteAlignedEofBe.java b/spec/java/src/io/kaitai/struct/specwrite/TestBitsByteAlignedEofBe.java index 9bda88c46..6df19b362 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestBitsByteAlignedEofBe.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBitsByteAlignedEofBe.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "bcd_user_type_be.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBitsByteAlignedEofLe.java b/spec/java/src/io/kaitai/struct/specwrite/TestBitsByteAlignedEofLe.java index 551ccedf0..89afd1326 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestBitsByteAlignedEofLe.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBitsByteAlignedEofLe.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "bcd_user_type_be.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBitsEnum.java b/spec/java/src/io/kaitai/struct/specwrite/TestBitsEnum.java index a7b44c002..f7fe3d289 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestBitsEnum.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBitsEnum.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "fixed_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBitsSeqEndianCombo.java b/spec/java/src/io/kaitai/struct/specwrite/TestBitsSeqEndianCombo.java index 27d3fef58..f31fcaa61 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestBitsSeqEndianCombo.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBitsSeqEndianCombo.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "process_xor_4.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBitsShiftByB32Le.java b/spec/java/src/io/kaitai/struct/specwrite/TestBitsShiftByB32Le.java index cecc5fa3b..2b3a0e6f2 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestBitsShiftByB32Le.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBitsShiftByB32Le.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "bits_shift_by_b32_le.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBitsShiftByB64Le.java b/spec/java/src/io/kaitai/struct/specwrite/TestBitsShiftByB64Le.java index e0bf66980..a3b55b559 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestBitsShiftByB64Le.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBitsShiftByB64Le.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "bits_shift_by_b64_le.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBitsSignedResB32Be.java b/spec/java/src/io/kaitai/struct/specwrite/TestBitsSignedResB32Be.java index f0fd20517..7bec567b6 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestBitsSignedResB32Be.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBitsSignedResB32Be.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "bits_shift_by_b32_le.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBitsSignedResB32Le.java b/spec/java/src/io/kaitai/struct/specwrite/TestBitsSignedResB32Le.java index a397112b0..028fbddc9 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestBitsSignedResB32Le.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBitsSignedResB32Le.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "bits_shift_by_b32_le.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBitsSignedShiftB32Le.java b/spec/java/src/io/kaitai/struct/specwrite/TestBitsSignedShiftB32Le.java index 2dcd352a7..f00732158 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestBitsSignedShiftB32Le.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBitsSignedShiftB32Le.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "bits_signed_shift_b32_le.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBitsSignedShiftB64Le.java b/spec/java/src/io/kaitai/struct/specwrite/TestBitsSignedShiftB64Le.java index 7482daf26..eeb0f75ef 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestBitsSignedShiftB64Le.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBitsSignedShiftB64Le.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "bits_signed_shift_b64_le.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBitsSimple.java b/spec/java/src/io/kaitai/struct/specwrite/TestBitsSimple.java index 1cd67cdad..5914be0a2 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestBitsSimple.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBitsSimple.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "fixed_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBitsSimpleLe.java b/spec/java/src/io/kaitai/struct/specwrite/TestBitsSimpleLe.java index f734b0dbd..232f67921 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestBitsSimpleLe.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBitsSimpleLe.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "fixed_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBitsUnalignedB32Be.java b/spec/java/src/io/kaitai/struct/specwrite/TestBitsUnalignedB32Be.java index 411d71fdb..ba4df88cc 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestBitsUnalignedB32Be.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBitsUnalignedB32Be.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "process_xor_4.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBitsUnalignedB32Le.java b/spec/java/src/io/kaitai/struct/specwrite/TestBitsUnalignedB32Le.java index fe01de3e7..317135f48 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestBitsUnalignedB32Le.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBitsUnalignedB32Le.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "process_xor_4.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBitsUnalignedB64Be.java b/spec/java/src/io/kaitai/struct/specwrite/TestBitsUnalignedB64Be.java index 8a09359cf..8aa948a47 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestBitsUnalignedB64Be.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBitsUnalignedB64Be.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "process_xor_4.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBitsUnalignedB64Le.java b/spec/java/src/io/kaitai/struct/specwrite/TestBitsUnalignedB64Le.java index 9e3fd2f97..d8fbe460b 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestBitsUnalignedB64Le.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBitsUnalignedB64Le.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "process_xor_4.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBufferedStruct.java b/spec/java/src/io/kaitai/struct/specwrite/TestBufferedStruct.java index ae498e291..74a1f758c 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestBufferedStruct.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBufferedStruct.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "buffered_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBytesEosPadTerm.java b/spec/java/src/io/kaitai/struct/specwrite/TestBytesEosPadTerm.java index 83df82297..557f15fec 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestBytesEosPadTerm.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBytesEosPadTerm.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "str_pad_term.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTermEmpty.java b/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTermEmpty.java index a0fae87c2..b16c72560 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTermEmpty.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTermEmpty.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "str_pad_term_empty.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTermRoundtrip.java b/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTermRoundtrip.java index 31d1e3623..6688c3cdc 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTermRoundtrip.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTermRoundtrip.java @@ -30,5 +30,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "str_pad_term.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTermZeroSize.java b/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTermZeroSize.java index cac2e4d3a..116111fdc 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTermZeroSize.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTermZeroSize.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "enum_negative.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestCastNested.java b/spec/java/src/io/kaitai/struct/specwrite/TestCastNested.java index 3dbe2a0f0..70f155aa3 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestCastNested.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestCastNested.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "switch_opcodes.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestCastToImported.java b/spec/java/src/io/kaitai/struct/specwrite/TestCastToImported.java index afb8b37e0..a731caac3 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestCastToImported.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestCastToImported.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "fixed_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestCastToTop.java b/spec/java/src/io/kaitai/struct/specwrite/TestCastToTop.java index 2f3538c90..78b20ecef 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestCastToTop.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestCastToTop.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "fixed_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestCombineBool.java b/spec/java/src/io/kaitai/struct/specwrite/TestCombineBool.java index 9278f1972..24d7eca75 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestCombineBool.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestCombineBool.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "enum_negative.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestCombineBytes.java b/spec/java/src/io/kaitai/struct/specwrite/TestCombineBytes.java index 41d6b8d9b..84cab5a40 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestCombineBytes.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestCombineBytes.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "term_strz.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestCombineEnum.java b/spec/java/src/io/kaitai/struct/specwrite/TestCombineEnum.java index fe703127d..be698ccb3 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestCombineEnum.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestCombineEnum.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "enum_0.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestCombineStr.java b/spec/java/src/io/kaitai/struct/specwrite/TestCombineStr.java index e1000d69c..e3b0037f5 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestCombineStr.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestCombineStr.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "term_strz.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestDebug0.java b/spec/java/src/io/kaitai/struct/specwrite/TestDebug0.java index f3ec597d9..d34cd2ead 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestDebug0.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestDebug0.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "fixed_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestDebugArrayUser.java b/spec/java/src/io/kaitai/struct/specwrite/TestDebugArrayUser.java index fa5764e9b..ddc983fd6 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestDebugArrayUser.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestDebugArrayUser.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "fixed_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestDebugEnumName.java b/spec/java/src/io/kaitai/struct/specwrite/TestDebugEnumName.java index b78966263..5dce576dd 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestDebugEnumName.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestDebugEnumName.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "fixed_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestDebugSwitchUser.java b/spec/java/src/io/kaitai/struct/specwrite/TestDebugSwitchUser.java index 74c825860..c0954a488 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestDebugSwitchUser.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestDebugSwitchUser.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "nav_parent_switch.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestDefaultBigEndian.java b/spec/java/src/io/kaitai/struct/specwrite/TestDefaultBigEndian.java index 3c993f97b..033669936 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestDefaultBigEndian.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestDefaultBigEndian.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "enum_0.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestDefaultBitEndianMod.java b/spec/java/src/io/kaitai/struct/specwrite/TestDefaultBitEndianMod.java index bd94d41e3..d8c10ffaf 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestDefaultBitEndianMod.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestDefaultBitEndianMod.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "fixed_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestDefaultEndianExprInherited.java b/spec/java/src/io/kaitai/struct/specwrite/TestDefaultEndianExprInherited.java index 67fbc9e86..78be155bf 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestDefaultEndianExprInherited.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestDefaultEndianExprInherited.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "endian_expr.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestDefaultEndianExprIsBe.java b/spec/java/src/io/kaitai/struct/specwrite/TestDefaultEndianExprIsBe.java index ff399b3a2..d47541970 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestDefaultEndianExprIsBe.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestDefaultEndianExprIsBe.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "endian_expr.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestDefaultEndianExprIsLe.java b/spec/java/src/io/kaitai/struct/specwrite/TestDefaultEndianExprIsLe.java index 88ec4502e..a4146385e 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestDefaultEndianExprIsLe.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestDefaultEndianExprIsLe.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "endian_expr.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestDefaultEndianMod.java b/spec/java/src/io/kaitai/struct/specwrite/TestDefaultEndianMod.java index 1618f424f..9fdd7c961 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestDefaultEndianMod.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestDefaultEndianMod.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "fixed_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestDocstrings.java b/spec/java/src/io/kaitai/struct/specwrite/TestDocstrings.java index 4a015ac6d..fa62c2b0d 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestDocstrings.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestDocstrings.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "fixed_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestDocstringsDocref.java b/spec/java/src/io/kaitai/struct/specwrite/TestDocstringsDocref.java index 56f09ebb4..886f03d60 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestDocstringsDocref.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestDocstringsDocref.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "fixed_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestDocstringsDocrefMulti.java b/spec/java/src/io/kaitai/struct/specwrite/TestDocstringsDocrefMulti.java index 388af735d..fe4962a29 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestDocstringsDocrefMulti.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestDocstringsDocrefMulti.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "fixed_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEnum0.java b/spec/java/src/io/kaitai/struct/specwrite/TestEnum0.java index 06d3d69ae..c011d535f 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestEnum0.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEnum0.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "enum_0.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEnum1.java b/spec/java/src/io/kaitai/struct/specwrite/TestEnum1.java index 457b79a73..12f5e189a 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestEnum1.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEnum1.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "enum_0.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEnumDeep.java b/spec/java/src/io/kaitai/struct/specwrite/TestEnumDeep.java index d7a6480dc..1686c4c7e 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestEnumDeep.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEnumDeep.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "enum_0.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEnumDeepLiterals.java b/spec/java/src/io/kaitai/struct/specwrite/TestEnumDeepLiterals.java index 339dc9211..e5d31dc14 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestEnumDeepLiterals.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEnumDeepLiterals.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "enum_0.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEnumFancy.java b/spec/java/src/io/kaitai/struct/specwrite/TestEnumFancy.java index fc231e140..0e258d1a6 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestEnumFancy.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEnumFancy.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "enum_0.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEnumForUnknownId.java b/spec/java/src/io/kaitai/struct/specwrite/TestEnumForUnknownId.java index 170f4b7d9..0fe32285a 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestEnumForUnknownId.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEnumForUnknownId.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "fixed_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEnumIf.java b/spec/java/src/io/kaitai/struct/specwrite/TestEnumIf.java index f6fd36c72..4a3f1b208 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestEnumIf.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEnumIf.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "if_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEnumImport.java b/spec/java/src/io/kaitai/struct/specwrite/TestEnumImport.java index 6e78e7d61..611ea0ee7 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestEnumImport.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEnumImport.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "enum_0.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEnumIntRangeS.java b/spec/java/src/io/kaitai/struct/specwrite/TestEnumIntRangeS.java index a0dcac90f..2b926879f 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestEnumIntRangeS.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEnumIntRangeS.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "enum_int_range_s.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEnumIntRangeU.java b/spec/java/src/io/kaitai/struct/specwrite/TestEnumIntRangeU.java index 8cd090dd7..d0092684c 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestEnumIntRangeU.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEnumIntRangeU.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "enum_int_range_u.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEnumInvalid.java b/spec/java/src/io/kaitai/struct/specwrite/TestEnumInvalid.java index b4963b06c..15dc25584 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestEnumInvalid.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEnumInvalid.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "term_strz.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEnumLongRangeS.java b/spec/java/src/io/kaitai/struct/specwrite/TestEnumLongRangeS.java index 300463caf..ab9a0c8b1 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestEnumLongRangeS.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEnumLongRangeS.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "enum_long_range_s.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEnumLongRangeU.java b/spec/java/src/io/kaitai/struct/specwrite/TestEnumLongRangeU.java index 1c79767cd..4f9791130 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestEnumLongRangeU.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEnumLongRangeU.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "enum_long_range_u.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEnumNegative.java b/spec/java/src/io/kaitai/struct/specwrite/TestEnumNegative.java index 3aec4e70f..0ea72208c 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestEnumNegative.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEnumNegative.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "enum_negative.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEnumOfValueInst.java b/spec/java/src/io/kaitai/struct/specwrite/TestEnumOfValueInst.java index c86cc9b68..b4da3d995 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestEnumOfValueInst.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEnumOfValueInst.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "enum_0.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEnumToI.java b/spec/java/src/io/kaitai/struct/specwrite/TestEnumToI.java index 58f1bcdc8..eb7091a0f 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestEnumToI.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEnumToI.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "enum_0.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEnumToIClassBorder1.java b/spec/java/src/io/kaitai/struct/specwrite/TestEnumToIClassBorder1.java index acb065c0d..02a2d3c4f 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestEnumToIClassBorder1.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEnumToIClassBorder1.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "enum_0.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestExpr0.java b/spec/java/src/io/kaitai/struct/specwrite/TestExpr0.java index eff9eae11..114ff1e8b 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestExpr0.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestExpr0.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "str_encodings.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestExpr1.java b/spec/java/src/io/kaitai/struct/specwrite/TestExpr1.java index 97c4cdf23..70494318d 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestExpr1.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestExpr1.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "str_encodings.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestExpr3.java b/spec/java/src/io/kaitai/struct/specwrite/TestExpr3.java index 28c8ceeb8..7ee1ece6c 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestExpr3.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestExpr3.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "fixed_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestExprArray.java b/spec/java/src/io/kaitai/struct/specwrite/TestExprArray.java index f11de5169..735a80c4e 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestExprArray.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestExprArray.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "expr_array.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestExprBits.java b/spec/java/src/io/kaitai/struct/specwrite/TestExprBits.java index 0d2805008..6069c60f0 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestExprBits.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestExprBits.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "switch_opcodes.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestExprBytesCmp.java b/spec/java/src/io/kaitai/struct/specwrite/TestExprBytesCmp.java index ea4327e56..7e549b49a 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestExprBytesCmp.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestExprBytesCmp.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "fixed_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestExprBytesNonLiteral.java b/spec/java/src/io/kaitai/struct/specwrite/TestExprBytesNonLiteral.java index 30f8e6abf..08384876a 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestExprBytesNonLiteral.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestExprBytesNonLiteral.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "enum_negative.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestExprBytesOps.java b/spec/java/src/io/kaitai/struct/specwrite/TestExprBytesOps.java index 571c2629c..8fc831d11 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestExprBytesOps.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestExprBytesOps.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "nav_parent_switch.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestExprCalcArrayOps.java b/spec/java/src/io/kaitai/struct/specwrite/TestExprCalcArrayOps.java index 7b9f0503c..d62cf5a08 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestExprCalcArrayOps.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestExprCalcArrayOps.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "fixed_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestExprEnum.java b/spec/java/src/io/kaitai/struct/specwrite/TestExprEnum.java index a33cd5d0f..2b0b531ed 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestExprEnum.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestExprEnum.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "term_strz.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestExprIfIntEq.java b/spec/java/src/io/kaitai/struct/specwrite/TestExprIfIntEq.java index dc2424443..5382c78dd 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestExprIfIntEq.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestExprIfIntEq.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "process_coerce_switch.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestExprIfIntOps.java b/spec/java/src/io/kaitai/struct/specwrite/TestExprIfIntOps.java index 661e2d3e5..46cfed6fe 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestExprIfIntOps.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestExprIfIntOps.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "instance_io.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestExprIntDiv.java b/spec/java/src/io/kaitai/struct/specwrite/TestExprIntDiv.java index 2afaf6905..8cb0e5a9c 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestExprIntDiv.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestExprIntDiv.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "fixed_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestExprIoEof.java b/spec/java/src/io/kaitai/struct/specwrite/TestExprIoEof.java index 0569e0af7..cadcad617 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestExprIoEof.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestExprIoEof.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "fixed_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestExprIoEofBits.java b/spec/java/src/io/kaitai/struct/specwrite/TestExprIoEofBits.java index b3e43cc82..6d716088e 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestExprIoEofBits.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestExprIoEofBits.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "nav_parent_switch.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestExprIoPos.java b/spec/java/src/io/kaitai/struct/specwrite/TestExprIoPos.java index 247c008ab..5d4b47224 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestExprIoPos.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestExprIoPos.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "expr_io_pos.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestExprIoPosBits.java b/spec/java/src/io/kaitai/struct/specwrite/TestExprIoPosBits.java index e789b35d0..7c3c5b0b0 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestExprIoPosBits.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestExprIoPosBits.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "process_xor_4.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestExprMod.java b/spec/java/src/io/kaitai/struct/specwrite/TestExprMod.java index 2bf680144..ce61eea9c 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestExprMod.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestExprMod.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "fixed_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestExprOpsParens.java b/spec/java/src/io/kaitai/struct/specwrite/TestExprOpsParens.java index 0454443dd..b9ac77705 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestExprOpsParens.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestExprOpsParens.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "enum_negative.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestExprSizeofType0.java b/spec/java/src/io/kaitai/struct/specwrite/TestExprSizeofType0.java index 743287760..60e4be4b3 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestExprSizeofType0.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestExprSizeofType0.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "fixed_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestExprSizeofType1.java b/spec/java/src/io/kaitai/struct/specwrite/TestExprSizeofType1.java index 0e08d38c8..4386f9ca6 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestExprSizeofType1.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestExprSizeofType1.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "fixed_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestExprSizeofValue0.java b/spec/java/src/io/kaitai/struct/specwrite/TestExprSizeofValue0.java index ed8c46a4b..695530ed6 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestExprSizeofValue0.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestExprSizeofValue0.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "fixed_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestExprSizeofValueSized.java b/spec/java/src/io/kaitai/struct/specwrite/TestExprSizeofValueSized.java index e1effc1c2..a53cfe06c 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestExprSizeofValueSized.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestExprSizeofValueSized.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "fixed_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestExprStrEncodings.java b/spec/java/src/io/kaitai/struct/specwrite/TestExprStrEncodings.java index a9a645477..3158a0c3a 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestExprStrEncodings.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestExprStrEncodings.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "str_encodings.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestExprStrOps.java b/spec/java/src/io/kaitai/struct/specwrite/TestExprStrOps.java index 7ffbd4a0e..60949e9a8 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestExprStrOps.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestExprStrOps.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "term_strz.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestFixedContents.java b/spec/java/src/io/kaitai/struct/specwrite/TestFixedContents.java index 016d96295..797104aea 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestFixedContents.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestFixedContents.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "fixed_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestFixedStruct.java b/spec/java/src/io/kaitai/struct/specwrite/TestFixedStruct.java index 7fb0adc94..4d28c4b24 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestFixedStruct.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestFixedStruct.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "fixed_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestFloatToI.java b/spec/java/src/io/kaitai/struct/specwrite/TestFloatToI.java index 15265ff5e..4e8e687f5 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestFloatToI.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestFloatToI.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "floating_points.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestFloatingPoints.java b/spec/java/src/io/kaitai/struct/specwrite/TestFloatingPoints.java index 4e917c914..a5f9ebced 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestFloatingPoints.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestFloatingPoints.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "floating_points.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestHelloWorld.java b/spec/java/src/io/kaitai/struct/specwrite/TestHelloWorld.java index f29328fc7..81c0afd55 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestHelloWorld.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestHelloWorld.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "fixed_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestIfInstances.java b/spec/java/src/io/kaitai/struct/specwrite/TestIfInstances.java index 19208b2d3..afe623110 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestIfInstances.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestIfInstances.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "fixed_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestIfStruct.java b/spec/java/src/io/kaitai/struct/specwrite/TestIfStruct.java index 94d931c6d..15015952e 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestIfStruct.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestIfStruct.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "if_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestIfValues.java b/spec/java/src/io/kaitai/struct/specwrite/TestIfValues.java index 16bac5fd6..d53d439c2 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestIfValues.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestIfValues.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "fixed_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestImports0.java b/spec/java/src/io/kaitai/struct/specwrite/TestImports0.java index ab99faa13..5fb253890 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestImports0.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestImports0.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "fixed_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestImportsAbs.java b/spec/java/src/io/kaitai/struct/specwrite/TestImportsAbs.java index c4167466a..efdbeeea3 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestImportsAbs.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestImportsAbs.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "fixed_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestImportsCircularA.java b/spec/java/src/io/kaitai/struct/specwrite/TestImportsCircularA.java index 041fe609c..4c124570a 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestImportsCircularA.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestImportsCircularA.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "fixed_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestImportsRel1.java b/spec/java/src/io/kaitai/struct/specwrite/TestImportsRel1.java index 0009e2b29..caabc3c0f 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestImportsRel1.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestImportsRel1.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "fixed_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestIndexSizes.java b/spec/java/src/io/kaitai/struct/specwrite/TestIndexSizes.java index b6294f14f..e45918af3 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestIndexSizes.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestIndexSizes.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "index_sizes.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestIndexToParamEos.java b/spec/java/src/io/kaitai/struct/specwrite/TestIndexToParamEos.java index 7a58d306a..312b81340 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestIndexToParamEos.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestIndexToParamEos.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "index_sizes.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestIndexToParamExpr.java b/spec/java/src/io/kaitai/struct/specwrite/TestIndexToParamExpr.java index 965de8759..8773a8974 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestIndexToParamExpr.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestIndexToParamExpr.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "index_sizes.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestIndexToParamUntil.java b/spec/java/src/io/kaitai/struct/specwrite/TestIndexToParamUntil.java index a49b4b28d..d46704728 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestIndexToParamUntil.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestIndexToParamUntil.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "index_sizes.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestInstanceInRepeatExpr.java b/spec/java/src/io/kaitai/struct/specwrite/TestInstanceInRepeatExpr.java index cdc9db099..8a25373ee 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestInstanceInRepeatExpr.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestInstanceInRepeatExpr.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "instance_in_repeat_expr.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestInstanceInRepeatUntil.java b/spec/java/src/io/kaitai/struct/specwrite/TestInstanceInRepeatUntil.java index 532a98fe9..8a97e66d2 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestInstanceInRepeatUntil.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestInstanceInRepeatUntil.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "repeat_until_s4.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestInstanceInSized.java b/spec/java/src/io/kaitai/struct/specwrite/TestInstanceInSized.java index 946ee779e..4312bad84 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestInstanceInSized.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestInstanceInSized.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "process_rotate.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestInstanceIoUser.java b/spec/java/src/io/kaitai/struct/specwrite/TestInstanceIoUser.java index edd6f57e1..6812181a5 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestInstanceIoUser.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestInstanceIoUser.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "instance_io.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestInstanceIoUserEarlier.java b/spec/java/src/io/kaitai/struct/specwrite/TestInstanceIoUserEarlier.java index b1028eb09..2f4a9fe70 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestInstanceIoUserEarlier.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestInstanceIoUserEarlier.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "switch_opcodes2.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestInstanceStdArray.java b/spec/java/src/io/kaitai/struct/specwrite/TestInstanceStdArray.java index 100fa63c9..573cbab2e 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestInstanceStdArray.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestInstanceStdArray.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "instance_std_array.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestInstanceUserArray.java b/spec/java/src/io/kaitai/struct/specwrite/TestInstanceUserArray.java index 42e4aebfa..ae754048d 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestInstanceUserArray.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestInstanceUserArray.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "instance_std_array.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestIntegers.java b/spec/java/src/io/kaitai/struct/specwrite/TestIntegers.java index edecf33e0..f61542f02 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestIntegers.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestIntegers.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "fixed_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestIntegersDoubleOverflow.java b/spec/java/src/io/kaitai/struct/specwrite/TestIntegersDoubleOverflow.java index 6f3503e56..2be81b830 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestIntegersDoubleOverflow.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestIntegersDoubleOverflow.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "integers_double_overflow.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestIntegersMinMax.java b/spec/java/src/io/kaitai/struct/specwrite/TestIntegersMinMax.java index b5b8b9d13..5a6bbb595 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestIntegersMinMax.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestIntegersMinMax.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "integers_min_max.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestIoLocalVar.java b/spec/java/src/io/kaitai/struct/specwrite/TestIoLocalVar.java index 677a4536d..609ccb132 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestIoLocalVar.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestIoLocalVar.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "full256.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestJsSignedRightShift.java b/spec/java/src/io/kaitai/struct/specwrite/TestJsSignedRightShift.java index 398da44cc..6a75e57f7 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestJsSignedRightShift.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestJsSignedRightShift.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "fixed_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestMetaTags.java b/spec/java/src/io/kaitai/struct/specwrite/TestMetaTags.java index 6de1b08ed..69641603a 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestMetaTags.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestMetaTags.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "fixed_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestMetaXref.java b/spec/java/src/io/kaitai/struct/specwrite/TestMetaXref.java index 7990de1c1..f508d88bb 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestMetaXref.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestMetaXref.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "fixed_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestMultipleUse.java b/spec/java/src/io/kaitai/struct/specwrite/TestMultipleUse.java index c5bc57994..a2ff49548 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestMultipleUse.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestMultipleUse.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "position_abs.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestNavParent.java b/spec/java/src/io/kaitai/struct/specwrite/TestNavParent.java index a57c2ad27..4946e65db 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestNavParent.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestNavParent.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "nav.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestNavParent2.java b/spec/java/src/io/kaitai/struct/specwrite/TestNavParent2.java index ac179b9c4..b3204c791 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestNavParent2.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestNavParent2.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "nav_parent2.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestNavParent3.java b/spec/java/src/io/kaitai/struct/specwrite/TestNavParent3.java index a64844045..263cb7b7e 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestNavParent3.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestNavParent3.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "nav_parent2.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestNavParentFalse.java b/spec/java/src/io/kaitai/struct/specwrite/TestNavParentFalse.java index dd4ebc7e4..764f5cb89 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestNavParentFalse.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestNavParentFalse.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "nav_parent_codes.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestNavParentFalse2.java b/spec/java/src/io/kaitai/struct/specwrite/TestNavParentFalse2.java index 2ceff290b..6112e583f 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestNavParentFalse2.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestNavParentFalse2.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "fixed_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestNavParentOverride.java b/spec/java/src/io/kaitai/struct/specwrite/TestNavParentOverride.java index 999cde389..21d6f453c 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestNavParentOverride.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestNavParentOverride.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "nav_parent_codes.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestNavParentSwitch.java b/spec/java/src/io/kaitai/struct/specwrite/TestNavParentSwitch.java index ae25b58d7..1b4781356 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestNavParentSwitch.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestNavParentSwitch.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "nav_parent_switch.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestNavParentSwitchCast.java b/spec/java/src/io/kaitai/struct/specwrite/TestNavParentSwitchCast.java index ed8e494a5..e04abd18a 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestNavParentSwitchCast.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestNavParentSwitchCast.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "switch_integers.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestNavParentVsValueInst.java b/spec/java/src/io/kaitai/struct/specwrite/TestNavParentVsValueInst.java index 18364d97b..50fde2415 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestNavParentVsValueInst.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestNavParentVsValueInst.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "term_strz.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestNavRoot.java b/spec/java/src/io/kaitai/struct/specwrite/TestNavRoot.java index fd37dabfa..d29c3cdb9 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestNavRoot.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestNavRoot.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "nav.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestNestedSameName.java b/spec/java/src/io/kaitai/struct/specwrite/TestNestedSameName.java index 2e43c1908..382e8169d 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestNestedSameName.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestNestedSameName.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "repeat_n_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestNestedSameName2.java b/spec/java/src/io/kaitai/struct/specwrite/TestNestedSameName2.java index 138de272e..8cf178424 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestNestedSameName2.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestNestedSameName2.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "nested_same_name2.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestNestedTypeParam.java b/spec/java/src/io/kaitai/struct/specwrite/TestNestedTypeParam.java index aae02cc74..7b4bc67f3 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestNestedTypeParam.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestNestedTypeParam.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "term_strz.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestNestedTypes.java b/spec/java/src/io/kaitai/struct/specwrite/TestNestedTypes.java index 826e2a352..222ea4d18 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestNestedTypes.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestNestedTypes.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "fixed_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestNestedTypes2.java b/spec/java/src/io/kaitai/struct/specwrite/TestNestedTypes2.java index ae7d74a14..93f95f8e6 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestNestedTypes2.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestNestedTypes2.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "fixed_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestNestedTypes3.java b/spec/java/src/io/kaitai/struct/specwrite/TestNestedTypes3.java index 0f67a2816..cae089bf3 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestNestedTypes3.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestNestedTypes3.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "fixed_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestNonStandard.java b/spec/java/src/io/kaitai/struct/specwrite/TestNonStandard.java index 6863928e8..d9846ad80 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestNonStandard.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestNonStandard.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "fixed_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestOpaqueExternalType.java b/spec/java/src/io/kaitai/struct/specwrite/TestOpaqueExternalType.java index 86d41c8ba..6a7671f0d 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestOpaqueExternalType.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestOpaqueExternalType.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "term_strz.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestOptionalId.java b/spec/java/src/io/kaitai/struct/specwrite/TestOptionalId.java index 70b85c940..a349abff6 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestOptionalId.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestOptionalId.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "fixed_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestParamsCallExtraParens.java b/spec/java/src/io/kaitai/struct/specwrite/TestParamsCallExtraParens.java index 65e4b8a03..fe8cb13b4 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestParamsCallExtraParens.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestParamsCallExtraParens.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "term_strz.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestParamsCallShort.java b/spec/java/src/io/kaitai/struct/specwrite/TestParamsCallShort.java index 5d461843f..91bea142c 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestParamsCallShort.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestParamsCallShort.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "term_strz.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestParamsEnum.java b/spec/java/src/io/kaitai/struct/specwrite/TestParamsEnum.java index bd35d1bd9..d8e20f252 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestParamsEnum.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestParamsEnum.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "enum_0.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassArrayInt.java b/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassArrayInt.java index 184c98098..fef4af37c 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassArrayInt.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassArrayInt.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "position_to_end.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassArrayIo.java b/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassArrayIo.java index aaff8f7b2..6b61490ea 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassArrayIo.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassArrayIo.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "enum_negative.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassArrayStr.java b/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassArrayStr.java index cea4c1fd5..5318e4985 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassArrayStr.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassArrayStr.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "term_strz.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassArrayStruct.java b/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassArrayStruct.java index 216a38b56..30dcaeb8f 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassArrayStruct.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassArrayStruct.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "position_to_end.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassArrayUsertype.java b/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassArrayUsertype.java index 41ee03beb..9113d2345 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassArrayUsertype.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassArrayUsertype.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "position_to_end.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassBool.java b/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassBool.java index eac2aff0e..71215e9da 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassBool.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassBool.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "term_strz.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassIo.java b/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassIo.java index 6623fb857..02c6455fe 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassIo.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassIo.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "enum_negative.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassStruct.java b/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassStruct.java index 296e77c21..5aee009e6 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassStruct.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassStruct.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "enum_negative.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassUsertype.java b/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassUsertype.java index 667917506..adbf65e02 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassUsertype.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestParamsPassUsertype.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "position_in_seq.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestPositionAbs.java b/spec/java/src/io/kaitai/struct/specwrite/TestPositionAbs.java index d2402c857..24569c92c 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestPositionAbs.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestPositionAbs.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "position_abs.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestPositionInSeq.java b/spec/java/src/io/kaitai/struct/specwrite/TestPositionInSeq.java index 3d73633da..105422e65 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestPositionInSeq.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestPositionInSeq.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "position_in_seq.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestPositionToEnd.java b/spec/java/src/io/kaitai/struct/specwrite/TestPositionToEnd.java index b8c4db592..4a4fd17c0 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestPositionToEnd.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestPositionToEnd.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "position_to_end.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestProcessBytesPadTerm.java b/spec/java/src/io/kaitai/struct/specwrite/TestProcessBytesPadTerm.java index b9e958860..abcf0b33d 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestProcessBytesPadTerm.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestProcessBytesPadTerm.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "str_pad_term.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestProcessCoerceBytes.java b/spec/java/src/io/kaitai/struct/specwrite/TestProcessCoerceBytes.java index 7bbbe4886..87cdd5090 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestProcessCoerceBytes.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestProcessCoerceBytes.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "process_coerce_bytes.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestProcessCoerceSwitch.java b/spec/java/src/io/kaitai/struct/specwrite/TestProcessCoerceSwitch.java index 4ed79fa33..cb2a0c40a 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestProcessCoerceSwitch.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestProcessCoerceSwitch.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "process_coerce_switch.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestProcessCoerceUsertype1.java b/spec/java/src/io/kaitai/struct/specwrite/TestProcessCoerceUsertype1.java index f5781201c..9c9662415 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestProcessCoerceUsertype1.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestProcessCoerceUsertype1.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "process_coerce_bytes.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestProcessCoerceUsertype2.java b/spec/java/src/io/kaitai/struct/specwrite/TestProcessCoerceUsertype2.java index 2a49f80bf..0c2ae82ba 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestProcessCoerceUsertype2.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestProcessCoerceUsertype2.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "process_coerce_bytes.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestProcessCustom.java b/spec/java/src/io/kaitai/struct/specwrite/TestProcessCustom.java index b5c2d232b..6b0ad45dc 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestProcessCustom.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestProcessCustom.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "process_rotate.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestProcessCustomNoArgs.java b/spec/java/src/io/kaitai/struct/specwrite/TestProcessCustomNoArgs.java index 916f00e73..e2b492be4 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestProcessCustomNoArgs.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestProcessCustomNoArgs.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "process_rotate.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestProcessRepeatBytes.java b/spec/java/src/io/kaitai/struct/specwrite/TestProcessRepeatBytes.java index a817dbece..4ad590de3 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestProcessRepeatBytes.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestProcessRepeatBytes.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "process_xor_4.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestProcessRepeatUsertype.java b/spec/java/src/io/kaitai/struct/specwrite/TestProcessRepeatUsertype.java index 3a80d9cb9..2a9eaf4ec 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestProcessRepeatUsertype.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestProcessRepeatUsertype.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "process_xor_4.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestProcessRepeatUsertypeDynargCustom.java b/spec/java/src/io/kaitai/struct/specwrite/TestProcessRepeatUsertypeDynargCustom.java index bdf33f6d4..f563edd65 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestProcessRepeatUsertypeDynargCustom.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestProcessRepeatUsertypeDynargCustom.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "process_rotate.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestProcessRepeatUsertypeDynargRotate.java b/spec/java/src/io/kaitai/struct/specwrite/TestProcessRepeatUsertypeDynargRotate.java index b1d1e6131..5a8bcbcfc 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestProcessRepeatUsertypeDynargRotate.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestProcessRepeatUsertypeDynargRotate.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "process_rotate.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestProcessRepeatUsertypeDynargXor.java b/spec/java/src/io/kaitai/struct/specwrite/TestProcessRepeatUsertypeDynargXor.java index 4ecdbf55f..d13772289 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestProcessRepeatUsertypeDynargXor.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestProcessRepeatUsertypeDynargXor.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "process_xor_4.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestProcessStructPadTerm.java b/spec/java/src/io/kaitai/struct/specwrite/TestProcessStructPadTerm.java index 2d95f13ce..7f030be5c 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestProcessStructPadTerm.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestProcessStructPadTerm.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "str_pad_term.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestProcessTermStruct.java b/spec/java/src/io/kaitai/struct/specwrite/TestProcessTermStruct.java index d0ace7853..7315bb824 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestProcessTermStruct.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestProcessTermStruct.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "term_strz.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestProcessXor4Const.java b/spec/java/src/io/kaitai/struct/specwrite/TestProcessXor4Const.java index 8496fd82d..626ce46b3 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestProcessXor4Const.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestProcessXor4Const.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "process_xor_4.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestProcessXor4Value.java b/spec/java/src/io/kaitai/struct/specwrite/TestProcessXor4Value.java index 513959504..2f86221a8 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestProcessXor4Value.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestProcessXor4Value.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "process_xor_4.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestProcessXorConst.java b/spec/java/src/io/kaitai/struct/specwrite/TestProcessXorConst.java index 0fbc66704..f10489e4f 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestProcessXorConst.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestProcessXorConst.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "process_xor_1.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestProcessXorValue.java b/spec/java/src/io/kaitai/struct/specwrite/TestProcessXorValue.java index b14fd5a07..eb5821101 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestProcessXorValue.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestProcessXorValue.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "process_xor_1.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRecursiveOne.java b/spec/java/src/io/kaitai/struct/specwrite/TestRecursiveOne.java index 473aff896..48b1239b0 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestRecursiveOne.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRecursiveOne.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "fixed_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosBit.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosBit.java index 1a24e7ea4..07f3868ef 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosBit.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosBit.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "enum_0.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosBytesPad.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosBytesPad.java index 025c1d2ee..1ffee0810 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosBytesPad.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosBytesPad.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "repeat_until_process.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosBytesPadTerm.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosBytesPadTerm.java index 1994c6cde..3cf9697b7 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosBytesPadTerm.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosBytesPadTerm.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "repeat_until_process.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosStruct.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosStruct.java index b017b5d9e..8c53d9661 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosStruct.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosStruct.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "repeat_eos_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosTermBytes.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosTermBytes.java index 67c0179ed..3e1f0d5dc 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosTermBytes.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosTermBytes.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "process_rotate.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosTermStruct.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosTermStruct.java index f55eae655..2ed75d96f 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosTermStruct.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosTermStruct.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "process_rotate.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosU4.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosU4.java index 953933d2c..820614789 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosU4.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosU4.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "repeat_eos_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNBytes.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNBytes.java index d9f51a74f..dccc9d426 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNBytes.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNBytes.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "repeat_until_process.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNBytesPad.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNBytesPad.java index 96850fd52..c6b9a4f87 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNBytesPad.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNBytesPad.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "repeat_until_process.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNBytesPadTerm.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNBytesPadTerm.java index bc6c89312..55b074303 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNBytesPadTerm.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNBytesPadTerm.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "repeat_until_process.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStruct.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStruct.java index d63540eb4..2f216547f 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStruct.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStruct.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "repeat_n_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStrzDouble.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStrzDouble.java index 49790ad3f..dab710a07 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStrzDouble.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStrzDouble.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "repeat_n_strz.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNTermBytes.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNTermBytes.java index c943164b1..11cd9ddfe 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNTermBytes.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNTermBytes.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "repeat_until_process.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNTermStruct.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNTermStruct.java index e51a57ffe..ccab3c82c 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNTermStruct.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNTermStruct.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "repeat_until_process.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilBytes.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilBytes.java index a48cac6f9..3789c89f4 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilBytes.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilBytes.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "repeat_until_process.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilBytesPad.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilBytesPad.java index 4d3b44f8b..09cdbae44 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilBytesPad.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilBytesPad.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "repeat_until_process.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilBytesPadTerm.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilBytesPadTerm.java index 23d76e8e3..a7f3783e4 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilBytesPadTerm.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilBytesPadTerm.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "repeat_until_process.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilCalcArrayType.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilCalcArrayType.java index 79ac524c2..34182fb23 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilCalcArrayType.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilCalcArrayType.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "repeat_until_process.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilComplex.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilComplex.java index 69b50dc6c..bae110a2b 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilComplex.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilComplex.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "repeat_until_complex.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilSized.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilSized.java index 5bfe8ee4a..6c95f9f82 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilSized.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilSized.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "repeat_until_process.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilTermBytes.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilTermBytes.java index 007094285..e14bc7a36 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilTermBytes.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilTermBytes.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "repeat_until_process.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilTermStruct.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilTermStruct.java index 1a21a7912..5b390cb54 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilTermStruct.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilTermStruct.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "repeat_until_process.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestStrEncodingsDefault.java b/spec/java/src/io/kaitai/struct/specwrite/TestStrEncodingsDefault.java index f656e18ce..d16483b61 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestStrEncodingsDefault.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestStrEncodingsDefault.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "str_encodings.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestStrEncodingsUtf16.java b/spec/java/src/io/kaitai/struct/specwrite/TestStrEncodingsUtf16.java index 38afa70dc..042d0411a 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestStrEncodingsUtf16.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestStrEncodingsUtf16.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "str_encodings_utf16.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestStrEosPadTerm.java b/spec/java/src/io/kaitai/struct/specwrite/TestStrEosPadTerm.java index ad0da1408..ffb020fd1 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestStrEosPadTerm.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestStrEosPadTerm.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "str_pad_term.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestStrEosPadTermEmpty.java b/spec/java/src/io/kaitai/struct/specwrite/TestStrEosPadTermEmpty.java index 8c38d8c6a..1c1fda78b 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestStrEosPadTermEmpty.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestStrEosPadTermEmpty.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "str_pad_term_empty.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestStrEosPadTermEqual.java b/spec/java/src/io/kaitai/struct/specwrite/TestStrEosPadTermEqual.java index e53ca74c5..cfc3c27ed 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestStrEosPadTermEqual.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestStrEosPadTermEqual.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "str_pad_term.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestStrLiterals2.java b/spec/java/src/io/kaitai/struct/specwrite/TestStrLiterals2.java index bb88d8170..52f7f9cc5 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestStrLiterals2.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestStrLiterals2.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "fixed_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestStrPadTerm.java b/spec/java/src/io/kaitai/struct/specwrite/TestStrPadTerm.java index a518a858d..2b0ee1d84 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestStrPadTerm.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestStrPadTerm.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "str_pad_term.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestStrPadTermEmpty.java b/spec/java/src/io/kaitai/struct/specwrite/TestStrPadTermEmpty.java index f498d7214..ce1205412 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestStrPadTermEmpty.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestStrPadTermEmpty.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "str_pad_term_empty.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestStrPadTermEqual.java b/spec/java/src/io/kaitai/struct/specwrite/TestStrPadTermEqual.java index 297850899..5e8ee332d 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestStrPadTermEqual.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestStrPadTermEqual.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "str_pad_term.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestStrPadTermRoundtrip.java b/spec/java/src/io/kaitai/struct/specwrite/TestStrPadTermRoundtrip.java index 60a1c7c63..1fd836f82 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestStrPadTermRoundtrip.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestStrPadTermRoundtrip.java @@ -30,5 +30,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "str_pad_term.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestStrPadTermZeroSize.java b/spec/java/src/io/kaitai/struct/specwrite/TestStrPadTermZeroSize.java index 859e880eb..3fc63d3e2 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestStrPadTermZeroSize.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestStrPadTermZeroSize.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "enum_negative.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestStructPadTerm.java b/spec/java/src/io/kaitai/struct/specwrite/TestStructPadTerm.java index 69dead14d..060d63b26 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestStructPadTerm.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestStructPadTerm.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "str_pad_term.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestStructPadTermEqual.java b/spec/java/src/io/kaitai/struct/specwrite/TestStructPadTermEqual.java index d9a6a94bf..fa444316e 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestStructPadTermEqual.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestStructPadTermEqual.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "str_pad_term.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchBytearray.java b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchBytearray.java index d1de882ab..b111dae75 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchBytearray.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchBytearray.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "switch_opcodes.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchElseOnly.java b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchElseOnly.java index 860539d4b..2e94521ad 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchElseOnly.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchElseOnly.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "switch_opcodes.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchIntegers.java b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchIntegers.java index 5eede418f..1d30e7056 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchIntegers.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchIntegers.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "switch_integers.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchIntegers2.java b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchIntegers2.java index aa46011d6..f3d044b5a 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchIntegers2.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchIntegers2.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "switch_integers.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualEnum.java b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualEnum.java index e9cfaf7c0..8f1463ed6 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualEnum.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualEnum.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "switch_opcodes.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualEnumInvalid.java b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualEnumInvalid.java index f39371ea6..5b411f250 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualEnumInvalid.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualEnumInvalid.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "enum_negative.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualEnumInvalidElse.java b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualEnumInvalidElse.java index a01d4ad00..0c49b0b7c 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualEnumInvalidElse.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualEnumInvalidElse.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "enum_negative.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualInt.java b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualInt.java index 8da4116d0..fc662f8c5 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualInt.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualInt.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "switch_opcodes.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualIntElse.java b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualIntElse.java index d079a11eb..6c3dcfb45 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualIntElse.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualIntElse.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "switch_opcodes2.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualIntSizeElse.java b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualIntSizeElse.java index 36a130d87..8880bbf89 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualIntSizeElse.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualIntSizeElse.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "switch_tlv.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualIntSizeEos.java b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualIntSizeEos.java index 1fcf4209b..3c2bc4057 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualIntSizeEos.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualIntSizeEos.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "switch_tlv.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualStr.java b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualStr.java index 475c8ecf7..7965b0ff5 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualStr.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualStr.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "switch_opcodes.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualStrElse.java b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualStrElse.java index 43291a0b0..21af12416 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualStrElse.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualStrElse.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "switch_opcodes2.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchMultiBoolOps.java b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchMultiBoolOps.java index e9de2acee..c8a7842a0 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchMultiBoolOps.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchMultiBoolOps.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "switch_integers.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchRepeatExpr.java b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchRepeatExpr.java index 66e0ff691..02127a73a 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchRepeatExpr.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchRepeatExpr.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "switch_tlv.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchRepeatExprInvalid.java b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchRepeatExprInvalid.java index cc1b7f080..4c2607044 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchRepeatExprInvalid.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchRepeatExprInvalid.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "switch_tlv.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestTermBytes.java b/spec/java/src/io/kaitai/struct/specwrite/TestTermBytes.java index f34781ccf..3c71434a6 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestTermBytes.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestTermBytes.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "term_strz.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestTermBytes2.java b/spec/java/src/io/kaitai/struct/specwrite/TestTermBytes2.java index ba510a690..0fd46c46e 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestTermBytes2.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestTermBytes2.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "term_strz.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestTermBytes3.java b/spec/java/src/io/kaitai/struct/specwrite/TestTermBytes3.java index 9b680c89e..269df8dda 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestTermBytes3.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestTermBytes3.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "term_strz.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestTermStruct.java b/spec/java/src/io/kaitai/struct/specwrite/TestTermStruct.java index 5f14f6e21..a8396c926 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestTermStruct.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestTermStruct.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "term_strz.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestTermStruct2.java b/spec/java/src/io/kaitai/struct/specwrite/TestTermStruct2.java index 50f765bae..89f368222 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestTermStruct2.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestTermStruct2.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "term_strz.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestTermStruct3.java b/spec/java/src/io/kaitai/struct/specwrite/TestTermStruct3.java index ef025b99a..82436812d 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestTermStruct3.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestTermStruct3.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "term_strz.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestTermStruct4.java b/spec/java/src/io/kaitai/struct/specwrite/TestTermStruct4.java index cf9cbc699..73608e45f 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestTermStruct4.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestTermStruct4.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "term_strz.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestTermStrz.java b/spec/java/src/io/kaitai/struct/specwrite/TestTermStrz.java index c2245d12a..f6fafb447 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestTermStrz.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestTermStrz.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "term_strz.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestTermStrz2.java b/spec/java/src/io/kaitai/struct/specwrite/TestTermStrz2.java index 7879320b6..ca6298b81 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestTermStrz2.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestTermStrz2.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "term_strz.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestTermStrz3.java b/spec/java/src/io/kaitai/struct/specwrite/TestTermStrz3.java index aced9fa64..aa55e51f9 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestTermStrz3.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestTermStrz3.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "term_strz.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestTermStrz4.java b/spec/java/src/io/kaitai/struct/specwrite/TestTermStrz4.java index 01725e278..12fabd16b 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestTermStrz4.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestTermStrz4.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "term_strz.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestTermU1Val.java b/spec/java/src/io/kaitai/struct/specwrite/TestTermU1Val.java index 7841c9008..514db7d54 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestTermU1Val.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestTermU1Val.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "str_encodings.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestTsPacketHeader.java b/spec/java/src/io/kaitai/struct/specwrite/TestTsPacketHeader.java index 854734602..123360f36 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestTsPacketHeader.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestTsPacketHeader.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "ts_packet.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestTypeIntUnaryOp.java b/spec/java/src/io/kaitai/struct/specwrite/TestTypeIntUnaryOp.java index ea9c7cb76..d54a602bf 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestTypeIntUnaryOp.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestTypeIntUnaryOp.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "fixed_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestTypeTernary.java b/spec/java/src/io/kaitai/struct/specwrite/TestTypeTernary.java index 7bdf905a5..8b88db955 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestTypeTernary.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestTypeTernary.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "term_strz.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestTypeTernary2ndFalsy.java b/spec/java/src/io/kaitai/struct/specwrite/TestTypeTernary2ndFalsy.java index 9e8f8f34c..c02a45237 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestTypeTernary2ndFalsy.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestTypeTernary2ndFalsy.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "switch_integers.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestTypeTernaryOpaque.java b/spec/java/src/io/kaitai/struct/specwrite/TestTypeTernaryOpaque.java index e4bad0cbe..c449a71f3 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestTypeTernaryOpaque.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestTypeTernaryOpaque.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "term_strz.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestUserType.java b/spec/java/src/io/kaitai/struct/specwrite/TestUserType.java index 29f2712c5..61d85090c 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestUserType.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestUserType.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "repeat_until_s4.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestValidEqStrEncodings.java b/spec/java/src/io/kaitai/struct/specwrite/TestValidEqStrEncodings.java index 71717b005..901afb0cb 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestValidEqStrEncodings.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestValidEqStrEncodings.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "str_encodings.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestValidLong.java b/spec/java/src/io/kaitai/struct/specwrite/TestValidLong.java index e6ad1ceb7..e22f9eeda 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestValidLong.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestValidLong.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "fixed_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestValidNotParsedIf.java b/spec/java/src/io/kaitai/struct/specwrite/TestValidNotParsedIf.java index ffca570fb..1ed9c53c5 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestValidNotParsedIf.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestValidNotParsedIf.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "fixed_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestValidOptionalId.java b/spec/java/src/io/kaitai/struct/specwrite/TestValidOptionalId.java index 8992a35ff..21581537c 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestValidOptionalId.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestValidOptionalId.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "fixed_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestValidShort.java b/spec/java/src/io/kaitai/struct/specwrite/TestValidShort.java index d79355bc5..1a11e48ea 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestValidShort.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestValidShort.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "fixed_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestValidSwitch.java b/spec/java/src/io/kaitai/struct/specwrite/TestValidSwitch.java index c5a644f6d..014e44544 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestValidSwitch.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestValidSwitch.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "fixed_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestYamlInts.java b/spec/java/src/io/kaitai/struct/specwrite/TestYamlInts.java index 7a83e6491..60423cd2e 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestYamlInts.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestYamlInts.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "fixed_struct.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestZlibSurrounded.java b/spec/java/src/io/kaitai/struct/specwrite/TestZlibSurrounded.java index a99cc2b02..dedf7d626 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestZlibSurrounded.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestZlibSurrounded.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "zlib_surrounded.bin"; } - } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestZlibWithHeader78.java b/spec/java/src/io/kaitai/struct/specwrite/TestZlibWithHeader78.java index fb83cd6ea..939525cc4 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestZlibWithHeader78.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestZlibWithHeader78.java @@ -16,5 +16,4 @@ protected Class getStructClass() { protected String getSrcFilename() { return "zlib_with_header_78.bin"; } - } From c49776f1e6ec24dd70db9a9c79e281bf3db5bf96 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Fri, 28 Jul 2023 19:29:18 +0200 Subject: [PATCH 101/126] Regen Java specwrite tests from KST: skip roundtrip properly --- .../specwrite/TestDefaultEndianExprException.java | 11 +++++++++-- .../struct/specwrite/TestEofExceptionBitsBe.java | 11 +++++++++-- .../struct/specwrite/TestEofExceptionBitsBe2.java | 11 +++++++++-- .../struct/specwrite/TestEofExceptionBitsLe.java | 11 +++++++++-- .../struct/specwrite/TestEofExceptionBitsLe2.java | 11 +++++++++-- .../struct/specwrite/TestEofExceptionBytes.java | 11 +++++++++-- .../kaitai/struct/specwrite/TestEofExceptionU4.java | 11 +++++++++-- .../struct/specwrite/TestEosExceptionBytes.java | 11 +++++++++-- .../kaitai/struct/specwrite/TestEosExceptionU4.java | 11 +++++++++-- .../struct/specwrite/TestValidFailAnyofInt.java | 11 +++++++++-- .../struct/specwrite/TestValidFailContents.java | 11 +++++++++-- .../kaitai/struct/specwrite/TestValidFailEqBytes.java | 11 +++++++++-- .../kaitai/struct/specwrite/TestValidFailEqInt.java | 11 +++++++++-- .../kaitai/struct/specwrite/TestValidFailEqStr.java | 11 +++++++++-- .../io/kaitai/struct/specwrite/TestValidFailExpr.java | 11 +++++++++-- .../io/kaitai/struct/specwrite/TestValidFailInst.java | 11 +++++++++-- .../kaitai/struct/specwrite/TestValidFailMaxInt.java | 11 +++++++++-- .../kaitai/struct/specwrite/TestValidFailMinInt.java | 11 +++++++++-- .../struct/specwrite/TestValidFailRangeBytes.java | 11 +++++++++-- .../struct/specwrite/TestValidFailRangeFloat.java | 11 +++++++++-- .../struct/specwrite/TestValidFailRangeInt.java | 11 +++++++++-- .../struct/specwrite/TestValidFailRangeStr.java | 11 +++++++++-- 22 files changed, 198 insertions(+), 44 deletions(-) diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestDefaultEndianExprException.java b/spec/java/src/io/kaitai/struct/specwrite/TestDefaultEndianExprException.java index b2fadb476..eacc461aa 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestDefaultEndianExprException.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestDefaultEndianExprException.java @@ -5,15 +5,22 @@ import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.DefaultEndianExprException; import org.testng.annotations.Test; +import org.testng.SkipException; public class TestDefaultEndianExprException extends CommonSpec { @Override protected Class getStructClass() { - throw new UnsupportedOperationException(); + return DefaultEndianExprException.class; } @Override protected String getSrcFilename() { - throw new UnsupportedOperationException(); + return "endian_expr.bin"; + } + + @Override + @Test + protected void testReadWriteRoundtrip() throws Exception { + throw new SkipException("cannot use roundtrip because parsing is expected to fail"); } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBitsBe.java b/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBitsBe.java index 0f8def5ee..01e603794 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBitsBe.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBitsBe.java @@ -11,17 +11,24 @@ import org.testng.Assert.ThrowingRunnable; import org.testng.annotations.Test; +import org.testng.SkipException; import static org.testng.Assert.assertEquals; public class TestEofExceptionBitsBe extends CommonSpec { @Override protected Class getStructClass() { - throw new UnsupportedOperationException(); + return EofExceptionBitsBe.class; } @Override protected String getSrcFilename() { - throw new UnsupportedOperationException(); + return "nav_parent_switch.bin"; + } + + @Override + @Test + protected void testReadWriteRoundtrip() throws Exception { + throw new SkipException("cannot use roundtrip because parsing is expected to fail"); } @Test diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBitsBe2.java b/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBitsBe2.java index 825921e5a..30c046733 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBitsBe2.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBitsBe2.java @@ -11,17 +11,24 @@ import org.testng.Assert.ThrowingRunnable; import org.testng.annotations.Test; +import org.testng.SkipException; import static org.testng.Assert.assertEquals; public class TestEofExceptionBitsBe2 extends CommonSpec { @Override protected Class getStructClass() { - throw new UnsupportedOperationException(); + return EofExceptionBitsBe2.class; } @Override protected String getSrcFilename() { - throw new UnsupportedOperationException(); + return "nav_parent_switch.bin"; + } + + @Override + @Test + protected void testReadWriteRoundtrip() throws Exception { + throw new SkipException("cannot use roundtrip because parsing is expected to fail"); } @Test diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBitsLe.java b/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBitsLe.java index 1ec86d9e8..64585dd10 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBitsLe.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBitsLe.java @@ -11,17 +11,24 @@ import org.testng.Assert.ThrowingRunnable; import org.testng.annotations.Test; +import org.testng.SkipException; import static org.testng.Assert.assertEquals; public class TestEofExceptionBitsLe extends CommonSpec { @Override protected Class getStructClass() { - throw new UnsupportedOperationException(); + return EofExceptionBitsLe.class; } @Override protected String getSrcFilename() { - throw new UnsupportedOperationException(); + return "nav_parent_switch.bin"; + } + + @Override + @Test + protected void testReadWriteRoundtrip() throws Exception { + throw new SkipException("cannot use roundtrip because parsing is expected to fail"); } @Test diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBitsLe2.java b/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBitsLe2.java index a399db7bd..6c7877a55 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBitsLe2.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBitsLe2.java @@ -11,17 +11,24 @@ import org.testng.Assert.ThrowingRunnable; import org.testng.annotations.Test; +import org.testng.SkipException; import static org.testng.Assert.assertEquals; public class TestEofExceptionBitsLe2 extends CommonSpec { @Override protected Class getStructClass() { - throw new UnsupportedOperationException(); + return EofExceptionBitsLe2.class; } @Override protected String getSrcFilename() { - throw new UnsupportedOperationException(); + return "nav_parent_switch.bin"; + } + + @Override + @Test + protected void testReadWriteRoundtrip() throws Exception { + throw new SkipException("cannot use roundtrip because parsing is expected to fail"); } @Test diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBytes.java b/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBytes.java index a867d947b..eadb85e1a 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBytes.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBytes.java @@ -11,17 +11,24 @@ import org.testng.Assert.ThrowingRunnable; import org.testng.annotations.Test; +import org.testng.SkipException; import static org.testng.Assert.assertEquals; public class TestEofExceptionBytes extends CommonSpec { @Override protected Class getStructClass() { - throw new UnsupportedOperationException(); + return EofExceptionBytes.class; } @Override protected String getSrcFilename() { - throw new UnsupportedOperationException(); + return "term_strz.bin"; + } + + @Override + @Test + protected void testReadWriteRoundtrip() throws Exception { + throw new SkipException("cannot use roundtrip because parsing is expected to fail"); } @Test diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionU4.java b/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionU4.java index e53ec8203..78dd1c8c4 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionU4.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionU4.java @@ -11,17 +11,24 @@ import org.testng.Assert.ThrowingRunnable; import org.testng.annotations.Test; +import org.testng.SkipException; import static org.testng.Assert.assertEquals; public class TestEofExceptionU4 extends CommonSpec { @Override protected Class getStructClass() { - throw new UnsupportedOperationException(); + return EofExceptionU4.class; } @Override protected String getSrcFilename() { - throw new UnsupportedOperationException(); + return "term_strz.bin"; + } + + @Override + @Test + protected void testReadWriteRoundtrip() throws Exception { + throw new SkipException("cannot use roundtrip because parsing is expected to fail"); } @Test diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEosExceptionBytes.java b/spec/java/src/io/kaitai/struct/specwrite/TestEosExceptionBytes.java index 574f5a028..03a0df832 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestEosExceptionBytes.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEosExceptionBytes.java @@ -5,16 +5,23 @@ import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.EosExceptionBytes; import org.testng.annotations.Test; +import org.testng.SkipException; public class TestEosExceptionBytes extends CommonSpec { @Override protected Class getStructClass() { - throw new UnsupportedOperationException(); + return EosExceptionBytes.class; } @Override protected String getSrcFilename() { - throw new UnsupportedOperationException(); + return "term_strz.bin"; + } + + @Override + @Test + protected void testReadWriteRoundtrip() throws Exception { + throw new SkipException("cannot use roundtrip because parsing is expected to fail"); } @Test(expectedExceptions = java.nio.BufferOverflowException.class) diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEosExceptionU4.java b/spec/java/src/io/kaitai/struct/specwrite/TestEosExceptionU4.java index 5fae851ff..e8e72b035 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestEosExceptionU4.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEosExceptionU4.java @@ -5,16 +5,23 @@ import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.EosExceptionU4; import org.testng.annotations.Test; +import org.testng.SkipException; public class TestEosExceptionU4 extends CommonSpec { @Override protected Class getStructClass() { - throw new UnsupportedOperationException(); + return EosExceptionU4.class; } @Override protected String getSrcFilename() { - throw new UnsupportedOperationException(); + return "term_strz.bin"; + } + + @Override + @Test + protected void testReadWriteRoundtrip() throws Exception { + throw new SkipException("cannot use roundtrip because parsing is expected to fail"); } @Test(expectedExceptions = java.nio.BufferOverflowException.class) diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailAnyofInt.java b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailAnyofInt.java index 244806299..4ff45ada2 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailAnyofInt.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailAnyofInt.java @@ -5,15 +5,22 @@ import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.ValidFailAnyofInt; import org.testng.annotations.Test; +import org.testng.SkipException; public class TestValidFailAnyofInt extends CommonSpec { @Override protected Class getStructClass() { - throw new UnsupportedOperationException(); + return ValidFailAnyofInt.class; } @Override protected String getSrcFilename() { - throw new UnsupportedOperationException(); + return "fixed_struct.bin"; + } + + @Override + @Test + protected void testReadWriteRoundtrip() throws Exception { + throw new SkipException("cannot use roundtrip because parsing is expected to fail"); } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailContents.java b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailContents.java index b184d6342..7527292a8 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailContents.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailContents.java @@ -5,15 +5,22 @@ import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.ValidFailContents; import org.testng.annotations.Test; +import org.testng.SkipException; public class TestValidFailContents extends CommonSpec { @Override protected Class getStructClass() { - throw new UnsupportedOperationException(); + return ValidFailContents.class; } @Override protected String getSrcFilename() { - throw new UnsupportedOperationException(); + return "fixed_struct.bin"; + } + + @Override + @Test + protected void testReadWriteRoundtrip() throws Exception { + throw new SkipException("cannot use roundtrip because parsing is expected to fail"); } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailEqBytes.java b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailEqBytes.java index ba7eeac87..0944a973b 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailEqBytes.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailEqBytes.java @@ -5,15 +5,22 @@ import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.ValidFailEqBytes; import org.testng.annotations.Test; +import org.testng.SkipException; public class TestValidFailEqBytes extends CommonSpec { @Override protected Class getStructClass() { - throw new UnsupportedOperationException(); + return ValidFailEqBytes.class; } @Override protected String getSrcFilename() { - throw new UnsupportedOperationException(); + return "fixed_struct.bin"; + } + + @Override + @Test + protected void testReadWriteRoundtrip() throws Exception { + throw new SkipException("cannot use roundtrip because parsing is expected to fail"); } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailEqInt.java b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailEqInt.java index 79f3daa8b..d91cb5d46 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailEqInt.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailEqInt.java @@ -5,15 +5,22 @@ import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.ValidFailEqInt; import org.testng.annotations.Test; +import org.testng.SkipException; public class TestValidFailEqInt extends CommonSpec { @Override protected Class getStructClass() { - throw new UnsupportedOperationException(); + return ValidFailEqInt.class; } @Override protected String getSrcFilename() { - throw new UnsupportedOperationException(); + return "fixed_struct.bin"; + } + + @Override + @Test + protected void testReadWriteRoundtrip() throws Exception { + throw new SkipException("cannot use roundtrip because parsing is expected to fail"); } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailEqStr.java b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailEqStr.java index 6279ae886..39bae4e0e 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailEqStr.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailEqStr.java @@ -5,15 +5,22 @@ import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.ValidFailEqStr; import org.testng.annotations.Test; +import org.testng.SkipException; public class TestValidFailEqStr extends CommonSpec { @Override protected Class getStructClass() { - throw new UnsupportedOperationException(); + return ValidFailEqStr.class; } @Override protected String getSrcFilename() { - throw new UnsupportedOperationException(); + return "fixed_struct.bin"; + } + + @Override + @Test + protected void testReadWriteRoundtrip() throws Exception { + throw new SkipException("cannot use roundtrip because parsing is expected to fail"); } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailExpr.java b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailExpr.java index efb40f97f..4d46e39f1 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailExpr.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailExpr.java @@ -5,15 +5,22 @@ import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.ValidFailExpr; import org.testng.annotations.Test; +import org.testng.SkipException; public class TestValidFailExpr extends CommonSpec { @Override protected Class getStructClass() { - throw new UnsupportedOperationException(); + return ValidFailExpr.class; } @Override protected String getSrcFilename() { - throw new UnsupportedOperationException(); + return "nav_parent_switch.bin"; + } + + @Override + @Test + protected void testReadWriteRoundtrip() throws Exception { + throw new SkipException("cannot use roundtrip because parsing is expected to fail"); } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailInst.java b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailInst.java index 2fdfb06a6..19edd82d2 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailInst.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailInst.java @@ -5,15 +5,22 @@ import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.ValidFailInst; import org.testng.annotations.Test; +import org.testng.SkipException; public class TestValidFailInst extends CommonSpec { @Override protected Class getStructClass() { - throw new UnsupportedOperationException(); + return ValidFailInst.class; } @Override protected String getSrcFilename() { - throw new UnsupportedOperationException(); + return "fixed_struct.bin"; + } + + @Override + @Test + protected void testReadWriteRoundtrip() throws Exception { + throw new SkipException("cannot use roundtrip because parsing is expected to fail"); } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailMaxInt.java b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailMaxInt.java index 5e800d49b..8fdd4965d 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailMaxInt.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailMaxInt.java @@ -5,15 +5,22 @@ import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.ValidFailMaxInt; import org.testng.annotations.Test; +import org.testng.SkipException; public class TestValidFailMaxInt extends CommonSpec { @Override protected Class getStructClass() { - throw new UnsupportedOperationException(); + return ValidFailMaxInt.class; } @Override protected String getSrcFilename() { - throw new UnsupportedOperationException(); + return "fixed_struct.bin"; + } + + @Override + @Test + protected void testReadWriteRoundtrip() throws Exception { + throw new SkipException("cannot use roundtrip because parsing is expected to fail"); } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailMinInt.java b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailMinInt.java index 785698fa8..303122a4e 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailMinInt.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailMinInt.java @@ -5,15 +5,22 @@ import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.ValidFailMinInt; import org.testng.annotations.Test; +import org.testng.SkipException; public class TestValidFailMinInt extends CommonSpec { @Override protected Class getStructClass() { - throw new UnsupportedOperationException(); + return ValidFailMinInt.class; } @Override protected String getSrcFilename() { - throw new UnsupportedOperationException(); + return "fixed_struct.bin"; + } + + @Override + @Test + protected void testReadWriteRoundtrip() throws Exception { + throw new SkipException("cannot use roundtrip because parsing is expected to fail"); } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailRangeBytes.java b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailRangeBytes.java index eb90424be..119bfbe92 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailRangeBytes.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailRangeBytes.java @@ -5,15 +5,22 @@ import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.ValidFailRangeBytes; import org.testng.annotations.Test; +import org.testng.SkipException; public class TestValidFailRangeBytes extends CommonSpec { @Override protected Class getStructClass() { - throw new UnsupportedOperationException(); + return ValidFailRangeBytes.class; } @Override protected String getSrcFilename() { - throw new UnsupportedOperationException(); + return "fixed_struct.bin"; + } + + @Override + @Test + protected void testReadWriteRoundtrip() throws Exception { + throw new SkipException("cannot use roundtrip because parsing is expected to fail"); } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailRangeFloat.java b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailRangeFloat.java index ad857585c..ea873c39e 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailRangeFloat.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailRangeFloat.java @@ -5,15 +5,22 @@ import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.ValidFailRangeFloat; import org.testng.annotations.Test; +import org.testng.SkipException; public class TestValidFailRangeFloat extends CommonSpec { @Override protected Class getStructClass() { - throw new UnsupportedOperationException(); + return ValidFailRangeFloat.class; } @Override protected String getSrcFilename() { - throw new UnsupportedOperationException(); + return "floating_points.bin"; + } + + @Override + @Test + protected void testReadWriteRoundtrip() throws Exception { + throw new SkipException("cannot use roundtrip because parsing is expected to fail"); } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailRangeInt.java b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailRangeInt.java index f7f6728d2..bb7b77551 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailRangeInt.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailRangeInt.java @@ -5,15 +5,22 @@ import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.ValidFailRangeInt; import org.testng.annotations.Test; +import org.testng.SkipException; public class TestValidFailRangeInt extends CommonSpec { @Override protected Class getStructClass() { - throw new UnsupportedOperationException(); + return ValidFailRangeInt.class; } @Override protected String getSrcFilename() { - throw new UnsupportedOperationException(); + return "fixed_struct.bin"; + } + + @Override + @Test + protected void testReadWriteRoundtrip() throws Exception { + throw new SkipException("cannot use roundtrip because parsing is expected to fail"); } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailRangeStr.java b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailRangeStr.java index 3caa58bf6..cc708d1c4 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailRangeStr.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailRangeStr.java @@ -5,15 +5,22 @@ import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.ValidFailRangeStr; import org.testng.annotations.Test; +import org.testng.SkipException; public class TestValidFailRangeStr extends CommonSpec { @Override protected Class getStructClass() { - throw new UnsupportedOperationException(); + return ValidFailRangeStr.class; } @Override protected String getSrcFilename() { - throw new UnsupportedOperationException(); + return "fixed_struct.bin"; + } + + @Override + @Test + protected void testReadWriteRoundtrip() throws Exception { + throw new SkipException("cannot use roundtrip because parsing is expected to fail"); } } From 6eccb6b2c582abe8444609c12fa33d77da90b12b Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Mon, 31 Jul 2023 11:41:14 +0200 Subject: [PATCH 102/126] Java specwrite: don't print format class in testReadWriteRoundtrip() --- spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java b/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java index 01b5404d1..2f8f320c4 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java +++ b/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java @@ -28,8 +28,6 @@ protected void testReadWriteRoundtrip() throws Exception { Class structClass = getStructClass(); String fn = getSrcFilename(); - System.out.println(structClass.getSimpleName()); - Method fromFileMethod = structClass.getMethod("fromFile", String.class); KaitaiStruct.ReadWrite origKs = (KaitaiStruct.ReadWrite) fromFileMethod.invoke(null, SRC_DIR + fn); origKs._read(); From d3fe5b61141c3fd8852a431685bdd1db47a9b5be Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Mon, 31 Jul 2023 11:37:50 +0200 Subject: [PATCH 103/126] Java specwrite: make sure all test methods are named `test*()` See https://github.com/kaitai-io/kaitai_struct/issues/1062 --- .../struct/specwrite/TestBytesPadTerm.java | 40 +++++++++---------- .../specwrite/TestBytesPadTermEqual.java | 40 +++++++++---------- .../struct/specwrite/TestInstanceStd.java | 6 +-- .../struct/specwrite/TestProcessRotate.java | 4 +- .../struct/specwrite/TestRepeatEosBytes.java | 2 +- .../struct/specwrite/TestRepeatNStrz.java | 4 +- .../struct/specwrite/TestRepeatUntilS4.java | 10 ++--- .../struct/specwrite/TestStrEncodings.java | 4 +- .../kaitai/struct/specwrite/TestStrEos.java | 2 +- .../specwrite/TestSwitchManualIntSize.java | 2 +- .../struct/specwrite/TestTermBytes4.java | 2 +- 11 files changed, 58 insertions(+), 58 deletions(-) diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTerm.java b/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTerm.java index a684c646a..59c3c6755 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTerm.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTerm.java @@ -7,7 +7,7 @@ public class TestBytesPadTerm extends CommonSpec { @Test - public void checkGoodMaxLengths() throws Exception { + public void testCheckGoodMaxLengths() throws Exception { BytesPadTerm r = new BytesPadTerm(); r.setStrPad("12345678901234567890".getBytes()); r.setStrTerm("12345678901234567890".getBytes()); @@ -17,7 +17,7 @@ public void checkGoodMaxLengths() throws Exception { } @Test - public void checkGoodMinLengths() throws Exception { + public void testCheckGoodMinLengths() throws Exception { BytesPadTerm r = new BytesPadTerm(); r.setStrPad("".getBytes()); r.setStrTerm("".getBytes()); @@ -27,14 +27,14 @@ public void checkGoodMinLengths() throws Exception { } @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: str_pad,.*") - public void checkLongerStrPad() throws Exception { + public void testCheckLongerStrPad() throws Exception { BytesPadTerm r = new BytesPadTerm(); r.setStrPad("123456789012345678901".getBytes()); r._check(); } @Test - public void checkGoodLastByteStrPad() throws Exception { + public void testCheckGoodLastByteStrPad() throws Exception { BytesPadTerm r = new BytesPadTerm(); r.setStrPad(("@@@@@"+"@@@@@"+"@@@@@"+"@@@@?").getBytes()); r.setStrTerm("12345678901234567890".getBytes()); @@ -44,14 +44,14 @@ public void checkGoodLastByteStrPad() throws Exception { } @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: str_pad,.*") - public void checkBadLastByteStrPad() throws Exception { + public void testCheckBadLastByteStrPad() throws Exception { BytesPadTerm r = new BytesPadTerm(); r.setStrPad("123456789012345678@".getBytes()); r._check(); } @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: str_term,.*") - public void checkLongerStrTerm() throws Exception { + public void testCheckLongerStrTerm() throws Exception { BytesPadTerm r = new BytesPadTerm(); r.setStrPad("12345678901234567890".getBytes()); r.setStrTerm("123456789012345678901".getBytes()); @@ -59,7 +59,7 @@ public void checkLongerStrTerm() throws Exception { } @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: str_term,.*") - public void checkBadHasTerminator1StrTerm() throws Exception { + public void testCheckBadHasTerminator1StrTerm() throws Exception { BytesPadTerm r = new BytesPadTerm(); r.setStrPad("12345678901234567890".getBytes()); r.setStrTerm("123456789012@4567890".getBytes()); @@ -67,7 +67,7 @@ public void checkBadHasTerminator1StrTerm() throws Exception { } @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: str_term,.*") - public void checkBadHasTerminator2StrTerm() throws Exception { + public void testCheckBadHasTerminator2StrTerm() throws Exception { BytesPadTerm r = new BytesPadTerm(); r.setStrPad("12345678901234567890".getBytes()); r.setStrTerm("1234567890123456789@".getBytes()); @@ -75,7 +75,7 @@ public void checkBadHasTerminator2StrTerm() throws Exception { } @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: str_term_and_pad,.*") - public void checkLongerStrTermAndPad() throws Exception { + public void testCheckLongerStrTermAndPad() throws Exception { BytesPadTerm r = new BytesPadTerm(); r.setStrPad("12345678901234567890".getBytes()); r.setStrTerm("12345678901234567890".getBytes()); @@ -84,7 +84,7 @@ public void checkLongerStrTermAndPad() throws Exception { } @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: str_term_and_pad,.*") - public void checkBadHasTerminatorStrTermAndPad() throws Exception { + public void testCheckBadHasTerminatorStrTermAndPad() throws Exception { BytesPadTerm r = new BytesPadTerm(); r.setStrPad("12345678901234567890".getBytes()); r.setStrTerm("12345678901234567890".getBytes()); @@ -93,7 +93,7 @@ public void checkBadHasTerminatorStrTermAndPad() throws Exception { } @Test - public void checkGoodLastByte1StrTermAndPad() throws Exception { + public void testCheckGoodLastByte1StrTermAndPad() throws Exception { BytesPadTerm r = new BytesPadTerm(); r.setStrPad("12345678901234567890".getBytes()); r.setStrTerm("12345678901234567890".getBytes()); @@ -103,7 +103,7 @@ public void checkGoodLastByte1StrTermAndPad() throws Exception { } @Test - public void checkGoodLastByte2StrTermAndPad() throws Exception { + public void testCheckGoodLastByte2StrTermAndPad() throws Exception { BytesPadTerm r = new BytesPadTerm(); r.setStrPad("12345678901234567890".getBytes()); r.setStrTerm("12345678901234567890".getBytes()); @@ -113,7 +113,7 @@ public void checkGoodLastByte2StrTermAndPad() throws Exception { } @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: str_term_and_pad,.*") - public void checkBadLastByteStrTermAndPad() throws Exception { + public void testCheckBadLastByteStrTermAndPad() throws Exception { BytesPadTerm r = new BytesPadTerm(); r.setStrPad("12345678901234567890".getBytes()); r.setStrTerm("12345678901234567890".getBytes()); @@ -122,7 +122,7 @@ public void checkBadLastByteStrTermAndPad() throws Exception { } @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: str_term_include,.*") - public void checkLongerStrTermInclude() throws Exception { + public void testCheckLongerStrTermInclude() throws Exception { BytesPadTerm r = new BytesPadTerm(); r.setStrPad("12345678901234567890".getBytes()); r.setStrTerm("12345678901234567890".getBytes()); @@ -132,7 +132,7 @@ public void checkLongerStrTermInclude() throws Exception { } @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: str_term_include,.*") - public void checkEmptyStrTermInclude() throws Exception { + public void testCheckEmptyStrTermInclude() throws Exception { BytesPadTerm r = new BytesPadTerm(); r.setStrPad("12345678901234567890".getBytes()); r.setStrTerm("12345678901234567890".getBytes()); @@ -142,7 +142,7 @@ public void checkEmptyStrTermInclude() throws Exception { } @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: str_term_include,.*") - public void checkBadNoTerminatorStrTermInclude() throws Exception { + public void testCheckBadNoTerminatorStrTermInclude() throws Exception { BytesPadTerm r = new BytesPadTerm(); r.setStrPad("12345678901234567890".getBytes()); r.setStrTerm("12345678901234567890".getBytes()); @@ -152,7 +152,7 @@ public void checkBadNoTerminatorStrTermInclude() throws Exception { } @Test - public void checkGoodTerminator1StrTermInclude() throws Exception { + public void testCheckGoodTerminator1StrTermInclude() throws Exception { BytesPadTerm r = new BytesPadTerm(); r.setStrPad("12345678901234567890".getBytes()); r.setStrTerm("12345678901234567890".getBytes()); @@ -162,7 +162,7 @@ public void checkGoodTerminator1StrTermInclude() throws Exception { } @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: str_term_include,.*") - public void checkEarlyTerminator1StrTermInclude() throws Exception { + public void testCheckEarlyTerminator1StrTermInclude() throws Exception { BytesPadTerm r = new BytesPadTerm(); r.setStrPad("12345678901234567890".getBytes()); r.setStrTerm("12345678901234567890".getBytes()); @@ -172,7 +172,7 @@ public void checkEarlyTerminator1StrTermInclude() throws Exception { } @Test - public void checkGoodTerminator2StrTermInclude() throws Exception { + public void testCheckGoodTerminator2StrTermInclude() throws Exception { BytesPadTerm r = new BytesPadTerm(); r.setStrPad("12345678901234567890".getBytes()); r.setStrTerm("12345678901234567890".getBytes()); @@ -182,7 +182,7 @@ public void checkGoodTerminator2StrTermInclude() throws Exception { } @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: str_term_include,.*") - public void checkEarlyTerminator2StrTermInclude() throws Exception { + public void testCheckEarlyTerminator2StrTermInclude() throws Exception { BytesPadTerm r = new BytesPadTerm(); r.setStrPad("12345678901234567890".getBytes()); r.setStrTerm("12345678901234567890".getBytes()); diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTermEqual.java b/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTermEqual.java index cb56d66cf..b81a59abb 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTermEqual.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBytesPadTermEqual.java @@ -17,7 +17,7 @@ protected String getSrcFilename() { } @Test - public void checkGoodMaxLengths() throws Exception { + public void testCheckGoodMaxLengths() throws Exception { BytesPadTermEqual r = new BytesPadTermEqual(); r.setS1("12345678901234567890".getBytes()); r.setS2("12345678901234567890".getBytes()); @@ -27,7 +27,7 @@ public void checkGoodMaxLengths() throws Exception { } @Test - public void checkGoodMinLengths() throws Exception { + public void testCheckGoodMinLengths() throws Exception { BytesPadTermEqual r = new BytesPadTermEqual(); r.setS1("".getBytes()); r.setS2("".getBytes()); @@ -37,28 +37,28 @@ public void checkGoodMinLengths() throws Exception { } @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: s1,.*") - public void checkLongerS1() throws Exception { + public void testCheckLongerS1() throws Exception { BytesPadTermEqual r = new BytesPadTermEqual(); r.setS1("123456789012345678901".getBytes()); r._check(); } @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: s1,.*") - public void checkBadHasTerminator1S1() throws Exception { + public void testCheckBadHasTerminator1S1() throws Exception { BytesPadTermEqual r = new BytesPadTermEqual(); r.setS1("123456789012@4567890".getBytes()); r._check(); } @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: s1,.*") - public void checkBadHasTerminator2S1() throws Exception { + public void testCheckBadHasTerminator2S1() throws Exception { BytesPadTermEqual r = new BytesPadTermEqual(); r.setS1("1234567890123456789@".getBytes()); r._check(); } @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: s2,.*") - public void checkLongerS2() throws Exception { + public void testCheckLongerS2() throws Exception { BytesPadTermEqual r = new BytesPadTermEqual(); r.setS1("12345678901234567890".getBytes()); r.setS2("123456789012345678901".getBytes()); @@ -66,7 +66,7 @@ public void checkLongerS2() throws Exception { } @Test - public void checkGoodTerminator1S2() throws Exception { + public void testCheckGoodTerminator1S2() throws Exception { BytesPadTermEqual r = new BytesPadTermEqual(); r.setS1("12345678901234567890".getBytes()); r.setS2("123456789012345678@".getBytes()); @@ -76,7 +76,7 @@ public void checkGoodTerminator1S2() throws Exception { } @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: s2,.*") - public void checkEarlyTerminator1S2() throws Exception { + public void testCheckEarlyTerminator1S2() throws Exception { BytesPadTermEqual r = new BytesPadTermEqual(); r.setS1("12345678901234567890".getBytes()); r.setS2("1234567890123456@8@".getBytes()); @@ -84,7 +84,7 @@ public void checkEarlyTerminator1S2() throws Exception { } @Test - public void checkGoodLastByteS2() throws Exception { + public void testCheckGoodLastByteS2() throws Exception { BytesPadTermEqual r = new BytesPadTermEqual(); r.setS1("12345678901234567890".getBytes()); r.setS2(("+++++"+"+++++"+"+++++"+"+++9").getBytes()); @@ -94,7 +94,7 @@ public void checkGoodLastByteS2() throws Exception { } @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: s2,.*") - public void checkBadLastByteS2() throws Exception { + public void testCheckBadLastByteS2() throws Exception { BytesPadTermEqual r = new BytesPadTermEqual(); r.setS1("12345678901234567890".getBytes()); r.setS2("123456789012345678+".getBytes()); @@ -102,7 +102,7 @@ public void checkBadLastByteS2() throws Exception { } @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: s3,.*") - public void checkLongerS3() throws Exception { + public void testCheckLongerS3() throws Exception { BytesPadTermEqual r = new BytesPadTermEqual(); r.setS1("12345678901234567890".getBytes()); r.setS2("12345678901234567890".getBytes()); @@ -111,7 +111,7 @@ public void checkLongerS3() throws Exception { } @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: s3,.*") - public void checkBadHasTerminator1S3() throws Exception { + public void testCheckBadHasTerminator1S3() throws Exception { BytesPadTermEqual r = new BytesPadTermEqual(); r.setS1("12345678901234567890".getBytes()); r.setS2("12345678901234567890".getBytes()); @@ -120,7 +120,7 @@ public void checkBadHasTerminator1S3() throws Exception { } @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: s3,.*") - public void checkBadHasTerminator2S3() throws Exception { + public void testCheckBadHasTerminator2S3() throws Exception { BytesPadTermEqual r = new BytesPadTermEqual(); r.setS1("12345678901234567890".getBytes()); r.setS2("12345678901234567890".getBytes()); @@ -129,7 +129,7 @@ public void checkBadHasTerminator2S3() throws Exception { } @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: s4,.*") - public void checkLongerS4() throws Exception { + public void testCheckLongerS4() throws Exception { BytesPadTermEqual r = new BytesPadTermEqual(); r.setS1("12345678901234567890".getBytes()); r.setS2("12345678901234567890".getBytes()); @@ -139,7 +139,7 @@ public void checkLongerS4() throws Exception { } @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: s4,.*") - public void checkEmptyS4() throws Exception { + public void testCheckEmptyS4() throws Exception { BytesPadTermEqual r = new BytesPadTermEqual(); r.setS1("12345678901234567890".getBytes()); r.setS2("12345678901234567890".getBytes()); @@ -149,7 +149,7 @@ public void checkEmptyS4() throws Exception { } @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: s4,.*") - public void checkBadNoTerminatorS4() throws Exception { + public void testCheckBadNoTerminatorS4() throws Exception { BytesPadTermEqual r = new BytesPadTermEqual(); r.setS1("12345678901234567890".getBytes()); r.setS2("12345678901234567890".getBytes()); @@ -159,7 +159,7 @@ public void checkBadNoTerminatorS4() throws Exception { } @Test - public void checkGoodTerminator1S4() throws Exception { + public void testCheckGoodTerminator1S4() throws Exception { BytesPadTermEqual r = new BytesPadTermEqual(); r.setS1("12345678901234567890".getBytes()); r.setS2("12345678901234567890".getBytes()); @@ -169,7 +169,7 @@ public void checkGoodTerminator1S4() throws Exception { } @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: s4,.*") - public void checkEarlyTerminator1S4() throws Exception { + public void testCheckEarlyTerminator1S4() throws Exception { BytesPadTermEqual r = new BytesPadTermEqual(); r.setS1("12345678901234567890".getBytes()); r.setS2("12345678901234567890".getBytes()); @@ -179,7 +179,7 @@ public void checkEarlyTerminator1S4() throws Exception { } @Test - public void checkGoodTerminator2S4() throws Exception { + public void testCheckGoodTerminator2S4() throws Exception { BytesPadTermEqual r = new BytesPadTermEqual(); r.setS1("12345678901234567890".getBytes()); r.setS2("12345678901234567890".getBytes()); @@ -189,7 +189,7 @@ public void checkGoodTerminator2S4() throws Exception { } @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: s4,.*") - public void checkEarlyTerminator2S4() throws Exception { + public void testCheckEarlyTerminator2S4() throws Exception { BytesPadTermEqual r = new BytesPadTermEqual(); r.setS1("12345678901234567890".getBytes()); r.setS2("12345678901234567890".getBytes()); diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestInstanceStd.java b/spec/java/src/io/kaitai/struct/specwrite/TestInstanceStd.java index dd883bd09..f2fdb7b69 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestInstanceStd.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestInstanceStd.java @@ -21,7 +21,7 @@ protected String getSrcFilename() { } @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: header,.*") - public void checkShorterHeader() throws Exception { + public void testCheckShorterHeader() throws Exception { InstanceStd r = new InstanceStd(); r._check(); r.setHeader("1234"); @@ -29,7 +29,7 @@ public void checkShorterHeader() throws Exception { } @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: header,.*") - public void checkLongerHeader() throws Exception { + public void testCheckLongerHeader() throws Exception { InstanceStd r = new InstanceStd(); r._check(); r.setHeader("123456"); @@ -37,7 +37,7 @@ public void checkLongerHeader() throws Exception { } @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: header,.*") - public void checkEmptyHeaderViaDump() throws Exception { + public void testCheckEmptyHeaderViaDump() throws Exception { InstanceStd r = new InstanceStd(); r.setHeader(""); try { diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestProcessRotate.java b/spec/java/src/io/kaitai/struct/specwrite/TestProcessRotate.java index 70f0e9456..b74f6bad3 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestProcessRotate.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestProcessRotate.java @@ -23,7 +23,7 @@ public void testProcessRotate() throws Exception { } @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: buf2,.*") - public void checkSizeMismatchCheck() throws Exception { + public void testCheckSizeMismatchCheck() throws Exception { ProcessRotate r = new ProcessRotate(); r.setBuf1("Hello".getBytes()); @@ -33,7 +33,7 @@ public void checkSizeMismatchCheck() throws Exception { } @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: buf2,.*") - public void checkSizeMismatchCheckOrWrite() throws Exception { + public void testCheckSizeMismatchCheckOrWrite() throws Exception { ProcessRotate r = new ProcessRotate(); r.setBuf1("Hello".getBytes()); diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosBytes.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosBytes.java index 54815903f..1dded37a6 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosBytes.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatEosBytes.java @@ -12,7 +12,7 @@ public class TestRepeatEosBytes extends CommonSpec { @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: records, expected: 0, actual: 3") - public void checkLongerIo() throws Exception { + public void testCheckLongerIo() throws Exception { RepeatEosBytes r = new RepeatEosBytes(); r.setRecords(new ArrayList<>( diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStrz.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStrz.java index 712f7e8c4..a14e0c0da 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStrz.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStrz.java @@ -10,7 +10,7 @@ public class TestRepeatNStrz extends CommonSpec { @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: lines,.*") - public void checkMismatch() throws Exception { + public void testCheckMismatch() throws Exception { RepeatNStrz r = new RepeatNStrz(); r.setQty(7); @@ -20,7 +20,7 @@ public void checkMismatch() throws Exception { } @Test(expectedExceptions = NullPointerException.class, expectedExceptionsMessageRegExp = ".*\\blines\\b.*") - public void checkNull() throws Exception { + public void testCheckNull() throws Exception { RepeatNStrz r = new RepeatNStrz(); r.setQty(0); diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilS4.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilS4.java index 59a332152..0f9bed45b 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilS4.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilS4.java @@ -21,14 +21,14 @@ protected String getSrcFilename() { } @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: entries,.*") - public void checkBadNoEntries() { + public void testCheckBadNoEntries() { RepeatUntilS4 r = new RepeatUntilS4(); r.setEntries(new ArrayList<>(0)); r._check(); } @Test - public void checkGoodOneEntry() { + public void testCheckGoodOneEntry() { RepeatUntilS4 r = new RepeatUntilS4(); r.setEntries(new ArrayList<>(Arrays.asList(-1))); r.setAfterall(""); @@ -36,21 +36,21 @@ public void checkGoodOneEntry() { } @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: entries,.*") - public void checkBadEarlyUntilEntry() { + public void testCheckBadEarlyUntilEntry() { RepeatUntilS4 r = new RepeatUntilS4(); r.setEntries(new ArrayList<>(Arrays.asList(-3, 275000, -1, 0, -1))); r._check(); } @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: entries,.*") - public void checkBadNoUntilEntry() { + public void testCheckBadNoUntilEntry() { RepeatUntilS4 r = new RepeatUntilS4(); r.setEntries(new ArrayList<>(Arrays.asList(-3, 275000, -2, 0))); r._check(); } @Test - public void checkGoodUntilEntry() { + public void testCheckGoodUntilEntry() { RepeatUntilS4 r = new RepeatUntilS4(); r.setEntries(new ArrayList<>(Arrays.asList(-3, 275000, -2, 0, -1))); r.setAfterall(""); diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestStrEncodings.java b/spec/java/src/io/kaitai/struct/specwrite/TestStrEncodings.java index 238a57715..6c0aac88e 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestStrEncodings.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestStrEncodings.java @@ -7,7 +7,7 @@ public class TestStrEncodings extends CommonSpec { @Test(expectedExceptions = NullPointerException.class, expectedExceptionsMessageRegExp = ".*\\bstr2\\b.*") - public void checkNull() throws Exception { + public void testCheckNull() throws Exception { StrEncodings r = new StrEncodings(); r.setStr1("woo"); @@ -19,7 +19,7 @@ public void checkNull() throws Exception { } @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: str2,.*") - public void checkMismatch() throws Exception { + public void testCheckMismatch() throws Exception { StrEncodings r = new StrEncodings(); r.setStr1("Some ASCII"); diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestStrEos.java b/spec/java/src/io/kaitai/struct/specwrite/TestStrEos.java index a3c00a263..7ff97ba5c 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestStrEos.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestStrEos.java @@ -8,7 +8,7 @@ public class TestStrEos extends CommonSpec { @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: str, expected: 0, actual: 2") - public void checkLongerIo() throws Exception { + public void testCheckLongerIo() throws Exception { StrEos r = new StrEos(); r.setStr("Hello"); diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualIntSize.java b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualIntSize.java index f4bf44b8d..554093fcd 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualIntSize.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestSwitchManualIntSize.java @@ -7,7 +7,7 @@ public class TestSwitchManualIntSize extends CommonSpec { @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: body, expected: 3, actual: 2") - public void checkSwitchBytesSizeMismatch() { + public void testCheckSwitchBytesSizeMismatch() { SwitchManualIntSize.Chunk chunk = new SwitchManualIntSize.Chunk(); chunk.setCode(0x33); chunk.setSize(3); diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestTermBytes4.java b/spec/java/src/io/kaitai/struct/specwrite/TestTermBytes4.java index 26cb39f9a..042e26fd8 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestTermBytes4.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestTermBytes4.java @@ -9,7 +9,7 @@ public class TestTermBytes4 extends CommonSpec { @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: value, expected: 0, actual: 1") - public void checkIsEofAfterIncludeTermMissing() { + public void testCheckIsEofAfterIncludeTermMissing() { TermBytes4 r = new TermBytes4(); TermBytes4.S1Type s1 = new TermBytes4.S1Type(null, r, r._root()); From aa79aa83de43f9d0c12201c2354cf0ebce7dc9b0 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Mon, 31 Jul 2023 01:28:21 +0200 Subject: [PATCH 104/126] Support Python serialization tests when generating `ci.json` --- aggregate/convert_to_json | 29 +++++++++++++++++++++++++---- aggregate/junit_xml_parser.rb | 18 ++++++++++++++---- aggregate/test_parser.rb | 5 +++++ ci-python | 7 +++++-- kst-adoption-report | 6 ++++-- 5 files changed, 53 insertions(+), 12 deletions(-) diff --git a/aggregate/convert_to_json b/aggregate/convert_to_json index 671878670..a39efc4da 100755 --- a/aggregate/convert_to_json +++ b/aggregate/convert_to_json @@ -37,11 +37,27 @@ def add_fails(first, *seconds) end def add_kst_adoption(tests, log_dir) - kst_tests = File.readlines("#{log_dir}/kst_adoption.log") + kst_tests = File.readlines("#{log_dir}/kst_adoption.log").map { |name| name.chomp } + kst_test_used = {} + kst_tests.each { |name| kst_test_used[name] = false } + tests.each_pair { |name, test_result| + kst_name = nil + if kst_test_used.has_key?(name) + kst_name = name + elsif name =~ /^(.+?)\./ && kst_test_used.has_key?($1) + kst_name = $1 + end + + if kst_name + test_result['is_kst'] = true + kst_test_used[kst_name] = true + end + } kst_tests.each { |name| - name.chomp! - tests[name] ||= {} - tests[name]['is_kst'] = true + if !kst_test_used.fetch(name) + tests[name] ||= {} + tests[name]['is_kst'] = true + end } tests end @@ -101,6 +117,11 @@ when 'php', 'python', 'construct' JUnitXMLParser.new(infile).to_h, infile ) +when 'python-write' + add_kst_adoption( + JUnitXMLParser.new(infile, true).to_h, + infile + ) when 'ruby' add_kst_adoption( RSpecJSONParser.new("#{infile}/test-output-ruby.json").to_h, diff --git a/aggregate/junit_xml_parser.rb b/aggregate/junit_xml_parser.rb index d97fbf867..c3420aa1a 100644 --- a/aggregate/junit_xml_parser.rb +++ b/aggregate/junit_xml_parser.rb @@ -3,7 +3,8 @@ require 'rexml/document' class JUnitXMLParser < TestParser - def initialize(fn) + def initialize(fn, include_classname = false) + @include_classname = include_classname @docs = if not File.exists?(fn) [] elsif File.directory?(fn) @@ -35,10 +36,19 @@ def each_test name = underscore_to_ucamelcase($1) else raise "Unable to parse name: \"#{name}\"" unless name =~ /^[Tt]est(.*?)$/ - if $1[0] == '_' - name = underscore_to_ucamelcase($1) + name = $1 + if @include_classname + classname = tc.attribute('classname').value + raise "Unable to parse classname: \"#{classname}\"" unless classname =~ /\.Test([^.]*)$/ + classname = $1 + if name[0] == '_' + name = underscore_to_lcamelcase(name[1..-1]) + end + name = "#{classname}.#{name}" else - name = $1 + if name[0] == '_' + name = underscore_to_ucamelcase(name[1..-1]) + end end end diff --git a/aggregate/test_parser.rb b/aggregate/test_parser.rb index 0c7758e4c..017365b04 100644 --- a/aggregate/test_parser.rb +++ b/aggregate/test_parser.rb @@ -5,6 +5,11 @@ def underscore_to_ucamelcase(s) s.split(/_/).map { |x| x.capitalize }.join end +def underscore_to_lcamelcase(s) + first_word, *rest_words = s.split(/_/) + ([first_word] + rest_words.map { |x| x.capitalize }).join +end + class TestParser def each_test raise 'Abstract method' diff --git a/ci-python b/ci-python index a49287ada..1651929d7 100755 --- a/ci-python +++ b/ci-python @@ -2,8 +2,11 @@ . ./config -rm -rf "$TEST_OUT_DIR/python" -PYTHONPATH="$PYTHON_RUNTIME_DIR:compiled/python:spec/python/extra" python ./run-python-xml.py spec/python "$TEST_OUT_DIR/python" +rm -rf "$TEST_OUT_DIR/python" "$TEST_OUT_DIR/python-write" +PYTHONPATH="$PYTHON_RUNTIME_DIR:compiled/python:spec/python/extra" python ./run-python-xml.py spec/python/spec "$TEST_OUT_DIR/python" +PYTHONPATH="$PYTHON_RUNTIME_DIR:compiled/python:spec/python:spec/python/extra" python ./run-python-xml.py spec/python/specwrite "$TEST_OUT_DIR/python-write" ./kst-adoption-report python +./kst-adoption-report python-write aggregate/convert_to_json python "$TEST_OUT_DIR/python" "$TEST_OUT_DIR/python/ci.json" +aggregate/convert_to_json python-write "$TEST_OUT_DIR/python-write" "$TEST_OUT_DIR/python-write/ci.json" diff --git a/kst-adoption-report b/kst-adoption-report index 571869ae0..30f1ce0e8 100755 --- a/kst-adoption-report +++ b/kst-adoption-report @@ -29,7 +29,9 @@ def glob_spec_files(lang) when 'php' Dir.glob('spec/php/*Test.php') when 'python' - Dir.glob('spec/python/**/test_*.py') + Dir.glob("spec/python/spec/test_*.py") + when 'python-write' + Dir.glob("spec/python/specwrite/test_*.py") when 'construct' Dir.glob('spec/construct/**/test_*.py') when 'ruby' @@ -68,7 +70,7 @@ def spec_file_to_test_name(lang, fn) when 'php' raise "Unable to extract test name from #{fn.inspect}" unless fn =~ /^(.*?)Test\.php$/ $1 - when 'python', 'construct' + when 'python', 'python-write', 'construct' raise "Unable to extract test name from #{fn.inspect}" unless fn =~ /^test_(.*?)\.py$/ underscore_to_ucamelcase($1) when 'ruby' From cbcc4009832b52705b9a8afa7d6e3b3223be09c1 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Mon, 31 Jul 2023 15:11:36 +0200 Subject: [PATCH 105/126] Support Java serialization tests when generating `ci.json` --- aggregate/convert_to_json | 13 ++++--------- aggregate/junit_xml_parser.rb | 10 ++++------ aggregate/test_parser.rb | 5 ----- builder/java_builder.rb | 14 ++++++++------ ci-java | 6 +++++- kst-adoption-report | 6 ++++-- run-java | 2 +- spec/java/testng.xml | 6 +++++- 8 files changed, 31 insertions(+), 31 deletions(-) diff --git a/aggregate/convert_to_json b/aggregate/convert_to_json index a39efc4da..9e7d3f36b 100755 --- a/aggregate/convert_to_json +++ b/aggregate/convert_to_json @@ -87,10 +87,10 @@ when 'cpp_stl' ), infile ) -when 'java' +when 'java', 'java-write' add_kst_adoption( add_fails( - JUnitXMLParser.new("#{infile}/junitreports").to_h, + JUnitXMLParser.new("#{infile}/junitreports", lang == 'java-write').to_h, BuildFailedParser.new("#{infile}/build_failed_tests.txt").to_h ), infile @@ -112,14 +112,9 @@ when 'javascript' JUnitXMLParser.new("#{infile}/test-output-javascript.xml").to_h, infile ) -when 'php', 'python', 'construct' +when 'php', 'python', 'python-write', 'construct' add_kst_adoption( - JUnitXMLParser.new(infile).to_h, - infile - ) -when 'python-write' - add_kst_adoption( - JUnitXMLParser.new(infile, true).to_h, + JUnitXMLParser.new(infile, lang == 'python-write').to_h, infile ) when 'ruby' diff --git a/aggregate/junit_xml_parser.rb b/aggregate/junit_xml_parser.rb index c3420aa1a..c16197363 100644 --- a/aggregate/junit_xml_parser.rb +++ b/aggregate/junit_xml_parser.rb @@ -37,18 +37,16 @@ def each_test else raise "Unable to parse name: \"#{name}\"" unless name =~ /^[Tt]est(.*?)$/ name = $1 + if name[0] == '_' + name = underscore_to_ucamelcase(name[1..-1]) + end + if @include_classname classname = tc.attribute('classname').value raise "Unable to parse classname: \"#{classname}\"" unless classname =~ /\.Test([^.]*)$/ classname = $1 - if name[0] == '_' - name = underscore_to_lcamelcase(name[1..-1]) - end name = "#{classname}.#{name}" else - if name[0] == '_' - name = underscore_to_ucamelcase(name[1..-1]) - end end end diff --git a/aggregate/test_parser.rb b/aggregate/test_parser.rb index 017365b04..0c7758e4c 100644 --- a/aggregate/test_parser.rb +++ b/aggregate/test_parser.rb @@ -5,11 +5,6 @@ def underscore_to_ucamelcase(s) s.split(/_/).map { |x| x.capitalize }.join end -def underscore_to_lcamelcase(s) - first_word, *rest_words = s.split(/_/) - ([first_word] + rest_words.map { |x| x.capitalize }).join -end - class TestParser def each_test raise 'Abstract method' diff --git a/builder/java_builder.rb b/builder/java_builder.rb index 987bd1436..a7285f92a 100644 --- a/builder/java_builder.rb +++ b/builder/java_builder.rb @@ -5,8 +5,11 @@ require_relative 'shellconfig' class JavaBuilder < PartialBuilder - def initialize - super + def initialize(suite_names, test_out_dir) + super() + + @suite_names = suite_names || 'spec,specwrite' + @test_out_dir = File.absolute_path(test_out_dir || "#{@config['TEST_OUT_DIR']}/java") @spec_dir = File.join('spec', 'java', 'src') @compiled_dir = File.join("#{@config['FORMATS_COMPILED_DIR']}", 'java') @@ -22,9 +25,6 @@ def initialize @java_classes_dir = "#{@compiled_dir}/bin" @java_classes_dir = File.absolute_path(@java_classes_dir) @java_classpath = [@java_classes_dir, @java_testng_jar].join(File::PATH_SEPARATOR) - - @test_out_dir = "#{@config['TEST_OUT_DIR']}/java" - @test_out_dir = File.absolute_path(@test_out_dir) end def list_mandatory_files @@ -92,7 +92,9 @@ def run_tests 'java', '-cp', @java_classpath, 'org.testng.TestNG', - '-d', @test_out_dir, File.absolute_path(File.join('spec', 'java', 'testng.xml')) + '-d', @test_out_dir, + '-testnames', @suite_names, + File.absolute_path(File.join('spec', 'java', 'testng.xml')) ] out_log = File.join(@test_out_dir, 'test_run.stdout') diff --git a/ci-java b/ci-java index 167f41f43..b84bce58e 100755 --- a/ci-java +++ b/ci-java @@ -2,7 +2,11 @@ . ./config -./run-java +rm -rf "$TEST_OUT_DIR/java" "$TEST_OUT_DIR/java-write" +./run-java spec "$TEST_OUT_DIR/java" +./run-java specwrite "$TEST_OUT_DIR/java-write" ./kst-adoption-report java +./kst-adoption-report java-write aggregate/convert_to_json java "$TEST_OUT_DIR/java" "$TEST_OUT_DIR/java/ci.json" +aggregate/convert_to_json java-write "$TEST_OUT_DIR/java-write" "$TEST_OUT_DIR/java-write/ci.json" diff --git a/kst-adoption-report b/kst-adoption-report index 30f1ce0e8..659f78f8d 100755 --- a/kst-adoption-report +++ b/kst-adoption-report @@ -17,7 +17,9 @@ def glob_spec_files(lang) when 'go' Dir.glob('spec/go/*_test.go') when 'java' - Dir.glob('spec/java/src/**/Test*.java') + Dir.glob('spec/java/src/**/spec/Test*.java') + when 'java-write' + Dir.glob('spec/java/src/**/specwrite/Test*.java') when 'javascript' Dir.glob('spec/javascript/test_*.js') when 'lua' @@ -52,7 +54,7 @@ def spec_file_to_test_name(lang, fn) when 'go' raise "Unable to extract test name from #{fn.inspect}" unless fn =~ /^(.*?)_test\.go$/ underscore_to_ucamelcase($1) - when 'java' + when 'java', 'java-write' raise "Unable to extract test name from #{fn.inspect}" unless fn =~ /^Test(.*?)\.java$/ $1 when 'javascript' diff --git a/run-java b/run-java index e3434dd43..39581d264 100755 --- a/run-java +++ b/run-java @@ -1,4 +1,4 @@ #!/usr/bin/env ruby require_relative 'builder/java_builder' -JavaBuilder.new.command_line(ARGV) +JavaBuilder.new(ARGV[0], ARGV[1]).command_line(ARGV[2..-1] || []) diff --git a/spec/java/testng.xml b/spec/java/testng.xml index 44e9b2f8e..88accb107 100644 --- a/spec/java/testng.xml +++ b/spec/java/testng.xml @@ -1,8 +1,12 @@ - + + + + + From 7a3fefa5290debe064f380c87e84a8c55e3b07f4 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Tue, 1 Aug 2023 21:10:15 +0200 Subject: [PATCH 106/126] build-formats: replace hardcoded `compiled` dir with config var --- build-formats | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/build-formats b/build-formats index a7ef6b414..80375de4c 100755 --- a/build-formats +++ b/build-formats @@ -19,11 +19,11 @@ mkdir -p "$FORMATS_COMPILED_DIR" --nim-opaque "../../tests/spec/nim/opaque/" \ "$FORMATS_KSY_DIR"/*.ksy || : -mv -n compiled/python compiled/python-tmp -mkdir compiled/python -mv -n compiled/python-tmp compiled/python/testformats +mv -n "$FORMATS_COMPILED_DIR/python" "$FORMATS_COMPILED_DIR/python-tmp" +mkdir "$FORMATS_COMPILED_DIR/python" +mv -n "$FORMATS_COMPILED_DIR/python-tmp" "$FORMATS_COMPILED_DIR/python/testformats" # __init__.py is needed in Python 2 -touch compiled/python/testformats/__init__.py +touch "$FORMATS_COMPILED_DIR/python/testformats/__init__.py" "$COMPILER_DIR/jvm/target/universal/stage/bin/kaitai-struct-compiler" -- \ --verbose file -t java -d "$FORMATS_COMPILED_DIR/java/src" \ @@ -44,4 +44,4 @@ touch compiled/python/testformats/__init__.py "$FORMATS_KSY_DIR"/*.ksy || : # __init__.py is needed in Python 2 -touch compiled/python/testwrite/__init__.py +touch "$FORMATS_COMPILED_DIR/python/testwrite/__init__.py" From 328239ea042fa747dc609466e14b35f997d01eda Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Fri, 4 Aug 2023 22:54:49 +0200 Subject: [PATCH 107/126] java_builder: fix `builder/spec` failure (make ctor args optional) --- builder/java_builder.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/java_builder.rb b/builder/java_builder.rb index a57e770f0..01843735b 100644 --- a/builder/java_builder.rb +++ b/builder/java_builder.rb @@ -5,7 +5,7 @@ require_relative 'shellconfig' class JavaBuilder < PartialBuilder - def initialize(suite_names, test_out_dir) + def initialize(suite_names = nil, test_out_dir = nil) super() @suite_names = suite_names || 'spec,specwrite' From c64152ca7dbb593272a2d0310a2fe16ae5089dde Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Fri, 4 Aug 2023 23:18:13 +0200 Subject: [PATCH 108/126] PythonWriteSG: simplify, extend `SpecGenerator` (fixes build error) --- .../specgenerators/PythonWriteSG.scala | 30 +++++++------------ 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/translator/src/main/scala/io/kaitai/struct/testtranslator/specgenerators/PythonWriteSG.scala b/translator/src/main/scala/io/kaitai/struct/testtranslator/specgenerators/PythonWriteSG.scala index c6e73c824..8ddce3890 100644 --- a/translator/src/main/scala/io/kaitai/struct/testtranslator/specgenerators/PythonWriteSG.scala +++ b/translator/src/main/scala/io/kaitai/struct/testtranslator/specgenerators/PythonWriteSG.scala @@ -7,7 +7,7 @@ import _root_.io.kaitai.struct.languages.PythonCompiler import _root_.io.kaitai.struct.testtranslator.{Main, TestAssert, TestSpec} import _root_.io.kaitai.struct.translators.PythonTranslator -class PythonWriteSG(spec: TestSpec, provider: ClassTypeProvider) extends BaseGenerator(spec) { +class PythonWriteSG(spec: TestSpec, provider: ClassTypeProvider) extends SpecGenerator { importList.add("import unittest") importList.add("from specwrite.common_spec import CommonSpec") @@ -18,7 +18,7 @@ class PythonWriteSG(spec: TestSpec, provider: ClassTypeProvider) extends BaseGen override def indentStr: String = " " - override def header(): Unit = { + override def run(): Unit = { out.puts out.puts(s"from testwrite.${spec.id} import $className") out.puts @@ -32,26 +32,18 @@ class PythonWriteSG(spec: TestSpec, provider: ClassTypeProvider) extends BaseGen out.puts(s"self.struct_class = $className") out.puts(s"self.src_filename = 'src/${spec.data}'") out.dec - } - - override def runParse(): Unit = {} - override def runParseExpectError(exception: KSError): Unit = { - out.puts - out.puts("def test_read_write_roundtrip(self):") - out.inc - out.puts("""self.skipTest("cannot use roundtrip because parsing is expected to fail")""") - out.dec + spec.exception match { + case None => + case Some(_) => + out.puts + out.puts("def test_read_write_roundtrip(self):") + out.inc + out.puts("""self.skipTest("cannot use roundtrip because parsing is expected to fail")""") + out.dec + } } - override def footer(): Unit = {} - - override def runAsserts(): Unit = {} - - override def simpleAssert(check: TestAssert): Unit = ??? - override def nullAssert(actual: Ast.expr): Unit = ??? - override def trueArrayAssert(check: TestAssert, elType: DataType, elts: Seq[Ast.expr]): Unit = ??? - override def results: String = "# " + AUTOGEN_COMMENT + "\n\n" + super.results } From f9deea2d3dffe8a462eae6886201b835db7eb7e7 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Fri, 4 Aug 2023 23:31:08 +0200 Subject: [PATCH 109/126] Regen Python specwrite from KST: fix double final newline --- spec/python/specwrite/test_bcd_user_type_be.py | 1 - spec/python/specwrite/test_bcd_user_type_le.py | 1 - spec/python/specwrite/test_bits_byte_aligned.py | 1 - spec/python/specwrite/test_bits_byte_aligned_eof_be.py | 1 - spec/python/specwrite/test_bits_byte_aligned_eof_le.py | 1 - spec/python/specwrite/test_bits_enum.py | 1 - spec/python/specwrite/test_bits_seq_endian_combo.py | 1 - spec/python/specwrite/test_bits_shift_by_b32_le.py | 1 - spec/python/specwrite/test_bits_shift_by_b64_le.py | 1 - spec/python/specwrite/test_bits_signed_res_b32_be.py | 1 - spec/python/specwrite/test_bits_signed_res_b32_le.py | 1 - spec/python/specwrite/test_bits_signed_shift_b32_le.py | 1 - spec/python/specwrite/test_bits_signed_shift_b64_le.py | 1 - spec/python/specwrite/test_bits_simple.py | 1 - spec/python/specwrite/test_bits_simple_le.py | 1 - spec/python/specwrite/test_bits_unaligned_b32_be.py | 1 - spec/python/specwrite/test_bits_unaligned_b32_le.py | 1 - spec/python/specwrite/test_bits_unaligned_b64_be.py | 1 - spec/python/specwrite/test_bits_unaligned_b64_le.py | 1 - spec/python/specwrite/test_buffered_struct.py | 1 - spec/python/specwrite/test_bytes_eos_pad_term.py | 1 - spec/python/specwrite/test_bytes_pad_term_empty.py | 1 - spec/python/specwrite/test_bytes_pad_term_zero_size.py | 1 - spec/python/specwrite/test_cast_nested.py | 1 - spec/python/specwrite/test_cast_to_imported.py | 1 - spec/python/specwrite/test_cast_to_top.py | 1 - spec/python/specwrite/test_combine_bool.py | 1 - spec/python/specwrite/test_combine_bytes.py | 1 - spec/python/specwrite/test_combine_enum.py | 1 - spec/python/specwrite/test_combine_str.py | 1 - spec/python/specwrite/test_debug_0.py | 1 - spec/python/specwrite/test_debug_array_user.py | 1 - spec/python/specwrite/test_debug_enum_name.py | 1 - spec/python/specwrite/test_debug_switch_user.py | 1 - spec/python/specwrite/test_default_big_endian.py | 1 - spec/python/specwrite/test_default_bit_endian_mod.py | 1 - spec/python/specwrite/test_default_endian_expr_inherited.py | 1 - spec/python/specwrite/test_default_endian_expr_is_be.py | 1 - spec/python/specwrite/test_default_endian_expr_is_le.py | 1 - spec/python/specwrite/test_default_endian_mod.py | 1 - spec/python/specwrite/test_docstrings.py | 1 - spec/python/specwrite/test_docstrings_docref.py | 1 - spec/python/specwrite/test_docstrings_docref_multi.py | 1 - spec/python/specwrite/test_enum_0.py | 1 - spec/python/specwrite/test_enum_1.py | 1 - spec/python/specwrite/test_enum_deep.py | 1 - spec/python/specwrite/test_enum_deep_literals.py | 1 - spec/python/specwrite/test_enum_fancy.py | 1 - spec/python/specwrite/test_enum_for_unknown_id.py | 1 - spec/python/specwrite/test_enum_if.py | 1 - spec/python/specwrite/test_enum_import.py | 1 - spec/python/specwrite/test_enum_int_range_s.py | 1 - spec/python/specwrite/test_enum_int_range_u.py | 1 - spec/python/specwrite/test_enum_invalid.py | 1 - spec/python/specwrite/test_enum_long_range_s.py | 1 - spec/python/specwrite/test_enum_long_range_u.py | 1 - spec/python/specwrite/test_enum_negative.py | 1 - spec/python/specwrite/test_enum_of_value_inst.py | 1 - spec/python/specwrite/test_enum_to_i.py | 1 - spec/python/specwrite/test_enum_to_i_class_border_1.py | 1 - spec/python/specwrite/test_expr_0.py | 1 - spec/python/specwrite/test_expr_1.py | 1 - spec/python/specwrite/test_expr_3.py | 1 - spec/python/specwrite/test_expr_array.py | 1 - spec/python/specwrite/test_expr_bits.py | 1 - spec/python/specwrite/test_expr_bytes_cmp.py | 1 - spec/python/specwrite/test_expr_bytes_non_literal.py | 1 - spec/python/specwrite/test_expr_bytes_ops.py | 1 - spec/python/specwrite/test_expr_calc_array_ops.py | 1 - spec/python/specwrite/test_expr_enum.py | 1 - spec/python/specwrite/test_expr_if_int_eq.py | 1 - spec/python/specwrite/test_expr_if_int_ops.py | 1 - spec/python/specwrite/test_expr_int_div.py | 1 - spec/python/specwrite/test_expr_io_eof.py | 1 - spec/python/specwrite/test_expr_io_eof_bits.py | 1 - spec/python/specwrite/test_expr_io_pos.py | 1 - spec/python/specwrite/test_expr_io_pos_bits.py | 1 - spec/python/specwrite/test_expr_mod.py | 1 - spec/python/specwrite/test_expr_ops_parens.py | 1 - spec/python/specwrite/test_expr_sizeof_type_0.py | 1 - spec/python/specwrite/test_expr_sizeof_type_1.py | 1 - spec/python/specwrite/test_expr_sizeof_value_0.py | 1 - spec/python/specwrite/test_expr_sizeof_value_sized.py | 1 - spec/python/specwrite/test_expr_str_encodings.py | 1 - spec/python/specwrite/test_expr_str_ops.py | 1 - spec/python/specwrite/test_fixed_contents.py | 1 - spec/python/specwrite/test_fixed_struct.py | 1 - spec/python/specwrite/test_float_to_i.py | 1 - spec/python/specwrite/test_floating_points.py | 1 - spec/python/specwrite/test_hello_world.py | 1 - spec/python/specwrite/test_if_instances.py | 1 - spec/python/specwrite/test_if_struct.py | 1 - spec/python/specwrite/test_if_values.py | 1 - spec/python/specwrite/test_imports0.py | 1 - spec/python/specwrite/test_imports_abs.py | 1 - spec/python/specwrite/test_imports_circular_a.py | 1 - spec/python/specwrite/test_imports_rel_1.py | 1 - spec/python/specwrite/test_index_sizes.py | 1 - spec/python/specwrite/test_index_to_param_eos.py | 1 - spec/python/specwrite/test_index_to_param_expr.py | 1 - spec/python/specwrite/test_index_to_param_until.py | 1 - spec/python/specwrite/test_instance_in_repeat_expr.py | 1 - spec/python/specwrite/test_instance_in_repeat_until.py | 1 - spec/python/specwrite/test_instance_in_sized.py | 1 - spec/python/specwrite/test_instance_io_user.py | 1 - spec/python/specwrite/test_instance_io_user_earlier.py | 1 - spec/python/specwrite/test_instance_std_array.py | 1 - spec/python/specwrite/test_instance_user_array.py | 1 - spec/python/specwrite/test_integers.py | 1 - spec/python/specwrite/test_integers_double_overflow.py | 1 - spec/python/specwrite/test_integers_min_max.py | 1 - spec/python/specwrite/test_io_local_var.py | 1 - spec/python/specwrite/test_js_signed_right_shift.py | 1 - spec/python/specwrite/test_meta_tags.py | 1 - spec/python/specwrite/test_meta_xref.py | 1 - spec/python/specwrite/test_multiple_use.py | 1 - spec/python/specwrite/test_nav_parent.py | 1 - spec/python/specwrite/test_nav_parent2.py | 1 - spec/python/specwrite/test_nav_parent3.py | 1 - spec/python/specwrite/test_nav_parent_false.py | 1 - spec/python/specwrite/test_nav_parent_false2.py | 1 - spec/python/specwrite/test_nav_parent_override.py | 1 - spec/python/specwrite/test_nav_parent_switch.py | 1 - spec/python/specwrite/test_nav_parent_switch_cast.py | 1 - spec/python/specwrite/test_nav_parent_vs_value_inst.py | 1 - spec/python/specwrite/test_nav_root.py | 1 - spec/python/specwrite/test_nested_same_name.py | 1 - spec/python/specwrite/test_nested_same_name2.py | 1 - spec/python/specwrite/test_nested_type_param.py | 1 - spec/python/specwrite/test_nested_types.py | 1 - spec/python/specwrite/test_nested_types2.py | 1 - spec/python/specwrite/test_nested_types3.py | 1 - spec/python/specwrite/test_non_standard.py | 1 - spec/python/specwrite/test_opaque_external_type.py | 1 - spec/python/specwrite/test_optional_id.py | 1 - spec/python/specwrite/test_params_call_extra_parens.py | 1 - spec/python/specwrite/test_params_call_short.py | 1 - spec/python/specwrite/test_params_enum.py | 1 - spec/python/specwrite/test_params_pass_array_int.py | 1 - spec/python/specwrite/test_params_pass_array_io.py | 1 - spec/python/specwrite/test_params_pass_array_str.py | 1 - spec/python/specwrite/test_params_pass_array_struct.py | 1 - spec/python/specwrite/test_params_pass_array_usertype.py | 1 - spec/python/specwrite/test_params_pass_bool.py | 1 - spec/python/specwrite/test_params_pass_io.py | 1 - spec/python/specwrite/test_params_pass_struct.py | 1 - spec/python/specwrite/test_params_pass_usertype.py | 1 - spec/python/specwrite/test_position_abs.py | 1 - spec/python/specwrite/test_position_in_seq.py | 1 - spec/python/specwrite/test_position_to_end.py | 1 - spec/python/specwrite/test_process_bytes_pad_term.py | 1 - spec/python/specwrite/test_process_coerce_bytes.py | 1 - spec/python/specwrite/test_process_coerce_switch.py | 1 - spec/python/specwrite/test_process_coerce_usertype1.py | 1 - spec/python/specwrite/test_process_coerce_usertype2.py | 1 - spec/python/specwrite/test_process_custom.py | 1 - spec/python/specwrite/test_process_custom_no_args.py | 1 - spec/python/specwrite/test_process_repeat_bytes.py | 1 - spec/python/specwrite/test_process_repeat_usertype.py | 1 - .../specwrite/test_process_repeat_usertype_dynarg_custom.py | 1 - .../specwrite/test_process_repeat_usertype_dynarg_rotate.py | 1 - spec/python/specwrite/test_process_repeat_usertype_dynarg_xor.py | 1 - spec/python/specwrite/test_process_struct_pad_term.py | 1 - spec/python/specwrite/test_process_term_struct.py | 1 - spec/python/specwrite/test_process_xor4_const.py | 1 - spec/python/specwrite/test_process_xor4_value.py | 1 - spec/python/specwrite/test_process_xor_const.py | 1 - spec/python/specwrite/test_process_xor_value.py | 1 - spec/python/specwrite/test_recursive_one.py | 1 - spec/python/specwrite/test_repeat_eos_bit.py | 1 - spec/python/specwrite/test_repeat_eos_bytes_pad.py | 1 - spec/python/specwrite/test_repeat_eos_bytes_pad_term.py | 1 - spec/python/specwrite/test_repeat_eos_struct.py | 1 - spec/python/specwrite/test_repeat_eos_term_bytes.py | 1 - spec/python/specwrite/test_repeat_eos_term_struct.py | 1 - spec/python/specwrite/test_repeat_eos_u4.py | 1 - spec/python/specwrite/test_repeat_n_bytes.py | 1 - spec/python/specwrite/test_repeat_n_bytes_pad.py | 1 - spec/python/specwrite/test_repeat_n_bytes_pad_term.py | 1 - spec/python/specwrite/test_repeat_n_struct.py | 1 - spec/python/specwrite/test_repeat_n_strz_double.py | 1 - spec/python/specwrite/test_repeat_n_term_bytes.py | 1 - spec/python/specwrite/test_repeat_n_term_struct.py | 1 - spec/python/specwrite/test_repeat_until_bytes.py | 1 - spec/python/specwrite/test_repeat_until_bytes_pad.py | 1 - spec/python/specwrite/test_repeat_until_bytes_pad_term.py | 1 - spec/python/specwrite/test_repeat_until_calc_array_type.py | 1 - spec/python/specwrite/test_repeat_until_complex.py | 1 - spec/python/specwrite/test_repeat_until_sized.py | 1 - spec/python/specwrite/test_repeat_until_term_bytes.py | 1 - spec/python/specwrite/test_repeat_until_term_struct.py | 1 - spec/python/specwrite/test_str_encodings_default.py | 1 - spec/python/specwrite/test_str_encodings_utf16.py | 1 - spec/python/specwrite/test_str_eos_pad_term.py | 1 - spec/python/specwrite/test_str_eos_pad_term_empty.py | 1 - spec/python/specwrite/test_str_eos_pad_term_equal.py | 1 - spec/python/specwrite/test_str_literals2.py | 1 - spec/python/specwrite/test_str_pad_term.py | 1 - spec/python/specwrite/test_str_pad_term_empty.py | 1 - spec/python/specwrite/test_str_pad_term_equal.py | 1 - spec/python/specwrite/test_str_pad_term_zero_size.py | 1 - spec/python/specwrite/test_struct_pad_term.py | 1 - spec/python/specwrite/test_struct_pad_term_equal.py | 1 - spec/python/specwrite/test_switch_bytearray.py | 1 - spec/python/specwrite/test_switch_else_only.py | 1 - spec/python/specwrite/test_switch_integers.py | 1 - spec/python/specwrite/test_switch_integers2.py | 1 - spec/python/specwrite/test_switch_manual_enum.py | 1 - spec/python/specwrite/test_switch_manual_enum_invalid.py | 1 - spec/python/specwrite/test_switch_manual_enum_invalid_else.py | 1 - spec/python/specwrite/test_switch_manual_int.py | 1 - spec/python/specwrite/test_switch_manual_int_else.py | 1 - spec/python/specwrite/test_switch_manual_int_size_else.py | 1 - spec/python/specwrite/test_switch_manual_int_size_eos.py | 1 - spec/python/specwrite/test_switch_manual_str.py | 1 - spec/python/specwrite/test_switch_manual_str_else.py | 1 - spec/python/specwrite/test_switch_multi_bool_ops.py | 1 - spec/python/specwrite/test_switch_repeat_expr.py | 1 - spec/python/specwrite/test_switch_repeat_expr_invalid.py | 1 - spec/python/specwrite/test_term_bytes.py | 1 - spec/python/specwrite/test_term_bytes2.py | 1 - spec/python/specwrite/test_term_bytes3.py | 1 - spec/python/specwrite/test_term_struct.py | 1 - spec/python/specwrite/test_term_struct2.py | 1 - spec/python/specwrite/test_term_struct3.py | 1 - spec/python/specwrite/test_term_struct4.py | 1 - spec/python/specwrite/test_term_strz.py | 1 - spec/python/specwrite/test_term_strz2.py | 1 - spec/python/specwrite/test_term_strz3.py | 1 - spec/python/specwrite/test_term_strz4.py | 1 - spec/python/specwrite/test_term_u1_val.py | 1 - spec/python/specwrite/test_ts_packet_header.py | 1 - spec/python/specwrite/test_type_int_unary_op.py | 1 - spec/python/specwrite/test_type_ternary.py | 1 - spec/python/specwrite/test_type_ternary_2nd_falsy.py | 1 - spec/python/specwrite/test_type_ternary_opaque.py | 1 - spec/python/specwrite/test_user_type.py | 1 - spec/python/specwrite/test_valid_eq_str_encodings.py | 1 - spec/python/specwrite/test_valid_long.py | 1 - spec/python/specwrite/test_valid_not_parsed_if.py | 1 - spec/python/specwrite/test_valid_optional_id.py | 1 - spec/python/specwrite/test_valid_short.py | 1 - spec/python/specwrite/test_valid_switch.py | 1 - spec/python/specwrite/test_yaml_ints.py | 1 - spec/python/specwrite/test_zlib_surrounded.py | 1 - spec/python/specwrite/test_zlib_with_header_78.py | 1 - 246 files changed, 246 deletions(-) diff --git a/spec/python/specwrite/test_bcd_user_type_be.py b/spec/python/specwrite/test_bcd_user_type_be.py index 26b833dcc..51a672958 100644 --- a/spec/python/specwrite/test_bcd_user_type_be.py +++ b/spec/python/specwrite/test_bcd_user_type_be.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestBcdUserTypeBe, self).__init__(*args, **kwargs) self.struct_class = BcdUserTypeBe self.src_filename = 'src/bcd_user_type_be.bin' - diff --git a/spec/python/specwrite/test_bcd_user_type_le.py b/spec/python/specwrite/test_bcd_user_type_le.py index e9f6a86ff..88a8c21e7 100644 --- a/spec/python/specwrite/test_bcd_user_type_le.py +++ b/spec/python/specwrite/test_bcd_user_type_le.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestBcdUserTypeLe, self).__init__(*args, **kwargs) self.struct_class = BcdUserTypeLe self.src_filename = 'src/bcd_user_type_le.bin' - diff --git a/spec/python/specwrite/test_bits_byte_aligned.py b/spec/python/specwrite/test_bits_byte_aligned.py index b1f7e5091..45b051d54 100644 --- a/spec/python/specwrite/test_bits_byte_aligned.py +++ b/spec/python/specwrite/test_bits_byte_aligned.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestBitsByteAligned, self).__init__(*args, **kwargs) self.struct_class = BitsByteAligned self.src_filename = 'src/fixed_struct.bin' - diff --git a/spec/python/specwrite/test_bits_byte_aligned_eof_be.py b/spec/python/specwrite/test_bits_byte_aligned_eof_be.py index 353221ad1..17180543c 100644 --- a/spec/python/specwrite/test_bits_byte_aligned_eof_be.py +++ b/spec/python/specwrite/test_bits_byte_aligned_eof_be.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestBitsByteAlignedEofBe, self).__init__(*args, **kwargs) self.struct_class = BitsByteAlignedEofBe self.src_filename = 'src/bcd_user_type_be.bin' - diff --git a/spec/python/specwrite/test_bits_byte_aligned_eof_le.py b/spec/python/specwrite/test_bits_byte_aligned_eof_le.py index b9122575a..cc3706105 100644 --- a/spec/python/specwrite/test_bits_byte_aligned_eof_le.py +++ b/spec/python/specwrite/test_bits_byte_aligned_eof_le.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestBitsByteAlignedEofLe, self).__init__(*args, **kwargs) self.struct_class = BitsByteAlignedEofLe self.src_filename = 'src/bcd_user_type_be.bin' - diff --git a/spec/python/specwrite/test_bits_enum.py b/spec/python/specwrite/test_bits_enum.py index f99249231..3123ce9cd 100644 --- a/spec/python/specwrite/test_bits_enum.py +++ b/spec/python/specwrite/test_bits_enum.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestBitsEnum, self).__init__(*args, **kwargs) self.struct_class = BitsEnum self.src_filename = 'src/fixed_struct.bin' - diff --git a/spec/python/specwrite/test_bits_seq_endian_combo.py b/spec/python/specwrite/test_bits_seq_endian_combo.py index 538dfee75..d4fb47ce5 100644 --- a/spec/python/specwrite/test_bits_seq_endian_combo.py +++ b/spec/python/specwrite/test_bits_seq_endian_combo.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestBitsSeqEndianCombo, self).__init__(*args, **kwargs) self.struct_class = BitsSeqEndianCombo self.src_filename = 'src/process_xor_4.bin' - diff --git a/spec/python/specwrite/test_bits_shift_by_b32_le.py b/spec/python/specwrite/test_bits_shift_by_b32_le.py index 596f84583..2425eac3a 100644 --- a/spec/python/specwrite/test_bits_shift_by_b32_le.py +++ b/spec/python/specwrite/test_bits_shift_by_b32_le.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestBitsShiftByB32Le, self).__init__(*args, **kwargs) self.struct_class = BitsShiftByB32Le self.src_filename = 'src/bits_shift_by_b32_le.bin' - diff --git a/spec/python/specwrite/test_bits_shift_by_b64_le.py b/spec/python/specwrite/test_bits_shift_by_b64_le.py index 0db262c08..168c21e05 100644 --- a/spec/python/specwrite/test_bits_shift_by_b64_le.py +++ b/spec/python/specwrite/test_bits_shift_by_b64_le.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestBitsShiftByB64Le, self).__init__(*args, **kwargs) self.struct_class = BitsShiftByB64Le self.src_filename = 'src/bits_shift_by_b64_le.bin' - diff --git a/spec/python/specwrite/test_bits_signed_res_b32_be.py b/spec/python/specwrite/test_bits_signed_res_b32_be.py index 9558f42bc..296717986 100644 --- a/spec/python/specwrite/test_bits_signed_res_b32_be.py +++ b/spec/python/specwrite/test_bits_signed_res_b32_be.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestBitsSignedResB32Be, self).__init__(*args, **kwargs) self.struct_class = BitsSignedResB32Be self.src_filename = 'src/bits_shift_by_b32_le.bin' - diff --git a/spec/python/specwrite/test_bits_signed_res_b32_le.py b/spec/python/specwrite/test_bits_signed_res_b32_le.py index 35a742c69..8b4eea08c 100644 --- a/spec/python/specwrite/test_bits_signed_res_b32_le.py +++ b/spec/python/specwrite/test_bits_signed_res_b32_le.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestBitsSignedResB32Le, self).__init__(*args, **kwargs) self.struct_class = BitsSignedResB32Le self.src_filename = 'src/bits_shift_by_b32_le.bin' - diff --git a/spec/python/specwrite/test_bits_signed_shift_b32_le.py b/spec/python/specwrite/test_bits_signed_shift_b32_le.py index 3fe551e6f..e05b010e1 100644 --- a/spec/python/specwrite/test_bits_signed_shift_b32_le.py +++ b/spec/python/specwrite/test_bits_signed_shift_b32_le.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestBitsSignedShiftB32Le, self).__init__(*args, **kwargs) self.struct_class = BitsSignedShiftB32Le self.src_filename = 'src/bits_signed_shift_b32_le.bin' - diff --git a/spec/python/specwrite/test_bits_signed_shift_b64_le.py b/spec/python/specwrite/test_bits_signed_shift_b64_le.py index f251b4ad6..66bd73337 100644 --- a/spec/python/specwrite/test_bits_signed_shift_b64_le.py +++ b/spec/python/specwrite/test_bits_signed_shift_b64_le.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestBitsSignedShiftB64Le, self).__init__(*args, **kwargs) self.struct_class = BitsSignedShiftB64Le self.src_filename = 'src/bits_signed_shift_b64_le.bin' - diff --git a/spec/python/specwrite/test_bits_simple.py b/spec/python/specwrite/test_bits_simple.py index 51b4141e0..9b777276c 100644 --- a/spec/python/specwrite/test_bits_simple.py +++ b/spec/python/specwrite/test_bits_simple.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestBitsSimple, self).__init__(*args, **kwargs) self.struct_class = BitsSimple self.src_filename = 'src/fixed_struct.bin' - diff --git a/spec/python/specwrite/test_bits_simple_le.py b/spec/python/specwrite/test_bits_simple_le.py index 5e7dcae13..5cff3c154 100644 --- a/spec/python/specwrite/test_bits_simple_le.py +++ b/spec/python/specwrite/test_bits_simple_le.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestBitsSimpleLe, self).__init__(*args, **kwargs) self.struct_class = BitsSimpleLe self.src_filename = 'src/fixed_struct.bin' - diff --git a/spec/python/specwrite/test_bits_unaligned_b32_be.py b/spec/python/specwrite/test_bits_unaligned_b32_be.py index bea9edaec..2f058fcb9 100644 --- a/spec/python/specwrite/test_bits_unaligned_b32_be.py +++ b/spec/python/specwrite/test_bits_unaligned_b32_be.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestBitsUnalignedB32Be, self).__init__(*args, **kwargs) self.struct_class = BitsUnalignedB32Be self.src_filename = 'src/process_xor_4.bin' - diff --git a/spec/python/specwrite/test_bits_unaligned_b32_le.py b/spec/python/specwrite/test_bits_unaligned_b32_le.py index 9bcbdb445..327e693f6 100644 --- a/spec/python/specwrite/test_bits_unaligned_b32_le.py +++ b/spec/python/specwrite/test_bits_unaligned_b32_le.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestBitsUnalignedB32Le, self).__init__(*args, **kwargs) self.struct_class = BitsUnalignedB32Le self.src_filename = 'src/process_xor_4.bin' - diff --git a/spec/python/specwrite/test_bits_unaligned_b64_be.py b/spec/python/specwrite/test_bits_unaligned_b64_be.py index 0aeab09fa..62abdaca9 100644 --- a/spec/python/specwrite/test_bits_unaligned_b64_be.py +++ b/spec/python/specwrite/test_bits_unaligned_b64_be.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestBitsUnalignedB64Be, self).__init__(*args, **kwargs) self.struct_class = BitsUnalignedB64Be self.src_filename = 'src/process_xor_4.bin' - diff --git a/spec/python/specwrite/test_bits_unaligned_b64_le.py b/spec/python/specwrite/test_bits_unaligned_b64_le.py index 375a24635..cb19e3ac5 100644 --- a/spec/python/specwrite/test_bits_unaligned_b64_le.py +++ b/spec/python/specwrite/test_bits_unaligned_b64_le.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestBitsUnalignedB64Le, self).__init__(*args, **kwargs) self.struct_class = BitsUnalignedB64Le self.src_filename = 'src/process_xor_4.bin' - diff --git a/spec/python/specwrite/test_buffered_struct.py b/spec/python/specwrite/test_buffered_struct.py index acf97f9c3..2e9a5c4ce 100644 --- a/spec/python/specwrite/test_buffered_struct.py +++ b/spec/python/specwrite/test_buffered_struct.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestBufferedStruct, self).__init__(*args, **kwargs) self.struct_class = BufferedStruct self.src_filename = 'src/buffered_struct.bin' - diff --git a/spec/python/specwrite/test_bytes_eos_pad_term.py b/spec/python/specwrite/test_bytes_eos_pad_term.py index 08983ca5c..b69a658d8 100644 --- a/spec/python/specwrite/test_bytes_eos_pad_term.py +++ b/spec/python/specwrite/test_bytes_eos_pad_term.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestBytesEosPadTerm, self).__init__(*args, **kwargs) self.struct_class = BytesEosPadTerm self.src_filename = 'src/str_pad_term.bin' - diff --git a/spec/python/specwrite/test_bytes_pad_term_empty.py b/spec/python/specwrite/test_bytes_pad_term_empty.py index d33c0b076..050161918 100644 --- a/spec/python/specwrite/test_bytes_pad_term_empty.py +++ b/spec/python/specwrite/test_bytes_pad_term_empty.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestBytesPadTermEmpty, self).__init__(*args, **kwargs) self.struct_class = BytesPadTermEmpty self.src_filename = 'src/str_pad_term_empty.bin' - diff --git a/spec/python/specwrite/test_bytes_pad_term_zero_size.py b/spec/python/specwrite/test_bytes_pad_term_zero_size.py index 5c12d3c0a..05c4fb935 100644 --- a/spec/python/specwrite/test_bytes_pad_term_zero_size.py +++ b/spec/python/specwrite/test_bytes_pad_term_zero_size.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestBytesPadTermZeroSize, self).__init__(*args, **kwargs) self.struct_class = BytesPadTermZeroSize self.src_filename = 'src/enum_negative.bin' - diff --git a/spec/python/specwrite/test_cast_nested.py b/spec/python/specwrite/test_cast_nested.py index d50e318ed..61969e064 100644 --- a/spec/python/specwrite/test_cast_nested.py +++ b/spec/python/specwrite/test_cast_nested.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestCastNested, self).__init__(*args, **kwargs) self.struct_class = CastNested self.src_filename = 'src/switch_opcodes.bin' - diff --git a/spec/python/specwrite/test_cast_to_imported.py b/spec/python/specwrite/test_cast_to_imported.py index 1c835f33b..4cdf98f0f 100644 --- a/spec/python/specwrite/test_cast_to_imported.py +++ b/spec/python/specwrite/test_cast_to_imported.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestCastToImported, self).__init__(*args, **kwargs) self.struct_class = CastToImported self.src_filename = 'src/fixed_struct.bin' - diff --git a/spec/python/specwrite/test_cast_to_top.py b/spec/python/specwrite/test_cast_to_top.py index 68cc69bf2..930431842 100644 --- a/spec/python/specwrite/test_cast_to_top.py +++ b/spec/python/specwrite/test_cast_to_top.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestCastToTop, self).__init__(*args, **kwargs) self.struct_class = CastToTop self.src_filename = 'src/fixed_struct.bin' - diff --git a/spec/python/specwrite/test_combine_bool.py b/spec/python/specwrite/test_combine_bool.py index ee6128fc5..d5a64a3eb 100644 --- a/spec/python/specwrite/test_combine_bool.py +++ b/spec/python/specwrite/test_combine_bool.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestCombineBool, self).__init__(*args, **kwargs) self.struct_class = CombineBool self.src_filename = 'src/enum_negative.bin' - diff --git a/spec/python/specwrite/test_combine_bytes.py b/spec/python/specwrite/test_combine_bytes.py index 0f37d7f3f..705202c81 100644 --- a/spec/python/specwrite/test_combine_bytes.py +++ b/spec/python/specwrite/test_combine_bytes.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestCombineBytes, self).__init__(*args, **kwargs) self.struct_class = CombineBytes self.src_filename = 'src/term_strz.bin' - diff --git a/spec/python/specwrite/test_combine_enum.py b/spec/python/specwrite/test_combine_enum.py index cbefdb98e..84804440a 100644 --- a/spec/python/specwrite/test_combine_enum.py +++ b/spec/python/specwrite/test_combine_enum.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestCombineEnum, self).__init__(*args, **kwargs) self.struct_class = CombineEnum self.src_filename = 'src/enum_0.bin' - diff --git a/spec/python/specwrite/test_combine_str.py b/spec/python/specwrite/test_combine_str.py index 670b05179..a9484ad49 100644 --- a/spec/python/specwrite/test_combine_str.py +++ b/spec/python/specwrite/test_combine_str.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestCombineStr, self).__init__(*args, **kwargs) self.struct_class = CombineStr self.src_filename = 'src/term_strz.bin' - diff --git a/spec/python/specwrite/test_debug_0.py b/spec/python/specwrite/test_debug_0.py index 278725930..d784124ab 100644 --- a/spec/python/specwrite/test_debug_0.py +++ b/spec/python/specwrite/test_debug_0.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestDebug0, self).__init__(*args, **kwargs) self.struct_class = Debug0 self.src_filename = 'src/fixed_struct.bin' - diff --git a/spec/python/specwrite/test_debug_array_user.py b/spec/python/specwrite/test_debug_array_user.py index 31d065241..703c21ee2 100644 --- a/spec/python/specwrite/test_debug_array_user.py +++ b/spec/python/specwrite/test_debug_array_user.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestDebugArrayUser, self).__init__(*args, **kwargs) self.struct_class = DebugArrayUser self.src_filename = 'src/fixed_struct.bin' - diff --git a/spec/python/specwrite/test_debug_enum_name.py b/spec/python/specwrite/test_debug_enum_name.py index 65322cd5e..94c4959eb 100644 --- a/spec/python/specwrite/test_debug_enum_name.py +++ b/spec/python/specwrite/test_debug_enum_name.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestDebugEnumName, self).__init__(*args, **kwargs) self.struct_class = DebugEnumName self.src_filename = 'src/fixed_struct.bin' - diff --git a/spec/python/specwrite/test_debug_switch_user.py b/spec/python/specwrite/test_debug_switch_user.py index 3e965d174..897545a5f 100644 --- a/spec/python/specwrite/test_debug_switch_user.py +++ b/spec/python/specwrite/test_debug_switch_user.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestDebugSwitchUser, self).__init__(*args, **kwargs) self.struct_class = DebugSwitchUser self.src_filename = 'src/nav_parent_switch.bin' - diff --git a/spec/python/specwrite/test_default_big_endian.py b/spec/python/specwrite/test_default_big_endian.py index aaa4ed05c..98e620b83 100644 --- a/spec/python/specwrite/test_default_big_endian.py +++ b/spec/python/specwrite/test_default_big_endian.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestDefaultBigEndian, self).__init__(*args, **kwargs) self.struct_class = DefaultBigEndian self.src_filename = 'src/enum_0.bin' - diff --git a/spec/python/specwrite/test_default_bit_endian_mod.py b/spec/python/specwrite/test_default_bit_endian_mod.py index b319fc2e7..4211a560b 100644 --- a/spec/python/specwrite/test_default_bit_endian_mod.py +++ b/spec/python/specwrite/test_default_bit_endian_mod.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestDefaultBitEndianMod, self).__init__(*args, **kwargs) self.struct_class = DefaultBitEndianMod self.src_filename = 'src/fixed_struct.bin' - diff --git a/spec/python/specwrite/test_default_endian_expr_inherited.py b/spec/python/specwrite/test_default_endian_expr_inherited.py index 21dfe9479..ef346352c 100644 --- a/spec/python/specwrite/test_default_endian_expr_inherited.py +++ b/spec/python/specwrite/test_default_endian_expr_inherited.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestDefaultEndianExprInherited, self).__init__(*args, **kwargs) self.struct_class = DefaultEndianExprInherited self.src_filename = 'src/endian_expr.bin' - diff --git a/spec/python/specwrite/test_default_endian_expr_is_be.py b/spec/python/specwrite/test_default_endian_expr_is_be.py index beb31befc..6a3438398 100644 --- a/spec/python/specwrite/test_default_endian_expr_is_be.py +++ b/spec/python/specwrite/test_default_endian_expr_is_be.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestDefaultEndianExprIsBe, self).__init__(*args, **kwargs) self.struct_class = DefaultEndianExprIsBe self.src_filename = 'src/endian_expr.bin' - diff --git a/spec/python/specwrite/test_default_endian_expr_is_le.py b/spec/python/specwrite/test_default_endian_expr_is_le.py index 929342076..a51a4ccac 100644 --- a/spec/python/specwrite/test_default_endian_expr_is_le.py +++ b/spec/python/specwrite/test_default_endian_expr_is_le.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestDefaultEndianExprIsLe, self).__init__(*args, **kwargs) self.struct_class = DefaultEndianExprIsLe self.src_filename = 'src/endian_expr.bin' - diff --git a/spec/python/specwrite/test_default_endian_mod.py b/spec/python/specwrite/test_default_endian_mod.py index b127d2e90..80fab3a4c 100644 --- a/spec/python/specwrite/test_default_endian_mod.py +++ b/spec/python/specwrite/test_default_endian_mod.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestDefaultEndianMod, self).__init__(*args, **kwargs) self.struct_class = DefaultEndianMod self.src_filename = 'src/fixed_struct.bin' - diff --git a/spec/python/specwrite/test_docstrings.py b/spec/python/specwrite/test_docstrings.py index 4cbec5378..a52145c68 100644 --- a/spec/python/specwrite/test_docstrings.py +++ b/spec/python/specwrite/test_docstrings.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestDocstrings, self).__init__(*args, **kwargs) self.struct_class = Docstrings self.src_filename = 'src/fixed_struct.bin' - diff --git a/spec/python/specwrite/test_docstrings_docref.py b/spec/python/specwrite/test_docstrings_docref.py index 1ce19a530..e20c2fc93 100644 --- a/spec/python/specwrite/test_docstrings_docref.py +++ b/spec/python/specwrite/test_docstrings_docref.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestDocstringsDocref, self).__init__(*args, **kwargs) self.struct_class = DocstringsDocref self.src_filename = 'src/fixed_struct.bin' - diff --git a/spec/python/specwrite/test_docstrings_docref_multi.py b/spec/python/specwrite/test_docstrings_docref_multi.py index 729f210ec..de6a6590f 100644 --- a/spec/python/specwrite/test_docstrings_docref_multi.py +++ b/spec/python/specwrite/test_docstrings_docref_multi.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestDocstringsDocrefMulti, self).__init__(*args, **kwargs) self.struct_class = DocstringsDocrefMulti self.src_filename = 'src/fixed_struct.bin' - diff --git a/spec/python/specwrite/test_enum_0.py b/spec/python/specwrite/test_enum_0.py index 09e1fe240..18b13effe 100644 --- a/spec/python/specwrite/test_enum_0.py +++ b/spec/python/specwrite/test_enum_0.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestEnum0, self).__init__(*args, **kwargs) self.struct_class = Enum0 self.src_filename = 'src/enum_0.bin' - diff --git a/spec/python/specwrite/test_enum_1.py b/spec/python/specwrite/test_enum_1.py index db4d7e861..d759343dd 100644 --- a/spec/python/specwrite/test_enum_1.py +++ b/spec/python/specwrite/test_enum_1.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestEnum1, self).__init__(*args, **kwargs) self.struct_class = Enum1 self.src_filename = 'src/enum_0.bin' - diff --git a/spec/python/specwrite/test_enum_deep.py b/spec/python/specwrite/test_enum_deep.py index 2631d057a..21b0c693f 100644 --- a/spec/python/specwrite/test_enum_deep.py +++ b/spec/python/specwrite/test_enum_deep.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestEnumDeep, self).__init__(*args, **kwargs) self.struct_class = EnumDeep self.src_filename = 'src/enum_0.bin' - diff --git a/spec/python/specwrite/test_enum_deep_literals.py b/spec/python/specwrite/test_enum_deep_literals.py index a4e1f438a..f7eafc714 100644 --- a/spec/python/specwrite/test_enum_deep_literals.py +++ b/spec/python/specwrite/test_enum_deep_literals.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestEnumDeepLiterals, self).__init__(*args, **kwargs) self.struct_class = EnumDeepLiterals self.src_filename = 'src/enum_0.bin' - diff --git a/spec/python/specwrite/test_enum_fancy.py b/spec/python/specwrite/test_enum_fancy.py index 8186c5104..eb2680220 100644 --- a/spec/python/specwrite/test_enum_fancy.py +++ b/spec/python/specwrite/test_enum_fancy.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestEnumFancy, self).__init__(*args, **kwargs) self.struct_class = EnumFancy self.src_filename = 'src/enum_0.bin' - diff --git a/spec/python/specwrite/test_enum_for_unknown_id.py b/spec/python/specwrite/test_enum_for_unknown_id.py index 6d38caed2..9bcbd2123 100644 --- a/spec/python/specwrite/test_enum_for_unknown_id.py +++ b/spec/python/specwrite/test_enum_for_unknown_id.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestEnumForUnknownId, self).__init__(*args, **kwargs) self.struct_class = EnumForUnknownId self.src_filename = 'src/fixed_struct.bin' - diff --git a/spec/python/specwrite/test_enum_if.py b/spec/python/specwrite/test_enum_if.py index 102202a05..eb5a35944 100644 --- a/spec/python/specwrite/test_enum_if.py +++ b/spec/python/specwrite/test_enum_if.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestEnumIf, self).__init__(*args, **kwargs) self.struct_class = EnumIf self.src_filename = 'src/if_struct.bin' - diff --git a/spec/python/specwrite/test_enum_import.py b/spec/python/specwrite/test_enum_import.py index 567e954d2..5863c5c27 100644 --- a/spec/python/specwrite/test_enum_import.py +++ b/spec/python/specwrite/test_enum_import.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestEnumImport, self).__init__(*args, **kwargs) self.struct_class = EnumImport self.src_filename = 'src/enum_0.bin' - diff --git a/spec/python/specwrite/test_enum_int_range_s.py b/spec/python/specwrite/test_enum_int_range_s.py index a9343b7fe..a149b2ee6 100644 --- a/spec/python/specwrite/test_enum_int_range_s.py +++ b/spec/python/specwrite/test_enum_int_range_s.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestEnumIntRangeS, self).__init__(*args, **kwargs) self.struct_class = EnumIntRangeS self.src_filename = 'src/enum_int_range_s.bin' - diff --git a/spec/python/specwrite/test_enum_int_range_u.py b/spec/python/specwrite/test_enum_int_range_u.py index 8bb1c7361..07d878194 100644 --- a/spec/python/specwrite/test_enum_int_range_u.py +++ b/spec/python/specwrite/test_enum_int_range_u.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestEnumIntRangeU, self).__init__(*args, **kwargs) self.struct_class = EnumIntRangeU self.src_filename = 'src/enum_int_range_u.bin' - diff --git a/spec/python/specwrite/test_enum_invalid.py b/spec/python/specwrite/test_enum_invalid.py index bdcb0634b..0fc0cfd51 100644 --- a/spec/python/specwrite/test_enum_invalid.py +++ b/spec/python/specwrite/test_enum_invalid.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestEnumInvalid, self).__init__(*args, **kwargs) self.struct_class = EnumInvalid self.src_filename = 'src/term_strz.bin' - diff --git a/spec/python/specwrite/test_enum_long_range_s.py b/spec/python/specwrite/test_enum_long_range_s.py index 3543246e2..a72b6348f 100644 --- a/spec/python/specwrite/test_enum_long_range_s.py +++ b/spec/python/specwrite/test_enum_long_range_s.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestEnumLongRangeS, self).__init__(*args, **kwargs) self.struct_class = EnumLongRangeS self.src_filename = 'src/enum_long_range_s.bin' - diff --git a/spec/python/specwrite/test_enum_long_range_u.py b/spec/python/specwrite/test_enum_long_range_u.py index b76f64bf2..8d89784ef 100644 --- a/spec/python/specwrite/test_enum_long_range_u.py +++ b/spec/python/specwrite/test_enum_long_range_u.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestEnumLongRangeU, self).__init__(*args, **kwargs) self.struct_class = EnumLongRangeU self.src_filename = 'src/enum_long_range_u.bin' - diff --git a/spec/python/specwrite/test_enum_negative.py b/spec/python/specwrite/test_enum_negative.py index b3a758130..8113631bf 100644 --- a/spec/python/specwrite/test_enum_negative.py +++ b/spec/python/specwrite/test_enum_negative.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestEnumNegative, self).__init__(*args, **kwargs) self.struct_class = EnumNegative self.src_filename = 'src/enum_negative.bin' - diff --git a/spec/python/specwrite/test_enum_of_value_inst.py b/spec/python/specwrite/test_enum_of_value_inst.py index 9b6f2ba8c..a38375db2 100644 --- a/spec/python/specwrite/test_enum_of_value_inst.py +++ b/spec/python/specwrite/test_enum_of_value_inst.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestEnumOfValueInst, self).__init__(*args, **kwargs) self.struct_class = EnumOfValueInst self.src_filename = 'src/enum_0.bin' - diff --git a/spec/python/specwrite/test_enum_to_i.py b/spec/python/specwrite/test_enum_to_i.py index 1122103af..487593d44 100644 --- a/spec/python/specwrite/test_enum_to_i.py +++ b/spec/python/specwrite/test_enum_to_i.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestEnumToI, self).__init__(*args, **kwargs) self.struct_class = EnumToI self.src_filename = 'src/enum_0.bin' - diff --git a/spec/python/specwrite/test_enum_to_i_class_border_1.py b/spec/python/specwrite/test_enum_to_i_class_border_1.py index bcbb97e80..3affc5d64 100644 --- a/spec/python/specwrite/test_enum_to_i_class_border_1.py +++ b/spec/python/specwrite/test_enum_to_i_class_border_1.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestEnumToIClassBorder1, self).__init__(*args, **kwargs) self.struct_class = EnumToIClassBorder1 self.src_filename = 'src/enum_0.bin' - diff --git a/spec/python/specwrite/test_expr_0.py b/spec/python/specwrite/test_expr_0.py index 00cb030dd..c0ac16f21 100644 --- a/spec/python/specwrite/test_expr_0.py +++ b/spec/python/specwrite/test_expr_0.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestExpr0, self).__init__(*args, **kwargs) self.struct_class = Expr0 self.src_filename = 'src/str_encodings.bin' - diff --git a/spec/python/specwrite/test_expr_1.py b/spec/python/specwrite/test_expr_1.py index 1b291d3aa..c6eb947de 100644 --- a/spec/python/specwrite/test_expr_1.py +++ b/spec/python/specwrite/test_expr_1.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestExpr1, self).__init__(*args, **kwargs) self.struct_class = Expr1 self.src_filename = 'src/str_encodings.bin' - diff --git a/spec/python/specwrite/test_expr_3.py b/spec/python/specwrite/test_expr_3.py index 5f7b97ac1..6ad903f40 100644 --- a/spec/python/specwrite/test_expr_3.py +++ b/spec/python/specwrite/test_expr_3.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestExpr3, self).__init__(*args, **kwargs) self.struct_class = Expr3 self.src_filename = 'src/fixed_struct.bin' - diff --git a/spec/python/specwrite/test_expr_array.py b/spec/python/specwrite/test_expr_array.py index 1e047d072..6969a78df 100644 --- a/spec/python/specwrite/test_expr_array.py +++ b/spec/python/specwrite/test_expr_array.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestExprArray, self).__init__(*args, **kwargs) self.struct_class = ExprArray self.src_filename = 'src/expr_array.bin' - diff --git a/spec/python/specwrite/test_expr_bits.py b/spec/python/specwrite/test_expr_bits.py index c5f3ad67f..ad4cdfa03 100644 --- a/spec/python/specwrite/test_expr_bits.py +++ b/spec/python/specwrite/test_expr_bits.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestExprBits, self).__init__(*args, **kwargs) self.struct_class = ExprBits self.src_filename = 'src/switch_opcodes.bin' - diff --git a/spec/python/specwrite/test_expr_bytes_cmp.py b/spec/python/specwrite/test_expr_bytes_cmp.py index 091b76341..f77b3ceed 100644 --- a/spec/python/specwrite/test_expr_bytes_cmp.py +++ b/spec/python/specwrite/test_expr_bytes_cmp.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestExprBytesCmp, self).__init__(*args, **kwargs) self.struct_class = ExprBytesCmp self.src_filename = 'src/fixed_struct.bin' - diff --git a/spec/python/specwrite/test_expr_bytes_non_literal.py b/spec/python/specwrite/test_expr_bytes_non_literal.py index 0caa32526..300ecb182 100644 --- a/spec/python/specwrite/test_expr_bytes_non_literal.py +++ b/spec/python/specwrite/test_expr_bytes_non_literal.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestExprBytesNonLiteral, self).__init__(*args, **kwargs) self.struct_class = ExprBytesNonLiteral self.src_filename = 'src/enum_negative.bin' - diff --git a/spec/python/specwrite/test_expr_bytes_ops.py b/spec/python/specwrite/test_expr_bytes_ops.py index 2a93eff9f..4de235faf 100644 --- a/spec/python/specwrite/test_expr_bytes_ops.py +++ b/spec/python/specwrite/test_expr_bytes_ops.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestExprBytesOps, self).__init__(*args, **kwargs) self.struct_class = ExprBytesOps self.src_filename = 'src/nav_parent_switch.bin' - diff --git a/spec/python/specwrite/test_expr_calc_array_ops.py b/spec/python/specwrite/test_expr_calc_array_ops.py index 388a2bd37..f83d7666a 100644 --- a/spec/python/specwrite/test_expr_calc_array_ops.py +++ b/spec/python/specwrite/test_expr_calc_array_ops.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestExprCalcArrayOps, self).__init__(*args, **kwargs) self.struct_class = ExprCalcArrayOps self.src_filename = 'src/fixed_struct.bin' - diff --git a/spec/python/specwrite/test_expr_enum.py b/spec/python/specwrite/test_expr_enum.py index 5f7af1b5e..cca8aa992 100644 --- a/spec/python/specwrite/test_expr_enum.py +++ b/spec/python/specwrite/test_expr_enum.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestExprEnum, self).__init__(*args, **kwargs) self.struct_class = ExprEnum self.src_filename = 'src/term_strz.bin' - diff --git a/spec/python/specwrite/test_expr_if_int_eq.py b/spec/python/specwrite/test_expr_if_int_eq.py index 060925d84..b6dbacbf5 100644 --- a/spec/python/specwrite/test_expr_if_int_eq.py +++ b/spec/python/specwrite/test_expr_if_int_eq.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestExprIfIntEq, self).__init__(*args, **kwargs) self.struct_class = ExprIfIntEq self.src_filename = 'src/process_coerce_switch.bin' - diff --git a/spec/python/specwrite/test_expr_if_int_ops.py b/spec/python/specwrite/test_expr_if_int_ops.py index c789bc777..d30357ce3 100644 --- a/spec/python/specwrite/test_expr_if_int_ops.py +++ b/spec/python/specwrite/test_expr_if_int_ops.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestExprIfIntOps, self).__init__(*args, **kwargs) self.struct_class = ExprIfIntOps self.src_filename = 'src/instance_io.bin' - diff --git a/spec/python/specwrite/test_expr_int_div.py b/spec/python/specwrite/test_expr_int_div.py index 74f5dba5f..406f58942 100644 --- a/spec/python/specwrite/test_expr_int_div.py +++ b/spec/python/specwrite/test_expr_int_div.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestExprIntDiv, self).__init__(*args, **kwargs) self.struct_class = ExprIntDiv self.src_filename = 'src/fixed_struct.bin' - diff --git a/spec/python/specwrite/test_expr_io_eof.py b/spec/python/specwrite/test_expr_io_eof.py index a834423bc..65bbc79f7 100644 --- a/spec/python/specwrite/test_expr_io_eof.py +++ b/spec/python/specwrite/test_expr_io_eof.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestExprIoEof, self).__init__(*args, **kwargs) self.struct_class = ExprIoEof self.src_filename = 'src/fixed_struct.bin' - diff --git a/spec/python/specwrite/test_expr_io_eof_bits.py b/spec/python/specwrite/test_expr_io_eof_bits.py index e30c0980e..e76b44c44 100644 --- a/spec/python/specwrite/test_expr_io_eof_bits.py +++ b/spec/python/specwrite/test_expr_io_eof_bits.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestExprIoEofBits, self).__init__(*args, **kwargs) self.struct_class = ExprIoEofBits self.src_filename = 'src/nav_parent_switch.bin' - diff --git a/spec/python/specwrite/test_expr_io_pos.py b/spec/python/specwrite/test_expr_io_pos.py index b37289aea..6cb8413cd 100644 --- a/spec/python/specwrite/test_expr_io_pos.py +++ b/spec/python/specwrite/test_expr_io_pos.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestExprIoPos, self).__init__(*args, **kwargs) self.struct_class = ExprIoPos self.src_filename = 'src/expr_io_pos.bin' - diff --git a/spec/python/specwrite/test_expr_io_pos_bits.py b/spec/python/specwrite/test_expr_io_pos_bits.py index f56afcc4e..cee7613f8 100644 --- a/spec/python/specwrite/test_expr_io_pos_bits.py +++ b/spec/python/specwrite/test_expr_io_pos_bits.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestExprIoPosBits, self).__init__(*args, **kwargs) self.struct_class = ExprIoPosBits self.src_filename = 'src/process_xor_4.bin' - diff --git a/spec/python/specwrite/test_expr_mod.py b/spec/python/specwrite/test_expr_mod.py index f62276a27..aa513e045 100644 --- a/spec/python/specwrite/test_expr_mod.py +++ b/spec/python/specwrite/test_expr_mod.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestExprMod, self).__init__(*args, **kwargs) self.struct_class = ExprMod self.src_filename = 'src/fixed_struct.bin' - diff --git a/spec/python/specwrite/test_expr_ops_parens.py b/spec/python/specwrite/test_expr_ops_parens.py index 98d71ef7b..b93b917f2 100644 --- a/spec/python/specwrite/test_expr_ops_parens.py +++ b/spec/python/specwrite/test_expr_ops_parens.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestExprOpsParens, self).__init__(*args, **kwargs) self.struct_class = ExprOpsParens self.src_filename = 'src/enum_negative.bin' - diff --git a/spec/python/specwrite/test_expr_sizeof_type_0.py b/spec/python/specwrite/test_expr_sizeof_type_0.py index df7d46875..8673db603 100644 --- a/spec/python/specwrite/test_expr_sizeof_type_0.py +++ b/spec/python/specwrite/test_expr_sizeof_type_0.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestExprSizeofType0, self).__init__(*args, **kwargs) self.struct_class = ExprSizeofType0 self.src_filename = 'src/fixed_struct.bin' - diff --git a/spec/python/specwrite/test_expr_sizeof_type_1.py b/spec/python/specwrite/test_expr_sizeof_type_1.py index 03e030695..c7496c651 100644 --- a/spec/python/specwrite/test_expr_sizeof_type_1.py +++ b/spec/python/specwrite/test_expr_sizeof_type_1.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestExprSizeofType1, self).__init__(*args, **kwargs) self.struct_class = ExprSizeofType1 self.src_filename = 'src/fixed_struct.bin' - diff --git a/spec/python/specwrite/test_expr_sizeof_value_0.py b/spec/python/specwrite/test_expr_sizeof_value_0.py index d175bfa99..4720d1b0c 100644 --- a/spec/python/specwrite/test_expr_sizeof_value_0.py +++ b/spec/python/specwrite/test_expr_sizeof_value_0.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestExprSizeofValue0, self).__init__(*args, **kwargs) self.struct_class = ExprSizeofValue0 self.src_filename = 'src/fixed_struct.bin' - diff --git a/spec/python/specwrite/test_expr_sizeof_value_sized.py b/spec/python/specwrite/test_expr_sizeof_value_sized.py index dd6e3d570..50d21bdae 100644 --- a/spec/python/specwrite/test_expr_sizeof_value_sized.py +++ b/spec/python/specwrite/test_expr_sizeof_value_sized.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestExprSizeofValueSized, self).__init__(*args, **kwargs) self.struct_class = ExprSizeofValueSized self.src_filename = 'src/fixed_struct.bin' - diff --git a/spec/python/specwrite/test_expr_str_encodings.py b/spec/python/specwrite/test_expr_str_encodings.py index e1a0432ff..398bf8a8e 100644 --- a/spec/python/specwrite/test_expr_str_encodings.py +++ b/spec/python/specwrite/test_expr_str_encodings.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestExprStrEncodings, self).__init__(*args, **kwargs) self.struct_class = ExprStrEncodings self.src_filename = 'src/str_encodings.bin' - diff --git a/spec/python/specwrite/test_expr_str_ops.py b/spec/python/specwrite/test_expr_str_ops.py index 50f3b3e14..98adf6c1b 100644 --- a/spec/python/specwrite/test_expr_str_ops.py +++ b/spec/python/specwrite/test_expr_str_ops.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestExprStrOps, self).__init__(*args, **kwargs) self.struct_class = ExprStrOps self.src_filename = 'src/term_strz.bin' - diff --git a/spec/python/specwrite/test_fixed_contents.py b/spec/python/specwrite/test_fixed_contents.py index b5f681492..157136d37 100644 --- a/spec/python/specwrite/test_fixed_contents.py +++ b/spec/python/specwrite/test_fixed_contents.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestFixedContents, self).__init__(*args, **kwargs) self.struct_class = FixedContents self.src_filename = 'src/fixed_struct.bin' - diff --git a/spec/python/specwrite/test_fixed_struct.py b/spec/python/specwrite/test_fixed_struct.py index cd7ae7a14..27e014994 100644 --- a/spec/python/specwrite/test_fixed_struct.py +++ b/spec/python/specwrite/test_fixed_struct.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestFixedStruct, self).__init__(*args, **kwargs) self.struct_class = FixedStruct self.src_filename = 'src/fixed_struct.bin' - diff --git a/spec/python/specwrite/test_float_to_i.py b/spec/python/specwrite/test_float_to_i.py index c3cd8d459..060ca4e83 100644 --- a/spec/python/specwrite/test_float_to_i.py +++ b/spec/python/specwrite/test_float_to_i.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestFloatToI, self).__init__(*args, **kwargs) self.struct_class = FloatToI self.src_filename = 'src/floating_points.bin' - diff --git a/spec/python/specwrite/test_floating_points.py b/spec/python/specwrite/test_floating_points.py index 7bd138f95..95c00da50 100644 --- a/spec/python/specwrite/test_floating_points.py +++ b/spec/python/specwrite/test_floating_points.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestFloatingPoints, self).__init__(*args, **kwargs) self.struct_class = FloatingPoints self.src_filename = 'src/floating_points.bin' - diff --git a/spec/python/specwrite/test_hello_world.py b/spec/python/specwrite/test_hello_world.py index 4f36f9b5f..bef1e249d 100644 --- a/spec/python/specwrite/test_hello_world.py +++ b/spec/python/specwrite/test_hello_world.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestHelloWorld, self).__init__(*args, **kwargs) self.struct_class = HelloWorld self.src_filename = 'src/fixed_struct.bin' - diff --git a/spec/python/specwrite/test_if_instances.py b/spec/python/specwrite/test_if_instances.py index 293d6f83e..2dbb55eb4 100644 --- a/spec/python/specwrite/test_if_instances.py +++ b/spec/python/specwrite/test_if_instances.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestIfInstances, self).__init__(*args, **kwargs) self.struct_class = IfInstances self.src_filename = 'src/fixed_struct.bin' - diff --git a/spec/python/specwrite/test_if_struct.py b/spec/python/specwrite/test_if_struct.py index 85f29296b..f136c5257 100644 --- a/spec/python/specwrite/test_if_struct.py +++ b/spec/python/specwrite/test_if_struct.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestIfStruct, self).__init__(*args, **kwargs) self.struct_class = IfStruct self.src_filename = 'src/if_struct.bin' - diff --git a/spec/python/specwrite/test_if_values.py b/spec/python/specwrite/test_if_values.py index 0cf2e8588..ab955704a 100644 --- a/spec/python/specwrite/test_if_values.py +++ b/spec/python/specwrite/test_if_values.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestIfValues, self).__init__(*args, **kwargs) self.struct_class = IfValues self.src_filename = 'src/fixed_struct.bin' - diff --git a/spec/python/specwrite/test_imports0.py b/spec/python/specwrite/test_imports0.py index 97010d898..1c2423dc0 100644 --- a/spec/python/specwrite/test_imports0.py +++ b/spec/python/specwrite/test_imports0.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestImports0, self).__init__(*args, **kwargs) self.struct_class = Imports0 self.src_filename = 'src/fixed_struct.bin' - diff --git a/spec/python/specwrite/test_imports_abs.py b/spec/python/specwrite/test_imports_abs.py index d2d92e85c..e1365807b 100644 --- a/spec/python/specwrite/test_imports_abs.py +++ b/spec/python/specwrite/test_imports_abs.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestImportsAbs, self).__init__(*args, **kwargs) self.struct_class = ImportsAbs self.src_filename = 'src/fixed_struct.bin' - diff --git a/spec/python/specwrite/test_imports_circular_a.py b/spec/python/specwrite/test_imports_circular_a.py index 67003140c..63717b141 100644 --- a/spec/python/specwrite/test_imports_circular_a.py +++ b/spec/python/specwrite/test_imports_circular_a.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestImportsCircularA, self).__init__(*args, **kwargs) self.struct_class = ImportsCircularA self.src_filename = 'src/fixed_struct.bin' - diff --git a/spec/python/specwrite/test_imports_rel_1.py b/spec/python/specwrite/test_imports_rel_1.py index e5b476cc1..aef9f7dc6 100644 --- a/spec/python/specwrite/test_imports_rel_1.py +++ b/spec/python/specwrite/test_imports_rel_1.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestImportsRel1, self).__init__(*args, **kwargs) self.struct_class = ImportsRel1 self.src_filename = 'src/fixed_struct.bin' - diff --git a/spec/python/specwrite/test_index_sizes.py b/spec/python/specwrite/test_index_sizes.py index 33429dbc1..5ec7dd544 100644 --- a/spec/python/specwrite/test_index_sizes.py +++ b/spec/python/specwrite/test_index_sizes.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestIndexSizes, self).__init__(*args, **kwargs) self.struct_class = IndexSizes self.src_filename = 'src/index_sizes.bin' - diff --git a/spec/python/specwrite/test_index_to_param_eos.py b/spec/python/specwrite/test_index_to_param_eos.py index 5794e42cc..1e1bf3d52 100644 --- a/spec/python/specwrite/test_index_to_param_eos.py +++ b/spec/python/specwrite/test_index_to_param_eos.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestIndexToParamEos, self).__init__(*args, **kwargs) self.struct_class = IndexToParamEos self.src_filename = 'src/index_sizes.bin' - diff --git a/spec/python/specwrite/test_index_to_param_expr.py b/spec/python/specwrite/test_index_to_param_expr.py index 35a9ca543..2e37ad3a0 100644 --- a/spec/python/specwrite/test_index_to_param_expr.py +++ b/spec/python/specwrite/test_index_to_param_expr.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestIndexToParamExpr, self).__init__(*args, **kwargs) self.struct_class = IndexToParamExpr self.src_filename = 'src/index_sizes.bin' - diff --git a/spec/python/specwrite/test_index_to_param_until.py b/spec/python/specwrite/test_index_to_param_until.py index 843cdd496..8a1ec019a 100644 --- a/spec/python/specwrite/test_index_to_param_until.py +++ b/spec/python/specwrite/test_index_to_param_until.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestIndexToParamUntil, self).__init__(*args, **kwargs) self.struct_class = IndexToParamUntil self.src_filename = 'src/index_sizes.bin' - diff --git a/spec/python/specwrite/test_instance_in_repeat_expr.py b/spec/python/specwrite/test_instance_in_repeat_expr.py index df85a0470..f29331b68 100644 --- a/spec/python/specwrite/test_instance_in_repeat_expr.py +++ b/spec/python/specwrite/test_instance_in_repeat_expr.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestInstanceInRepeatExpr, self).__init__(*args, **kwargs) self.struct_class = InstanceInRepeatExpr self.src_filename = 'src/instance_in_repeat_expr.bin' - diff --git a/spec/python/specwrite/test_instance_in_repeat_until.py b/spec/python/specwrite/test_instance_in_repeat_until.py index 5f8ecd4e8..d636ccf51 100644 --- a/spec/python/specwrite/test_instance_in_repeat_until.py +++ b/spec/python/specwrite/test_instance_in_repeat_until.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestInstanceInRepeatUntil, self).__init__(*args, **kwargs) self.struct_class = InstanceInRepeatUntil self.src_filename = 'src/repeat_until_s4.bin' - diff --git a/spec/python/specwrite/test_instance_in_sized.py b/spec/python/specwrite/test_instance_in_sized.py index 7af81ce1d..3232d2b63 100644 --- a/spec/python/specwrite/test_instance_in_sized.py +++ b/spec/python/specwrite/test_instance_in_sized.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestInstanceInSized, self).__init__(*args, **kwargs) self.struct_class = InstanceInSized self.src_filename = 'src/process_rotate.bin' - diff --git a/spec/python/specwrite/test_instance_io_user.py b/spec/python/specwrite/test_instance_io_user.py index e7b3f14bf..adea8a8a0 100644 --- a/spec/python/specwrite/test_instance_io_user.py +++ b/spec/python/specwrite/test_instance_io_user.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestInstanceIoUser, self).__init__(*args, **kwargs) self.struct_class = InstanceIoUser self.src_filename = 'src/instance_io.bin' - diff --git a/spec/python/specwrite/test_instance_io_user_earlier.py b/spec/python/specwrite/test_instance_io_user_earlier.py index 35fc46c75..88cde50b2 100644 --- a/spec/python/specwrite/test_instance_io_user_earlier.py +++ b/spec/python/specwrite/test_instance_io_user_earlier.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestInstanceIoUserEarlier, self).__init__(*args, **kwargs) self.struct_class = InstanceIoUserEarlier self.src_filename = 'src/switch_opcodes2.bin' - diff --git a/spec/python/specwrite/test_instance_std_array.py b/spec/python/specwrite/test_instance_std_array.py index 8e2a19767..07d1dbd3e 100644 --- a/spec/python/specwrite/test_instance_std_array.py +++ b/spec/python/specwrite/test_instance_std_array.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestInstanceStdArray, self).__init__(*args, **kwargs) self.struct_class = InstanceStdArray self.src_filename = 'src/instance_std_array.bin' - diff --git a/spec/python/specwrite/test_instance_user_array.py b/spec/python/specwrite/test_instance_user_array.py index 0ad2aad38..fcf11cc6b 100644 --- a/spec/python/specwrite/test_instance_user_array.py +++ b/spec/python/specwrite/test_instance_user_array.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestInstanceUserArray, self).__init__(*args, **kwargs) self.struct_class = InstanceUserArray self.src_filename = 'src/instance_std_array.bin' - diff --git a/spec/python/specwrite/test_integers.py b/spec/python/specwrite/test_integers.py index d4dedf346..e7d40eabf 100644 --- a/spec/python/specwrite/test_integers.py +++ b/spec/python/specwrite/test_integers.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestIntegers, self).__init__(*args, **kwargs) self.struct_class = Integers self.src_filename = 'src/fixed_struct.bin' - diff --git a/spec/python/specwrite/test_integers_double_overflow.py b/spec/python/specwrite/test_integers_double_overflow.py index 7e6dffb6c..fddd1851d 100644 --- a/spec/python/specwrite/test_integers_double_overflow.py +++ b/spec/python/specwrite/test_integers_double_overflow.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestIntegersDoubleOverflow, self).__init__(*args, **kwargs) self.struct_class = IntegersDoubleOverflow self.src_filename = 'src/integers_double_overflow.bin' - diff --git a/spec/python/specwrite/test_integers_min_max.py b/spec/python/specwrite/test_integers_min_max.py index f819d5e8c..4c379249c 100644 --- a/spec/python/specwrite/test_integers_min_max.py +++ b/spec/python/specwrite/test_integers_min_max.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestIntegersMinMax, self).__init__(*args, **kwargs) self.struct_class = IntegersMinMax self.src_filename = 'src/integers_min_max.bin' - diff --git a/spec/python/specwrite/test_io_local_var.py b/spec/python/specwrite/test_io_local_var.py index cffa02c47..c08fbc16f 100644 --- a/spec/python/specwrite/test_io_local_var.py +++ b/spec/python/specwrite/test_io_local_var.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestIoLocalVar, self).__init__(*args, **kwargs) self.struct_class = IoLocalVar self.src_filename = 'src/full256.bin' - diff --git a/spec/python/specwrite/test_js_signed_right_shift.py b/spec/python/specwrite/test_js_signed_right_shift.py index b0d85513c..cda77e1dc 100644 --- a/spec/python/specwrite/test_js_signed_right_shift.py +++ b/spec/python/specwrite/test_js_signed_right_shift.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestJsSignedRightShift, self).__init__(*args, **kwargs) self.struct_class = JsSignedRightShift self.src_filename = 'src/fixed_struct.bin' - diff --git a/spec/python/specwrite/test_meta_tags.py b/spec/python/specwrite/test_meta_tags.py index 9b94f25af..43aef4668 100644 --- a/spec/python/specwrite/test_meta_tags.py +++ b/spec/python/specwrite/test_meta_tags.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestMetaTags, self).__init__(*args, **kwargs) self.struct_class = MetaTags self.src_filename = 'src/fixed_struct.bin' - diff --git a/spec/python/specwrite/test_meta_xref.py b/spec/python/specwrite/test_meta_xref.py index 5365e2652..5745445c3 100644 --- a/spec/python/specwrite/test_meta_xref.py +++ b/spec/python/specwrite/test_meta_xref.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestMetaXref, self).__init__(*args, **kwargs) self.struct_class = MetaXref self.src_filename = 'src/fixed_struct.bin' - diff --git a/spec/python/specwrite/test_multiple_use.py b/spec/python/specwrite/test_multiple_use.py index ca3c706c0..8d25e1f13 100644 --- a/spec/python/specwrite/test_multiple_use.py +++ b/spec/python/specwrite/test_multiple_use.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestMultipleUse, self).__init__(*args, **kwargs) self.struct_class = MultipleUse self.src_filename = 'src/position_abs.bin' - diff --git a/spec/python/specwrite/test_nav_parent.py b/spec/python/specwrite/test_nav_parent.py index a54627d7d..4e4ba7c70 100644 --- a/spec/python/specwrite/test_nav_parent.py +++ b/spec/python/specwrite/test_nav_parent.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestNavParent, self).__init__(*args, **kwargs) self.struct_class = NavParent self.src_filename = 'src/nav.bin' - diff --git a/spec/python/specwrite/test_nav_parent2.py b/spec/python/specwrite/test_nav_parent2.py index 6bb03ad2f..7ce267a6f 100644 --- a/spec/python/specwrite/test_nav_parent2.py +++ b/spec/python/specwrite/test_nav_parent2.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestNavParent2, self).__init__(*args, **kwargs) self.struct_class = NavParent2 self.src_filename = 'src/nav_parent2.bin' - diff --git a/spec/python/specwrite/test_nav_parent3.py b/spec/python/specwrite/test_nav_parent3.py index f005147b5..e5da92ad6 100644 --- a/spec/python/specwrite/test_nav_parent3.py +++ b/spec/python/specwrite/test_nav_parent3.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestNavParent3, self).__init__(*args, **kwargs) self.struct_class = NavParent3 self.src_filename = 'src/nav_parent2.bin' - diff --git a/spec/python/specwrite/test_nav_parent_false.py b/spec/python/specwrite/test_nav_parent_false.py index bee36d8cb..e7361028e 100644 --- a/spec/python/specwrite/test_nav_parent_false.py +++ b/spec/python/specwrite/test_nav_parent_false.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestNavParentFalse, self).__init__(*args, **kwargs) self.struct_class = NavParentFalse self.src_filename = 'src/nav_parent_codes.bin' - diff --git a/spec/python/specwrite/test_nav_parent_false2.py b/spec/python/specwrite/test_nav_parent_false2.py index 719ac40d2..0355f1884 100644 --- a/spec/python/specwrite/test_nav_parent_false2.py +++ b/spec/python/specwrite/test_nav_parent_false2.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestNavParentFalse2, self).__init__(*args, **kwargs) self.struct_class = NavParentFalse2 self.src_filename = 'src/fixed_struct.bin' - diff --git a/spec/python/specwrite/test_nav_parent_override.py b/spec/python/specwrite/test_nav_parent_override.py index 5c9d5616d..9630978e1 100644 --- a/spec/python/specwrite/test_nav_parent_override.py +++ b/spec/python/specwrite/test_nav_parent_override.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestNavParentOverride, self).__init__(*args, **kwargs) self.struct_class = NavParentOverride self.src_filename = 'src/nav_parent_codes.bin' - diff --git a/spec/python/specwrite/test_nav_parent_switch.py b/spec/python/specwrite/test_nav_parent_switch.py index 403bf904b..7171db065 100644 --- a/spec/python/specwrite/test_nav_parent_switch.py +++ b/spec/python/specwrite/test_nav_parent_switch.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestNavParentSwitch, self).__init__(*args, **kwargs) self.struct_class = NavParentSwitch self.src_filename = 'src/nav_parent_switch.bin' - diff --git a/spec/python/specwrite/test_nav_parent_switch_cast.py b/spec/python/specwrite/test_nav_parent_switch_cast.py index b8bf17e50..1d47a1eee 100644 --- a/spec/python/specwrite/test_nav_parent_switch_cast.py +++ b/spec/python/specwrite/test_nav_parent_switch_cast.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestNavParentSwitchCast, self).__init__(*args, **kwargs) self.struct_class = NavParentSwitchCast self.src_filename = 'src/switch_integers.bin' - diff --git a/spec/python/specwrite/test_nav_parent_vs_value_inst.py b/spec/python/specwrite/test_nav_parent_vs_value_inst.py index 102cb9c00..f30333dad 100644 --- a/spec/python/specwrite/test_nav_parent_vs_value_inst.py +++ b/spec/python/specwrite/test_nav_parent_vs_value_inst.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestNavParentVsValueInst, self).__init__(*args, **kwargs) self.struct_class = NavParentVsValueInst self.src_filename = 'src/term_strz.bin' - diff --git a/spec/python/specwrite/test_nav_root.py b/spec/python/specwrite/test_nav_root.py index 94f697114..3b521f1fd 100644 --- a/spec/python/specwrite/test_nav_root.py +++ b/spec/python/specwrite/test_nav_root.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestNavRoot, self).__init__(*args, **kwargs) self.struct_class = NavRoot self.src_filename = 'src/nav.bin' - diff --git a/spec/python/specwrite/test_nested_same_name.py b/spec/python/specwrite/test_nested_same_name.py index 19feee092..1db246c5a 100644 --- a/spec/python/specwrite/test_nested_same_name.py +++ b/spec/python/specwrite/test_nested_same_name.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestNestedSameName, self).__init__(*args, **kwargs) self.struct_class = NestedSameName self.src_filename = 'src/repeat_n_struct.bin' - diff --git a/spec/python/specwrite/test_nested_same_name2.py b/spec/python/specwrite/test_nested_same_name2.py index 808bd1d64..57c019ec0 100644 --- a/spec/python/specwrite/test_nested_same_name2.py +++ b/spec/python/specwrite/test_nested_same_name2.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestNestedSameName2, self).__init__(*args, **kwargs) self.struct_class = NestedSameName2 self.src_filename = 'src/nested_same_name2.bin' - diff --git a/spec/python/specwrite/test_nested_type_param.py b/spec/python/specwrite/test_nested_type_param.py index bb2050b9d..b5af8336d 100644 --- a/spec/python/specwrite/test_nested_type_param.py +++ b/spec/python/specwrite/test_nested_type_param.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestNestedTypeParam, self).__init__(*args, **kwargs) self.struct_class = NestedTypeParam self.src_filename = 'src/term_strz.bin' - diff --git a/spec/python/specwrite/test_nested_types.py b/spec/python/specwrite/test_nested_types.py index f6e1b9a60..51b154652 100644 --- a/spec/python/specwrite/test_nested_types.py +++ b/spec/python/specwrite/test_nested_types.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestNestedTypes, self).__init__(*args, **kwargs) self.struct_class = NestedTypes self.src_filename = 'src/fixed_struct.bin' - diff --git a/spec/python/specwrite/test_nested_types2.py b/spec/python/specwrite/test_nested_types2.py index 530875df5..04e1409a0 100644 --- a/spec/python/specwrite/test_nested_types2.py +++ b/spec/python/specwrite/test_nested_types2.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestNestedTypes2, self).__init__(*args, **kwargs) self.struct_class = NestedTypes2 self.src_filename = 'src/fixed_struct.bin' - diff --git a/spec/python/specwrite/test_nested_types3.py b/spec/python/specwrite/test_nested_types3.py index 31388b428..a9a72361a 100644 --- a/spec/python/specwrite/test_nested_types3.py +++ b/spec/python/specwrite/test_nested_types3.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestNestedTypes3, self).__init__(*args, **kwargs) self.struct_class = NestedTypes3 self.src_filename = 'src/fixed_struct.bin' - diff --git a/spec/python/specwrite/test_non_standard.py b/spec/python/specwrite/test_non_standard.py index 8d1a8c0c2..678edddc3 100644 --- a/spec/python/specwrite/test_non_standard.py +++ b/spec/python/specwrite/test_non_standard.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestNonStandard, self).__init__(*args, **kwargs) self.struct_class = NonStandard self.src_filename = 'src/fixed_struct.bin' - diff --git a/spec/python/specwrite/test_opaque_external_type.py b/spec/python/specwrite/test_opaque_external_type.py index 456c93d83..fb99f981d 100644 --- a/spec/python/specwrite/test_opaque_external_type.py +++ b/spec/python/specwrite/test_opaque_external_type.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestOpaqueExternalType, self).__init__(*args, **kwargs) self.struct_class = OpaqueExternalType self.src_filename = 'src/term_strz.bin' - diff --git a/spec/python/specwrite/test_optional_id.py b/spec/python/specwrite/test_optional_id.py index ec9d4dd1c..7c8938c0d 100644 --- a/spec/python/specwrite/test_optional_id.py +++ b/spec/python/specwrite/test_optional_id.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestOptionalId, self).__init__(*args, **kwargs) self.struct_class = OptionalId self.src_filename = 'src/fixed_struct.bin' - diff --git a/spec/python/specwrite/test_params_call_extra_parens.py b/spec/python/specwrite/test_params_call_extra_parens.py index 256e1d976..54620a1bd 100644 --- a/spec/python/specwrite/test_params_call_extra_parens.py +++ b/spec/python/specwrite/test_params_call_extra_parens.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestParamsCallExtraParens, self).__init__(*args, **kwargs) self.struct_class = ParamsCallExtraParens self.src_filename = 'src/term_strz.bin' - diff --git a/spec/python/specwrite/test_params_call_short.py b/spec/python/specwrite/test_params_call_short.py index 6d201ef81..c7e16aef1 100644 --- a/spec/python/specwrite/test_params_call_short.py +++ b/spec/python/specwrite/test_params_call_short.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestParamsCallShort, self).__init__(*args, **kwargs) self.struct_class = ParamsCallShort self.src_filename = 'src/term_strz.bin' - diff --git a/spec/python/specwrite/test_params_enum.py b/spec/python/specwrite/test_params_enum.py index 711793fe1..c79c0faed 100644 --- a/spec/python/specwrite/test_params_enum.py +++ b/spec/python/specwrite/test_params_enum.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestParamsEnum, self).__init__(*args, **kwargs) self.struct_class = ParamsEnum self.src_filename = 'src/enum_0.bin' - diff --git a/spec/python/specwrite/test_params_pass_array_int.py b/spec/python/specwrite/test_params_pass_array_int.py index 438b0542c..e2a3728d5 100644 --- a/spec/python/specwrite/test_params_pass_array_int.py +++ b/spec/python/specwrite/test_params_pass_array_int.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestParamsPassArrayInt, self).__init__(*args, **kwargs) self.struct_class = ParamsPassArrayInt self.src_filename = 'src/position_to_end.bin' - diff --git a/spec/python/specwrite/test_params_pass_array_io.py b/spec/python/specwrite/test_params_pass_array_io.py index ab080e9fc..39cb669ce 100644 --- a/spec/python/specwrite/test_params_pass_array_io.py +++ b/spec/python/specwrite/test_params_pass_array_io.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestParamsPassArrayIo, self).__init__(*args, **kwargs) self.struct_class = ParamsPassArrayIo self.src_filename = 'src/enum_negative.bin' - diff --git a/spec/python/specwrite/test_params_pass_array_str.py b/spec/python/specwrite/test_params_pass_array_str.py index 987f970ab..5f6a53dc6 100644 --- a/spec/python/specwrite/test_params_pass_array_str.py +++ b/spec/python/specwrite/test_params_pass_array_str.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestParamsPassArrayStr, self).__init__(*args, **kwargs) self.struct_class = ParamsPassArrayStr self.src_filename = 'src/term_strz.bin' - diff --git a/spec/python/specwrite/test_params_pass_array_struct.py b/spec/python/specwrite/test_params_pass_array_struct.py index 33e3f2dd8..9b2de0b54 100644 --- a/spec/python/specwrite/test_params_pass_array_struct.py +++ b/spec/python/specwrite/test_params_pass_array_struct.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestParamsPassArrayStruct, self).__init__(*args, **kwargs) self.struct_class = ParamsPassArrayStruct self.src_filename = 'src/position_to_end.bin' - diff --git a/spec/python/specwrite/test_params_pass_array_usertype.py b/spec/python/specwrite/test_params_pass_array_usertype.py index 760816f3e..c80c689c5 100644 --- a/spec/python/specwrite/test_params_pass_array_usertype.py +++ b/spec/python/specwrite/test_params_pass_array_usertype.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestParamsPassArrayUsertype, self).__init__(*args, **kwargs) self.struct_class = ParamsPassArrayUsertype self.src_filename = 'src/position_to_end.bin' - diff --git a/spec/python/specwrite/test_params_pass_bool.py b/spec/python/specwrite/test_params_pass_bool.py index 587d4a0c4..1f4ad07b5 100644 --- a/spec/python/specwrite/test_params_pass_bool.py +++ b/spec/python/specwrite/test_params_pass_bool.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestParamsPassBool, self).__init__(*args, **kwargs) self.struct_class = ParamsPassBool self.src_filename = 'src/term_strz.bin' - diff --git a/spec/python/specwrite/test_params_pass_io.py b/spec/python/specwrite/test_params_pass_io.py index a57cf760f..9c4359680 100644 --- a/spec/python/specwrite/test_params_pass_io.py +++ b/spec/python/specwrite/test_params_pass_io.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestParamsPassIo, self).__init__(*args, **kwargs) self.struct_class = ParamsPassIo self.src_filename = 'src/enum_negative.bin' - diff --git a/spec/python/specwrite/test_params_pass_struct.py b/spec/python/specwrite/test_params_pass_struct.py index 85bc0f9ac..fc0f22a9d 100644 --- a/spec/python/specwrite/test_params_pass_struct.py +++ b/spec/python/specwrite/test_params_pass_struct.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestParamsPassStruct, self).__init__(*args, **kwargs) self.struct_class = ParamsPassStruct self.src_filename = 'src/enum_negative.bin' - diff --git a/spec/python/specwrite/test_params_pass_usertype.py b/spec/python/specwrite/test_params_pass_usertype.py index b547fc456..ea48a70e5 100644 --- a/spec/python/specwrite/test_params_pass_usertype.py +++ b/spec/python/specwrite/test_params_pass_usertype.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestParamsPassUsertype, self).__init__(*args, **kwargs) self.struct_class = ParamsPassUsertype self.src_filename = 'src/position_in_seq.bin' - diff --git a/spec/python/specwrite/test_position_abs.py b/spec/python/specwrite/test_position_abs.py index a3b739719..f4e6b26ff 100644 --- a/spec/python/specwrite/test_position_abs.py +++ b/spec/python/specwrite/test_position_abs.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestPositionAbs, self).__init__(*args, **kwargs) self.struct_class = PositionAbs self.src_filename = 'src/position_abs.bin' - diff --git a/spec/python/specwrite/test_position_in_seq.py b/spec/python/specwrite/test_position_in_seq.py index fae4fc1e6..376e63bf1 100644 --- a/spec/python/specwrite/test_position_in_seq.py +++ b/spec/python/specwrite/test_position_in_seq.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestPositionInSeq, self).__init__(*args, **kwargs) self.struct_class = PositionInSeq self.src_filename = 'src/position_in_seq.bin' - diff --git a/spec/python/specwrite/test_position_to_end.py b/spec/python/specwrite/test_position_to_end.py index 6de1d2bb9..00b6e26ef 100644 --- a/spec/python/specwrite/test_position_to_end.py +++ b/spec/python/specwrite/test_position_to_end.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestPositionToEnd, self).__init__(*args, **kwargs) self.struct_class = PositionToEnd self.src_filename = 'src/position_to_end.bin' - diff --git a/spec/python/specwrite/test_process_bytes_pad_term.py b/spec/python/specwrite/test_process_bytes_pad_term.py index 10eaee668..d92748f67 100644 --- a/spec/python/specwrite/test_process_bytes_pad_term.py +++ b/spec/python/specwrite/test_process_bytes_pad_term.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestProcessBytesPadTerm, self).__init__(*args, **kwargs) self.struct_class = ProcessBytesPadTerm self.src_filename = 'src/str_pad_term.bin' - diff --git a/spec/python/specwrite/test_process_coerce_bytes.py b/spec/python/specwrite/test_process_coerce_bytes.py index 513437348..9e6e7e344 100644 --- a/spec/python/specwrite/test_process_coerce_bytes.py +++ b/spec/python/specwrite/test_process_coerce_bytes.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestProcessCoerceBytes, self).__init__(*args, **kwargs) self.struct_class = ProcessCoerceBytes self.src_filename = 'src/process_coerce_bytes.bin' - diff --git a/spec/python/specwrite/test_process_coerce_switch.py b/spec/python/specwrite/test_process_coerce_switch.py index 2fa936dfb..9f0a618ed 100644 --- a/spec/python/specwrite/test_process_coerce_switch.py +++ b/spec/python/specwrite/test_process_coerce_switch.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestProcessCoerceSwitch, self).__init__(*args, **kwargs) self.struct_class = ProcessCoerceSwitch self.src_filename = 'src/process_coerce_switch.bin' - diff --git a/spec/python/specwrite/test_process_coerce_usertype1.py b/spec/python/specwrite/test_process_coerce_usertype1.py index 6b8a04cf1..cadcb809b 100644 --- a/spec/python/specwrite/test_process_coerce_usertype1.py +++ b/spec/python/specwrite/test_process_coerce_usertype1.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestProcessCoerceUsertype1, self).__init__(*args, **kwargs) self.struct_class = ProcessCoerceUsertype1 self.src_filename = 'src/process_coerce_bytes.bin' - diff --git a/spec/python/specwrite/test_process_coerce_usertype2.py b/spec/python/specwrite/test_process_coerce_usertype2.py index 4b80c592e..6ae1e3219 100644 --- a/spec/python/specwrite/test_process_coerce_usertype2.py +++ b/spec/python/specwrite/test_process_coerce_usertype2.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestProcessCoerceUsertype2, self).__init__(*args, **kwargs) self.struct_class = ProcessCoerceUsertype2 self.src_filename = 'src/process_coerce_bytes.bin' - diff --git a/spec/python/specwrite/test_process_custom.py b/spec/python/specwrite/test_process_custom.py index 209e47b77..e1bc40514 100644 --- a/spec/python/specwrite/test_process_custom.py +++ b/spec/python/specwrite/test_process_custom.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestProcessCustom, self).__init__(*args, **kwargs) self.struct_class = ProcessCustom self.src_filename = 'src/process_rotate.bin' - diff --git a/spec/python/specwrite/test_process_custom_no_args.py b/spec/python/specwrite/test_process_custom_no_args.py index 8371c6d69..0bfa37b87 100644 --- a/spec/python/specwrite/test_process_custom_no_args.py +++ b/spec/python/specwrite/test_process_custom_no_args.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestProcessCustomNoArgs, self).__init__(*args, **kwargs) self.struct_class = ProcessCustomNoArgs self.src_filename = 'src/process_rotate.bin' - diff --git a/spec/python/specwrite/test_process_repeat_bytes.py b/spec/python/specwrite/test_process_repeat_bytes.py index fbb558252..4996acecc 100644 --- a/spec/python/specwrite/test_process_repeat_bytes.py +++ b/spec/python/specwrite/test_process_repeat_bytes.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestProcessRepeatBytes, self).__init__(*args, **kwargs) self.struct_class = ProcessRepeatBytes self.src_filename = 'src/process_xor_4.bin' - diff --git a/spec/python/specwrite/test_process_repeat_usertype.py b/spec/python/specwrite/test_process_repeat_usertype.py index a9b01880a..3834b381e 100644 --- a/spec/python/specwrite/test_process_repeat_usertype.py +++ b/spec/python/specwrite/test_process_repeat_usertype.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestProcessRepeatUsertype, self).__init__(*args, **kwargs) self.struct_class = ProcessRepeatUsertype self.src_filename = 'src/process_xor_4.bin' - diff --git a/spec/python/specwrite/test_process_repeat_usertype_dynarg_custom.py b/spec/python/specwrite/test_process_repeat_usertype_dynarg_custom.py index a8227788b..afc58fa5d 100644 --- a/spec/python/specwrite/test_process_repeat_usertype_dynarg_custom.py +++ b/spec/python/specwrite/test_process_repeat_usertype_dynarg_custom.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestProcessRepeatUsertypeDynargCustom, self).__init__(*args, **kwargs) self.struct_class = ProcessRepeatUsertypeDynargCustom self.src_filename = 'src/process_rotate.bin' - diff --git a/spec/python/specwrite/test_process_repeat_usertype_dynarg_rotate.py b/spec/python/specwrite/test_process_repeat_usertype_dynarg_rotate.py index fe775cfbf..5617845ce 100644 --- a/spec/python/specwrite/test_process_repeat_usertype_dynarg_rotate.py +++ b/spec/python/specwrite/test_process_repeat_usertype_dynarg_rotate.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestProcessRepeatUsertypeDynargRotate, self).__init__(*args, **kwargs) self.struct_class = ProcessRepeatUsertypeDynargRotate self.src_filename = 'src/process_rotate.bin' - diff --git a/spec/python/specwrite/test_process_repeat_usertype_dynarg_xor.py b/spec/python/specwrite/test_process_repeat_usertype_dynarg_xor.py index 21e51addc..bd6419238 100644 --- a/spec/python/specwrite/test_process_repeat_usertype_dynarg_xor.py +++ b/spec/python/specwrite/test_process_repeat_usertype_dynarg_xor.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestProcessRepeatUsertypeDynargXor, self).__init__(*args, **kwargs) self.struct_class = ProcessRepeatUsertypeDynargXor self.src_filename = 'src/process_xor_4.bin' - diff --git a/spec/python/specwrite/test_process_struct_pad_term.py b/spec/python/specwrite/test_process_struct_pad_term.py index 610381987..da49b0e28 100644 --- a/spec/python/specwrite/test_process_struct_pad_term.py +++ b/spec/python/specwrite/test_process_struct_pad_term.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestProcessStructPadTerm, self).__init__(*args, **kwargs) self.struct_class = ProcessStructPadTerm self.src_filename = 'src/str_pad_term.bin' - diff --git a/spec/python/specwrite/test_process_term_struct.py b/spec/python/specwrite/test_process_term_struct.py index 0a4279fa3..599fced1e 100644 --- a/spec/python/specwrite/test_process_term_struct.py +++ b/spec/python/specwrite/test_process_term_struct.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestProcessTermStruct, self).__init__(*args, **kwargs) self.struct_class = ProcessTermStruct self.src_filename = 'src/term_strz.bin' - diff --git a/spec/python/specwrite/test_process_xor4_const.py b/spec/python/specwrite/test_process_xor4_const.py index 37de705b2..867bd67dc 100644 --- a/spec/python/specwrite/test_process_xor4_const.py +++ b/spec/python/specwrite/test_process_xor4_const.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestProcessXor4Const, self).__init__(*args, **kwargs) self.struct_class = ProcessXor4Const self.src_filename = 'src/process_xor_4.bin' - diff --git a/spec/python/specwrite/test_process_xor4_value.py b/spec/python/specwrite/test_process_xor4_value.py index 94cadcf00..2df99139f 100644 --- a/spec/python/specwrite/test_process_xor4_value.py +++ b/spec/python/specwrite/test_process_xor4_value.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestProcessXor4Value, self).__init__(*args, **kwargs) self.struct_class = ProcessXor4Value self.src_filename = 'src/process_xor_4.bin' - diff --git a/spec/python/specwrite/test_process_xor_const.py b/spec/python/specwrite/test_process_xor_const.py index c88d6aa43..ad5ae1720 100644 --- a/spec/python/specwrite/test_process_xor_const.py +++ b/spec/python/specwrite/test_process_xor_const.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestProcessXorConst, self).__init__(*args, **kwargs) self.struct_class = ProcessXorConst self.src_filename = 'src/process_xor_1.bin' - diff --git a/spec/python/specwrite/test_process_xor_value.py b/spec/python/specwrite/test_process_xor_value.py index 44bce26bf..8c61217e2 100644 --- a/spec/python/specwrite/test_process_xor_value.py +++ b/spec/python/specwrite/test_process_xor_value.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestProcessXorValue, self).__init__(*args, **kwargs) self.struct_class = ProcessXorValue self.src_filename = 'src/process_xor_1.bin' - diff --git a/spec/python/specwrite/test_recursive_one.py b/spec/python/specwrite/test_recursive_one.py index 88a3a4009..77ed53b0b 100644 --- a/spec/python/specwrite/test_recursive_one.py +++ b/spec/python/specwrite/test_recursive_one.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestRecursiveOne, self).__init__(*args, **kwargs) self.struct_class = RecursiveOne self.src_filename = 'src/fixed_struct.bin' - diff --git a/spec/python/specwrite/test_repeat_eos_bit.py b/spec/python/specwrite/test_repeat_eos_bit.py index c13e11d03..4014f9597 100644 --- a/spec/python/specwrite/test_repeat_eos_bit.py +++ b/spec/python/specwrite/test_repeat_eos_bit.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestRepeatEosBit, self).__init__(*args, **kwargs) self.struct_class = RepeatEosBit self.src_filename = 'src/enum_0.bin' - diff --git a/spec/python/specwrite/test_repeat_eos_bytes_pad.py b/spec/python/specwrite/test_repeat_eos_bytes_pad.py index dcc58ae12..07fd43e38 100644 --- a/spec/python/specwrite/test_repeat_eos_bytes_pad.py +++ b/spec/python/specwrite/test_repeat_eos_bytes_pad.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestRepeatEosBytesPad, self).__init__(*args, **kwargs) self.struct_class = RepeatEosBytesPad self.src_filename = 'src/repeat_until_process.bin' - diff --git a/spec/python/specwrite/test_repeat_eos_bytes_pad_term.py b/spec/python/specwrite/test_repeat_eos_bytes_pad_term.py index aa62f3505..15a616b63 100644 --- a/spec/python/specwrite/test_repeat_eos_bytes_pad_term.py +++ b/spec/python/specwrite/test_repeat_eos_bytes_pad_term.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestRepeatEosBytesPadTerm, self).__init__(*args, **kwargs) self.struct_class = RepeatEosBytesPadTerm self.src_filename = 'src/repeat_until_process.bin' - diff --git a/spec/python/specwrite/test_repeat_eos_struct.py b/spec/python/specwrite/test_repeat_eos_struct.py index 9ea490a92..d5abfce7e 100644 --- a/spec/python/specwrite/test_repeat_eos_struct.py +++ b/spec/python/specwrite/test_repeat_eos_struct.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestRepeatEosStruct, self).__init__(*args, **kwargs) self.struct_class = RepeatEosStruct self.src_filename = 'src/repeat_eos_struct.bin' - diff --git a/spec/python/specwrite/test_repeat_eos_term_bytes.py b/spec/python/specwrite/test_repeat_eos_term_bytes.py index 957c7cb03..1c6832fbf 100644 --- a/spec/python/specwrite/test_repeat_eos_term_bytes.py +++ b/spec/python/specwrite/test_repeat_eos_term_bytes.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestRepeatEosTermBytes, self).__init__(*args, **kwargs) self.struct_class = RepeatEosTermBytes self.src_filename = 'src/process_rotate.bin' - diff --git a/spec/python/specwrite/test_repeat_eos_term_struct.py b/spec/python/specwrite/test_repeat_eos_term_struct.py index 76ffc471e..6cbb5c8f2 100644 --- a/spec/python/specwrite/test_repeat_eos_term_struct.py +++ b/spec/python/specwrite/test_repeat_eos_term_struct.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestRepeatEosTermStruct, self).__init__(*args, **kwargs) self.struct_class = RepeatEosTermStruct self.src_filename = 'src/process_rotate.bin' - diff --git a/spec/python/specwrite/test_repeat_eos_u4.py b/spec/python/specwrite/test_repeat_eos_u4.py index 25f651697..f264a11aa 100644 --- a/spec/python/specwrite/test_repeat_eos_u4.py +++ b/spec/python/specwrite/test_repeat_eos_u4.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestRepeatEosU4, self).__init__(*args, **kwargs) self.struct_class = RepeatEosU4 self.src_filename = 'src/repeat_eos_struct.bin' - diff --git a/spec/python/specwrite/test_repeat_n_bytes.py b/spec/python/specwrite/test_repeat_n_bytes.py index e0b9ccac8..3ac48b559 100644 --- a/spec/python/specwrite/test_repeat_n_bytes.py +++ b/spec/python/specwrite/test_repeat_n_bytes.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestRepeatNBytes, self).__init__(*args, **kwargs) self.struct_class = RepeatNBytes self.src_filename = 'src/repeat_until_process.bin' - diff --git a/spec/python/specwrite/test_repeat_n_bytes_pad.py b/spec/python/specwrite/test_repeat_n_bytes_pad.py index a9b62b88b..da950d611 100644 --- a/spec/python/specwrite/test_repeat_n_bytes_pad.py +++ b/spec/python/specwrite/test_repeat_n_bytes_pad.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestRepeatNBytesPad, self).__init__(*args, **kwargs) self.struct_class = RepeatNBytesPad self.src_filename = 'src/repeat_until_process.bin' - diff --git a/spec/python/specwrite/test_repeat_n_bytes_pad_term.py b/spec/python/specwrite/test_repeat_n_bytes_pad_term.py index e0cd188b2..a3a1cd813 100644 --- a/spec/python/specwrite/test_repeat_n_bytes_pad_term.py +++ b/spec/python/specwrite/test_repeat_n_bytes_pad_term.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestRepeatNBytesPadTerm, self).__init__(*args, **kwargs) self.struct_class = RepeatNBytesPadTerm self.src_filename = 'src/repeat_until_process.bin' - diff --git a/spec/python/specwrite/test_repeat_n_struct.py b/spec/python/specwrite/test_repeat_n_struct.py index eb4fe6985..e27fdfe55 100644 --- a/spec/python/specwrite/test_repeat_n_struct.py +++ b/spec/python/specwrite/test_repeat_n_struct.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestRepeatNStruct, self).__init__(*args, **kwargs) self.struct_class = RepeatNStruct self.src_filename = 'src/repeat_n_struct.bin' - diff --git a/spec/python/specwrite/test_repeat_n_strz_double.py b/spec/python/specwrite/test_repeat_n_strz_double.py index 5be076206..bdffb5058 100644 --- a/spec/python/specwrite/test_repeat_n_strz_double.py +++ b/spec/python/specwrite/test_repeat_n_strz_double.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestRepeatNStrzDouble, self).__init__(*args, **kwargs) self.struct_class = RepeatNStrzDouble self.src_filename = 'src/repeat_n_strz.bin' - diff --git a/spec/python/specwrite/test_repeat_n_term_bytes.py b/spec/python/specwrite/test_repeat_n_term_bytes.py index af7bd91e4..85a66d926 100644 --- a/spec/python/specwrite/test_repeat_n_term_bytes.py +++ b/spec/python/specwrite/test_repeat_n_term_bytes.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestRepeatNTermBytes, self).__init__(*args, **kwargs) self.struct_class = RepeatNTermBytes self.src_filename = 'src/repeat_until_process.bin' - diff --git a/spec/python/specwrite/test_repeat_n_term_struct.py b/spec/python/specwrite/test_repeat_n_term_struct.py index f83c98f67..abc3d8905 100644 --- a/spec/python/specwrite/test_repeat_n_term_struct.py +++ b/spec/python/specwrite/test_repeat_n_term_struct.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestRepeatNTermStruct, self).__init__(*args, **kwargs) self.struct_class = RepeatNTermStruct self.src_filename = 'src/repeat_until_process.bin' - diff --git a/spec/python/specwrite/test_repeat_until_bytes.py b/spec/python/specwrite/test_repeat_until_bytes.py index 2e15a611f..ece615247 100644 --- a/spec/python/specwrite/test_repeat_until_bytes.py +++ b/spec/python/specwrite/test_repeat_until_bytes.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestRepeatUntilBytes, self).__init__(*args, **kwargs) self.struct_class = RepeatUntilBytes self.src_filename = 'src/repeat_until_process.bin' - diff --git a/spec/python/specwrite/test_repeat_until_bytes_pad.py b/spec/python/specwrite/test_repeat_until_bytes_pad.py index e17e38166..f6a0622fb 100644 --- a/spec/python/specwrite/test_repeat_until_bytes_pad.py +++ b/spec/python/specwrite/test_repeat_until_bytes_pad.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestRepeatUntilBytesPad, self).__init__(*args, **kwargs) self.struct_class = RepeatUntilBytesPad self.src_filename = 'src/repeat_until_process.bin' - diff --git a/spec/python/specwrite/test_repeat_until_bytes_pad_term.py b/spec/python/specwrite/test_repeat_until_bytes_pad_term.py index 3a5e2303c..3a4cfaf76 100644 --- a/spec/python/specwrite/test_repeat_until_bytes_pad_term.py +++ b/spec/python/specwrite/test_repeat_until_bytes_pad_term.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestRepeatUntilBytesPadTerm, self).__init__(*args, **kwargs) self.struct_class = RepeatUntilBytesPadTerm self.src_filename = 'src/repeat_until_process.bin' - diff --git a/spec/python/specwrite/test_repeat_until_calc_array_type.py b/spec/python/specwrite/test_repeat_until_calc_array_type.py index b561ebe69..fab1949a4 100644 --- a/spec/python/specwrite/test_repeat_until_calc_array_type.py +++ b/spec/python/specwrite/test_repeat_until_calc_array_type.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestRepeatUntilCalcArrayType, self).__init__(*args, **kwargs) self.struct_class = RepeatUntilCalcArrayType self.src_filename = 'src/repeat_until_process.bin' - diff --git a/spec/python/specwrite/test_repeat_until_complex.py b/spec/python/specwrite/test_repeat_until_complex.py index 6ca09754a..ff80785a2 100644 --- a/spec/python/specwrite/test_repeat_until_complex.py +++ b/spec/python/specwrite/test_repeat_until_complex.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestRepeatUntilComplex, self).__init__(*args, **kwargs) self.struct_class = RepeatUntilComplex self.src_filename = 'src/repeat_until_complex.bin' - diff --git a/spec/python/specwrite/test_repeat_until_sized.py b/spec/python/specwrite/test_repeat_until_sized.py index b01b88f1a..f63740d80 100644 --- a/spec/python/specwrite/test_repeat_until_sized.py +++ b/spec/python/specwrite/test_repeat_until_sized.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestRepeatUntilSized, self).__init__(*args, **kwargs) self.struct_class = RepeatUntilSized self.src_filename = 'src/repeat_until_process.bin' - diff --git a/spec/python/specwrite/test_repeat_until_term_bytes.py b/spec/python/specwrite/test_repeat_until_term_bytes.py index 9f09345c7..4eb6e4da8 100644 --- a/spec/python/specwrite/test_repeat_until_term_bytes.py +++ b/spec/python/specwrite/test_repeat_until_term_bytes.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestRepeatUntilTermBytes, self).__init__(*args, **kwargs) self.struct_class = RepeatUntilTermBytes self.src_filename = 'src/repeat_until_process.bin' - diff --git a/spec/python/specwrite/test_repeat_until_term_struct.py b/spec/python/specwrite/test_repeat_until_term_struct.py index 27a9d1747..dd46ecde5 100644 --- a/spec/python/specwrite/test_repeat_until_term_struct.py +++ b/spec/python/specwrite/test_repeat_until_term_struct.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestRepeatUntilTermStruct, self).__init__(*args, **kwargs) self.struct_class = RepeatUntilTermStruct self.src_filename = 'src/repeat_until_process.bin' - diff --git a/spec/python/specwrite/test_str_encodings_default.py b/spec/python/specwrite/test_str_encodings_default.py index b6691d5ad..603aa7922 100644 --- a/spec/python/specwrite/test_str_encodings_default.py +++ b/spec/python/specwrite/test_str_encodings_default.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestStrEncodingsDefault, self).__init__(*args, **kwargs) self.struct_class = StrEncodingsDefault self.src_filename = 'src/str_encodings.bin' - diff --git a/spec/python/specwrite/test_str_encodings_utf16.py b/spec/python/specwrite/test_str_encodings_utf16.py index 734fa3a5d..de775cd37 100644 --- a/spec/python/specwrite/test_str_encodings_utf16.py +++ b/spec/python/specwrite/test_str_encodings_utf16.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestStrEncodingsUtf16, self).__init__(*args, **kwargs) self.struct_class = StrEncodingsUtf16 self.src_filename = 'src/str_encodings_utf16.bin' - diff --git a/spec/python/specwrite/test_str_eos_pad_term.py b/spec/python/specwrite/test_str_eos_pad_term.py index 838507b0f..bc1d36494 100644 --- a/spec/python/specwrite/test_str_eos_pad_term.py +++ b/spec/python/specwrite/test_str_eos_pad_term.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestStrEosPadTerm, self).__init__(*args, **kwargs) self.struct_class = StrEosPadTerm self.src_filename = 'src/str_pad_term.bin' - diff --git a/spec/python/specwrite/test_str_eos_pad_term_empty.py b/spec/python/specwrite/test_str_eos_pad_term_empty.py index 8897f50bb..27c755791 100644 --- a/spec/python/specwrite/test_str_eos_pad_term_empty.py +++ b/spec/python/specwrite/test_str_eos_pad_term_empty.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestStrEosPadTermEmpty, self).__init__(*args, **kwargs) self.struct_class = StrEosPadTermEmpty self.src_filename = 'src/str_pad_term_empty.bin' - diff --git a/spec/python/specwrite/test_str_eos_pad_term_equal.py b/spec/python/specwrite/test_str_eos_pad_term_equal.py index c2ba5dd14..f2edb7c56 100644 --- a/spec/python/specwrite/test_str_eos_pad_term_equal.py +++ b/spec/python/specwrite/test_str_eos_pad_term_equal.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestStrEosPadTermEqual, self).__init__(*args, **kwargs) self.struct_class = StrEosPadTermEqual self.src_filename = 'src/str_pad_term.bin' - diff --git a/spec/python/specwrite/test_str_literals2.py b/spec/python/specwrite/test_str_literals2.py index 83f9e66f1..34e560eae 100644 --- a/spec/python/specwrite/test_str_literals2.py +++ b/spec/python/specwrite/test_str_literals2.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestStrLiterals2, self).__init__(*args, **kwargs) self.struct_class = StrLiterals2 self.src_filename = 'src/fixed_struct.bin' - diff --git a/spec/python/specwrite/test_str_pad_term.py b/spec/python/specwrite/test_str_pad_term.py index 4b79dfa9d..764fccac8 100644 --- a/spec/python/specwrite/test_str_pad_term.py +++ b/spec/python/specwrite/test_str_pad_term.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestStrPadTerm, self).__init__(*args, **kwargs) self.struct_class = StrPadTerm self.src_filename = 'src/str_pad_term.bin' - diff --git a/spec/python/specwrite/test_str_pad_term_empty.py b/spec/python/specwrite/test_str_pad_term_empty.py index 0c0d17da8..381241f6b 100644 --- a/spec/python/specwrite/test_str_pad_term_empty.py +++ b/spec/python/specwrite/test_str_pad_term_empty.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestStrPadTermEmpty, self).__init__(*args, **kwargs) self.struct_class = StrPadTermEmpty self.src_filename = 'src/str_pad_term_empty.bin' - diff --git a/spec/python/specwrite/test_str_pad_term_equal.py b/spec/python/specwrite/test_str_pad_term_equal.py index 2d1b28f30..a57d92279 100644 --- a/spec/python/specwrite/test_str_pad_term_equal.py +++ b/spec/python/specwrite/test_str_pad_term_equal.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestStrPadTermEqual, self).__init__(*args, **kwargs) self.struct_class = StrPadTermEqual self.src_filename = 'src/str_pad_term.bin' - diff --git a/spec/python/specwrite/test_str_pad_term_zero_size.py b/spec/python/specwrite/test_str_pad_term_zero_size.py index dfb523993..cb92e5c33 100644 --- a/spec/python/specwrite/test_str_pad_term_zero_size.py +++ b/spec/python/specwrite/test_str_pad_term_zero_size.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestStrPadTermZeroSize, self).__init__(*args, **kwargs) self.struct_class = StrPadTermZeroSize self.src_filename = 'src/enum_negative.bin' - diff --git a/spec/python/specwrite/test_struct_pad_term.py b/spec/python/specwrite/test_struct_pad_term.py index cb579e5b4..aa4cf64f9 100644 --- a/spec/python/specwrite/test_struct_pad_term.py +++ b/spec/python/specwrite/test_struct_pad_term.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestStructPadTerm, self).__init__(*args, **kwargs) self.struct_class = StructPadTerm self.src_filename = 'src/str_pad_term.bin' - diff --git a/spec/python/specwrite/test_struct_pad_term_equal.py b/spec/python/specwrite/test_struct_pad_term_equal.py index c3f7ae606..e87ae4577 100644 --- a/spec/python/specwrite/test_struct_pad_term_equal.py +++ b/spec/python/specwrite/test_struct_pad_term_equal.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestStructPadTermEqual, self).__init__(*args, **kwargs) self.struct_class = StructPadTermEqual self.src_filename = 'src/str_pad_term.bin' - diff --git a/spec/python/specwrite/test_switch_bytearray.py b/spec/python/specwrite/test_switch_bytearray.py index ff4953644..1fc7afbe5 100644 --- a/spec/python/specwrite/test_switch_bytearray.py +++ b/spec/python/specwrite/test_switch_bytearray.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestSwitchBytearray, self).__init__(*args, **kwargs) self.struct_class = SwitchBytearray self.src_filename = 'src/switch_opcodes.bin' - diff --git a/spec/python/specwrite/test_switch_else_only.py b/spec/python/specwrite/test_switch_else_only.py index 203c76362..27c7d128a 100644 --- a/spec/python/specwrite/test_switch_else_only.py +++ b/spec/python/specwrite/test_switch_else_only.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestSwitchElseOnly, self).__init__(*args, **kwargs) self.struct_class = SwitchElseOnly self.src_filename = 'src/switch_opcodes.bin' - diff --git a/spec/python/specwrite/test_switch_integers.py b/spec/python/specwrite/test_switch_integers.py index fa2bd56ce..9748acd57 100644 --- a/spec/python/specwrite/test_switch_integers.py +++ b/spec/python/specwrite/test_switch_integers.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestSwitchIntegers, self).__init__(*args, **kwargs) self.struct_class = SwitchIntegers self.src_filename = 'src/switch_integers.bin' - diff --git a/spec/python/specwrite/test_switch_integers2.py b/spec/python/specwrite/test_switch_integers2.py index 294701eb0..e6adf00df 100644 --- a/spec/python/specwrite/test_switch_integers2.py +++ b/spec/python/specwrite/test_switch_integers2.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestSwitchIntegers2, self).__init__(*args, **kwargs) self.struct_class = SwitchIntegers2 self.src_filename = 'src/switch_integers.bin' - diff --git a/spec/python/specwrite/test_switch_manual_enum.py b/spec/python/specwrite/test_switch_manual_enum.py index 9acfe1c86..89dd0adfc 100644 --- a/spec/python/specwrite/test_switch_manual_enum.py +++ b/spec/python/specwrite/test_switch_manual_enum.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestSwitchManualEnum, self).__init__(*args, **kwargs) self.struct_class = SwitchManualEnum self.src_filename = 'src/switch_opcodes.bin' - diff --git a/spec/python/specwrite/test_switch_manual_enum_invalid.py b/spec/python/specwrite/test_switch_manual_enum_invalid.py index 80530da5a..8ae632104 100644 --- a/spec/python/specwrite/test_switch_manual_enum_invalid.py +++ b/spec/python/specwrite/test_switch_manual_enum_invalid.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestSwitchManualEnumInvalid, self).__init__(*args, **kwargs) self.struct_class = SwitchManualEnumInvalid self.src_filename = 'src/enum_negative.bin' - diff --git a/spec/python/specwrite/test_switch_manual_enum_invalid_else.py b/spec/python/specwrite/test_switch_manual_enum_invalid_else.py index cdeebea1d..f118b8999 100644 --- a/spec/python/specwrite/test_switch_manual_enum_invalid_else.py +++ b/spec/python/specwrite/test_switch_manual_enum_invalid_else.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestSwitchManualEnumInvalidElse, self).__init__(*args, **kwargs) self.struct_class = SwitchManualEnumInvalidElse self.src_filename = 'src/enum_negative.bin' - diff --git a/spec/python/specwrite/test_switch_manual_int.py b/spec/python/specwrite/test_switch_manual_int.py index e76cdd570..f9dd15bb5 100644 --- a/spec/python/specwrite/test_switch_manual_int.py +++ b/spec/python/specwrite/test_switch_manual_int.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestSwitchManualInt, self).__init__(*args, **kwargs) self.struct_class = SwitchManualInt self.src_filename = 'src/switch_opcodes.bin' - diff --git a/spec/python/specwrite/test_switch_manual_int_else.py b/spec/python/specwrite/test_switch_manual_int_else.py index 2aa67c355..d84e50a29 100644 --- a/spec/python/specwrite/test_switch_manual_int_else.py +++ b/spec/python/specwrite/test_switch_manual_int_else.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestSwitchManualIntElse, self).__init__(*args, **kwargs) self.struct_class = SwitchManualIntElse self.src_filename = 'src/switch_opcodes2.bin' - diff --git a/spec/python/specwrite/test_switch_manual_int_size_else.py b/spec/python/specwrite/test_switch_manual_int_size_else.py index f2a2d4e66..787ac69a5 100644 --- a/spec/python/specwrite/test_switch_manual_int_size_else.py +++ b/spec/python/specwrite/test_switch_manual_int_size_else.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestSwitchManualIntSizeElse, self).__init__(*args, **kwargs) self.struct_class = SwitchManualIntSizeElse self.src_filename = 'src/switch_tlv.bin' - diff --git a/spec/python/specwrite/test_switch_manual_int_size_eos.py b/spec/python/specwrite/test_switch_manual_int_size_eos.py index 9a06fcb74..96f1acc1a 100644 --- a/spec/python/specwrite/test_switch_manual_int_size_eos.py +++ b/spec/python/specwrite/test_switch_manual_int_size_eos.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestSwitchManualIntSizeEos, self).__init__(*args, **kwargs) self.struct_class = SwitchManualIntSizeEos self.src_filename = 'src/switch_tlv.bin' - diff --git a/spec/python/specwrite/test_switch_manual_str.py b/spec/python/specwrite/test_switch_manual_str.py index 341890139..ad760b9d4 100644 --- a/spec/python/specwrite/test_switch_manual_str.py +++ b/spec/python/specwrite/test_switch_manual_str.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestSwitchManualStr, self).__init__(*args, **kwargs) self.struct_class = SwitchManualStr self.src_filename = 'src/switch_opcodes.bin' - diff --git a/spec/python/specwrite/test_switch_manual_str_else.py b/spec/python/specwrite/test_switch_manual_str_else.py index 80a9ea39f..43e455aa1 100644 --- a/spec/python/specwrite/test_switch_manual_str_else.py +++ b/spec/python/specwrite/test_switch_manual_str_else.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestSwitchManualStrElse, self).__init__(*args, **kwargs) self.struct_class = SwitchManualStrElse self.src_filename = 'src/switch_opcodes2.bin' - diff --git a/spec/python/specwrite/test_switch_multi_bool_ops.py b/spec/python/specwrite/test_switch_multi_bool_ops.py index 99bb7a153..ed8b95de7 100644 --- a/spec/python/specwrite/test_switch_multi_bool_ops.py +++ b/spec/python/specwrite/test_switch_multi_bool_ops.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestSwitchMultiBoolOps, self).__init__(*args, **kwargs) self.struct_class = SwitchMultiBoolOps self.src_filename = 'src/switch_integers.bin' - diff --git a/spec/python/specwrite/test_switch_repeat_expr.py b/spec/python/specwrite/test_switch_repeat_expr.py index a506e5f38..c95335ab0 100644 --- a/spec/python/specwrite/test_switch_repeat_expr.py +++ b/spec/python/specwrite/test_switch_repeat_expr.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestSwitchRepeatExpr, self).__init__(*args, **kwargs) self.struct_class = SwitchRepeatExpr self.src_filename = 'src/switch_tlv.bin' - diff --git a/spec/python/specwrite/test_switch_repeat_expr_invalid.py b/spec/python/specwrite/test_switch_repeat_expr_invalid.py index cbc445aaa..753aef986 100644 --- a/spec/python/specwrite/test_switch_repeat_expr_invalid.py +++ b/spec/python/specwrite/test_switch_repeat_expr_invalid.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestSwitchRepeatExprInvalid, self).__init__(*args, **kwargs) self.struct_class = SwitchRepeatExprInvalid self.src_filename = 'src/switch_tlv.bin' - diff --git a/spec/python/specwrite/test_term_bytes.py b/spec/python/specwrite/test_term_bytes.py index 8d3a669eb..fafc21e82 100644 --- a/spec/python/specwrite/test_term_bytes.py +++ b/spec/python/specwrite/test_term_bytes.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestTermBytes, self).__init__(*args, **kwargs) self.struct_class = TermBytes self.src_filename = 'src/term_strz.bin' - diff --git a/spec/python/specwrite/test_term_bytes2.py b/spec/python/specwrite/test_term_bytes2.py index b96372d0f..be046f6d3 100644 --- a/spec/python/specwrite/test_term_bytes2.py +++ b/spec/python/specwrite/test_term_bytes2.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestTermBytes2, self).__init__(*args, **kwargs) self.struct_class = TermBytes2 self.src_filename = 'src/term_strz.bin' - diff --git a/spec/python/specwrite/test_term_bytes3.py b/spec/python/specwrite/test_term_bytes3.py index e946361d4..15c280801 100644 --- a/spec/python/specwrite/test_term_bytes3.py +++ b/spec/python/specwrite/test_term_bytes3.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestTermBytes3, self).__init__(*args, **kwargs) self.struct_class = TermBytes3 self.src_filename = 'src/term_strz.bin' - diff --git a/spec/python/specwrite/test_term_struct.py b/spec/python/specwrite/test_term_struct.py index 1d512bd3e..7b8487300 100644 --- a/spec/python/specwrite/test_term_struct.py +++ b/spec/python/specwrite/test_term_struct.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestTermStruct, self).__init__(*args, **kwargs) self.struct_class = TermStruct self.src_filename = 'src/term_strz.bin' - diff --git a/spec/python/specwrite/test_term_struct2.py b/spec/python/specwrite/test_term_struct2.py index 74ba0181f..60df335bf 100644 --- a/spec/python/specwrite/test_term_struct2.py +++ b/spec/python/specwrite/test_term_struct2.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestTermStruct2, self).__init__(*args, **kwargs) self.struct_class = TermStruct2 self.src_filename = 'src/term_strz.bin' - diff --git a/spec/python/specwrite/test_term_struct3.py b/spec/python/specwrite/test_term_struct3.py index ea99c7d6e..c0ffb1512 100644 --- a/spec/python/specwrite/test_term_struct3.py +++ b/spec/python/specwrite/test_term_struct3.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestTermStruct3, self).__init__(*args, **kwargs) self.struct_class = TermStruct3 self.src_filename = 'src/term_strz.bin' - diff --git a/spec/python/specwrite/test_term_struct4.py b/spec/python/specwrite/test_term_struct4.py index 7d57efa6a..525184101 100644 --- a/spec/python/specwrite/test_term_struct4.py +++ b/spec/python/specwrite/test_term_struct4.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestTermStruct4, self).__init__(*args, **kwargs) self.struct_class = TermStruct4 self.src_filename = 'src/term_strz.bin' - diff --git a/spec/python/specwrite/test_term_strz.py b/spec/python/specwrite/test_term_strz.py index c1a405604..842b5af6e 100644 --- a/spec/python/specwrite/test_term_strz.py +++ b/spec/python/specwrite/test_term_strz.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestTermStrz, self).__init__(*args, **kwargs) self.struct_class = TermStrz self.src_filename = 'src/term_strz.bin' - diff --git a/spec/python/specwrite/test_term_strz2.py b/spec/python/specwrite/test_term_strz2.py index 37e6aae4b..232c844e8 100644 --- a/spec/python/specwrite/test_term_strz2.py +++ b/spec/python/specwrite/test_term_strz2.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestTermStrz2, self).__init__(*args, **kwargs) self.struct_class = TermStrz2 self.src_filename = 'src/term_strz.bin' - diff --git a/spec/python/specwrite/test_term_strz3.py b/spec/python/specwrite/test_term_strz3.py index cada96aa5..fcaacdbc3 100644 --- a/spec/python/specwrite/test_term_strz3.py +++ b/spec/python/specwrite/test_term_strz3.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestTermStrz3, self).__init__(*args, **kwargs) self.struct_class = TermStrz3 self.src_filename = 'src/term_strz.bin' - diff --git a/spec/python/specwrite/test_term_strz4.py b/spec/python/specwrite/test_term_strz4.py index 159079931..2f2b3fa83 100644 --- a/spec/python/specwrite/test_term_strz4.py +++ b/spec/python/specwrite/test_term_strz4.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestTermStrz4, self).__init__(*args, **kwargs) self.struct_class = TermStrz4 self.src_filename = 'src/term_strz.bin' - diff --git a/spec/python/specwrite/test_term_u1_val.py b/spec/python/specwrite/test_term_u1_val.py index 4c58638d3..aaf5b719a 100644 --- a/spec/python/specwrite/test_term_u1_val.py +++ b/spec/python/specwrite/test_term_u1_val.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestTermU1Val, self).__init__(*args, **kwargs) self.struct_class = TermU1Val self.src_filename = 'src/str_encodings.bin' - diff --git a/spec/python/specwrite/test_ts_packet_header.py b/spec/python/specwrite/test_ts_packet_header.py index 5534871f8..4de0fda2c 100644 --- a/spec/python/specwrite/test_ts_packet_header.py +++ b/spec/python/specwrite/test_ts_packet_header.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestTsPacketHeader, self).__init__(*args, **kwargs) self.struct_class = TsPacketHeader self.src_filename = 'src/ts_packet.bin' - diff --git a/spec/python/specwrite/test_type_int_unary_op.py b/spec/python/specwrite/test_type_int_unary_op.py index c24ea693e..ef124c9aa 100644 --- a/spec/python/specwrite/test_type_int_unary_op.py +++ b/spec/python/specwrite/test_type_int_unary_op.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestTypeIntUnaryOp, self).__init__(*args, **kwargs) self.struct_class = TypeIntUnaryOp self.src_filename = 'src/fixed_struct.bin' - diff --git a/spec/python/specwrite/test_type_ternary.py b/spec/python/specwrite/test_type_ternary.py index f04105fae..88c93d0cd 100644 --- a/spec/python/specwrite/test_type_ternary.py +++ b/spec/python/specwrite/test_type_ternary.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestTypeTernary, self).__init__(*args, **kwargs) self.struct_class = TypeTernary self.src_filename = 'src/term_strz.bin' - diff --git a/spec/python/specwrite/test_type_ternary_2nd_falsy.py b/spec/python/specwrite/test_type_ternary_2nd_falsy.py index 44ca6d269..bd6637f5e 100644 --- a/spec/python/specwrite/test_type_ternary_2nd_falsy.py +++ b/spec/python/specwrite/test_type_ternary_2nd_falsy.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestTypeTernary2ndFalsy, self).__init__(*args, **kwargs) self.struct_class = TypeTernary2ndFalsy self.src_filename = 'src/switch_integers.bin' - diff --git a/spec/python/specwrite/test_type_ternary_opaque.py b/spec/python/specwrite/test_type_ternary_opaque.py index 9516e3f27..dabb8569d 100644 --- a/spec/python/specwrite/test_type_ternary_opaque.py +++ b/spec/python/specwrite/test_type_ternary_opaque.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestTypeTernaryOpaque, self).__init__(*args, **kwargs) self.struct_class = TypeTernaryOpaque self.src_filename = 'src/term_strz.bin' - diff --git a/spec/python/specwrite/test_user_type.py b/spec/python/specwrite/test_user_type.py index 34f60e352..d91855d45 100644 --- a/spec/python/specwrite/test_user_type.py +++ b/spec/python/specwrite/test_user_type.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestUserType, self).__init__(*args, **kwargs) self.struct_class = UserType self.src_filename = 'src/repeat_until_s4.bin' - diff --git a/spec/python/specwrite/test_valid_eq_str_encodings.py b/spec/python/specwrite/test_valid_eq_str_encodings.py index 957e24bf2..a1f0268ae 100644 --- a/spec/python/specwrite/test_valid_eq_str_encodings.py +++ b/spec/python/specwrite/test_valid_eq_str_encodings.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestValidEqStrEncodings, self).__init__(*args, **kwargs) self.struct_class = ValidEqStrEncodings self.src_filename = 'src/str_encodings.bin' - diff --git a/spec/python/specwrite/test_valid_long.py b/spec/python/specwrite/test_valid_long.py index f348195c0..de7b2227e 100644 --- a/spec/python/specwrite/test_valid_long.py +++ b/spec/python/specwrite/test_valid_long.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestValidLong, self).__init__(*args, **kwargs) self.struct_class = ValidLong self.src_filename = 'src/fixed_struct.bin' - diff --git a/spec/python/specwrite/test_valid_not_parsed_if.py b/spec/python/specwrite/test_valid_not_parsed_if.py index 74bf3718b..2d7c68381 100644 --- a/spec/python/specwrite/test_valid_not_parsed_if.py +++ b/spec/python/specwrite/test_valid_not_parsed_if.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestValidNotParsedIf, self).__init__(*args, **kwargs) self.struct_class = ValidNotParsedIf self.src_filename = 'src/fixed_struct.bin' - diff --git a/spec/python/specwrite/test_valid_optional_id.py b/spec/python/specwrite/test_valid_optional_id.py index ca42e7678..653f80994 100644 --- a/spec/python/specwrite/test_valid_optional_id.py +++ b/spec/python/specwrite/test_valid_optional_id.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestValidOptionalId, self).__init__(*args, **kwargs) self.struct_class = ValidOptionalId self.src_filename = 'src/fixed_struct.bin' - diff --git a/spec/python/specwrite/test_valid_short.py b/spec/python/specwrite/test_valid_short.py index 011cc7e73..46295e356 100644 --- a/spec/python/specwrite/test_valid_short.py +++ b/spec/python/specwrite/test_valid_short.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestValidShort, self).__init__(*args, **kwargs) self.struct_class = ValidShort self.src_filename = 'src/fixed_struct.bin' - diff --git a/spec/python/specwrite/test_valid_switch.py b/spec/python/specwrite/test_valid_switch.py index 5870ff563..c5a4a4b7e 100644 --- a/spec/python/specwrite/test_valid_switch.py +++ b/spec/python/specwrite/test_valid_switch.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestValidSwitch, self).__init__(*args, **kwargs) self.struct_class = ValidSwitch self.src_filename = 'src/fixed_struct.bin' - diff --git a/spec/python/specwrite/test_yaml_ints.py b/spec/python/specwrite/test_yaml_ints.py index 5116b8b4d..530a174f3 100644 --- a/spec/python/specwrite/test_yaml_ints.py +++ b/spec/python/specwrite/test_yaml_ints.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestYamlInts, self).__init__(*args, **kwargs) self.struct_class = YamlInts self.src_filename = 'src/fixed_struct.bin' - diff --git a/spec/python/specwrite/test_zlib_surrounded.py b/spec/python/specwrite/test_zlib_surrounded.py index ae5acf28d..a29761df0 100644 --- a/spec/python/specwrite/test_zlib_surrounded.py +++ b/spec/python/specwrite/test_zlib_surrounded.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestZlibSurrounded, self).__init__(*args, **kwargs) self.struct_class = ZlibSurrounded self.src_filename = 'src/zlib_surrounded.bin' - diff --git a/spec/python/specwrite/test_zlib_with_header_78.py b/spec/python/specwrite/test_zlib_with_header_78.py index ac84bb5f0..8c8615275 100644 --- a/spec/python/specwrite/test_zlib_with_header_78.py +++ b/spec/python/specwrite/test_zlib_with_header_78.py @@ -10,4 +10,3 @@ def __init__(self, *args, **kwargs): super(TestZlibWithHeader78, self).__init__(*args, **kwargs) self.struct_class = ZlibWithHeader78 self.src_filename = 'src/zlib_with_header_78.bin' - From ec57e22696fd6b633e1d368f61bd6100ca07ada1 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Fri, 4 Aug 2023 23:48:14 +0200 Subject: [PATCH 110/126] Move Python spec ExprToITrailing test to the correct location --- spec/python/{ => spec}/test_expr_to_i_trailing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename spec/python/{ => spec}/test_expr_to_i_trailing.py (88%) diff --git a/spec/python/test_expr_to_i_trailing.py b/spec/python/spec/test_expr_to_i_trailing.py similarity index 88% rename from spec/python/test_expr_to_i_trailing.py rename to spec/python/spec/test_expr_to_i_trailing.py index 5be9ef7e3..2eb9ed8a1 100644 --- a/spec/python/test_expr_to_i_trailing.py +++ b/spec/python/spec/test_expr_to_i_trailing.py @@ -3,7 +3,7 @@ import unittest import kaitaistruct -from expr_to_i_trailing import ExprToITrailing +from testformats.expr_to_i_trailing import ExprToITrailing class TestExprToITrailing(unittest.TestCase): def test_expr_to_i_trailing(self): From 55dbf81ca2da9f684bdf295b179024e93706cc9f Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Thu, 14 Sep 2023 21:58:38 +0200 Subject: [PATCH 111/126] junit_xml_parser: add support for `skipped` status --- aggregate/junit_xml_parser.rb | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/aggregate/junit_xml_parser.rb b/aggregate/junit_xml_parser.rb index f8035901f..a80b262b2 100644 --- a/aggregate/junit_xml_parser.rb +++ b/aggregate/junit_xml_parser.rb @@ -53,10 +53,32 @@ def each_test failure_xml = tc.elements['failure'] || tc.elements['error'] if failure_xml.nil? - status = :passed - failure = nil + skipped_xml = tc.elements['skipped'] + + if skipped_xml.nil? + status = :passed + failure = nil + else + status = :skipped + failure_msg = skipped_xml.attribute('message') + failure = TestResult::Failure.new( + nil, + nil, + failure_msg, + nil + ) + end else - status = :failed + # Until TestNG 7.4.0, throwing a SkipException is reported as an error + # (not as a skip, as it should be) in the JUnit XML report by TestNG - + # see . Since we + # are using an older version of TestNG for compatibility with Java 7 + # and Java 8, we have to fix the reported status ourselves. + if failure_xml.attribute('type') && failure_xml.attribute('type').value == 'org.testng.SkipException' + status = :skipped + else + status = :failed + end failure_msg = failure_xml.attribute('message') || failure_xml.attribute('type') failure_msg = failure_msg.value if failure_msg failure_trace = (failure_xml.texts.map {|t| t.value }).join('').strip From 64f7c897a231398730ca0fe8863ee47b7ea6827f Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Thu, 14 Sep 2023 22:30:07 +0200 Subject: [PATCH 112/126] junit_xml_parser: downgrade `classname` match error to warning This is needed to fix the `aggregate/convert_to_json` crash due to error `Unable to parse classname: "unittest.loader.ModuleImportFailure"` that currently occurs when running ./ci-python on Python 2. When `unittest` automatically imports modules during test discovery and some file cannot be imported (e.g. due to a syntax error), the error is reported under the classname `unittest.loader.ModuleImportFailure`, which obviously doesn't match the `/\.Test([^.]*)$/` pattern expected for normal tests. But in that case we just want to skip prepending the classname and continue, not crash - this is not a fatal error. --- aggregate/junit_xml_parser.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/aggregate/junit_xml_parser.rb b/aggregate/junit_xml_parser.rb index a80b262b2..8b44c4209 100644 --- a/aggregate/junit_xml_parser.rb +++ b/aggregate/junit_xml_parser.rb @@ -43,10 +43,12 @@ def each_test if @include_classname classname = tc.attribute('classname').value - raise "Unable to parse classname: \"#{classname}\"" unless classname =~ /\.Test([^.]*)$/ - classname = $1 - name = "#{classname}.#{name}" - else + if classname =~ /\.Test([^.]*)$/ + classname = $1 + name = "#{classname}.#{name}" + else + warn "Unable to parse classname #{classname.inspect} at #{tc.xpath}" + end end end From 57f1142b8476d8add61695e254e40d3ab2ddad3c Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Sat, 16 Sep 2023 18:07:59 +0200 Subject: [PATCH 113/126] ValidFailRangeFloat: use values with exact representation ... to avoid inaccurracies --- formats/valid_fail_range_float.ksy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/formats/valid_fail_range_float.ksy b/formats/valid_fail_range_float.ksy index f058db5b6..6bcc20723 100644 --- a/formats/valid_fail_range_float.ksy +++ b/formats/valid_fail_range_float.ksy @@ -4,5 +4,5 @@ seq: - id: foo type: f4le valid: - min: 0.2 - max: 0.4 # there is actually 0.5 in the file + min: 0.25 + max: 0.375 # there is actually 0.5 in the file From e92fb336fb2eda17521224ab05ea416f8052828e Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Sat, 23 Sep 2023 10:41:04 +0200 Subject: [PATCH 114/126] Java specwrite: test that _check() uses no IO in ValidFail* tests --- .../specwrite/TestValidFailAnyofInt.java | 37 +++++++++++++++++- .../specwrite/TestValidFailContents.java | 37 +++++++++++++++++- .../specwrite/TestValidFailEqBytes.java | 37 +++++++++++++++++- .../struct/specwrite/TestValidFailEqInt.java | 37 +++++++++++++++++- .../struct/specwrite/TestValidFailEqStr.java | 37 +++++++++++++++++- .../struct/specwrite/TestValidFailExpr.java | 38 +++++++++++++++++- .../struct/specwrite/TestValidFailInst.java | 39 ++++++++++++++++++- .../struct/specwrite/TestValidFailMaxInt.java | 37 +++++++++++++++++- .../struct/specwrite/TestValidFailMinInt.java | 37 +++++++++++++++++- .../specwrite/TestValidFailRangeBytes.java | 37 +++++++++++++++++- .../specwrite/TestValidFailRangeFloat.java | 37 +++++++++++++++++- .../specwrite/TestValidFailRangeInt.java | 37 +++++++++++++++++- .../specwrite/TestValidFailRangeStr.java | 37 +++++++++++++++++- 13 files changed, 458 insertions(+), 26 deletions(-) diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailAnyofInt.java b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailAnyofInt.java index 4ff45ada2..00a3868ae 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailAnyofInt.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailAnyofInt.java @@ -1,11 +1,11 @@ -// Autogenerated from KST: please remove this line if doing any edits by hand! - package io.kaitai.struct.specwrite; +import io.kaitai.struct.KaitaiStream; import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.ValidFailAnyofInt; import org.testng.annotations.Test; import org.testng.SkipException; +import static org.testng.Assert.*; public class TestValidFailAnyofInt extends CommonSpec { @Override @@ -23,4 +23,37 @@ protected String getSrcFilename() { protected void testReadWriteRoundtrip() throws Exception { throw new SkipException("cannot use roundtrip because parsing is expected to fail"); } + + @Test + public void testCheckBadValidNoIo() throws Exception { + ValidFailAnyofInt r = new ValidFailAnyofInt(); + r.setFoo(0x50); + assertCheckValidFail(r); + } + + @Test + public void testCheckBadValidOldIo() throws Exception { + final ValidFailAnyofInt r = ValidFailAnyofInt.fromFile(SRC_DIR + getSrcFilename()); + assertThrows(KaitaiStream.ValidationNotAnyOfError.class, new ThrowingRunnable() { + @Override + public void run() throws Throwable { + r._read(); + } + }); + assertCheckValidFail(r); + } + + private void assertCheckValidFail(final ValidFailAnyofInt r) { + Throwable thr = expectThrows(KaitaiStream.ValidationNotAnyOfError.class, new ThrowingRunnable() { + @Override + public void run() throws Throwable { + r._check(); + } + }); + + // NB: the error message must not contain the "at pos X: " part because + // _check() is not supposed to access `_io` at all (even if it happens + // to be non-`null`, as in this case) + assertEquals(thr.getMessage(), "/seq/0: validation failed: not any of the list, got 80"); + } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailContents.java b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailContents.java index 7527292a8..baf28a4be 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailContents.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailContents.java @@ -1,11 +1,11 @@ -// Autogenerated from KST: please remove this line if doing any edits by hand! - package io.kaitai.struct.specwrite; +import io.kaitai.struct.KaitaiStream; import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.ValidFailContents; import org.testng.annotations.Test; import org.testng.SkipException; +import static org.testng.Assert.*; public class TestValidFailContents extends CommonSpec { @Override @@ -23,4 +23,37 @@ protected String getSrcFilename() { protected void testReadWriteRoundtrip() throws Exception { throw new SkipException("cannot use roundtrip because parsing is expected to fail"); } + + @Test + public void testCheckBadValidNoIo() throws Exception { + ValidFailContents r = new ValidFailContents(); + r.setFoo(new byte[] { 0x50, 0x41 }); + assertCheckValidFail(r); + } + + @Test + public void testCheckBadValidOldIo() throws Exception { + final ValidFailContents r = ValidFailContents.fromFile(SRC_DIR + getSrcFilename()); + assertThrows(KaitaiStream.ValidationNotEqualError.class, new ThrowingRunnable() { + @Override + public void run() throws Throwable { + r._read(); + } + }); + assertCheckValidFail(r); + } + + private void assertCheckValidFail(final ValidFailContents r) { + Throwable thr = expectThrows(KaitaiStream.ValidationNotEqualError.class, new ThrowingRunnable() { + @Override + public void run() throws Throwable { + r._check(); + } + }); + + // NB: the error message must not contain the "at pos X: " part because + // _check() is not supposed to access `_io` at all (even if it happens + // to be non-`null`, as in this case) + assertEquals(thr.getMessage(), "/seq/0: validation failed: not equal, expected [51 41], but got [50 41]"); + } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailEqBytes.java b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailEqBytes.java index 0944a973b..9c84e3526 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailEqBytes.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailEqBytes.java @@ -1,11 +1,11 @@ -// Autogenerated from KST: please remove this line if doing any edits by hand! - package io.kaitai.struct.specwrite; +import io.kaitai.struct.KaitaiStream; import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.ValidFailEqBytes; import org.testng.annotations.Test; import org.testng.SkipException; +import static org.testng.Assert.*; public class TestValidFailEqBytes extends CommonSpec { @Override @@ -23,4 +23,37 @@ protected String getSrcFilename() { protected void testReadWriteRoundtrip() throws Exception { throw new SkipException("cannot use roundtrip because parsing is expected to fail"); } + + @Test + public void testCheckBadValidNoIo() throws Exception { + ValidFailEqBytes r = new ValidFailEqBytes(); + r.setFoo(new byte[] { 0x50, 0x41 }); + assertCheckValidFail(r); + } + + @Test + public void testCheckBadValidOldIo() throws Exception { + final ValidFailEqBytes r = ValidFailEqBytes.fromFile(SRC_DIR + getSrcFilename()); + assertThrows(KaitaiStream.ValidationNotEqualError.class, new ThrowingRunnable() { + @Override + public void run() throws Throwable { + r._read(); + } + }); + assertCheckValidFail(r); + } + + private void assertCheckValidFail(final ValidFailEqBytes r) { + Throwable thr = expectThrows(KaitaiStream.ValidationNotEqualError.class, new ThrowingRunnable() { + @Override + public void run() throws Throwable { + r._check(); + } + }); + + // NB: the error message must not contain the "at pos X: " part because + // _check() is not supposed to access `_io` at all (even if it happens + // to be non-`null`, as in this case) + assertEquals(thr.getMessage(), "/seq/0: validation failed: not equal, expected [51 41], but got [50 41]"); + } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailEqInt.java b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailEqInt.java index d91cb5d46..8a380c6c6 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailEqInt.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailEqInt.java @@ -1,11 +1,11 @@ -// Autogenerated from KST: please remove this line if doing any edits by hand! - package io.kaitai.struct.specwrite; +import io.kaitai.struct.KaitaiStream; import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.ValidFailEqInt; import org.testng.annotations.Test; import org.testng.SkipException; +import static org.testng.Assert.*; public class TestValidFailEqInt extends CommonSpec { @Override @@ -23,4 +23,37 @@ protected String getSrcFilename() { protected void testReadWriteRoundtrip() throws Exception { throw new SkipException("cannot use roundtrip because parsing is expected to fail"); } + + @Test + public void testCheckBadValidNoIo() throws Exception { + ValidFailEqInt r = new ValidFailEqInt(); + r.setFoo(0x50); + assertCheckValidFail(r); + } + + @Test + public void testCheckBadValidOldIo() throws Exception { + final ValidFailEqInt r = ValidFailEqInt.fromFile(SRC_DIR + getSrcFilename()); + assertThrows(KaitaiStream.ValidationNotEqualError.class, new ThrowingRunnable() { + @Override + public void run() throws Throwable { + r._read(); + } + }); + assertCheckValidFail(r); + } + + private void assertCheckValidFail(final ValidFailEqInt r) { + Throwable thr = expectThrows(KaitaiStream.ValidationNotEqualError.class, new ThrowingRunnable() { + @Override + public void run() throws Throwable { + r._check(); + } + }); + + // NB: the error message must not contain the "at pos X: " part because + // _check() is not supposed to access `_io` at all (even if it happens + // to be non-`null`, as in this case) + assertEquals(thr.getMessage(), "/seq/0: validation failed: not equal, expected 123, but got 80"); + } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailEqStr.java b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailEqStr.java index 39bae4e0e..270885bee 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailEqStr.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailEqStr.java @@ -1,11 +1,11 @@ -// Autogenerated from KST: please remove this line if doing any edits by hand! - package io.kaitai.struct.specwrite; +import io.kaitai.struct.KaitaiStream; import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.ValidFailEqStr; import org.testng.annotations.Test; import org.testng.SkipException; +import static org.testng.Assert.*; public class TestValidFailEqStr extends CommonSpec { @Override @@ -23,4 +23,37 @@ protected String getSrcFilename() { protected void testReadWriteRoundtrip() throws Exception { throw new SkipException("cannot use roundtrip because parsing is expected to fail"); } + + @Test + public void testCheckBadValidNoIo() throws Exception { + ValidFailEqStr r = new ValidFailEqStr(); + r.setFoo("PACK"); + assertCheckValidFail(r); + } + + @Test + public void testCheckBadValidOldIo() throws Exception { + final ValidFailEqStr r = ValidFailEqStr.fromFile(SRC_DIR + getSrcFilename()); + assertThrows(KaitaiStream.ValidationNotEqualError.class, new ThrowingRunnable() { + @Override + public void run() throws Throwable { + r._read(); + } + }); + assertCheckValidFail(r); + } + + private void assertCheckValidFail(final ValidFailEqStr r) { + Throwable thr = expectThrows(KaitaiStream.ValidationNotEqualError.class, new ThrowingRunnable() { + @Override + public void run() throws Throwable { + r._check(); + } + }); + + // NB: the error message must not contain the "at pos X: " part because + // _check() is not supposed to access `_io` at all (even if it happens + // to be non-`null`, as in this case) + assertEquals(thr.getMessage(), "/seq/0: validation failed: not equal, expected BACK, but got PACK"); + } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailExpr.java b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailExpr.java index 4d46e39f1..343666169 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailExpr.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailExpr.java @@ -1,11 +1,11 @@ -// Autogenerated from KST: please remove this line if doing any edits by hand! - package io.kaitai.struct.specwrite; +import io.kaitai.struct.KaitaiStream; import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.ValidFailExpr; import org.testng.annotations.Test; import org.testng.SkipException; +import static org.testng.Assert.*; public class TestValidFailExpr extends CommonSpec { @Override @@ -23,4 +23,38 @@ protected String getSrcFilename() { protected void testReadWriteRoundtrip() throws Exception { throw new SkipException("cannot use roundtrip because parsing is expected to fail"); } + + @Test + public void testCheckBadValidNoIo() throws Exception { + ValidFailExpr r = new ValidFailExpr(); + r.setFoo(1); + r.setBar((short) -190); + assertCheckValidFail(r); + } + + @Test + public void testCheckBadValidOldIo() throws Exception { + final ValidFailExpr r = ValidFailExpr.fromFile(SRC_DIR + getSrcFilename()); + assertThrows(KaitaiStream.ValidationExprError.class, new ThrowingRunnable() { + @Override + public void run() throws Throwable { + r._read(); + } + }); + assertCheckValidFail(r); + } + + private void assertCheckValidFail(final ValidFailExpr r) { + Throwable thr = expectThrows(KaitaiStream.ValidationExprError.class, new ThrowingRunnable() { + @Override + public void run() throws Throwable { + r._check(); + } + }); + + // NB: the error message must not contain the "at pos X: " part because + // _check() is not supposed to access `_io` at all (even if it happens + // to be non-`null`, as in this case) + assertEquals(thr.getMessage(), "/seq/1: validation failed: not matching the expression, got -190"); + } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailInst.java b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailInst.java index 19edd82d2..563d42129 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailInst.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailInst.java @@ -1,11 +1,11 @@ -// Autogenerated from KST: please remove this line if doing any edits by hand! - package io.kaitai.struct.specwrite; +import io.kaitai.struct.KaitaiStream; import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.ValidFailInst; import org.testng.annotations.Test; import org.testng.SkipException; +import static org.testng.Assert.*; public class TestValidFailInst extends CommonSpec { @Override @@ -23,4 +23,39 @@ protected String getSrcFilename() { protected void testReadWriteRoundtrip() throws Exception { throw new SkipException("cannot use roundtrip because parsing is expected to fail"); } + + @Test + public void testCheckBadValidNoIo() throws Exception { + ValidFailInst r = new ValidFailInst(); + r.setA(0x50); + r.setInst(0x31); + assertCheckValidFail(r); + } + + @Test + public void testCheckBadValidOldIo() throws Exception { + final ValidFailInst r = ValidFailInst.fromFile(SRC_DIR + getSrcFilename()); + assertThrows(KaitaiStream.ValidationNotEqualError.class, new ThrowingRunnable() { + @Override + public void run() throws Throwable { + r._read(); + } + }); + assertCheckValidFail(r); + } + + private void assertCheckValidFail(final ValidFailInst r) { + Throwable thr = expectThrows(KaitaiStream.ValidationNotEqualError.class, new ThrowingRunnable() { + @Override + public void run() throws Throwable { + r._checkInst(); + } + }); + r._check(); + + // NB: the error message must not contain the "at pos X: " part because + // _check() is not supposed to access `_io` at all (even if it happens + // to be non-`null`, as in this case) + assertEquals(thr.getMessage(), "/instances/inst: validation failed: not equal, expected 80, but got 49"); + } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailMaxInt.java b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailMaxInt.java index 8fdd4965d..f0da3be61 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailMaxInt.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailMaxInt.java @@ -1,11 +1,11 @@ -// Autogenerated from KST: please remove this line if doing any edits by hand! - package io.kaitai.struct.specwrite; +import io.kaitai.struct.KaitaiStream; import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.ValidFailMaxInt; import org.testng.annotations.Test; import org.testng.SkipException; +import static org.testng.Assert.*; public class TestValidFailMaxInt extends CommonSpec { @Override @@ -23,4 +23,37 @@ protected String getSrcFilename() { protected void testReadWriteRoundtrip() throws Exception { throw new SkipException("cannot use roundtrip because parsing is expected to fail"); } + + @Test + public void testCheckBadValidNoIo() throws Exception { + ValidFailMaxInt r = new ValidFailMaxInt(); + r.setFoo(0x50); + assertCheckValidFail(r); + } + + @Test + public void testCheckBadValidOldIo() throws Exception { + final ValidFailMaxInt r = ValidFailMaxInt.fromFile(SRC_DIR + getSrcFilename()); + assertThrows(KaitaiStream.ValidationGreaterThanError.class, new ThrowingRunnable() { + @Override + public void run() throws Throwable { + r._read(); + } + }); + assertCheckValidFail(r); + } + + private void assertCheckValidFail(final ValidFailMaxInt r) { + Throwable thr = expectThrows(KaitaiStream.ValidationGreaterThanError.class, new ThrowingRunnable() { + @Override + public void run() throws Throwable { + r._check(); + } + }); + + // NB: the error message must not contain the "at pos X: " part because + // _check() is not supposed to access `_io` at all (even if it happens + // to be non-`null`, as in this case) + assertEquals(thr.getMessage(), "/seq/0: validation failed: not in range, max 12, but got 80"); + } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailMinInt.java b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailMinInt.java index 303122a4e..eca836cfa 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailMinInt.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailMinInt.java @@ -1,11 +1,11 @@ -// Autogenerated from KST: please remove this line if doing any edits by hand! - package io.kaitai.struct.specwrite; +import io.kaitai.struct.KaitaiStream; import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.ValidFailMinInt; import org.testng.annotations.Test; import org.testng.SkipException; +import static org.testng.Assert.*; public class TestValidFailMinInt extends CommonSpec { @Override @@ -23,4 +23,37 @@ protected String getSrcFilename() { protected void testReadWriteRoundtrip() throws Exception { throw new SkipException("cannot use roundtrip because parsing is expected to fail"); } + + @Test + public void testCheckBadValidNoIo() throws Exception { + ValidFailMinInt r = new ValidFailMinInt(); + r.setFoo(0x50); + assertCheckValidFail(r); + } + + @Test + public void testCheckBadValidOldIo() throws Exception { + final ValidFailMinInt r = ValidFailMinInt.fromFile(SRC_DIR + getSrcFilename()); + assertThrows(KaitaiStream.ValidationLessThanError.class, new ThrowingRunnable() { + @Override + public void run() throws Throwable { + r._read(); + } + }); + assertCheckValidFail(r); + } + + private void assertCheckValidFail(final ValidFailMinInt r) { + Throwable thr = expectThrows(KaitaiStream.ValidationLessThanError.class, new ThrowingRunnable() { + @Override + public void run() throws Throwable { + r._check(); + } + }); + + // NB: the error message must not contain the "at pos X: " part because + // _check() is not supposed to access `_io` at all (even if it happens + // to be non-`null`, as in this case) + assertEquals(thr.getMessage(), "/seq/0: validation failed: not in range, min 123, but got 80"); + } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailRangeBytes.java b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailRangeBytes.java index 119bfbe92..47f8c7031 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailRangeBytes.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailRangeBytes.java @@ -1,11 +1,11 @@ -// Autogenerated from KST: please remove this line if doing any edits by hand! - package io.kaitai.struct.specwrite; +import io.kaitai.struct.KaitaiStream; import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.ValidFailRangeBytes; import org.testng.annotations.Test; import org.testng.SkipException; +import static org.testng.Assert.*; public class TestValidFailRangeBytes extends CommonSpec { @Override @@ -23,4 +23,37 @@ protected String getSrcFilename() { protected void testReadWriteRoundtrip() throws Exception { throw new SkipException("cannot use roundtrip because parsing is expected to fail"); } + + @Test + public void testCheckBadValidNoIo() throws Exception { + ValidFailRangeBytes r = new ValidFailRangeBytes(); + r.setFoo(new byte[] { 80, 65 }); + assertCheckValidFail(r); + } + + @Test + public void testCheckBadValidOldIo() throws Exception { + final ValidFailRangeBytes r = ValidFailRangeBytes.fromFile(SRC_DIR + getSrcFilename()); + assertThrows(KaitaiStream.ValidationGreaterThanError.class, new ThrowingRunnable() { + @Override + public void run() throws Throwable { + r._read(); + } + }); + assertCheckValidFail(r); + } + + private void assertCheckValidFail(final ValidFailRangeBytes r) { + Throwable thr = expectThrows(KaitaiStream.ValidationGreaterThanError.class, new ThrowingRunnable() { + @Override + public void run() throws Throwable { + r._check(); + } + }); + + // NB: the error message must not contain the "at pos X: " part because + // _check() is not supposed to access `_io` at all (even if it happens + // to be non-`null`, as in this case) + assertEquals(thr.getMessage(), "/seq/0: validation failed: not in range, max [50 31], but got [50 41]"); + } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailRangeFloat.java b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailRangeFloat.java index ea873c39e..f9df34d18 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailRangeFloat.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailRangeFloat.java @@ -1,11 +1,11 @@ -// Autogenerated from KST: please remove this line if doing any edits by hand! - package io.kaitai.struct.specwrite; +import io.kaitai.struct.KaitaiStream; import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.ValidFailRangeFloat; import org.testng.annotations.Test; import org.testng.SkipException; +import static org.testng.Assert.*; public class TestValidFailRangeFloat extends CommonSpec { @Override @@ -23,4 +23,37 @@ protected String getSrcFilename() { protected void testReadWriteRoundtrip() throws Exception { throw new SkipException("cannot use roundtrip because parsing is expected to fail"); } + + @Test + public void testCheckBadValidNoIo() throws Exception { + ValidFailRangeFloat r = new ValidFailRangeFloat(); + r.setFoo(0.5f); + assertCheckValidFail(r); + } + + @Test + public void testCheckBadValidOldIo() throws Exception { + final ValidFailRangeFloat r = ValidFailRangeFloat.fromFile(SRC_DIR + getSrcFilename()); + assertThrows(KaitaiStream.ValidationGreaterThanError.class, new ThrowingRunnable() { + @Override + public void run() throws Throwable { + r._read(); + } + }); + assertCheckValidFail(r); + } + + private void assertCheckValidFail(final ValidFailRangeFloat r) { + Throwable thr = expectThrows(KaitaiStream.ValidationGreaterThanError.class, new ThrowingRunnable() { + @Override + public void run() throws Throwable { + r._check(); + } + }); + + // NB: the error message must not contain the "at pos X: " part because + // _check() is not supposed to access `_io` at all (even if it happens + // to be non-`null`, as in this case) + assertEquals(thr.getMessage(), "/seq/0: validation failed: not in range, max 0.375, but got 0.5"); + } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailRangeInt.java b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailRangeInt.java index bb7b77551..35b7328f0 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailRangeInt.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailRangeInt.java @@ -1,11 +1,11 @@ -// Autogenerated from KST: please remove this line if doing any edits by hand! - package io.kaitai.struct.specwrite; +import io.kaitai.struct.KaitaiStream; import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.ValidFailRangeInt; import org.testng.annotations.Test; import org.testng.SkipException; +import static org.testng.Assert.*; public class TestValidFailRangeInt extends CommonSpec { @Override @@ -23,4 +23,37 @@ protected String getSrcFilename() { protected void testReadWriteRoundtrip() throws Exception { throw new SkipException("cannot use roundtrip because parsing is expected to fail"); } + + @Test + public void testCheckBadValidNoIo() throws Exception { + ValidFailRangeInt r = new ValidFailRangeInt(); + r.setFoo(80); + assertCheckValidFail(r); + } + + @Test + public void testCheckBadValidOldIo() throws Exception { + final ValidFailRangeInt r = ValidFailRangeInt.fromFile(SRC_DIR + getSrcFilename()); + assertThrows(KaitaiStream.ValidationGreaterThanError.class, new ThrowingRunnable() { + @Override + public void run() throws Throwable { + r._read(); + } + }); + assertCheckValidFail(r); + } + + private void assertCheckValidFail(final ValidFailRangeInt r) { + Throwable thr = expectThrows(KaitaiStream.ValidationGreaterThanError.class, new ThrowingRunnable() { + @Override + public void run() throws Throwable { + r._check(); + } + }); + + // NB: the error message must not contain the "at pos X: " part because + // _check() is not supposed to access `_io` at all (even if it happens + // to be non-`null`, as in this case) + assertEquals(thr.getMessage(), "/seq/0: validation failed: not in range, max 10, but got 80"); + } } diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailRangeStr.java b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailRangeStr.java index cc708d1c4..00dd87c93 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestValidFailRangeStr.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestValidFailRangeStr.java @@ -1,11 +1,11 @@ -// Autogenerated from KST: please remove this line if doing any edits by hand! - package io.kaitai.struct.specwrite; +import io.kaitai.struct.KaitaiStream; import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.ValidFailRangeStr; import org.testng.annotations.Test; import org.testng.SkipException; +import static org.testng.Assert.*; public class TestValidFailRangeStr extends CommonSpec { @Override @@ -23,4 +23,37 @@ protected String getSrcFilename() { protected void testReadWriteRoundtrip() throws Exception { throw new SkipException("cannot use roundtrip because parsing is expected to fail"); } + + @Test + public void testCheckBadValidNoIo() throws Exception { + ValidFailRangeStr r = new ValidFailRangeStr(); + r.setFoo("PA"); + assertCheckValidFail(r); + } + + @Test + public void testCheckBadValidOldIo() throws Exception { + final ValidFailRangeStr r = ValidFailRangeStr.fromFile(SRC_DIR + getSrcFilename()); + assertThrows(KaitaiStream.ValidationGreaterThanError.class, new ThrowingRunnable() { + @Override + public void run() throws Throwable { + r._read(); + } + }); + assertCheckValidFail(r); + } + + private void assertCheckValidFail(final ValidFailRangeStr r) { + Throwable thr = expectThrows(KaitaiStream.ValidationGreaterThanError.class, new ThrowingRunnable() { + @Override + public void run() throws Throwable { + r._check(); + } + }); + + // NB: the error message must not contain the "at pos X: " part because + // _check() is not supposed to access `_io` at all (even if it happens + // to be non-`null`, as in this case) + assertEquals(thr.getMessage(), "/seq/0: validation failed: not in range, max P1, but got PA"); + } } From e7869f0ce9a1bd9dc58f5523366615fe9e1fbbc8 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Sun, 24 Sep 2023 00:43:09 +0200 Subject: [PATCH 115/126] Port tests for _check() not using IO from Java to Python See previous commit e92fb336fb2eda17521224ab05ea416f8052828e --- .../specwrite/test_valid_fail_anyof_int.py | 23 +++++++++++++++-- .../specwrite/test_valid_fail_contents.py | 23 +++++++++++++++-- .../specwrite/test_valid_fail_eq_bytes.py | 23 +++++++++++++++-- .../specwrite/test_valid_fail_eq_int.py | 23 +++++++++++++++-- .../specwrite/test_valid_fail_eq_str.py | 23 +++++++++++++++-- spec/python/specwrite/test_valid_fail_expr.py | 24 ++++++++++++++++-- spec/python/specwrite/test_valid_fail_inst.py | 25 +++++++++++++++++-- .../specwrite/test_valid_fail_max_int.py | 23 +++++++++++++++-- .../specwrite/test_valid_fail_min_int.py | 23 +++++++++++++++-- .../specwrite/test_valid_fail_range_bytes.py | 23 +++++++++++++++-- .../specwrite/test_valid_fail_range_float.py | 23 +++++++++++++++-- .../specwrite/test_valid_fail_range_int.py | 23 +++++++++++++++-- .../specwrite/test_valid_fail_range_str.py | 23 +++++++++++++++-- 13 files changed, 276 insertions(+), 26 deletions(-) diff --git a/spec/python/specwrite/test_valid_fail_anyof_int.py b/spec/python/specwrite/test_valid_fail_anyof_int.py index 2c3ea0339..ca38af69c 100644 --- a/spec/python/specwrite/test_valid_fail_anyof_int.py +++ b/spec/python/specwrite/test_valid_fail_anyof_int.py @@ -1,6 +1,5 @@ -# Autogenerated from KST: please remove this line if doing any edits by hand! - import unittest +import kaitaistruct from specwrite.common_spec import CommonSpec from testwrite.valid_fail_anyof_int import ValidFailAnyofInt @@ -13,3 +12,23 @@ def __init__(self, *args, **kwargs): def test_read_write_roundtrip(self): self.skipTest("cannot use roundtrip because parsing is expected to fail") + + def test_check_bad_valid_no_io(self): + r = ValidFailAnyofInt() + r.foo = 0x50 + self.assert_check_valid_fail(r) + + def test_check_bad_valid_old_io(self): + r = ValidFailAnyofInt.from_file(self.src_filename) + with self.assertRaises(kaitaistruct.ValidationNotAnyOfError): + r._read() + self.assert_check_valid_fail(r) + + def assert_check_valid_fail(self, r): + with self.assertRaises(kaitaistruct.ValidationNotAnyOfError) as cm: + r._check() + + # NB: the error message must not contain the "at pos X: " part because + # _check() is not supposed to access `_io` at all (even if it happens + # to be non-`null`, as in this case) + self.assertEqual(str(cm.exception), "/seq/0: validation failed: not any of the list, got 80") diff --git a/spec/python/specwrite/test_valid_fail_contents.py b/spec/python/specwrite/test_valid_fail_contents.py index a9b3bf330..dc08d31e0 100644 --- a/spec/python/specwrite/test_valid_fail_contents.py +++ b/spec/python/specwrite/test_valid_fail_contents.py @@ -1,6 +1,5 @@ -# Autogenerated from KST: please remove this line if doing any edits by hand! - import unittest +import kaitaistruct from specwrite.common_spec import CommonSpec from testwrite.valid_fail_contents import ValidFailContents @@ -13,3 +12,23 @@ def __init__(self, *args, **kwargs): def test_read_write_roundtrip(self): self.skipTest("cannot use roundtrip because parsing is expected to fail") + + def test_check_bad_valid_no_io(self): + r = ValidFailContents() + r.foo = b"\x50\x41" + self.assert_check_valid_fail(r) + + def test_check_bad_valid_old_io(self): + r = ValidFailContents.from_file(self.src_filename) + with self.assertRaises(kaitaistruct.ValidationNotEqualError): + r._read() + self.assert_check_valid_fail(r) + + def assert_check_valid_fail(self, r): + with self.assertRaises(kaitaistruct.ValidationNotEqualError) as cm: + r._check() + + # NB: the error message must not contain the "at pos X: " part because + # _check() is not supposed to access `_io` at all (even if it happens + # to be non-`null`, as in this case) + self.assertEqual(str(cm.exception), "/seq/0: validation failed: not equal, expected b'QA', but got b'PA'") diff --git a/spec/python/specwrite/test_valid_fail_eq_bytes.py b/spec/python/specwrite/test_valid_fail_eq_bytes.py index 1d47d14be..44bb47959 100644 --- a/spec/python/specwrite/test_valid_fail_eq_bytes.py +++ b/spec/python/specwrite/test_valid_fail_eq_bytes.py @@ -1,6 +1,5 @@ -# Autogenerated from KST: please remove this line if doing any edits by hand! - import unittest +import kaitaistruct from specwrite.common_spec import CommonSpec from testwrite.valid_fail_eq_bytes import ValidFailEqBytes @@ -13,3 +12,23 @@ def __init__(self, *args, **kwargs): def test_read_write_roundtrip(self): self.skipTest("cannot use roundtrip because parsing is expected to fail") + + def test_check_bad_valid_no_io(self): + r = ValidFailEqBytes() + r.foo = b"\x50\x41" + self.assert_check_valid_fail(r) + + def test_check_bad_valid_old_io(self): + r = ValidFailEqBytes.from_file(self.src_filename) + with self.assertRaises(kaitaistruct.ValidationNotEqualError): + r._read() + self.assert_check_valid_fail(r) + + def assert_check_valid_fail(self, r): + with self.assertRaises(kaitaistruct.ValidationNotEqualError) as cm: + r._check() + + # NB: the error message must not contain the "at pos X: " part because + # _check() is not supposed to access `_io` at all (even if it happens + # to be non-`null`, as in this case) + self.assertEqual(str(cm.exception), "/seq/0: validation failed: not equal, expected b'QA', but got b'PA'") diff --git a/spec/python/specwrite/test_valid_fail_eq_int.py b/spec/python/specwrite/test_valid_fail_eq_int.py index 465243ff1..c8e9d6cb0 100644 --- a/spec/python/specwrite/test_valid_fail_eq_int.py +++ b/spec/python/specwrite/test_valid_fail_eq_int.py @@ -1,6 +1,5 @@ -# Autogenerated from KST: please remove this line if doing any edits by hand! - import unittest +import kaitaistruct from specwrite.common_spec import CommonSpec from testwrite.valid_fail_eq_int import ValidFailEqInt @@ -13,3 +12,23 @@ def __init__(self, *args, **kwargs): def test_read_write_roundtrip(self): self.skipTest("cannot use roundtrip because parsing is expected to fail") + + def test_check_bad_valid_no_io(self): + r = ValidFailEqInt() + r.foo = 0x50 + self.assert_check_valid_fail(r) + + def test_check_bad_valid_old_io(self): + r = ValidFailEqInt.from_file(self.src_filename) + with self.assertRaises(kaitaistruct.ValidationNotEqualError): + r._read() + self.assert_check_valid_fail(r) + + def assert_check_valid_fail(self, r): + with self.assertRaises(kaitaistruct.ValidationNotEqualError) as cm: + r._check() + + # NB: the error message must not contain the "at pos X: " part because + # _check() is not supposed to access `_io` at all (even if it happens + # to be non-`null`, as in this case) + self.assertEqual(str(cm.exception), "/seq/0: validation failed: not equal, expected 123, but got 80") diff --git a/spec/python/specwrite/test_valid_fail_eq_str.py b/spec/python/specwrite/test_valid_fail_eq_str.py index 0c781ce4a..067d83a04 100644 --- a/spec/python/specwrite/test_valid_fail_eq_str.py +++ b/spec/python/specwrite/test_valid_fail_eq_str.py @@ -1,6 +1,5 @@ -# Autogenerated from KST: please remove this line if doing any edits by hand! - import unittest +import kaitaistruct from specwrite.common_spec import CommonSpec from testwrite.valid_fail_eq_str import ValidFailEqStr @@ -13,3 +12,23 @@ def __init__(self, *args, **kwargs): def test_read_write_roundtrip(self): self.skipTest("cannot use roundtrip because parsing is expected to fail") + + def test_check_bad_valid_no_io(self): + r = ValidFailEqStr() + r.foo = u"PACK" + self.assert_check_valid_fail(r) + + def test_check_bad_valid_old_io(self): + r = ValidFailEqStr.from_file(self.src_filename) + with self.assertRaises(kaitaistruct.ValidationNotEqualError): + r._read() + self.assert_check_valid_fail(r) + + def assert_check_valid_fail(self, r): + with self.assertRaises(kaitaistruct.ValidationNotEqualError) as cm: + r._check() + + # NB: the error message must not contain the "at pos X: " part because + # _check() is not supposed to access `_io` at all (even if it happens + # to be non-`null`, as in this case) + self.assertEqual(str(cm.exception), "/seq/0: validation failed: not equal, expected 'BACK', but got 'PACK'") diff --git a/spec/python/specwrite/test_valid_fail_expr.py b/spec/python/specwrite/test_valid_fail_expr.py index 1786cc74a..5e240034c 100644 --- a/spec/python/specwrite/test_valid_fail_expr.py +++ b/spec/python/specwrite/test_valid_fail_expr.py @@ -1,6 +1,5 @@ -# Autogenerated from KST: please remove this line if doing any edits by hand! - import unittest +import kaitaistruct from specwrite.common_spec import CommonSpec from testwrite.valid_fail_expr import ValidFailExpr @@ -13,3 +12,24 @@ def __init__(self, *args, **kwargs): def test_read_write_roundtrip(self): self.skipTest("cannot use roundtrip because parsing is expected to fail") + + def test_check_bad_valid_no_io(self): + r = ValidFailExpr() + r.foo = 1 + r.bar = -190 + self.assert_check_valid_fail(r) + + def test_check_bad_valid_old_io(self): + r = ValidFailExpr.from_file(self.src_filename) + with self.assertRaises(kaitaistruct.ValidationExprError): + r._read() + self.assert_check_valid_fail(r) + + def assert_check_valid_fail(self, r): + with self.assertRaises(kaitaistruct.ValidationExprError) as cm: + r._check() + + # NB: the error message must not contain the "at pos X: " part because + # _check() is not supposed to access `_io` at all (even if it happens + # to be non-`null`, as in this case) + self.assertEqual(str(cm.exception), "/seq/1: validation failed: not matching the expression, got -190") diff --git a/spec/python/specwrite/test_valid_fail_inst.py b/spec/python/specwrite/test_valid_fail_inst.py index ef5b9ff52..167dcfa65 100644 --- a/spec/python/specwrite/test_valid_fail_inst.py +++ b/spec/python/specwrite/test_valid_fail_inst.py @@ -1,6 +1,5 @@ -# Autogenerated from KST: please remove this line if doing any edits by hand! - import unittest +import kaitaistruct from specwrite.common_spec import CommonSpec from testwrite.valid_fail_inst import ValidFailInst @@ -13,3 +12,25 @@ def __init__(self, *args, **kwargs): def test_read_write_roundtrip(self): self.skipTest("cannot use roundtrip because parsing is expected to fail") + + def test_check_bad_valid_no_io(self): + r = ValidFailInst() + r.a = 0x50 + r.inst = 0x31 + self.assert_check_valid_fail(r) + + def test_check_bad_valid_old_io(self): + r = ValidFailInst.from_file(self.src_filename) + with self.assertRaises(kaitaistruct.ValidationNotEqualError): + r._read() + self.assert_check_valid_fail(r) + + def assert_check_valid_fail(self, r): + with self.assertRaises(kaitaistruct.ValidationNotEqualError) as cm: + r._check_inst() + r._check() + + # NB: the error message must not contain the "at pos X: " part because + # _check() is not supposed to access `_io` at all (even if it happens + # to be non-`null`, as in this case) + self.assertEqual(str(cm.exception), "/instances/inst: validation failed: not equal, expected 80, but got 49") diff --git a/spec/python/specwrite/test_valid_fail_max_int.py b/spec/python/specwrite/test_valid_fail_max_int.py index ecd3d25fe..859d9a564 100644 --- a/spec/python/specwrite/test_valid_fail_max_int.py +++ b/spec/python/specwrite/test_valid_fail_max_int.py @@ -1,6 +1,5 @@ -# Autogenerated from KST: please remove this line if doing any edits by hand! - import unittest +import kaitaistruct from specwrite.common_spec import CommonSpec from testwrite.valid_fail_max_int import ValidFailMaxInt @@ -13,3 +12,23 @@ def __init__(self, *args, **kwargs): def test_read_write_roundtrip(self): self.skipTest("cannot use roundtrip because parsing is expected to fail") + + def test_check_bad_valid_no_io(self): + r = ValidFailMaxInt() + r.foo = 0x50 + self.assert_check_valid_fail(r) + + def test_check_bad_valid_old_io(self): + r = ValidFailMaxInt.from_file(self.src_filename) + with self.assertRaises(kaitaistruct.ValidationGreaterThanError): + r._read() + self.assert_check_valid_fail(r) + + def assert_check_valid_fail(self, r): + with self.assertRaises(kaitaistruct.ValidationGreaterThanError) as cm: + r._check() + + # NB: the error message must not contain the "at pos X: " part because + # _check() is not supposed to access `_io` at all (even if it happens + # to be non-`null`, as in this case) + self.assertEqual(str(cm.exception), "/seq/0: validation failed: not in range, max 12, but got 80") diff --git a/spec/python/specwrite/test_valid_fail_min_int.py b/spec/python/specwrite/test_valid_fail_min_int.py index 9e607db12..e39b824d5 100644 --- a/spec/python/specwrite/test_valid_fail_min_int.py +++ b/spec/python/specwrite/test_valid_fail_min_int.py @@ -1,6 +1,5 @@ -# Autogenerated from KST: please remove this line if doing any edits by hand! - import unittest +import kaitaistruct from specwrite.common_spec import CommonSpec from testwrite.valid_fail_min_int import ValidFailMinInt @@ -13,3 +12,23 @@ def __init__(self, *args, **kwargs): def test_read_write_roundtrip(self): self.skipTest("cannot use roundtrip because parsing is expected to fail") + + def test_check_bad_valid_no_io(self): + r = ValidFailMinInt() + r.foo = 0x50 + self.assert_check_valid_fail(r) + + def test_check_bad_valid_old_io(self): + r = ValidFailMinInt.from_file(self.src_filename) + with self.assertRaises(kaitaistruct.ValidationLessThanError): + r._read() + self.assert_check_valid_fail(r) + + def assert_check_valid_fail(self, r): + with self.assertRaises(kaitaistruct.ValidationLessThanError) as cm: + r._check() + + # NB: the error message must not contain the "at pos X: " part because + # _check() is not supposed to access `_io` at all (even if it happens + # to be non-`null`, as in this case) + self.assertEqual(str(cm.exception), "/seq/0: validation failed: not in range, min 123, but got 80") diff --git a/spec/python/specwrite/test_valid_fail_range_bytes.py b/spec/python/specwrite/test_valid_fail_range_bytes.py index c3c3f94d4..111550549 100644 --- a/spec/python/specwrite/test_valid_fail_range_bytes.py +++ b/spec/python/specwrite/test_valid_fail_range_bytes.py @@ -1,6 +1,5 @@ -# Autogenerated from KST: please remove this line if doing any edits by hand! - import unittest +import kaitaistruct from specwrite.common_spec import CommonSpec from testwrite.valid_fail_range_bytes import ValidFailRangeBytes @@ -13,3 +12,23 @@ def __init__(self, *args, **kwargs): def test_read_write_roundtrip(self): self.skipTest("cannot use roundtrip because parsing is expected to fail") + + def test_check_bad_valid_no_io(self): + r = ValidFailRangeBytes() + r.foo = b"\x50\x41" + self.assert_check_valid_fail(r) + + def test_check_bad_valid_old_io(self): + r = ValidFailRangeBytes.from_file(self.src_filename) + with self.assertRaises(kaitaistruct.ValidationGreaterThanError): + r._read() + self.assert_check_valid_fail(r) + + def assert_check_valid_fail(self, r): + with self.assertRaises(kaitaistruct.ValidationGreaterThanError) as cm: + r._check() + + # NB: the error message must not contain the "at pos X: " part because + # _check() is not supposed to access `_io` at all (even if it happens + # to be non-`null`, as in this case) + self.assertEqual(str(cm.exception), "/seq/0: validation failed: not in range, max b'P1', but got b'PA'") diff --git a/spec/python/specwrite/test_valid_fail_range_float.py b/spec/python/specwrite/test_valid_fail_range_float.py index 644646ccd..bcba3c8d5 100644 --- a/spec/python/specwrite/test_valid_fail_range_float.py +++ b/spec/python/specwrite/test_valid_fail_range_float.py @@ -1,6 +1,5 @@ -# Autogenerated from KST: please remove this line if doing any edits by hand! - import unittest +import kaitaistruct from specwrite.common_spec import CommonSpec from testwrite.valid_fail_range_float import ValidFailRangeFloat @@ -13,3 +12,23 @@ def __init__(self, *args, **kwargs): def test_read_write_roundtrip(self): self.skipTest("cannot use roundtrip because parsing is expected to fail") + + def test_check_bad_valid_no_io(self): + r = ValidFailRangeFloat() + r.foo = 0.5 + self.assert_check_valid_fail(r) + + def test_check_bad_valid_old_io(self): + r = ValidFailRangeFloat.from_file(self.src_filename) + with self.assertRaises(kaitaistruct.ValidationGreaterThanError): + r._read() + self.assert_check_valid_fail(r) + + def assert_check_valid_fail(self, r): + with self.assertRaises(kaitaistruct.ValidationGreaterThanError) as cm: + r._check() + + # NB: the error message must not contain the "at pos X: " part because + # _check() is not supposed to access `_io` at all (even if it happens + # to be non-`null`, as in this case) + self.assertEqual(str(cm.exception), "/seq/0: validation failed: not in range, max 0.375, but got 0.5") diff --git a/spec/python/specwrite/test_valid_fail_range_int.py b/spec/python/specwrite/test_valid_fail_range_int.py index 86c2c40ee..46e70eabd 100644 --- a/spec/python/specwrite/test_valid_fail_range_int.py +++ b/spec/python/specwrite/test_valid_fail_range_int.py @@ -1,6 +1,5 @@ -# Autogenerated from KST: please remove this line if doing any edits by hand! - import unittest +import kaitaistruct from specwrite.common_spec import CommonSpec from testwrite.valid_fail_range_int import ValidFailRangeInt @@ -13,3 +12,23 @@ def __init__(self, *args, **kwargs): def test_read_write_roundtrip(self): self.skipTest("cannot use roundtrip because parsing is expected to fail") + + def test_check_bad_valid_no_io(self): + r = ValidFailRangeInt() + r.foo = 80 + self.assert_check_valid_fail(r) + + def test_check_bad_valid_old_io(self): + r = ValidFailRangeInt.from_file(self.src_filename) + with self.assertRaises(kaitaistruct.ValidationGreaterThanError): + r._read() + self.assert_check_valid_fail(r) + + def assert_check_valid_fail(self, r): + with self.assertRaises(kaitaistruct.ValidationGreaterThanError) as cm: + r._check() + + # NB: the error message must not contain the "at pos X: " part because + # _check() is not supposed to access `_io` at all (even if it happens + # to be non-`null`, as in this case) + self.assertEqual(str(cm.exception), "/seq/0: validation failed: not in range, max 10, but got 80") diff --git a/spec/python/specwrite/test_valid_fail_range_str.py b/spec/python/specwrite/test_valid_fail_range_str.py index 4611e660f..834e2be38 100644 --- a/spec/python/specwrite/test_valid_fail_range_str.py +++ b/spec/python/specwrite/test_valid_fail_range_str.py @@ -1,6 +1,5 @@ -# Autogenerated from KST: please remove this line if doing any edits by hand! - import unittest +import kaitaistruct from specwrite.common_spec import CommonSpec from testwrite.valid_fail_range_str import ValidFailRangeStr @@ -13,3 +12,23 @@ def __init__(self, *args, **kwargs): def test_read_write_roundtrip(self): self.skipTest("cannot use roundtrip because parsing is expected to fail") + + def test_check_bad_valid_no_io(self): + r = ValidFailRangeStr() + r.foo = u"PA" + self.assert_check_valid_fail(r) + + def test_check_bad_valid_old_io(self): + r = ValidFailRangeStr.from_file(self.src_filename) + with self.assertRaises(kaitaistruct.ValidationGreaterThanError): + r._read() + self.assert_check_valid_fail(r) + + def assert_check_valid_fail(self, r): + with self.assertRaises(kaitaistruct.ValidationGreaterThanError) as cm: + r._check() + + # NB: the error message must not contain the "at pos X: " part because + # _check() is not supposed to access `_io` at all (even if it happens + # to be non-`null`, as in this case) + self.assertEqual(str(cm.exception), "/seq/0: validation failed: not in range, max 'P1', but got 'PA'") From d4d387065faac687332d55664370e4ebae8fd890 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Sun, 24 Sep 2023 10:26:19 +0200 Subject: [PATCH 116/126] Python specwrite: fix incompatibilities with Python 2 --- spec/python/specwrite/common_spec.py | 6 +++--- spec/python/specwrite/test_expr_2.py | 3 ++- spec/python/specwrite/test_str_encodings.py | 9 +++++---- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/spec/python/specwrite/common_spec.py b/spec/python/specwrite/common_spec.py index 2598d6828..4dda1e3e4 100644 --- a/spec/python/specwrite/common_spec.py +++ b/spec/python/specwrite/common_spec.py @@ -122,9 +122,6 @@ def dump_struct_value(value, parent_structs, recursion_depth_limit, current_path if isinstance(value, KaitaiStream): value = value.to_byte_array() - if PY2 and isinstance(value, bytes): - value = bytearray(value) - if isinstance(value, (bytes, bytearray)): # https://stackoverflow.com/a/19210468 value = CommonSpec.Base.byte_array_to_hex(value) @@ -133,4 +130,7 @@ def dump_struct_value(value, parent_structs, recursion_depth_limit, current_path @staticmethod def byte_array_to_hex(arr): + if PY2 and isinstance(arr, bytes): + arr = bytearray(arr) + return ' '.join('%02x' % b for b in arr) diff --git a/spec/python/specwrite/test_expr_2.py b/spec/python/specwrite/test_expr_2.py index 734584bf6..8013ec32b 100644 --- a/spec/python/specwrite/test_expr_2.py +++ b/spec/python/specwrite/test_expr_2.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- import io import unittest from kaitaistruct import KaitaiStream @@ -18,7 +19,7 @@ def test_edit(self): old_len_mod = r.str2.len_mod old_str2_rest_avg = r.str2.rest.avg - r.str2.str = "Kaitai Struct カ" + r.str2.str = u"Kaitai Struct カ" r.str2._invalidate_len_mod() str2_size = len(r.str2.str.encode(u"UTF-8")) diff --git a/spec/python/specwrite/test_str_encodings.py b/spec/python/specwrite/test_str_encodings.py index 3b768d3d1..2cad19426 100644 --- a/spec/python/specwrite/test_str_encodings.py +++ b/spec/python/specwrite/test_str_encodings.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- import unittest from kaitaistruct import ConsistencyError from specwrite.common_spec import CommonSpec @@ -24,10 +25,10 @@ def test_check_null(self): def test_check_mismatch(self): r = StrEncodings() - r.str1 = "Some ASCII" - r.str2 = "こんにちは" - r.str3 = "こんにちは" - r.str4 = "░▒▓" + r.str1 = u"Some ASCII" + r.str2 = u"こんにちは" + r.str3 = u"こんにちは" + r.str4 = u"░▒▓" # To be auto-derived r.len_of_1 = 10 From 2841eec52e4c93493f222b8aada48058cd9eb12a Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Thu, 28 Sep 2023 14:46:46 +0200 Subject: [PATCH 117/126] InstanceStd: fix incompatibility with Python 2 --- spec/python/specwrite/test_instance_std.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/python/specwrite/test_instance_std.py b/spec/python/specwrite/test_instance_std.py index 28f5724b9..cbfc005c1 100644 --- a/spec/python/specwrite/test_instance_std.py +++ b/spec/python/specwrite/test_instance_std.py @@ -34,7 +34,7 @@ def test_check_empty_header_via_dump(self): def test_write(self): r = InstanceStd() - r.header = "Hello" + r.header = u"Hello" # see .test_read_write_roundtrip orig_dump = CommonSpec.Base.dump_struct(r) From 54b8ef288ed074487e352f52b38d0ebf205f6052 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Thu, 12 Oct 2023 15:28:37 +0200 Subject: [PATCH 118/126] Regen Java spec tests from KST (remove extra newline) --- spec/java/src/io/kaitai/struct/spec/TestBufferedStruct.java | 1 - spec/java/src/io/kaitai/struct/spec/TestEnumToIInvalid.java | 1 - spec/java/src/io/kaitai/struct/spec/TestExprToITrailing.java | 1 - 3 files changed, 3 deletions(-) diff --git a/spec/java/src/io/kaitai/struct/spec/TestBufferedStruct.java b/spec/java/src/io/kaitai/struct/spec/TestBufferedStruct.java index b1d566f34..0875e0c79 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestBufferedStruct.java +++ b/spec/java/src/io/kaitai/struct/spec/TestBufferedStruct.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestBufferedStruct extends CommonSpec { - @Test public void testBufferedStruct() throws Exception { BufferedStruct r = BufferedStruct.fromFile(SRC_DIR + "buffered_struct.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestEnumToIInvalid.java b/spec/java/src/io/kaitai/struct/spec/TestEnumToIInvalid.java index 6b78337c6..c0547bd2c 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestEnumToIInvalid.java +++ b/spec/java/src/io/kaitai/struct/spec/TestEnumToIInvalid.java @@ -6,7 +6,6 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; public class TestEnumToIInvalid extends CommonSpec { - @Test public void testEnumToIInvalid() throws Exception { EnumToIInvalid r = EnumToIInvalid.fromFile(SRC_DIR + "term_strz.bin"); diff --git a/spec/java/src/io/kaitai/struct/spec/TestExprToITrailing.java b/spec/java/src/io/kaitai/struct/spec/TestExprToITrailing.java index 4766bf164..0ccdc073d 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestExprToITrailing.java +++ b/spec/java/src/io/kaitai/struct/spec/TestExprToITrailing.java @@ -7,7 +7,6 @@ import static org.testng.Assert.*; import io.kaitai.struct.KaitaiStream; public class TestExprToITrailing extends CommonSpec { - @Test public void testExprToITrailing() throws Exception { final ExprToITrailing r = ExprToITrailing.fromFile(SRC_DIR + "term_strz.bin"); From 2fc07b769bfe007120de624460f4c0ccb6f14532 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Thu, 12 Oct 2023 20:58:14 +0200 Subject: [PATCH 119/126] Regen EnumToIInvalid from KST for Java+Python specwrite --- .../struct/specwrite/TestEnumToIInvalid.java | 19 +++++++++++++++++++ .../specwrite/test_enum_to_i_invalid.py | 12 ++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 spec/java/src/io/kaitai/struct/specwrite/TestEnumToIInvalid.java create mode 100644 spec/python/specwrite/test_enum_to_i_invalid.py diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEnumToIInvalid.java b/spec/java/src/io/kaitai/struct/specwrite/TestEnumToIInvalid.java new file mode 100644 index 000000000..bb1823689 --- /dev/null +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEnumToIInvalid.java @@ -0,0 +1,19 @@ +// Autogenerated from KST: please remove this line if doing any edits by hand! + +package io.kaitai.struct.specwrite; + +import io.kaitai.struct.KaitaiStruct.ReadWrite; +import io.kaitai.struct.testwrite.EnumToIInvalid; +import org.testng.annotations.Test; + +public class TestEnumToIInvalid extends CommonSpec { + @Override + protected Class getStructClass() { + return EnumToIInvalid.class; + } + + @Override + protected String getSrcFilename() { + return "term_strz.bin"; + } +} diff --git a/spec/python/specwrite/test_enum_to_i_invalid.py b/spec/python/specwrite/test_enum_to_i_invalid.py new file mode 100644 index 000000000..8c7f0a0e7 --- /dev/null +++ b/spec/python/specwrite/test_enum_to_i_invalid.py @@ -0,0 +1,12 @@ +# Autogenerated from KST: please remove this line if doing any edits by hand! + +import unittest +from specwrite.common_spec import CommonSpec + +from testwrite.enum_to_i_invalid import EnumToIInvalid + +class TestEnumToIInvalid(CommonSpec.Base): + def __init__(self, *args, **kwargs): + super(TestEnumToIInvalid, self).__init__(*args, **kwargs) + self.struct_class = EnumToIInvalid + self.src_filename = 'src/term_strz.bin' From 6199fe0bab8568de72e065343dae54e9147e02f3 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Fri, 13 Oct 2023 00:04:08 +0200 Subject: [PATCH 120/126] Fix Java 7 compat: add `final` to local vars used in inner classes --- .../src/io/kaitai/struct/spec/TestEofExceptionBitsBe.java | 2 +- .../src/io/kaitai/struct/spec/TestEofExceptionBitsBe2.java | 2 +- .../src/io/kaitai/struct/spec/TestEofExceptionBitsLe.java | 2 +- .../src/io/kaitai/struct/spec/TestEofExceptionBitsLe2.java | 2 +- .../io/kaitai/struct/specwrite/TestEofExceptionBitsBe.java | 4 ++-- .../io/kaitai/struct/specwrite/TestEofExceptionBitsBe2.java | 4 ++-- .../io/kaitai/struct/specwrite/TestEofExceptionBitsLe.java | 4 ++-- .../io/kaitai/struct/specwrite/TestEofExceptionBitsLe2.java | 4 ++-- .../src/io/kaitai/struct/specwrite/TestEofExceptionBytes.java | 4 ++-- .../src/io/kaitai/struct/specwrite/TestEofExceptionU4.java | 4 ++-- 10 files changed, 16 insertions(+), 16 deletions(-) diff --git a/spec/java/src/io/kaitai/struct/spec/TestEofExceptionBitsBe.java b/spec/java/src/io/kaitai/struct/spec/TestEofExceptionBitsBe.java index d55f52c14..5660e5c58 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestEofExceptionBitsBe.java +++ b/spec/java/src/io/kaitai/struct/spec/TestEofExceptionBitsBe.java @@ -6,7 +6,7 @@ public class TestEofExceptionBitsBe extends CommonSpec { @Test public void testEofExceptionBitsBe() throws Exception { - EofExceptionBitsBe r = EofExceptionBitsBe.fromFile(SRC_DIR + "nav_parent_switch.bin"); + final EofExceptionBitsBe r = EofExceptionBitsBe.fromFile(SRC_DIR + "nav_parent_switch.bin"); assertThrowsEofError(new ThrowingRunnable() { @Override public void run() throws Throwable { diff --git a/spec/java/src/io/kaitai/struct/spec/TestEofExceptionBitsBe2.java b/spec/java/src/io/kaitai/struct/spec/TestEofExceptionBitsBe2.java index 6b7f91310..b46016c5e 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestEofExceptionBitsBe2.java +++ b/spec/java/src/io/kaitai/struct/spec/TestEofExceptionBitsBe2.java @@ -8,7 +8,7 @@ public class TestEofExceptionBitsBe2 extends CommonSpec { @Test public void testEofExceptionBitsBe2() throws Exception { - EofExceptionBitsBe2 r = EofExceptionBitsBe2.fromFile(SRC_DIR + "nav_parent_switch.bin"); + final EofExceptionBitsBe2 r = EofExceptionBitsBe2.fromFile(SRC_DIR + "nav_parent_switch.bin"); assertThrowsEofError(new ThrowingRunnable() { @Override public void run() throws Throwable { diff --git a/spec/java/src/io/kaitai/struct/spec/TestEofExceptionBitsLe.java b/spec/java/src/io/kaitai/struct/spec/TestEofExceptionBitsLe.java index 10ed19d12..6aed7389e 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestEofExceptionBitsLe.java +++ b/spec/java/src/io/kaitai/struct/spec/TestEofExceptionBitsLe.java @@ -8,7 +8,7 @@ public class TestEofExceptionBitsLe extends CommonSpec { @Test public void testEofExceptionBitsLe() throws Exception { - EofExceptionBitsLe r = EofExceptionBitsLe.fromFile(SRC_DIR + "nav_parent_switch.bin"); + final EofExceptionBitsLe r = EofExceptionBitsLe.fromFile(SRC_DIR + "nav_parent_switch.bin"); assertThrowsEofError(new ThrowingRunnable() { @Override public void run() throws Throwable { diff --git a/spec/java/src/io/kaitai/struct/spec/TestEofExceptionBitsLe2.java b/spec/java/src/io/kaitai/struct/spec/TestEofExceptionBitsLe2.java index be2fc9a27..b4c47212f 100644 --- a/spec/java/src/io/kaitai/struct/spec/TestEofExceptionBitsLe2.java +++ b/spec/java/src/io/kaitai/struct/spec/TestEofExceptionBitsLe2.java @@ -8,7 +8,7 @@ public class TestEofExceptionBitsLe2 extends CommonSpec { @Test public void testEofExceptionBitsLe2() throws Exception { - EofExceptionBitsLe2 r = EofExceptionBitsLe2.fromFile(SRC_DIR + "nav_parent_switch.bin"); + final EofExceptionBitsLe2 r = EofExceptionBitsLe2.fromFile(SRC_DIR + "nav_parent_switch.bin"); assertThrowsEofError(new ThrowingRunnable() { @Override public void run() throws Throwable { diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBitsBe.java b/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBitsBe.java index 01e603794..9abc15971 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBitsBe.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBitsBe.java @@ -33,7 +33,7 @@ protected void testReadWriteRoundtrip() throws Exception { @Test public void testEofExceptionBitsBeBB() throws Exception { - EofExceptionBitsBe r = getEofExceptionBitsBe(); + final EofExceptionBitsBe r = getEofExceptionBitsBe(); try (KaitaiStream io = new ByteBufferKaitaiStream(3)) { assertThrowsEofError(new ThrowingRunnable() { @@ -48,7 +48,7 @@ public void run() throws Throwable { @Test public void testEofExceptionBitsBeRAF() throws Exception { - EofExceptionBitsBe r = getEofExceptionBitsBe(); + final EofExceptionBitsBe r = getEofExceptionBitsBe(); File file = new File(SCRATCH_DIR + "specwrite_TestEofExceptionBitsBe.bin"); RandomAccessFile raf = new RandomAccessFile(file, "rw"); diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBitsBe2.java b/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBitsBe2.java index 30c046733..ef183a100 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBitsBe2.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBitsBe2.java @@ -33,7 +33,7 @@ protected void testReadWriteRoundtrip() throws Exception { @Test public void testEofExceptionBitsBe2BB() throws Exception { - EofExceptionBitsBe2 r = getEofExceptionBitsBe2(); + final EofExceptionBitsBe2 r = getEofExceptionBitsBe2(); try (KaitaiStream io = new ByteBufferKaitaiStream(3)) { assertThrowsEofError(new ThrowingRunnable() { @@ -48,7 +48,7 @@ public void run() throws Throwable { @Test public void testEofExceptionBitsBe2RAF() throws Exception { - EofExceptionBitsBe2 r = getEofExceptionBitsBe2(); + final EofExceptionBitsBe2 r = getEofExceptionBitsBe2(); File file = new File(SCRATCH_DIR + "specwrite_TestEofExceptionBitsBe2.bin"); RandomAccessFile raf = new RandomAccessFile(file, "rw"); diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBitsLe.java b/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBitsLe.java index 64585dd10..979b7ed72 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBitsLe.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBitsLe.java @@ -33,7 +33,7 @@ protected void testReadWriteRoundtrip() throws Exception { @Test public void testEofExceptionBitsLeBB() throws Exception { - EofExceptionBitsLe r = getEofExceptionBitsLe(); + final EofExceptionBitsLe r = getEofExceptionBitsLe(); try (KaitaiStream io = new ByteBufferKaitaiStream(3)) { assertThrowsEofError(new ThrowingRunnable() { @@ -48,7 +48,7 @@ public void run() throws Throwable { @Test public void testEofExceptionBitsLeRAF() throws Exception { - EofExceptionBitsLe r = getEofExceptionBitsLe(); + final EofExceptionBitsLe r = getEofExceptionBitsLe(); File file = new File(SCRATCH_DIR + "specwrite_TestEofExceptionBitsLe.bin"); RandomAccessFile raf = new RandomAccessFile(file, "rw"); diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBitsLe2.java b/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBitsLe2.java index 6c7877a55..db25d7e50 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBitsLe2.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBitsLe2.java @@ -33,7 +33,7 @@ protected void testReadWriteRoundtrip() throws Exception { @Test public void testEofExceptionBitsLe2BB() throws Exception { - EofExceptionBitsLe2 r = getEofExceptionBitsLe2(); + final EofExceptionBitsLe2 r = getEofExceptionBitsLe2(); try (KaitaiStream io = new ByteBufferKaitaiStream(3)) { assertThrowsEofError(new ThrowingRunnable() { @@ -48,7 +48,7 @@ public void run() throws Throwable { @Test public void testEofExceptionBitsLe2RAF() throws Exception { - EofExceptionBitsLe2 r = getEofExceptionBitsLe2(); + final EofExceptionBitsLe2 r = getEofExceptionBitsLe2(); File file = new File(SCRATCH_DIR + "specwrite_TestEofExceptionBitsLe2.bin"); RandomAccessFile raf = new RandomAccessFile(file, "rw"); diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBytes.java b/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBytes.java index eadb85e1a..92a9b0a7a 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBytes.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionBytes.java @@ -33,7 +33,7 @@ protected void testReadWriteRoundtrip() throws Exception { @Test public void testEofExceptionBytesBB() throws Exception { - EofExceptionBytes r = getEofExceptionBytes(); + final EofExceptionBytes r = getEofExceptionBytes(); try (KaitaiStream io = new ByteBufferKaitaiStream(12)) { assertThrowsEofError(new ThrowingRunnable() { @@ -47,7 +47,7 @@ public void run() throws Throwable { @Test public void testEofExceptionBytesRAF() throws Exception { - EofExceptionBytes r = getEofExceptionBytes(); + final EofExceptionBytes r = getEofExceptionBytes(); File file = new File(SCRATCH_DIR + "specwrite_TestEofExceptionBytes.bin"); RandomAccessFile raf = new RandomAccessFile(file, "rw"); diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionU4.java b/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionU4.java index 78dd1c8c4..a6cdc4da1 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionU4.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestEofExceptionU4.java @@ -33,7 +33,7 @@ protected void testReadWriteRoundtrip() throws Exception { @Test public void testEofExceptionU4BB() throws Exception { - EofExceptionU4 r = getEofExceptionU4(); + final EofExceptionU4 r = getEofExceptionU4(); try (KaitaiStream io = new ByteBufferKaitaiStream(12)) { assertThrowsEofError(new ThrowingRunnable() { @@ -47,7 +47,7 @@ public void run() throws Throwable { @Test public void testEofExceptionU4RAF() throws Exception { - EofExceptionU4 r = getEofExceptionU4(); + final EofExceptionU4 r = getEofExceptionU4(); File file = new File(SCRATCH_DIR + "specwrite_TestEofExceptionU4.bin"); RandomAccessFile raf = new RandomAccessFile(file, "rw"); From e0c5a671b2a88be21db0d4a4e6b4873a05e2dc23 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Fri, 13 Oct 2023 00:05:36 +0200 Subject: [PATCH 121/126] Fix Java 7 compat: add explicit type args to empty collections --- spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java | 4 +++- .../src/io/kaitai/struct/specwrite/TestRepeatUntilS4.java | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java b/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java index 2f8f320c4..98c21cf51 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java +++ b/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java @@ -72,7 +72,9 @@ protected void assertByteArrayEquals(byte[] actual, byte[] expected) { } protected static Object dumpStruct(KaitaiStruct.ReadWrite struct) throws Exception { - return dumpStructValue(struct, new IdentityHashMap<>(), 50, "/"); + // In this case, explicit type arguments are needed for Java 7 + // compatibility; since Java 8, `new IdentityHashMap<>()` also works. + return dumpStructValue(struct, new IdentityHashMap(), 50, "/"); } protected static Object dumpStructValue( diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilS4.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilS4.java index 0f9bed45b..48d2bb507 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilS4.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatUntilS4.java @@ -23,7 +23,9 @@ protected String getSrcFilename() { @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: entries,.*") public void testCheckBadNoEntries() { RepeatUntilS4 r = new RepeatUntilS4(); - r.setEntries(new ArrayList<>(0)); + // In this case, an explicit `Integer` type argument is needed for Java 7 + // compatibility; since Java 8, `new ArrayList<>()` also works. + r.setEntries(new ArrayList(0)); r._check(); } From bb10791018c96cf882b99270abb572e4e9b7f79c Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Fri, 13 Oct 2023 00:07:28 +0200 Subject: [PATCH 122/126] Fix Java 7 compat: replace `getParameterCount()` added in Java 8 --- spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java b/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java index 98c21cf51..0169d8264 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java +++ b/spec/java/src/io/kaitai/struct/specwrite/CommonSpec.java @@ -129,7 +129,10 @@ protected static Object dumpStructValue( continue; } } - if (m.getParameterCount() != 0) continue; // we only want getters (which must have 0 args) + // // The `java.lang.reflect.Method.getParameterCount()` method + // // is only available since Java 8 + // if (m.getParameterCount() != 0) continue; // we only want getters (which must have 0 args) + if (m.getParameterTypes().length != 0) continue; // we only want getters (which must have 0 args) // here we could maybe set `_raw_*` properties to `null` to avoid fooling the test // as easily as merely writing the `_raw_*` bytes left over from parsing, but so far From 3714a69dcd3befc1b7d0819b917ba825712d08c1 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Sat, 14 Oct 2023 00:55:25 +0200 Subject: [PATCH 123/126] java_builder: build only the sources that each suite needs Avoid unnecessarily compiling both `spec` and `specwrite` suites twice, each time only to run tests from one suite. This means that the compilation should be faster, the compile errors (mostly in generated Java sources) won't be duplicated in the console output, and our CI infrastructure will no longer report them (also) in the wrong suite. --- builder/java_builder.rb | 23 ++++++++++++++++++----- builder/spec/java/java_builder_spec.rb | 2 +- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/builder/java_builder.rb b/builder/java_builder.rb index 51a2984a5..851cc661a 100644 --- a/builder/java_builder.rb +++ b/builder/java_builder.rb @@ -5,10 +5,12 @@ require_relative 'shellconfig' class JavaBuilder < PartialBuilder - def initialize(suite_names = nil, test_out_dir = nil) + def initialize(suite_name, test_out_dir = nil) super() - @suite_names = suite_names || 'spec,specwrite' + raise "Expected suite_name to be \"spec\" or \"specwrite\", but got #{suite_name.inspect}" unless suite_name == 'spec' || suite_name == 'specwrite' + + @suite_name = suite_name @test_out_dir = File.absolute_path(test_out_dir || "#{@config['TEST_OUT_DIR']}/java") @spec_dir = File.join('spec', 'java', 'src') @@ -32,8 +34,19 @@ def list_mandatory_files end def list_disposable_files - Dir.glob(File.join("#{@spec_dir}", '**/*.java')) + - Dir.glob(File.join("#{@compiled_dir}", 'src', '**/*.java')) + suite_files = + if @suite_name == 'specwrite' + [File.join(@spec_dir, 'io', 'kaitai', 'struct', 'spec', 'CommonSpec.java')] + + Dir.glob(File.join(@spec_dir, 'io', 'kaitai', 'struct', 'specwrite', '*.java')) + + Dir.glob(File.join(@spec_dir, 'io', 'kaitai', 'struct', 'testwrite', '*.java')) + + Dir.glob(File.join(@compiled_dir, 'src', 'io', 'kaitai', 'struct', 'testwrite', '*.java')) + else + Dir.glob(File.join(@spec_dir, 'io', 'kaitai', 'struct', 'spec', '*.java')) + + Dir.glob(File.join(@spec_dir, 'io', 'kaitai', 'struct', 'testformats', '*.java')) + + Dir.glob(File.join(@compiled_dir, 'src', 'io', 'kaitai', 'struct', 'testformats', '*.java')) + end + + suite_files + Dir.glob(File.join("#{@spec_dir}", 'nested', '**/*.java')) end def create_project(mand_files, disp_files) @@ -94,7 +107,7 @@ def run_tests '-cp', @java_classpath, 'org.testng.TestNG', '-d', @test_out_dir, - '-testnames', @suite_names, + '-testnames', @suite_name, File.absolute_path(File.join('spec', 'java', 'testng.xml')) ] out_log = File.join(@test_out_dir, 'test_run.stdout') diff --git a/builder/spec/java/java_builder_spec.rb b/builder/spec/java/java_builder_spec.rb index 6189658d6..887f23545 100644 --- a/builder/spec/java/java_builder_spec.rb +++ b/builder/spec/java/java_builder_spec.rb @@ -10,7 +10,7 @@ context '1' do before :context do Dir.chdir("#{@spec_dir}/1") - @builder = JavaBuilder.new + @builder = JavaBuilder.new('spec') end describe '#parse_failed_build' do From 2b80b8b6ec89862e0d1133bbd9237e0551d5069c Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Sat, 14 Oct 2023 20:53:42 +0200 Subject: [PATCH 124/126] RepeatNStrz, StrEncodings: fix Java <17 compat of testCheckNull() --- .../struct/specwrite/TestRepeatNStrz.java | 17 ++++++++++++++--- .../struct/specwrite/TestStrEncodings.java | 17 ++++++++++++++--- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStrz.java b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStrz.java index a14e0c0da..560aa2b2c 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStrz.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestRepeatNStrz.java @@ -4,6 +4,7 @@ import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.RepeatNStrz; import org.testng.annotations.Test; +import static org.testng.Assert.*; import java.util.ArrayList; import java.util.Arrays; @@ -19,12 +20,22 @@ public void testCheckMismatch() throws Exception { r._check(); } - @Test(expectedExceptions = NullPointerException.class, expectedExceptionsMessageRegExp = ".*\\blines\\b.*") + @Test public void testCheckNull() throws Exception { - RepeatNStrz r = new RepeatNStrz(); + final RepeatNStrz r = new RepeatNStrz(); r.setQty(0); - r._check(); + Throwable thr = expectThrows(NullPointerException.class, new ThrowingRunnable() { + @Override + public void run() throws Throwable { + r._check(); + } + }); + final String msg = thr.getMessage(); + if (msg != null) { + final String fieldName = "lines"; + assertTrue(msg.matches(".*\\b" + fieldName + "\\b.*"), "expected the error message to contain '" + fieldName + "', but got [" + msg + "]"); + } } @Override diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestStrEncodings.java b/spec/java/src/io/kaitai/struct/specwrite/TestStrEncodings.java index 6c0aac88e..27ede9c1f 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestStrEncodings.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestStrEncodings.java @@ -4,18 +4,29 @@ import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.StrEncodings; import org.testng.annotations.Test; +import static org.testng.Assert.*; public class TestStrEncodings extends CommonSpec { - @Test(expectedExceptions = NullPointerException.class, expectedExceptionsMessageRegExp = ".*\\bstr2\\b.*") + @Test public void testCheckNull() throws Exception { - StrEncodings r = new StrEncodings(); + final StrEncodings r = new StrEncodings(); r.setStr1("woo"); r.setLenOf1(3); r.setLenOf2(15); - r._check(); + Throwable thr = expectThrows(NullPointerException.class, new ThrowingRunnable() { + @Override + public void run() throws Throwable { + r._check(); + } + }); + final String msg = thr.getMessage(); + if (msg != null) { + final String fieldName = "str2"; + assertTrue(msg.matches(".*\\b" + fieldName + "\\b.*"), "expected the error message to contain '" + fieldName + "', but got [" + msg + "]"); + } } @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: str2,.*") From b8da1cbeac82a45fc43865c7187408ed38268eac Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Sun, 3 Mar 2024 23:43:15 +0100 Subject: [PATCH 125/126] BytesEosPadTerm: add _check() cases for Java specwrite --- .../struct/specwrite/TestBytesEosPadTerm.java | 231 +++++++++++++++++- 1 file changed, 229 insertions(+), 2 deletions(-) diff --git a/spec/java/src/io/kaitai/struct/specwrite/TestBytesEosPadTerm.java b/spec/java/src/io/kaitai/struct/specwrite/TestBytesEosPadTerm.java index 557f15fec..ab9fe6e8f 100644 --- a/spec/java/src/io/kaitai/struct/specwrite/TestBytesEosPadTerm.java +++ b/spec/java/src/io/kaitai/struct/specwrite/TestBytesEosPadTerm.java @@ -1,12 +1,239 @@ -// Autogenerated from KST: please remove this line if doing any edits by hand! - package io.kaitai.struct.specwrite; +import io.kaitai.struct.ByteBufferKaitaiStream; +import io.kaitai.struct.ConsistencyError; import io.kaitai.struct.KaitaiStruct.ReadWrite; import io.kaitai.struct.testwrite.BytesEosPadTerm; import org.testng.annotations.Test; public class TestBytesEosPadTerm extends CommonSpec { + @Test + public void testCheckGoodMaxLengths() throws Exception { + BytesEosPadTerm r = new BytesEosPadTerm(); + setStrPad(r, "12345678901234567890".getBytes()); + setStrTerm(r, "12345678901234567890".getBytes()); + setStrTermAndPad(r, "12345678901234567890".getBytes()); + setStrTermInclude(r, "12345678901234567890".getBytes()); + check(r); + } + + @Test + public void testCheckGoodMinLengths() throws Exception { + BytesEosPadTerm r = new BytesEosPadTerm(); + setStrPad(r, "".getBytes()); + setStrTerm(r, "".getBytes()); + setStrTermAndPad(r, "".getBytes()); + setStrTermInclude(r, "@".getBytes()); + check(r); + } + + @Test(expectedExceptions = java.nio.BufferOverflowException.class) + public void testCheckLongerStrPad() throws Exception { + BytesEosPadTerm r = new BytesEosPadTerm(); + setStrPad(r, "123456789012345678901".getBytes()); + check(r); + } + + @Test + public void testCheckGoodLastByteStrPad() throws Exception { + BytesEosPadTerm r = new BytesEosPadTerm(); + setStrPad(r, ("@@@@@"+"@@@@@"+"@@@@@"+"@@@@?").getBytes()); + setStrTerm(r, "12345678901234567890".getBytes()); + setStrTermAndPad(r, "12345678901234567890".getBytes()); + setStrTermInclude(r, "12345678901234567890".getBytes()); + check(r); + } + + @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: str_pad,.*") + public void testCheckBadLastByteStrPad() throws Exception { + BytesEosPadTerm r = new BytesEosPadTerm(); + setStrPad(r, "123456789012345678@".getBytes()); + check(r); + } + + @Test(expectedExceptions = java.nio.BufferOverflowException.class) + public void testCheckLongerStrTerm() throws Exception { + BytesEosPadTerm r = new BytesEosPadTerm(); + setStrPad(r, "12345678901234567890".getBytes()); + setStrTerm(r, "123456789012345678901".getBytes()); + check(r); + } + + @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: str_term,.*") + public void testCheckBadHasTerminator1StrTerm() throws Exception { + BytesEosPadTerm r = new BytesEosPadTerm(); + setStrPad(r, "12345678901234567890".getBytes()); + setStrTerm(r, "123456789012@4567890".getBytes()); + check(r); + } + + @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: str_term,.*") + public void testCheckBadHasTerminator2StrTerm() throws Exception { + BytesEosPadTerm r = new BytesEosPadTerm(); + setStrPad(r, "12345678901234567890".getBytes()); + setStrTerm(r, "1234567890123456789@".getBytes()); + check(r); + } + + @Test(expectedExceptions = java.nio.BufferOverflowException.class) + public void testCheckLongerStrTermAndPad() throws Exception { + BytesEosPadTerm r = new BytesEosPadTerm(); + setStrPad(r, "12345678901234567890".getBytes()); + setStrTerm(r, "12345678901234567890".getBytes()); + setStrTermAndPad(r, "123456789012345678901".getBytes()); + check(r); + } + + @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: str_term_and_pad,.*") + public void testCheckBadHasTerminatorStrTermAndPad() throws Exception { + BytesEosPadTerm r = new BytesEosPadTerm(); + setStrPad(r, "12345678901234567890".getBytes()); + setStrTerm(r, "12345678901234567890".getBytes()); + setStrTermAndPad(r, "@2345678901234567890".getBytes()); + check(r); + } + + @Test + public void testCheckGoodLastByte1StrTermAndPad() throws Exception { + BytesEosPadTerm r = new BytesEosPadTerm(); + setStrPad(r, "12345678901234567890".getBytes()); + setStrTerm(r, "12345678901234567890".getBytes()); + setStrTermAndPad(r, ("+++++"+"+++++"+"+++++"+"++++").getBytes()); + setStrTermInclude(r, "12345678901234567890".getBytes()); + check(r); + } + + @Test + public void testCheckGoodLastByte2StrTermAndPad() throws Exception { + BytesEosPadTerm r = new BytesEosPadTerm(); + setStrPad(r, "12345678901234567890".getBytes()); + setStrTerm(r, "12345678901234567890".getBytes()); + setStrTermAndPad(r, ("+++++"+"+++++"+"+++++"+"++++0").getBytes()); + setStrTermInclude(r, "12345678901234567890".getBytes()); + check(r); + } + + @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: str_term_and_pad,.*") + public void testCheckBadLastByteStrTermAndPad() throws Exception { + BytesEosPadTerm r = new BytesEosPadTerm(); + setStrPad(r, "12345678901234567890".getBytes()); + setStrTerm(r, "12345678901234567890".getBytes()); + setStrTermAndPad(r, "1234567890123456789+".getBytes()); + check(r); + } + + @Test(expectedExceptions = java.nio.BufferOverflowException.class) + public void testCheckLongerStrTermInclude() throws Exception { + BytesEosPadTerm r = new BytesEosPadTerm(); + setStrPad(r, "12345678901234567890".getBytes()); + setStrTerm(r, "12345678901234567890".getBytes()); + setStrTermAndPad(r, "12345678901234567890".getBytes()); + setStrTermInclude(r, "123456789012345678901".getBytes()); + check(r); + } + + @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: str_term_include,.*") + public void testCheckEmptyStrTermInclude() throws Exception { + BytesEosPadTerm r = new BytesEosPadTerm(); + setStrPad(r, "12345678901234567890".getBytes()); + setStrTerm(r, "12345678901234567890".getBytes()); + setStrTermAndPad(r, "12345678901234567890".getBytes()); + setStrTermInclude(r, "".getBytes()); + check(r); + } + + @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: str_term_include,.*") + public void testCheckBadNoTerminatorStrTermInclude() throws Exception { + BytesEosPadTerm r = new BytesEosPadTerm(); + setStrPad(r, "12345678901234567890".getBytes()); + setStrTerm(r, "12345678901234567890".getBytes()); + setStrTermAndPad(r, "12345678901234567890".getBytes()); + setStrTermInclude(r, "123".getBytes()); + check(r); + } + + @Test + public void testCheckGoodTerminator1StrTermInclude() throws Exception { + BytesEosPadTerm r = new BytesEosPadTerm(); + setStrPad(r, "12345678901234567890".getBytes()); + setStrTerm(r, "12345678901234567890".getBytes()); + setStrTermAndPad(r, "12345678901234567890".getBytes()); + setStrTermInclude(r, "12@".getBytes()); + check(r); + } + + @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: str_term_include,.*") + public void testCheckEarlyTerminator1StrTermInclude() throws Exception { + BytesEosPadTerm r = new BytesEosPadTerm(); + setStrPad(r, "12345678901234567890".getBytes()); + setStrTerm(r, "12345678901234567890".getBytes()); + setStrTermAndPad(r, "12345678901234567890".getBytes()); + setStrTermInclude(r, "1@@".getBytes()); + check(r); + } + + @Test + public void testCheckGoodTerminator2StrTermInclude() throws Exception { + BytesEosPadTerm r = new BytesEosPadTerm(); + setStrPad(r, "12345678901234567890".getBytes()); + setStrTerm(r, "12345678901234567890".getBytes()); + setStrTermAndPad(r, "12345678901234567890".getBytes()); + setStrTermInclude(r, "1234567890123456789@".getBytes()); + check(r); + } + + @Test(expectedExceptions = ConsistencyError.class, expectedExceptionsMessageRegExp = "Check failed: str_term_include,.*") + public void testCheckEarlyTerminator2StrTermInclude() throws Exception { + BytesEosPadTerm r = new BytesEosPadTerm(); + setStrPad(r, "12345678901234567890".getBytes()); + setStrTerm(r, "12345678901234567890".getBytes()); + setStrTermAndPad(r, "12345678901234567890".getBytes()); + setStrTermInclude(r, "123456789012345678@@".getBytes()); + check(r); + } + + private static void setStrPad(BytesEosPadTerm r, byte[] value) { + BytesEosPadTerm.StrPadType s = new BytesEosPadTerm.StrPadType(null, r, r._root()); + s.setValue(value); + r.setStrPad(s); + } + + private static void setStrTerm(BytesEosPadTerm r, byte[] value) { + BytesEosPadTerm.StrTermType s = new BytesEosPadTerm.StrTermType(null, r, r._root()); + s.setValue(value); + r.setStrTerm(s); + } + + private static void setStrTermAndPad(BytesEosPadTerm r, byte[] value) { + BytesEosPadTerm.StrTermAndPadType s = new BytesEosPadTerm.StrTermAndPadType(null, r, r._root()); + s.setValue(value); + r.setStrTermAndPad(s); + } + + private static void setStrTermInclude(BytesEosPadTerm r, byte[] value) { + BytesEosPadTerm.StrTermIncludeType s = new BytesEosPadTerm.StrTermIncludeType(null, r, r._root()); + s.setValue(value); + r.setStrTermInclude(s); + } + + private static void check(BytesEosPadTerm r) { + final byte[] buf = "12345678901234567890".getBytes(); + if (r.strPad() == null) { + setStrPad(r, buf); + } + if (r.strTerm() == null) { + setStrTerm(r, buf); + } + if (r.strTermAndPad() == null) { + setStrTermAndPad(r, buf); + } + if (r.strTermInclude() == null) { + setStrTermInclude(r, buf); + } + r._check(); + r._write(new ByteBufferKaitaiStream(80)); + } + @Override protected Class getStructClass() { return BytesEosPadTerm.class; From 629484b021cf5835e9bfee40bc621f0108120b7c Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Mon, 4 Mar 2024 21:17:53 +0100 Subject: [PATCH 126/126] BytesEosPadTerm: port _check() cases to Python specwrite --- .../specwrite/test_bytes_eos_pad_term.py | 202 +++++++++++++++++- 1 file changed, 200 insertions(+), 2 deletions(-) diff --git a/spec/python/specwrite/test_bytes_eos_pad_term.py b/spec/python/specwrite/test_bytes_eos_pad_term.py index b69a658d8..2ff26a404 100644 --- a/spec/python/specwrite/test_bytes_eos_pad_term.py +++ b/spec/python/specwrite/test_bytes_eos_pad_term.py @@ -1,6 +1,6 @@ -# Autogenerated from KST: please remove this line if doing any edits by hand! - +import io import unittest +from kaitaistruct import ConsistencyError, KaitaiStream from specwrite.common_spec import CommonSpec from testwrite.bytes_eos_pad_term import BytesEosPadTerm @@ -10,3 +10,201 @@ def __init__(self, *args, **kwargs): super(TestBytesEosPadTerm, self).__init__(*args, **kwargs) self.struct_class = BytesEosPadTerm self.src_filename = 'src/str_pad_term.bin' + + def test_check_good_max_lengths(self): + r = BytesEosPadTerm() + set_str_pad(r, b"12345678901234567890") + set_str_term(r, b"12345678901234567890") + set_str_term_and_pad(r, b"12345678901234567890") + set_str_term_include(r, b"12345678901234567890") + check(r) + + def test_check_good_min_lengths(self): + r = BytesEosPadTerm() + set_str_pad(r, b"") + set_str_term(r, b"") + set_str_term_and_pad(r, b"") + set_str_term_include(r, b"@") + check(r) + + def test_check_longer_str_pad(self): + r = BytesEosPadTerm() + set_str_pad(r, b"123456789012345678901") + with self.assertRaisesRegexp(EOFError, u"^requested to write \\d+ bytes, but only \\d+ bytes left in the stream$"): + check(r) + + def test_check_good_last_byte_str_pad(self): + r = BytesEosPadTerm() + set_str_pad(r, b"@@@@@" b"@@@@@" b"@@@@@" b"@@@@?") + set_str_term(r, b"12345678901234567890") + set_str_term_and_pad(r, b"12345678901234567890") + set_str_term_include(r, b"12345678901234567890") + check(r) + + def test_check_bad_last_byte_str_pad(self): + r = BytesEosPadTerm() + set_str_pad(r, b"123456789012345678@") + with self.assertRaisesRegexp(ConsistencyError, u"^Check failed: str_pad,"): + check(r) + + def test_check_longer_str_term(self): + r = BytesEosPadTerm() + set_str_pad(r, b"12345678901234567890") + set_str_term(r, b"123456789012345678901") + with self.assertRaisesRegexp(EOFError, u"^requested to write \\d+ bytes, but only \\d+ bytes left in the stream$"): + check(r) + + def test_check_bad_has_terminator1_str_term(self): + r = BytesEosPadTerm() + set_str_pad(r, b"12345678901234567890") + set_str_term(r, b"123456789012@4567890") + with self.assertRaisesRegexp(ConsistencyError, u"^Check failed: str_term,"): + check(r) + + def test_check_bad_has_terminator2_str_term(self): + r = BytesEosPadTerm() + set_str_pad(r, b"12345678901234567890") + set_str_term(r, b"1234567890123456789@") + with self.assertRaisesRegexp(ConsistencyError, u"^Check failed: str_term,"): + check(r) + + def test_check_longer_str_term_and_pad(self): + r = BytesEosPadTerm() + set_str_pad(r, b"12345678901234567890") + set_str_term(r, b"12345678901234567890") + set_str_term_and_pad(r, b"123456789012345678901") + with self.assertRaisesRegexp(EOFError, u"^requested to write \\d+ bytes, but only \\d+ bytes left in the stream$"): + check(r) + + def test_check_bad_has_terminator_str_term_and_pad(self): + r = BytesEosPadTerm() + set_str_pad(r, b"12345678901234567890") + set_str_term(r, b"12345678901234567890") + set_str_term_and_pad(r, b"@2345678901234567890") + with self.assertRaisesRegexp(ConsistencyError, u"^Check failed: str_term_and_pad,"): + check(r) + + def test_check_good_last_byte1_str_term_and_pad(self): + r = BytesEosPadTerm() + set_str_pad(r, b"12345678901234567890") + set_str_term(r, b"12345678901234567890") + set_str_term_and_pad(r, b"+++++" b"+++++" b"+++++" b"++++") + set_str_term_include(r, b"12345678901234567890") + check(r) + + def test_check_good_last_byte2_str_term_and_pad(self): + r = BytesEosPadTerm() + set_str_pad(r, b"12345678901234567890") + set_str_term(r, b"12345678901234567890") + set_str_term_and_pad(r, b"+++++" b"+++++" b"+++++" b"++++0") + set_str_term_include(r, b"12345678901234567890") + check(r) + + def test_check_bad_last_byte_str_term_and_pad(self): + r = BytesEosPadTerm() + set_str_pad(r, b"12345678901234567890") + set_str_term(r, b"12345678901234567890") + set_str_term_and_pad(r, b"1234567890123456789+") + with self.assertRaisesRegexp(ConsistencyError, u"^Check failed: str_term_and_pad,"): + check(r) + + def test_check_longer_str_term_include(self): + r = BytesEosPadTerm() + set_str_pad(r, b"12345678901234567890") + set_str_term(r, b"12345678901234567890") + set_str_term_and_pad(r, b"12345678901234567890") + set_str_term_include(r, b"123456789012345678901") + with self.assertRaisesRegexp(EOFError, u"^requested to write \\d+ bytes, but only \\d+ bytes left in the stream$"): + check(r) + + def test_check_empty_str_term_include(self): + r = BytesEosPadTerm() + set_str_pad(r, b"12345678901234567890") + set_str_term(r, b"12345678901234567890") + set_str_term_and_pad(r, b"12345678901234567890") + set_str_term_include(r, b"") + with self.assertRaisesRegexp(ConsistencyError, u"^Check failed: str_term_include,"): + check(r) + + def test_check_bad_no_terminator_str_term_include(self): + r = BytesEosPadTerm() + set_str_pad(r, b"12345678901234567890") + set_str_term(r, b"12345678901234567890") + set_str_term_and_pad(r, b"12345678901234567890") + set_str_term_include(r, b"123") + with self.assertRaisesRegexp(ConsistencyError, u"^Check failed: str_term_include,"): + check(r) + + def test_check_good_terminator1_str_term_include(self): + r = BytesEosPadTerm() + set_str_pad(r, b"12345678901234567890") + set_str_term(r, b"12345678901234567890") + set_str_term_and_pad(r, b"12345678901234567890") + set_str_term_include(r, b"12@") + check(r) + + def test_check_early_terminator1_str_term_include(self): + r = BytesEosPadTerm() + set_str_pad(r, b"12345678901234567890") + set_str_term(r, b"12345678901234567890") + set_str_term_and_pad(r, b"12345678901234567890") + set_str_term_include(r, b"1@@") + with self.assertRaisesRegexp(ConsistencyError, u"^Check failed: str_term_include,"): + check(r) + + def test_check_good_terminator2_str_term_include(self): + r = BytesEosPadTerm() + set_str_pad(r, b"12345678901234567890") + set_str_term(r, b"12345678901234567890") + set_str_term_and_pad(r, b"12345678901234567890") + set_str_term_include(r, b"1234567890123456789@") + check(r) + + def test_check_early_terminator2_str_term_include(self): + r = BytesEosPadTerm() + set_str_pad(r, b"12345678901234567890") + set_str_term(r, b"12345678901234567890") + set_str_term_and_pad(r, b"12345678901234567890") + set_str_term_include(r, b"123456789012345678@@") + with self.assertRaisesRegexp(ConsistencyError, u"^Check failed: str_term_include,"): + check(r) + + +def set_str_pad(r, value): + s = BytesEosPadTerm.StrPadType(None, r, r._root) + s.value = value + r.str_pad = s + + +def set_str_term(r, value): + s = BytesEosPadTerm.StrTermType(None, r, r._root) + s.value = value + r.str_term = s + + +def set_str_term_and_pad(r, value): + s = BytesEosPadTerm.StrTermAndPadType(None, r, r._root) + s.value = value + r.str_term_and_pad = s + + +def set_str_term_include(r, value): + s = BytesEosPadTerm.StrTermIncludeType(None, r, r._root) + s.value = value + r.str_term_include = s + + +def check(r): + buf = b"12345678901234567890" + if not hasattr(r, 'str_pad'): + set_str_pad(r, buf) + if not hasattr(r, 'str_term'): + set_str_term(r, buf) + if not hasattr(r, 'str_term_and_pad'): + set_str_term_and_pad(r, buf) + if not hasattr(r, 'str_term_include'): + set_str_term_include(r, buf) + + r._check() + ks_io = KaitaiStream(io.BytesIO(bytearray(80))) + r._write(ks_io)