Vendor import of libcbor 0.12.0
Sponsored by: The FreeBSD Foundation
This commit is contained in:
+33
-34
@@ -11,7 +11,7 @@
|
||||
|
||||
cbor_item_t *item, *copy, *tmp;
|
||||
|
||||
static void test_uints(void **_CBOR_UNUSED(_state)) {
|
||||
static void test_uints(void** _state _CBOR_UNUSED) {
|
||||
item = cbor_build_uint8(10);
|
||||
assert_uint8(copy = cbor_copy(item), 10);
|
||||
cbor_decref(&item);
|
||||
@@ -33,7 +33,7 @@ static void test_uints(void **_CBOR_UNUSED(_state)) {
|
||||
cbor_decref(©);
|
||||
}
|
||||
|
||||
static void test_negints(void **_CBOR_UNUSED(_state)) {
|
||||
static void test_negints(void** _state _CBOR_UNUSED) {
|
||||
item = cbor_build_negint8(10);
|
||||
assert_true(cbor_get_uint8(copy = cbor_copy(item)) == 10);
|
||||
cbor_decref(&item);
|
||||
@@ -55,7 +55,7 @@ static void test_negints(void **_CBOR_UNUSED(_state)) {
|
||||
cbor_decref(©);
|
||||
}
|
||||
|
||||
static void test_def_bytestring(void **_CBOR_UNUSED(_state)) {
|
||||
static void test_def_bytestring(void** _state _CBOR_UNUSED) {
|
||||
item = cbor_build_bytestring((cbor_data) "abc", 3);
|
||||
assert_memory_equal(cbor_bytestring_handle(copy = cbor_copy(item)),
|
||||
cbor_bytestring_handle(item), 3);
|
||||
@@ -63,7 +63,7 @@ static void test_def_bytestring(void **_CBOR_UNUSED(_state)) {
|
||||
cbor_decref(©);
|
||||
}
|
||||
|
||||
static void test_indef_bytestring(void **_CBOR_UNUSED(_state)) {
|
||||
static void test_indef_bytestring(void** _state _CBOR_UNUSED) {
|
||||
item = cbor_new_indefinite_bytestring();
|
||||
assert_true(cbor_bytestring_add_chunk(
|
||||
item, cbor_move(cbor_build_bytestring((cbor_data) "abc", 3))));
|
||||
@@ -78,7 +78,7 @@ static void test_indef_bytestring(void **_CBOR_UNUSED(_state)) {
|
||||
cbor_decref(©);
|
||||
}
|
||||
|
||||
static void test_def_string(void **_CBOR_UNUSED(_state)) {
|
||||
static void test_def_string(void** _state _CBOR_UNUSED) {
|
||||
item = cbor_build_string("abc");
|
||||
assert_memory_equal(cbor_string_handle(copy = cbor_copy(item)),
|
||||
cbor_string_handle(item), 3);
|
||||
@@ -86,7 +86,7 @@ static void test_def_string(void **_CBOR_UNUSED(_state)) {
|
||||
cbor_decref(©);
|
||||
}
|
||||
|
||||
static void test_indef_string(void **_CBOR_UNUSED(_state)) {
|
||||
static void test_indef_string(void** _state _CBOR_UNUSED) {
|
||||
item = cbor_new_indefinite_string();
|
||||
assert_true(cbor_string_add_chunk(item, cbor_move(cbor_build_string("abc"))));
|
||||
copy = cbor_copy(item);
|
||||
@@ -100,7 +100,7 @@ static void test_indef_string(void **_CBOR_UNUSED(_state)) {
|
||||
cbor_decref(©);
|
||||
}
|
||||
|
||||
static void test_def_array(void **_CBOR_UNUSED(_state)) {
|
||||
static void test_def_array(void** _state _CBOR_UNUSED) {
|
||||
item = cbor_new_definite_array(1);
|
||||
assert_true(cbor_array_push(item, cbor_move(cbor_build_uint8(42))));
|
||||
|
||||
@@ -110,7 +110,7 @@ static void test_def_array(void **_CBOR_UNUSED(_state)) {
|
||||
cbor_decref(&tmp);
|
||||
}
|
||||
|
||||
static void test_indef_array(void **_CBOR_UNUSED(_state)) {
|
||||
static void test_indef_array(void** _state _CBOR_UNUSED) {
|
||||
item = cbor_new_indefinite_array();
|
||||
assert_true(cbor_array_push(item, cbor_move(cbor_build_uint8(42))));
|
||||
|
||||
@@ -120,7 +120,7 @@ static void test_indef_array(void **_CBOR_UNUSED(_state)) {
|
||||
cbor_decref(&tmp);
|
||||
}
|
||||
|
||||
static void test_def_map(void **_CBOR_UNUSED(_state)) {
|
||||
static void test_def_map(void** _state _CBOR_UNUSED) {
|
||||
item = cbor_new_definite_map(1);
|
||||
assert_true(cbor_map_add(item, (struct cbor_pair){
|
||||
.key = cbor_move(cbor_build_uint8(42)),
|
||||
@@ -133,7 +133,7 @@ static void test_def_map(void **_CBOR_UNUSED(_state)) {
|
||||
cbor_decref(©);
|
||||
}
|
||||
|
||||
static void test_indef_map(void **_CBOR_UNUSED(_state)) {
|
||||
static void test_indef_map(void** _state _CBOR_UNUSED) {
|
||||
item = cbor_new_indefinite_map();
|
||||
assert_true(cbor_map_add(item, (struct cbor_pair){
|
||||
.key = cbor_move(cbor_build_uint8(42)),
|
||||
@@ -146,7 +146,7 @@ static void test_indef_map(void **_CBOR_UNUSED(_state)) {
|
||||
cbor_decref(©);
|
||||
}
|
||||
|
||||
static void test_tag(void **_CBOR_UNUSED(_state)) {
|
||||
static void test_tag(void** _state _CBOR_UNUSED) {
|
||||
item = cbor_build_tag(10, cbor_move(cbor_build_uint8(42)));
|
||||
|
||||
assert_uint8(cbor_move(cbor_tag_item(copy = cbor_copy(item))), 42);
|
||||
@@ -155,14 +155,14 @@ static void test_tag(void **_CBOR_UNUSED(_state)) {
|
||||
cbor_decref(©);
|
||||
}
|
||||
|
||||
static void test_ctrls(void **_CBOR_UNUSED(_state)) {
|
||||
static void test_ctrls(void** _state _CBOR_UNUSED) {
|
||||
item = cbor_new_null();
|
||||
assert_true(cbor_is_null(copy = cbor_copy(item)));
|
||||
cbor_decref(&item);
|
||||
cbor_decref(©);
|
||||
}
|
||||
|
||||
static void test_floats(void **_CBOR_UNUSED(_state)) {
|
||||
static void test_floats(void** _state _CBOR_UNUSED) {
|
||||
item = cbor_build_float2(3.14f);
|
||||
assert_true(cbor_float_get_float2(copy = cbor_copy(item)) ==
|
||||
cbor_float_get_float2(item));
|
||||
@@ -182,7 +182,7 @@ static void test_floats(void **_CBOR_UNUSED(_state)) {
|
||||
cbor_decref(©);
|
||||
}
|
||||
|
||||
static void test_alloc_failure_simple(void **_CBOR_UNUSED(_state)) {
|
||||
static void test_alloc_failure_simple(void** _state _CBOR_UNUSED) {
|
||||
item = cbor_build_uint8(10);
|
||||
|
||||
WITH_FAILING_MALLOC({ assert_null(cbor_copy(item)); });
|
||||
@@ -191,7 +191,7 @@ static void test_alloc_failure_simple(void **_CBOR_UNUSED(_state)) {
|
||||
cbor_decref(&item);
|
||||
}
|
||||
|
||||
static void test_bytestring_alloc_failure(void **_CBOR_UNUSED(_state)) {
|
||||
static void test_bytestring_alloc_failure(void** _state _CBOR_UNUSED) {
|
||||
item = cbor_new_indefinite_bytestring();
|
||||
assert_true(cbor_bytestring_add_chunk(
|
||||
item, cbor_move(cbor_build_bytestring((cbor_data) "abc", 3))));
|
||||
@@ -202,7 +202,7 @@ static void test_bytestring_alloc_failure(void **_CBOR_UNUSED(_state)) {
|
||||
cbor_decref(&item);
|
||||
}
|
||||
|
||||
static void test_bytestring_chunk_alloc_failure(void **_CBOR_UNUSED(_state)) {
|
||||
static void test_bytestring_chunk_alloc_failure(void** _state _CBOR_UNUSED) {
|
||||
item = cbor_new_indefinite_bytestring();
|
||||
assert_true(cbor_bytestring_add_chunk(
|
||||
item, cbor_move(cbor_build_bytestring((cbor_data) "abc", 3))));
|
||||
@@ -213,7 +213,7 @@ static void test_bytestring_chunk_alloc_failure(void **_CBOR_UNUSED(_state)) {
|
||||
cbor_decref(&item);
|
||||
}
|
||||
|
||||
static void test_bytestring_chunk_append_failure(void **_CBOR_UNUSED(_state)) {
|
||||
static void test_bytestring_chunk_append_failure(void** _state _CBOR_UNUSED) {
|
||||
item = cbor_new_indefinite_bytestring();
|
||||
assert_true(cbor_bytestring_add_chunk(
|
||||
item, cbor_move(cbor_build_bytestring((cbor_data) "abc", 3))));
|
||||
@@ -228,7 +228,7 @@ static void test_bytestring_chunk_append_failure(void **_CBOR_UNUSED(_state)) {
|
||||
}
|
||||
|
||||
static void test_bytestring_second_chunk_alloc_failure(
|
||||
void **_CBOR_UNUSED(_state)) {
|
||||
void** _state _CBOR_UNUSED) {
|
||||
item = cbor_new_indefinite_bytestring();
|
||||
assert_true(cbor_bytestring_add_chunk(
|
||||
item, cbor_move(cbor_build_bytestring((cbor_data) "abc", 3))));
|
||||
@@ -245,7 +245,7 @@ static void test_bytestring_second_chunk_alloc_failure(
|
||||
cbor_decref(&item);
|
||||
}
|
||||
|
||||
static void test_string_alloc_failure(void **_CBOR_UNUSED(_state)) {
|
||||
static void test_string_alloc_failure(void** _state _CBOR_UNUSED) {
|
||||
item = cbor_new_indefinite_string();
|
||||
assert_true(cbor_string_add_chunk(item, cbor_move(cbor_build_string("abc"))));
|
||||
|
||||
@@ -255,7 +255,7 @@ static void test_string_alloc_failure(void **_CBOR_UNUSED(_state)) {
|
||||
cbor_decref(&item);
|
||||
}
|
||||
|
||||
static void test_string_chunk_alloc_failure(void **_CBOR_UNUSED(_state)) {
|
||||
static void test_string_chunk_alloc_failure(void** _state _CBOR_UNUSED) {
|
||||
item = cbor_new_indefinite_string();
|
||||
assert_true(cbor_string_add_chunk(item, cbor_move(cbor_build_string("abc"))));
|
||||
|
||||
@@ -265,7 +265,7 @@ static void test_string_chunk_alloc_failure(void **_CBOR_UNUSED(_state)) {
|
||||
cbor_decref(&item);
|
||||
}
|
||||
|
||||
static void test_string_chunk_append_failure(void **_CBOR_UNUSED(_state)) {
|
||||
static void test_string_chunk_append_failure(void** _state _CBOR_UNUSED) {
|
||||
item = cbor_new_indefinite_string();
|
||||
assert_true(cbor_string_add_chunk(item, cbor_move(cbor_build_string("abc"))));
|
||||
|
||||
@@ -278,8 +278,7 @@ static void test_string_chunk_append_failure(void **_CBOR_UNUSED(_state)) {
|
||||
cbor_decref(&item);
|
||||
}
|
||||
|
||||
static void test_string_second_chunk_alloc_failure(
|
||||
void **_CBOR_UNUSED(_state)) {
|
||||
static void test_string_second_chunk_alloc_failure(void** _state _CBOR_UNUSED) {
|
||||
item = cbor_new_indefinite_string();
|
||||
assert_true(cbor_string_add_chunk(item, cbor_move(cbor_build_string("abc"))));
|
||||
assert_true(cbor_string_add_chunk(item, cbor_move(cbor_build_string("def"))));
|
||||
@@ -294,7 +293,7 @@ static void test_string_second_chunk_alloc_failure(
|
||||
cbor_decref(&item);
|
||||
}
|
||||
|
||||
static void test_array_alloc_failure(void **_CBOR_UNUSED(_state)) {
|
||||
static void test_array_alloc_failure(void** _state _CBOR_UNUSED) {
|
||||
item = cbor_new_indefinite_array();
|
||||
assert_true(cbor_array_push(item, cbor_move(cbor_build_uint8(42))));
|
||||
|
||||
@@ -304,7 +303,7 @@ static void test_array_alloc_failure(void **_CBOR_UNUSED(_state)) {
|
||||
cbor_decref(&item);
|
||||
}
|
||||
|
||||
static void test_array_item_alloc_failure(void **_CBOR_UNUSED(_state)) {
|
||||
static void test_array_item_alloc_failure(void** _state _CBOR_UNUSED) {
|
||||
item = cbor_new_indefinite_array();
|
||||
assert_true(cbor_array_push(item, cbor_move(cbor_build_uint8(42))));
|
||||
|
||||
@@ -317,7 +316,7 @@ static void test_array_item_alloc_failure(void **_CBOR_UNUSED(_state)) {
|
||||
cbor_decref(&item);
|
||||
}
|
||||
|
||||
static void test_array_push_failure(void **_CBOR_UNUSED(_state)) {
|
||||
static void test_array_push_failure(void** _state _CBOR_UNUSED) {
|
||||
item = cbor_new_indefinite_array();
|
||||
assert_true(cbor_array_push(item, cbor_move(cbor_build_uint8(42))));
|
||||
|
||||
@@ -330,7 +329,7 @@ static void test_array_push_failure(void **_CBOR_UNUSED(_state)) {
|
||||
cbor_decref(&item);
|
||||
}
|
||||
|
||||
static void test_array_second_item_alloc_failure(void **_CBOR_UNUSED(_state)) {
|
||||
static void test_array_second_item_alloc_failure(void** _state _CBOR_UNUSED) {
|
||||
item = cbor_new_indefinite_array();
|
||||
assert_true(cbor_array_push(item, cbor_move(cbor_build_uint8(42))));
|
||||
assert_true(cbor_array_push(item, cbor_move(cbor_build_uint8(43))));
|
||||
@@ -344,7 +343,7 @@ static void test_array_second_item_alloc_failure(void **_CBOR_UNUSED(_state)) {
|
||||
cbor_decref(&item);
|
||||
}
|
||||
|
||||
static void test_map_alloc_failure(void **_CBOR_UNUSED(_state)) {
|
||||
static void test_map_alloc_failure(void** _state _CBOR_UNUSED) {
|
||||
item = cbor_new_indefinite_map();
|
||||
assert_true(
|
||||
cbor_map_add(item, (struct cbor_pair){cbor_move(cbor_build_uint8(42)),
|
||||
@@ -356,7 +355,7 @@ static void test_map_alloc_failure(void **_CBOR_UNUSED(_state)) {
|
||||
cbor_decref(&item);
|
||||
}
|
||||
|
||||
static void test_map_key_alloc_failure(void **_CBOR_UNUSED(_state)) {
|
||||
static void test_map_key_alloc_failure(void** _state _CBOR_UNUSED) {
|
||||
item = cbor_new_indefinite_map();
|
||||
assert_true(
|
||||
cbor_map_add(item, (struct cbor_pair){cbor_move(cbor_build_uint8(42)),
|
||||
@@ -370,7 +369,7 @@ static void test_map_key_alloc_failure(void **_CBOR_UNUSED(_state)) {
|
||||
cbor_decref(&item);
|
||||
}
|
||||
|
||||
static void test_map_value_alloc_failure(void **_CBOR_UNUSED(_state)) {
|
||||
static void test_map_value_alloc_failure(void** _state _CBOR_UNUSED) {
|
||||
item = cbor_new_indefinite_map();
|
||||
assert_true(
|
||||
cbor_map_add(item, (struct cbor_pair){cbor_move(cbor_build_uint8(42)),
|
||||
@@ -384,7 +383,7 @@ static void test_map_value_alloc_failure(void **_CBOR_UNUSED(_state)) {
|
||||
cbor_decref(&item);
|
||||
}
|
||||
|
||||
static void test_map_add_failure(void **_CBOR_UNUSED(_state)) {
|
||||
static void test_map_add_failure(void** _state _CBOR_UNUSED) {
|
||||
item = cbor_new_indefinite_map();
|
||||
assert_true(
|
||||
cbor_map_add(item, (struct cbor_pair){cbor_move(cbor_build_uint8(42)),
|
||||
@@ -398,7 +397,7 @@ static void test_map_add_failure(void **_CBOR_UNUSED(_state)) {
|
||||
cbor_decref(&item);
|
||||
}
|
||||
|
||||
static void test_map_second_key_failure(void **_CBOR_UNUSED(_state)) {
|
||||
static void test_map_second_key_failure(void** _state _CBOR_UNUSED) {
|
||||
item = cbor_new_indefinite_map();
|
||||
assert_true(
|
||||
cbor_map_add(item, (struct cbor_pair){cbor_move(cbor_build_uint8(42)),
|
||||
@@ -415,7 +414,7 @@ static void test_map_second_key_failure(void **_CBOR_UNUSED(_state)) {
|
||||
cbor_decref(&item);
|
||||
}
|
||||
|
||||
static void test_tag_item_alloc_failure(void **_CBOR_UNUSED(_state)) {
|
||||
static void test_tag_item_alloc_failure(void** _state _CBOR_UNUSED) {
|
||||
item = cbor_build_tag(1, cbor_move(cbor_build_uint8(42)));
|
||||
|
||||
WITH_FAILING_MALLOC({ assert_null(cbor_copy(item)); });
|
||||
@@ -424,7 +423,7 @@ static void test_tag_item_alloc_failure(void **_CBOR_UNUSED(_state)) {
|
||||
cbor_decref(&item);
|
||||
}
|
||||
|
||||
static void test_tag_alloc_failure(void **_CBOR_UNUSED(_state)) {
|
||||
static void test_tag_alloc_failure(void** _state _CBOR_UNUSED) {
|
||||
item = cbor_build_tag(1, cbor_move(cbor_build_uint8(42)));
|
||||
|
||||
WITH_MOCK_MALLOC({ assert_null(cbor_copy(item)); }, 2,
|
||||
|
||||
Reference in New Issue
Block a user