Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
PJK committed May 7, 2015
1 parent 8bb1d1b commit a2d4fd1
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions test/bad_inputs_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,29 +47,28 @@ static void test_3(void **state)
assert_int_equal(res.error.position, 1);
}

#ifdef CBOR_ASSUME_SANE_MALLOC
unsigned char data4[] = {0xBA, 0xC1, 0xE8, 0x3E, 0xE7, 0x20, 0xA8};
static void test_4(void **state)
{
item = cbor_load(data4, 7, &res);
assert_null(item);
#ifdef CBOR_ASSUME_SANE_MALLOC
assert_true(res.error.code == CBOR_ERR_MEMERROR);
assert_int_equal(res.error.position, 5);
#endif
}


unsigned char data5[] = {0x9A, 0xDA, 0x3A, 0xB2, 0x7F, 0x29};
static void test_5(void **state)
{
assert_true(res.error.code == CBOR_ERR_MEMERROR);
item = cbor_load(data5, 6, &res);
assert_null(item);
#ifdef CBOR_ASSUME_SANE_MALLOC
assert_true(res.error.code == CBOR_ERR_MEMERROR);
assert_int_equal(res.error.position, 5);
#endif
/* Indef string expectation mismatch */
}
#endif

/* Indef string expectation mismatch */
unsigned char data6[] = {0x7F, 0x21, 0x4C, 0x02, 0x40};
static void test_6(void **state)
{
Expand All @@ -87,8 +86,10 @@ int main(void)
unit_test(test_1),
unit_test(test_2),
unit_test(test_3),
#ifdef CBOR_ASSUME_SANE_MALLOC
unit_test(test_4),
unit_test(test_5),
#endif
unit_test(test_6)
};
return run_tests(tests);
Expand Down

0 comments on commit a2d4fd1

Please sign in to comment.