Basic implementation of Binary struct parsing
This commit is contained in:
parent
da54bc8db5
commit
b7bedc94cd
5 changed files with 123 additions and 6 deletions
10
test/zutil/test/ConverterTest.java
Normal file → Executable file
10
test/zutil/test/ConverterTest.java
Normal file → Executable file
|
|
@ -77,4 +77,14 @@ public class ConverterTest {
|
|||
Converter.urlDecode("9i34%202y9252%25%2623%20463765(%2f%26(") );
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void byteArrayToInt(){
|
||||
assertEquals(0, Converter.toInt(new byte[]{}));
|
||||
assertEquals(1, Converter.toInt(new byte[]{0b0000_0001}));
|
||||
assertEquals(1, Converter.toInt(new byte[]{0x01,0x00}));
|
||||
assertEquals(256, Converter.toInt(new byte[]{0x00,0x01,0x00}));
|
||||
assertEquals(Integer.MAX_VALUE, Converter.toInt(new byte[]{(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0x7F}));
|
||||
assertEquals(Integer.MAX_VALUE, Converter.toInt(new byte[]{(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0x7F,(byte)0xFF,(byte)0xFF}));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue