Lines Matching full:stack

10 #include "cbor/internal/stack.h"
35 struct _cbor_stack stack = _cbor_stack_init(); in test_builder_byte_string_callback_append() local
37 _cbor_stack_push(&stack, cbor_new_indefinite_bytestring(), 0)); in test_builder_byte_string_callback_append()
42 .stack = &stack, in test_builder_byte_string_callback_append()
49 assert_size_equal(context.stack->size, 1); in test_builder_byte_string_callback_append()
51 cbor_item_t* bytestring = stack.top->item; in test_builder_byte_string_callback_append()
70 _cbor_stack_pop(&stack); in test_builder_byte_string_callback_append()
75 struct _cbor_stack stack = _cbor_stack_init(); in test_builder_byte_string_callback_append_alloc_failure() local
77 _cbor_stack_push(&stack, cbor_new_indefinite_bytestring(), 0)); in test_builder_byte_string_callback_append_alloc_failure()
82 .stack = &stack, in test_builder_byte_string_callback_append_alloc_failure()
90 assert_size_equal(context.stack->size, 1); in test_builder_byte_string_callback_append_alloc_failure()
92 // The stack remains unchanged in test_builder_byte_string_callback_append_alloc_failure()
93 cbor_item_t* bytestring = stack.top->item; in test_builder_byte_string_callback_append_alloc_failure()
102 _cbor_stack_pop(&stack); in test_builder_byte_string_callback_append_alloc_failure()
107 struct _cbor_stack stack = _cbor_stack_init(); in test_builder_byte_string_callback_append_item_alloc_failure() local
109 _cbor_stack_push(&stack, cbor_new_indefinite_bytestring(), 0)); in test_builder_byte_string_callback_append_item_alloc_failure()
114 .stack = &stack, in test_builder_byte_string_callback_append_item_alloc_failure()
124 assert_size_equal(context.stack->size, 1); in test_builder_byte_string_callback_append_item_alloc_failure()
126 // The stack remains unchanged in test_builder_byte_string_callback_append_item_alloc_failure()
127 cbor_item_t* bytestring = stack.top->item; in test_builder_byte_string_callback_append_item_alloc_failure()
136 _cbor_stack_pop(&stack); in test_builder_byte_string_callback_append_item_alloc_failure()
141 struct _cbor_stack stack = _cbor_stack_init(); in test_builder_byte_string_callback_append_parent_alloc_failure() local
143 _cbor_stack_push(&stack, cbor_new_indefinite_bytestring(), 0)); in test_builder_byte_string_callback_append_parent_alloc_failure()
148 .stack = &stack, in test_builder_byte_string_callback_append_parent_alloc_failure()
151 // Allocate new item, but fail to push it into the parent on the stack in test_builder_byte_string_callback_append_parent_alloc_failure()
158 assert_size_equal(context.stack->size, 1); in test_builder_byte_string_callback_append_parent_alloc_failure()
160 // The stack remains unchanged in test_builder_byte_string_callback_append_parent_alloc_failure()
161 cbor_item_t* bytestring = stack.top->item; in test_builder_byte_string_callback_append_parent_alloc_failure()
170 _cbor_stack_pop(&stack); in test_builder_byte_string_callback_append_parent_alloc_failure()
175 struct _cbor_stack stack = _cbor_stack_init(); in test_builder_string_callback_append() local
176 assert_non_null(_cbor_stack_push(&stack, cbor_new_indefinite_string(), 0)); in test_builder_string_callback_append()
181 .stack = &stack, in test_builder_string_callback_append()
188 assert_size_equal(context.stack->size, 1); in test_builder_string_callback_append()
190 cbor_item_t* string = stack.top->item; in test_builder_string_callback_append()
207 _cbor_stack_pop(&stack); in test_builder_string_callback_append()
212 struct _cbor_stack stack = _cbor_stack_init(); in test_builder_string_callback_append_alloc_failure() local
213 assert_non_null(_cbor_stack_push(&stack, cbor_new_indefinite_string(), 0)); in test_builder_string_callback_append_alloc_failure()
218 .stack = &stack, in test_builder_string_callback_append_alloc_failure()
226 assert_size_equal(context.stack->size, 1); in test_builder_string_callback_append_alloc_failure()
228 // The stack remains unchanged in test_builder_string_callback_append_alloc_failure()
229 cbor_item_t* string = stack.top->item; in test_builder_string_callback_append_alloc_failure()
238 _cbor_stack_pop(&stack); in test_builder_string_callback_append_alloc_failure()
243 struct _cbor_stack stack = _cbor_stack_init(); in test_builder_string_callback_append_item_alloc_failure() local
244 assert_non_null(_cbor_stack_push(&stack, cbor_new_indefinite_string(), 0)); in test_builder_string_callback_append_item_alloc_failure()
249 .stack = &stack, in test_builder_string_callback_append_item_alloc_failure()
258 assert_size_equal(context.stack->size, 1); in test_builder_string_callback_append_item_alloc_failure()
260 // The stack remains unchanged in test_builder_string_callback_append_item_alloc_failure()
261 cbor_item_t* string = stack.top->item; in test_builder_string_callback_append_item_alloc_failure()
270 _cbor_stack_pop(&stack); in test_builder_string_callback_append_item_alloc_failure()
275 struct _cbor_stack stack = _cbor_stack_init(); in test_builder_string_callback_append_parent_alloc_failure() local
276 assert_non_null(_cbor_stack_push(&stack, cbor_new_indefinite_string(), 0)); in test_builder_string_callback_append_parent_alloc_failure()
281 .stack = &stack, in test_builder_string_callback_append_parent_alloc_failure()
284 // Allocate new item, but fail to push it into the parent on the stack in test_builder_string_callback_append_parent_alloc_failure()
290 assert_size_equal(context.stack->size, 1); in test_builder_string_callback_append_parent_alloc_failure()
292 // The stack remains unchanged in test_builder_string_callback_append_parent_alloc_failure()
293 cbor_item_t* string = stack.top->item; in test_builder_string_callback_append_parent_alloc_failure()
302 _cbor_stack_pop(&stack); in test_builder_string_callback_append_parent_alloc_failure()
306 struct _cbor_stack stack = _cbor_stack_init(); in test_append_array_failure() local
307 assert_non_null(_cbor_stack_push(&stack, cbor_new_definite_array(0), 0)); in test_append_array_failure()
308 stack.top->subitems = 1; in test_append_array_failure()
313 .stack = &stack, in test_append_array_failure()
321 assert_size_equal(context.stack->size, 1); in test_append_array_failure()
323 // The stack remains unchanged in test_append_array_failure()
324 cbor_item_t* array = stack.top->item; in test_append_array_failure()
331 _cbor_stack_pop(&stack); in test_append_array_failure()
335 struct _cbor_stack stack = _cbor_stack_init(); in test_append_map_failure() local
337 _cbor_stack_push(&stack, cbor_new_indefinite_map(), /*subitems=*/0)); in test_append_map_failure()
342 .stack = &stack, in test_append_map_failure()
350 assert_size_equal(context.stack->size, 1); in test_append_map_failure()
352 // The stack remains unchanged in test_append_map_failure()
353 cbor_item_t* map = stack.top->item; in test_append_map_failure()
360 _cbor_stack_pop(&stack); in test_append_map_failure()
375 struct _cbor_stack stack = _cbor_stack_init(); in test_invalid_state_indef_break() local
376 assert_non_null(_cbor_stack_push(&stack, cbor_new_int8(), /*subitems=*/0)); in test_invalid_state_indef_break()
381 .stack = &stack, in test_invalid_state_indef_break()
388 assert_size_equal(context.stack->size, 1); in test_invalid_state_indef_break()
389 // The stack remains unchanged in test_invalid_state_indef_break()
390 cbor_item_t* small_int = stack.top->item; in test_invalid_state_indef_break()
395 _cbor_stack_pop(&stack); in test_invalid_state_indef_break()