Mercurial > stress-tester
changeset 680:0ff49c5a275c
NcDataHelperTest
author | Devel 1 |
---|---|
date | Wed, 22 Nov 2017 15:38:55 +0100 |
parents | 14e07598bc8c |
children | d48d77c2270b |
files | stress-tester/src/main/java/com/passus/st/reader/nc/NcDataHelper.java stress-tester/src/test/java/com/passus/st/reader/nc/NcDataHelperTest.java |
diffstat | 2 files changed, 17 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/stress-tester/src/main/java/com/passus/st/reader/nc/NcDataHelper.java Wed Nov 22 14:47:24 2017 +0100 +++ b/stress-tester/src/main/java/com/passus/st/reader/nc/NcDataHelper.java Wed Nov 22 15:38:55 2017 +0100 @@ -128,7 +128,7 @@ throw new IndexOutOfBoundsException(); } - data[startIndex] = (byte) (0x80 | bytes); + data[startIndex] = (byte) (VLC_INT_TRESHOLD | bytes); startIndex++; DataUtils.putInt(data, startIndex, bytes, value); return bytes + 1;
--- a/stress-tester/src/test/java/com/passus/st/reader/nc/NcDataHelperTest.java Wed Nov 22 14:47:24 2017 +0100 +++ b/stress-tester/src/test/java/com/passus/st/reader/nc/NcDataHelperTest.java Wed Nov 22 15:38:55 2017 +0100 @@ -14,6 +14,9 @@ * @author Mirosław Hawrot */ public class NcDataHelperTest { + + private static final byte B_FF = (byte) 0xff; + private static final byte B_80 = (byte) 0x80; private final NcDataHelper helper = new NcDataHelper(); @@ -21,8 +24,11 @@ public Object[][] validIntVLC() { return new Object[][]{ {new byte[]{0x00}, 1, 0x00}, - {new byte[]{0x7F}, 1, 0x7F}, - {new byte[]{(byte) 0x81, (byte) 0xFF}, 2, 0xFF} + {new byte[]{0x7f}, 1, 0x7f}, + {new byte[]{(byte) 0x81, B_FF}, 2, 0xff}, + {new byte[]{(byte) 0x82, 0x01, 0x00}, 3, 0x100}, + {new byte[]{(byte) 0x82, 0x01, B_FF}, 3, 0x01ff}, + {new byte[]{(byte) 0x82, B_FF, 0x01}, 3, 0xff01} }; } @@ -30,8 +36,14 @@ public Object[][] validLongVLC() { return new Object[][]{ {new byte[]{0x00, 0x00}, 2, 0x00L}, - {new byte[]{0x00, 0x7F}, 2, 0x7FL}, - {new byte[]{(byte) 0x80, 0x02, (byte) 0x80, 0x01}, 4, 0x8001L} + {new byte[]{0x00, 0x7f}, 2, 0x7fL}, + {new byte[]{0x00, B_80}, 2, 0x80L}, + {new byte[]{0x00, B_FF}, 2, 0xffL}, + {new byte[]{0x01, 0x00}, 2, 0x0100L}, + {new byte[]{0x01, B_FF}, 2, 0x01ffL}, + {new byte[]{0x7F, B_FF}, 2, 0x7fffL}, + {new byte[]{B_80, 0x02, B_80, B_80}, 4, 0x8080L}, + {new byte[]{B_80, 0x02, B_FF, B_FF}, 4, 0xffffL} }; }