コード例 #1
0
 @Test
 public void test_int8_t() throws IOException {
   for (Integer exp : expected_int8) {
     SignedByte result = binFileReader.int8_t();
     assertEquals("int8_t " + Integer.toHexString(exp) + " asInt()", exp, result.asInt());
     assertEquals(
         "int8_t " + Integer.toHexString(exp) + " getSignedValue()",
         (Byte) exp.byteValue(),
         result.getSignedValue());
     assertEquals(
         "int8_t " + Integer.toHexString(exp) + " toString()",
         ((Byte) exp.byteValue()).toString(),
         result.toString());
   }
 }
コード例 #2
0
 @Test
 public void test_manuel_int8_t() throws IOException {
   // 73 4B C3 BC
   // 115, 75, -61, -68
   byte[] input = {115, 75, -61, -68};
   int[] expected = {115, 75, -61, -68};
   BinFileReader binFileReader =
       new BinFileReader(new BufferedInputStream(new ByteArrayInputStream(input)));
   for (int i = 0; i < input.length; i++) {
     SignedByte result = binFileReader.int8_t();
     Integer exp = expected[i];
     assertEquals("int8_t " + Integer.toHexString(exp) + " asInt()", exp, result.asInt());
     assertEquals(
         "int8_t " + Integer.toHexString(exp) + " getSignedValue()",
         (Byte) exp.byteValue(),
         result.getSignedValue());
   }
 }