| 48 | } |
| 49 | |
| 50 | static void test_decodeUptoMaxInt(void) { |
| 51 | printf("Test decodeUptoMaxInt\n"); |
| 52 | const unsigned char buf[] = |
| 53 | { 0x4b, 0x86, 0x39, 0xe8, 0xdf, 0xc0, 0x38, 0x0f, 0x7f, 0xff, 0xff, 0x00 |
| 54 | , 0x00, 0x00, 0xf0, 0xe0, 0x00, 0x00, 0x00, 0x3c, 0x3b, 0xff, 0xff, 0xff |
| 55 | , 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00 |
| 56 | }; |
| 57 | const int32_t expected[] = |
| 58 | { 1, 2, 3, 4, 5, 7, 8, 15, 16, 17 |
| 59 | , 0xffff, 0x10000, 0x40000000, 0x7fffffff, SIMPLICITY_ERR_DATA_OUT_OF_RANGE |
| 60 | }; |
| 61 | |
| 62 | bitstream stream = initializeBitstream(buf, sizeof(buf)); |
| 63 | for (size_t i = 0; i < sizeof(expected)/sizeof(expected[0]); ++i) { |
| 64 | int32_t result = simplicity_decodeUptoMaxInt(&stream); |
| 65 | if (expected[i] == result) { |
| 66 | successes++; |
| 67 | } else { |
| 68 | failures++; |
| 69 | printf("Unexpected result during parsing. Expected %d and received %d\n", expected[i], result); |
| 70 | } |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | static void test_hashBlock(void) { |
| 75 | printf("Test hashBlock\n"); |
no test coverage detected