Implementation of Variable length BinaryStruct fields, one TC is failing

This commit is contained in:
Ziver Koc 2016-04-14 16:44:42 +02:00
parent e41fe70951
commit dd1b55106b
8 changed files with 139 additions and 21 deletions

View file

@ -154,4 +154,25 @@ public class BinaryStructInputStreamTest {
}
public void write(OutputStream out, String obj, BinaryFieldData field) throws IOException {}
}
@Test
public void variableLengthField(){
BinaryTestStruct struct = new BinaryTestStruct() {
@BinaryField(index=1, length=8)
public int i1;
@VariableLengthBinaryField(index=2, lengthField="i1")
public String s2;
public void assertObj(){
assertEquals(3, i1);
assertEquals("123", s2);
}
};
byte[] data = "0123456".getBytes();
data[0] = 3;
BinaryStructInputStream.read(struct, data);
struct.assertObj();
}
}