Skip to content

Commit b384542

Browse files
committed
added test for VAL
1 parent 1b2a3d6 commit b384542

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

jbbp/src/test/java/com/igormaznitsa/jbbp/compiler/conversion/JBBPToJava6ConverterReadWriteTest.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,17 @@ public void testReadWite_String_SingleValue() throws Exception {
193193
assertArrayEquals(etalon, callWrite(instance));
194194
}
195195

196+
@Test
197+
public void testReadWite_Val_CalculatedLength() throws Exception {
198+
final Object instance = compileAndMakeInstance("ubyte a; ubyte b; val:(a-b) c; val:(c+8) d; byte [d] data;");
199+
final byte[] etalon = new byte[] {2, 8, 33, 44};
200+
201+
callRead(instance, etalon.clone());
202+
203+
assertArrayEquals(new byte[]{33,44}, getField(instance, "data", byte[].class));
204+
assertArrayEquals(etalon, callWrite(instance));
205+
}
206+
196207
@Test
197208
public void testReadWite_Bit_SingleValueWhichLengthCalclatedThrouhExpression() throws Exception {
198209
final Object instance = compileAndMakeInstance("ubyte a; ubyte b; bit:(a+b) c;");

0 commit comments

Comments
 (0)