Skip to content

Commit 63ed319

Browse files
committed
Test: Errors: Test OOM paths for binary type
1 parent 0fdd134 commit 63ed319

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/units/errs.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9037,6 +9037,7 @@ static bool test_err_load_alloc_oom_2(
90379037
" - &a1 {"
90389038
" kind: cat,\n"
90399039
" sound: meow,\n"
9040+
" bin: d2FsdGhhemFyYm9iYWx0aGF6YXI=,\n"
90409041
" position: &a2 [ 1, &my_value 2, 1],\n"
90419042
" flags: &a3 [\n"
90429043
" first,\n"
@@ -9047,6 +9048,7 @@ static bool test_err_load_alloc_oom_2(
90479048
" }\n"
90489049
" - kind: snake\n"
90499050
" sound: &a5 hiss\n"
9051+
" bin: &a8 d2FsdGhhemFyYm9iYWx0aGF6YXI=\n"
90509052
" position: &a6 [ 3, 1, 0]\n"
90519053
" flags: &a7 [\n"
90529054
" first,\n"
@@ -9058,13 +9060,16 @@ static bool test_err_load_alloc_oom_2(
90589060
" - *a1\n"
90599061
" - kind: snake\n"
90609062
" sound: *a5\n"
9063+
" bin: *a8\n"
90619064
" position: *a6\n"
90629065
" flags: *a7\n"
90639066
" value: *my_value\n";
90649067
struct animal_s {
90659068
char *kind;
90669069
char *sound;
90679070
int **position;
9071+
uint8_t *bin;
9072+
size_t bin_len;
90689073
unsigned position_count;
90699074
enum test_f *flags;
90709075
int value;
@@ -9084,6 +9089,8 @@ static bool test_err_load_alloc_oom_2(
90849089
CYAML_FIELD_SEQUENCE("position", CYAML_FLAG_POINTER,
90859090
struct animal_s, position,
90869091
&position_entry_schema, 0, CYAML_UNLIMITED),
9092+
CYAML_FIELD_BINARY("bin", CYAML_FLAG_POINTER,
9093+
struct animal_s, bin, 0, CYAML_UNLIMITED),
90879094
CYAML_FIELD_FLAGS("flags",
90889095
CYAML_FLAG_STRICT | CYAML_FLAG_POINTER,
90899096
struct animal_s, flags, strings, 4),
@@ -9322,6 +9329,7 @@ static bool test_err_save_alloc_oom_2(
93229329
"animals:\n"
93239330
" - kind: cat\n"
93249331
" sound: meow\n"
9332+
" bin: d2FsdGhhemFyYm9iYWx0aGF6YXI=\n"
93259333
" position: [ 1, 2, 1]\n"
93269334
" flags:\n"
93279335
" - first\n"
@@ -9330,6 +9338,7 @@ static bool test_err_save_alloc_oom_2(
93309338
" - fourth\n"
93319339
" - kind: snake\n"
93329340
" sound: hiss\n"
9341+
" bin: d2FsdGhhemFyYm9iYWx0aGF6YXI=\n"
93339342
" position: [ 3, 1, 0]\n"
93349343
" flags:\n"
93359344
" - first\n"
@@ -9340,6 +9349,8 @@ static bool test_err_save_alloc_oom_2(
93409349
char *kind;
93419350
char *sound;
93429351
int **position;
9352+
uint8_t *bin;
9353+
size_t bin_len;
93439354
unsigned position_count;
93449355
enum test_f *flags;
93459356
};
@@ -9358,6 +9369,8 @@ static bool test_err_save_alloc_oom_2(
93589369
CYAML_FIELD_SEQUENCE("position", CYAML_FLAG_POINTER,
93599370
struct animal_s, position,
93609371
&position_entry_schema, 0, CYAML_UNLIMITED),
9372+
CYAML_FIELD_BINARY("bin", CYAML_FLAG_POINTER,
9373+
struct animal_s, bin, 0, CYAML_UNLIMITED),
93619374
CYAML_FIELD_FLAGS("flags",
93629375
CYAML_FLAG_STRICT | CYAML_FLAG_POINTER,
93639376
struct animal_s, flags, strings, 4),
@@ -9602,6 +9615,7 @@ static bool test_err_copy_alloc_oom_2(
96029615
"animals:\n"
96039616
" - kind: cat\n"
96049617
" sound: meow\n"
9618+
" bin: d2FsdGhhemFyYm9iYWx0aGF6YXI=\n"
96059619
" position: [ 1, 2, 1]\n"
96069620
" flags:\n"
96079621
" - first\n"
@@ -9610,6 +9624,7 @@ static bool test_err_copy_alloc_oom_2(
96109624
" - fourth\n"
96119625
" - kind: snake\n"
96129626
" sound: hiss\n"
9627+
" bin: d2FsdGhhemFyYm9iYWx0aGF6YXI=\n"
96139628
" position: [ 3, 1, 0]\n"
96149629
" flags:\n"
96159630
" - first\n"
@@ -9620,6 +9635,8 @@ static bool test_err_copy_alloc_oom_2(
96209635
char *kind;
96219636
char *sound;
96229637
int **position;
9638+
uint8_t *bin;
9639+
size_t bin_len;
96239640
unsigned position_count;
96249641
enum test_f *flags;
96259642
};
@@ -9639,6 +9656,8 @@ static bool test_err_copy_alloc_oom_2(
96399656
CYAML_FIELD_SEQUENCE("position", CYAML_FLAG_POINTER,
96409657
struct animal_s, position,
96419658
&position_entry_schema, 0, CYAML_UNLIMITED),
9659+
CYAML_FIELD_BINARY("bin", CYAML_FLAG_POINTER,
9660+
struct animal_s, bin, 0, CYAML_UNLIMITED),
96429661
CYAML_FIELD_FLAGS("flags",
96439662
CYAML_FLAG_STRICT | CYAML_FLAG_POINTER,
96449663
struct animal_s, flags, strings, 4),

0 commit comments

Comments
 (0)