From 3626272a461c94c0569c197eb2f795bd4c0ff2c6 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Wed, 16 Aug 2023 22:48:37 -0500 Subject: [PATCH] Progress: Continue re-designing of the memory logic, mostly getting tests back in synchronization. Get the tests working. Some of the tests I am not mocking the allocation and performing the real allocation actions. This allows for the unit test to also test memory if run with valgrind. I did this after getting much of the work done and so I ended up not consistently doing this on all of the "works" tests. Generally, the tests for functions with the double 's' have the actual memory allocations. --- build/stand_alone/fake.config.h | 244 +++++++++------ build/stand_alone/fake.settings | 3 +- level_0/f_account/tests/unit/c/mock-account.h | 2 + .../tests/unit/c/test-account-ss_delete_callback.c | 14 +- .../unit/c/test-account-ss_destroy_callback.c | 14 +- level_0/f_account/tests/unit/c/test-account.c | 3 +- level_0/f_directory/c/directory/listing.h | 25 +- level_0/f_directory/c/directory/recurse_do.h | 27 +- level_0/f_directory/c/directory/status.h | 23 ++ level_0/f_directory/data/build/settings-mocks | 2 + level_0/f_directory/data/build/settings-tests | 6 +- level_0/f_directory/tests/unit/c/mock-directory.c | 35 +++ level_0/f_directory/tests/unit/c/mock-directory.h | 7 + .../c/test-directory-listings_delete_callback.c | 22 +- .../c/test-directory-listings_destroy_callback.c | 22 +- .../c/test-directory-listingss_delete_callback.c | 261 ++++++++++++++++ .../c/test-directory-listingss_delete_callback.h | 27 ++ .../c/test-directory-listingss_destroy_callback.c | 261 ++++++++++++++++ .../c/test-directory-listingss_destroy_callback.h | 27 ++ .../test-directory-recurse_doss_delete_callback.c | 342 +++++++++++++++++++++ .../test-directory-recurse_doss_delete_callback.h | 27 ++ .../test-directory-recurse_doss_destroy_callback.c | 342 +++++++++++++++++++++ .../test-directory-recurse_doss_destroy_callback.h | 27 ++ .../c/test-directory-statusss_delete_callback.c | 72 +++++ .../c/test-directory-statusss_delete_callback.h | 27 ++ .../c/test-directory-statusss_destroy_callback.c | 72 +++++ .../c/test-directory-statusss_destroy_callback.h | 27 ++ level_0/f_directory/tests/unit/c/test-directory.c | 27 +- level_0/f_directory/tests/unit/c/test-directory.h | 6 + level_0/f_fss/c/fss/item.h | 24 +- level_0/f_fss/c/fss/named.h | 24 ++ level_0/f_fss/c/fss/nest.c | 20 ++ level_0/f_fss/c/fss/nest.h | 24 ++ level_0/f_fss/c/fss/set.h | 24 ++ level_0/f_fss/c/fss/set_quote.h | 76 +++-- level_0/f_fss/c/fss/simple_packet.c | 2 +- level_0/f_fss/c/fss/simple_packet.h | 4 +- level_0/f_fss/data/build/settings-mocks | 10 + level_0/f_fss/data/build/settings-tests | 16 +- level_0/f_fss/data/build/testfile | 2 +- level_0/f_fss/tests/unit/c/mock-fss.c | 173 ++++++++++- level_0/f_fss/tests/unit/c/mock-fss.h | 27 ++ .../tests/unit/c/test-fss-items_delete_callback.c | 190 +----------- .../tests/unit/c/test-fss-items_delete_callback.h | 6 +- .../tests/unit/c/test-fss-items_destroy_callback.c | 190 +----------- .../tests/unit/c/test-fss-items_destroy_callback.h | 6 +- .../tests/unit/c/test-fss-itemss_delete_callback.c | 72 +++++ .../tests/unit/c/test-fss-itemss_delete_callback.h | 27 ++ .../unit/c/test-fss-itemss_destroy_callback.c | 72 +++++ .../unit/c/test-fss-itemss_destroy_callback.h | 27 ++ .../tests/unit/c/test-fss-nameds_delete_callback.c | 84 +++++ .../tests/unit/c/test-fss-nameds_delete_callback.h | 27 ++ .../unit/c/test-fss-nameds_destroy_callback.c | 84 +++++ .../unit/c/test-fss-nameds_destroy_callback.h | 27 ++ .../unit/c/test-fss-namedss_delete_callback.c | 96 ++++++ .../unit/c/test-fss-namedss_delete_callback.h | 27 ++ .../unit/c/test-fss-namedss_destroy_callback.c | 96 ++++++ .../unit/c/test-fss-namedss_destroy_callback.h | 27 ++ .../tests/unit/c/test-fss-nests_delete_callback.c | 88 ++++++ .../tests/unit/c/test-fss-nests_delete_callback.h | 27 ++ .../tests/unit/c/test-fss-nests_destroy_callback.c | 88 ++++++ .../tests/unit/c/test-fss-nests_destroy_callback.h | 27 ++ .../tests/unit/c/test-fss-nestss_delete_callback.c | 82 +++++ .../tests/unit/c/test-fss-nestss_delete_callback.h | 27 ++ .../unit/c/test-fss-nestss_destroy_callback.c | 82 +++++ .../unit/c/test-fss-nestss_destroy_callback.h | 27 ++ .../unit/c/test-fss-set_quotes_delete_callback.c | 105 +++++++ .../unit/c/test-fss-set_quotes_delete_callback.h | 27 ++ .../unit/c/test-fss-set_quotes_destroy_callback.c | 105 +++++++ .../unit/c/test-fss-set_quotes_destroy_callback.h | 27 ++ .../unit/c/test-fss-set_quotess_delete_callback.c | 114 +++++++ .../unit/c/test-fss-set_quotess_delete_callback.h | 27 ++ .../unit/c/test-fss-set_quotess_destroy_callback.c | 114 +++++++ .../unit/c/test-fss-set_quotess_destroy_callback.h | 27 ++ .../tests/unit/c/test-fss-sets_delete_callback.c | 66 ++++ .../tests/unit/c/test-fss-sets_delete_callback.h | 27 ++ .../tests/unit/c/test-fss-sets_destroy_callback.c | 66 ++++ .../tests/unit/c/test-fss-sets_destroy_callback.h | 27 ++ .../tests/unit/c/test-fss-setss_delete_callback.c | 75 +++++ .../tests/unit/c/test-fss-setss_delete_callback.h | 27 ++ .../tests/unit/c/test-fss-setss_destroy_callback.c | 75 +++++ .../tests/unit/c/test-fss-setss_destroy_callback.h | 27 ++ .../c/test-fss-simple_packets_delete_callback.c | 51 +++ .../c/test-fss-simple_packets_delete_callback.h | 27 ++ .../c/test-fss-simple_packets_destroy_callback.c | 51 +++ .../c/test-fss-simple_packets_destroy_callback.h | 27 ++ .../c/test-fss-simple_packetss_delete_callback.c | 72 +++++ .../c/test-fss-simple_packetss_delete_callback.h | 27 ++ .../c/test-fss-simple_packetss_destroy_callback.c | 72 +++++ .../c/test-fss-simple_packetss_destroy_callback.h | 27 ++ level_0/f_fss/tests/unit/c/test-fss.c | 85 +++++ level_0/f_fss/tests/unit/c/test-fss.h | 44 +-- level_0/f_iki/data/build/settings-tests | 3 +- level_0/f_iki/tests/unit/c/mock-iki.c | 9 +- level_0/f_iki/tests/unit/c/mock-iki.h | 3 + .../tests/unit/c/test-iki-datas_delete_callback.c | 28 +- .../tests/unit/c/test-iki-datas_destroy_callback.c | 28 +- .../tests/unit/c/test-iki-datass_delete_callback.c | 139 +++++++++ .../tests/unit/c/test-iki-datass_delete_callback.h | 27 ++ .../unit/c/test-iki-datass_destroy_callback.c | 139 +++++++++ .../unit/c/test-iki-datass_destroy_callback.h | 27 ++ level_0/f_iki/tests/unit/c/test-iki.c | 10 +- level_0/f_iki/tests/unit/c/test-iki.h | 4 +- level_0/f_memory/c/memory/arrayss.c | 52 ---- level_0/f_memory/c/memory/arrayss.h | 115 ------- level_0/f_memory/data/build/settings | 4 +- level_0/f_memory/data/build/settings-tests | 1 - level_0/f_memory/tests/unit/c/test-memory.c | 9 - level_0/f_memory/tests/unit/c/test-memory.h | 13 - level_0/f_type_array/data/build/settings-mocks | 2 + level_0/f_type_array/data/build/settings-tests | 34 +- .../f_type_array/tests/unit/c/mock-type_array.c | 49 +++ .../f_type_array/tests/unit/c/mock-type_array.h | 17 +- .../unit/c/test-type_array-cells_delete_callback.c | 45 --- .../unit/c/test-type_array-cells_delete_callback.h | 27 -- .../c/test-type_array-cells_destroy_callback.c | 45 --- .../c/test-type_array-cells_destroy_callback.h | 27 -- .../c/test-type_array-cellss_delete_callback.c | 57 ++++ .../c/test-type_array-cellss_delete_callback.h | 27 ++ .../c/test-type_array-cellss_destroy_callback.c | 57 ++++ .../c/test-type_array-cellss_destroy_callback.h | 27 ++ .../unit/c/test-type_array-files_delete_callback.c | 45 --- .../unit/c/test-type_array-files_delete_callback.h | 27 -- .../c/test-type_array-files_destroy_callback.c | 45 --- .../c/test-type_array-files_destroy_callback.h | 27 -- .../c/test-type_array-filess_delete_callback.c | 57 ++++ .../c/test-type_array-filess_delete_callback.h | 27 ++ .../c/test-type_array-filess_destroy_callback.c | 57 ++++ .../c/test-type_array-filess_destroy_callback.h | 27 ++ .../c/test-type_array-fll_ids_delete_callback.c | 45 --- .../c/test-type_array-fll_ids_delete_callback.h | 27 -- .../c/test-type_array-fll_ids_destroy_callback.c | 45 --- .../c/test-type_array-fll_ids_destroy_callback.h | 27 -- .../c/test-type_array-fll_idss_delete_callback.c | 57 ++++ .../c/test-type_array-fll_idss_delete_callback.h | 27 ++ .../c/test-type_array-fll_idss_destroy_callback.c | 57 ++++ .../c/test-type_array-fll_idss_destroy_callback.h | 27 ++ .../c/test-type_array-int128s_delete_callback.c | 45 --- .../c/test-type_array-int128s_delete_callback.h | 27 -- .../c/test-type_array-int128s_destroy_callback.c | 45 --- .../c/test-type_array-int128s_destroy_callback.h | 27 -- .../c/test-type_array-int128ss_delete_callback.c | 57 ++++ .../c/test-type_array-int128ss_delete_callback.h | 27 ++ .../c/test-type_array-int128ss_destroy_callback.c | 57 ++++ .../c/test-type_array-int128ss_destroy_callback.h | 27 ++ .../c/test-type_array-int16s_delete_callback.c | 45 --- .../c/test-type_array-int16s_delete_callback.h | 27 -- .../c/test-type_array-int16s_destroy_callback.c | 45 --- .../c/test-type_array-int16s_destroy_callback.h | 27 -- .../c/test-type_array-int16ss_delete_callback.c | 57 ++++ .../c/test-type_array-int16ss_delete_callback.h | 27 ++ .../c/test-type_array-int16ss_destroy_callback.c | 57 ++++ .../c/test-type_array-int16ss_destroy_callback.h | 27 ++ .../c/test-type_array-int32s_delete_callback.c | 45 --- .../c/test-type_array-int32s_delete_callback.h | 27 -- .../c/test-type_array-int32s_destroy_callback.c | 45 --- .../c/test-type_array-int32s_destroy_callback.h | 27 -- .../c/test-type_array-int32ss_delete_callback.c | 57 ++++ .../c/test-type_array-int32ss_delete_callback.h | 27 ++ .../c/test-type_array-int32ss_destroy_callback.c | 57 ++++ .../c/test-type_array-int32ss_destroy_callback.h | 27 ++ .../c/test-type_array-int64s_delete_callback.c | 45 --- .../c/test-type_array-int64s_delete_callback.h | 27 -- .../c/test-type_array-int64s_destroy_callback.c | 45 --- .../c/test-type_array-int64s_destroy_callback.h | 27 -- .../c/test-type_array-int64ss_delete_callback.c | 57 ++++ .../c/test-type_array-int64ss_delete_callback.h | 27 ++ .../c/test-type_array-int64ss_destroy_callback.c | 57 ++++ .../c/test-type_array-int64ss_destroy_callback.h | 27 ++ .../unit/c/test-type_array-int8s_delete_callback.c | 45 --- .../unit/c/test-type_array-int8s_delete_callback.h | 27 -- .../c/test-type_array-int8s_destroy_callback.c | 45 --- .../c/test-type_array-int8s_destroy_callback.h | 27 -- .../c/test-type_array-int8ss_delete_callback.c | 57 ++++ .../c/test-type_array-int8ss_delete_callback.h | 27 ++ .../c/test-type_array-int8ss_destroy_callback.c | 57 ++++ .../c/test-type_array-int8ss_destroy_callback.h | 27 ++ ...t-type_array-number_unsigneds_delete_callback.c | 45 --- ...t-type_array-number_unsigneds_delete_callback.h | 27 -- ...-type_array-number_unsigneds_destroy_callback.c | 45 --- ...-type_array-number_unsigneds_destroy_callback.h | 27 -- ...-type_array-number_unsignedss_delete_callback.c | 57 ++++ ...-type_array-number_unsignedss_delete_callback.h | 27 ++ ...type_array-number_unsignedss_destroy_callback.c | 57 ++++ ...type_array-number_unsignedss_destroy_callback.h | 27 ++ .../unit/c/test-type_array-polls_delete_callback.c | 45 --- .../unit/c/test-type_array-polls_delete_callback.h | 27 -- .../c/test-type_array-polls_destroy_callback.c | 45 --- .../c/test-type_array-polls_destroy_callback.h | 27 -- .../c/test-type_array-pollss_delete_callback.c | 57 ++++ .../c/test-type_array-pollss_delete_callback.h | 27 ++ .../c/test-type_array-pollss_destroy_callback.c | 57 ++++ .../c/test-type_array-pollss_destroy_callback.h | 27 ++ .../c/test-type_array-states_delete_callback.c | 45 --- .../c/test-type_array-states_delete_callback.h | 27 -- .../c/test-type_array-states_destroy_callback.c | 45 --- .../c/test-type_array-states_destroy_callback.h | 27 -- .../c/test-type_array-statess_delete_callback.c | 57 ++++ .../c/test-type_array-statess_delete_callback.h | 27 ++ .../c/test-type_array-statess_destroy_callback.c | 57 ++++ .../c/test-type_array-statess_destroy_callback.h | 27 ++ .../c/test-type_array-statuss_delete_callback.c | 45 --- .../c/test-type_array-statuss_delete_callback.h | 27 -- .../c/test-type_array-statuss_destroy_callback.c | 45 --- .../c/test-type_array-statuss_destroy_callback.h | 27 -- .../c/test-type_array-statusss_delete_callback.c | 57 ++++ .../c/test-type_array-statusss_delete_callback.h | 27 ++ .../c/test-type_array-statusss_destroy_callback.c | 57 ++++ .../c/test-type_array-statusss_destroy_callback.h | 27 ++ .../c/test-type_array-uint128s_delete_callback.c | 45 --- .../c/test-type_array-uint128s_delete_callback.h | 27 -- .../c/test-type_array-uint128s_destroy_callback.c | 45 --- .../c/test-type_array-uint128s_destroy_callback.h | 27 -- .../c/test-type_array-uint128ss_delete_callback.c | 57 ++++ .../c/test-type_array-uint128ss_delete_callback.h | 27 ++ .../c/test-type_array-uint128ss_destroy_callback.c | 57 ++++ .../c/test-type_array-uint128ss_destroy_callback.h | 27 ++ .../c/test-type_array-uint16s_delete_callback.c | 45 --- .../c/test-type_array-uint16s_delete_callback.h | 27 -- .../c/test-type_array-uint16s_destroy_callback.c | 45 --- .../c/test-type_array-uint16s_destroy_callback.h | 27 -- .../c/test-type_array-uint16ss_delete_callback.c | 57 ++++ .../c/test-type_array-uint16ss_delete_callback.h | 27 ++ .../c/test-type_array-uint16ss_destroy_callback.c | 57 ++++ .../c/test-type_array-uint16ss_destroy_callback.h | 27 ++ .../c/test-type_array-uint32s_delete_callback.c | 45 --- .../c/test-type_array-uint32s_delete_callback.h | 27 -- .../c/test-type_array-uint32s_destroy_callback.c | 45 --- .../c/test-type_array-uint32s_destroy_callback.h | 27 -- .../c/test-type_array-uint32ss_delete_callback.c | 57 ++++ .../c/test-type_array-uint32ss_delete_callback.h | 27 ++ .../c/test-type_array-uint32ss_destroy_callback.c | 57 ++++ .../c/test-type_array-uint32ss_destroy_callback.h | 27 ++ .../c/test-type_array-uint64s_delete_callback.c | 45 --- .../c/test-type_array-uint64s_delete_callback.h | 27 -- .../c/test-type_array-uint64s_destroy_callback.c | 45 --- .../c/test-type_array-uint64s_destroy_callback.h | 27 -- .../c/test-type_array-uint64ss_delete_callback.c | 57 ++++ .../c/test-type_array-uint64ss_delete_callback.h | 27 ++ .../c/test-type_array-uint64ss_destroy_callback.c | 57 ++++ .../c/test-type_array-uint64ss_destroy_callback.h | 27 ++ .../c/test-type_array-uint8s_delete_callback.c | 45 --- .../c/test-type_array-uint8s_delete_callback.h | 27 -- .../c/test-type_array-uint8s_destroy_callback.c | 45 --- .../c/test-type_array-uint8s_destroy_callback.h | 27 -- .../c/test-type_array-uint8ss_delete_callback.c | 57 ++++ .../c/test-type_array-uint8ss_delete_callback.h | 27 ++ .../c/test-type_array-uint8ss_destroy_callback.c | 57 ++++ .../c/test-type_array-uint8ss_destroy_callback.h | 27 ++ .../f_type_array/tests/unit/c/test-type_array.c | 204 ++++++------ .../f_type_array/tests/unit/c/test-type_array.h | 71 +++-- 251 files changed, 8242 insertions(+), 3395 deletions(-) create mode 100644 level_0/f_directory/tests/unit/c/test-directory-listingss_delete_callback.c create mode 100644 level_0/f_directory/tests/unit/c/test-directory-listingss_delete_callback.h create mode 100644 level_0/f_directory/tests/unit/c/test-directory-listingss_destroy_callback.c create mode 100644 level_0/f_directory/tests/unit/c/test-directory-listingss_destroy_callback.h create mode 100644 level_0/f_directory/tests/unit/c/test-directory-recurse_doss_delete_callback.c create mode 100644 level_0/f_directory/tests/unit/c/test-directory-recurse_doss_delete_callback.h create mode 100644 level_0/f_directory/tests/unit/c/test-directory-recurse_doss_destroy_callback.c create mode 100644 level_0/f_directory/tests/unit/c/test-directory-recurse_doss_destroy_callback.h create mode 100644 level_0/f_directory/tests/unit/c/test-directory-statusss_delete_callback.c create mode 100644 level_0/f_directory/tests/unit/c/test-directory-statusss_delete_callback.h create mode 100644 level_0/f_directory/tests/unit/c/test-directory-statusss_destroy_callback.c create mode 100644 level_0/f_directory/tests/unit/c/test-directory-statusss_destroy_callback.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-itemss_delete_callback.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-itemss_delete_callback.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-itemss_destroy_callback.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-itemss_destroy_callback.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-nameds_delete_callback.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-nameds_delete_callback.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-nameds_destroy_callback.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-nameds_destroy_callback.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-namedss_delete_callback.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-namedss_delete_callback.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-namedss_destroy_callback.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-namedss_destroy_callback.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-nests_delete_callback.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-nests_delete_callback.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-nests_destroy_callback.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-nests_destroy_callback.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-nestss_delete_callback.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-nestss_delete_callback.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-nestss_destroy_callback.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-nestss_destroy_callback.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-set_quotes_delete_callback.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-set_quotes_delete_callback.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-set_quotes_destroy_callback.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-set_quotes_destroy_callback.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-set_quotess_delete_callback.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-set_quotess_delete_callback.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-set_quotess_destroy_callback.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-set_quotess_destroy_callback.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-sets_delete_callback.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-sets_delete_callback.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-sets_destroy_callback.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-sets_destroy_callback.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-setss_delete_callback.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-setss_delete_callback.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-setss_destroy_callback.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-setss_destroy_callback.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-simple_packets_delete_callback.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-simple_packets_delete_callback.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-simple_packets_destroy_callback.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-simple_packets_destroy_callback.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-simple_packetss_delete_callback.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-simple_packetss_delete_callback.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-simple_packetss_destroy_callback.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-simple_packetss_destroy_callback.h create mode 100644 level_0/f_iki/tests/unit/c/test-iki-datass_delete_callback.c create mode 100644 level_0/f_iki/tests/unit/c/test-iki-datass_delete_callback.h create mode 100644 level_0/f_iki/tests/unit/c/test-iki-datass_destroy_callback.c create mode 100644 level_0/f_iki/tests/unit/c/test-iki-datass_destroy_callback.h delete mode 100644 level_0/f_memory/c/memory/arrayss.c delete mode 100644 level_0/f_memory/c/memory/arrayss.h delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-cells_delete_callback.c delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-cells_delete_callback.h delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-cells_destroy_callback.c delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-cells_destroy_callback.h create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-cellss_delete_callback.c create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-cellss_delete_callback.h create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-cellss_destroy_callback.c create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-cellss_destroy_callback.h delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-files_delete_callback.c delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-files_delete_callback.h delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-files_destroy_callback.c delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-files_destroy_callback.h create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-filess_delete_callback.c create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-filess_delete_callback.h create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-filess_destroy_callback.c create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-filess_destroy_callback.h delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_delete_callback.c delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_delete_callback.h delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_destroy_callback.c delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_destroy_callback.h create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_delete_callback.c create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_delete_callback.h create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_destroy_callback.c create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_destroy_callback.h delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-int128s_delete_callback.c delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-int128s_delete_callback.h delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-int128s_destroy_callback.c delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-int128s_destroy_callback.h create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-int128ss_delete_callback.c create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-int128ss_delete_callback.h create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-int128ss_destroy_callback.c create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-int128ss_destroy_callback.h delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-int16s_delete_callback.c delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-int16s_delete_callback.h delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-int16s_destroy_callback.c delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-int16s_destroy_callback.h create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-int16ss_delete_callback.c create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-int16ss_delete_callback.h create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-int16ss_destroy_callback.c create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-int16ss_destroy_callback.h delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-int32s_delete_callback.c delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-int32s_delete_callback.h delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-int32s_destroy_callback.c delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-int32s_destroy_callback.h create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-int32ss_delete_callback.c create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-int32ss_delete_callback.h create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-int32ss_destroy_callback.c create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-int32ss_destroy_callback.h delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-int64s_delete_callback.c delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-int64s_delete_callback.h delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-int64s_destroy_callback.c delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-int64s_destroy_callback.h create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-int64ss_delete_callback.c create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-int64ss_delete_callback.h create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-int64ss_destroy_callback.c create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-int64ss_destroy_callback.h delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-int8s_delete_callback.c delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-int8s_delete_callback.h delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-int8s_destroy_callback.c delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-int8s_destroy_callback.h create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-int8ss_delete_callback.c create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-int8ss_delete_callback.h create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-int8ss_destroy_callback.c create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-int8ss_destroy_callback.h delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_delete_callback.c delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_delete_callback.h delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_destroy_callback.c delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_destroy_callback.h create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_delete_callback.c create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_delete_callback.h create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_destroy_callback.c create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_destroy_callback.h delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-polls_delete_callback.c delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-polls_delete_callback.h delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-polls_destroy_callback.c delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-polls_destroy_callback.h create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-pollss_delete_callback.c create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-pollss_delete_callback.h create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-pollss_destroy_callback.c create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-pollss_destroy_callback.h delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-states_delete_callback.c delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-states_delete_callback.h delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-states_destroy_callback.c delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-states_destroy_callback.h create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-statess_delete_callback.c create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-statess_delete_callback.h create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-statess_destroy_callback.c create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-statess_destroy_callback.h delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-statuss_delete_callback.c delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-statuss_delete_callback.h delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-statuss_destroy_callback.c delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-statuss_destroy_callback.h create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-statusss_delete_callback.c create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-statusss_delete_callback.h create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-statusss_destroy_callback.c create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-statusss_destroy_callback.h delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-uint128s_delete_callback.c delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-uint128s_delete_callback.h delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-uint128s_destroy_callback.c delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-uint128s_destroy_callback.h create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_delete_callback.c create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_delete_callback.h create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_destroy_callback.c create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_destroy_callback.h delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-uint16s_delete_callback.c delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-uint16s_delete_callback.h delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-uint16s_destroy_callback.c delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-uint16s_destroy_callback.h create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_delete_callback.c create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_delete_callback.h create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_destroy_callback.c create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_destroy_callback.h delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-uint32s_delete_callback.c delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-uint32s_delete_callback.h delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-uint32s_destroy_callback.c delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-uint32s_destroy_callback.h create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_delete_callback.c create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_delete_callback.h create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_destroy_callback.c create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_destroy_callback.h delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-uint64s_delete_callback.c delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-uint64s_delete_callback.h delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-uint64s_destroy_callback.c delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-uint64s_destroy_callback.h create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_delete_callback.c create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_delete_callback.h create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_destroy_callback.c create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_destroy_callback.h delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-uint8s_delete_callback.c delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-uint8s_delete_callback.h delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-uint8s_destroy_callback.c delete mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-uint8s_destroy_callback.h create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_delete_callback.c create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_delete_callback.h create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_destroy_callback.c create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_destroy_callback.h diff --git a/build/stand_alone/fake.config.h b/build/stand_alone/fake.config.h index bb5bd8f..94da1ba 100644 --- a/build/stand_alone/fake.config.h +++ b/build/stand_alone/fake.config.h @@ -24,8 +24,13 @@ #define _di_f_account_group_name_by_id_ //#define _di_f_account_id_by_name_ #define _di_f_account_name_by_id_ -#define _di_f_accounts_destroy_callback_ +#define _di_f_accounts_append_ +#define _di_f_accounts_append_all_ #define _di_f_accounts_delete_callback_ +#define _di_f_accounts_destroy_callback_ +#define _di_f_accountss_append_all_ +#define _di_f_accountss_delete_callback_ +#define _di_f_accountss_destroy_callback_ #define _di_f_accountss_t_ #define _di_f_accounts_t_ //#define _di_f_account_t_ @@ -70,8 +75,8 @@ #define _di_f_capability_to_name_ #define _di_f_capability_to_text_ #define _di_f_capability_user_set_ -#define _di_f_cells_destroy_callback_ -#define _di_f_cells_delete_callback_ +#define _di_f_cellss_delete_callback_ +#define _di_f_cellss_destroy_callback_ #define _di_f_cellss_t_ #define _di_f_cells_t_ #define _di_f_cell_t_ @@ -291,8 +296,13 @@ #define _di_f_directory_list_ //#define _di_f_directory_listing_delete_ #define _di_f_directory_listing_destroy_ -//#define _di_f_directory_listing_t_ +#define _di_f_directory_listings_delete_callback_ +#define _di_f_directory_listings_destroy_callback_ +#define _di_f_directory_listingss_delete_callback_ +#define _di_f_directory_listingss_destroy_callback_ +#define _di_f_directory_listingss_t_ #define _di_f_directory_listings_t_ +//#define _di_f_directory_listing_t_ //#define _di_f_directory_max_d_ #define _di_f_directory_mode_ //#define _di_f_directory_open_ @@ -300,19 +310,23 @@ //#define _di_f_directory_recurse_do_delete_ #define _di_f_directory_recurse_do_destroy_ //#define _di_f_directory_recurse_do_flag_e_ +#define _di_f_directory_recurse_dos_delete_callback_ +#define _di_f_directory_recurse_dos_destroy_callback_ +#define _di_f_directory_recurse_doss_delete_callback_ +#define _di_f_directory_recurse_doss_destroy_callback_ +#define _di_f_directory_recurse_doss_t_ +#define _di_f_directory_recurse_dos_t_ //#define _di_f_directory_recurse_do_t_ -#define _di_f_directory_recurses_do_t_ //#define _di_f_directory_remove_ //#define _di_f_directory_remove_custom_ #define _di_f_directory_s_ -#define _di_f_directory_listings_destroy_callback_ -#define _di_f_directory_listings_delete_callback_ -#define _di_f_directory_recurses_destroy_callback_ -#define _di_f_directory_recurses_delete_callback_ #define _di_f_directory_status_delete_ #define _di_f_directory_status_destroy_ -#define _di_f_directory_statuss_destroy_callback_ #define _di_f_directory_statuss_delete_callback_ +#define _di_f_directory_statuss_destroy_callback_ +#define _di_f_directory_statusss_delete_callback_ +#define _di_f_directory_statusss_destroy_callback_ +#define _di_f_directory_statusss_t_ //#define _di_f_directory_statuss_t_ //#define _di_f_directory_status_t_ //#define _di_f_directory_touch_ @@ -435,8 +449,7 @@ //#define _di_f_file_rename_ #define _di_f_file_rename_at_ //#define _di_f_file_role_change_ -#define _di_f_file_role_change_at_ -#define _di_f_files_destroy_callback_ +//#define _di_f_file_role_change_at_ #define _di_f_file_seek_ #define _di_f_file_seeks_d_ #define _di_f_file_select_ @@ -444,7 +457,8 @@ //#define _di_f_file_size_ #define _di_f_file_size_at_ #define _di_f_file_size_by_id_ -#define _di_f_files_delete_callback_ +#define _di_f_filess_delete_callback_ +#define _di_f_filess_destroy_callback_ #define _di_f_filess_t_ #define _di_f_files_t_ //#define _di_f_file_stat_ @@ -491,8 +505,10 @@ #define _di_f_file_write_range_ #define _di_f_file_write_until #define _di_f_file_write_until_ -#define _di_f_fll_ids_destroy_callback_ #define _di_f_fll_ids_delete_callback_ +#define _di_f_fll_ids_destroy_callback_ +#define _di_f_fll_idss_delete_callback_ +#define _di_f_fll_idss_destroy_callback_ #define _di_f_fll_idss_t_ #define _di_f_fll_ids_t_ #define _di_f_fll_id_t_ @@ -510,40 +526,51 @@ //#define _di_f_fss_is_graph_ //#define _di_f_fss_is_space_ //#define _di_f_fss_is_zero_width_ +#define _di_f_fss_item_delete_ +#define _di_f_fss_item_destroy_ #define _di_f_fss_items_adjust_ #define _di_f_fss_items_decimate_by_ #define _di_f_fss_items_decrease_by_ -#define _di_f_fss_items_increase_ -#define _di_f_fss_items_increase_by_ +#define _di_f_fss_items_delete_callback_ +#define _di_f_fss_items_destroy_callback_ #define _di_f_fss_items_resize_ +#define _di_f_fss_itemss_delete_callback_ +#define _di_f_fss_itemss_destroy_callback_ +#define _di_f_fss_itemss_t_ #define _di_f_fss_items_t_ -#define _di_f_fss_item_t_ -#define _di_f_fss_named_adjust_ -#define _di_f_fss_named_decimate_by_ -#define _di_f_fss_named_decrease_by_ +//#define _di_f_fss_item_t_ +#define _di_f_fss_named_delete_ +#define _di_f_fss_named_destroy_ #define _di_f_fss_named_increase_ #define _di_f_fss_named_increase_by_ -#define _di_f_fss_named_resize_ #define _di_f_fss_nameds_adjust_ #define _di_f_fss_nameds_decimate_by_ #define _di_f_fss_nameds_decrease_by_ -#define _di_f_fss_nameds_increase_ -#define _di_f_fss_nameds_increase_by_ -//#define _di_f_fss_nameds_resize_ +//#define _di_f_fss_nameds_delete_callback_ +#define _di_f_fss_nameds_destroy_callback_ +#define _di_f_fss_nameds_resize_ +#define _di_f_fss_namedss_delete_callback_ +#define _di_f_fss_namedss_destroy_callback_ +#define _di_f_fss_namedss_t_ //#define _di_f_fss_nameds_t_ //#define _di_f_fss_named_t_ #define _di_f_fss_nest_adjust_ #define _di_f_fss_nest_decimate_by_ #define _di_f_fss_nest_decrease_by_ -#define _di_f_fss_nest_increase_ -#define _di_f_fss_nest_increase_by_ +#define _di_f_fss_nest_delete_ +#define _di_f_fss_nest_destroy_ #define _di_f_fss_nest_resize_ #define _di_f_fss_nests_adjust_ #define _di_f_fss_nests_decimate_by_ #define _di_f_fss_nests_decrease_by_ +#define _di_f_fss_nests_delete_callback_ +#define _di_f_fss_nests_destroy_callback_ #define _di_f_fss_nests_increase_ #define _di_f_fss_nests_increase_by_ #define _di_f_fss_nests_resize_ +#define _di_f_fss_nestss_delete_callback_ +#define _di_f_fss_nestss_destroy_callback_ +#define _di_f_fss_nestss_t_ #define _di_f_fss_nests_t_ #define _di_f_fss_nest_t_ #define _di_f_fss_payload_s_ @@ -554,50 +581,53 @@ #define _di_f_fss_set_adjust_ #define _di_f_fss_set_decimate_by_ #define _di_f_fss_set_decrease_by_ +//#define _di_f_fss_set_delete_ +#define _di_f_fss_set_destroy_ #define _di_f_fss_set_increase_ #define _di_f_fss_set_increase_by_ #define _di_f_fss_set_quote_adjust_ #define _di_f_fss_set_quote_decimate_by_ #define _di_f_fss_set_quote_decrease_by_ +#define _di_f_fss_set_quote_delete_ +#define _di_f_fss_set_quote_destroy_ #define _di_f_fss_set_quote_increase_ #define _di_f_fss_set_quote_increase_by_ #define _di_f_fss_set_quote_resize_ #define _di_f_fss_set_quotes_adjust_ #define _di_f_fss_set_quotes_decimate_by_ #define _di_f_fss_set_quotes_decrease_by_ -#define _di_f_fss_set_quotes_increase_ -#define _di_f_fss_set_quotes_increase_by_ +#define _di_f_fss_set_quotes_delete_callback_ +#define _di_f_fss_set_quotes_destroy_callback_ #define _di_f_fss_set_quotes_resize_ +#define _di_f_fss_set_quotess_delete_callback_ +#define _di_f_fss_set_quotess_destroy_callback_ +#define _di_f_fss_set_quotess_t_ #define _di_f_fss_set_quotes_t_ #define _di_f_fss_set_quote_t_ -//#define _di_f_fss_set_resize_ +#define _di_f_fss_set_resize_ #define _di_f_fss_sets_adjust_ #define _di_f_fss_sets_decimate_by_ #define _di_f_fss_sets_decrease_by_ -#define _di_f_fss_sets_increase_ -#define _di_f_fss_sets_increase_by_ +#define _di_f_fss_sets_delete_callback_ +#define _di_f_fss_sets_destroy_callback_ #define _di_f_fss_sets_resize_ +#define _di_f_fss_setss_delete_callback_ +#define _di_f_fss_sets_sdestroy_callback_ +#define _di_f_fss_setss_destroy_callback_ +#define _di_f_fss_setss_t_ #define _di_f_fss_sets_t_ //#define _di_f_fss_set_t_ #define _di_f_fss_simple_packet_d_ #define _di_f_fss_simple_packet_delete_ #define _di_f_fss_simple_packet_destroy_ #define _di_f_fss_simple_packet_identify_ -#define _di_f_fss_simple_packet_ranges_adjust_ #define _di_f_fss_simple_packet_ranges_append_ #define _di_f_fss_simple_packet_ranges_append_all_ -#define _di_f_fss_simple_packet_ranges_decimate_by_ -#define _di_f_fss_simple_packet_ranges_decrease_by_ -#define _di_f_fss_simple_packet_ranges_increase_ -#define _di_f_fss_simple_packet_ranges_increase_by_ -#define _di_f_fss_simple_packet_ranges_resize_ #define _di_f_fss_simple_packet_rangess_adjust_ #define _di_f_fss_simple_packet_rangess_append_ #define _di_f_fss_simple_packet_rangess_append_all_ #define _di_f_fss_simple_packet_rangess_decimate_by_ #define _di_f_fss_simple_packet_rangess_decrease_by_ -#define _di_f_fss_simple_packet_rangess_increase_ -#define _di_f_fss_simple_packet_rangess_increase_by_ #define _di_f_fss_simple_packet_rangess_resize_ #define _di_f_fss_simple_packet_rangess_t_ #define _di_f_fss_simple_packet_ranges_t_ @@ -607,16 +637,16 @@ #define _di_f_fss_simple_packets_append_all_ #define _di_f_fss_simple_packets_decimate_by_ #define _di_f_fss_simple_packets_decrease_by_ -#define _di_f_fss_simple_packets_increase_ -#define _di_f_fss_simple_packets_increase_by_ +#define _di_f_fss_simple_packets_delete_callback_ +#define _di_f_fss_simple_packets_destroy_callback_ #define _di_f_fss_simple_packets_resize_ #define _di_f_fss_simple_packetss_adjust_ #define _di_f_fss_simple_packetss_append_ #define _di_f_fss_simple_packetss_append_all_ #define _di_f_fss_simple_packetss_decimate_by_ #define _di_f_fss_simple_packetss_decrease_by_ -#define _di_f_fss_simple_packetss_increase_ -#define _di_f_fss_simple_packetss_increase_by_ +#define _di_f_fss_simple_packetss_delete_callback_ +#define _di_f_fss_simple_packetss_destroy_callback_ #define _di_f_fss_simple_packetss_resize_ #define _di_f_fss_simple_packetss_t_ #define _di_f_fss_simple_packets_t_ @@ -658,12 +688,14 @@ #define _di_f_iki_content_partial_is_ //#define _di_f_iki_data_delete_ #define _di_f_iki_data_destroy_ -#define _di_f_iki_datas_destroy_callback_ #define _di_f_iki_datas_append_ #define _di_f_iki_datas_append_all_ #define _di_f_iki_datas_delete_callback_ +#define _di_f_iki_datas_destroy_callback_ #define _di_f_iki_datass_append_ #define _di_f_iki_datass_append_all_ +#define _di_f_iki_datass_delete_callback_ +#define _di_f_iki_datass_destroy_callback_ #define _di_f_iki_datass_t_ #define _di_f_iki_datas_t_ //#define _di_f_iki_data_t_ @@ -696,25 +728,25 @@ //#define _di_f_iki_vocabulary_0002_define_s_ //#define _di_f_iki_vocabulary_0002_parameter_s_ //#define _di_f_iki_vocabulary_0002_s_ -#define _di_f_int128s_destroy_callback_ -#define _di_f_int128s_delete_callback_ +#define _di_f_int128ss_delete_callback_ +#define _di_f_int128ss_destroy_callback_ #define _di_f_int128ss_t_ #define _di_f_int128s_t_ //#define _di_f_int128_t_ -#define _di_f_int16s_destroy_callback_ -#define _di_f_int16s_delete_callback_ +#define _di_f_int16ss_delete_callback_ +#define _di_f_int16ss_destroy_callback_ #define _di_f_int16ss_t_ #define _di_f_int16s_t_ -#define _di_f_int32s_destroy_callback_ -#define _di_f_int32s_delete_callback_ +#define _di_f_int32ss_delete_callback_ +#define _di_f_int32ss_destroy_callback_ #define _di_f_int32ss_t_ //#define _di_f_int32s_t_ -#define _di_f_int64s_destroy_callback_ -#define _di_f_int64s_delete_callback_ +#define _di_f_int64ss_delete_callback_ +#define _di_f_int64ss_destroy_callback_ #define _di_f_int64ss_t_ #define _di_f_int64s_t_ -#define _di_f_int8s_destroy_callback_ -#define _di_f_int8s_delete_callback_ +#define _di_f_int8ss_delete_callback_ +#define _di_f_int8ss_destroy_callback_ #define _di_f_int8ss_t_ #define _di_f_int8s_t_ //#define _di_fl_control_group_apply_ @@ -1069,8 +1101,8 @@ #define _di_f_network_to_host_long_ #define _di_f_network_to_host_short_ #define _di_f_network_to_ip_string_ -#define _di_f_number_unsigneds_destroy_callback_ -#define _di_f_number_unsigneds_delete_callback_ +#define _di_f_number_unsignedss_delete_callback_ +#define _di_f_number_unsignedss_destroy_callback_ #define _di_f_number_unsignedss_t_ //#define _di_f_number_unsigneds_t_ #define _di_f_parse_dynamic_partial_fll_identify_ @@ -1164,8 +1196,8 @@ //#define _di_f_pipe_input_exists_ #define _di_f_pipe_output_exists_ //#define _di_f_poll_e_ -#define _di_f_polls_destroy_callback_ -#define _di_f_polls_delete_callback_ +#define _di_f_pollss_delete_callback_ +#define _di_f_pollss_destroy_callback_ #define _di_f_pollss_t_ #define _di_f_polls_t_ //#define _di_f_poll_t_ @@ -1385,8 +1417,8 @@ #define _di_f_socket_write_ #define _di_f_socket_write_message_ #define _di_f_socket_write_stream_ -#define _di_f_states_destroy_callback_ -#define _di_f_states_delete_callback_ +#define _di_f_statess_delete_callback_ +#define _di_f_statess_destroy_callback_ #define _di_f_statess_t_ #define _di_f_states_t_ //#define _di_f_state_t_ @@ -1408,10 +1440,10 @@ //#define _di_f_status_number_e_ //#define _di_f_status_process_e_ //#define _di_f_status_return_e_ -#define _di_f_statuss_destroy_callback_ //#define _di_f_status_signal_e_ //#define _di_f_status_socket_e_ -#define _di_f_statuss_delete_callback_ +#define _di_f_statusss_delete_callback_ +#define _di_f_statusss_destroy_callback_ #define _di_f_statusss_t_ #define _di_f_statuss_t_ //#define _di_f_status_t_ @@ -1615,8 +1647,10 @@ #define _di_f_thread_attribute_scheduler_policy_set_ #define _di_f_thread_attribute_scope_get_ #define _di_f_thread_attribute_scope_set_ -#define _di_f_thread_attributes_destroy_callback_ #define _di_f_thread_attributes_delete_callback_ +#define _di_f_thread_attributes_destroy_callback_ +#define _di_f_thread_attributess_delete_callback_ +#define _di_f_thread_attributess_destroy_callback_ #define _di_f_thread_attributes_t_ #define _di_f_thread_attribute_stack_get_ #define _di_f_thread_attribute_stack_set_ @@ -1625,16 +1659,20 @@ //#define _di_f_thread_attribute_t_ #define _di_f_thread_barrier_attribute_create_ #define _di_f_thread_barrier_attribute_delete_ +#define _di_f_thread_barrier_attributes_delete_callback_ +#define _di_f_thread_barrier_attributes_destroy_callback_ #define _di_f_thread_barrier_attribute_shared_get_ #define _di_f_thread_barrier_attribute_shared_set_ -#define _di_f_thread_barrier_attributes_destroy_callback_ -#define _di_f_thread_barrier_attributes_delete_callback_ +#define _di_f_thread_barrier_attributess_delete_callback_ +#define _di_f_thread_barrier_attributess_destroy_callback_ #define _di_f_thread_barrier_attributes_t_ #define _di_f_thread_barrier_attribute_t_ #define _di_f_thread_barrier_create_ #define _di_f_thread_barrier_delete_ -#define _di_f_thread_barriers_destroy_callback_ #define _di_f_thread_barriers_delete_callback_ +#define _di_f_thread_barriers_destroy_callback_ +#define _di_f_thread_barrierss_delete_callback_ +#define _di_f_thread_barrierss_destroy_callback_ #define _di_f_thread_barriers_t_ #define _di_f_thread_barrier_t_ #define _di_f_thread_barrier_wait_ @@ -1649,18 +1687,22 @@ #define _di_f_thread_condition_attribute_clock_set_ #define _di_f_thread_condition_attribute_create_ #define _di_f_thread_condition_attribute_delete_ +#define _di_f_thread_condition_attributes_delete_callback_ +#define _di_f_thread_condition_attributes_destroy_callback_ #define _di_f_thread_condition_attribute_shared_get_ #define _di_f_thread_condition_attribute_shared_set_ -#define _di_f_thread_condition_attributes_destroy_callback_ -#define _di_f_thread_condition_attributes_delete_callback_ +#define _di_f_thread_condition_attributess_delete_callback_ +#define _di_f_thread_condition_attributess_destroy_callback_ #define _di_f_thread_condition_attributes_t_ #define _di_f_thread_condition_attribute_t_ #define _di_f_thread_condition_create_ #define _di_f_thread_condition_delete_ +#define _di_f_thread_conditions_delete_callback_ +#define _di_f_thread_conditions_destroy_callback_ #define _di_f_thread_condition_signal_ #define _di_f_thread_condition_signal_all_ -#define _di_f_thread_conditions_destroy_callback_ -#define _di_f_thread_conditions_delete_callback_ +#define _di_f_thread_conditionss_delete_callback_ +#define _di_f_thread_conditionss_destroy_callback_ #define _di_f_thread_conditions_t_ #define _di_f_thread_condition_t_ #define _di_f_thread_condition_wait_ @@ -1676,19 +1718,21 @@ #define _di_f_thread_key_create_ #define _di_f_thread_key_delete_ #define _di_f_thread_key_get_ -#define _di_f_thread_key_set_ -#define _di_f_thread_keys_destroy_callback_ #define _di_f_thread_keys_delete_callback_ +#define _di_f_thread_keys_destroy_callback_ +#define _di_f_thread_key_set_ +#define _di_f_thread_keyss_delete_callback_ +#define _di_f_thread_keyss_destroy_callback_ #define _di_f_thread_keys_t_ #define _di_f_thread_key_t_ -#define _di_f_thread_lock_attribute_destroy_callback_ #define _di_f_thread_lock_attribute_create_ #define _di_f_thread_lock_attribute_delete_ -#define _di_f_thread_lock_attribute_delete_callback_ +#define _di_f_thread_lock_attributes_delete_callback_ +#define _di_f_thread_lock_attributes_destroy_callback_ #define _di_f_thread_lock_attribute_shared_get_ #define _di_f_thread_lock_attribute_shared_set_ -#define _di_f_thread_lock_attributes_destroy_callback_ -#define _di_f_thread_lock_attributes_delete_callback_ +#define _di_f_thread_lock_attributess_delete_callback_ +#define _di_f_thread_lock_attributess_destroy_callback_ #define _di_f_thread_lock_attributes_t_ #define _di_f_thread_lock_attribute_t_ #define _di_f_thread_lock_create_ @@ -1696,25 +1740,27 @@ #define _di_f_thread_lock_read_ #define _di_f_thread_lock_read_timed_ #define _di_f_thread_lock_read_try_ -#define _di_f_thread_locks_destroy_callback_ #define _di_f_thread_locks_delete_callback_ +#define _di_f_thread_locks_destroy_callback_ +#define _di_f_thread_lockss_delete_callback_ +#define _di_f_thread_lockss_destroy_callback_ #define _di_f_thread_locks_t_ #define _di_f_thread_lock_t_ #define _di_f_thread_lock_write_ #define _di_f_thread_lock_write_timed_ #define _di_f_thread_lock_write_try_ -#define _di_f_thread_mutex_attribute_destroy_callback_ #define _di_f_thread_mutex_attribute_create_ #define _di_f_thread_mutex_attribute_delete_ #define _di_f_thread_mutex_attribute_priority_ceiling_get_ #define _di_f_thread_mutex_attribute_priority_ceiling_set_ #define _di_f_thread_mutex_attribute_protocol_get_ #define _di_f_thread_mutex_attribute_protocol_set_ -#define _di_f_thread_mutex_attribute_delete_callback_ +#define _di_f_thread_mutex_attributes_delete_callback_ +#define _di_f_thread_mutex_attributes_destroy_callback_ #define _di_f_thread_mutex_attribute_shared_get_ #define _di_f_thread_mutex_attribute_shared_set_ -#define _di_f_thread_mutex_attributes_destroy_callback_ -#define _di_f_thread_mutex_attributes_delete_callback_ +#define _di_f_thread_mutex_attributess_delete_callback_ +#define _di_f_thread_mutex_attributess_destroy_callback_ #define _di_f_thread_mutex_attributes_t_ #define _di_f_thread_mutex_attribute_t_ #define _di_f_thread_mutex_attribute_type_get_ @@ -1726,8 +1772,10 @@ #define _di_f_thread_mutex_lock_try_ #define _di_f_thread_mutex_priority_ceiling_get_ #define _di_f_thread_mutex_priority_ceiling_set_ -#define _di_f_thread_mutexs_destroy_callback_ #define _di_f_thread_mutexs_delete_callback_ +#define _di_f_thread_mutexs_destroy_callback_ +#define _di_f_thread_mutexss_delete_callback_ +#define _di_f_thread_mutexss_destroy_callback_ #define _di_f_thread_mutexs_t_ #define _di_f_thread_mutex_t_ #define _di_f_thread_mutex_unlock_ @@ -1745,14 +1793,18 @@ #define _di_f_thread_semaphore_lock_ #define _di_f_thread_semaphore_lock_timed_ #define _di_f_thread_semaphore_lock_try_ -#define _di_f_thread_semaphores_destroy_callback_ #define _di_f_thread_semaphores_delete_callback_ +#define _di_f_thread_semaphores_destroy_callback_ +#define _di_f_thread_semaphoress_delete_callback_ +#define _di_f_thread_semaphoress_destroy_callback_ #define _di_f_thread_semaphores_t_ #define _di_f_thread_semaphore_t_ #define _di_f_thread_semaphore_unlock_ #define _di_f_thread_semaphore_value_get_ -#define _di_f_thread_sets_destroy_callback_ #define _di_f_thread_sets_delete_callback_ +#define _di_f_thread_sets_destroy_callback_ +#define _di_f_thread_setss_delete_callback_ +#define _di_f_thread_setss_destroy_callback_ #define _di_f_thread_sets_t_ #define _di_f_thread_set_t_ //#define _di_f_thread_signal_mask_ @@ -1762,8 +1814,10 @@ #define _di_f_thread_spin_delete_ #define _di_f_thread_spin_lock_ #define _di_f_thread_spin_lock_try_ -#define _di_f_thread_spins_destroy_callback_ #define _di_f_thread_spins_delete_callback_ +#define _di_f_thread_spins_destroy_callback_ +#define _di_f_thread_spinss_delete_callback_ +#define _di_f_thread_spinss_destroy_callback_ #define _di_f_thread_spins_t_ #define _di_f_thread_spin_t_ #define _di_f_thread_spin_unlock_ @@ -1777,25 +1831,25 @@ //#define _di_f_type_file_flag_d_ //#define _di_f_type_number_64_t_ //#define _di_f_type_sizes_d_ -#define _di_f_uint128s_destroy_callback_ -#define _di_f_uint128s_delete_callback_ +#define _di_f_uint128ss_delete_callback_ +#define _di_f_uint128ss_destroy_callback_ #define _di_f_uint128ss_t_ #define _di_f_uint128s_t_ //#define _di_f_uint128_t_ -#define _di_f_uint16s_destroy_callback_ -#define _di_f_uint16s_delete_callback_ +#define _di_f_uint16ss_delete_callback_ +#define _di_f_uint16ss_destroy_callback_ #define _di_f_uint16ss_t_ //#define _di_f_uint16s_t_ -#define _di_f_uint32s_destroy_callback_ -#define _di_f_uint32s_delete_callback_ +#define _di_f_uint32ss_delete_callback_ +#define _di_f_uint32ss_destroy_callback_ #define _di_f_uint32ss_t_ #define _di_f_uint32s_t_ -#define _di_f_uint64s_destroy_callback_ -#define _di_f_uint64s_delete_callback_ +#define _di_f_uint64ss_delete_callback_ +#define _di_f_uint64ss_destroy_callback_ #define _di_f_uint64ss_t_ #define _di_f_uint64s_t_ -#define _di_f_uint8s_destroy_callback_ -//#define _di_f_uint8s_delete_callback_ +//#define _di_f_uint8ss_delete_callback_ +#define _di_f_uint8ss_destroy_callback_ //#define _di_f_uint8ss_t_ //#define _di_f_uint8s_t_ #define _di_f_utf_buffer_decrement_ diff --git a/build/stand_alone/fake.settings b/build/stand_alone/fake.settings index f8dc570..1eff6c1 100644 --- a/build/stand_alone/fake.settings +++ b/build/stand_alone/fake.settings @@ -38,7 +38,8 @@ build_sources_program fll/level_0/compare.c fll/level_0/compare/utf.c fll/level_ build_sources_program fll/level_0/console.c fll/level_0/console/common.c fll/level_0/private-console.c build_sources_program fll/level_0/control_group.c fll/level_0/control_group/common.c build_sources_program fll/level_0/conversion.c fll/level_0/private-conversion.c fll/level_0/conversion/common.c -build_sources_program fll/level_0/directory.c fll/level_0/directory/common.c fll/level_0/directory/type.c fll/level_0/private-directory.c +build_sources_library fll/level_0/directory.c fll/level_0/directory/common.c fll/level_0/directory/listing.c fll/level_0/directory/recurse_do.c fll/level_0/directory/status.c +build_sources_library fll/level_0/private-directory.c build_sources_program fll/level_0/environment.c build_sources_program fll/level_0/execute.c build_sources_program fll/level_0/file.c fll/level_0/private-file.c fll/level_0/file/common.c fll/level_0/file/stream.c diff --git a/level_0/f_account/tests/unit/c/mock-account.h b/level_0/f_account/tests/unit/c/mock-account.h index 529f229..df2b6b9 100644 --- a/level_0/f_account/tests/unit/c/mock-account.h +++ b/level_0/f_account/tests/unit/c/mock-account.h @@ -33,11 +33,13 @@ extern int mock_unwrap_f_memory; extern f_status_t __real_f_memory_array_adjust(const f_number_unsigned_t length, const size_t width, void ** const array, f_number_unsigned_t * const used, f_number_unsigned_t * const size); extern f_status_t __real_f_memory_array_resize(const f_number_unsigned_t length, const size_t width, void ** const array, f_number_unsigned_t * const used, f_number_unsigned_t * const size); + extern f_status_t __real_f_string_dynamic_adjust(const f_number_unsigned_t length, f_string_dynamic_t * const structure); extern f_status_t __real_f_string_dynamic_resize(const f_number_unsigned_t length, f_string_dynamic_t * const structure); extern f_status_t __wrap_f_memory_array_adjust(const f_number_unsigned_t length, const size_t width, void ** const array, f_number_unsigned_t * const used, f_number_unsigned_t * const size); extern f_status_t __wrap_f_memory_array_resize(const f_number_unsigned_t length, const size_t width, void ** const array, f_number_unsigned_t * const used, f_number_unsigned_t * const size); + extern f_status_t __wrap_f_string_dynamic_adjust(const f_number_unsigned_t length, f_string_dynamic_t * const structure); extern f_status_t __wrap_f_string_dynamic_resize(const f_number_unsigned_t length, f_string_dynamic_t * const structure); diff --git a/level_0/f_account/tests/unit/c/test-account-ss_delete_callback.c b/level_0/f_account/tests/unit/c/test-account-ss_delete_callback.c index 2042eda..c209be7 100644 --- a/level_0/f_account/tests/unit/c/test-account-ss_delete_callback.c +++ b/level_0/f_account/tests/unit/c/test-account-ss_delete_callback.c @@ -13,13 +13,13 @@ void test__f_accountss_delete_callback__fails(void **state) { f_account_t data = f_account_t_initialize; f_account_t data_array[] = { data }; f_accounts_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_accounts_t datass_array[] = { datas }; + f_accounts_t datas_array[] = { datas }; { will_return(__wrap_f_string_dynamic_resize, true); will_return(__wrap_f_string_dynamic_resize, F_status_set_error(F_failure)); - const f_status_t status = f_accountss_delete_callback(0, 1, (void *) datass_array); + const f_status_t status = f_accountss_delete_callback(0, 1, (void *) datas_array); assert_int_equal(status, F_status_set_error(F_failure)); } @@ -31,7 +31,7 @@ void test__f_accountss_delete_callback__fails(void **state) { will_return(__wrap_f_string_dynamic_resize, true); will_return(__wrap_f_string_dynamic_resize, F_status_set_error(F_failure)); - const f_status_t status = f_accountss_delete_callback(0, 1, (void *) datass_array); + const f_status_t status = f_accountss_delete_callback(0, 1, (void *) datas_array); assert_int_equal(status, F_status_set_error(F_failure)); } @@ -46,7 +46,7 @@ void test__f_accountss_delete_callback__fails(void **state) { will_return(__wrap_f_string_dynamic_resize, true); will_return(__wrap_f_string_dynamic_resize, F_status_set_error(F_failure)); - const f_status_t status = f_accountss_delete_callback(0, 1, (void *) datass_array); + const f_status_t status = f_accountss_delete_callback(0, 1, (void *) datas_array); assert_int_equal(status, F_status_set_error(F_failure)); } @@ -64,7 +64,7 @@ void test__f_accountss_delete_callback__fails(void **state) { will_return(__wrap_f_string_dynamic_resize, true); will_return(__wrap_f_string_dynamic_resize, F_status_set_error(F_failure)); - const f_status_t status = f_accountss_delete_callback(0, 1, (void *) datass_array); + const f_status_t status = f_accountss_delete_callback(0, 1, (void *) datas_array); assert_int_equal(status, F_status_set_error(F_failure)); } @@ -85,7 +85,7 @@ void test__f_accountss_delete_callback__fails(void **state) { will_return(__wrap_f_string_dynamic_resize, true); will_return(__wrap_f_string_dynamic_resize, F_status_set_error(F_failure)); - const f_status_t status = f_accountss_delete_callback(0, 1, (void *) datass_array); + const f_status_t status = f_accountss_delete_callback(0, 1, (void *) datas_array); assert_int_equal(status, F_status_set_error(F_failure)); } @@ -109,7 +109,7 @@ void test__f_accountss_delete_callback__fails(void **state) { will_return(__wrap_f_memory_array_resize, true); will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); - const f_status_t status = f_accountss_delete_callback(0, 1, (void *) datass_array); + const f_status_t status = f_accountss_delete_callback(0, 1, (void *) datas_array); assert_int_equal(status, F_status_set_error(F_failure)); } diff --git a/level_0/f_account/tests/unit/c/test-account-ss_destroy_callback.c b/level_0/f_account/tests/unit/c/test-account-ss_destroy_callback.c index 1c398a9..1074810 100644 --- a/level_0/f_account/tests/unit/c/test-account-ss_destroy_callback.c +++ b/level_0/f_account/tests/unit/c/test-account-ss_destroy_callback.c @@ -13,13 +13,13 @@ void test__f_accountss_destroy_callback__fails(void **state) { f_account_t data = f_account_t_initialize; f_account_t data_array[] = { data }; f_accounts_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_accounts_t datass_array[] = { datas }; + f_accounts_t datas_array[] = { datas }; { will_return(__wrap_f_string_dynamic_adjust, true); will_return(__wrap_f_string_dynamic_adjust, F_status_set_error(F_failure)); - const f_status_t status = f_accountss_destroy_callback(0, 1, (void *) datass_array); + const f_status_t status = f_accountss_destroy_callback(0, 1, (void *) datas_array); assert_int_equal(status, F_status_set_error(F_failure)); } @@ -31,7 +31,7 @@ void test__f_accountss_destroy_callback__fails(void **state) { will_return(__wrap_f_string_dynamic_adjust, true); will_return(__wrap_f_string_dynamic_adjust, F_status_set_error(F_failure)); - const f_status_t status = f_accountss_destroy_callback(0, 1, (void *) datass_array); + const f_status_t status = f_accountss_destroy_callback(0, 1, (void *) datas_array); assert_int_equal(status, F_status_set_error(F_failure)); } @@ -46,7 +46,7 @@ void test__f_accountss_destroy_callback__fails(void **state) { will_return(__wrap_f_string_dynamic_adjust, true); will_return(__wrap_f_string_dynamic_adjust, F_status_set_error(F_failure)); - const f_status_t status = f_accountss_destroy_callback(0, 1, (void *) datass_array); + const f_status_t status = f_accountss_destroy_callback(0, 1, (void *) datas_array); assert_int_equal(status, F_status_set_error(F_failure)); } @@ -64,7 +64,7 @@ void test__f_accountss_destroy_callback__fails(void **state) { will_return(__wrap_f_string_dynamic_adjust, true); will_return(__wrap_f_string_dynamic_adjust, F_status_set_error(F_failure)); - const f_status_t status = f_accountss_destroy_callback(0, 1, (void *) datass_array); + const f_status_t status = f_accountss_destroy_callback(0, 1, (void *) datas_array); assert_int_equal(status, F_status_set_error(F_failure)); } @@ -85,7 +85,7 @@ void test__f_accountss_destroy_callback__fails(void **state) { will_return(__wrap_f_string_dynamic_adjust, true); will_return(__wrap_f_string_dynamic_adjust, F_status_set_error(F_failure)); - const f_status_t status = f_accountss_destroy_callback(0, 1, (void *) datass_array); + const f_status_t status = f_accountss_destroy_callback(0, 1, (void *) datas_array); assert_int_equal(status, F_status_set_error(F_failure)); } @@ -109,7 +109,7 @@ void test__f_accountss_destroy_callback__fails(void **state) { will_return(__wrap_f_memory_array_adjust, true); will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); - const f_status_t status = f_accountss_destroy_callback(0, 1, (void *) datass_array); + const f_status_t status = f_accountss_destroy_callback(0, 1, (void *) datas_array); assert_int_equal(status, F_status_set_error(F_failure)); } diff --git a/level_0/f_account/tests/unit/c/test-account.c b/level_0/f_account/tests/unit/c/test-account.c index ed6bb9a..7af0e57 100644 --- a/level_0/f_account/tests/unit/c/test-account.c +++ b/level_0/f_account/tests/unit/c/test-account.c @@ -53,7 +53,7 @@ int main(void) { cmocka_unit_test(test__f_accountss_destroy_callback__fails), cmocka_unit_test(test__f_accountss_delete_callback__works), - //cmocka_unit_test(test__f_accountss_destroy_callback__works), + cmocka_unit_test(test__f_accountss_destroy_callback__works), #ifndef _di_level_0_parameter_checking_ cmocka_unit_test(test__f_account_by_id__parameter_checking), @@ -65,7 +65,6 @@ int main(void) { // f_accounts_delete_callback() doesn't use parameter checking. // f_accounts_destroy_callback() doesn't use parameter checking. - // f_accountss_delete_callback() doesn't use parameter checking. // f_accountss_destroy_callback() doesn't use parameter checking. #endif // _di_level_0_parameter_checking_ diff --git a/level_0/f_directory/c/directory/listing.h b/level_0/f_directory/c/directory/listing.h index e9ffea4..c5d7f1d 100644 --- a/level_0/f_directory/c/directory/listing.h +++ b/level_0/f_directory/c/directory/listing.h @@ -70,7 +70,7 @@ extern "C" { * An array of directory listing. * * Properties: - * - array: An array of directory status. + * - array: An array of directory listing. * - size: Total amount of allocated space. * - used: Total number of allocated spaces used. */ @@ -90,6 +90,29 @@ extern "C" { #endif // _di_f_directory_listings_t_ /** + * An array of an array of directory listing. + * + * Properties: + * - array: An array of an array of directory listing. + * - size: Total amount of allocated space. + * - used: Total number of allocated spaces used. + */ +#ifndef _di_f_directory_listingss_t_ + typedef struct { + f_directory_listings_t *array; + f_number_unsigned_t size; + f_number_unsigned_t used; + } f_directory_listingss_t; + + #define f_directory_listingss_t_initialize { 0, 0, 0 } + + #define macro_f_directory_listingss_t_initialize_1(content, size, used) { array, size, used } + #define macro_f_directory_listingss_t_initialize_2(array, length) { array, length, length } + + #define macro_f_directory_listingss_t_clear(structures) macro_f_memory_structures_clear(structures) +#endif // _di_f_directory_listingss_t_ + +/** * Delete all arrays within the listing. * * @param listing diff --git a/level_0/f_directory/c/directory/recurse_do.h b/level_0/f_directory/c/directory/recurse_do.h index c6e98d9..36c0ac1 100644 --- a/level_0/f_directory/c/directory/recurse_do.h +++ b/level_0/f_directory/c/directory/recurse_do.h @@ -118,10 +118,10 @@ extern "C" { #endif // _di_f_directory_recurse_do_t_ /** - * An array of directory recurse. + * An array of directory recursion information. * * Properties: - * - array: An array of directory status. + * - array: An array of directory recursion information. * - size: Total amount of allocated space. * - used: Total number of allocated spaces used. */ @@ -141,6 +141,29 @@ extern "C" { #endif // _di_f_directory_recurse_dos_t_ /** + * An array of an array of directory recursion information. + * + * Properties: + * - array: An array of directory recursion information. + * - size: Total amount of allocated space. + * - used: Total number of allocated spaces used. + */ +#ifndef _di_f_directory_recurse_doss_t_ + typedef struct { + f_directory_recurse_dos_t *array; + f_number_unsigned_t size; + f_number_unsigned_t used; + } f_directory_recurse_doss_t; + + #define f_directory_recurse_doss_t_initialize { 0, 0, 0 } + + #define macro_f_directory_recurse_doss_t_initialize_1(content, size, used) { array, size, used } + #define macro_f_directory_recurse_doss_t_initialize_2(array, length) { array, length, length } + + #define macro_f_directory_recurse_doss_t_clear(structures) macro_f_memory_structures_clear(structures) +#endif // _di_f_directory_recurse_doss_t_ + +/** * Delete all non-pointer based dynamic arrays within the recurse. * * @param recurse diff --git a/level_0/f_directory/c/directory/status.h b/level_0/f_directory/c/directory/status.h index 18e55ff..65af472 100644 --- a/level_0/f_directory/c/directory/status.h +++ b/level_0/f_directory/c/directory/status.h @@ -65,6 +65,29 @@ extern "C" { #endif // _di_f_directory_statuss_t_ /** + * An array of an array of directory status. + * + * Properties: + * - array: An array of an array of directory status. + * - size: Total amount of allocated space. + * - used: Total number of allocated spaces used. + */ +#ifndef _di_f_directory_statusss_t_ + typedef struct { + f_directory_statuss_t *array; + f_number_unsigned_t size; + f_number_unsigned_t used; + } f_directory_statusss_t; + + #define f_directory_statusss_t_initialize { 0, 0, 0 } + + #define macro_f_directory_statusss_t_initialize_1(content, size, used) { array, size, used } + #define macro_f_directory_statusss_t_initialize_2(array, length) { array, length, length } + + #define macro_f_directory_statusss_t_clear(structures) macro_f_memory_structures_clear(structures) +#endif // _di_f_directory_statusss_t_ + +/** * A callback intended to be passed to f_memory_arrays_resize() for an f_directory_statuss_t structure. * * This is only called when shrinking the array and generally should perform deallocations. diff --git a/level_0/f_directory/data/build/settings-mocks b/level_0/f_directory/data/build/settings-mocks index 5a72c32..285772d 100644 --- a/level_0/f_directory/data/build/settings-mocks +++ b/level_0/f_directory/data/build/settings-mocks @@ -63,6 +63,8 @@ flags-coverage --coverage -fprofile-abs-path -fprofile-dir=build/coverage/ flags_library -fPIC # Inject mocks. +flags -Wl,--wrap=f_memory_array_adjust +flags -Wl,--wrap=f_memory_array_resize flags -Wl,--wrap=f_string_dynamic_adjust flags -Wl,--wrap=f_string_dynamic_resize flags -Wl,--wrap=f_string_dynamics_adjust diff --git a/level_0/f_directory/data/build/settings-tests b/level_0/f_directory/data/build/settings-tests index a60e9ea..49eba7a 100644 --- a/level_0/f_directory/data/build/settings-tests +++ b/level_0/f_directory/data/build/settings-tests @@ -26,9 +26,9 @@ build_libraries -lc -lcmocka build_libraries-individual -lf_memory -lf_string -lf_directory build_sources_program test-directory.c test-directory-create.c test-directory-create_at.c test-directory-exists.c test-directory-exists_at.c test-directory-is.c test-directory-is_at.c test-directory-list.c test-directory-open.c test-directory-open_at.c test-directory-remove.c test-directory-remove_custom.c test-directory-touch.c test-directory-touch_at.c -build_sources_program test-directory-listings_destroy_callback.c test-directory-listings_delete_callback.c -build_sources_program test-directory-recurse_dos_destroy_callback.c test-directory-recurse_dos_delete_callback.c -build_sources_program test-directory-statuss_destroy_callback.c test-directory-statuss_delete_callback.c +build_sources_program test-directory-listings_destroy_callback.c test-directory-listings_delete_callback.c test-directory-listingss_destroy_callback.c test-directory-listingss_delete_callback.c +build_sources_program test-directory-recurse_dos_destroy_callback.c test-directory-recurse_dos_delete_callback.c test-directory-recurse_doss_destroy_callback.c test-directory-recurse_doss_delete_callback.c +build_sources_program test-directory-statuss_destroy_callback.c test-directory-statuss_delete_callback.c test-directory-statusss_destroy_callback.c test-directory-statusss_delete_callback.c build_script no build_shared yes diff --git a/level_0/f_directory/tests/unit/c/mock-directory.c b/level_0/f_directory/tests/unit/c/mock-directory.c index 01efdd6..fa8be2d 100644 --- a/level_0/f_directory/tests/unit/c/mock-directory.c +++ b/level_0/f_directory/tests/unit/c/mock-directory.c @@ -5,6 +5,41 @@ extern "C" { #endif int mock_unwrap = 0; +int mock_unwrap_f_memory = 1; + +f_status_t __wrap_f_memory_array_adjust(const f_number_unsigned_t length, const size_t width, void ** const array, f_number_unsigned_t * const used, f_number_unsigned_t * const size) { + + if (mock_unwrap_f_memory) { + return __real_f_memory_array_adjust(length, width, array, used, size); + } + + if (!array || !used || !size) return F_status_set_error(F_parameter_not); + + const bool failure = mock_type(bool); + + if (failure) return mock_type(f_status_t); + + *size = length; + + return mock_type(f_status_t); +} + +f_status_t __wrap_f_memory_array_resize(const f_number_unsigned_t length, const size_t width, void ** const array, f_number_unsigned_t * const used, f_number_unsigned_t * const size) { + + if (mock_unwrap_f_memory) { + return __real_f_memory_array_resize(length, width, array, used, size); + } + + if (!array || !used || !size) return F_status_set_error(F_parameter_not); + + const bool failure = mock_type(bool); + + if (failure) return mock_type(f_status_t); + + *size = length; + + return mock_type(f_status_t); +} f_status_t __wrap_f_string_dynamic_adjust(const f_number_unsigned_t length, f_string_dynamic_t * const structure) { diff --git a/level_0/f_directory/tests/unit/c/mock-directory.h b/level_0/f_directory/tests/unit/c/mock-directory.h index 15f1562..8671401 100644 --- a/level_0/f_directory/tests/unit/c/mock-directory.h +++ b/level_0/f_directory/tests/unit/c/mock-directory.h @@ -29,12 +29,19 @@ extern "C" { const static int mock_errno_generic = 32767; extern int mock_unwrap; +extern int mock_unwrap_f_memory; + +extern f_status_t __real_f_memory_array_adjust(const f_number_unsigned_t length, const size_t width, void ** const array, f_number_unsigned_t * const used, f_number_unsigned_t * const size); +extern f_status_t __real_f_memory_array_resize(const f_number_unsigned_t length, const size_t width, void ** const array, f_number_unsigned_t * const used, f_number_unsigned_t * const size); extern f_status_t __real_f_string_dynamic_adjust(const f_number_unsigned_t length, f_string_dynamic_t * const structure); extern f_status_t __real_f_string_dynamic_resize(const f_number_unsigned_t length, f_string_dynamic_t * const structure); extern f_status_t __real_f_string_dynamics_adjust(const f_number_unsigned_t length, f_string_dynamics_t * const structure); extern f_status_t __real_f_string_dynamics_resize(const f_number_unsigned_t length, f_string_dynamics_t * const structure); +extern f_status_t __wrap_f_memory_array_adjust(const f_number_unsigned_t length, const size_t width, void ** const array, f_number_unsigned_t * const used, f_number_unsigned_t * const size); +extern f_status_t __wrap_f_memory_array_resize(const f_number_unsigned_t length, const size_t width, void ** const array, f_number_unsigned_t * const used, f_number_unsigned_t * const size); + extern f_status_t __wrap_f_string_dynamic_adjust(const f_number_unsigned_t length, f_string_dynamic_t * const structure); extern f_status_t __wrap_f_string_dynamic_resize(const f_number_unsigned_t length, f_string_dynamic_t * const structure); extern f_status_t __wrap_f_string_dynamics_adjust(const f_number_unsigned_t length, f_string_dynamics_t * const structure); diff --git a/level_0/f_directory/tests/unit/c/test-directory-listings_delete_callback.c b/level_0/f_directory/tests/unit/c/test-directory-listings_delete_callback.c index c9b5c57..0a5007c 100644 --- a/level_0/f_directory/tests/unit/c/test-directory-listings_delete_callback.c +++ b/level_0/f_directory/tests/unit/c/test-directory-listings_delete_callback.c @@ -12,13 +12,13 @@ void test__f_directory_listings_delete_callback__fails(void **state) { f_directory_listing_t data = f_directory_listing_t_initialize; f_directory_listing_t data_array[] = { data }; f_directory_listings_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_directory_listings_t datass_array[] = { datas }; + f_directory_listings_t datas_array[] = { datas }; { will_return(__wrap_f_string_dynamics_resize, true); will_return(__wrap_f_string_dynamics_resize, F_status_set_error(F_failure)); - const f_status_t status = f_directory_listings_delete_callback(0, 1, (void *) datass_array); + const f_status_t status = f_directory_listings_delete_callback(0, 1, (void *) datas_array); assert_int_equal(status, F_status_set_error(F_failure)); } @@ -30,7 +30,7 @@ void test__f_directory_listings_delete_callback__fails(void **state) { will_return(__wrap_f_string_dynamics_resize, true); will_return(__wrap_f_string_dynamics_resize, F_status_set_error(F_failure)); - const f_status_t status = f_directory_listings_delete_callback(0, 1, (void *) datass_array); + const f_status_t status = f_directory_listings_delete_callback(0, 1, (void *) datas_array); assert_int_equal(status, F_status_set_error(F_failure)); } @@ -45,7 +45,7 @@ void test__f_directory_listings_delete_callback__fails(void **state) { will_return(__wrap_f_string_dynamics_resize, true); will_return(__wrap_f_string_dynamics_resize, F_status_set_error(F_failure)); - const f_status_t status = f_directory_listings_delete_callback(0, 1, (void *) datass_array); + const f_status_t status = f_directory_listings_delete_callback(0, 1, (void *) datas_array); assert_int_equal(status, F_status_set_error(F_failure)); } @@ -63,7 +63,7 @@ void test__f_directory_listings_delete_callback__fails(void **state) { will_return(__wrap_f_string_dynamics_resize, true); will_return(__wrap_f_string_dynamics_resize, F_status_set_error(F_failure)); - const f_status_t status = f_directory_listings_delete_callback(0, 1, (void *) datass_array); + const f_status_t status = f_directory_listings_delete_callback(0, 1, (void *) datas_array); assert_int_equal(status, F_status_set_error(F_failure)); } @@ -84,7 +84,7 @@ void test__f_directory_listings_delete_callback__fails(void **state) { will_return(__wrap_f_string_dynamics_resize, true); will_return(__wrap_f_string_dynamics_resize, F_status_set_error(F_failure)); - const f_status_t status = f_directory_listings_delete_callback(0, 1, (void *) datass_array); + const f_status_t status = f_directory_listings_delete_callback(0, 1, (void *) datas_array); assert_int_equal(status, F_status_set_error(F_failure)); } @@ -108,7 +108,7 @@ void test__f_directory_listings_delete_callback__fails(void **state) { will_return(__wrap_f_string_dynamics_resize, true); will_return(__wrap_f_string_dynamics_resize, F_status_set_error(F_failure)); - const f_status_t status = f_directory_listings_delete_callback(0, 1, (void *) datass_array); + const f_status_t status = f_directory_listings_delete_callback(0, 1, (void *) datas_array); assert_int_equal(status, F_status_set_error(F_failure)); } @@ -135,7 +135,7 @@ void test__f_directory_listings_delete_callback__fails(void **state) { will_return(__wrap_f_string_dynamics_resize, true); will_return(__wrap_f_string_dynamics_resize, F_status_set_error(F_failure)); - const f_status_t status = f_directory_listings_delete_callback(0, 1, (void *) datass_array); + const f_status_t status = f_directory_listings_delete_callback(0, 1, (void *) datas_array); assert_int_equal(status, F_status_set_error(F_failure)); } @@ -165,7 +165,7 @@ void test__f_directory_listings_delete_callback__fails(void **state) { will_return(__wrap_f_string_dynamics_resize, true); will_return(__wrap_f_string_dynamics_resize, F_status_set_error(F_failure)); - const f_status_t status = f_directory_listings_delete_callback(0, 1, (void *) datass_array); + const f_status_t status = f_directory_listings_delete_callback(0, 1, (void *) datas_array); assert_int_equal(status, F_status_set_error(F_failure)); } @@ -178,7 +178,7 @@ void test__f_directory_listings_delete_callback__works(void **state) { f_directory_listing_t data = f_directory_listing_t_initialize; f_directory_listing_t data_array[] = { data }; f_directory_listings_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_directory_listings_t datass_array[] = { datas }; + f_directory_listings_t datas_array[] = { datas }; const f_number_unsigned_t length = 1; { @@ -206,7 +206,7 @@ void test__f_directory_listings_delete_callback__works(void **state) { will_return(__wrap_f_string_dynamics_resize, false); will_return(__wrap_f_string_dynamics_resize, F_none); - const f_status_t status = f_directory_listings_delete_callback(0, length, (void *) datass_array); + const f_status_t status = f_directory_listings_delete_callback(0, length, (void *) datas_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_directory/tests/unit/c/test-directory-listings_destroy_callback.c b/level_0/f_directory/tests/unit/c/test-directory-listings_destroy_callback.c index 007c43c..8bf4859 100644 --- a/level_0/f_directory/tests/unit/c/test-directory-listings_destroy_callback.c +++ b/level_0/f_directory/tests/unit/c/test-directory-listings_destroy_callback.c @@ -12,13 +12,13 @@ void test__f_directory_listings_destroy_callback__fails(void **state) { f_directory_listing_t data = f_directory_listing_t_initialize; f_directory_listing_t data_array[] = { data }; f_directory_listings_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_directory_listings_t datass_array[] = { datas }; + f_directory_listings_t datas_array[] = { datas }; { will_return(__wrap_f_string_dynamics_adjust, true); will_return(__wrap_f_string_dynamics_adjust, F_status_set_error(F_failure)); - const f_status_t status = f_directory_listings_destroy_callback(0, 1, (void *) datass_array); + const f_status_t status = f_directory_listings_destroy_callback(0, 1, (void *) datas_array); assert_int_equal(status, F_status_set_error(F_failure)); } @@ -30,7 +30,7 @@ void test__f_directory_listings_destroy_callback__fails(void **state) { will_return(__wrap_f_string_dynamics_adjust, true); will_return(__wrap_f_string_dynamics_adjust, F_status_set_error(F_failure)); - const f_status_t status = f_directory_listings_destroy_callback(0, 1, (void *) datass_array); + const f_status_t status = f_directory_listings_destroy_callback(0, 1, (void *) datas_array); assert_int_equal(status, F_status_set_error(F_failure)); } @@ -45,7 +45,7 @@ void test__f_directory_listings_destroy_callback__fails(void **state) { will_return(__wrap_f_string_dynamics_adjust, true); will_return(__wrap_f_string_dynamics_adjust, F_status_set_error(F_failure)); - const f_status_t status = f_directory_listings_destroy_callback(0, 1, (void *) datass_array); + const f_status_t status = f_directory_listings_destroy_callback(0, 1, (void *) datas_array); assert_int_equal(status, F_status_set_error(F_failure)); } @@ -63,7 +63,7 @@ void test__f_directory_listings_destroy_callback__fails(void **state) { will_return(__wrap_f_string_dynamics_adjust, true); will_return(__wrap_f_string_dynamics_adjust, F_status_set_error(F_failure)); - const f_status_t status = f_directory_listings_destroy_callback(0, 1, (void *) datass_array); + const f_status_t status = f_directory_listings_destroy_callback(0, 1, (void *) datas_array); assert_int_equal(status, F_status_set_error(F_failure)); } @@ -84,7 +84,7 @@ void test__f_directory_listings_destroy_callback__fails(void **state) { will_return(__wrap_f_string_dynamics_adjust, true); will_return(__wrap_f_string_dynamics_adjust, F_status_set_error(F_failure)); - const f_status_t status = f_directory_listings_destroy_callback(0, 1, (void *) datass_array); + const f_status_t status = f_directory_listings_destroy_callback(0, 1, (void *) datas_array); assert_int_equal(status, F_status_set_error(F_failure)); } @@ -108,7 +108,7 @@ void test__f_directory_listings_destroy_callback__fails(void **state) { will_return(__wrap_f_string_dynamics_adjust, true); will_return(__wrap_f_string_dynamics_adjust, F_status_set_error(F_failure)); - const f_status_t status = f_directory_listings_destroy_callback(0, 1, (void *) datass_array); + const f_status_t status = f_directory_listings_destroy_callback(0, 1, (void *) datas_array); assert_int_equal(status, F_status_set_error(F_failure)); } @@ -135,7 +135,7 @@ void test__f_directory_listings_destroy_callback__fails(void **state) { will_return(__wrap_f_string_dynamics_adjust, true); will_return(__wrap_f_string_dynamics_adjust, F_status_set_error(F_failure)); - const f_status_t status = f_directory_listings_destroy_callback(0, 1, (void *) datass_array); + const f_status_t status = f_directory_listings_destroy_callback(0, 1, (void *) datas_array); assert_int_equal(status, F_status_set_error(F_failure)); } @@ -165,7 +165,7 @@ void test__f_directory_listings_destroy_callback__fails(void **state) { will_return(__wrap_f_string_dynamics_adjust, true); will_return(__wrap_f_string_dynamics_adjust, F_status_set_error(F_failure)); - const f_status_t status = f_directory_listings_destroy_callback(0, 1, (void *) datass_array); + const f_status_t status = f_directory_listings_destroy_callback(0, 1, (void *) datas_array); assert_int_equal(status, F_status_set_error(F_failure)); } @@ -178,7 +178,7 @@ void test__f_directory_listings_destroy_callback__works(void **state) { f_directory_listing_t data = f_directory_listing_t_initialize; f_directory_listing_t data_array[] = { data }; f_directory_listings_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_directory_listings_t datass_array[] = { datas }; + f_directory_listings_t datas_array[] = { datas }; const f_number_unsigned_t length = 1; { @@ -206,7 +206,7 @@ void test__f_directory_listings_destroy_callback__works(void **state) { will_return(__wrap_f_string_dynamics_adjust, false); will_return(__wrap_f_string_dynamics_adjust, F_none); - const f_status_t status = f_directory_listings_destroy_callback(0, length, (void *) datass_array); + const f_status_t status = f_directory_listings_destroy_callback(0, length, (void *) datas_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_directory/tests/unit/c/test-directory-listingss_delete_callback.c b/level_0/f_directory/tests/unit/c/test-directory-listingss_delete_callback.c new file mode 100644 index 0000000..0ad401e --- /dev/null +++ b/level_0/f_directory/tests/unit/c/test-directory-listingss_delete_callback.c @@ -0,0 +1,261 @@ +#include "test-directory.h" +#include "test-directory-listingss_delete_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_directory_listingss_delete_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_directory_listing_t data = f_directory_listing_t_initialize; + f_directory_listing_t data_array[] = { data }; + f_directory_listings_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_directory_listings_t datas_array[] = { datas }; + + { + will_return(__wrap_f_string_dynamics_resize, true); + will_return(__wrap_f_string_dynamics_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_listingss_delete_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, true); + will_return(__wrap_f_string_dynamics_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_listingss_delete_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, true); + will_return(__wrap_f_string_dynamics_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_listingss_delete_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, true); + will_return(__wrap_f_string_dynamics_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_listingss_delete_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, true); + will_return(__wrap_f_string_dynamics_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_listingss_delete_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, true); + will_return(__wrap_f_string_dynamics_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_listingss_delete_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, true); + will_return(__wrap_f_string_dynamics_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_listingss_delete_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, true); + will_return(__wrap_f_string_dynamics_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_listingss_delete_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_memory_array_resize, true); + will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_listingss_delete_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_directory_listingss_delete_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_directory_listingss_t datass = f_directory_listingss_t_initialize; + + { + f_status_t status = f_memory_array_resize(length, sizeof(f_directory_listings_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_none); + + status = f_memory_array_resize(1, sizeof(f_directory_listing_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size); + assert_int_equal(status, F_none); + + status = f_string_dynamics_resize(1, &datass.array[0].array[0].block); + assert_int_equal(status, F_none); + + status = f_string_dynamics_resize(1, &datass.array[0].array[0].character); + assert_int_equal(status, F_none); + + status = f_string_dynamics_resize(1, &datass.array[0].array[0].directory); + assert_int_equal(status, F_none); + + status = f_string_dynamics_resize(1, &datass.array[0].array[0].regular); + assert_int_equal(status, F_none); + + status = f_string_dynamics_resize(1, &datass.array[0].array[0].link); + assert_int_equal(status, F_none); + + status = f_string_dynamics_resize(1, &datass.array[0].array[0].fifo); + assert_int_equal(status, F_none); + + status = f_string_dynamics_resize(1, &datass.array[0].array[0].socket); + assert_int_equal(status, F_none); + + status = f_string_dynamics_resize(1, &datass.array[0].array[0].unknown); + assert_int_equal(status, F_none); + } + + { + const f_status_t status = f_directory_listingss_delete_callback(0, length, (void *) datass.array); + + assert_int_equal(status, F_none); + assert_int_equal(datass.array[0].size, 0); + } + + free((void *) datass.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_directory/tests/unit/c/test-directory-listingss_delete_callback.h b/level_0/f_directory/tests/unit/c/test-directory-listingss_delete_callback.h new file mode 100644 index 0000000..3b03a85 --- /dev/null +++ b/level_0/f_directory/tests/unit/c/test-directory-listingss_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Directory + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_directory__listingss_delete_callback +#define _TEST__F_directory__listingss_delete_callback + +/** + * Test that the function fails. + * + * @see f_directory_listingss_delete_callback() + */ +extern void test__f_directory_listingss_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_directory_listingss_delete_callback() + */ +extern void test__f_directory_listingss_delete_callback__works(void **state); + +#endif // _TEST__F_directory__listingss_delete_callback diff --git a/level_0/f_directory/tests/unit/c/test-directory-listingss_destroy_callback.c b/level_0/f_directory/tests/unit/c/test-directory-listingss_destroy_callback.c new file mode 100644 index 0000000..2aa5368 --- /dev/null +++ b/level_0/f_directory/tests/unit/c/test-directory-listingss_destroy_callback.c @@ -0,0 +1,261 @@ +#include "test-directory.h" +#include "test-directory-listingss_destroy_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_directory_listingss_destroy_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_directory_listing_t data = f_directory_listing_t_initialize; + f_directory_listing_t data_array[] = { data }; + f_directory_listings_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_directory_listings_t datas_array[] = { datas }; + + { + will_return(__wrap_f_string_dynamics_adjust, true); + will_return(__wrap_f_string_dynamics_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_listingss_destroy_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, true); + will_return(__wrap_f_string_dynamics_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_listingss_destroy_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, true); + will_return(__wrap_f_string_dynamics_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_listingss_destroy_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, true); + will_return(__wrap_f_string_dynamics_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_listingss_destroy_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, true); + will_return(__wrap_f_string_dynamics_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_listingss_destroy_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, true); + will_return(__wrap_f_string_dynamics_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_listingss_destroy_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, true); + will_return(__wrap_f_string_dynamics_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_listingss_destroy_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, true); + will_return(__wrap_f_string_dynamics_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_listingss_destroy_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_memory_array_adjust, true); + will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_listingss_destroy_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_directory_listingss_destroy_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_directory_listingss_t datass = f_directory_listingss_t_initialize; + + { + f_status_t status = f_memory_array_adjust(length, sizeof(f_directory_listings_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_none); + + status = f_memory_array_resize(1, sizeof(f_directory_listing_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size); + assert_int_equal(status, F_none); + + status = f_string_dynamics_adjust(1, &datass.array[0].array[0].block); + assert_int_equal(status, F_none); + + status = f_string_dynamics_adjust(1, &datass.array[0].array[0].character); + assert_int_equal(status, F_none); + + status = f_string_dynamics_adjust(1, &datass.array[0].array[0].directory); + assert_int_equal(status, F_none); + + status = f_string_dynamics_adjust(1, &datass.array[0].array[0].regular); + assert_int_equal(status, F_none); + + status = f_string_dynamics_adjust(1, &datass.array[0].array[0].link); + assert_int_equal(status, F_none); + + status = f_string_dynamics_adjust(1, &datass.array[0].array[0].fifo); + assert_int_equal(status, F_none); + + status = f_string_dynamics_adjust(1, &datass.array[0].array[0].socket); + assert_int_equal(status, F_none); + + status = f_string_dynamics_adjust(1, &datass.array[0].array[0].unknown); + assert_int_equal(status, F_none); + } + + { + const f_status_t status = f_directory_listingss_destroy_callback(0, length, (void *) datass.array); + + assert_int_equal(status, F_none); + assert_int_equal(datass.array[0].size, 0); + } + + free((void *) datass.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_directory/tests/unit/c/test-directory-listingss_destroy_callback.h b/level_0/f_directory/tests/unit/c/test-directory-listingss_destroy_callback.h new file mode 100644 index 0000000..ef59cc7 --- /dev/null +++ b/level_0/f_directory/tests/unit/c/test-directory-listingss_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Directory + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_directory__listingss_destroy_callback +#define _TEST__F_directory__listingss_destroy_callback + +/** + * Test that the function fails. + * + * @see f_directory_listingss_destroy_callback() + */ +extern void test__f_directory_listingss_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_directory_listingss_destroy_callback() + */ +extern void test__f_directory_listingss_destroy_callback__works(void **state); + +#endif // _TEST__F_directory__listingss_destroy_callback diff --git a/level_0/f_directory/tests/unit/c/test-directory-recurse_doss_delete_callback.c b/level_0/f_directory/tests/unit/c/test-directory-recurse_doss_delete_callback.c new file mode 100644 index 0000000..be47516 --- /dev/null +++ b/level_0/f_directory/tests/unit/c/test-directory-recurse_doss_delete_callback.c @@ -0,0 +1,342 @@ +#include "test-directory.h" +#include "test-directory-recurse_doss_delete_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_directory_recurse_doss_delete_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_directory_recurse_do_t data = f_directory_recurse_do_t_initialize; + f_directory_recurse_do_t data_array[] = { data }; + f_directory_recurse_dos_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_directory_recurse_dos_t datass_array[] = { datas }; + + { + will_return(__wrap_f_string_dynamic_resize, true); + will_return(__wrap_f_string_dynamic_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_recurse_doss_delete_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamic_resize, false); + will_return(__wrap_f_string_dynamic_resize, F_none); + + will_return(__wrap_f_string_dynamic_resize, true); + will_return(__wrap_f_string_dynamic_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_recurse_doss_delete_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamic_resize, false); + will_return(__wrap_f_string_dynamic_resize, F_none); + + will_return(__wrap_f_string_dynamic_resize, false); + will_return(__wrap_f_string_dynamic_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, true); + will_return(__wrap_f_string_dynamics_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_recurse_doss_delete_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamic_resize, false); + will_return(__wrap_f_string_dynamic_resize, F_none); + + will_return(__wrap_f_string_dynamic_resize, false); + will_return(__wrap_f_string_dynamic_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, true); + will_return(__wrap_f_string_dynamics_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_recurse_doss_delete_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamic_resize, false); + will_return(__wrap_f_string_dynamic_resize, F_none); + + will_return(__wrap_f_string_dynamic_resize, false); + will_return(__wrap_f_string_dynamic_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, true); + will_return(__wrap_f_string_dynamics_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_recurse_doss_delete_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamic_resize, false); + will_return(__wrap_f_string_dynamic_resize, F_none); + + will_return(__wrap_f_string_dynamic_resize, false); + will_return(__wrap_f_string_dynamic_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, true); + will_return(__wrap_f_string_dynamics_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_recurse_doss_delete_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamic_resize, false); + will_return(__wrap_f_string_dynamic_resize, F_none); + + will_return(__wrap_f_string_dynamic_resize, false); + will_return(__wrap_f_string_dynamic_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, true); + will_return(__wrap_f_string_dynamics_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_recurse_doss_delete_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamic_resize, false); + will_return(__wrap_f_string_dynamic_resize, F_none); + + will_return(__wrap_f_string_dynamic_resize, false); + will_return(__wrap_f_string_dynamic_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, true); + will_return(__wrap_f_string_dynamics_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_recurse_doss_delete_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamic_resize, false); + will_return(__wrap_f_string_dynamic_resize, F_none); + + will_return(__wrap_f_string_dynamic_resize, false); + will_return(__wrap_f_string_dynamic_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, true); + will_return(__wrap_f_string_dynamics_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_recurse_doss_delete_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamic_resize, false); + will_return(__wrap_f_string_dynamic_resize, F_none); + + will_return(__wrap_f_string_dynamic_resize, false); + will_return(__wrap_f_string_dynamic_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, true); + will_return(__wrap_f_string_dynamics_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_recurse_doss_delete_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamic_resize, false); + will_return(__wrap_f_string_dynamic_resize, F_none); + + will_return(__wrap_f_string_dynamic_resize, false); + will_return(__wrap_f_string_dynamic_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_memory_array_resize, true); + will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_recurse_doss_delete_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_directory_recurse_doss_delete_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_directory_recurse_doss_t datass = f_directory_recurse_doss_t_initialize; + + { + f_status_t status = f_memory_array_resize(length, sizeof(f_directory_recurse_dos_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_none); + + status = f_memory_array_resize(1, sizeof(f_directory_recurse_do_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size); + assert_int_equal(status, F_none); + + status = f_string_dynamic_resize(1, &datass.array[0].array[0].path); + assert_int_equal(status, F_none); + + status = f_string_dynamic_resize(1, &datass.array[0].array[0].path_cache); + assert_int_equal(status, F_none); + + status = f_string_dynamics_resize(1, &datass.array[0].array[0].listing.block); + assert_int_equal(status, F_none); + + status = f_string_dynamics_resize(1, &datass.array[0].array[0].listing.character); + assert_int_equal(status, F_none); + + status = f_string_dynamics_resize(1, &datass.array[0].array[0].listing.directory); + assert_int_equal(status, F_none); + + status = f_string_dynamics_resize(1, &datass.array[0].array[0].listing.regular); + assert_int_equal(status, F_none); + + status = f_string_dynamics_resize(1, &datass.array[0].array[0].listing.link); + assert_int_equal(status, F_none); + + status = f_string_dynamics_resize(1, &datass.array[0].array[0].listing.fifo); + assert_int_equal(status, F_none); + + status = f_string_dynamics_resize(1, &datass.array[0].array[0].listing.socket); + assert_int_equal(status, F_none); + + status = f_string_dynamics_resize(1, &datass.array[0].array[0].listing.unknown); + assert_int_equal(status, F_none); + } + + { + const f_status_t status = f_directory_recurse_doss_delete_callback(0, length, (void *) datass.array); + + assert_int_equal(status, F_none); + assert_int_equal(datass.array[0].size, 0); + } + + free((void *) datass.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_directory/tests/unit/c/test-directory-recurse_doss_delete_callback.h b/level_0/f_directory/tests/unit/c/test-directory-recurse_doss_delete_callback.h new file mode 100644 index 0000000..b5f8a5e --- /dev/null +++ b/level_0/f_directory/tests/unit/c/test-directory-recurse_doss_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Directory + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_directory__recurse_doss_delete_callback +#define _TEST__F_directory__recurse_doss_delete_callback + +/** + * Test that the function fails. + * + * @see f_directory_recurse_doss_delete_callback() + */ +extern void test__f_directory_recurse_doss_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_directory_recurse_doss_delete_callback() + */ +extern void test__f_directory_recurse_doss_delete_callback__works(void **state); + +#endif // _TEST__F_directory__recurse_doss_delete_callback diff --git a/level_0/f_directory/tests/unit/c/test-directory-recurse_doss_destroy_callback.c b/level_0/f_directory/tests/unit/c/test-directory-recurse_doss_destroy_callback.c new file mode 100644 index 0000000..3e3fd88 --- /dev/null +++ b/level_0/f_directory/tests/unit/c/test-directory-recurse_doss_destroy_callback.c @@ -0,0 +1,342 @@ +#include "test-directory.h" +#include "test-directory-recurse_doss_destroy_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_directory_recurse_doss_destroy_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_directory_recurse_do_t data = f_directory_recurse_do_t_initialize; + f_directory_recurse_do_t data_array[] = { data }; + f_directory_recurse_dos_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_directory_recurse_dos_t datass_array[] = { datas }; + + { + will_return(__wrap_f_string_dynamic_adjust, true); + will_return(__wrap_f_string_dynamic_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_recurse_doss_destroy_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamic_adjust, true); + will_return(__wrap_f_string_dynamic_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_recurse_doss_destroy_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, true); + will_return(__wrap_f_string_dynamics_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_recurse_doss_destroy_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, true); + will_return(__wrap_f_string_dynamics_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_recurse_doss_destroy_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, true); + will_return(__wrap_f_string_dynamics_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_recurse_doss_destroy_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, true); + will_return(__wrap_f_string_dynamics_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_recurse_doss_destroy_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, true); + will_return(__wrap_f_string_dynamics_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_recurse_doss_destroy_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, true); + will_return(__wrap_f_string_dynamics_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_recurse_doss_destroy_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, true); + will_return(__wrap_f_string_dynamics_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_recurse_doss_destroy_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, true); + will_return(__wrap_f_string_dynamics_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_recurse_doss_destroy_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_memory_array_adjust, true); + will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_recurse_doss_destroy_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_directory_recurse_doss_destroy_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_directory_recurse_doss_t datass = f_directory_recurse_doss_t_initialize; + + { + f_status_t status = f_memory_array_adjust(length, sizeof(f_directory_recurse_dos_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_none); + + status = f_memory_array_adjust(1, sizeof(f_directory_recurse_do_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size); + assert_int_equal(status, F_none); + + status = f_string_dynamic_adjust(1, &datass.array[0].array[0].path); + assert_int_equal(status, F_none); + + status = f_string_dynamic_adjust(1, &datass.array[0].array[0].path_cache); + assert_int_equal(status, F_none); + + status = f_string_dynamics_adjust(1, &datass.array[0].array[0].listing.block); + assert_int_equal(status, F_none); + + status = f_string_dynamics_adjust(1, &datass.array[0].array[0].listing.character); + assert_int_equal(status, F_none); + + status = f_string_dynamics_adjust(1, &datass.array[0].array[0].listing.directory); + assert_int_equal(status, F_none); + + status = f_string_dynamics_adjust(1, &datass.array[0].array[0].listing.regular); + assert_int_equal(status, F_none); + + status = f_string_dynamics_adjust(1, &datass.array[0].array[0].listing.link); + assert_int_equal(status, F_none); + + status = f_string_dynamics_adjust(1, &datass.array[0].array[0].listing.fifo); + assert_int_equal(status, F_none); + + status = f_string_dynamics_adjust(1, &datass.array[0].array[0].listing.socket); + assert_int_equal(status, F_none); + + status = f_string_dynamics_adjust(1, &datass.array[0].array[0].listing.unknown); + assert_int_equal(status, F_none); + } + + { + const f_status_t status = f_directory_recurse_doss_destroy_callback(0, length, (void *) datass.array); + + assert_int_equal(status, F_none); + assert_int_equal(datass.array[0].size, 0); + } + + free((void *) datass.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_directory/tests/unit/c/test-directory-recurse_doss_destroy_callback.h b/level_0/f_directory/tests/unit/c/test-directory-recurse_doss_destroy_callback.h new file mode 100644 index 0000000..af2d76f --- /dev/null +++ b/level_0/f_directory/tests/unit/c/test-directory-recurse_doss_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Directory + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_directory__recurse_doss_destroy_callback +#define _TEST__F_directory__recurse_doss_destroy_callback + +/** + * Test that the function fails. + * + * @see f_directory_recurse_doss_destroy_callback() + */ +extern void test__f_directory_recurse_doss_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_directory_recurse_doss_destroy_callback() + */ +extern void test__f_directory_recurse_doss_destroy_callback__works(void **state); + +#endif // _TEST__F_directory__recurse_doss_destroy_callback diff --git a/level_0/f_directory/tests/unit/c/test-directory-statusss_delete_callback.c b/level_0/f_directory/tests/unit/c/test-directory-statusss_delete_callback.c new file mode 100644 index 0000000..2082685 --- /dev/null +++ b/level_0/f_directory/tests/unit/c/test-directory-statusss_delete_callback.c @@ -0,0 +1,72 @@ +#include "test-directory.h" +#include "test-directory-statusss_delete_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_directory_statusss_delete_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_directory_status_t data = f_directory_status_t_initialize; + f_directory_status_t data_array[] = { data }; + f_directory_statuss_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_directory_statuss_t datass_array[] = { datas }; + + { + will_return(__wrap_f_string_dynamic_resize, true); + will_return(__wrap_f_string_dynamic_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_statusss_delete_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamic_resize, false); + will_return(__wrap_f_string_dynamic_resize, F_none); + + will_return(__wrap_f_memory_array_resize, true); + will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_statusss_delete_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_directory_statusss_delete_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_directory_statusss_t datass = f_directory_statusss_t_initialize; + + { + f_status_t status = f_memory_array_resize(length, sizeof(f_directory_statuss_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_none); + + status = f_memory_array_resize(1, sizeof(f_directory_status_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size); + assert_int_equal(status, F_none); + + status = f_string_dynamic_resize(1, &datass.array[0].array[0].path); + assert_int_equal(status, F_none); + } + + { + const f_status_t status = f_directory_statusss_delete_callback(0, length, (void *) datass.array); + + assert_int_equal(status, F_none); + assert_int_equal(datass.array[0].size, 0); + } + + free((void *) datass.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_directory/tests/unit/c/test-directory-statusss_delete_callback.h b/level_0/f_directory/tests/unit/c/test-directory-statusss_delete_callback.h new file mode 100644 index 0000000..e518d24 --- /dev/null +++ b/level_0/f_directory/tests/unit/c/test-directory-statusss_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Directory + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_directory__statusss_delete_callback +#define _TEST__F_directory__statusss_delete_callback + +/** + * Test that the function fails. + * + * @see f_directory_statusss_delete_callback() + */ +extern void test__f_directory_statusss_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_directory_statusss_delete_callback() + */ +extern void test__f_directory_statusss_delete_callback__works(void **state); + +#endif // _TEST__F_directory__statusss_delete_callback diff --git a/level_0/f_directory/tests/unit/c/test-directory-statusss_destroy_callback.c b/level_0/f_directory/tests/unit/c/test-directory-statusss_destroy_callback.c new file mode 100644 index 0000000..b660722 --- /dev/null +++ b/level_0/f_directory/tests/unit/c/test-directory-statusss_destroy_callback.c @@ -0,0 +1,72 @@ +#include "test-directory.h" +#include "test-directory-statusss_destroy_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_directory_statusss_destroy_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_directory_status_t data = f_directory_status_t_initialize; + f_directory_status_t data_array[] = { data }; + f_directory_statuss_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_directory_statuss_t datass_array[] = { datas }; + + { + will_return(__wrap_f_string_dynamic_adjust, true); + will_return(__wrap_f_string_dynamic_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_statusss_destroy_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_memory_array_adjust, true); + will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_statusss_destroy_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_directory_statusss_destroy_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_directory_statusss_t datass = f_directory_statusss_t_initialize; + + { + f_status_t status = f_memory_array_adjust(length, sizeof(f_directory_statuss_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_none); + + status = f_memory_array_adjust(1, sizeof(f_directory_status_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size); + assert_int_equal(status, F_none); + + status = f_string_dynamic_adjust(1, &datass.array[0].array[0].path); + assert_int_equal(status, F_none); + } + + { + const f_status_t status = f_directory_statusss_destroy_callback(0, length, (void *) datass.array); + + assert_int_equal(status, F_none); + assert_int_equal(datass.array[0].size, 0); + } + + free((void *) datass.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_directory/tests/unit/c/test-directory-statusss_destroy_callback.h b/level_0/f_directory/tests/unit/c/test-directory-statusss_destroy_callback.h new file mode 100644 index 0000000..38ef90d --- /dev/null +++ b/level_0/f_directory/tests/unit/c/test-directory-statusss_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Directory + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_directory__statusss_destroy_callback +#define _TEST__F_directory__statusss_destroy_callback + +/** + * Test that the function fails. + * + * @see f_directory_statusss_destroy_callback() + */ +extern void test__f_directory_statusss_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_directory_statusss_destroy_callback() + */ +extern void test__f_directory_statusss_destroy_callback__works(void **state); + +#endif // _TEST__F_directory__statusss_destroy_callback diff --git a/level_0/f_directory/tests/unit/c/test-directory.c b/level_0/f_directory/tests/unit/c/test-directory.c index f0aaaa9..7b992e9 100644 --- a/level_0/f_directory/tests/unit/c/test-directory.c +++ b/level_0/f_directory/tests/unit/c/test-directory.c @@ -70,21 +70,33 @@ int main(void) { cmocka_unit_test(test__f_directory_listings_destroy_callback__fails), cmocka_unit_test(test__f_directory_listings_delete_callback__fails), + cmocka_unit_test(test__f_directory_listingss_destroy_callback__fails), + cmocka_unit_test(test__f_directory_listingss_delete_callback__fails), cmocka_unit_test(test__f_directory_listings_destroy_callback__works), cmocka_unit_test(test__f_directory_listings_delete_callback__works), + cmocka_unit_test(test__f_directory_listingss_destroy_callback__works), + cmocka_unit_test(test__f_directory_listingss_delete_callback__works), cmocka_unit_test(test__f_directory_recurse_dos_destroy_callback__fails), cmocka_unit_test(test__f_directory_recurse_dos_delete_callback__fails), + cmocka_unit_test(test__f_directory_recurse_doss_destroy_callback__fails), + cmocka_unit_test(test__f_directory_recurse_doss_delete_callback__fails), cmocka_unit_test(test__f_directory_recurse_dos_destroy_callback__works), cmocka_unit_test(test__f_directory_recurse_dos_delete_callback__works), + cmocka_unit_test(test__f_directory_recurse_doss_destroy_callback__works), + cmocka_unit_test(test__f_directory_recurse_doss_delete_callback__works), cmocka_unit_test(test__f_directory_statuss_destroy_callback__fails), cmocka_unit_test(test__f_directory_statuss_delete_callback__fails), + cmocka_unit_test(test__f_directory_statusss_destroy_callback__fails), + cmocka_unit_test(test__f_directory_statusss_delete_callback__fails), cmocka_unit_test(test__f_directory_statuss_destroy_callback__works), cmocka_unit_test(test__f_directory_statuss_delete_callback__works), + cmocka_unit_test(test__f_directory_statusss_destroy_callback__works), + cmocka_unit_test(test__f_directory_statusss_delete_callback__works), cmocka_unit_test(test__f_directory_touch__fails), cmocka_unit_test(test__f_directory_touch__returns_data_not), @@ -106,10 +118,21 @@ int main(void) { cmocka_unit_test(test__f_directory_open_at__parameter_checking), cmocka_unit_test(test__f_directory_remove__parameter_checking), cmocka_unit_test(test__f_directory_remove_custom__parameter_checking), - // f_directory_statuss_destroy_callback() doesn't use parameter checking. - // f_directory_statuss_delete_callback() doesn't use parameter checking. // f_directory_touch() doesn't use parameter checking. // f_directory_touch_at() doesn't use parameter checking. + + // f_directory_listings_destroy_callback() doesn't use parameter checking. + // f_directory_listings_delete_callback() doesn't use parameter checking. + // f_directory_listingss_destroy_callback() doesn't use parameter checking. + // f_directory_listingss_delete_callback() doesn't use parameter checking. + // f_directory_recurse_dos_destroy_callback() doesn't use parameter checking. + // f_directory_recurse_dos_delete_callback() doesn't use parameter checking. + // f_directory_recurse_doss_destroy_callback() doesn't use parameter checking. + // f_directory_recurse_doss_delete_callback() doesn't use parameter checking. + // f_directory_statuss_destroy_callback() doesn't use parameter checking. + // f_directory_statuss_delete_callback() doesn't use parameter checking. + // f_directory_statusss_destroy_callback() doesn't use parameter checking. + // f_directory_statusss_delete_callback() doesn't use parameter checking. #endif // _di_level_0_parameter_checking_ }; diff --git a/level_0/f_directory/tests/unit/c/test-directory.h b/level_0/f_directory/tests/unit/c/test-directory.h index 196169f..6bedc79 100644 --- a/level_0/f_directory/tests/unit/c/test-directory.h +++ b/level_0/f_directory/tests/unit/c/test-directory.h @@ -39,10 +39,16 @@ #include "test-directory-remove_custom.h" #include "test-directory-listings_destroy_callback.h" #include "test-directory-listings_delete_callback.h" +#include "test-directory-listingss_destroy_callback.h" +#include "test-directory-listingss_delete_callback.h" #include "test-directory-recurse_dos_destroy_callback.h" #include "test-directory-recurse_dos_delete_callback.h" +#include "test-directory-recurse_doss_destroy_callback.h" +#include "test-directory-recurse_doss_delete_callback.h" #include "test-directory-statuss_destroy_callback.h" #include "test-directory-statuss_delete_callback.h" +#include "test-directory-statusss_destroy_callback.h" +#include "test-directory-statusss_delete_callback.h" #include "test-directory-touch.h" #include "test-directory-touch_at.h" diff --git a/level_0/f_fss/c/fss/item.h b/level_0/f_fss/c/fss/item.h index a1f397d..e699ae0 100644 --- a/level_0/f_fss/c/fss/item.h +++ b/level_0/f_fss/c/fss/item.h @@ -75,7 +75,7 @@ extern "C" { * } * * Properties: - * - array: The array of object, their associated content, and their associated parent. + * - array: The array of fss_items. * - size: Total amount of allocated space. * - used: Total number of allocated spaces used. */ @@ -94,6 +94,28 @@ extern "C" { #endif // _di_f_fss_items_t_ /** + * This holds an array of an array of fss_items. + * + * Properties: + * - array: The array of an array of fss_items. + * - size: Total amount of allocated space. + * - used: Total number of allocated spaces used. + */ +#ifndef _di_f_fss_itemss_t_ + typedef struct { + f_fss_items_t *array; + + f_number_unsigned_t size; + f_number_unsigned_t used; + } f_fss_itemss_t; + + #define f_fss_itemss_t_initialize { 0, 0, 0 } + + #define macro_f_fss_itemss_t_initialize_1(array, size, used) { array, size, used } + #define macro_f_fss_itemss_t_initialize_2(array, length) { array, length, length } +#endif // _di_f_fss_itemss_t_ + +/** * Delete an item. * * @param item diff --git a/level_0/f_fss/c/fss/named.h b/level_0/f_fss/c/fss/named.h index 66cd709..957b6ec 100644 --- a/level_0/f_fss/c/fss/named.h +++ b/level_0/f_fss/c/fss/named.h @@ -73,6 +73,30 @@ extern "C" { #endif // _di_f_fss_nameds_t_ /** + * This holds an array of an array of f_fss_nameds_t. + * + * Properties: + * - array: An array an array of of f_fss_nameds_t. + * - size: Total amount of allocated space. + * - used: Total number of allocated spaces used. + */ +#ifndef _di_f_fss_namedss_t_ + typedef struct { + f_fss_nameds_t *array; + + f_number_unsigned_t size; + f_number_unsigned_t used; + } f_fss_namedss_t; + + #define f_fss_namedss_t_initialize { 0, 0, 0 } + + #define macro_f_fss_namedss_t_initialize_1(array, size, used) { array, size, used } + #define macro_f_fss_namedss_t_initialize_2(array, length) { array, length, length } + + #define macro_f_fss_namedss_t_clear(nameds) macro_f_memory_structures_clear(nameds) +#endif // _di_f_fss_namedss_t_ + +/** * Delete a named. * * @param named diff --git a/level_0/f_fss/c/fss/nest.c b/level_0/f_fss/c/fss/nest.c index 50b0ef6..cbb7715 100644 --- a/level_0/f_fss/c/fss/nest.c +++ b/level_0/f_fss/c/fss/nest.c @@ -90,6 +90,11 @@ extern "C" { if (F_status_is_error(status)) return status; } } // for + + if (array[i].size) { + status = f_memory_array_resize(0, sizeof(f_fss_items_t), (void **) &array[i].depth, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } } // for } @@ -125,6 +130,11 @@ extern "C" { if (F_status_is_error(status)) return status; } } // for + + if (array[i].size) { + status = f_memory_array_adjust(0, sizeof(f_fss_items_t), (void **) &array[i].depth, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } } // for } @@ -159,6 +169,11 @@ extern "C" { if (F_status_is_error(status)) return status; } } // for + + if (array[i].array[j].size) { + status = f_memory_array_resize(0, sizeof(f_fss_items_t), (void **) &array[i].array[j].depth, &array[i].array[j].used, &array[i].array[j].size); + if (F_status_is_error(status)) return status; + } } // for if (array[i].size) { @@ -203,6 +218,11 @@ extern "C" { if (F_status_is_error(status)) return status; } } // for + + if (array[i].array[j].size) { + status = f_memory_array_adjust(0, sizeof(f_fss_items_t), (void **) &array[i].array[j].depth, &array[i].array[j].used, &array[i].array[j].size); + if (F_status_is_error(status)) return status; + } } // for if (array[i].size) { diff --git a/level_0/f_fss/c/fss/nest.h b/level_0/f_fss/c/fss/nest.h index 1e5cd0e..449944f 100644 --- a/level_0/f_fss/c/fss/nest.h +++ b/level_0/f_fss/c/fss/nest.h @@ -69,6 +69,30 @@ extern "C" { #endif // _di_f_fss_nests_t_ /** + * This holds an array of an array of f_fss_nests_t. + * + * Properties: + * - array: An array of an array of f_fss_nests_t. + * - size: Total amount of allocated space. + * - used: Total number of allocated spaces used. + */ +#ifndef _di_f_fss_nestss_t_ + typedef struct { + f_fss_nests_t *array; + + f_number_unsigned_t size; + f_number_unsigned_t used; + } f_fss_nestss_t; + + #define f_fss_nestss_t_initialize { 0, 0, 0 } + + #define macro_f_fss_nestss_t_initialize_1(array, size, used) { array, size, used } + #define macro_f_fss_nestss_t_initialize_2(array, length) { array, length, length } + + #define macro_f_fss_nestss_t_clear(nests) macro_f_memory_structures_clear(nests) +#endif // _di_f_fss_nestss_t_ + +/** * Delete a nest. * * @param nest diff --git a/level_0/f_fss/c/fss/set.h b/level_0/f_fss/c/fss/set.h index 44af1f7..fcd8689 100644 --- a/level_0/f_fss/c/fss/set.h +++ b/level_0/f_fss/c/fss/set.h @@ -66,6 +66,30 @@ extern "C" { #endif // _di_f_fss_sets_t_ /** + * This holds an array of an array of f_fss_sets_t. + * + * Properties: + * - array: An array of an array of f_fss_sets_t. + * - size: Total amount of allocated space. + * - used: Total number of allocated spaces used. + */ +#ifndef _di_f_fss_setss_t_ + typedef struct { + f_fss_sets_t *array; + + f_number_unsigned_t size; + f_number_unsigned_t used; + } f_fss_setss_t; + + #define f_fss_setss_t_initialize { 0, 0, 0 } + + #define macro_f_fss_setss_t_initialize_1(array, size, used) { array, size, used } + #define macro_f_fss_setss_t_initialize_2(array, length) { array, length, length } + + #define macro_f_fss_setss_t_clear(sets) macro_f_memory_structures_clear(sets) +#endif // _di_f_fss_setss_t_ + +/** * Delete a set. * * @param set diff --git a/level_0/f_fss/c/fss/set_quote.h b/level_0/f_fss/c/fss/set_quote.h index bc22edd..2ba808f 100644 --- a/level_0/f_fss/c/fss/set_quote.h +++ b/level_0/f_fss/c/fss/set_quote.h @@ -73,6 +73,30 @@ extern "C" { #endif // _di_f_fss_set_quotes_t_ /** + * This holds an array of an array of f_fss_set_quotes_t. + * + * Properties: + * - array: An array of an array of f_fss_set_quotes_t. + * - size: Total amount of allocated space. + * - used: Total number of allocated spaces used. + */ +#ifndef _di_f_fss_set_quotess_t_ + typedef struct { + f_fss_set_quotes_t *array; + + f_number_unsigned_t size; + f_number_unsigned_t used; + } f_fss_set_quotess_t; + + #define f_fss_set_quotess_t_initialize { 0, 0, 0 } + + #define macro_f_fss_set_quotess_t_initialize_1(array, size, used) { array, size, used } + #define macro_f_fss_set_quotess_t_initialize_2(array, length) { array, length, length } + + #define macro_f_fss_set_quotess_t_clear(set_quotes) macro_f_memory_structures_clear(set_quotes) +#endif // _di_f_fss_set_quotess_t_ + +/** * Delete a quote set. * * @param set_quote @@ -83,15 +107,15 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. * + * Errors (with error bit) from: f_memory_array_resize(). + * Errors (with error bit) from: f_memory_arrays_resize(). * Errors (with error bit) from: f_string_ranges_resize(). * Errors (with error bit) from: f_string_rangess_resize(). - * Errors (with error bit) from: f_uint8s_resize(). - * Errors (with error bit) from: f_uint8ss_resize(). * + * @see f_memory_array_resize() + * @see f_memory_arrays_resize() * @see f_string_ranges_resize() * @see f_string_rangess_resize() - * @see f_uint8s_resize() - * @see f_uint8ss_resize() */ #ifndef _di_f_fss_set_quote_delete_ extern f_status_t f_fss_set_quote_delete(f_fss_set_quote_t * const set_quote); @@ -108,15 +132,15 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. * + * Errors (with error bit) from: f_memory_array_adjust(). + * Errors (with error bit) from: f_memory_arrays_adjust(). * Errors (with error bit) from: f_string_ranges_adjust(). * Errors (with error bit) from: f_string_rangess_adjust(). - * Errors (with error bit) from: f_uint8s_adjust(). - * Errors (with error bit) from: f_uint8ss_adjust(). * + * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() * @see f_string_ranges_adjust() * @see f_string_rangess_adjust() - * @see f_uint8s_adjust() - * @see f_uint8ss_adjust() */ #ifndef _di_f_fss_set_quote_destroy_ extern f_status_t f_fss_set_quote_destroy(f_fss_set_quote_t * const set_quote); @@ -142,16 +166,15 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. * + * Errors (with error bit) from: f_memory_array_resize(). + * Errors (with error bit) from: f_memory_arrays_resize(). * Errors (with error bit) from: f_string_ranges_resize(). * Errors (with error bit) from: f_string_rangess_resize(). * - * Errors (with error bit) from: f_uint8s_resize(). - * Errors (with error bit) from: f_uint8ss_resize(). - * + * @see f_memory_array_resize() + * @see f_memory_arrays_resize() * @see f_string_ranges_resize() * @see f_string_rangess_resize() - * @see f_uint8s_resize() - * @see f_uint8ss_resize() */ #ifndef _di_f_fss_set_quotes_delete_callback_ extern f_status_t f_fss_set_quotes_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); @@ -177,16 +200,15 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. * + * Errors (with error bit) from: f_memory_array_adjust(). + * Errors (with error bit) from: f_memory_arrays_adjust(). * Errors (with error bit) from: f_string_ranges_adjust(). * Errors (with error bit) from: f_string_rangess_adjust(). * - * Errors (with error bit) from: f_uint8s_adjust(). - * Errors (with error bit) from: f_uint8ss_adjust(). - * + * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() * @see f_string_ranges_adjust() * @see f_string_rangess_adjust() - * @see f_uint8s_adjust() - * @see f_uint8ss_adjust() */ #ifndef _di_f_fss_set_quotes_destroy_callback_ extern f_status_t f_fss_set_quotes_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); @@ -212,16 +234,15 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. * + * Errors (with error bit) from: f_memory_array_resize(). + * Errors (with error bit) from: f_memory_arrays_resize(). * Errors (with error bit) from: f_string_ranges_resize(). * Errors (with error bit) from: f_string_rangess_resize(). * - * Errors (with error bit) from: f_uint8s_resize(). - * Errors (with error bit) from: f_uint8ss_resize(). - * + * @see f_memory_array_resize() + * @see f_memory_arrays_resize() * @see f_string_ranges_resize() * @see f_string_rangess_resize() - * @see f_uint8s_resize() - * @see f_uint8ss_resize() */ #ifndef _di_f_fss_set_quotess_delete_callback_ extern f_status_t f_fss_set_quotess_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); @@ -247,16 +268,15 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. * + * Errors (with error bit) from: f_memory_array_adjust(). + * Errors (with error bit) from: f_memory_arrays_adjust(). * Errors (with error bit) from: f_string_ranges_adjust(). * Errors (with error bit) from: f_string_rangess_adjust(). * - * Errors (with error bit) from: f_uint8s_adjust(). - * Errors (with error bit) from: f_uint8ss_adjust(). - * + * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() * @see f_string_ranges_adjust() * @see f_string_rangess_adjust() - * @see f_uint8s_adjust() - * @see f_uint8ss_adjust() */ #ifndef _di_f_fss_set_quotess_destroy_callback_ extern f_status_t f_fss_set_quotess_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); diff --git a/level_0/f_fss/c/fss/simple_packet.c b/level_0/f_fss/c/fss/simple_packet.c index 0d016b3..52bbdfb 100644 --- a/level_0/f_fss/c/fss/simple_packet.c +++ b/level_0/f_fss/c/fss/simple_packet.c @@ -165,7 +165,7 @@ extern "C" { } // for if (array[i].size) { - status = f_memory_array_resize(0, sizeof(f_fss_simple_packet_t), (void **) &array[i].array, &array[i].used, &array[i].size); + status = f_memory_array_adjust(0, sizeof(f_fss_simple_packet_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } } // for diff --git a/level_0/f_fss/c/fss/simple_packet.h b/level_0/f_fss/c/fss/simple_packet.h index 0d25a4b..f9aa062 100644 --- a/level_0/f_fss/c/fss/simple_packet.h +++ b/level_0/f_fss/c/fss/simple_packet.h @@ -169,10 +169,10 @@ extern "C" { #endif // _di_f_fss_simple_packet_ranges_t_ /** - * This holds an array of f_fss_simple_packet_ranges_t. + * This holds an array of an array of f_fss_simple_packet_range_t. * * Properties: - * - array: An array of f_fss_simple_packet_ranges_t. + * - array: An array of an array of f_fss_simple_packet_range_t. * - size: Total amount of allocated space. * - used: Total number of allocated spaces used. */ diff --git a/level_0/f_fss/data/build/settings-mocks b/level_0/f_fss/data/build/settings-mocks index d97f4de..eb8d51a 100644 --- a/level_0/f_fss/data/build/settings-mocks +++ b/level_0/f_fss/data/build/settings-mocks @@ -61,3 +61,13 @@ flags-coverage --coverage -fprofile-abs-path -fprofile-dir=build/coverage/ flags_library -fPIC # Inject mocks. +flags -Wl,--wrap=f_memory_array_adjust +flags -Wl,--wrap=f_memory_array_resize +flags -Wl,--wrap=f_memory_arrays_adjust +flags -Wl,--wrap=f_memory_arrays_resize +flags -Wl,--wrap=f_string_dynamic_adjust +flags -Wl,--wrap=f_string_dynamic_resize +flags -Wl,--wrap=f_string_ranges_adjust +flags -Wl,--wrap=f_string_ranges_resize +flags -Wl,--wrap=f_string_rangess_adjust +flags -Wl,--wrap=f_string_rangess_resize diff --git a/level_0/f_fss/data/build/settings-tests b/level_0/f_fss/data/build/settings-tests index 2ebed50..dd57ac0 100644 --- a/level_0/f_fss/data/build/settings-tests +++ b/level_0/f_fss/data/build/settings-tests @@ -27,16 +27,12 @@ build_libraries-individual -lf_memory -lf_string -lf_type_array -lf_utf -lf_fss build_sources_program test-fss-apply_delimit.c test-fss-apply_delimit_range.c test-fss-count_lines.c test-fss-count_lines_range.c test-fss-fail_utf.c test-fss-fail_utf_to_false.c test-fss-is_combining.c test-fss-is_graph.c test-fss-is_space.c test-fss-is_zero_width.c test-fss-seek_to_eol.c test-fss-skip_past_delimit.c test-fss-skip_past_space.c -#build_sources_program test-fss-items_destroy_callback.c test-fss-items_delete_callback.c -#build_sources_program test-fss-named_destroy_callback.c test-fss-named_delete_callback.c -#build_sources_program test-fss-nameds_destroy_callback.c test-fss-nameds_delete_callback.c -#build_sources_program test-fss-nest_destroy_callback.c test-fss-nest_delete_callback.c -#build_sources_program test-fss-nests_destroy_callback.c test-fss-nests_delete_callback.c -#build_sources_program test-fss-set_destroy_callback.c test-fss-set_delete_callback.c -#build_sources_program test-fss-set_quote_destroy_callback.c test-fss-set_quote_delete_callback.c -#build_sources_program test-fss-set_quotes_destroy_callback.c test-fss-set_quotes_delete_callback.c -#build_sources_program test-fss-sets_destroy_callback.c test-fss-sets_delete_callback.c -#build_sources_program test-fss-simple_packet_ranges_destroy_callback.c test-fss-simple_packet_ranges_delete_callback.c +build_sources_program test-fss-items_destroy_callback.c test-fss-items_delete_callback.c test-fss-itemss_destroy_callback.c test-fss-itemss_delete_callback.c +build_sources_program test-fss-nameds_destroy_callback.c test-fss-nameds_delete_callback.c test-fss-namedss_destroy_callback.c test-fss-namedss_delete_callback.c +build_sources_program test-fss-nests_destroy_callback.c test-fss-nests_delete_callback.c test-fss-nestss_destroy_callback.c test-fss-nestss_delete_callback.c +build_sources_program test-fss-sets_destroy_callback.c test-fss-sets_delete_callback.c test-fss-setss_destroy_callback.c test-fss-setss_delete_callback.c +build_sources_program test-fss-set_quotes_destroy_callback.c test-fss-set_quotes_delete_callback.c test-fss-set_quotess_destroy_callback.c test-fss-set_quotess_delete_callback.c +build_sources_program test-fss-simple_packets_destroy_callback.c test-fss-simple_packets_delete_callback.c test-fss-simple_packetss_destroy_callback.c test-fss-simple_packetss_delete_callback.c build_sources_program test-fss.c diff --git a/level_0/f_fss/data/build/testfile b/level_0/f_fss/data/build/testfile index f89f284..8ff3718 100644 --- a/level_0/f_fss/data/build/testfile +++ b/level_0/f_fss/data/build/testfile @@ -18,7 +18,7 @@ settings: #define CMOCKA_XML_FILE ./out.xml main: - build settings individual test + build settings-mocks individual test build settings-tests individual test operate build_path diff --git a/level_0/f_fss/tests/unit/c/mock-fss.c b/level_0/f_fss/tests/unit/c/mock-fss.c index bbdd908..1cc41d6 100644 --- a/level_0/f_fss/tests/unit/c/mock-fss.c +++ b/level_0/f_fss/tests/unit/c/mock-fss.c @@ -4,21 +4,178 @@ extern "C" { #endif -/*int __wrap_getgrgid_r(uid_t uid, struct group *grp, char *buf, size_t buflen, struct group **result) { +int mock_unwrap = 0; +int mock_unwrap_f_memory = 1; + +f_status_t __wrap_f_memory_array_adjust(const f_number_unsigned_t length, const size_t width, void ** const array, f_number_unsigned_t * const used, f_number_unsigned_t * const size) { + + if (mock_unwrap_f_memory) { + return __real_f_memory_array_adjust(length, width, array, used, size); + } + + if (!array || !used || !size) return F_status_set_error(F_parameter_not); + + const bool failure = mock_type(bool); + + if (failure) return mock_type(f_status_t); + + *size = length; + + return mock_type(f_status_t); +} + +f_status_t __wrap_f_memory_array_resize(const f_number_unsigned_t length, const size_t width, void ** const array, f_number_unsigned_t * const used, f_number_unsigned_t * const size) { + + if (mock_unwrap_f_memory) { + return __real_f_memory_array_resize(length, width, array, used, size); + } + + if (!array || !used || !size) return F_status_set_error(F_parameter_not); + + const bool failure = mock_type(bool); + + if (failure) return mock_type(f_status_t); + + *size = length; + + return mock_type(f_status_t); +} + +f_status_t __wrap_f_memory_arrays_adjust(const f_number_unsigned_t length, const size_t width, void ** const array, f_number_unsigned_t * const used, f_number_unsigned_t * const size, f_status_t (*callback)(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array)) { + + if (mock_unwrap_f_memory) { + return __real_f_memory_arrays_resize(length, width, array, used, size, callback); + } + + if (!array || !used || !size || !callback) return F_status_set_error(F_parameter_not); const bool failure = mock_type(bool); - if (failure) { - errno = mock_type(int); + if (failure) return mock_type(f_status_t); + + *size = length; + + return mock_type(f_status_t); +} - return 1; +f_status_t __wrap_f_memory_arrays_resize(const f_number_unsigned_t length, const size_t width, void ** const array, f_number_unsigned_t * const used, f_number_unsigned_t * const size, f_status_t (*callback)(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array)) { + + if (mock_unwrap_f_memory) { + return __real_f_memory_arrays_resize(length, width, array, used, size, callback); } - *grp = *mock_type(struct group *); - *result = mock_type(struct group *); + if (!array || !used || !size || !callback) return F_status_set_error(F_parameter_not); + + const bool failure = mock_type(bool); + + if (failure) return mock_type(f_status_t); + + *size = length; + + return mock_type(f_status_t); +} + +f_status_t __wrap_f_string_dynamic_adjust(const f_number_unsigned_t length, f_string_dynamic_t * const structure) { + + if (mock_unwrap) { + return __real_f_string_dynamic_adjust(length, structure); + } + + if (!structure) return F_status_set_error(F_parameter_not); + + const bool failure = mock_type(bool); + + if (failure) return mock_type(f_status_t); + + structure->size = length; + + return mock_type(f_status_t); +} + +f_status_t __wrap_f_string_dynamic_resize(const f_number_unsigned_t length, f_string_dynamic_t * const structure) { + + if (mock_unwrap) { + return __real_f_string_dynamic_resize(length, structure); + } + + if (!structure) return F_status_set_error(F_parameter_not); + + const bool failure = mock_type(bool); + + if (failure) return mock_type(f_status_t); + + structure->size = length; + + return mock_type(f_status_t); +} + +f_status_t __wrap_f_string_ranges_adjust(const f_number_unsigned_t length, f_string_ranges_t * const structure) { + + if (mock_unwrap) { + return __real_f_string_ranges_adjust(length, structure); + } + + if (!structure) return F_status_set_error(F_parameter_not); + + const bool failure = mock_type(bool); + + if (failure) return mock_type(f_status_t); + + structure->size = length; + + return mock_type(f_status_t); +} + +f_status_t __wrap_f_string_ranges_resize(const f_number_unsigned_t length, f_string_ranges_t * const structure) { + + if (mock_unwrap) { + return __real_f_string_ranges_resize(length, structure); + } + + if (!structure) return F_status_set_error(F_parameter_not); + + const bool failure = mock_type(bool); + + if (failure) return mock_type(f_status_t); + + structure->size = length; + + return mock_type(f_status_t); +} + +f_status_t __wrap_f_string_rangess_adjust(const f_number_unsigned_t length, f_string_ranges_t * const structure) { + + if (mock_unwrap) { + return __real_f_string_rangess_adjust(length, structure); + } + + if (!structure) return F_status_set_error(F_parameter_not); + + const bool failure = mock_type(bool); + + if (failure) return mock_type(f_status_t); + + structure->size = length; + + return mock_type(f_status_t); +} + +f_status_t __wrap_f_string_rangess_resize(const f_number_unsigned_t length, f_string_ranges_t * const structure) { + + if (mock_unwrap) { + return __real_f_string_rangess_resize(length, structure); + } + + if (!structure) return F_status_set_error(F_parameter_not); + + const bool failure = mock_type(bool); + + if (failure) return mock_type(f_status_t); + + structure->size = length; - return 0; -}*/ + return mock_type(f_status_t); +} #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_fss/tests/unit/c/mock-fss.h b/level_0/f_fss/tests/unit/c/mock-fss.h index 53e02a5..ade2dcd 100644 --- a/level_0/f_fss/tests/unit/c/mock-fss.h +++ b/level_0/f_fss/tests/unit/c/mock-fss.h @@ -28,6 +28,33 @@ extern "C" { const static int mock_errno_generic = 32767; +extern int mock_unwrap; +extern int mock_unwrap_f_memory; + +extern f_status_t __real_f_memory_array_adjust(const f_number_unsigned_t length, const size_t width, void ** const array, f_number_unsigned_t * const used, f_number_unsigned_t * const size); +extern f_status_t __real_f_memory_array_resize(const f_number_unsigned_t length, const size_t width, void ** const array, f_number_unsigned_t * const used, f_number_unsigned_t * const size); +extern f_status_t __real_f_memory_arrays_adjust(const f_number_unsigned_t length, const size_t width, void ** const array, f_number_unsigned_t * const used, f_number_unsigned_t * const size, f_status_t (*callback)(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array)); +extern f_status_t __real_f_memory_arrays_resize(const f_number_unsigned_t length, const size_t width, void ** const array, f_number_unsigned_t * const used, f_number_unsigned_t * const size, f_status_t (*callback)(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array)); + +extern f_status_t __real_f_string_dynamic_adjust(const f_number_unsigned_t length, f_string_dynamic_t * const structure); +extern f_status_t __real_f_string_dynamic_resize(const f_number_unsigned_t length, f_string_dynamic_t * const structure); +extern f_status_t __real_f_string_ranges_adjust(const f_number_unsigned_t length, f_string_ranges_t * const structure); +extern f_status_t __real_f_string_ranges_resize(const f_number_unsigned_t length, f_string_ranges_t * const structure); +extern f_status_t __real_f_string_rangess_adjust(const f_number_unsigned_t length, f_string_ranges_t * const structure); +extern f_status_t __real_f_string_rangess_resize(const f_number_unsigned_t length, f_string_ranges_t * const structure); + +extern f_status_t __wrap_f_memory_array_adjust(const f_number_unsigned_t length, const size_t width, void ** const array, f_number_unsigned_t * const used, f_number_unsigned_t * const size); +extern f_status_t __wrap_f_memory_array_resize(const f_number_unsigned_t length, const size_t width, void ** const array, f_number_unsigned_t * const used, f_number_unsigned_t * const size); +extern f_status_t __wrap_f_memory_arrays_adjust(const f_number_unsigned_t length, const size_t width, void ** const array, f_number_unsigned_t * const used, f_number_unsigned_t * const size, f_status_t (*callback)(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array)); +extern f_status_t __wrap_f_memory_arrays_resize(const f_number_unsigned_t length, const size_t width, void ** const array, f_number_unsigned_t * const used, f_number_unsigned_t * const size, f_status_t (*callback)(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array)); + +extern f_status_t __wrap_f_string_dynamic_adjust(const f_number_unsigned_t length, f_string_dynamic_t * const structure); +extern f_status_t __wrap_f_string_dynamic_resize(const f_number_unsigned_t length, f_string_dynamic_t * const structure); +extern f_status_t __wrap_f_string_ranges_adjust(const f_number_unsigned_t length, f_string_ranges_t * const structure); +extern f_status_t __wrap_f_string_ranges_resize(const f_number_unsigned_t length, f_string_ranges_t * const structure); +extern f_status_t __wrap_f_string_rangess_adjust(const f_number_unsigned_t length, f_string_ranges_t * const structure); +extern f_status_t __wrap_f_string_rangess_resize(const f_number_unsigned_t length, f_string_ranges_t * const structure); + //extern long __wrap_sysconf(int name); #ifdef __cplusplus diff --git a/level_0/f_fss/tests/unit/c/test-fss-items_delete_callback.c b/level_0/f_fss/tests/unit/c/test-fss-items_delete_callback.c index 7374955..a025dc1 100644 --- a/level_0/f_fss/tests/unit/c/test-fss-items_delete_callback.c +++ b/level_0/f_fss/tests/unit/c/test-fss-items_delete_callback.c @@ -1,5 +1,5 @@ -#include "test-directory.h" -#include "test-directory-listings_delete_callback.h" +#include "test-fss.h" +#include "test-fss-items_delete_callback.h" #ifdef __cplusplus extern "C" { @@ -8,164 +8,18 @@ extern "C" { void test__f_fss_items_delete_callback__fails(void **state) { mock_unwrap = 0; + mock_unwrap_f_memory = 0; f_fss_item_t data = f_fss_item_t_initialize; f_fss_item_t data_array[] = { data }; f_fss_items_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_fss_items_t datass_array[] = { datas }; + f_fss_items_t datas_array[] = { datas }; { - will_return(__wrap_f_string_dynamics_resize, true); - will_return(__wrap_f_string_dynamics_resize, F_status_set_error(F_failure)); + will_return(__wrap_f_string_ranges_resize, true); + will_return(__wrap_f_string_ranges_resize, F_status_set_error(F_failure)); - const f_status_t status = f_fss_items_delete_callback(0, 1, (void *) datass_array); - - assert_int_equal(status, F_status_set_error(F_failure)); - } - - { - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_none); - - will_return(__wrap_f_string_dynamics_resize, true); - will_return(__wrap_f_string_dynamics_resize, F_status_set_error(F_failure)); - - const f_status_t status = f_fss_items_delete_callback(0, 1, (void *) datass_array); - - assert_int_equal(status, F_status_set_error(F_failure)); - } - - { - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_none); - - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_none); - - will_return(__wrap_f_string_dynamics_resize, true); - will_return(__wrap_f_string_dynamics_resize, F_status_set_error(F_failure)); - - const f_status_t status = f_fss_items_delete_callback(0, 1, (void *) datass_array); - - assert_int_equal(status, F_status_set_error(F_failure)); - } - - { - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_none); - - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_none); - - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_none); - - will_return(__wrap_f_string_dynamics_resize, true); - will_return(__wrap_f_string_dynamics_resize, F_status_set_error(F_failure)); - - const f_status_t status = f_fss_items_delete_callback(0, 1, (void *) datass_array); - - assert_int_equal(status, F_status_set_error(F_failure)); - } - - { - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_none); - - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_none); - - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_none); - - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_none); - - will_return(__wrap_f_string_dynamics_resize, true); - will_return(__wrap_f_string_dynamics_resize, F_status_set_error(F_failure)); - - const f_status_t status = f_fss_items_delete_callback(0, 1, (void *) datass_array); - - assert_int_equal(status, F_status_set_error(F_failure)); - } - - { - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_none); - - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_none); - - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_none); - - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_none); - - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_none); - - will_return(__wrap_f_string_dynamics_resize, true); - will_return(__wrap_f_string_dynamics_resize, F_status_set_error(F_failure)); - - const f_status_t status = f_fss_items_delete_callback(0, 1, (void *) datass_array); - - assert_int_equal(status, F_status_set_error(F_failure)); - } - - { - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_none); - - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_none); - - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_none); - - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_none); - - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_none); - - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_none); - - will_return(__wrap_f_string_dynamics_resize, true); - will_return(__wrap_f_string_dynamics_resize, F_status_set_error(F_failure)); - - const f_status_t status = f_fss_items_delete_callback(0, 1, (void *) datass_array); - - assert_int_equal(status, F_status_set_error(F_failure)); - } - - { - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_none); - - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_none); - - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_none); - - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_none); - - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_none); - - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_none); - - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_none); - - will_return(__wrap_f_string_dynamics_resize, true); - will_return(__wrap_f_string_dynamics_resize, F_status_set_error(F_failure)); - - const f_status_t status = f_fss_items_delete_callback(0, 1, (void *) datass_array); + const f_status_t status = f_fss_items_delete_callback(0, 1, (void *) datas_array); assert_int_equal(status, F_status_set_error(F_failure)); } @@ -174,39 +28,19 @@ void test__f_fss_items_delete_callback__fails(void **state) { void test__f_fss_items_delete_callback__works(void **state) { mock_unwrap = 0; + mock_unwrap_f_memory = 0; f_fss_item_t data = f_fss_item_t_initialize; f_fss_item_t data_array[] = { data }; f_fss_items_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_fss_items_t datass_array[] = { datas }; + f_fss_items_t datas_array[] = { datas }; const f_number_unsigned_t length = 1; { - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_none); - - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_none); - - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_none); - - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_none); - - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_none); - - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_none); - - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_none); - - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_none); + will_return(__wrap_f_string_ranges_resize, false); + will_return(__wrap_f_string_ranges_resize, F_none); - const f_status_t status = f_fss_items_delete_callback(0, length, (void *) datass_array); + const f_status_t status = f_fss_items_delete_callback(0, length, (void *) datas_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_fss/tests/unit/c/test-fss-items_delete_callback.h b/level_0/f_fss/tests/unit/c/test-fss-items_delete_callback.h index 1972635..29f1a0d 100644 --- a/level_0/f_fss/tests/unit/c/test-fss-items_delete_callback.h +++ b/level_0/f_fss/tests/unit/c/test-fss-items_delete_callback.h @@ -7,8 +7,8 @@ * * Test the array types in the type project. */ -#ifndef _TEST__F_fss__listings_delete_callback -#define _TEST__F_fss__listings_delete_callback +#ifndef _TEST__F_fss__items_delete_callback +#define _TEST__F_fss__items_delete_callback /** * Test that the function fails. @@ -24,4 +24,4 @@ extern void test__f_fss_items_delete_callback__fails(void **state); */ extern void test__f_fss_items_delete_callback__works(void **state); -#endif // _TEST__F_fss__listings_delete_callback +#endif // _TEST__F_fss__items_delete_callback diff --git a/level_0/f_fss/tests/unit/c/test-fss-items_destroy_callback.c b/level_0/f_fss/tests/unit/c/test-fss-items_destroy_callback.c index 39d03b9..2bd8828 100644 --- a/level_0/f_fss/tests/unit/c/test-fss-items_destroy_callback.c +++ b/level_0/f_fss/tests/unit/c/test-fss-items_destroy_callback.c @@ -1,5 +1,5 @@ -#include "test-directory.h" -#include "test-directory-listings_destroy_callback.h" +#include "test-fss.h" +#include "test-fss-items_destroy_callback.h" #ifdef __cplusplus extern "C" { @@ -8,164 +8,18 @@ extern "C" { void test__f_fss_items_destroy_callback__fails(void **state) { mock_unwrap = 0; + mock_unwrap_f_memory = 0; f_fss_item_t data = f_fss_item_t_initialize; f_fss_item_t data_array[] = { data }; f_fss_items_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_fss_items_t datass_array[] = { datas }; + f_fss_items_t datas_array[] = { datas }; { - will_return(__wrap_f_string_dynamics_adjust, true); - will_return(__wrap_f_string_dynamics_adjust, F_status_set_error(F_failure)); + will_return(__wrap_f_string_ranges_adjust, true); + will_return(__wrap_f_string_ranges_adjust, F_status_set_error(F_failure)); - const f_status_t status = f_fss_items_destroy_callback(0, 1, (void *) datass_array); - - assert_int_equal(status, F_status_set_error(F_failure)); - } - - { - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_none); - - will_return(__wrap_f_string_dynamics_adjust, true); - will_return(__wrap_f_string_dynamics_adjust, F_status_set_error(F_failure)); - - const f_status_t status = f_fss_items_destroy_callback(0, 1, (void *) datass_array); - - assert_int_equal(status, F_status_set_error(F_failure)); - } - - { - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_none); - - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_none); - - will_return(__wrap_f_string_dynamics_adjust, true); - will_return(__wrap_f_string_dynamics_adjust, F_status_set_error(F_failure)); - - const f_status_t status = f_fss_items_destroy_callback(0, 1, (void *) datass_array); - - assert_int_equal(status, F_status_set_error(F_failure)); - } - - { - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_none); - - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_none); - - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_none); - - will_return(__wrap_f_string_dynamics_adjust, true); - will_return(__wrap_f_string_dynamics_adjust, F_status_set_error(F_failure)); - - const f_status_t status = f_fss_items_destroy_callback(0, 1, (void *) datass_array); - - assert_int_equal(status, F_status_set_error(F_failure)); - } - - { - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_none); - - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_none); - - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_none); - - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_none); - - will_return(__wrap_f_string_dynamics_adjust, true); - will_return(__wrap_f_string_dynamics_adjust, F_status_set_error(F_failure)); - - const f_status_t status = f_fss_items_destroy_callback(0, 1, (void *) datass_array); - - assert_int_equal(status, F_status_set_error(F_failure)); - } - - { - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_none); - - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_none); - - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_none); - - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_none); - - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_none); - - will_return(__wrap_f_string_dynamics_adjust, true); - will_return(__wrap_f_string_dynamics_adjust, F_status_set_error(F_failure)); - - const f_status_t status = f_fss_items_destroy_callback(0, 1, (void *) datass_array); - - assert_int_equal(status, F_status_set_error(F_failure)); - } - - { - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_none); - - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_none); - - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_none); - - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_none); - - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_none); - - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_none); - - will_return(__wrap_f_string_dynamics_adjust, true); - will_return(__wrap_f_string_dynamics_adjust, F_status_set_error(F_failure)); - - const f_status_t status = f_fss_items_destroy_callback(0, 1, (void *) datass_array); - - assert_int_equal(status, F_status_set_error(F_failure)); - } - - { - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_none); - - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_none); - - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_none); - - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_none); - - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_none); - - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_none); - - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_none); - - will_return(__wrap_f_string_dynamics_adjust, true); - will_return(__wrap_f_string_dynamics_adjust, F_status_set_error(F_failure)); - - const f_status_t status = f_fss_items_destroy_callback(0, 1, (void *) datass_array); + const f_status_t status = f_fss_items_destroy_callback(0, 1, (void *) datas_array); assert_int_equal(status, F_status_set_error(F_failure)); } @@ -174,39 +28,19 @@ void test__f_fss_items_destroy_callback__fails(void **state) { void test__f_fss_items_destroy_callback__works(void **state) { mock_unwrap = 0; + mock_unwrap_f_memory = 0; f_fss_item_t data = f_fss_item_t_initialize; f_fss_item_t data_array[] = { data }; f_fss_items_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_fss_items_t datass_array[] = { datas }; + f_fss_items_t datas_array[] = { datas }; const f_number_unsigned_t length = 1; { - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_none); - - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_none); - - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_none); - - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_none); - - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_none); - - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_none); - - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_none); - - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_none); + will_return(__wrap_f_string_ranges_adjust, false); + will_return(__wrap_f_string_ranges_adjust, F_none); - const f_status_t status = f_fss_items_destroy_callback(0, length, (void *) datass_array); + const f_status_t status = f_fss_items_destroy_callback(0, length, (void *) datas_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_fss/tests/unit/c/test-fss-items_destroy_callback.h b/level_0/f_fss/tests/unit/c/test-fss-items_destroy_callback.h index 637dc10..d492d9b 100644 --- a/level_0/f_fss/tests/unit/c/test-fss-items_destroy_callback.h +++ b/level_0/f_fss/tests/unit/c/test-fss-items_destroy_callback.h @@ -7,8 +7,8 @@ * * Test the array types in the type project. */ -#ifndef _TEST__F_fss__listings_destroy_callback -#define _TEST__F_fss__listings_destroy_callback +#ifndef _TEST__F_fss__items_destroy_callback +#define _TEST__F_fss__items_destroy_callback /** * Test that the function fails. @@ -24,4 +24,4 @@ extern void test__f_fss_items_destroy_callback__fails(void **state); */ extern void test__f_fss_items_destroy_callback__works(void **state); -#endif // _TEST__F_fss__listings_destroy_callback +#endif // _TEST__F_fss__items_destroy_callback diff --git a/level_0/f_fss/tests/unit/c/test-fss-itemss_delete_callback.c b/level_0/f_fss/tests/unit/c/test-fss-itemss_delete_callback.c new file mode 100644 index 0000000..129340b --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-itemss_delete_callback.c @@ -0,0 +1,72 @@ +#include "test-fss.h" +#include "test-fss-itemss_delete_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_itemss_delete_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_fss_item_t data = f_fss_item_t_initialize; + f_fss_item_t data_array[] = { data }; + f_fss_items_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_fss_items_t datas_array[] = { datas }; + + { + will_return(__wrap_f_string_ranges_resize, true); + will_return(__wrap_f_string_ranges_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_itemss_delete_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_ranges_resize, false); + will_return(__wrap_f_string_ranges_resize, F_none); + + will_return(__wrap_f_memory_array_resize, true); + will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_itemss_delete_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_fss_itemss_delete_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_fss_itemss_t datass = f_fss_itemss_t_initialize; + + { + f_status_t status = f_memory_array_resize(length, sizeof(f_fss_items_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_none); + + status = f_memory_array_resize(1, sizeof(f_fss_item_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size); + assert_int_equal(status, F_none); + + status = f_string_ranges_resize(1, &datass.array[0].array[0].content); + assert_int_equal(status, F_none); + } + + { + const f_status_t status = f_fss_itemss_delete_callback(0, length, (void *) datass.array); + + assert_int_equal(status, F_none); + assert_int_equal(datass.array[0].size, 0); + } + + free((void *) datass.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-itemss_delete_callback.h b/level_0/f_fss/tests/unit/c/test-fss-itemss_delete_callback.h new file mode 100644 index 0000000..b534c28 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-itemss_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_fss__itemss_delete_callback +#define _TEST__F_fss__itemss_delete_callback + +/** + * Test that the function fails. + * + * @see f_fss_itemss_delete_callback() + */ +extern void test__f_fss_itemss_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_fss_itemss_delete_callback() + */ +extern void test__f_fss_itemss_delete_callback__works(void **state); + +#endif // _TEST__F_fss__itemss_delete_callback diff --git a/level_0/f_fss/tests/unit/c/test-fss-itemss_destroy_callback.c b/level_0/f_fss/tests/unit/c/test-fss-itemss_destroy_callback.c new file mode 100644 index 0000000..969558c --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-itemss_destroy_callback.c @@ -0,0 +1,72 @@ +#include "test-fss.h" +#include "test-fss-itemss_destroy_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_itemss_destroy_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_fss_item_t data = f_fss_item_t_initialize; + f_fss_item_t data_array[] = { data }; + f_fss_items_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_fss_items_t datas_array[] = { datas }; + + { + will_return(__wrap_f_string_ranges_adjust, true); + will_return(__wrap_f_string_ranges_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_itemss_destroy_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_ranges_adjust, false); + will_return(__wrap_f_string_ranges_adjust, F_none); + + will_return(__wrap_f_memory_array_adjust, true); + will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_itemss_destroy_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_fss_itemss_destroy_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_fss_itemss_t datass = f_fss_itemss_t_initialize; + + { + f_status_t status = f_memory_array_adjust(length, sizeof(f_fss_items_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_none); + + status = f_memory_array_adjust(1, sizeof(f_fss_item_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size); + assert_int_equal(status, F_none); + + status = f_string_ranges_adjust(1, &datass.array[0].array[0].content); + assert_int_equal(status, F_none); + } + + { + const f_status_t status = f_fss_itemss_destroy_callback(0, length, (void *) datass.array); + + assert_int_equal(status, F_none); + assert_int_equal(datass.array[0].size, 0); + } + + free((void *) datass.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-itemss_destroy_callback.h b/level_0/f_fss/tests/unit/c/test-fss-itemss_destroy_callback.h new file mode 100644 index 0000000..47811c7 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-itemss_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_fss__itemss_destroy_callback +#define _TEST__F_fss__itemss_destroy_callback + +/** + * Test that the function fails. + * + * @see f_fss_itemss_destroy_callback() + */ +extern void test__f_fss_itemss_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_fss_itemss_destroy_callback() + */ +extern void test__f_fss_itemss_destroy_callback__works(void **state); + +#endif // _TEST__F_fss__itemss_destroy_callback diff --git a/level_0/f_fss/tests/unit/c/test-fss-nameds_delete_callback.c b/level_0/f_fss/tests/unit/c/test-fss-nameds_delete_callback.c new file mode 100644 index 0000000..64403f2 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-nameds_delete_callback.c @@ -0,0 +1,84 @@ +#include "test-fss.h" +#include "test-fss-nameds_delete_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_nameds_delete_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_fss_named_t data = f_fss_named_t_initialize; + f_fss_named_t data_array[] = { data }; + f_fss_nameds_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_fss_nameds_t datas_array[] = { datas }; + + { + will_return(__wrap_f_string_ranges_resize, true); + will_return(__wrap_f_string_ranges_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_nameds_delete_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_ranges_resize, false); + will_return(__wrap_f_string_ranges_resize, F_none); + + will_return(__wrap_f_string_rangess_resize, true); + will_return(__wrap_f_string_rangess_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_nameds_delete_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_ranges_resize, false); + will_return(__wrap_f_string_ranges_resize, F_none); + + will_return(__wrap_f_string_rangess_resize, false); + will_return(__wrap_f_string_rangess_resize, F_none); + + will_return(__wrap_f_memory_arrays_resize, true); + will_return(__wrap_f_memory_arrays_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_nameds_delete_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_fss_nameds_delete_callback__works(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_fss_named_t data = f_fss_named_t_initialize; + f_fss_named_t data_array[] = { data }; + f_fss_nameds_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_fss_nameds_t datas_array[] = { datas }; + const f_number_unsigned_t length = 1; + + { + will_return(__wrap_f_string_ranges_resize, false); + will_return(__wrap_f_string_ranges_resize, F_none); + + will_return(__wrap_f_string_rangess_resize, false); + will_return(__wrap_f_string_rangess_resize, F_none); + + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_none); + + const f_status_t status = f_fss_nameds_delete_callback(0, length, (void *) datas_array); + + assert_int_equal(status, F_none); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-nameds_delete_callback.h b/level_0/f_fss/tests/unit/c/test-fss-nameds_delete_callback.h new file mode 100644 index 0000000..4d7eb5a --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-nameds_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_fss__nameds_delete_callback +#define _TEST__F_fss__nameds_delete_callback + +/** + * Test that the function fails. + * + * @see f_fss_nameds_delete_callback() + */ +extern void test__f_fss_nameds_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_fss_nameds_delete_callback() + */ +extern void test__f_fss_nameds_delete_callback__works(void **state); + +#endif // _TEST__F_fss__nameds_delete_callback diff --git a/level_0/f_fss/tests/unit/c/test-fss-nameds_destroy_callback.c b/level_0/f_fss/tests/unit/c/test-fss-nameds_destroy_callback.c new file mode 100644 index 0000000..54e5412 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-nameds_destroy_callback.c @@ -0,0 +1,84 @@ +#include "test-fss.h" +#include "test-fss-nameds_destroy_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_nameds_destroy_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_fss_named_t data = f_fss_named_t_initialize; + f_fss_named_t data_array[] = { data }; + f_fss_nameds_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_fss_nameds_t datas_array[] = { datas }; + + { + will_return(__wrap_f_string_ranges_adjust, true); + will_return(__wrap_f_string_ranges_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_nameds_destroy_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_ranges_adjust, false); + will_return(__wrap_f_string_ranges_adjust, F_none); + + will_return(__wrap_f_string_rangess_adjust, true); + will_return(__wrap_f_string_rangess_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_nameds_destroy_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_ranges_adjust, false); + will_return(__wrap_f_string_ranges_adjust, F_none); + + will_return(__wrap_f_string_rangess_adjust, false); + will_return(__wrap_f_string_rangess_adjust, F_none); + + will_return(__wrap_f_memory_arrays_adjust, true); + will_return(__wrap_f_memory_arrays_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_nameds_destroy_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_fss_nameds_destroy_callback__works(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_fss_named_t data = f_fss_named_t_initialize; + f_fss_named_t data_array[] = { data }; + f_fss_nameds_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_fss_nameds_t datas_array[] = { datas }; + const f_number_unsigned_t length = 1; + + { + will_return(__wrap_f_string_ranges_adjust, false); + will_return(__wrap_f_string_ranges_adjust, F_none); + + will_return(__wrap_f_string_rangess_adjust, false); + will_return(__wrap_f_string_rangess_adjust, F_none); + + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_none); + + const f_status_t status = f_fss_nameds_destroy_callback(0, length, (void *) datas_array); + + assert_int_equal(status, F_none); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-nameds_destroy_callback.h b/level_0/f_fss/tests/unit/c/test-fss-nameds_destroy_callback.h new file mode 100644 index 0000000..52c5c50 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-nameds_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_fss__nameds_destroy_callback +#define _TEST__F_fss__nameds_destroy_callback + +/** + * Test that the function fails. + * + * @see f_fss_nameds_destroy_callback() + */ +extern void test__f_fss_nameds_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_fss_nameds_destroy_callback() + */ +extern void test__f_fss_nameds_destroy_callback__works(void **state); + +#endif // _TEST__F_fss__nameds_destroy_callback diff --git a/level_0/f_fss/tests/unit/c/test-fss-namedss_delete_callback.c b/level_0/f_fss/tests/unit/c/test-fss-namedss_delete_callback.c new file mode 100644 index 0000000..0afab83 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-namedss_delete_callback.c @@ -0,0 +1,96 @@ +#include "test-fss.h" +#include "test-fss-namedss_delete_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_namedss_delete_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_fss_named_t data = f_fss_named_t_initialize; + f_fss_named_t data_array[] = { data }; + f_fss_nameds_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_fss_nameds_t datas_array[] = { datas }; + + { + will_return(__wrap_f_string_ranges_resize, true); + will_return(__wrap_f_string_ranges_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_namedss_delete_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_ranges_resize, false); + will_return(__wrap_f_string_ranges_resize, F_none); + + will_return(__wrap_f_string_rangess_resize, true); + will_return(__wrap_f_string_rangess_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_namedss_delete_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_ranges_resize, false); + will_return(__wrap_f_string_ranges_resize, F_none); + + will_return(__wrap_f_string_rangess_resize, false); + will_return(__wrap_f_string_rangess_resize, F_none); + + will_return(__wrap_f_memory_arrays_resize, true); + will_return(__wrap_f_memory_arrays_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_namedss_delete_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_fss_namedss_delete_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_fss_namedss_t datass = f_fss_namedss_t_initialize; + + { + f_status_t status = f_memory_array_resize(length, sizeof(f_fss_nameds_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_none); + + status = f_memory_array_resize(1, sizeof(f_fss_named_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size); + assert_int_equal(status, F_none); + + status = f_string_ranges_resize(1, &datass.array[0].array[0].objects); + assert_int_equal(status, F_none); + + status = f_string_rangess_resize(1, &datass.array[0].array[0].contents); + assert_int_equal(status, F_none); + + status = f_memory_arrays_resize(1, sizeof(f_uint8s_t), (void **) &datass.array[0].array[0].quotess.array, &datass.array[0].array[0].quotess.used, &datass.array[0].array[0].quotess.size, &f_uint8ss_delete_callback); + assert_int_equal(status, F_none); + + status = f_memory_array_resize(1, sizeof(uint8_t), (void **) &datass.array[0].array[0].quotess.array[0].array, &datass.array[0].array[0].quotess.array[0].used, &datass.array[0].array[0].quotess.array[0].size); + assert_int_equal(status, F_none); + } + + { + const f_status_t status = f_fss_namedss_delete_callback(0, length, (void *) datass.array); + + assert_int_equal(status, F_none); + assert_int_equal(datass.array[0].size, 0); + } + + free((void *) datass.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-namedss_delete_callback.h b/level_0/f_fss/tests/unit/c/test-fss-namedss_delete_callback.h new file mode 100644 index 0000000..ba1e5f6 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-namedss_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_fss__namedss_delete_callback +#define _TEST__F_fss__namedss_delete_callback + +/** + * Test that the function fails. + * + * @see f_fss_namedss_delete_callback() + */ +extern void test__f_fss_namedss_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_fss_namedss_delete_callback() + */ +extern void test__f_fss_namedss_delete_callback__works(void **state); + +#endif // _TEST__F_fss__namedss_delete_callback diff --git a/level_0/f_fss/tests/unit/c/test-fss-namedss_destroy_callback.c b/level_0/f_fss/tests/unit/c/test-fss-namedss_destroy_callback.c new file mode 100644 index 0000000..e6ce2ee --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-namedss_destroy_callback.c @@ -0,0 +1,96 @@ +#include "test-fss.h" +#include "test-fss-namedss_destroy_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_namedss_destroy_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_fss_named_t data = f_fss_named_t_initialize; + f_fss_named_t data_array[] = { data }; + f_fss_nameds_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_fss_nameds_t datas_array[] = { datas }; + + { + will_return(__wrap_f_string_ranges_adjust, true); + will_return(__wrap_f_string_ranges_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_namedss_destroy_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_ranges_adjust, false); + will_return(__wrap_f_string_ranges_adjust, F_none); + + will_return(__wrap_f_string_rangess_adjust, true); + will_return(__wrap_f_string_rangess_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_namedss_destroy_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_ranges_adjust, false); + will_return(__wrap_f_string_ranges_adjust, F_none); + + will_return(__wrap_f_string_rangess_adjust, false); + will_return(__wrap_f_string_rangess_adjust, F_none); + + will_return(__wrap_f_memory_arrays_adjust, true); + will_return(__wrap_f_memory_arrays_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_namedss_destroy_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_fss_namedss_destroy_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_fss_namedss_t datass = f_fss_namedss_t_initialize; + + { + f_status_t status = f_memory_array_adjust(length, sizeof(f_fss_nameds_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_none); + + status = f_memory_array_adjust(1, sizeof(f_fss_named_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size); + assert_int_equal(status, F_none); + + status = f_string_ranges_adjust(1, &datass.array[0].array[0].objects); + assert_int_equal(status, F_none); + + status = f_string_rangess_adjust(1, &datass.array[0].array[0].contents); + assert_int_equal(status, F_none); + + status = f_memory_arrays_adjust(1, sizeof(f_uint8s_t), (void **) &datass.array[0].array[0].quotess.array, &datass.array[0].array[0].quotess.used, &datass.array[0].array[0].quotess.size, &f_uint8ss_delete_callback); + assert_int_equal(status, F_none); + + status = f_memory_array_adjust(1, sizeof(uint8_t), (void **) &datass.array[0].array[0].quotess.array[0].array, &datass.array[0].array[0].quotess.array[0].used, &datass.array[0].array[0].quotess.array[0].size); + assert_int_equal(status, F_none); + } + + { + const f_status_t status = f_fss_namedss_destroy_callback(0, length, (void *) datass.array); + + assert_int_equal(status, F_none); + assert_int_equal(datass.array[0].size, 0); + } + + free((void *) datass.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-namedss_destroy_callback.h b/level_0/f_fss/tests/unit/c/test-fss-namedss_destroy_callback.h new file mode 100644 index 0000000..bde4720 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-namedss_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_fss__namedss_destroy_callback +#define _TEST__F_fss__namedss_destroy_callback + +/** + * Test that the function fails. + * + * @see f_fss_namedss_destroy_callback() + */ +extern void test__f_fss_namedss_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_fss_namedss_destroy_callback() + */ +extern void test__f_fss_namedss_destroy_callback__works(void **state); + +#endif // _TEST__F_fss__namedss_destroy_callback diff --git a/level_0/f_fss/tests/unit/c/test-fss-nests_delete_callback.c b/level_0/f_fss/tests/unit/c/test-fss-nests_delete_callback.c new file mode 100644 index 0000000..659c0f3 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-nests_delete_callback.c @@ -0,0 +1,88 @@ +#include "test-fss.h" +#include "test-fss-nests_delete_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_nests_delete_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_fss_item_t item = f_fss_item_t_initialize; + f_fss_item_t item_array[] = { item }; + f_fss_items_t items = { .array = item_array, .used = 1, .size = 1 }; + f_fss_items_t items_array[] = { items }; + f_fss_nest_t data = { .depth = items_array, .used = 1, .size = 1 }; + f_fss_nest_t data_array[] = { data }; + + { + will_return(__wrap_f_string_ranges_resize, true); + will_return(__wrap_f_string_ranges_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_nests_delete_callback(0, 1, (void *) data_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_ranges_resize, false); + will_return(__wrap_f_string_ranges_resize, F_none); + + will_return(__wrap_f_memory_array_resize, true); + will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_nests_delete_callback(0, 1, (void *) data_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_ranges_resize, false); + will_return(__wrap_f_string_ranges_resize, F_none); + + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_none); + + will_return(__wrap_f_memory_array_resize, true); + will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_nests_delete_callback(0, 1, (void *) data_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_fss_nests_delete_callback__works(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_fss_item_t item = f_fss_item_t_initialize; + f_fss_item_t item_array[] = { item }; + f_fss_items_t items = { .array = item_array, .used = 1, .size = 1 }; + f_fss_items_t items_array[] = { items }; + f_fss_nest_t data = { .depth = items_array, .used = 1, .size = 1 }; + f_fss_nest_t data_array[] = { data }; + const f_number_unsigned_t length = 1; + + { + will_return(__wrap_f_string_ranges_resize, false); + will_return(__wrap_f_string_ranges_resize, F_none); + + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_none); + + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_none); + + const f_status_t status = f_fss_nests_delete_callback(0, length, (void *) data_array); + + assert_int_equal(status, F_none); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-nests_delete_callback.h b/level_0/f_fss/tests/unit/c/test-fss-nests_delete_callback.h new file mode 100644 index 0000000..8c18256 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-nests_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_fss__nests_delete_callback +#define _TEST__F_fss__nests_delete_callback + +/** + * Test that the function fails. + * + * @see f_fss_nests_delete_callback() + */ +extern void test__f_fss_nests_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_fss_nests_delete_callback() + */ +extern void test__f_fss_nests_delete_callback__works(void **state); + +#endif // _TEST__F_fss__nests_delete_callback diff --git a/level_0/f_fss/tests/unit/c/test-fss-nests_destroy_callback.c b/level_0/f_fss/tests/unit/c/test-fss-nests_destroy_callback.c new file mode 100644 index 0000000..a8e8a86 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-nests_destroy_callback.c @@ -0,0 +1,88 @@ +#include "test-fss.h" +#include "test-fss-nests_destroy_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_nests_destroy_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_fss_item_t item = f_fss_item_t_initialize; + f_fss_item_t item_array[] = { item }; + f_fss_items_t items = { .array = item_array, .used = 1, .size = 1 }; + f_fss_items_t items_array[] = { items }; + f_fss_nest_t data = { .depth = items_array, .used = 1, .size = 1 }; + f_fss_nest_t data_array[] = { data }; + + { + will_return(__wrap_f_string_ranges_adjust, true); + will_return(__wrap_f_string_ranges_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_nests_destroy_callback(0, 1, (void *) data_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_ranges_adjust, false); + will_return(__wrap_f_string_ranges_adjust, F_none); + + will_return(__wrap_f_memory_array_adjust, true); + will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_nests_destroy_callback(0, 1, (void *) data_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_ranges_adjust, false); + will_return(__wrap_f_string_ranges_adjust, F_none); + + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_none); + + will_return(__wrap_f_memory_array_adjust, true); + will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_nests_destroy_callback(0, 1, (void *) data_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_fss_nests_destroy_callback__works(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_fss_item_t item = f_fss_item_t_initialize; + f_fss_item_t item_array[] = { item }; + f_fss_items_t items = { .array = item_array, .used = 1, .size = 1 }; + f_fss_items_t items_array[] = { items }; + f_fss_nest_t data = { .depth = items_array, .used = 1, .size = 1 }; + f_fss_nest_t data_array[] = { data }; + const f_number_unsigned_t length = 1; + + { + will_return(__wrap_f_string_ranges_adjust, false); + will_return(__wrap_f_string_ranges_adjust, F_none); + + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_none); + + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_none); + + const f_status_t status = f_fss_nests_destroy_callback(0, length, (void *) data_array); + + assert_int_equal(status, F_none); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-nests_destroy_callback.h b/level_0/f_fss/tests/unit/c/test-fss-nests_destroy_callback.h new file mode 100644 index 0000000..297c3ae --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-nests_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_fss__nests_destroy_callback +#define _TEST__F_fss__nests_destroy_callback + +/** + * Test that the function fails. + * + * @see f_fss_nests_destroy_callback() + */ +extern void test__f_fss_nests_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_fss_nests_destroy_callback() + */ +extern void test__f_fss_nests_destroy_callback__works(void **state); + +#endif // _TEST__F_fss__nests_destroy_callback diff --git a/level_0/f_fss/tests/unit/c/test-fss-nestss_delete_callback.c b/level_0/f_fss/tests/unit/c/test-fss-nestss_delete_callback.c new file mode 100644 index 0000000..6ede591 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-nestss_delete_callback.c @@ -0,0 +1,82 @@ +#include "test-fss.h" +#include "test-fss-nestss_delete_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_nestss_delete_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_fss_item_t item = f_fss_item_t_initialize; + f_fss_item_t item_array[] = { item }; + f_fss_items_t items = { .array = item_array, .used = 1, .size = 1 }; + f_fss_items_t items_array[] = { items }; + f_fss_nest_t data = { .depth = items_array, .used = 1, .size = 1 }; + f_fss_nest_t data_array[] = { data }; + f_fss_nests_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_fss_nests_t datas_array[] = { datas }; + + { + will_return(__wrap_f_string_ranges_resize, true); + will_return(__wrap_f_string_ranges_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_nestss_delete_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_ranges_resize, false); + will_return(__wrap_f_string_ranges_resize, F_none); + + will_return(__wrap_f_memory_array_resize, true); + will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_nestss_delete_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_fss_nestss_delete_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_fss_nestss_t datass = f_fss_nestss_t_initialize; + + { + f_status_t status = f_memory_array_resize(length, sizeof(f_fss_nests_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_none); + + status = f_memory_array_resize(1, sizeof(f_fss_nest_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size); + assert_int_equal(status, F_none); + + status = f_memory_array_resize(1, sizeof(f_fss_items_t), (void **) &datass.array[0].array[0].depth, &datass.array[0].array[0].used, &datass.array[0].array[0].size); + assert_int_equal(status, F_none); + + status = f_memory_array_resize(1, sizeof(f_fss_item_t), (void **) &datass.array[0].array[0].depth[0].array, &datass.array[0].array[0].depth[0].used, &datass.array[0].array[0].depth[0].size); + assert_int_equal(status, F_none); + + status = f_string_ranges_resize(1, &datass.array[0].array[0].depth[0].array[0].content); + assert_int_equal(status, F_none); + } + + { + const f_status_t status = f_fss_nestss_delete_callback(0, length, (void *) datass.array); + + assert_int_equal(status, F_none); + assert_int_equal(datass.array[0].size, 0); + } + + free((void *) datass.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-nestss_delete_callback.h b/level_0/f_fss/tests/unit/c/test-fss-nestss_delete_callback.h new file mode 100644 index 0000000..9163439 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-nestss_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_fss__nestss_delete_callback +#define _TEST__F_fss__nestss_delete_callback + +/** + * Test that the function fails. + * + * @see f_fss_nestss_delete_callback() + */ +extern void test__f_fss_nestss_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_fss_nestss_delete_callback() + */ +extern void test__f_fss_nestss_delete_callback__works(void **state); + +#endif // _TEST__F_fss__nestss_delete_callback diff --git a/level_0/f_fss/tests/unit/c/test-fss-nestss_destroy_callback.c b/level_0/f_fss/tests/unit/c/test-fss-nestss_destroy_callback.c new file mode 100644 index 0000000..2f91f06 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-nestss_destroy_callback.c @@ -0,0 +1,82 @@ +#include "test-fss.h" +#include "test-fss-nestss_destroy_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_nestss_destroy_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_fss_item_t item = f_fss_item_t_initialize; + f_fss_item_t item_array[] = { item }; + f_fss_items_t items = { .array = item_array, .used = 1, .size = 1 }; + f_fss_items_t items_array[] = { items }; + f_fss_nest_t data = { .depth = items_array, .used = 1, .size = 1 }; + f_fss_nest_t data_array[] = { data }; + f_fss_nests_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_fss_nests_t datas_array[] = { datas }; + + { + will_return(__wrap_f_string_ranges_adjust, true); + will_return(__wrap_f_string_ranges_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_nestss_destroy_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_ranges_adjust, false); + will_return(__wrap_f_string_ranges_adjust, F_none); + + will_return(__wrap_f_memory_array_adjust, true); + will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_nestss_destroy_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_fss_nestss_destroy_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_fss_nestss_t datass = f_fss_nestss_t_initialize; + + { + f_status_t status = f_memory_array_adjust(length, sizeof(f_fss_nests_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_none); + + status = f_memory_array_adjust(1, sizeof(f_fss_nest_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size); + assert_int_equal(status, F_none); + + status = f_memory_array_adjust(1, sizeof(f_fss_items_t), (void **) &datass.array[0].array[0].depth, &datass.array[0].array[0].used, &datass.array[0].array[0].size); + assert_int_equal(status, F_none); + + status = f_memory_array_adjust(1, sizeof(f_fss_item_t), (void **) &datass.array[0].array[0].depth[0].array, &datass.array[0].array[0].depth[0].used, &datass.array[0].array[0].depth[0].size); + assert_int_equal(status, F_none); + + status = f_string_ranges_adjust(1, &datass.array[0].array[0].depth[0].array[0].content); + assert_int_equal(status, F_none); + } + + { + const f_status_t status = f_fss_nestss_destroy_callback(0, length, (void *) datass.array); + + assert_int_equal(status, F_none); + assert_int_equal(datass.array[0].size, 0); + } + + free((void *) datass.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-nestss_destroy_callback.h b/level_0/f_fss/tests/unit/c/test-fss-nestss_destroy_callback.h new file mode 100644 index 0000000..93c1863 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-nestss_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_fss__nestss_destroy_callback +#define _TEST__F_fss__nestss_destroy_callback + +/** + * Test that the function fails. + * + * @see f_fss_nestss_destroy_callback() + */ +extern void test__f_fss_nestss_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_fss_nestss_destroy_callback() + */ +extern void test__f_fss_nestss_destroy_callback__works(void **state); + +#endif // _TEST__F_fss__nestss_destroy_callback diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_quotes_delete_callback.c b/level_0/f_fss/tests/unit/c/test-fss-set_quotes_delete_callback.c new file mode 100644 index 0000000..9910793 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-set_quotes_delete_callback.c @@ -0,0 +1,105 @@ +#include "test-fss.h" +#include "test-fss-set_quotes_delete_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_set_quotes_delete_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_fss_set_quote_t data = f_fss_set_quote_t_initialize; + f_fss_set_quote_t data_array[] = { data }; + f_fss_set_quotes_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_fss_set_quotes_t datas_array[] = { datas }; + + { + will_return(__wrap_f_string_ranges_resize, true); + will_return(__wrap_f_string_ranges_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_set_quotes_delete_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_ranges_resize, false); + will_return(__wrap_f_string_ranges_resize, F_none); + + will_return(__wrap_f_string_rangess_resize, true); + will_return(__wrap_f_string_rangess_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_set_quotes_delete_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_ranges_resize, false); + will_return(__wrap_f_string_ranges_resize, F_none); + + will_return(__wrap_f_string_rangess_resize, false); + will_return(__wrap_f_string_rangess_resize, F_none); + + will_return(__wrap_f_memory_array_resize, true); + will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_set_quotes_delete_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_ranges_resize, false); + will_return(__wrap_f_string_ranges_resize, F_none); + + will_return(__wrap_f_string_rangess_resize, false); + will_return(__wrap_f_string_rangess_resize, F_none); + + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_none); + + will_return(__wrap_f_memory_arrays_resize, true); + will_return(__wrap_f_memory_arrays_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_set_quotes_delete_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_fss_set_quotes_delete_callback__works(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_fss_set_quote_t data = f_fss_set_quote_t_initialize; + f_fss_set_quote_t data_array[] = { data }; + f_fss_set_quotes_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_fss_set_quotes_t datas_array[] = { datas }; + const f_number_unsigned_t length = 1; + + { + will_return(__wrap_f_string_ranges_resize, false); + will_return(__wrap_f_string_ranges_resize, F_none); + + will_return(__wrap_f_string_rangess_resize, false); + will_return(__wrap_f_string_rangess_resize, F_none); + + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_none); + + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_none); + + const f_status_t status = f_fss_set_quotes_delete_callback(0, length, (void *) datas_array); + + assert_int_equal(status, F_none); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_quotes_delete_callback.h b/level_0/f_fss/tests/unit/c/test-fss-set_quotes_delete_callback.h new file mode 100644 index 0000000..45b6509 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-set_quotes_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_fss__set_quotes_delete_callback +#define _TEST__F_fss__set_quotes_delete_callback + +/** + * Test that the function fails. + * + * @see f_fss_set_quotes_delete_callback() + */ +extern void test__f_fss_set_quotes_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_fss_set_quotes_delete_callback() + */ +extern void test__f_fss_set_quotes_delete_callback__works(void **state); + +#endif // _TEST__F_fss__set_quotes_delete_callback diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_quotes_destroy_callback.c b/level_0/f_fss/tests/unit/c/test-fss-set_quotes_destroy_callback.c new file mode 100644 index 0000000..2647243 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-set_quotes_destroy_callback.c @@ -0,0 +1,105 @@ +#include "test-fss.h" +#include "test-fss-set_quotes_destroy_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_set_quotes_destroy_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_fss_set_quote_t data = f_fss_set_quote_t_initialize; + f_fss_set_quote_t data_array[] = { data }; + f_fss_set_quotes_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_fss_set_quotes_t datas_array[] = { datas }; + + { + will_return(__wrap_f_string_ranges_adjust, true); + will_return(__wrap_f_string_ranges_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_set_quotes_destroy_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_ranges_adjust, false); + will_return(__wrap_f_string_ranges_adjust, F_none); + + will_return(__wrap_f_string_rangess_adjust, true); + will_return(__wrap_f_string_rangess_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_set_quotes_destroy_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_ranges_adjust, false); + will_return(__wrap_f_string_ranges_adjust, F_none); + + will_return(__wrap_f_string_rangess_adjust, false); + will_return(__wrap_f_string_rangess_adjust, F_none); + + will_return(__wrap_f_memory_array_adjust, true); + will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_set_quotes_destroy_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_ranges_adjust, false); + will_return(__wrap_f_string_ranges_adjust, F_none); + + will_return(__wrap_f_string_rangess_adjust, false); + will_return(__wrap_f_string_rangess_adjust, F_none); + + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_none); + + will_return(__wrap_f_memory_arrays_adjust, true); + will_return(__wrap_f_memory_arrays_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_set_quotes_destroy_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_fss_set_quotes_destroy_callback__works(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_fss_set_quote_t data = f_fss_set_quote_t_initialize; + f_fss_set_quote_t data_array[] = { data }; + f_fss_set_quotes_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_fss_set_quotes_t datas_array[] = { datas }; + const f_number_unsigned_t length = 1; + + { + will_return(__wrap_f_string_ranges_adjust, false); + will_return(__wrap_f_string_ranges_adjust, F_none); + + will_return(__wrap_f_string_rangess_adjust, false); + will_return(__wrap_f_string_rangess_adjust, F_none); + + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_none); + + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_none); + + const f_status_t status = f_fss_set_quotes_destroy_callback(0, length, (void *) datas_array); + + assert_int_equal(status, F_none); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_quotes_destroy_callback.h b/level_0/f_fss/tests/unit/c/test-fss-set_quotes_destroy_callback.h new file mode 100644 index 0000000..fdf759f --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-set_quotes_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_fss__set_quotes_destroy_callback +#define _TEST__F_fss__set_quotes_destroy_callback + +/** + * Test that the function fails. + * + * @see f_fss_set_quotes_destroy_callback() + */ +extern void test__f_fss_set_quotes_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_fss_set_quotes_destroy_callback() + */ +extern void test__f_fss_set_quotes_destroy_callback__works(void **state); + +#endif // _TEST__F_fss__set_quotes_destroy_callback diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_quotess_delete_callback.c b/level_0/f_fss/tests/unit/c/test-fss-set_quotess_delete_callback.c new file mode 100644 index 0000000..021fe27 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-set_quotess_delete_callback.c @@ -0,0 +1,114 @@ +#include "test-fss.h" +#include "test-fss-set_quotess_delete_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_set_quotess_delete_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_fss_set_quote_t data = f_fss_set_quote_t_initialize; + f_fss_set_quote_t data_array[] = { data }; + f_fss_set_quotes_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_fss_set_quotes_t datas_array[] = { datas }; + + { + will_return(__wrap_f_string_ranges_resize, true); + will_return(__wrap_f_string_ranges_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_set_quotess_delete_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_ranges_resize, false); + will_return(__wrap_f_string_ranges_resize, F_none); + + will_return(__wrap_f_string_rangess_resize, true); + will_return(__wrap_f_string_rangess_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_set_quotess_delete_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_ranges_resize, false); + will_return(__wrap_f_string_ranges_resize, F_none); + + will_return(__wrap_f_string_rangess_resize, false); + will_return(__wrap_f_string_rangess_resize, F_none); + + will_return(__wrap_f_memory_array_resize, true); + will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_set_quotess_delete_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_ranges_resize, false); + will_return(__wrap_f_string_ranges_resize, F_none); + + will_return(__wrap_f_string_rangess_resize, false); + will_return(__wrap_f_string_rangess_resize, F_none); + + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_none); + + will_return(__wrap_f_memory_arrays_resize, true); + will_return(__wrap_f_memory_arrays_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_set_quotess_delete_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_fss_set_quotess_delete_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_fss_set_quotess_t datass = f_fss_set_quotess_t_initialize; + + { + f_status_t status = f_memory_array_resize(length, sizeof(f_fss_set_quotes_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_none); + + status = f_memory_array_resize(1, sizeof(f_fss_set_quote_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size); + assert_int_equal(status, F_none); + + status = f_string_ranges_resize(1, &datass.array[0].array[0].objects); + assert_int_equal(status, F_none); + + status = f_string_rangess_resize(1, &datass.array[0].array[0].contents); + assert_int_equal(status, F_none); + + status = f_memory_array_resize(1, sizeof(uint8_t), (void **) &datass.array[0].array[0].objects_quote.array, &datass.array[0].array[0].objects_quote.used, &datass.array[0].array[0].objects_quote.size); + assert_int_equal(status, F_none); + + status = f_memory_arrays_adjust(1, sizeof(f_uint8s_t), (void **) &datass.array[0].array[0].contents_quote.array, &datass.array[0].array[0].contents_quote.used, &datass.array[0].array[0].contents_quote.size, &f_uint8ss_destroy_callback); + assert_int_equal(status, F_none); + } + + { + const f_status_t status = f_fss_set_quotess_delete_callback(0, length, (void *) datass.array); + + assert_int_equal(status, F_none); + assert_int_equal(datass.array[0].size, 0); + } + + free((void *) datass.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_quotess_delete_callback.h b/level_0/f_fss/tests/unit/c/test-fss-set_quotess_delete_callback.h new file mode 100644 index 0000000..0fb5332 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-set_quotess_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_fss__set_quotess_delete_callback +#define _TEST__F_fss__set_quotess_delete_callback + +/** + * Test that the function fails. + * + * @see f_fss_set_quotess_delete_callback() + */ +extern void test__f_fss_set_quotess_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_fss_set_quotess_delete_callback() + */ +extern void test__f_fss_set_quotess_delete_callback__works(void **state); + +#endif // _TEST__F_fss__set_quotess_delete_callback diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_quotess_destroy_callback.c b/level_0/f_fss/tests/unit/c/test-fss-set_quotess_destroy_callback.c new file mode 100644 index 0000000..ed4d28e --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-set_quotess_destroy_callback.c @@ -0,0 +1,114 @@ +#include "test-fss.h" +#include "test-fss-set_quotess_destroy_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_set_quotess_destroy_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_fss_set_quote_t data = f_fss_set_quote_t_initialize; + f_fss_set_quote_t data_array[] = { data }; + f_fss_set_quotes_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_fss_set_quotes_t datas_array[] = { datas }; + + { + will_return(__wrap_f_string_ranges_adjust, true); + will_return(__wrap_f_string_ranges_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_set_quotess_destroy_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_ranges_adjust, false); + will_return(__wrap_f_string_ranges_adjust, F_none); + + will_return(__wrap_f_string_rangess_adjust, true); + will_return(__wrap_f_string_rangess_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_set_quotess_destroy_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_ranges_adjust, false); + will_return(__wrap_f_string_ranges_adjust, F_none); + + will_return(__wrap_f_string_rangess_adjust, false); + will_return(__wrap_f_string_rangess_adjust, F_none); + + will_return(__wrap_f_memory_array_adjust, true); + will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_set_quotess_destroy_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_ranges_adjust, false); + will_return(__wrap_f_string_ranges_adjust, F_none); + + will_return(__wrap_f_string_rangess_adjust, false); + will_return(__wrap_f_string_rangess_adjust, F_none); + + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_none); + + will_return(__wrap_f_memory_arrays_adjust, true); + will_return(__wrap_f_memory_arrays_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_set_quotess_destroy_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_fss_set_quotess_destroy_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_fss_set_quotess_t datass = f_fss_set_quotess_t_initialize; + + { + f_status_t status = f_memory_array_adjust(length, sizeof(f_fss_set_quotes_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_none); + + status = f_memory_array_adjust(1, sizeof(f_fss_set_quote_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size); + assert_int_equal(status, F_none); + + status = f_string_ranges_adjust(1, &datass.array[0].array[0].objects); + assert_int_equal(status, F_none); + + status = f_string_rangess_adjust(1, &datass.array[0].array[0].contents); + assert_int_equal(status, F_none); + + status = f_memory_array_adjust(1, sizeof(uint8_t), (void **) &datass.array[0].array[0].objects_quote.array, &datass.array[0].array[0].objects_quote.used, &datass.array[0].array[0].objects_quote.size); + assert_int_equal(status, F_none); + + status = f_memory_arrays_adjust(1, sizeof(f_uint8s_t), (void **) &datass.array[0].array[0].contents_quote.array, &datass.array[0].array[0].contents_quote.used, &datass.array[0].array[0].contents_quote.size, &f_uint8ss_destroy_callback); + assert_int_equal(status, F_none); + } + + { + const f_status_t status = f_fss_set_quotess_destroy_callback(0, length, (void *) datass.array); + + assert_int_equal(status, F_none); + assert_int_equal(datass.array[0].size, 0); + } + + free((void *) datass.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_quotess_destroy_callback.h b/level_0/f_fss/tests/unit/c/test-fss-set_quotess_destroy_callback.h new file mode 100644 index 0000000..0ed11cd --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-set_quotess_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_fss__set_quotess_destroy_callback +#define _TEST__F_fss__set_quotess_destroy_callback + +/** + * Test that the function fails. + * + * @see f_fss_set_quotess_destroy_callback() + */ +extern void test__f_fss_set_quotess_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_fss_set_quotess_destroy_callback() + */ +extern void test__f_fss_set_quotess_destroy_callback__works(void **state); + +#endif // _TEST__F_fss__set_quotess_destroy_callback diff --git a/level_0/f_fss/tests/unit/c/test-fss-sets_delete_callback.c b/level_0/f_fss/tests/unit/c/test-fss-sets_delete_callback.c new file mode 100644 index 0000000..cd93ca8 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-sets_delete_callback.c @@ -0,0 +1,66 @@ +#include "test-fss.h" +#include "test-fss-sets_delete_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_sets_delete_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_fss_set_t data = f_fss_set_t_initialize; + f_fss_set_t data_array[] = { data }; + f_fss_sets_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_fss_sets_t datas_array[] = { datas }; + + { + will_return(__wrap_f_string_ranges_resize, true); + will_return(__wrap_f_string_ranges_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_sets_delete_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_ranges_resize, false); + will_return(__wrap_f_string_ranges_resize, F_none); + + will_return(__wrap_f_string_rangess_resize, true); + will_return(__wrap_f_string_rangess_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_sets_delete_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_fss_sets_delete_callback__works(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_fss_set_t data = f_fss_set_t_initialize; + f_fss_set_t data_array[] = { data }; + f_fss_sets_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_fss_sets_t datas_array[] = { datas }; + const f_number_unsigned_t length = 1; + + { + will_return(__wrap_f_string_ranges_resize, false); + will_return(__wrap_f_string_ranges_resize, F_none); + + will_return(__wrap_f_string_rangess_resize, false); + will_return(__wrap_f_string_rangess_resize, F_none); + + const f_status_t status = f_fss_sets_delete_callback(0, length, (void *) datas_array); + + assert_int_equal(status, F_none); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-sets_delete_callback.h b/level_0/f_fss/tests/unit/c/test-fss-sets_delete_callback.h new file mode 100644 index 0000000..8bbfa3b --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-sets_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_fss__sets_delete_callback +#define _TEST__F_fss__sets_delete_callback + +/** + * Test that the function fails. + * + * @see f_fss_sets_delete_callback() + */ +extern void test__f_fss_sets_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_fss_sets_delete_callback() + */ +extern void test__f_fss_sets_delete_callback__works(void **state); + +#endif // _TEST__F_fss__sets_delete_callback diff --git a/level_0/f_fss/tests/unit/c/test-fss-sets_destroy_callback.c b/level_0/f_fss/tests/unit/c/test-fss-sets_destroy_callback.c new file mode 100644 index 0000000..ab3c09f --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-sets_destroy_callback.c @@ -0,0 +1,66 @@ +#include "test-fss.h" +#include "test-fss-sets_destroy_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_sets_destroy_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_fss_set_t data = f_fss_set_t_initialize; + f_fss_set_t data_array[] = { data }; + f_fss_sets_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_fss_sets_t datas_array[] = { datas }; + + { + will_return(__wrap_f_string_ranges_adjust, true); + will_return(__wrap_f_string_ranges_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_sets_destroy_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_ranges_adjust, false); + will_return(__wrap_f_string_ranges_adjust, F_none); + + will_return(__wrap_f_string_rangess_adjust, true); + will_return(__wrap_f_string_rangess_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_sets_destroy_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_fss_sets_destroy_callback__works(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_fss_set_t data = f_fss_set_t_initialize; + f_fss_set_t data_array[] = { data }; + f_fss_sets_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_fss_sets_t datas_array[] = { datas }; + const f_number_unsigned_t length = 1; + + { + will_return(__wrap_f_string_ranges_adjust, false); + will_return(__wrap_f_string_ranges_adjust, F_none); + + will_return(__wrap_f_string_rangess_adjust, false); + will_return(__wrap_f_string_rangess_adjust, F_none); + + const f_status_t status = f_fss_sets_destroy_callback(0, length, (void *) datas_array); + + assert_int_equal(status, F_none); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-sets_destroy_callback.h b/level_0/f_fss/tests/unit/c/test-fss-sets_destroy_callback.h new file mode 100644 index 0000000..eb815b2 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-sets_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_fss__sets_destroy_callback +#define _TEST__F_fss__sets_destroy_callback + +/** + * Test that the function fails. + * + * @see f_fss_sets_destroy_callback() + */ +extern void test__f_fss_sets_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_fss_sets_destroy_callback() + */ +extern void test__f_fss_sets_destroy_callback__works(void **state); + +#endif // _TEST__F_fss__sets_destroy_callback diff --git a/level_0/f_fss/tests/unit/c/test-fss-setss_delete_callback.c b/level_0/f_fss/tests/unit/c/test-fss-setss_delete_callback.c new file mode 100644 index 0000000..3ae8143 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-setss_delete_callback.c @@ -0,0 +1,75 @@ +#include "test-fss.h" +#include "test-fss-setss_delete_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_setss_delete_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_fss_set_t data = f_fss_set_t_initialize; + f_fss_set_t data_array[] = { data }; + f_fss_sets_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_fss_sets_t datas_array[] = { datas }; + + { + will_return(__wrap_f_string_ranges_resize, true); + will_return(__wrap_f_string_ranges_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_setss_delete_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_ranges_resize, false); + will_return(__wrap_f_string_ranges_resize, F_none); + + will_return(__wrap_f_string_rangess_resize, true); + will_return(__wrap_f_string_rangess_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_setss_delete_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_fss_setss_delete_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_fss_setss_t datass = f_fss_setss_t_initialize; + + { + f_status_t status = f_memory_array_resize(length, sizeof(f_fss_sets_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_none); + + status = f_memory_array_resize(1, sizeof(f_fss_set_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size); + assert_int_equal(status, F_none); + + status = f_string_ranges_resize(1, &datass.array[0].array[0].objects); + assert_int_equal(status, F_none); + + status = f_string_rangess_resize(1, &datass.array[0].array[0].contents); + assert_int_equal(status, F_none); + } + + { + const f_status_t status = f_fss_setss_delete_callback(0, length, (void *) datass.array); + + assert_int_equal(status, F_none); + assert_int_equal(datass.array[0].size, 0); + } + + free((void *) datass.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-setss_delete_callback.h b/level_0/f_fss/tests/unit/c/test-fss-setss_delete_callback.h new file mode 100644 index 0000000..c884f10 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-setss_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_fss__setss_delete_callback +#define _TEST__F_fss__setss_delete_callback + +/** + * Test that the function fails. + * + * @see f_fss_setss_delete_callback() + */ +extern void test__f_fss_setss_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_fss_setss_delete_callback() + */ +extern void test__f_fss_setss_delete_callback__works(void **state); + +#endif // _TEST__F_fss__setss_delete_callback diff --git a/level_0/f_fss/tests/unit/c/test-fss-setss_destroy_callback.c b/level_0/f_fss/tests/unit/c/test-fss-setss_destroy_callback.c new file mode 100644 index 0000000..14b3068 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-setss_destroy_callback.c @@ -0,0 +1,75 @@ +#include "test-fss.h" +#include "test-fss-setss_destroy_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_setss_destroy_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_fss_set_t data = f_fss_set_t_initialize; + f_fss_set_t data_array[] = { data }; + f_fss_sets_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_fss_sets_t datas_array[] = { datas }; + + { + will_return(__wrap_f_string_ranges_adjust, true); + will_return(__wrap_f_string_ranges_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_setss_destroy_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_ranges_adjust, false); + will_return(__wrap_f_string_ranges_adjust, F_none); + + will_return(__wrap_f_string_rangess_adjust, true); + will_return(__wrap_f_string_rangess_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_setss_destroy_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_fss_setss_destroy_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_fss_setss_t datass = f_fss_setss_t_initialize; + + { + f_status_t status = f_memory_array_adjust(length, sizeof(f_fss_sets_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_none); + + status = f_memory_array_adjust(1, sizeof(f_fss_set_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size); + assert_int_equal(status, F_none); + + status = f_string_ranges_adjust(1, &datass.array[0].array[0].objects); + assert_int_equal(status, F_none); + + status = f_string_rangess_adjust(1, &datass.array[0].array[0].contents); + assert_int_equal(status, F_none); + } + + { + const f_status_t status = f_fss_setss_destroy_callback(0, length, (void *) datass.array); + + assert_int_equal(status, F_none); + assert_int_equal(datass.array[0].size, 0); + } + + free((void *) datass.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-setss_destroy_callback.h b/level_0/f_fss/tests/unit/c/test-fss-setss_destroy_callback.h new file mode 100644 index 0000000..4c9afdf --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-setss_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_fss__setss_destroy_callback +#define _TEST__F_fss__setss_destroy_callback + +/** + * Test that the function fails. + * + * @see f_fss_setss_destroy_callback() + */ +extern void test__f_fss_setss_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_fss_setss_destroy_callback() + */ +extern void test__f_fss_setss_destroy_callback__works(void **state); + +#endif // _TEST__F_fss__setss_destroy_callback diff --git a/level_0/f_fss/tests/unit/c/test-fss-simple_packets_delete_callback.c b/level_0/f_fss/tests/unit/c/test-fss-simple_packets_delete_callback.c new file mode 100644 index 0000000..8d9622e --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-simple_packets_delete_callback.c @@ -0,0 +1,51 @@ +#include "test-fss.h" +#include "test-fss-simple_packets_delete_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_simple_packets_delete_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_fss_simple_packet_t data = { .payload = f_string_empty_s, .control = 0, .size = 0 }; + f_fss_simple_packet_t data_array[] = { data }; + f_fss_simple_packets_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_fss_simple_packets_t datas_array[] = { datas }; + + { + will_return(__wrap_f_string_dynamic_resize, true); + will_return(__wrap_f_string_dynamic_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_simple_packets_delete_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_fss_simple_packets_delete_callback__works(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_fss_simple_packet_t data = { .payload = f_string_empty_s, .control = 0, .size = 0 }; + f_fss_simple_packet_t data_array[] = { data }; + f_fss_simple_packets_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_fss_simple_packets_t datas_array[] = { datas }; + const f_number_unsigned_t length = 1; + + { + will_return(__wrap_f_string_dynamic_resize, false); + will_return(__wrap_f_string_dynamic_resize, F_none); + + const f_status_t status = f_fss_simple_packets_delete_callback(0, length, (void *) datas_array); + + assert_int_equal(status, F_none); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-simple_packets_delete_callback.h b/level_0/f_fss/tests/unit/c/test-fss-simple_packets_delete_callback.h new file mode 100644 index 0000000..a6668fe --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-simple_packets_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_fss__simple_packets_delete_callback +#define _TEST__F_fss__simple_packets_delete_callback + +/** + * Test that the function fails. + * + * @see f_fss_simple_packets_delete_callback() + */ +extern void test__f_fss_simple_packets_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_fss_simple_packets_delete_callback() + */ +extern void test__f_fss_simple_packets_delete_callback__works(void **state); + +#endif // _TEST__F_fss__simple_packets_delete_callback diff --git a/level_0/f_fss/tests/unit/c/test-fss-simple_packets_destroy_callback.c b/level_0/f_fss/tests/unit/c/test-fss-simple_packets_destroy_callback.c new file mode 100644 index 0000000..b4ecd5b --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-simple_packets_destroy_callback.c @@ -0,0 +1,51 @@ +#include "test-fss.h" +#include "test-fss-simple_packets_destroy_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_simple_packets_destroy_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_fss_simple_packet_t data = { .payload = f_string_empty_s, .control = 0, .size = 0 }; + f_fss_simple_packet_t data_array[] = { data }; + f_fss_simple_packets_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_fss_simple_packets_t datas_array[] = { datas }; + + { + will_return(__wrap_f_string_dynamic_adjust, true); + will_return(__wrap_f_string_dynamic_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_simple_packets_destroy_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_fss_simple_packets_destroy_callback__works(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_fss_simple_packet_t data = { .payload = f_string_empty_s, .control = 0, .size = 0 }; + f_fss_simple_packet_t data_array[] = { data }; + f_fss_simple_packets_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_fss_simple_packets_t datas_array[] = { datas }; + const f_number_unsigned_t length = 1; + + { + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + const f_status_t status = f_fss_simple_packets_destroy_callback(0, length, (void *) datas_array); + + assert_int_equal(status, F_none); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-simple_packets_destroy_callback.h b/level_0/f_fss/tests/unit/c/test-fss-simple_packets_destroy_callback.h new file mode 100644 index 0000000..7bfb870 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-simple_packets_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_fss__simple_packets_destroy_callback +#define _TEST__F_fss__simple_packets_destroy_callback + +/** + * Test that the function fails. + * + * @see f_fss_simple_packets_destroy_callback() + */ +extern void test__f_fss_simple_packets_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_fss_simple_packets_destroy_callback() + */ +extern void test__f_fss_simple_packets_destroy_callback__works(void **state); + +#endif // _TEST__F_fss__simple_packets_destroy_callback diff --git a/level_0/f_fss/tests/unit/c/test-fss-simple_packetss_delete_callback.c b/level_0/f_fss/tests/unit/c/test-fss-simple_packetss_delete_callback.c new file mode 100644 index 0000000..e7b578c --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-simple_packetss_delete_callback.c @@ -0,0 +1,72 @@ +#include "test-fss.h" +#include "test-fss-simple_packetss_delete_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_simple_packetss_delete_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_fss_simple_packet_t data = { .payload = f_string_empty_s, .control = 0, .size = 0 }; + f_fss_simple_packet_t data_array[] = { data }; + f_fss_simple_packets_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_fss_simple_packets_t datas_array[] = { datas }; + + { + will_return(__wrap_f_string_dynamic_resize, true); + will_return(__wrap_f_string_dynamic_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_simple_packetss_delete_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamic_resize, false); + will_return(__wrap_f_string_dynamic_resize, F_none); + + will_return(__wrap_f_memory_array_resize, true); + will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_simple_packetss_delete_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_fss_simple_packetss_delete_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_fss_simple_packetss_t datass = f_fss_simple_packetss_t_initialize; + + { + f_status_t status = f_memory_array_resize(length, sizeof(f_fss_simple_packets_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_none); + + status = f_memory_array_resize(1, sizeof(f_fss_simple_packet_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size); + assert_int_equal(status, F_none); + + status = f_string_dynamic_resize(1, &datass.array[0].array[0].payload); + assert_int_equal(status, F_none); + } + + { + const f_status_t status = f_fss_simple_packetss_delete_callback(0, length, (void *) datass.array); + + assert_int_equal(status, F_none); + assert_int_equal(datass.array[0].size, 0); + } + + free((void *) datass.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-simple_packetss_delete_callback.h b/level_0/f_fss/tests/unit/c/test-fss-simple_packetss_delete_callback.h new file mode 100644 index 0000000..446e4d7 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-simple_packetss_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_fss__simple_packetss_delete_callback +#define _TEST__F_fss__simple_packetss_delete_callback + +/** + * Test that the function fails. + * + * @see f_fss_simple_packetss_delete_callback() + */ +extern void test__f_fss_simple_packetss_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_fss_simple_packetss_delete_callback() + */ +extern void test__f_fss_simple_packetss_delete_callback__works(void **state); + +#endif // _TEST__F_fss__simple_packetss_delete_callback diff --git a/level_0/f_fss/tests/unit/c/test-fss-simple_packetss_destroy_callback.c b/level_0/f_fss/tests/unit/c/test-fss-simple_packetss_destroy_callback.c new file mode 100644 index 0000000..d2d1ddd --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-simple_packetss_destroy_callback.c @@ -0,0 +1,72 @@ +#include "test-fss.h" +#include "test-fss-simple_packetss_destroy_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_simple_packetss_destroy_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_fss_simple_packet_t data = { .payload = f_string_empty_s, .control = 0, .size = 0 }; + f_fss_simple_packet_t data_array[] = { data }; + f_fss_simple_packets_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_fss_simple_packets_t datas_array[] = { datas }; + + { + will_return(__wrap_f_string_dynamic_adjust, true); + will_return(__wrap_f_string_dynamic_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_simple_packetss_destroy_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_memory_array_adjust, true); + will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_simple_packetss_destroy_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_fss_simple_packetss_destroy_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_fss_simple_packetss_t datass = f_fss_simple_packetss_t_initialize; + + { + f_status_t status = f_memory_array_adjust(length, sizeof(f_fss_simple_packets_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_none); + + status = f_memory_array_adjust(1, sizeof(f_fss_simple_packet_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size); + assert_int_equal(status, F_none); + + status = f_string_dynamic_adjust(1, &datass.array[0].array[0].payload); + assert_int_equal(status, F_none); + } + + { + const f_status_t status = f_fss_simple_packetss_destroy_callback(0, length, (void *) datass.array); + + assert_int_equal(status, F_none); + assert_int_equal(datass.array[0].size, 0); + } + + free((void *) datass.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-simple_packetss_destroy_callback.h b/level_0/f_fss/tests/unit/c/test-fss-simple_packetss_destroy_callback.h new file mode 100644 index 0000000..a43cf37 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-simple_packetss_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_fss__simple_packetss_destroy_callback +#define _TEST__F_fss__simple_packetss_destroy_callback + +/** + * Test that the function fails. + * + * @see f_fss_simple_packetss_destroy_callback() + */ +extern void test__f_fss_simple_packetss_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_fss_simple_packetss_destroy_callback() + */ +extern void test__f_fss_simple_packetss_destroy_callback__works(void **state); + +#endif // _TEST__F_fss__simple_packetss_destroy_callback diff --git a/level_0/f_fss/tests/unit/c/test-fss.c b/level_0/f_fss/tests/unit/c/test-fss.c index 5d71325..1af9f30 100644 --- a/level_0/f_fss/tests/unit/c/test-fss.c +++ b/level_0/f_fss/tests/unit/c/test-fss.c @@ -45,6 +45,66 @@ int main(void) { cmocka_unit_test(test__f_fss_fail_utf__works_for_no_error), cmocka_unit_test(test__f_fss_fail_utf_to_false__works_for_no_error), + cmocka_unit_test(test__f_fss_items_delete_callback__fails), + cmocka_unit_test(test__f_fss_items_destroy_callback__fails), + cmocka_unit_test(test__f_fss_itemss_delete_callback__fails), + cmocka_unit_test(test__f_fss_itemss_destroy_callback__fails), + + cmocka_unit_test(test__f_fss_items_delete_callback__works), + cmocka_unit_test(test__f_fss_items_destroy_callback__works), + cmocka_unit_test(test__f_fss_itemss_delete_callback__works), + cmocka_unit_test(test__f_fss_itemss_destroy_callback__works), + + cmocka_unit_test(test__f_fss_nameds_delete_callback__fails), + cmocka_unit_test(test__f_fss_nameds_destroy_callback__fails), + cmocka_unit_test(test__f_fss_namedss_delete_callback__fails), + cmocka_unit_test(test__f_fss_namedss_destroy_callback__fails), + + cmocka_unit_test(test__f_fss_nameds_delete_callback__works), + cmocka_unit_test(test__f_fss_nameds_destroy_callback__works), + cmocka_unit_test(test__f_fss_namedss_delete_callback__works), + cmocka_unit_test(test__f_fss_namedss_destroy_callback__works), + + cmocka_unit_test(test__f_fss_nests_delete_callback__fails), + cmocka_unit_test(test__f_fss_nests_destroy_callback__fails), + cmocka_unit_test(test__f_fss_nestss_delete_callback__fails), + cmocka_unit_test(test__f_fss_nestss_destroy_callback__fails), + + cmocka_unit_test(test__f_fss_nests_delete_callback__works), + cmocka_unit_test(test__f_fss_nests_destroy_callback__works), + cmocka_unit_test(test__f_fss_nestss_delete_callback__works), + cmocka_unit_test(test__f_fss_nestss_destroy_callback__works), + + cmocka_unit_test(test__f_fss_set_quotes_delete_callback__fails), + cmocka_unit_test(test__f_fss_set_quotes_destroy_callback__fails), + cmocka_unit_test(test__f_fss_set_quotess_delete_callback__fails), + cmocka_unit_test(test__f_fss_set_quotess_destroy_callback__fails), + + cmocka_unit_test(test__f_fss_set_quotes_delete_callback__works), + cmocka_unit_test(test__f_fss_set_quotes_destroy_callback__works), + cmocka_unit_test(test__f_fss_set_quotess_delete_callback__works), + cmocka_unit_test(test__f_fss_set_quotess_destroy_callback__works), + + cmocka_unit_test(test__f_fss_sets_delete_callback__fails), + cmocka_unit_test(test__f_fss_sets_destroy_callback__fails), + cmocka_unit_test(test__f_fss_setss_delete_callback__fails), + cmocka_unit_test(test__f_fss_setss_destroy_callback__fails), + + cmocka_unit_test(test__f_fss_sets_delete_callback__works), + cmocka_unit_test(test__f_fss_sets_destroy_callback__works), + cmocka_unit_test(test__f_fss_setss_delete_callback__works), + cmocka_unit_test(test__f_fss_setss_destroy_callback__works), + + cmocka_unit_test(test__f_fss_simple_packets_delete_callback__fails), + cmocka_unit_test(test__f_fss_simple_packets_destroy_callback__fails), + cmocka_unit_test(test__f_fss_simple_packetss_delete_callback__fails), + cmocka_unit_test(test__f_fss_simple_packetss_destroy_callback__fails), + + cmocka_unit_test(test__f_fss_simple_packets_delete_callback__works), + cmocka_unit_test(test__f_fss_simple_packets_destroy_callback__works), + cmocka_unit_test(test__f_fss_simple_packetss_delete_callback__works), + cmocka_unit_test(test__f_fss_simple_packetss_destroy_callback__works), + #ifndef _di_level_0_parameter_checking_ cmocka_unit_test(test__f_fss_apply_delimit__parameter_checking), cmocka_unit_test(test__f_fss_apply_delimit_range__parameter_checking), @@ -59,6 +119,31 @@ int main(void) { cmocka_unit_test(test__f_fss_seek_to_eol__parameter_checking), cmocka_unit_test(test__f_fss_skip_past_delimit__parameter_checking), cmocka_unit_test(test__f_fss_skip_past_space__parameter_checking), + + // f_fss_items_delete_callback() doesn't use parameter checking. + // f_fss_items_destroy_callback() doesn't use parameter checking. + // f_fss_itemss_delete_callback() doesn't use parameter checking. + // f_fss_itemss_destroy_callback() doesn't use parameter checking. + // f_fss_nameds_delete_callback() doesn't use parameter checking. + // f_fss_nameds_destroy_callback() doesn't use parameter checking. + // f_fss_namedss_delete_callback() doesn't use parameter checking. + // f_fss_namedss_destroy_callback() doesn't use parameter checking. + // f_fss_nests_delete_callback() doesn't use parameter checking. + // f_fss_nests_destroy_callback() doesn't use parameter checking. + // f_fss_nestss_delete_callback() doesn't use parameter checking. + // f_fss_nestss_destroy_callback() doesn't use parameter checking. + // f_fss_set_quotes_delete_callback() doesn't use parameter checking. + // f_fss_set_quotes_destroy_callback() doesn't use parameter checking. + // f_fss_set_quotess_delete_callback() doesn't use parameter checking. + // f_fss_set_quotess_destroy_callback() doesn't use parameter checking. + // f_fss_sets_delete_callback() doesn't use parameter checking. + // f_fss_sets_destroy_callback() doesn't use parameter checking. + // f_fss_setss_delete_callback() doesn't use parameter checking. + // f_fss_setss_destroy_callback() doesn't use parameter checking. + // f_fss_simple_packets_delete_callback() doesn't use parameter checking. + // f_fss_simple_packets_destroy_callback() doesn't use parameter checking. + // f_fss_simple_packetss_delete_callback() doesn't use parameter checking. + // f_fss_simple_packetss_destroy_callback() doesn't use parameter checking. #endif // _di_level_0_parameter_checking_ }; diff --git a/level_0/f_fss/tests/unit/c/test-fss.h b/level_0/f_fss/tests/unit/c/test-fss.h index d676ed1..4e9eceb 100644 --- a/level_0/f_fss/tests/unit/c/test-fss.h +++ b/level_0/f_fss/tests/unit/c/test-fss.h @@ -36,27 +36,31 @@ #include "test-fss-is_graph.h" #include "test-fss-is_space.h" #include "test-fss-is_zero_width.h" -//#include "test-fss-items_destroy_callback.h" -//#include "test-fss-items_delete_callback.h" -//#include "test-fss-named_destroy_callback.h" -//#include "test-fss-named_delete_callback.h" -//#include "test-fss-nameds_destroy_callback.h" -//#include "test-fss-nameds_delete_callback.h" -//#include "test-fss-nest_destroy_callback.h" -//#include "test-fss-nest_delete_callback.h" -//#include "test-fss-nests_destroy_callback.h" -//#include "test-fss-nests_delete_callback.h" +#include "test-fss-items_destroy_callback.h" +#include "test-fss-items_delete_callback.h" +#include "test-fss-itemss_destroy_callback.h" +#include "test-fss-itemss_delete_callback.h" +#include "test-fss-nameds_destroy_callback.h" +#include "test-fss-nameds_delete_callback.h" +#include "test-fss-namedss_destroy_callback.h" +#include "test-fss-namedss_delete_callback.h" +#include "test-fss-nests_destroy_callback.h" +#include "test-fss-nests_delete_callback.h" +#include "test-fss-nestss_destroy_callback.h" +#include "test-fss-nestss_delete_callback.h" #include "test-fss-seek_to_eol.h" -//#include "test-fss-set_destroy_callback.h" -//#include "test-fss-set_delete_callback.h" -//#include "test-fss-set_quote_destroy_callback.h" -//#include "test-fss-set_quote_delete_callback.h" -//#include "test-fss-set_quotes_destroy_callback.h" -//#include "test-fss-set_quotes_delete_callback.h" -//#include "test-fss-sets_destroy_callback.h" -//#include "test-fss-sets_delete_callback.h" -//#include "test-fss-simple_packet_ranges_destroy_callback.h" -//#include "test-fss-simple_packet_ranges_delete_callback.h" +#include "test-fss-set_quotes_destroy_callback.h" +#include "test-fss-set_quotes_delete_callback.h" +#include "test-fss-set_quotess_destroy_callback.h" +#include "test-fss-set_quotess_delete_callback.h" +#include "test-fss-sets_destroy_callback.h" +#include "test-fss-sets_delete_callback.h" +#include "test-fss-setss_destroy_callback.h" +#include "test-fss-setss_delete_callback.h" +#include "test-fss-simple_packets_destroy_callback.h" +#include "test-fss-simple_packets_delete_callback.h" +#include "test-fss-simple_packetss_destroy_callback.h" +#include "test-fss-simple_packetss_delete_callback.h" #include "test-fss-skip_past_delimit.h" #include "test-fss-skip_past_space.h" diff --git a/level_0/f_iki/data/build/settings-tests b/level_0/f_iki/data/build/settings-tests index b964202..1eebd62 100644 --- a/level_0/f_iki/data/build/settings-tests +++ b/level_0/f_iki/data/build/settings-tests @@ -26,7 +26,8 @@ build_libraries -lc -lcmocka build_libraries-individual -lf_memory -lf_string -lf_type_array -lf_utf -lf_iki build_sources_program test-iki-content_is.c test-iki-content_partial_is.c test-iki-object_is.c test-iki-object_partial_is.c test-iki-read.c -build_sources_program test-iki-datas_destroy_callback.c test-iki-datas_append.c test-iki-datas_append_all.c test-iki-datas_delete_callback.c test-iki-datass_append.c test-iki-datass_append_all.c +build_sources_program test-iki-datas_append.c test-iki-datas_append_all.c test-iki-datass_append.c test-iki-datass_append_all.c +build_sources_program test-iki-datas_delete_callback.c test-iki-datas_destroy_callback.c test-iki-datass_delete_callback.c test-iki-datass_destroy_callback.c build_sources_program test-iki.c build_script no diff --git a/level_0/f_iki/tests/unit/c/mock-iki.c b/level_0/f_iki/tests/unit/c/mock-iki.c index 0441520..4ea9c7b 100644 --- a/level_0/f_iki/tests/unit/c/mock-iki.c +++ b/level_0/f_iki/tests/unit/c/mock-iki.c @@ -5,10 +5,11 @@ extern "C" { #endif int mock_unwrap = 0; +int mock_unwrap_f_memory = 1; -f_status_t __wrap_f_memory_array_adjust(const f_number_unsigned_t length, const size_t width, void ** array, f_number_unsigned_t * const used, f_number_unsigned_t * const size) { +f_status_t __wrap_f_memory_array_adjust(const f_number_unsigned_t length, const size_t width, void ** const array, f_number_unsigned_t * const used, f_number_unsigned_t * const size) { - if (mock_unwrap) { + if (mock_unwrap_f_memory) { return __real_f_memory_array_adjust(length, width, array, used, size); } @@ -23,9 +24,9 @@ f_status_t __wrap_f_memory_array_adjust(const f_number_unsigned_t length, const return mock_type(f_status_t); } -f_status_t __wrap_f_memory_array_resize(const f_number_unsigned_t length, const size_t width, void ** array, f_number_unsigned_t * const used, f_number_unsigned_t * const size) { +f_status_t __wrap_f_memory_array_resize(const f_number_unsigned_t length, const size_t width, void ** const array, f_number_unsigned_t * const used, f_number_unsigned_t * const size) { - if (mock_unwrap) { + if (mock_unwrap_f_memory) { return __real_f_memory_array_resize(length, width, array, used, size); } diff --git a/level_0/f_iki/tests/unit/c/mock-iki.h b/level_0/f_iki/tests/unit/c/mock-iki.h index a42bfc5..51dcaa7 100644 --- a/level_0/f_iki/tests/unit/c/mock-iki.h +++ b/level_0/f_iki/tests/unit/c/mock-iki.h @@ -30,14 +30,17 @@ extern "C" { const static int mock_errno_generic = 32767; extern int mock_unwrap; +extern int mock_unwrap_f_memory; extern f_status_t __real_f_memory_array_adjust(const f_number_unsigned_t length, const size_t width, void ** array, f_number_unsigned_t * const used, f_number_unsigned_t * const size); extern f_status_t __real_f_memory_array_resize(const f_number_unsigned_t length, const size_t width, void ** array, f_number_unsigned_t * const used, f_number_unsigned_t * const size); + extern f_status_t __real_f_string_ranges_adjust(const f_number_unsigned_t length, f_string_ranges_t * const structure); extern f_status_t __real_f_string_ranges_resize(const f_number_unsigned_t length, f_string_ranges_t * const structure); extern f_status_t __wrap_f_memory_array_adjust(const f_number_unsigned_t length, const size_t width, void ** array, f_number_unsigned_t * const used, f_number_unsigned_t * const size); extern f_status_t __wrap_f_memory_array_resize(const f_number_unsigned_t length, const size_t width, void ** array, f_number_unsigned_t * const used, f_number_unsigned_t * const size); + extern f_status_t __wrap_f_string_ranges_adjust(const f_number_unsigned_t length, f_string_ranges_t * const structure); extern f_status_t __wrap_f_string_ranges_resize(const f_number_unsigned_t length, f_string_ranges_t * const structure); diff --git a/level_0/f_iki/tests/unit/c/test-iki-datas_delete_callback.c b/level_0/f_iki/tests/unit/c/test-iki-datas_delete_callback.c index 3b6c6ca..24c5d30 100644 --- a/level_0/f_iki/tests/unit/c/test-iki-datas_delete_callback.c +++ b/level_0/f_iki/tests/unit/c/test-iki-datas_delete_callback.c @@ -8,17 +8,22 @@ extern "C" { void test__f_iki_datas_delete_callback__fails(void **state) { mock_unwrap = 0; + mock_unwrap_f_memory = 0; - f_iki_data_t data = f_iki_data_t_initialize; + f_string_ranges_t content = f_string_ranges_t_initialize; + f_number_unsigneds_t delimits = f_number_unsigneds_t_initialize; + f_string_ranges_t variable = f_string_ranges_t_initialize; + f_string_ranges_t vocabulary = f_string_ranges_t_initialize; + f_iki_data_t data = { .content = content, .delimits = delimits, .variable = variable, .vocabulary = vocabulary }; f_iki_data_t data_array[] = { data }; f_iki_datas_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_iki_datas_t datass_array[] = { datas }; + f_iki_datas_t datas_array[] = { datas }; { will_return(__wrap_f_string_ranges_resize, true); will_return(__wrap_f_string_ranges_resize, F_status_set_error(F_failure)); - const f_status_t status = f_iki_datas_delete_callback(0, 1, (void *) datass_array); + const f_status_t status = f_iki_datas_delete_callback(0, 1, (void *) datas_array); assert_int_equal(status, F_status_set_error(F_failure)); } @@ -30,7 +35,7 @@ void test__f_iki_datas_delete_callback__fails(void **state) { will_return(__wrap_f_memory_array_resize, true); will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); - const f_status_t status = f_iki_datas_delete_callback(0, 1, (void *) datass_array); + const f_status_t status = f_iki_datas_delete_callback(0, 1, (void *) datas_array); assert_int_equal(status, F_status_set_error(F_failure)); } @@ -45,7 +50,7 @@ void test__f_iki_datas_delete_callback__fails(void **state) { will_return(__wrap_f_string_ranges_resize, true); will_return(__wrap_f_string_ranges_resize, F_status_set_error(F_failure)); - const f_status_t status = f_iki_datas_delete_callback(0, 1, (void *) datass_array); + const f_status_t status = f_iki_datas_delete_callback(0, 1, (void *) datas_array); assert_int_equal(status, F_status_set_error(F_failure)); } @@ -63,7 +68,7 @@ void test__f_iki_datas_delete_callback__fails(void **state) { will_return(__wrap_f_string_ranges_resize, true); will_return(__wrap_f_string_ranges_resize, F_status_set_error(F_failure)); - const f_status_t status = f_iki_datas_delete_callback(0, 1, (void *) datass_array); + const f_status_t status = f_iki_datas_delete_callback(0, 1, (void *) datas_array); assert_int_equal(status, F_status_set_error(F_failure)); } @@ -72,11 +77,16 @@ void test__f_iki_datas_delete_callback__fails(void **state) { void test__f_iki_datas_delete_callback__works(void **state) { mock_unwrap = 0; + mock_unwrap_f_memory = 0; - f_iki_data_t data = f_iki_data_t_initialize; + f_string_ranges_t content = f_string_ranges_t_initialize; + f_number_unsigneds_t delimits = f_number_unsigneds_t_initialize; + f_string_ranges_t variable = f_string_ranges_t_initialize; + f_string_ranges_t vocabulary = f_string_ranges_t_initialize; + f_iki_data_t data = { .content = content, .delimits = delimits, .variable = variable, .vocabulary = vocabulary }; f_iki_data_t data_array[] = { data }; f_iki_datas_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_iki_datas_t datass_array[] = { datas }; + f_iki_datas_t datas_array[] = { datas }; const f_number_unsigned_t length = 1; { @@ -92,7 +102,7 @@ void test__f_iki_datas_delete_callback__works(void **state) { will_return(__wrap_f_string_ranges_resize, false); will_return(__wrap_f_string_ranges_resize, F_none); - const f_status_t status = f_iki_datas_delete_callback(0, length, (void *) datass_array); + const f_status_t status = f_iki_datas_delete_callback(0, length, (void *) datas_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_iki/tests/unit/c/test-iki-datas_destroy_callback.c b/level_0/f_iki/tests/unit/c/test-iki-datas_destroy_callback.c index 10a86d8..25034a1 100644 --- a/level_0/f_iki/tests/unit/c/test-iki-datas_destroy_callback.c +++ b/level_0/f_iki/tests/unit/c/test-iki-datas_destroy_callback.c @@ -8,17 +8,22 @@ extern "C" { void test__f_iki_datas_destroy_callback__fails(void **state) { mock_unwrap = 0; + mock_unwrap_f_memory = 0; - f_iki_data_t data = f_iki_data_t_initialize; + f_string_ranges_t content = f_string_ranges_t_initialize; + f_number_unsigneds_t delimits = f_number_unsigneds_t_initialize; + f_string_ranges_t variable = f_string_ranges_t_initialize; + f_string_ranges_t vocabulary = f_string_ranges_t_initialize; + f_iki_data_t data = { .content = content, .delimits = delimits, .variable = variable, .vocabulary = vocabulary }; f_iki_data_t data_array[] = { data }; f_iki_datas_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_iki_datas_t datass_array[] = { datas }; + f_iki_datas_t datas_array[] = { datas }; { will_return(__wrap_f_string_ranges_adjust, true); will_return(__wrap_f_string_ranges_adjust, F_status_set_error(F_failure)); - const f_status_t status = f_iki_datas_destroy_callback(0, 1, (void *) datass_array); + const f_status_t status = f_iki_datas_destroy_callback(0, 1, (void *) datas_array); assert_int_equal(status, F_status_set_error(F_failure)); } @@ -30,7 +35,7 @@ void test__f_iki_datas_destroy_callback__fails(void **state) { will_return(__wrap_f_memory_array_adjust, true); will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); - const f_status_t status = f_iki_datas_destroy_callback(0, 1, (void *) datass_array); + const f_status_t status = f_iki_datas_destroy_callback(0, 1, (void *) datas_array); assert_int_equal(status, F_status_set_error(F_failure)); } @@ -45,7 +50,7 @@ void test__f_iki_datas_destroy_callback__fails(void **state) { will_return(__wrap_f_string_ranges_adjust, true); will_return(__wrap_f_string_ranges_adjust, F_status_set_error(F_failure)); - const f_status_t status = f_iki_datas_destroy_callback(0, 1, (void *) datass_array); + const f_status_t status = f_iki_datas_destroy_callback(0, 1, (void *) datas_array); assert_int_equal(status, F_status_set_error(F_failure)); } @@ -63,7 +68,7 @@ void test__f_iki_datas_destroy_callback__fails(void **state) { will_return(__wrap_f_string_ranges_adjust, true); will_return(__wrap_f_string_ranges_adjust, F_status_set_error(F_failure)); - const f_status_t status = f_iki_datas_destroy_callback(0, 1, (void *) datass_array); + const f_status_t status = f_iki_datas_destroy_callback(0, 1, (void *) datas_array); assert_int_equal(status, F_status_set_error(F_failure)); } @@ -72,11 +77,16 @@ void test__f_iki_datas_destroy_callback__fails(void **state) { void test__f_iki_datas_destroy_callback__works(void **state) { mock_unwrap = 0; + mock_unwrap_f_memory = 0; - f_iki_data_t data = f_iki_data_t_initialize; + f_string_ranges_t content = f_string_ranges_t_initialize; + f_number_unsigneds_t delimits = f_number_unsigneds_t_initialize; + f_string_ranges_t variable = f_string_ranges_t_initialize; + f_string_ranges_t vocabulary = f_string_ranges_t_initialize; + f_iki_data_t data = { .content = content, .delimits = delimits, .variable = variable, .vocabulary = vocabulary }; f_iki_data_t data_array[] = { data }; f_iki_datas_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_iki_datas_t datass_array[] = { datas }; + f_iki_datas_t datas_array[] = { datas }; const f_number_unsigned_t length = 1; { @@ -92,7 +102,7 @@ void test__f_iki_datas_destroy_callback__works(void **state) { will_return(__wrap_f_string_ranges_adjust, false); will_return(__wrap_f_string_ranges_adjust, F_none); - const f_status_t status = f_iki_datas_destroy_callback(0, length, (void *) datass_array); + const f_status_t status = f_iki_datas_destroy_callback(0, length, (void *) datas_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_iki/tests/unit/c/test-iki-datass_delete_callback.c b/level_0/f_iki/tests/unit/c/test-iki-datass_delete_callback.c new file mode 100644 index 0000000..a69d9cd --- /dev/null +++ b/level_0/f_iki/tests/unit/c/test-iki-datass_delete_callback.c @@ -0,0 +1,139 @@ +#include "test-iki.h" +#include "test-iki-datass_delete_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_iki_datass_delete_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_string_ranges_t content = f_string_ranges_t_initialize; + f_number_unsigneds_t delimits = f_number_unsigneds_t_initialize; + f_string_ranges_t variable = f_string_ranges_t_initialize; + f_string_ranges_t vocabulary = f_string_ranges_t_initialize; + f_iki_data_t data = { .content = content, .delimits = delimits, .variable = variable, .vocabulary = vocabulary }; + f_iki_data_t data_array[] = { data }; + f_iki_datas_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_iki_datas_t datas_array[] = { datas }; + + { + will_return(__wrap_f_string_ranges_resize, true); + will_return(__wrap_f_string_ranges_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_iki_datass_delete_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_ranges_resize, false); + will_return(__wrap_f_string_ranges_resize, F_none); + + will_return(__wrap_f_memory_array_resize, true); + will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_iki_datass_delete_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_ranges_resize, false); + will_return(__wrap_f_string_ranges_resize, F_none); + + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_none); + + will_return(__wrap_f_string_ranges_resize, true); + will_return(__wrap_f_string_ranges_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_iki_datass_delete_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_ranges_resize, false); + will_return(__wrap_f_string_ranges_resize, F_none); + + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_none); + + will_return(__wrap_f_string_ranges_resize, false); + will_return(__wrap_f_string_ranges_resize, F_none); + + will_return(__wrap_f_string_ranges_resize, true); + will_return(__wrap_f_string_ranges_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_iki_datass_delete_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_ranges_resize, false); + will_return(__wrap_f_string_ranges_resize, F_none); + + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_none); + + will_return(__wrap_f_string_ranges_resize, false); + will_return(__wrap_f_string_ranges_resize, F_none); + + will_return(__wrap_f_string_ranges_resize, false); + will_return(__wrap_f_string_ranges_resize, F_none); + + will_return(__wrap_f_memory_array_resize, true); + will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_iki_datass_delete_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_iki_datass_delete_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_iki_datass_t datass = f_iki_datass_t_initialize; + + { + f_status_t status = f_memory_array_resize(length, sizeof(f_iki_datas_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_none); + + status = f_memory_array_resize(1, sizeof(f_iki_data_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size); + assert_int_equal(status, F_none); + + status = f_string_ranges_resize(1, &datass.array[0].array[0].content); + assert_int_equal(status, F_none); + + status = f_memory_array_resize(1, sizeof(f_number_unsigned_t), (void **) &datass.array[0].array[0].delimits.array, &datass.array[0].array[0].delimits.used, &datass.array[0].array[0].delimits.size); + assert_int_equal(status, F_none); + + status = f_string_ranges_resize(1, &datass.array[0].array[0].variable); + assert_int_equal(status, F_none); + + status = f_string_ranges_resize(1, &datass.array[0].array[0].vocabulary); + assert_int_equal(status, F_none); + } + + { + const f_status_t status = f_iki_datass_delete_callback(0, length, (void *) datass.array); + + assert_int_equal(status, F_none); + assert_int_equal(datass.array[0].size, 0); + } + + free((void *) datass.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_iki/tests/unit/c/test-iki-datass_delete_callback.h b/level_0/f_iki/tests/unit/c/test-iki-datass_delete_callback.h new file mode 100644 index 0000000..7643488 --- /dev/null +++ b/level_0/f_iki/tests/unit/c/test-iki-datass_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: IKI + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_iki__datass_delete_callback +#define _TEST__F_iki__datass_delete_callback + +/** + * Test that the function fails. + * + * @see f_iki_datass_delete_callback() + */ +extern void test__f_iki_datass_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_iki_datass_delete_callback() + */ +extern void test__f_iki_datass_delete_callback__works(void **state); + +#endif // _TEST__F_iki__datass_delete_callback diff --git a/level_0/f_iki/tests/unit/c/test-iki-datass_destroy_callback.c b/level_0/f_iki/tests/unit/c/test-iki-datass_destroy_callback.c new file mode 100644 index 0000000..f72d2df --- /dev/null +++ b/level_0/f_iki/tests/unit/c/test-iki-datass_destroy_callback.c @@ -0,0 +1,139 @@ +#include "test-iki.h" +#include "test-iki-datass_destroy_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_iki_datass_destroy_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_string_ranges_t content = f_string_ranges_t_initialize; + f_number_unsigneds_t delimits = f_number_unsigneds_t_initialize; + f_string_ranges_t variable = f_string_ranges_t_initialize; + f_string_ranges_t vocabulary = f_string_ranges_t_initialize; + f_iki_data_t data = { .content = content, .delimits = delimits, .variable = variable, .vocabulary = vocabulary }; + f_iki_data_t data_array[] = { data }; + f_iki_datas_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_iki_datas_t datas_array[] = { datas }; + + { + will_return(__wrap_f_string_ranges_adjust, true); + will_return(__wrap_f_string_ranges_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_iki_datass_destroy_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_ranges_adjust, false); + will_return(__wrap_f_string_ranges_adjust, F_none); + + will_return(__wrap_f_memory_array_adjust, true); + will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_iki_datass_destroy_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_ranges_adjust, false); + will_return(__wrap_f_string_ranges_adjust, F_none); + + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_none); + + will_return(__wrap_f_string_ranges_adjust, true); + will_return(__wrap_f_string_ranges_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_iki_datass_destroy_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_ranges_adjust, false); + will_return(__wrap_f_string_ranges_adjust, F_none); + + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_none); + + will_return(__wrap_f_string_ranges_adjust, false); + will_return(__wrap_f_string_ranges_adjust, F_none); + + will_return(__wrap_f_string_ranges_adjust, true); + will_return(__wrap_f_string_ranges_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_iki_datass_destroy_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_ranges_adjust, false); + will_return(__wrap_f_string_ranges_adjust, F_none); + + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_none); + + will_return(__wrap_f_string_ranges_adjust, false); + will_return(__wrap_f_string_ranges_adjust, F_none); + + will_return(__wrap_f_string_ranges_adjust, false); + will_return(__wrap_f_string_ranges_adjust, F_none); + + will_return(__wrap_f_memory_array_adjust, true); + will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_iki_datass_destroy_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_iki_datass_destroy_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_iki_datass_t datass = f_iki_datass_t_initialize; + + { + f_status_t status = f_memory_array_adjust(length, sizeof(f_iki_datas_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_none); + + status = f_memory_array_adjust(1, sizeof(f_iki_data_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size); + assert_int_equal(status, F_none); + + status = f_string_ranges_adjust(1, &datass.array[0].array[0].content); + assert_int_equal(status, F_none); + + status = f_memory_array_adjust(1, sizeof(f_number_unsigned_t), (void **) &datass.array[0].array[0].delimits.array, &datass.array[0].array[0].delimits.used, &datass.array[0].array[0].delimits.size); + assert_int_equal(status, F_none); + + status = f_string_ranges_adjust(1, &datass.array[0].array[0].variable); + assert_int_equal(status, F_none); + + status = f_string_ranges_adjust(1, &datass.array[0].array[0].vocabulary); + assert_int_equal(status, F_none); + } + + { + const f_status_t status = f_iki_datass_destroy_callback(0, length, (void *) datass.array); + + assert_int_equal(status, F_none); + assert_int_equal(datass.array[0].size, 0); + } + + free((void *) datass.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_iki/tests/unit/c/test-iki-datass_destroy_callback.h b/level_0/f_iki/tests/unit/c/test-iki-datass_destroy_callback.h new file mode 100644 index 0000000..b914fff --- /dev/null +++ b/level_0/f_iki/tests/unit/c/test-iki-datass_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: IKI + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_iki__datass_destroy_callback +#define _TEST__F_iki__datass_destroy_callback + +/** + * Test that the function fails. + * + * @see f_iki_datass_destroy_callback() + */ +extern void test__f_iki_datass_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_iki_datass_destroy_callback() + */ +extern void test__f_iki_datass_destroy_callback__works(void **state); + +#endif // _TEST__F_iki__datass_destroy_callback diff --git a/level_0/f_iki/tests/unit/c/test-iki.c b/level_0/f_iki/tests/unit/c/test-iki.c index 03c0615..f032372 100644 --- a/level_0/f_iki/tests/unit/c/test-iki.c +++ b/level_0/f_iki/tests/unit/c/test-iki.c @@ -29,11 +29,15 @@ int main(void) { cmocka_unit_test(test__f_iki_content_partial_is__returns_false), cmocka_unit_test(test__f_iki_content_partial_is__returns_true), - cmocka_unit_test(test__f_iki_datas_destroy_callback__fails), cmocka_unit_test(test__f_iki_datas_delete_callback__fails), + cmocka_unit_test(test__f_iki_datas_destroy_callback__fails), + cmocka_unit_test(test__f_iki_datass_destroy_callback__fails), + cmocka_unit_test(test__f_iki_datass_delete_callback__fails), - cmocka_unit_test(test__f_iki_datas_destroy_callback__works), cmocka_unit_test(test__f_iki_datas_delete_callback__works), + cmocka_unit_test(test__f_iki_datas_destroy_callback__works), + cmocka_unit_test(test__f_iki_datass_delete_callback__works), + cmocka_unit_test(test__f_iki_datass_destroy_callback__works), cmocka_unit_test(test__f_iki_datas_append__works), cmocka_unit_test(test__f_iki_datas_append_all__works), @@ -65,6 +69,8 @@ int main(void) { // f_iki_datas_destroy_callback() doesn't use parameter checking. // f_iki_datas_delete_callback() doesn't use parameter checking. + // f_iki_datass_destroy_callback() doesn't use parameter checking. + // f_iki_datass_delete_callback() doesn't use parameter checking. cmocka_unit_test(test__f_iki_datas_append__parameter_checking), cmocka_unit_test(test__f_iki_datas_append_all__parameter_checking), diff --git a/level_0/f_iki/tests/unit/c/test-iki.h b/level_0/f_iki/tests/unit/c/test-iki.h index 92827c5..24c1e1b 100644 --- a/level_0/f_iki/tests/unit/c/test-iki.h +++ b/level_0/f_iki/tests/unit/c/test-iki.h @@ -28,12 +28,14 @@ // Test includes. #include "test-iki-content_is.h" #include "test-iki-content_partial_is.h" -#include "test-iki-datas_destroy_callback.h" #include "test-iki-datas_append.h" #include "test-iki-datas_append_all.h" #include "test-iki-datas_delete_callback.h" +#include "test-iki-datas_destroy_callback.h" #include "test-iki-datass_append.h" #include "test-iki-datass_append_all.h" +#include "test-iki-datass_delete_callback.h" +#include "test-iki-datass_destroy_callback.h" #include "test-iki-object_is.h" #include "test-iki-object_partial_is.h" #include "test-iki-read.h" diff --git a/level_0/f_memory/c/memory/arrayss.c b/level_0/f_memory/c/memory/arrayss.c deleted file mode 100644 index 3a433d8..0000000 --- a/level_0/f_memory/c/memory/arrayss.c +++ /dev/null @@ -1,52 +0,0 @@ -#include "../memory.h" -#include "private-array.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _di_f_memory_arrayss_adjust_ - f_status_t f_memory_arrayss_adjust(const f_number_unsigned_t length, const size_t width, void ** const array, f_number_unsigned_t * const used, f_number_unsigned_t * const size, f_status_t (*destroy_callback)(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array)) { - #ifndef _di_level_0_parameter_checking_ - if (!width) return F_status_set_error(F_parameter); - if (!array) return F_status_set_error(F_parameter); - if (!used) return F_status_set_error(F_parameter); - if (!size) return F_status_set_error(F_parameter); - if (!destroy_callback) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (length > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); - - if (length < *size) { - const f_status_t status = destroy_callback(length, *size, *array); - if (F_status_is_error(status)) return status; - } - - return private_f_memory_array_adjust(length, width, array, used, size); - } -#endif // _di_f_memory_arrayss_adjust_ - -#ifndef _di_f_memory_arrayss_resize_ - f_status_t f_memory_arrayss_resize(const f_number_unsigned_t length, const size_t width, void ** const array, f_number_unsigned_t * const used, f_number_unsigned_t * const size, f_status_t (*delete_callback)(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array)) { - #ifndef _di_level_0_parameter_checking_ - if (!width) return F_status_set_error(F_parameter); - if (!array) return F_status_set_error(F_parameter); - if (!used) return F_status_set_error(F_parameter); - if (!size) return F_status_set_error(F_parameter); - if (!delete_callback) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (length > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); - - if (length < *size) { - const f_status_t status = delete_callback(length, *size, *array); - if (F_status_is_error(status)) return status; - } - - return private_f_memory_array_resize(length, width, array, used, size); - } -#endif // _di_f_memory_arrayss_resize_ - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_memory/c/memory/arrayss.h b/level_0/f_memory/c/memory/arrayss.h deleted file mode 100644 index 3007929..0000000 --- a/level_0/f_memory/c/memory/arrayss.h +++ /dev/null @@ -1,115 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Memory - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Defines memory array data. - * - * This is auto-included by memory.h and should not need to be explicitly included. - */ -#ifndef _F_memory_arrayss_h -#define _F_memory_arrayss_h - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Resize the memory array of arrays of arrays. - * - * This function is only useful for structures of the form "{ array, used, size }" where the array is a an array of simple types. - * If the simple type that is "array" requires additional memory manipulation on allocation or de-allocation, then do not use this function. - * - * The inner array can be a more complex structure because the callback is expected to know the type. - * - * @param length - * The new size to use. - * @param width - * The size of the structure represented by array. - * The word "width" is used due to conflicts of already using "length" and "size". - * Must not be 0. - * @param array - * The structure.array to resize. - * @param used - * The structure.used. - * @param size - * The structure.size. - * @param destroy_callback - * A callback to call on each array value when reducing the length of the array. - * This callback is expected to know the appropriate type and will cast the structure parameter to the appropriate type. - * This callback is intended to be used for deleting data and does not get called when adding new data. - * - * This is only called when the requested length is less than the given size. - * - * Callback Parameters: - * - start: The start position in the array to start deleting. - * - stop: The stop in the array to stop deleting. - * - array: The array structure to delete all values of. - * - * Callback Returns: - * The standard status codes similar to this function. - * - * @return - * F_none on success. - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - */ -#ifndef _di_f_memory_arrayss_adjust_ - extern f_status_t f_memory_arrayss_adjust(const f_number_unsigned_t length, const size_t width, void ** const array, f_number_unsigned_t * const used, f_number_unsigned_t * const size, f_status_t (*destroy_callback)(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array)); -#endif // _di_f_memory_arrayss_adjust_ - -/** - * Resize the memory array of arrays of arrays. - * - * This function is only useful for structures of the form "{ array, used, size }" where the array is a an array of simple types. - * If the simple type that is "array" requires additional memory manipulation on allocation or de-allocation, then do not use this function. - * - * The inner array can be a more complex structure because the callback is expected to know the type. - * - * @param length - * The new size to use. - * @param width - * The size of the structure represented by array. - * The word "width" is used due to conflicts of already using "length" and "size". - * Must not be 0. - * @param array - * The structure.array to resize. - * @param used - * The structure.used. - * @param size - * The structure.size. - * @param delete_callback - * A callback to call on each array value when reducing the length of the array. - * This callback is expected to know the appropriate type and will cast the structure parameter to the appropriate type. - * This callback is intended to be used for deleting data and does not get called when adding new data. - * - * This is only called when the requested length is less than the given size. - * - * Callback Parameters: - * - start: The start position in the array to start deleting. - * - stop: The stop in the array to stop deleting. - * - array: The array structure to delete all values of. - * - * Callback Returns: - * The standard status codes similar to this function. - * - * @return - * F_none on success. - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - */ -#ifndef _di_f_memory_arrayss_resize_ - extern f_status_t f_memory_arrayss_resize(const f_number_unsigned_t length, const size_t width, void ** const array, f_number_unsigned_t * const used, f_number_unsigned_t * const size, f_status_t (*delete_callback)(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array)); -#endif // _di_f_memory_arrayss_resize_ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _F_memory_arrayss_h diff --git a/level_0/f_memory/data/build/settings b/level_0/f_memory/data/build/settings index d65c672..df7c054 100644 --- a/level_0/f_memory/data/build/settings +++ b/level_0/f_memory/data/build/settings @@ -31,10 +31,10 @@ build_language c build_libraries -lc -build_sources_library memory.c memory/array.c memory/arrays.c memory/arrayss.c +build_sources_library memory.c memory/array.c memory/arrays.c build_sources_library private-memory.c memory/private-array.c -build_sources_headers memory.h memory/array.h memory/arrays.h memory/arrayss.h memory/common.h +build_sources_headers memory.h memory/array.h memory/arrays.h memory/common.h build_script yes build_shared yes diff --git a/level_0/f_memory/data/build/settings-tests b/level_0/f_memory/data/build/settings-tests index acc6a10..21779e5 100644 --- a/level_0/f_memory/data/build/settings-tests +++ b/level_0/f_memory/data/build/settings-tests @@ -26,7 +26,6 @@ build_libraries-individual -lf_memory build_sources_program test-memory-adjust.c test-memory-delete.c test-memory-destroy.c test-memory-new_aligned.c test-memory-new.c test-memory-resize.c test-memory.c build_sources_program test-memory-array_adjust.c test-memory-array_append.c test-memory-array_append_all.c test-memory-array_decimate_by.c test-memory-array_decrease_by.c test-memory-array_increase.c test-memory-array_increase_by.c test-memory-array_resize.c build_sources_program test-memory-arrays_adjust.c test-memory-arrays_resize.c -build_sources_program test-memory-arrayss_adjust.c test-memory-arrayss_resize.c build_script no build_shared yes diff --git a/level_0/f_memory/tests/unit/c/test-memory.c b/level_0/f_memory/tests/unit/c/test-memory.c index 5cc8878..8636a84 100644 --- a/level_0/f_memory/tests/unit/c/test-memory.c +++ b/level_0/f_memory/tests/unit/c/test-memory.c @@ -44,9 +44,6 @@ int main(void) { cmocka_unit_test(test__f_memory_arrays_adjust__returns_array_too_large), cmocka_unit_test(test__f_memory_arrays_resize__returns_array_too_large), - cmocka_unit_test(test__f_memory_arrayss_adjust__returns_array_too_large), - cmocka_unit_test(test__f_memory_arrayss_resize__returns_array_too_large), - cmocka_unit_test(test__f_memory_array_append_all__returns_data_not), cmocka_unit_test(test__f_memory_array_decimate_by__returns_data_not), cmocka_unit_test(test__f_memory_array_decrease_by__returns_data_not), @@ -65,9 +62,6 @@ int main(void) { cmocka_unit_test(test__f_memory_arrays_adjust__works), cmocka_unit_test(test__f_memory_arrays_resize__works), - cmocka_unit_test(test__f_memory_arrayss_adjust__works), - cmocka_unit_test(test__f_memory_arrayss_resize__works), - #ifndef _di_level_0_parameter_checking_ cmocka_unit_test(test__f_memory_adjust__parameter_checking), cmocka_unit_test(test__f_memory_delete__parameter_checking), @@ -86,9 +80,6 @@ int main(void) { cmocka_unit_test(test__f_memory_arrays_adjust__parameter_checking), cmocka_unit_test(test__f_memory_arrays_resize__parameter_checking), - - cmocka_unit_test(test__f_memory_arrayss_adjust__parameter_checking), - cmocka_unit_test(test__f_memory_arrayss_resize__parameter_checking), #endif // _di_level_0_parameter_checking_ }; diff --git a/level_0/f_memory/tests/unit/c/test-memory.h b/level_0/f_memory/tests/unit/c/test-memory.h index 443d946..9958b73 100644 --- a/level_0/f_memory/tests/unit/c/test-memory.h +++ b/level_0/f_memory/tests/unit/c/test-memory.h @@ -34,8 +34,6 @@ #include "test-memory-array_resize.h" #include "test-memory-arrays_adjust.h" #include "test-memory-arrays_resize.h" -#include "test-memory-arrayss_adjust.h" -#include "test-memory-arrayss_resize.h" #include "test-memory-delete.h" #include "test-memory-destroy.h" #include "test-memory-new.h" @@ -69,17 +67,6 @@ typedef struct { #define test_memory_arrays_t_initialize { 0, 0, 0 } /** - * A structure used for testing the memory arrayss functions. - */ -typedef struct { - test_memory_arrays_t *array; - f_number_unsigned_t used; - f_number_unsigned_t size; -} test_memory_arrayss_t; - -#define test_memory_arrayss_t_initialize { 0, 0, 0 } - -/** * Perform any setup operations. * * @param state diff --git a/level_0/f_type_array/data/build/settings-mocks b/level_0/f_type_array/data/build/settings-mocks index 46c80ed..53627d5 100644 --- a/level_0/f_type_array/data/build/settings-mocks +++ b/level_0/f_type_array/data/build/settings-mocks @@ -64,4 +64,6 @@ flags_library -fPIC # Inject mocks. flags -Wl,--wrap=f_memory_array_adjust flags -Wl,--wrap=f_memory_array_resize +flags -Wl,--wrap=f_memory_arrays_adjust +flags -Wl,--wrap=f_memory_arrays_resize flags -Wl,--wrap=poll diff --git a/level_0/f_type_array/data/build/settings-tests b/level_0/f_type_array/data/build/settings-tests index 0518496..d3ad7ba 100644 --- a/level_0/f_type_array/data/build/settings-tests +++ b/level_0/f_type_array/data/build/settings-tests @@ -23,23 +23,23 @@ build_language c build_libraries -lc -lcmocka build_libraries-individual -lf_memory -lf_type_array -build_sources_program test-type_array-cells_destroy_callback.c test-type_array-cells_delete_callback.c -build_sources_program test-type_array-files_destroy_callback.c test-type_array-files_delete_callback.c -build_sources_program test-type_array-fll_ids_destroy_callback.c test-type_array-fll_ids_delete_callback.c -build_sources_program test-type_array-int8s_destroy_callback.c test-type_array-int8s_delete_callback.c -build_sources_program test-type_array-int16s_destroy_callback.c test-type_array-int16s_delete_callback.c -build_sources_program test-type_array-int32s_destroy_callback.c test-type_array-int32s_delete_callback.c -build_sources_program test-type_array-int64s_destroy_callback.c test-type_array-int64s_delete_callback.c -build_sources_program test-type_array-int128s_destroy_callback.c test-type_array-int128s_delete_callback.c -build_sources_program test-type_array-number_unsigneds_destroy_callback.c test-type_array-number_unsigneds_delete_callback.c -build_sources_program test-type_array-polls_destroy_callback.c test-type_array-polls_delete_callback.c -build_sources_program test-type_array-states_destroy_callback.c test-type_array-states_delete_callback.c -build_sources_program test-type_array-statuss_destroy_callback.c test-type_array-statuss_delete_callback.c -build_sources_program test-type_array-uint8s_destroy_callback.c test-type_array-uint8s_delete_callback.c -build_sources_program test-type_array-uint16s_destroy_callback.c test-type_array-uint16s_delete_callback.c -build_sources_program test-type_array-uint32s_destroy_callback.c test-type_array-uint32s_delete_callback.c -build_sources_program test-type_array-uint64s_destroy_callback.c test-type_array-uint64s_delete_callback.c -build_sources_program test-type_array-uint128s_destroy_callback.c test-type_array-uint128s_delete_callback.c +build_sources_program test-type_array-cellss_delete_callback.c test-type_array-cellss_destroy_callback.c +build_sources_program test-type_array-filess_delete_callback.c test-type_array-filess_destroy_callback.c +build_sources_program test-type_array-fll_idss_delete_callback.c test-type_array-fll_idss_destroy_callback.c +build_sources_program test-type_array-int8ss_delete_callback.c test-type_array-int8ss_destroy_callback.c +build_sources_program test-type_array-int16ss_delete_callback.c test-type_array-int16ss_destroy_callback.c +build_sources_program test-type_array-int32ss_delete_callback.c test-type_array-int32ss_destroy_callback.c +build_sources_program test-type_array-int64ss_delete_callback.c test-type_array-int64ss_destroy_callback.c +build_sources_program test-type_array-int128ss_delete_callback.c test-type_array-int128ss_destroy_callback.c +build_sources_program test-type_array-number_unsignedss_delete_callback.c test-type_array-number_unsignedss_destroy_callback.c +build_sources_program test-type_array-pollss_delete_callback.c test-type_array-pollss_destroy_callback.c +build_sources_program test-type_array-statess_delete_callback.c test-type_array-statess_destroy_callback.c +build_sources_program test-type_array-statusss_delete_callback.c test-type_array-statusss_destroy_callback.c +build_sources_program test-type_array-uint8ss_delete_callback.c test-type_array-uint8ss_destroy_callback.c +build_sources_program test-type_array-uint16ss_delete_callback.c test-type_array-uint16ss_destroy_callback.c +build_sources_program test-type_array-uint32ss_delete_callback.c test-type_array-uint32ss_destroy_callback.c +build_sources_program test-type_array-uint64ss_delete_callback.c test-type_array-uint64ss_destroy_callback.c +build_sources_program test-type_array-uint128ss_delete_callback.c test-type_array-uint128ss_destroy_callback.c build_sources_program test-type_array.c diff --git a/level_0/f_type_array/tests/unit/c/mock-type_array.c b/level_0/f_type_array/tests/unit/c/mock-type_array.c index 02f61f7..46c6a2f 100644 --- a/level_0/f_type_array/tests/unit/c/mock-type_array.c +++ b/level_0/f_type_array/tests/unit/c/mock-type_array.c @@ -4,8 +4,15 @@ extern "C" { #endif +int mock_unwrap = 0; +int mock_unwrap_f_memory = 1; + f_status_t __wrap_f_memory_array_adjust(const f_number_unsigned_t length, const size_t width, void ** array, f_number_unsigned_t * const used, f_number_unsigned_t * const size) { + if (mock_unwrap_f_memory) { + return __real_f_memory_array_adjust(length, width, array, used, size); + } + if (!array || !used || !size) return F_status_set_error(F_parameter_not); const bool failure = mock_type(bool); @@ -19,6 +26,10 @@ f_status_t __wrap_f_memory_array_adjust(const f_number_unsigned_t length, const f_status_t __wrap_f_memory_array_resize(const f_number_unsigned_t length, const size_t width, void ** array, f_number_unsigned_t * const used, f_number_unsigned_t * const size) { + if (mock_unwrap_f_memory) { + return __real_f_memory_array_adjust(length, width, array, used, size); + } + if (!array || !used || !size) return F_status_set_error(F_parameter_not); const bool failure = mock_type(bool); @@ -30,8 +41,46 @@ f_status_t __wrap_f_memory_array_resize(const f_number_unsigned_t length, const return mock_type(f_status_t); } +f_status_t __wrap_f_memory_arrays_adjust(const f_number_unsigned_t length, const size_t width, void ** const array, f_number_unsigned_t * const used, f_number_unsigned_t * const size, f_status_t (*callback)(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array)) { + + if (mock_unwrap_f_memory) { + return __real_f_memory_arrays_resize(length, width, array, used, size, callback); + } + + if (!array || !used || !size || !callback) return F_status_set_error(F_parameter_not); + + const bool failure = mock_type(bool); + + if (failure) return mock_type(f_status_t); + + *size = length; + + return mock_type(f_status_t); +} + +f_status_t __wrap_f_memory_arrays_resize(const f_number_unsigned_t length, const size_t width, void ** const array, f_number_unsigned_t * const used, f_number_unsigned_t * const size, f_status_t (*callback)(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array)) { + + if (mock_unwrap_f_memory) { + return __real_f_memory_arrays_resize(length, width, array, used, size, callback); + } + + if (!array || !used || !size || !callback) return F_status_set_error(F_parameter_not); + + const bool failure = mock_type(bool); + + if (failure) return mock_type(f_status_t); + + *size = length; + + return mock_type(f_status_t); +} + int __wrap_poll(f_poll_t *fds, nfds_t nfds, int timeout) { + if (mock_unwrap) { + return __real_poll(fds, nfds, timeout); + } + const bool failure = mock_type(bool); if (failure) { diff --git a/level_0/f_type_array/tests/unit/c/mock-type_array.h b/level_0/f_type_array/tests/unit/c/mock-type_array.h index 92441e0..f263d3f 100644 --- a/level_0/f_type_array/tests/unit/c/mock-type_array.h +++ b/level_0/f_type_array/tests/unit/c/mock-type_array.h @@ -30,8 +30,23 @@ extern "C" { const static int mock_errno_generic = 32767; +extern int mock_unwrap; +extern int mock_unwrap_f_memory; + +extern f_status_t __real_f_memory_array_adjust(const f_number_unsigned_t length, const size_t width, void ** array, f_number_unsigned_t * const used, f_number_unsigned_t * const size); +extern f_status_t __real_f_memory_array_resize(const f_number_unsigned_t length, const size_t width, void ** array, f_number_unsigned_t * const used, f_number_unsigned_t * const size); + +extern f_status_t __real_f_memory_arrays_adjust(const f_number_unsigned_t length, const size_t width, void ** const array, f_number_unsigned_t * const used, f_number_unsigned_t * const size, f_status_t (*callback)(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array)); +extern f_status_t __real_f_memory_arrays_resize(const f_number_unsigned_t length, const size_t width, void ** const array, f_number_unsigned_t * const used, f_number_unsigned_t * const size, f_status_t (*callback)(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array)); + +extern int __real_poll(f_poll_t *fds, nfds_t nfds, int timeout); + extern f_status_t __wrap_f_memory_array_adjust(const f_number_unsigned_t length, const size_t width, void ** array, f_number_unsigned_t * const used, f_number_unsigned_t * const size); -extern f_status_t __wrap_f_memory_array_resizze(const f_number_unsigned_t length, const size_t width, void ** array, f_number_unsigned_t * const used, f_number_unsigned_t * const size); +extern f_status_t __wrap_f_memory_array_resize(const f_number_unsigned_t length, const size_t width, void ** array, f_number_unsigned_t * const used, f_number_unsigned_t * const size); + +extern f_status_t __wrap_f_memory_arrays_adjust(const f_number_unsigned_t length, const size_t width, void ** const array, f_number_unsigned_t * const used, f_number_unsigned_t * const size, f_status_t (*callback)(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array)); +extern f_status_t __wrap_f_memory_arrays_resize(const f_number_unsigned_t length, const size_t width, void ** const array, f_number_unsigned_t * const used, f_number_unsigned_t * const size, f_status_t (*callback)(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array)); + extern int __wrap_poll(f_poll_t *fds, nfds_t nfds, int timeout); #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cells_delete_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-cells_delete_callback.c deleted file mode 100644 index 46fe109..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cells_delete_callback.c +++ /dev/null @@ -1,45 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-cells_delete_callback.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_cells_delete_callback__fails(void **state) { - - f_cell_t data = f_cell_t_initialize; - f_cell_t data_array[] = { data }; - f_cells_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_cells_t datass_array[] = { datas }; - - { - will_return(__wrap_f_memory_array_resize, true); - will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); - - const f_status_t status = f_cells_delete_callback(0, 1, (void *) datass_array); - - assert_int_equal(status, F_status_set_error(F_failure)); - } -} - -void test__f_type_array_cells_delete_callback__works(void **state) { - - f_cell_t data = f_cell_t_initialize; - f_cell_t data_array[] = { data }; - f_cells_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_cells_t datass_array[] = { datas }; - const f_number_unsigned_t length = 1; - - { - will_return(__wrap_f_memory_array_resize, false); - will_return(__wrap_f_memory_array_resize, F_none); - - const f_status_t status = f_cells_delete_callback(0, length, (void *) datass_array); - - assert_int_equal(status, F_none); - } -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cells_delete_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-cells_delete_callback.h deleted file mode 100644 index e514b54..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cells_delete_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__cells_delete_callback -#define _TEST__F_type_array__cells_delete_callback - -/** - * Test that the function fails. - * - * @see f_cells_delete_callback() - */ -extern void test__f_type_array_cells_delete_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_cells_delete_callback() - */ -extern void test__f_type_array_cells_delete_callback__works(void **state); - -#endif // _TEST__F_type_array__cells_delete_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cells_destroy_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-cells_destroy_callback.c deleted file mode 100644 index 706d5bd..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cells_destroy_callback.c +++ /dev/null @@ -1,45 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-cells_destroy_callback.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_cells_destroy_callback__fails(void **state) { - - f_cell_t data = f_cell_t_initialize; - f_cell_t data_array[] = { data }; - f_cells_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_cells_t datass_array[] = { datas }; - - { - will_return(__wrap_f_memory_array_adjust, true); - will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); - - const f_status_t status = f_cells_destroy_callback(0, 1, (void *) datass_array); - - assert_int_equal(status, F_status_set_error(F_failure)); - } -} - -void test__f_type_array_cells_destroy_callback__works(void **state) { - - f_cell_t data = f_cell_t_initialize; - f_cell_t data_array[] = { data }; - f_cells_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_cells_t datass_array[] = { datas }; - const f_number_unsigned_t length = 1; - - { - will_return(__wrap_f_memory_array_adjust, false); - will_return(__wrap_f_memory_array_adjust, F_none); - - const f_status_t status = f_cells_destroy_callback(0, length, (void *) datass_array); - - assert_int_equal(status, F_none); - } -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cells_destroy_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-cells_destroy_callback.h deleted file mode 100644 index 9eb8873..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cells_destroy_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__cells_destroy_callback -#define _TEST__F_type_array__cells_destroy_callback - -/** - * Test that the function fails. - * - * @see f_cells_destroy_callback() - */ -extern void test__f_type_array_cells_destroy_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_cells_destroy_callback() - */ -extern void test__f_type_array_cells_destroy_callback__works(void **state); - -#endif // _TEST__F_type_array__cells_destroy_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_delete_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-cellss_delete_callback.c new file mode 100644 index 0000000..1e14bae --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-cellss_delete_callback.c @@ -0,0 +1,57 @@ +#include "test-type_array.h" +#include "test-type_array-cellss_delete_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_cellss_delete_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_cell_t data = f_cell_t_initialize; + f_cell_t data_array[] = { data }; + f_cells_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_cells_t datas_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_resize, true); + will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_cellss_delete_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_cellss_delete_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_cellss_t datass = f_cellss_t_initialize; + + { + f_status_t status = f_memory_array_resize(length, sizeof(f_cells_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_none); + + status = f_memory_array_resize(1, sizeof(f_cell_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size); + assert_int_equal(status, F_none); + } + + { + const f_status_t status = f_cellss_delete_callback(0, length, (void *) datass.array); + + assert_int_equal(status, F_none); + assert_int_equal(datass.array[0].size, 0); + } + + free((void *) datass.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_delete_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-cellss_delete_callback.h new file mode 100644 index 0000000..60ea14c --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-cellss_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__cellss_delete_callback +#define _TEST__F_type_array__cellss_delete_callback + +/** + * Test that the function fails. + * + * @see f_cellss_delete_callback() + */ +extern void test__f_type_array_cellss_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_cellss_delete_callback() + */ +extern void test__f_type_array_cellss_delete_callback__works(void **state); + +#endif // _TEST__F_type_array__cellss_delete_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_destroy_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-cellss_destroy_callback.c new file mode 100644 index 0000000..6ddc30b --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-cellss_destroy_callback.c @@ -0,0 +1,57 @@ +#include "test-type_array.h" +#include "test-type_array-cellss_destroy_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_cellss_destroy_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_cell_t data = f_cell_t_initialize; + f_cell_t data_array[] = { data }; + f_cells_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_cells_t datas_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_adjust, true); + will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_cellss_destroy_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_cellss_destroy_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_cellss_t datass = f_cellss_t_initialize; + + { + f_status_t status = f_memory_array_adjust(length, sizeof(f_cells_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_none); + + status = f_memory_array_adjust(1, sizeof(f_cell_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size); + assert_int_equal(status, F_none); + } + + { + const f_status_t status = f_cellss_destroy_callback(0, length, (void *) datass.array); + + assert_int_equal(status, F_none); + assert_int_equal(datass.array[0].size, 0); + } + + free((void *) datass.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_destroy_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-cellss_destroy_callback.h new file mode 100644 index 0000000..fb30c5c --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-cellss_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__cellss_destroy_callback +#define _TEST__F_type_array__cellss_destroy_callback + +/** + * Test that the function fails. + * + * @see f_cellss_destroy_callback() + */ +extern void test__f_type_array_cellss_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_cellss_destroy_callback() + */ +extern void test__f_type_array_cellss_destroy_callback__works(void **state); + +#endif // _TEST__F_type_array__cellss_destroy_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-files_delete_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-files_delete_callback.c deleted file mode 100644 index 6ba1927..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-files_delete_callback.c +++ /dev/null @@ -1,45 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-files_delete_callback.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_files_delete_callback__fails(void **state) { - - f_file_t data = f_file_t_initialize; - f_file_t data_array[] = { data }; - f_files_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_files_t datass_array[] = { datas }; - - { - will_return(__wrap_f_memory_array_resize, true); - will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); - - const f_status_t status = f_files_delete_callback(0, 1, (void *) datass_array); - - assert_int_equal(status, F_status_set_error(F_failure)); - } -} - -void test__f_type_array_files_delete_callback__works(void **state) { - - f_file_t data = f_file_t_initialize; - f_file_t data_array[] = { data }; - f_files_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_files_t datass_array[] = { datas }; - const f_number_unsigned_t length = 1; - - { - will_return(__wrap_f_memory_array_resize, false); - will_return(__wrap_f_memory_array_resize, F_none); - - const f_status_t status = f_files_delete_callback(0, length, (void *) datass_array); - - assert_int_equal(status, F_none); - } -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-files_delete_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-files_delete_callback.h deleted file mode 100644 index f9e6903..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-files_delete_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__files_delete_callback -#define _TEST__F_type_array__files_delete_callback - -/** - * Test that the function fails. - * - * @see f_files_delete_callback() - */ -extern void test__f_type_array_files_delete_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_files_delete_callback() - */ -extern void test__f_type_array_files_delete_callback__works(void **state); - -#endif // _TEST__F_type_array__files_delete_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-files_destroy_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-files_destroy_callback.c deleted file mode 100644 index 3af9fc1..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-files_destroy_callback.c +++ /dev/null @@ -1,45 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-files_destroy_callback.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_files_destroy_callback__fails(void **state) { - - f_file_t data = f_file_t_initialize; - f_file_t data_array[] = { data }; - f_files_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_files_t datass_array[] = { datas }; - - { - will_return(__wrap_f_memory_array_adjust, true); - will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); - - const f_status_t status = f_files_destroy_callback(0, 1, (void *) datass_array); - - assert_int_equal(status, F_status_set_error(F_failure)); - } -} - -void test__f_type_array_files_destroy_callback__works(void **state) { - - f_file_t data = f_file_t_initialize; - f_file_t data_array[] = { data }; - f_files_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_files_t datass_array[] = { datas }; - const f_number_unsigned_t length = 1; - - { - will_return(__wrap_f_memory_array_adjust, false); - will_return(__wrap_f_memory_array_adjust, F_none); - - const f_status_t status = f_files_destroy_callback(0, length, (void *) datass_array); - - assert_int_equal(status, F_none); - } -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-files_destroy_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-files_destroy_callback.h deleted file mode 100644 index 7f74897..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-files_destroy_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__files_destroy_callback -#define _TEST__F_type_array__files_destroy_callback - -/** - * Test that the function fails. - * - * @see f_files_destroy_callback() - */ -extern void test__f_type_array_files_destroy_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_files_destroy_callback() - */ -extern void test__f_type_array_files_destroy_callback__works(void **state); - -#endif // _TEST__F_type_array__files_destroy_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-filess_delete_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-filess_delete_callback.c new file mode 100644 index 0000000..9118863 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-filess_delete_callback.c @@ -0,0 +1,57 @@ +#include "test-type_array.h" +#include "test-type_array-filess_delete_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_filess_delete_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_file_t data = f_file_t_initialize; + f_file_t data_array[] = { data }; + f_files_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_files_t datas_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_resize, true); + will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_filess_delete_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_filess_delete_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_filess_t datass = f_filess_t_initialize; + + { + f_status_t status = f_memory_array_resize(length, sizeof(f_files_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_none); + + status = f_memory_array_resize(1, sizeof(f_file_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size); + assert_int_equal(status, F_none); + } + + { + const f_status_t status = f_filess_delete_callback(0, length, (void *) datass.array); + + assert_int_equal(status, F_none); + assert_int_equal(datass.array[0].size, 0); + } + + free((void *) datass.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-filess_delete_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-filess_delete_callback.h new file mode 100644 index 0000000..d2688cf --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-filess_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__filess_delete_callback +#define _TEST__F_type_array__filess_delete_callback + +/** + * Test that the function fails. + * + * @see f_filess_delete_callback() + */ +extern void test__f_type_array_filess_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_filess_delete_callback() + */ +extern void test__f_type_array_filess_delete_callback__works(void **state); + +#endif // _TEST__F_type_array__filess_delete_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-filess_destroy_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-filess_destroy_callback.c new file mode 100644 index 0000000..7b58459 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-filess_destroy_callback.c @@ -0,0 +1,57 @@ +#include "test-type_array.h" +#include "test-type_array-filess_destroy_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_filess_destroy_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_file_t data = f_file_t_initialize; + f_file_t data_array[] = { data }; + f_files_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_files_t datas_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_adjust, true); + will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_filess_destroy_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_filess_destroy_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_filess_t datass = f_filess_t_initialize; + + { + f_status_t status = f_memory_array_adjust(length, sizeof(f_files_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_none); + + status = f_memory_array_adjust(1, sizeof(f_file_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size); + assert_int_equal(status, F_none); + } + + { + const f_status_t status = f_filess_destroy_callback(0, length, (void *) datass.array); + + assert_int_equal(status, F_none); + assert_int_equal(datass.array[0].size, 0); + } + + free((void *) datass.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-filess_destroy_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-filess_destroy_callback.h new file mode 100644 index 0000000..a642dd7 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-filess_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__filess_destroy_callback +#define _TEST__F_type_array__filess_destroy_callback + +/** + * Test that the function fails. + * + * @see f_filess_destroy_callback() + */ +extern void test__f_type_array_filess_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_filess_destroy_callback() + */ +extern void test__f_type_array_filess_destroy_callback__works(void **state); + +#endif // _TEST__F_type_array__filess_destroy_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_delete_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_delete_callback.c deleted file mode 100644 index b9dfa83..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_delete_callback.c +++ /dev/null @@ -1,45 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-fll_ids_delete_callback.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_fll_ids_delete_callback__fails(void **state) { - - f_fll_id_t data = f_fll_id_t_initialize; - f_fll_id_t data_array[] = { data }; - f_fll_ids_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_fll_ids_t datass_array[] = { datas }; - - { - will_return(__wrap_f_memory_array_resize, true); - will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); - - const f_status_t status = f_fll_ids_delete_callback(0, 1, (void *) datass_array); - - assert_int_equal(status, F_status_set_error(F_failure)); - } -} - -void test__f_type_array_fll_ids_delete_callback__works(void **state) { - - f_fll_id_t data = f_fll_id_t_initialize; - f_fll_id_t data_array[] = { data }; - f_fll_ids_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_fll_ids_t datass_array[] = { datas }; - const f_number_unsigned_t length = 1; - - { - will_return(__wrap_f_memory_array_resize, false); - will_return(__wrap_f_memory_array_resize, F_none); - - const f_status_t status = f_fll_ids_delete_callback(0, length, (void *) datass_array); - - assert_int_equal(status, F_none); - } -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_delete_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_delete_callback.h deleted file mode 100644 index 472a906..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_delete_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__fll_ids_delete_callback -#define _TEST__F_type_array__fll_ids_delete_callback - -/** - * Test that the function fails. - * - * @see f_fll_ids_delete_callback() - */ -extern void test__f_type_array_fll_ids_delete_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_fll_ids_delete_callback() - */ -extern void test__f_type_array_fll_ids_delete_callback__works(void **state); - -#endif // _TEST__F_type_array__fll_ids_delete_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_destroy_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_destroy_callback.c deleted file mode 100644 index 2691c79..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_destroy_callback.c +++ /dev/null @@ -1,45 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-fll_ids_destroy_callback.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_fll_ids_destroy_callback__fails(void **state) { - - f_fll_id_t data = f_fll_id_t_initialize; - f_fll_id_t data_array[] = { data }; - f_fll_ids_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_fll_ids_t datass_array[] = { datas }; - - { - will_return(__wrap_f_memory_array_adjust, true); - will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); - - const f_status_t status = f_fll_ids_destroy_callback(0, 1, (void *) datass_array); - - assert_int_equal(status, F_status_set_error(F_failure)); - } -} - -void test__f_type_array_fll_ids_destroy_callback__works(void **state) { - - f_fll_id_t data = f_fll_id_t_initialize; - f_fll_id_t data_array[] = { data }; - f_fll_ids_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_fll_ids_t datass_array[] = { datas }; - const f_number_unsigned_t length = 1; - - { - will_return(__wrap_f_memory_array_adjust, false); - will_return(__wrap_f_memory_array_adjust, F_none); - - const f_status_t status = f_fll_ids_destroy_callback(0, length, (void *) datass_array); - - assert_int_equal(status, F_none); - } -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_destroy_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_destroy_callback.h deleted file mode 100644 index cd90c41..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_destroy_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__fll_ids_destroy_callback -#define _TEST__F_type_array__fll_ids_destroy_callback - -/** - * Test that the function fails. - * - * @see f_fll_ids_destroy_callback() - */ -extern void test__f_type_array_fll_ids_destroy_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_fll_ids_destroy_callback() - */ -extern void test__f_type_array_fll_ids_destroy_callback__works(void **state); - -#endif // _TEST__F_type_array__fll_ids_destroy_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_delete_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_delete_callback.c new file mode 100644 index 0000000..5797651 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_delete_callback.c @@ -0,0 +1,57 @@ +#include "test-type_array.h" +#include "test-type_array-fll_idss_delete_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_fll_idss_delete_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_fll_id_t data = f_fll_id_t_initialize; + f_fll_id_t data_array[] = { data }; + f_fll_ids_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_fll_ids_t datas_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_resize, true); + will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_fll_idss_delete_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_fll_idss_delete_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_fll_idss_t datass = f_fll_idss_t_initialize; + + { + f_status_t status = f_memory_array_resize(length, sizeof(f_fll_ids_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_none); + + status = f_memory_array_resize(1, sizeof(f_fll_id_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size); + assert_int_equal(status, F_none); + } + + { + const f_status_t status = f_fll_idss_delete_callback(0, length, (void *) datass.array); + + assert_int_equal(status, F_none); + assert_int_equal(datass.array[0].size, 0); + } + + free((void *) datass.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_delete_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_delete_callback.h new file mode 100644 index 0000000..4f02b30 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__fll_idss_delete_callback +#define _TEST__F_type_array__fll_idss_delete_callback + +/** + * Test that the function fails. + * + * @see f_fll_idss_delete_callback() + */ +extern void test__f_type_array_fll_idss_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_fll_idss_delete_callback() + */ +extern void test__f_type_array_fll_idss_delete_callback__works(void **state); + +#endif // _TEST__F_type_array__fll_idss_delete_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_destroy_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_destroy_callback.c new file mode 100644 index 0000000..b4d5178 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_destroy_callback.c @@ -0,0 +1,57 @@ +#include "test-type_array.h" +#include "test-type_array-fll_idss_destroy_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_fll_idss_destroy_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_fll_id_t data = f_fll_id_t_initialize; + f_fll_id_t data_array[] = { data }; + f_fll_ids_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_fll_ids_t datas_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_adjust, true); + will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_fll_idss_destroy_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_fll_idss_destroy_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_fll_idss_t datass = f_fll_idss_t_initialize; + + { + f_status_t status = f_memory_array_adjust(length, sizeof(f_fll_ids_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_none); + + status = f_memory_array_adjust(1, sizeof(f_fll_id_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size); + assert_int_equal(status, F_none); + } + + { + const f_status_t status = f_fll_idss_destroy_callback(0, length, (void *) datass.array); + + assert_int_equal(status, F_none); + assert_int_equal(datass.array[0].size, 0); + } + + free((void *) datass.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_destroy_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_destroy_callback.h new file mode 100644 index 0000000..e0ced0a --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__fll_idss_destroy_callback +#define _TEST__F_type_array__fll_idss_destroy_callback + +/** + * Test that the function fails. + * + * @see f_fll_idss_destroy_callback() + */ +extern void test__f_type_array_fll_idss_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_fll_idss_destroy_callback() + */ +extern void test__f_type_array_fll_idss_destroy_callback__works(void **state); + +#endif // _TEST__F_type_array__fll_idss_destroy_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_delete_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_delete_callback.c deleted file mode 100644 index 94f141f..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_delete_callback.c +++ /dev/null @@ -1,45 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int128s_delete_callback.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int128s_delete_callback__fails(void **state) { - - f_int128_t data = 0; - f_int128_t data_array[] = { data }; - f_int128s_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_int128s_t datass_array[] = { datas }; - - { - will_return(__wrap_f_memory_array_resize, true); - will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); - - const f_status_t status = f_int128s_delete_callback(0, 1, (void *) datass_array); - - assert_int_equal(status, F_status_set_error(F_failure)); - } -} - -void test__f_type_array_int128s_delete_callback__works(void **state) { - - f_int128_t data = 0; - f_int128_t data_array[] = { data }; - f_int128s_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_int128s_t datass_array[] = { datas }; - const f_number_unsigned_t length = 1; - - { - will_return(__wrap_f_memory_array_resize, false); - will_return(__wrap_f_memory_array_resize, F_none); - - const f_status_t status = f_int128s_delete_callback(0, length, (void *) datass_array); - - assert_int_equal(status, F_none); - } -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_delete_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_delete_callback.h deleted file mode 100644 index 3273acb..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_delete_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int128s_delete_callback -#define _TEST__F_type_array__int128s_delete_callback - -/** - * Test that the function fails. - * - * @see f_int128s_delete_callback() - */ -extern void test__f_type_array_int128s_delete_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_int128s_delete_callback() - */ -extern void test__f_type_array_int128s_delete_callback__works(void **state); - -#endif // _TEST__F_type_array__int128s_delete_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_destroy_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_destroy_callback.c deleted file mode 100644 index 474a889..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_destroy_callback.c +++ /dev/null @@ -1,45 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int128s_destroy_callback.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int128s_destroy_callback__fails(void **state) { - - f_int128_t data = 0; - f_int128_t data_array[] = { data }; - f_int128s_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_int128s_t datass_array[] = { datas }; - - { - will_return(__wrap_f_memory_array_adjust, true); - will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); - - const f_status_t status = f_int128s_destroy_callback(0, 1, (void *) datass_array); - - assert_int_equal(status, F_status_set_error(F_failure)); - } -} - -void test__f_type_array_int128s_destroy_callback__works(void **state) { - - f_int128_t data = 0; - f_int128_t data_array[] = { data }; - f_int128s_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_int128s_t datass_array[] = { datas }; - const f_number_unsigned_t length = 1; - - { - will_return(__wrap_f_memory_array_adjust, false); - will_return(__wrap_f_memory_array_adjust, F_none); - - const f_status_t status = f_int128s_destroy_callback(0, length, (void *) datass_array); - - assert_int_equal(status, F_none); - } -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_destroy_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_destroy_callback.h deleted file mode 100644 index 4db2028..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_destroy_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int128s_destroy_callback -#define _TEST__F_type_array__int128s_destroy_callback - -/** - * Test that the function fails. - * - * @see f_int128s_destroy_callback() - */ -extern void test__f_type_array_int128s_destroy_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_int128s_destroy_callback() - */ -extern void test__f_type_array_int128s_destroy_callback__works(void **state); - -#endif // _TEST__F_type_array__int128s_destroy_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_delete_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_delete_callback.c new file mode 100644 index 0000000..07512fc --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_delete_callback.c @@ -0,0 +1,57 @@ +#include "test-type_array.h" +#include "test-type_array-int128ss_delete_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int128ss_delete_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_int128_t data = 0; + f_int128_t data_array[] = { data }; + f_int128s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_int128s_t datas_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_resize, true); + will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_int128ss_delete_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_int128ss_delete_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_int128ss_t datass = f_int128ss_t_initialize; + + { + f_status_t status = f_memory_array_resize(length, sizeof(f_int128s_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_none); + + status = f_memory_array_resize(1, sizeof(f_int128_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size); + assert_int_equal(status, F_none); + } + + { + const f_status_t status = f_int128ss_delete_callback(0, length, (void *) datass.array); + + assert_int_equal(status, F_none); + assert_int_equal(datass.array[0].size, 0); + } + + free((void *) datass.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_delete_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_delete_callback.h new file mode 100644 index 0000000..2c4e448 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int128ss_delete_callback +#define _TEST__F_type_array__int128ss_delete_callback + +/** + * Test that the function fails. + * + * @see f_int128ss_delete_callback() + */ +extern void test__f_type_array_int128ss_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_int128ss_delete_callback() + */ +extern void test__f_type_array_int128ss_delete_callback__works(void **state); + +#endif // _TEST__F_type_array__int128ss_delete_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_destroy_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_destroy_callback.c new file mode 100644 index 0000000..ac9c4d5 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_destroy_callback.c @@ -0,0 +1,57 @@ +#include "test-type_array.h" +#include "test-type_array-int128ss_destroy_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int128ss_destroy_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_int128_t data = 0; + f_int128_t data_array[] = { data }; + f_int128s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_int128s_t datas_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_adjust, true); + will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_int128ss_destroy_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_int128ss_destroy_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_int128ss_t datass = f_int128ss_t_initialize; + + { + f_status_t status = f_memory_array_adjust(length, sizeof(f_int128s_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_none); + + status = f_memory_array_adjust(1, sizeof(f_int128_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size); + assert_int_equal(status, F_none); + } + + { + const f_status_t status = f_int128ss_destroy_callback(0, length, (void *) datass.array); + + assert_int_equal(status, F_none); + assert_int_equal(datass.array[0].size, 0); + } + + free((void *) datass.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_destroy_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_destroy_callback.h new file mode 100644 index 0000000..1761aa3 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int128ss_destroy_callback +#define _TEST__F_type_array__int128ss_destroy_callback + +/** + * Test that the function fails. + * + * @see f_int128ss_destroy_callback() + */ +extern void test__f_type_array_int128ss_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_int128ss_destroy_callback() + */ +extern void test__f_type_array_int128ss_destroy_callback__works(void **state); + +#endif // _TEST__F_type_array__int128ss_destroy_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_delete_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_delete_callback.c deleted file mode 100644 index 7a70378..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_delete_callback.c +++ /dev/null @@ -1,45 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int16s_delete_callback.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int16s_delete_callback__fails(void **state) { - - int16_t data = 0; - int16_t data_array[] = { data }; - f_int16s_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_int16s_t datass_array[] = { datas }; - - { - will_return(__wrap_f_memory_array_resize, true); - will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); - - const f_status_t status = f_int16s_delete_callback(0, 1, (void *) datass_array); - - assert_int_equal(status, F_status_set_error(F_failure)); - } -} - -void test__f_type_array_int16s_delete_callback__works(void **state) { - - int16_t data = 0; - int16_t data_array[] = { data }; - f_int16s_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_int16s_t datass_array[] = { datas }; - const f_number_unsigned_t length = 1; - - { - will_return(__wrap_f_memory_array_resize, false); - will_return(__wrap_f_memory_array_resize, F_none); - - const f_status_t status = f_int16s_delete_callback(0, length, (void *) datass_array); - - assert_int_equal(status, F_none); - } -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_delete_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_delete_callback.h deleted file mode 100644 index 91ccdaf..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_delete_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int16s_delete_callback -#define _TEST__F_type_array__int16s_delete_callback - -/** - * Test that the function fails. - * - * @see f_int16s_delete_callback() - */ -extern void test__f_type_array_int16s_delete_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_int16s_delete_callback() - */ -extern void test__f_type_array_int16s_delete_callback__works(void **state); - -#endif // _TEST__F_type_array__int16s_delete_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_destroy_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_destroy_callback.c deleted file mode 100644 index 8016baf..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_destroy_callback.c +++ /dev/null @@ -1,45 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int16s_destroy_callback.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int16s_destroy_callback__fails(void **state) { - - int16_t data = 0; - int16_t data_array[] = { data }; - f_int16s_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_int16s_t datass_array[] = { datas }; - - { - will_return(__wrap_f_memory_array_adjust, true); - will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); - - const f_status_t status = f_int16s_destroy_callback(0, 1, (void *) datass_array); - - assert_int_equal(status, F_status_set_error(F_failure)); - } -} - -void test__f_type_array_int16s_destroy_callback__works(void **state) { - - int16_t data = 0; - int16_t data_array[] = { data }; - f_int16s_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_int16s_t datass_array[] = { datas }; - const f_number_unsigned_t length = 1; - - { - will_return(__wrap_f_memory_array_adjust, false); - will_return(__wrap_f_memory_array_adjust, F_none); - - const f_status_t status = f_int16s_destroy_callback(0, length, (void *) datass_array); - - assert_int_equal(status, F_none); - } -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_destroy_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_destroy_callback.h deleted file mode 100644 index 068ccd7..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_destroy_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int16s_destroy_callback -#define _TEST__F_type_array__int16s_destroy_callback - -/** - * Test that the function fails. - * - * @see f_int16s_destroy_callback() - */ -extern void test__f_type_array_int16s_destroy_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_int16s_destroy_callback() - */ -extern void test__f_type_array_int16s_destroy_callback__works(void **state); - -#endif // _TEST__F_type_array__int16s_destroy_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_delete_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_delete_callback.c new file mode 100644 index 0000000..020e11f --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_delete_callback.c @@ -0,0 +1,57 @@ +#include "test-type_array.h" +#include "test-type_array-int16ss_delete_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int16ss_delete_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + int16_t data = 0; + int16_t data_array[] = { data }; + f_int16s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_int16s_t datas_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_resize, true); + will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_int16ss_delete_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_int16ss_delete_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_int16ss_t datass = f_int16ss_t_initialize; + + { + f_status_t status = f_memory_array_resize(length, sizeof(f_int16s_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_none); + + status = f_memory_array_resize(1, sizeof(int16_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size); + assert_int_equal(status, F_none); + } + + { + const f_status_t status = f_int16ss_delete_callback(0, length, (void *) datass.array); + + assert_int_equal(status, F_none); + assert_int_equal(datass.array[0].size, 0); + } + + free((void *) datass.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_delete_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_delete_callback.h new file mode 100644 index 0000000..424fd03 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int16ss_delete_callback +#define _TEST__F_type_array__int16ss_delete_callback + +/** + * Test that the function fails. + * + * @see f_int16ss_delete_callback() + */ +extern void test__f_type_array_int16ss_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_int16ss_delete_callback() + */ +extern void test__f_type_array_int16ss_delete_callback__works(void **state); + +#endif // _TEST__F_type_array__int16ss_delete_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_destroy_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_destroy_callback.c new file mode 100644 index 0000000..27d7a1a --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_destroy_callback.c @@ -0,0 +1,57 @@ +#include "test-type_array.h" +#include "test-type_array-int16ss_destroy_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int16ss_destroy_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + int16_t data = 0; + int16_t data_array[] = { data }; + f_int16s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_int16s_t datas_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_adjust, true); + will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_int16ss_destroy_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_int16ss_destroy_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_int16ss_t datass = f_int16ss_t_initialize; + + { + f_status_t status = f_memory_array_adjust(length, sizeof(f_int16s_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_none); + + status = f_memory_array_adjust(1, sizeof(int16_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size); + assert_int_equal(status, F_none); + } + + { + const f_status_t status = f_int16ss_destroy_callback(0, length, (void *) datass.array); + + assert_int_equal(status, F_none); + assert_int_equal(datass.array[0].size, 0); + } + + free((void *) datass.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_destroy_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_destroy_callback.h new file mode 100644 index 0000000..44be70d --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int16ss_destroy_callback +#define _TEST__F_type_array__int16ss_destroy_callback + +/** + * Test that the function fails. + * + * @see f_int16ss_destroy_callback() + */ +extern void test__f_type_array_int16ss_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_int16ss_destroy_callback() + */ +extern void test__f_type_array_int16ss_destroy_callback__works(void **state); + +#endif // _TEST__F_type_array__int16ss_destroy_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_delete_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_delete_callback.c deleted file mode 100644 index 37e627f..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_delete_callback.c +++ /dev/null @@ -1,45 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int32s_delete_callback.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int32s_delete_callback__fails(void **state) { - - int32_t data = 0; - int32_t data_array[] = { data }; - f_int32s_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_int32s_t datass_array[] = { datas }; - - { - will_return(__wrap_f_memory_array_resize, true); - will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); - - const f_status_t status = f_int32s_delete_callback(0, 1, (void *) datass_array); - - assert_int_equal(status, F_status_set_error(F_failure)); - } -} - -void test__f_type_array_int32s_delete_callback__works(void **state) { - - int32_t data = 0; - int32_t data_array[] = { data }; - f_int32s_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_int32s_t datass_array[] = { datas }; - const f_number_unsigned_t length = 1; - - { - will_return(__wrap_f_memory_array_resize, false); - will_return(__wrap_f_memory_array_resize, F_none); - - const f_status_t status = f_int32s_delete_callback(0, length, (void *) datass_array); - - assert_int_equal(status, F_none); - } -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_delete_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_delete_callback.h deleted file mode 100644 index ac1c8de..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_delete_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int32s_delete_callback -#define _TEST__F_type_array__int32s_delete_callback - -/** - * Test that the function fails. - * - * @see f_int32s_delete_callback() - */ -extern void test__f_type_array_int32s_delete_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_int32s_delete_callback() - */ -extern void test__f_type_array_int32s_delete_callback__works(void **state); - -#endif // _TEST__F_type_array__int32s_delete_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_destroy_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_destroy_callback.c deleted file mode 100644 index fa08145..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_destroy_callback.c +++ /dev/null @@ -1,45 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int32s_destroy_callback.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int32s_destroy_callback__fails(void **state) { - - int32_t data = 0; - int32_t data_array[] = { data }; - f_int32s_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_int32s_t datass_array[] = { datas }; - - { - will_return(__wrap_f_memory_array_adjust, true); - will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); - - const f_status_t status = f_int32s_destroy_callback(0, 1, (void *) datass_array); - - assert_int_equal(status, F_status_set_error(F_failure)); - } -} - -void test__f_type_array_int32s_destroy_callback__works(void **state) { - - int32_t data = 0; - int32_t data_array[] = { data }; - f_int32s_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_int32s_t datass_array[] = { datas }; - const f_number_unsigned_t length = 1; - - { - will_return(__wrap_f_memory_array_adjust, false); - will_return(__wrap_f_memory_array_adjust, F_none); - - const f_status_t status = f_int32s_destroy_callback(0, length, (void *) datass_array); - - assert_int_equal(status, F_none); - } -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_destroy_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_destroy_callback.h deleted file mode 100644 index 212ae69..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_destroy_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int32s_destroy_callback -#define _TEST__F_type_array__int32s_destroy_callback - -/** - * Test that the function fails. - * - * @see f_int32s_destroy_callback() - */ -extern void test__f_type_array_int32s_destroy_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_int32s_destroy_callback() - */ -extern void test__f_type_array_int32s_destroy_callback__works(void **state); - -#endif // _TEST__F_type_array__int32s_destroy_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_delete_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_delete_callback.c new file mode 100644 index 0000000..3062d4e --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_delete_callback.c @@ -0,0 +1,57 @@ +#include "test-type_array.h" +#include "test-type_array-int32ss_delete_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int32ss_delete_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + int32_t data = 0; + int32_t data_array[] = { data }; + f_int32s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_int32s_t datas_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_resize, true); + will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_int32ss_delete_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_int32ss_delete_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_int32ss_t datass = f_int32ss_t_initialize; + + { + f_status_t status = f_memory_array_resize(length, sizeof(f_int32s_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_none); + + status = f_memory_array_resize(1, sizeof(int32_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size); + assert_int_equal(status, F_none); + } + + { + const f_status_t status = f_int32ss_delete_callback(0, length, (void *) datass.array); + + assert_int_equal(status, F_none); + assert_int_equal(datass.array[0].size, 0); + } + + free((void *) datass.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_delete_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_delete_callback.h new file mode 100644 index 0000000..7b3a023 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int32ss_delete_callback +#define _TEST__F_type_array__int32ss_delete_callback + +/** + * Test that the function fails. + * + * @see f_int32ss_delete_callback() + */ +extern void test__f_type_array_int32ss_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_int32ss_delete_callback() + */ +extern void test__f_type_array_int32ss_delete_callback__works(void **state); + +#endif // _TEST__F_type_array__int32ss_delete_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_destroy_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_destroy_callback.c new file mode 100644 index 0000000..9d5bcf9 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_destroy_callback.c @@ -0,0 +1,57 @@ +#include "test-type_array.h" +#include "test-type_array-int32ss_destroy_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int32ss_destroy_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + int32_t data = 0; + int32_t data_array[] = { data }; + f_int32s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_int32s_t datas_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_adjust, true); + will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_int32ss_destroy_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_int32ss_destroy_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_int32ss_t datass = f_int32ss_t_initialize; + + { + f_status_t status = f_memory_array_adjust(length, sizeof(f_int32s_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_none); + + status = f_memory_array_adjust(1, sizeof(int32_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size); + assert_int_equal(status, F_none); + } + + { + const f_status_t status = f_int32ss_destroy_callback(0, length, (void *) datass.array); + + assert_int_equal(status, F_none); + assert_int_equal(datass.array[0].size, 0); + } + + free((void *) datass.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_destroy_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_destroy_callback.h new file mode 100644 index 0000000..c29867a --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int32ss_destroy_callback +#define _TEST__F_type_array__int32ss_destroy_callback + +/** + * Test that the function fails. + * + * @see f_int32ss_destroy_callback() + */ +extern void test__f_type_array_int32ss_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_int32ss_destroy_callback() + */ +extern void test__f_type_array_int32ss_destroy_callback__works(void **state); + +#endif // _TEST__F_type_array__int32ss_destroy_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_delete_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_delete_callback.c deleted file mode 100644 index 312aff3..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_delete_callback.c +++ /dev/null @@ -1,45 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int64s_delete_callback.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int64s_delete_callback__fails(void **state) { - - int64_t data = 0; - int64_t data_array[] = { data }; - f_int64s_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_int64s_t datass_array[] = { datas }; - - { - will_return(__wrap_f_memory_array_resize, true); - will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); - - const f_status_t status = f_int64s_delete_callback(0, 1, (void *) datass_array); - - assert_int_equal(status, F_status_set_error(F_failure)); - } -} - -void test__f_type_array_int64s_delete_callback__works(void **state) { - - int64_t data = 0; - int64_t data_array[] = { data }; - f_int64s_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_int64s_t datass_array[] = { datas }; - const f_number_unsigned_t length = 1; - - { - will_return(__wrap_f_memory_array_resize, false); - will_return(__wrap_f_memory_array_resize, F_none); - - const f_status_t status = f_int64s_delete_callback(0, length, (void *) datass_array); - - assert_int_equal(status, F_none); - } -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_delete_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_delete_callback.h deleted file mode 100644 index 4f06ff8..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_delete_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int64s_delete_callback -#define _TEST__F_type_array__int64s_delete_callback - -/** - * Test that the function fails. - * - * @see f_int64s_delete_callback() - */ -extern void test__f_type_array_int64s_delete_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_int64s_delete_callback() - */ -extern void test__f_type_array_int64s_delete_callback__works(void **state); - -#endif // _TEST__F_type_array__int64s_delete_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_destroy_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_destroy_callback.c deleted file mode 100644 index 631ea63..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_destroy_callback.c +++ /dev/null @@ -1,45 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int64s_destroy_callback.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int64s_destroy_callback__fails(void **state) { - - int64_t data = 0; - int64_t data_array[] = { data }; - f_int64s_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_int64s_t datass_array[] = { datas }; - - { - will_return(__wrap_f_memory_array_adjust, true); - will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); - - const f_status_t status = f_int64s_destroy_callback(0, 1, (void *) datass_array); - - assert_int_equal(status, F_status_set_error(F_failure)); - } -} - -void test__f_type_array_int64s_destroy_callback__works(void **state) { - - int64_t data = 0; - int64_t data_array[] = { data }; - f_int64s_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_int64s_t datass_array[] = { datas }; - const f_number_unsigned_t length = 1; - - { - will_return(__wrap_f_memory_array_adjust, false); - will_return(__wrap_f_memory_array_adjust, F_none); - - const f_status_t status = f_int64s_destroy_callback(0, length, (void *) datass_array); - - assert_int_equal(status, F_none); - } -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_destroy_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_destroy_callback.h deleted file mode 100644 index 998e037..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_destroy_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int64s_destroy_callback -#define _TEST__F_type_array__int64s_destroy_callback - -/** - * Test that the function fails. - * - * @see f_int64s_destroy_callback() - */ -extern void test__f_type_array_int64s_destroy_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_int64s_destroy_callback() - */ -extern void test__f_type_array_int64s_destroy_callback__works(void **state); - -#endif // _TEST__F_type_array__int64s_destroy_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_delete_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_delete_callback.c new file mode 100644 index 0000000..ba5a42c --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_delete_callback.c @@ -0,0 +1,57 @@ +#include "test-type_array.h" +#include "test-type_array-int64ss_delete_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int64ss_delete_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + int64_t data = 0; + int64_t data_array[] = { data }; + f_int64s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_int64s_t datas_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_resize, true); + will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_int64ss_delete_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_int64ss_delete_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_int64ss_t datass = f_int64ss_t_initialize; + + { + f_status_t status = f_memory_array_resize(length, sizeof(f_int64s_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_none); + + status = f_memory_array_resize(1, sizeof(int64_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size); + assert_int_equal(status, F_none); + } + + { + const f_status_t status = f_int64ss_delete_callback(0, length, (void *) datass.array); + + assert_int_equal(status, F_none); + assert_int_equal(datass.array[0].size, 0); + } + + free((void *) datass.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_delete_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_delete_callback.h new file mode 100644 index 0000000..cacdff5 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int64ss_delete_callback +#define _TEST__F_type_array__int64ss_delete_callback + +/** + * Test that the function fails. + * + * @see f_int64ss_delete_callback() + */ +extern void test__f_type_array_int64ss_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_int64ss_delete_callback() + */ +extern void test__f_type_array_int64ss_delete_callback__works(void **state); + +#endif // _TEST__F_type_array__int64ss_delete_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_destroy_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_destroy_callback.c new file mode 100644 index 0000000..54237d6 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_destroy_callback.c @@ -0,0 +1,57 @@ +#include "test-type_array.h" +#include "test-type_array-int64ss_destroy_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int64ss_destroy_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + int64_t data = 0; + int64_t data_array[] = { data }; + f_int64s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_int64s_t datas_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_adjust, true); + will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_int64ss_destroy_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_int64ss_destroy_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_int64ss_t datass = f_int64ss_t_initialize; + + { + f_status_t status = f_memory_array_adjust(length, sizeof(f_int64s_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_none); + + status = f_memory_array_adjust(1, sizeof(int64_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size); + assert_int_equal(status, F_none); + } + + { + const f_status_t status = f_int64ss_destroy_callback(0, length, (void *) datass.array); + + assert_int_equal(status, F_none); + assert_int_equal(datass.array[0].size, 0); + } + + free((void *) datass.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_destroy_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_destroy_callback.h new file mode 100644 index 0000000..77c3ac2 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int64ss_destroy_callback +#define _TEST__F_type_array__int64ss_destroy_callback + +/** + * Test that the function fails. + * + * @see f_int64ss_destroy_callback() + */ +extern void test__f_type_array_int64ss_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_int64ss_destroy_callback() + */ +extern void test__f_type_array_int64ss_destroy_callback__works(void **state); + +#endif // _TEST__F_type_array__int64ss_destroy_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_delete_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_delete_callback.c deleted file mode 100644 index cd1e85b..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_delete_callback.c +++ /dev/null @@ -1,45 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int8s_delete_callback.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int8s_delete_callback__fails(void **state) { - - int8_t data = 0; - int8_t data_array[] = { data }; - f_int8s_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_int8s_t datass_array[] = { datas }; - - { - will_return(__wrap_f_memory_array_resize, true); - will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); - - const f_status_t status = f_int8s_delete_callback(0, 1, (void *) datass_array); - - assert_int_equal(status, F_status_set_error(F_failure)); - } -} - -void test__f_type_array_int8s_delete_callback__works(void **state) { - - int8_t data = 0; - int8_t data_array[] = { data }; - f_int8s_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_int8s_t datass_array[] = { datas }; - const f_number_unsigned_t length = 1; - - { - will_return(__wrap_f_memory_array_resize, false); - will_return(__wrap_f_memory_array_resize, F_none); - - const f_status_t status = f_int8s_delete_callback(0, length, (void *) datass_array); - - assert_int_equal(status, F_none); - } -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_delete_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_delete_callback.h deleted file mode 100644 index 30adf90..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_delete_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int8s_delete_callback -#define _TEST__F_type_array__int8s_delete_callback - -/** - * Test that the function fails. - * - * @see f_int8s_delete_callback() - */ -extern void test__f_type_array_int8s_delete_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_int8s_delete_callback() - */ -extern void test__f_type_array_int8s_delete_callback__works(void **state); - -#endif // _TEST__F_type_array__int8s_delete_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_destroy_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_destroy_callback.c deleted file mode 100644 index 8339593..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_destroy_callback.c +++ /dev/null @@ -1,45 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int8s_destroy_callback.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int8s_destroy_callback__fails(void **state) { - - int8_t data = 0; - int8_t data_array[] = { data }; - f_int8s_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_int8s_t datass_array[] = { datas }; - - { - will_return(__wrap_f_memory_array_adjust, true); - will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); - - const f_status_t status = f_int8s_destroy_callback(0, 1, (void *) datass_array); - - assert_int_equal(status, F_status_set_error(F_failure)); - } -} - -void test__f_type_array_int8s_destroy_callback__works(void **state) { - - int8_t data = 0; - int8_t data_array[] = { data }; - f_int8s_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_int8s_t datass_array[] = { datas }; - const f_number_unsigned_t length = 1; - - { - will_return(__wrap_f_memory_array_adjust, false); - will_return(__wrap_f_memory_array_adjust, F_none); - - const f_status_t status = f_int8s_destroy_callback(0, length, (void *) datass_array); - - assert_int_equal(status, F_none); - } -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_destroy_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_destroy_callback.h deleted file mode 100644 index 2074caa..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_destroy_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int8s_destroy_callback -#define _TEST__F_type_array__int8s_destroy_callback - -/** - * Test that the function fails. - * - * @see f_int8s_destroy_callback() - */ -extern void test__f_type_array_int8s_destroy_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_int8s_destroy_callback() - */ -extern void test__f_type_array_int8s_destroy_callback__works(void **state); - -#endif // _TEST__F_type_array__int8s_destroy_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_delete_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_delete_callback.c new file mode 100644 index 0000000..3a5ffce --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_delete_callback.c @@ -0,0 +1,57 @@ +#include "test-type_array.h" +#include "test-type_array-int8ss_delete_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int8ss_delete_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + int8_t data = 0; + int8_t data_array[] = { data }; + f_int8s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_int8s_t datas_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_resize, true); + will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_int8ss_delete_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_int8ss_delete_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_int8ss_t datass = f_int8ss_t_initialize; + + { + f_status_t status = f_memory_array_resize(length, sizeof(f_int8s_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_none); + + status = f_memory_array_resize(1, sizeof(int8_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size); + assert_int_equal(status, F_none); + } + + { + const f_status_t status = f_int8ss_delete_callback(0, length, (void *) datass.array); + + assert_int_equal(status, F_none); + assert_int_equal(datass.array[0].size, 0); + } + + free((void *) datass.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_delete_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_delete_callback.h new file mode 100644 index 0000000..6bdb16f --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int8ss_delete_callback +#define _TEST__F_type_array__int8ss_delete_callback + +/** + * Test that the function fails. + * + * @see f_int8ss_delete_callback() + */ +extern void test__f_type_array_int8ss_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_int8ss_delete_callback() + */ +extern void test__f_type_array_int8ss_delete_callback__works(void **state); + +#endif // _TEST__F_type_array__int8ss_delete_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_destroy_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_destroy_callback.c new file mode 100644 index 0000000..579c020 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_destroy_callback.c @@ -0,0 +1,57 @@ +#include "test-type_array.h" +#include "test-type_array-int8ss_destroy_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int8ss_destroy_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + int8_t data = 0; + int8_t data_array[] = { data }; + f_int8s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_int8s_t datas_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_adjust, true); + will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_int8ss_destroy_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_int8ss_destroy_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_int8ss_t datass = f_int8ss_t_initialize; + + { + f_status_t status = f_memory_array_adjust(length, sizeof(f_int8s_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_none); + + status = f_memory_array_adjust(1, sizeof(int8_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size); + assert_int_equal(status, F_none); + } + + { + const f_status_t status = f_int8ss_destroy_callback(0, length, (void *) datass.array); + + assert_int_equal(status, F_none); + assert_int_equal(datass.array[0].size, 0); + } + + free((void *) datass.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_destroy_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_destroy_callback.h new file mode 100644 index 0000000..e972830 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int8ss_destroy_callback +#define _TEST__F_type_array__int8ss_destroy_callback + +/** + * Test that the function fails. + * + * @see f_int8ss_destroy_callback() + */ +extern void test__f_type_array_int8ss_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_int8ss_destroy_callback() + */ +extern void test__f_type_array_int8ss_destroy_callback__works(void **state); + +#endif // _TEST__F_type_array__int8ss_destroy_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_delete_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_delete_callback.c deleted file mode 100644 index cf55a24..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_delete_callback.c +++ /dev/null @@ -1,45 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-number_unsigneds_delete_callback.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_number_unsigneds_delete_callback__fails(void **state) { - - f_number_unsigned_t data = f_number_unsigned_t_initialize; - f_number_unsigned_t data_array[] = { data }; - f_number_unsigneds_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_number_unsigneds_t datass_array[] = { datas }; - - { - will_return(__wrap_f_memory_array_resize, true); - will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); - - const f_status_t status = f_number_unsigneds_delete_callback(0, 1, (void *) datass_array); - - assert_int_equal(status, F_status_set_error(F_failure)); - } -} - -void test__f_type_array_number_unsigneds_delete_callback__works(void **state) { - - f_number_unsigned_t data = f_number_unsigned_t_initialize; - f_number_unsigned_t data_array[] = { data }; - f_number_unsigneds_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_number_unsigneds_t datass_array[] = { datas }; - const f_number_unsigned_t length = 1; - - { - will_return(__wrap_f_memory_array_resize, false); - will_return(__wrap_f_memory_array_resize, F_none); - - const f_status_t status = f_number_unsigneds_delete_callback(0, length, (void *) datass_array); - - assert_int_equal(status, F_none); - } -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_delete_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_delete_callback.h deleted file mode 100644 index 0e6c3b5..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_delete_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__number_unsigneds_delete_callback -#define _TEST__F_type_array__number_unsigneds_delete_callback - -/** - * Test that the function fails. - * - * @see f_number_unsigneds_delete_callback() - */ -extern void test__f_type_array_number_unsigneds_delete_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_number_unsigneds_delete_callback() - */ -extern void test__f_type_array_number_unsigneds_delete_callback__works(void **state); - -#endif // _TEST__F_type_array__number_unsigneds_delete_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_destroy_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_destroy_callback.c deleted file mode 100644 index ad54770..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_destroy_callback.c +++ /dev/null @@ -1,45 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-number_unsigneds_destroy_callback.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_number_unsigneds_destroy_callback__fails(void **state) { - - f_number_unsigned_t data = f_number_unsigned_t_initialize; - f_number_unsigned_t data_array[] = { data }; - f_number_unsigneds_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_number_unsigneds_t datass_array[] = { datas }; - - { - will_return(__wrap_f_memory_array_adjust, true); - will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); - - const f_status_t status = f_number_unsigneds_destroy_callback(0, 1, (void *) datass_array); - - assert_int_equal(status, F_status_set_error(F_failure)); - } -} - -void test__f_type_array_number_unsigneds_destroy_callback__works(void **state) { - - f_number_unsigned_t data = f_number_unsigned_t_initialize; - f_number_unsigned_t data_array[] = { data }; - f_number_unsigneds_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_number_unsigneds_t datass_array[] = { datas }; - const f_number_unsigned_t length = 1; - - { - will_return(__wrap_f_memory_array_adjust, false); - will_return(__wrap_f_memory_array_adjust, F_none); - - const f_status_t status = f_number_unsigneds_destroy_callback(0, length, (void *) datass_array); - - assert_int_equal(status, F_none); - } -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_destroy_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_destroy_callback.h deleted file mode 100644 index ae6810b..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_destroy_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__number_unsigneds_destroy_callback -#define _TEST__F_type_array__number_unsigneds_destroy_callback - -/** - * Test that the function fails. - * - * @see f_number_unsigneds_destroy_callback() - */ -extern void test__f_type_array_number_unsigneds_destroy_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_number_unsigneds_destroy_callback() - */ -extern void test__f_type_array_number_unsigneds_destroy_callback__works(void **state); - -#endif // _TEST__F_type_array__number_unsigneds_destroy_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_delete_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_delete_callback.c new file mode 100644 index 0000000..4fbc32d --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_delete_callback.c @@ -0,0 +1,57 @@ +#include "test-type_array.h" +#include "test-type_array-number_unsignedss_delete_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_number_unsignedss_delete_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_number_unsigned_t data = f_number_unsigned_t_initialize; + f_number_unsigned_t data_array[] = { data }; + f_number_unsigneds_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_number_unsigneds_t datas_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_resize, true); + will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_number_unsignedss_delete_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_number_unsignedss_delete_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_number_unsignedss_t datass = f_number_unsignedss_t_initialize; + + { + f_status_t status = f_memory_array_resize(length, sizeof(f_number_unsigneds_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_none); + + status = f_memory_array_resize(1, sizeof(f_number_unsigned_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size); + assert_int_equal(status, F_none); + } + + { + const f_status_t status = f_number_unsignedss_delete_callback(0, length, (void *) datass.array); + + assert_int_equal(status, F_none); + assert_int_equal(datass.array[0].size, 0); + } + + free((void *) datass.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_delete_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_delete_callback.h new file mode 100644 index 0000000..d5442c8 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__number_unsignedss_delete_callback +#define _TEST__F_type_array__number_unsignedss_delete_callback + +/** + * Test that the function fails. + * + * @see f_number_unsignedss_delete_callback() + */ +extern void test__f_type_array_number_unsignedss_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_number_unsignedss_delete_callback() + */ +extern void test__f_type_array_number_unsignedss_delete_callback__works(void **state); + +#endif // _TEST__F_type_array__number_unsignedss_delete_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_destroy_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_destroy_callback.c new file mode 100644 index 0000000..61a4ea4 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_destroy_callback.c @@ -0,0 +1,57 @@ +#include "test-type_array.h" +#include "test-type_array-number_unsignedss_destroy_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_number_unsignedss_destroy_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_number_unsigned_t data = f_number_unsigned_t_initialize; + f_number_unsigned_t data_array[] = { data }; + f_number_unsigneds_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_number_unsigneds_t datas_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_adjust, true); + will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_number_unsignedss_destroy_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_number_unsignedss_destroy_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_number_unsignedss_t datass = f_number_unsignedss_t_initialize; + + { + f_status_t status = f_memory_array_adjust(length, sizeof(f_number_unsigneds_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_none); + + status = f_memory_array_adjust(1, sizeof(f_number_unsigned_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size); + assert_int_equal(status, F_none); + } + + { + const f_status_t status = f_number_unsignedss_destroy_callback(0, length, (void *) datass.array); + + assert_int_equal(status, F_none); + assert_int_equal(datass.array[0].size, 0); + } + + free((void *) datass.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_destroy_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_destroy_callback.h new file mode 100644 index 0000000..d453af1 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__number_unsignedss_destroy_callback +#define _TEST__F_type_array__number_unsignedss_destroy_callback + +/** + * Test that the function fails. + * + * @see f_number_unsignedss_destroy_callback() + */ +extern void test__f_type_array_number_unsignedss_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_number_unsignedss_destroy_callback() + */ +extern void test__f_type_array_number_unsignedss_destroy_callback__works(void **state); + +#endif // _TEST__F_type_array__number_unsignedss_destroy_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-polls_delete_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-polls_delete_callback.c deleted file mode 100644 index ed6b410..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-polls_delete_callback.c +++ /dev/null @@ -1,45 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-polls_delete_callback.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_polls_delete_callback__fails(void **state) { - - f_poll_t data = f_poll_t_initialize; - f_poll_t data_array[] = { data }; - f_polls_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_polls_t datass_array[] = { datas }; - - { - will_return(__wrap_f_memory_array_resize, true); - will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); - - const f_status_t status = f_polls_delete_callback(0, 1, (void *) datass_array); - - assert_int_equal(status, F_status_set_error(F_failure)); - } -} - -void test__f_type_array_polls_delete_callback__works(void **state) { - - f_poll_t data = f_poll_t_initialize; - f_poll_t data_array[] = { data }; - f_polls_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_polls_t datass_array[] = { datas }; - const f_number_unsigned_t length = 1; - - { - will_return(__wrap_f_memory_array_resize, false); - will_return(__wrap_f_memory_array_resize, F_none); - - const f_status_t status = f_polls_delete_callback(0, length, (void *) datass_array); - - assert_int_equal(status, F_none); - } -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-polls_delete_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-polls_delete_callback.h deleted file mode 100644 index d6b9562..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-polls_delete_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__polls_delete_callback -#define _TEST__F_type_array__polls_delete_callback - -/** - * Test that the function fails. - * - * @see f_polls_delete_callback() - */ -extern void test__f_type_array_polls_delete_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_polls_delete_callback() - */ -extern void test__f_type_array_polls_delete_callback__works(void **state); - -#endif // _TEST__F_type_array__polls_delete_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-polls_destroy_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-polls_destroy_callback.c deleted file mode 100644 index 1241c67..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-polls_destroy_callback.c +++ /dev/null @@ -1,45 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-polls_destroy_callback.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_polls_destroy_callback__fails(void **state) { - - f_poll_t data = f_poll_t_initialize; - f_poll_t data_array[] = { data }; - f_polls_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_polls_t datass_array[] = { datas }; - - { - will_return(__wrap_f_memory_array_adjust, true); - will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); - - const f_status_t status = f_polls_destroy_callback(0, 1, (void *) datass_array); - - assert_int_equal(status, F_status_set_error(F_failure)); - } -} - -void test__f_type_array_polls_destroy_callback__works(void **state) { - - f_poll_t data = f_poll_t_initialize; - f_poll_t data_array[] = { data }; - f_polls_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_polls_t datass_array[] = { datas }; - const f_number_unsigned_t length = 1; - - { - will_return(__wrap_f_memory_array_adjust, false); - will_return(__wrap_f_memory_array_adjust, F_none); - - const f_status_t status = f_polls_destroy_callback(0, length, (void *) datass_array); - - assert_int_equal(status, F_none); - } -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-polls_destroy_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-polls_destroy_callback.h deleted file mode 100644 index 4a25b2f..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-polls_destroy_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__polls_destroy_callback -#define _TEST__F_type_array__polls_destroy_callback - -/** - * Test that the function fails. - * - * @see f_polls_destroy_callback() - */ -extern void test__f_type_array_polls_destroy_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_polls_destroy_callback() - */ -extern void test__f_type_array_polls_destroy_callback__works(void **state); - -#endif // _TEST__F_type_array__polls_destroy_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-pollss_delete_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-pollss_delete_callback.c new file mode 100644 index 0000000..ffa0b8c --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-pollss_delete_callback.c @@ -0,0 +1,57 @@ +#include "test-type_array.h" +#include "test-type_array-pollss_delete_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_pollss_delete_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_poll_t data = f_poll_t_initialize; + f_poll_t data_array[] = { data }; + f_polls_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_polls_t datas_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_resize, true); + will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_pollss_delete_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_pollss_delete_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_pollss_t datass = f_pollss_t_initialize; + + { + f_status_t status = f_memory_array_resize(length, sizeof(f_polls_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_none); + + status = f_memory_array_resize(1, sizeof(f_poll_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size); + assert_int_equal(status, F_none); + } + + { + const f_status_t status = f_pollss_delete_callback(0, length, (void *) datass.array); + + assert_int_equal(status, F_none); + assert_int_equal(datass.array[0].size, 0); + } + + free((void *) datass.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-pollss_delete_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-pollss_delete_callback.h new file mode 100644 index 0000000..d93c002 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-pollss_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__pollss_delete_callback +#define _TEST__F_type_array__pollss_delete_callback + +/** + * Test that the function fails. + * + * @see f_pollss_delete_callback() + */ +extern void test__f_type_array_pollss_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_pollss_delete_callback() + */ +extern void test__f_type_array_pollss_delete_callback__works(void **state); + +#endif // _TEST__F_type_array__pollss_delete_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-pollss_destroy_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-pollss_destroy_callback.c new file mode 100644 index 0000000..4302b51 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-pollss_destroy_callback.c @@ -0,0 +1,57 @@ +#include "test-type_array.h" +#include "test-type_array-pollss_destroy_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_pollss_destroy_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_poll_t data = f_poll_t_initialize; + f_poll_t data_array[] = { data }; + f_polls_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_polls_t datas_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_adjust, true); + will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_pollss_destroy_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_pollss_destroy_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_pollss_t datass = f_pollss_t_initialize; + + { + f_status_t status = f_memory_array_adjust(length, sizeof(f_polls_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_none); + + status = f_memory_array_adjust(1, sizeof(f_poll_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size); + assert_int_equal(status, F_none); + } + + { + const f_status_t status = f_pollss_destroy_callback(0, length, (void *) datass.array); + + assert_int_equal(status, F_none); + assert_int_equal(datass.array[0].size, 0); + } + + free((void *) datass.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-pollss_destroy_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-pollss_destroy_callback.h new file mode 100644 index 0000000..0806c60 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-pollss_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__pollss_destroy_callback +#define _TEST__F_type_array__pollss_destroy_callback + +/** + * Test that the function fails. + * + * @see f_pollss_destroy_callback() + */ +extern void test__f_type_array_pollss_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_pollss_destroy_callback() + */ +extern void test__f_type_array_pollss_destroy_callback__works(void **state); + +#endif // _TEST__F_type_array__pollss_destroy_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-states_delete_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-states_delete_callback.c deleted file mode 100644 index 9aa63db..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-states_delete_callback.c +++ /dev/null @@ -1,45 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-states_delete_callback.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_states_delete_callback__fails(void **state) { - - f_state_t data = f_state_t_initialize; - f_state_t data_array[] = { data }; - f_states_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_states_t datass_array[] = { datas }; - - { - will_return(__wrap_f_memory_array_resize, true); - will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); - - const f_status_t status = f_states_delete_callback(0, 1, (void *) datass_array); - - assert_int_equal(status, F_status_set_error(F_failure)); - } -} - -void test__f_type_array_states_delete_callback__works(void **state) { - - f_state_t data = f_state_t_initialize; - f_state_t data_array[] = { data }; - f_states_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_states_t datass_array[] = { datas }; - const f_number_unsigned_t length = 1; - - { - will_return(__wrap_f_memory_array_resize, false); - will_return(__wrap_f_memory_array_resize, F_none); - - const f_status_t status = f_states_delete_callback(0, length, (void *) datass_array); - - assert_int_equal(status, F_none); - } -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-states_delete_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-states_delete_callback.h deleted file mode 100644 index 24855a6..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-states_delete_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__states_delete_callback -#define _TEST__F_type_array__states_delete_callback - -/** - * Test that the function fails. - * - * @see f_states_delete_callback() - */ -extern void test__f_type_array_states_delete_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_states_delete_callback() - */ -extern void test__f_type_array_states_delete_callback__works(void **state); - -#endif // _TEST__F_type_array__states_delete_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-states_destroy_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-states_destroy_callback.c deleted file mode 100644 index ca8a1b7..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-states_destroy_callback.c +++ /dev/null @@ -1,45 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-states_destroy_callback.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_states_destroy_callback__fails(void **state) { - - f_state_t data = f_state_t_initialize; - f_state_t data_array[] = { data }; - f_states_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_states_t datass_array[] = { datas }; - - { - will_return(__wrap_f_memory_array_adjust, true); - will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); - - const f_status_t status = f_states_destroy_callback(0, 1, (void *) datass_array); - - assert_int_equal(status, F_status_set_error(F_failure)); - } -} - -void test__f_type_array_states_destroy_callback__works(void **state) { - - f_state_t data = f_state_t_initialize; - f_state_t data_array[] = { data }; - f_states_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_states_t datass_array[] = { datas }; - const f_number_unsigned_t length = 1; - - { - will_return(__wrap_f_memory_array_adjust, false); - will_return(__wrap_f_memory_array_adjust, F_none); - - const f_status_t status = f_states_destroy_callback(0, length, (void *) datass_array); - - assert_int_equal(status, F_none); - } -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-states_destroy_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-states_destroy_callback.h deleted file mode 100644 index 1533ebe..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-states_destroy_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__states_destroy_callback -#define _TEST__F_type_array__states_destroy_callback - -/** - * Test that the function fails. - * - * @see f_states_destroy_callback() - */ -extern void test__f_type_array_states_destroy_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_states_destroy_callback() - */ -extern void test__f_type_array_states_destroy_callback__works(void **state); - -#endif // _TEST__F_type_array__states_destroy_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statess_delete_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-statess_delete_callback.c new file mode 100644 index 0000000..353a46d --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statess_delete_callback.c @@ -0,0 +1,57 @@ +#include "test-type_array.h" +#include "test-type_array-statess_delete_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_statess_delete_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_state_t data = f_state_t_initialize; + f_state_t data_array[] = { data }; + f_states_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_states_t datas_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_resize, true); + will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_statess_delete_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_statess_delete_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_statess_t datass = f_statess_t_initialize; + + { + f_status_t status = f_memory_array_resize(length, sizeof(f_states_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_none); + + status = f_memory_array_resize(1, sizeof(f_state_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size); + assert_int_equal(status, F_none); + } + + { + const f_status_t status = f_statess_delete_callback(0, length, (void *) datass.array); + + assert_int_equal(status, F_none); + assert_int_equal(datass.array[0].size, 0); + } + + free((void *) datass.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statess_delete_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-statess_delete_callback.h new file mode 100644 index 0000000..f7dcc9e --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statess_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__statess_delete_callback +#define _TEST__F_type_array__statess_delete_callback + +/** + * Test that the function fails. + * + * @see f_statess_delete_callback() + */ +extern void test__f_type_array_statess_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_statess_delete_callback() + */ +extern void test__f_type_array_statess_delete_callback__works(void **state); + +#endif // _TEST__F_type_array__statess_delete_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statess_destroy_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-statess_destroy_callback.c new file mode 100644 index 0000000..a6bef3e --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statess_destroy_callback.c @@ -0,0 +1,57 @@ +#include "test-type_array.h" +#include "test-type_array-statess_destroy_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_statess_destroy_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_state_t data = f_state_t_initialize; + f_state_t data_array[] = { data }; + f_states_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_states_t datas_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_adjust, true); + will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_statess_destroy_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_statess_destroy_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_statess_t datass = f_statess_t_initialize; + + { + f_status_t status = f_memory_array_adjust(length, sizeof(f_states_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_none); + + status = f_memory_array_adjust(1, sizeof(f_state_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size); + assert_int_equal(status, F_none); + } + + { + const f_status_t status = f_statess_destroy_callback(0, length, (void *) datass.array); + + assert_int_equal(status, F_none); + assert_int_equal(datass.array[0].size, 0); + } + + free((void *) datass.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statess_destroy_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-statess_destroy_callback.h new file mode 100644 index 0000000..666444d --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statess_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__statess_destroy_callback +#define _TEST__F_type_array__statess_destroy_callback + +/** + * Test that the function fails. + * + * @see f_statess_destroy_callback() + */ +extern void test__f_type_array_statess_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_statess_destroy_callback() + */ +extern void test__f_type_array_statess_destroy_callback__works(void **state); + +#endif // _TEST__F_type_array__statess_destroy_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_delete_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_delete_callback.c deleted file mode 100644 index 6f943d0..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_delete_callback.c +++ /dev/null @@ -1,45 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-statuss_delete_callback.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_statuss_delete_callback__fails(void **state) { - - f_status_t data = f_status_t_initialize; - f_status_t data_array[] = { data }; - f_statuss_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_statuss_t datass_array[] = { datas }; - - { - will_return(__wrap_f_memory_array_resize, true); - will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); - - const f_status_t status = f_statuss_delete_callback(0, 1, (void *) datass_array); - - assert_int_equal(status, F_status_set_error(F_failure)); - } -} - -void test__f_type_array_statuss_delete_callback__works(void **state) { - - f_status_t data = f_status_t_initialize; - f_status_t data_array[] = { data }; - f_statuss_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_statuss_t datass_array[] = { datas }; - const f_number_unsigned_t length = 1; - - { - will_return(__wrap_f_memory_array_resize, false); - will_return(__wrap_f_memory_array_resize, F_none); - - const f_status_t status = f_statuss_delete_callback(0, length, (void *) datass_array); - - assert_int_equal(status, F_none); - } -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_delete_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_delete_callback.h deleted file mode 100644 index 4ba1f6e..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_delete_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__statuss_delete_callback -#define _TEST__F_type_array__statuss_delete_callback - -/** - * Test that the function fails. - * - * @see f_statuss_delete_callback() - */ -extern void test__f_type_array_statuss_delete_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_statuss_delete_callback() - */ -extern void test__f_type_array_statuss_delete_callback__works(void **state); - -#endif // _TEST__F_type_array__statuss_delete_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_destroy_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_destroy_callback.c deleted file mode 100644 index 5696778..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_destroy_callback.c +++ /dev/null @@ -1,45 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-statuss_destroy_callback.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_statuss_destroy_callback__fails(void **state) { - - f_status_t data = f_status_t_initialize; - f_status_t data_array[] = { data }; - f_statuss_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_statuss_t datass_array[] = { datas }; - - { - will_return(__wrap_f_memory_array_adjust, true); - will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); - - const f_status_t status = f_statuss_destroy_callback(0, 1, (void *) datass_array); - - assert_int_equal(status, F_status_set_error(F_failure)); - } -} - -void test__f_type_array_statuss_destroy_callback__works(void **state) { - - f_status_t data = f_status_t_initialize; - f_status_t data_array[] = { data }; - f_statuss_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_statuss_t datass_array[] = { datas }; - const f_number_unsigned_t length = 1; - - { - will_return(__wrap_f_memory_array_adjust, false); - will_return(__wrap_f_memory_array_adjust, F_none); - - const f_status_t status = f_statuss_destroy_callback(0, length, (void *) datass_array); - - assert_int_equal(status, F_none); - } -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_destroy_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_destroy_callback.h deleted file mode 100644 index 26cb0ac..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_destroy_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__statuss_destroy_callback -#define _TEST__F_type_array__statuss_destroy_callback - -/** - * Test that the function fails. - * - * @see f_statuss_destroy_callback() - */ -extern void test__f_type_array_statuss_destroy_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_statuss_destroy_callback() - */ -extern void test__f_type_array_statuss_destroy_callback__works(void **state); - -#endif // _TEST__F_type_array__statuss_destroy_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_delete_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-statusss_delete_callback.c new file mode 100644 index 0000000..e5cac87 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statusss_delete_callback.c @@ -0,0 +1,57 @@ +#include "test-type_array.h" +#include "test-type_array-statusss_delete_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_statusss_delete_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_status_t data = f_status_t_initialize; + f_status_t data_array[] = { data }; + f_statuss_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_statuss_t datas_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_resize, true); + will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_statusss_delete_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_statusss_delete_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_statusss_t datass = f_statusss_t_initialize; + + { + f_status_t status = f_memory_array_resize(length, sizeof(f_statuss_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_none); + + status = f_memory_array_resize(1, sizeof(f_status_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size); + assert_int_equal(status, F_none); + } + + { + const f_status_t status = f_statusss_delete_callback(0, length, (void *) datass.array); + + assert_int_equal(status, F_none); + assert_int_equal(datass.array[0].size, 0); + } + + free((void *) datass.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_delete_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-statusss_delete_callback.h new file mode 100644 index 0000000..c08180e --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statusss_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__statusss_delete_callback +#define _TEST__F_type_array__statusss_delete_callback + +/** + * Test that the function fails. + * + * @see f_statusss_delete_callback() + */ +extern void test__f_type_array_statusss_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_statusss_delete_callback() + */ +extern void test__f_type_array_statusss_delete_callback__works(void **state); + +#endif // _TEST__F_type_array__statusss_delete_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_destroy_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-statusss_destroy_callback.c new file mode 100644 index 0000000..883c43a --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statusss_destroy_callback.c @@ -0,0 +1,57 @@ +#include "test-type_array.h" +#include "test-type_array-statusss_destroy_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_statusss_destroy_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_status_t data = f_status_t_initialize; + f_status_t data_array[] = { data }; + f_statuss_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_statuss_t datas_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_adjust, true); + will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_statusss_destroy_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_statusss_destroy_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_statusss_t datass = f_statusss_t_initialize; + + { + f_status_t status = f_memory_array_adjust(length, sizeof(f_statuss_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_none); + + status = f_memory_array_adjust(1, sizeof(f_status_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size); + assert_int_equal(status, F_none); + } + + { + const f_status_t status = f_statusss_destroy_callback(0, length, (void *) datass.array); + + assert_int_equal(status, F_none); + assert_int_equal(datass.array[0].size, 0); + } + + free((void *) datass.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_destroy_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-statusss_destroy_callback.h new file mode 100644 index 0000000..e99640a --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statusss_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__statusss_destroy_callback +#define _TEST__F_type_array__statusss_destroy_callback + +/** + * Test that the function fails. + * + * @see f_statusss_destroy_callback() + */ +extern void test__f_type_array_statusss_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_statusss_destroy_callback() + */ +extern void test__f_type_array_statusss_destroy_callback__works(void **state); + +#endif // _TEST__F_type_array__statusss_destroy_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_delete_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_delete_callback.c deleted file mode 100644 index 233f3e5..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_delete_callback.c +++ /dev/null @@ -1,45 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint128s_delete_callback.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint128s_delete_callback__fails(void **state) { - - f_uint128_t data = 0; - f_uint128_t data_array[] = { data }; - f_uint128s_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_uint128s_t datass_array[] = { datas }; - - { - will_return(__wrap_f_memory_array_resize, true); - will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); - - const f_status_t status = f_uint128s_delete_callback(0, 1, (void *) datass_array); - - assert_int_equal(status, F_status_set_error(F_failure)); - } -} - -void test__f_type_array_uint128s_delete_callback__works(void **state) { - - f_uint128_t data = 0; - f_uint128_t data_array[] = { data }; - f_uint128s_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_uint128s_t datass_array[] = { datas }; - const f_number_unsigned_t length = 1; - - { - will_return(__wrap_f_memory_array_resize, false); - will_return(__wrap_f_memory_array_resize, F_none); - - const f_status_t status = f_uint128s_delete_callback(0, length, (void *) datass_array); - - assert_int_equal(status, F_none); - } -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_delete_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_delete_callback.h deleted file mode 100644 index ae8a66d..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_delete_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint128s_delete_callback -#define _TEST__F_type_array__uint128s_delete_callback - -/** - * Test that the function fails. - * - * @see f_uint128s_delete_callback() - */ -extern void test__f_type_array_uint128s_delete_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_uint128s_delete_callback() - */ -extern void test__f_type_array_uint128s_delete_callback__works(void **state); - -#endif // _TEST__F_type_array__uint128s_delete_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_destroy_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_destroy_callback.c deleted file mode 100644 index e88b599..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_destroy_callback.c +++ /dev/null @@ -1,45 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint128s_destroy_callback.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint128s_destroy_callback__fails(void **state) { - - f_uint128_t data = 0; - f_uint128_t data_array[] = { data }; - f_uint128s_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_uint128s_t datass_array[] = { datas }; - - { - will_return(__wrap_f_memory_array_adjust, true); - will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); - - const f_status_t status = f_uint128s_destroy_callback(0, 1, (void *) datass_array); - - assert_int_equal(status, F_status_set_error(F_failure)); - } -} - -void test__f_type_array_uint128s_destroy_callback__works(void **state) { - - f_uint128_t data = 0; - f_uint128_t data_array[] = { data }; - f_uint128s_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_uint128s_t datass_array[] = { datas }; - const f_number_unsigned_t length = 1; - - { - will_return(__wrap_f_memory_array_adjust, false); - will_return(__wrap_f_memory_array_adjust, F_none); - - const f_status_t status = f_uint128s_destroy_callback(0, length, (void *) datass_array); - - assert_int_equal(status, F_none); - } -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_destroy_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_destroy_callback.h deleted file mode 100644 index 6176824..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_destroy_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint128s_destroy_callback -#define _TEST__F_type_array__uint128s_destroy_callback - -/** - * Test that the function fails. - * - * @see f_uint128s_destroy_callback() - */ -extern void test__f_type_array_uint128s_destroy_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_uint128s_destroy_callback() - */ -extern void test__f_type_array_uint128s_destroy_callback__works(void **state); - -#endif // _TEST__F_type_array__uint128s_destroy_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_delete_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_delete_callback.c new file mode 100644 index 0000000..c275081 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_delete_callback.c @@ -0,0 +1,57 @@ +#include "test-type_array.h" +#include "test-type_array-uint128ss_delete_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint128ss_delete_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_uint128_t data = 0; + f_uint128_t data_array[] = { data }; + f_uint128s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_uint128s_t datas_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_resize, true); + will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_uint128ss_delete_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_uint128ss_delete_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_uint128ss_t datass = f_uint128ss_t_initialize; + + { + f_status_t status = f_memory_array_resize(length, sizeof(f_uint128s_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_none); + + status = f_memory_array_resize(1, sizeof(f_uint128_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size); + assert_int_equal(status, F_none); + } + + { + const f_status_t status = f_uint128ss_delete_callback(0, length, (void *) datass.array); + + assert_int_equal(status, F_none); + assert_int_equal(datass.array[0].size, 0); + } + + free((void *) datass.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_delete_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_delete_callback.h new file mode 100644 index 0000000..8251c6e --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint128ss_delete_callback +#define _TEST__F_type_array__uint128ss_delete_callback + +/** + * Test that the function fails. + * + * @see f_uint128ss_delete_callback() + */ +extern void test__f_type_array_uint128ss_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_uint128ss_delete_callback() + */ +extern void test__f_type_array_uint128ss_delete_callback__works(void **state); + +#endif // _TEST__F_type_array__uint128ss_delete_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_destroy_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_destroy_callback.c new file mode 100644 index 0000000..abd3623 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_destroy_callback.c @@ -0,0 +1,57 @@ +#include "test-type_array.h" +#include "test-type_array-uint128ss_destroy_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint128ss_destroy_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_uint128_t data = 0; + f_uint128_t data_array[] = { data }; + f_uint128s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_uint128s_t datas_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_adjust, true); + will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_uint128ss_destroy_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_uint128ss_destroy_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_uint128ss_t datass = f_uint128ss_t_initialize; + + { + f_status_t status = f_memory_array_adjust(length, sizeof(f_uint128s_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_none); + + status = f_memory_array_adjust(1, sizeof(f_uint128_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size); + assert_int_equal(status, F_none); + } + + { + const f_status_t status = f_uint128ss_destroy_callback(0, length, (void *) datass.array); + + assert_int_equal(status, F_none); + assert_int_equal(datass.array[0].size, 0); + } + + free((void *) datass.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_destroy_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_destroy_callback.h new file mode 100644 index 0000000..a3eac6c --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint128ss_destroy_callback +#define _TEST__F_type_array__uint128ss_destroy_callback + +/** + * Test that the function fails. + * + * @see f_uint128ss_destroy_callback() + */ +extern void test__f_type_array_uint128ss_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_uint128ss_destroy_callback() + */ +extern void test__f_type_array_uint128ss_destroy_callback__works(void **state); + +#endif // _TEST__F_type_array__uint128ss_destroy_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_delete_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_delete_callback.c deleted file mode 100644 index 89d2db5..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_delete_callback.c +++ /dev/null @@ -1,45 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint16s_delete_callback.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint16s_delete_callback__fails(void **state) { - - uint16_t data = 0; - uint16_t data_array[] = { data }; - f_uint16s_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_uint16s_t datass_array[] = { datas }; - - { - will_return(__wrap_f_memory_array_resize, true); - will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); - - const f_status_t status = f_uint16s_delete_callback(0, 1, (void *) datass_array); - - assert_int_equal(status, F_status_set_error(F_failure)); - } -} - -void test__f_type_array_uint16s_delete_callback__works(void **state) { - - uint16_t data = 0; - uint16_t data_array[] = { data }; - f_uint16s_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_uint16s_t datass_array[] = { datas }; - const f_number_unsigned_t length = 1; - - { - will_return(__wrap_f_memory_array_resize, false); - will_return(__wrap_f_memory_array_resize, F_none); - - const f_status_t status = f_uint16s_delete_callback(0, length, (void *) datass_array); - - assert_int_equal(status, F_none); - } -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_delete_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_delete_callback.h deleted file mode 100644 index 48bc3f6..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_delete_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint16s_delete_callback -#define _TEST__F_type_array__uint16s_delete_callback - -/** - * Test that the function fails. - * - * @see f_uint16s_delete_callback() - */ -extern void test__f_type_array_uint16s_delete_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_uint16s_delete_callback() - */ -extern void test__f_type_array_uint16s_delete_callback__works(void **state); - -#endif // _TEST__F_type_array__uint16s_delete_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_destroy_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_destroy_callback.c deleted file mode 100644 index 34853f7..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_destroy_callback.c +++ /dev/null @@ -1,45 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint16s_destroy_callback.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint16s_destroy_callback__fails(void **state) { - - uint16_t data = 0; - uint16_t data_array[] = { data }; - f_uint16s_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_uint16s_t datass_array[] = { datas }; - - { - will_return(__wrap_f_memory_array_adjust, true); - will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); - - const f_status_t status = f_uint16s_destroy_callback(0, 1, (void *) datass_array); - - assert_int_equal(status, F_status_set_error(F_failure)); - } -} - -void test__f_type_array_uint16s_destroy_callback__works(void **state) { - - uint16_t data = 0; - uint16_t data_array[] = { data }; - f_uint16s_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_uint16s_t datass_array[] = { datas }; - const f_number_unsigned_t length = 1; - - { - will_return(__wrap_f_memory_array_adjust, false); - will_return(__wrap_f_memory_array_adjust, F_none); - - const f_status_t status = f_uint16s_destroy_callback(0, length, (void *) datass_array); - - assert_int_equal(status, F_none); - } -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_destroy_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_destroy_callback.h deleted file mode 100644 index bfac51f..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_destroy_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint16s_destroy_callback -#define _TEST__F_type_array__uint16s_destroy_callback - -/** - * Test that the function fails. - * - * @see f_uint16s_destroy_callback() - */ -extern void test__f_type_array_uint16s_destroy_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_uint16s_destroy_callback() - */ -extern void test__f_type_array_uint16s_destroy_callback__works(void **state); - -#endif // _TEST__F_type_array__uint16s_destroy_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_delete_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_delete_callback.c new file mode 100644 index 0000000..12b25f2 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_delete_callback.c @@ -0,0 +1,57 @@ +#include "test-type_array.h" +#include "test-type_array-uint16ss_delete_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint16ss_delete_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + uint16_t data = 0; + uint16_t data_array[] = { data }; + f_uint16s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_uint16s_t datas_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_resize, true); + will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_uint16ss_delete_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_uint16ss_delete_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_uint16ss_t datass = f_uint16ss_t_initialize; + + { + f_status_t status = f_memory_array_resize(length, sizeof(f_uint16s_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_none); + + status = f_memory_array_resize(1, sizeof(uint16_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size); + assert_int_equal(status, F_none); + } + + { + const f_status_t status = f_uint16ss_delete_callback(0, length, (void *) datass.array); + + assert_int_equal(status, F_none); + assert_int_equal(datass.array[0].size, 0); + } + + free((void *) datass.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_delete_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_delete_callback.h new file mode 100644 index 0000000..e83565b --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint16ss_delete_callback +#define _TEST__F_type_array__uint16ss_delete_callback + +/** + * Test that the function fails. + * + * @see f_uint16ss_delete_callback() + */ +extern void test__f_type_array_uint16ss_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_uint16ss_delete_callback() + */ +extern void test__f_type_array_uint16ss_delete_callback__works(void **state); + +#endif // _TEST__F_type_array__uint16ss_delete_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_destroy_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_destroy_callback.c new file mode 100644 index 0000000..3d9d094 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_destroy_callback.c @@ -0,0 +1,57 @@ +#include "test-type_array.h" +#include "test-type_array-uint16ss_destroy_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint16ss_destroy_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + uint16_t data = 0; + uint16_t data_array[] = { data }; + f_uint16s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_uint16s_t datas_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_adjust, true); + will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_uint16ss_destroy_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_uint16ss_destroy_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_uint16ss_t datass = f_uint16ss_t_initialize; + + { + f_status_t status = f_memory_array_adjust(length, sizeof(f_uint16s_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_none); + + status = f_memory_array_adjust(1, sizeof(uint16_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size); + assert_int_equal(status, F_none); + } + + { + const f_status_t status = f_uint16ss_destroy_callback(0, length, (void *) datass.array); + + assert_int_equal(status, F_none); + assert_int_equal(datass.array[0].size, 0); + } + + free((void *) datass.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_destroy_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_destroy_callback.h new file mode 100644 index 0000000..c9f0340 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint16ss_destroy_callback +#define _TEST__F_type_array__uint16ss_destroy_callback + +/** + * Test that the function fails. + * + * @see f_uint16ss_destroy_callback() + */ +extern void test__f_type_array_uint16ss_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_uint16ss_destroy_callback() + */ +extern void test__f_type_array_uint16ss_destroy_callback__works(void **state); + +#endif // _TEST__F_type_array__uint16ss_destroy_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_delete_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_delete_callback.c deleted file mode 100644 index 034f1eb..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_delete_callback.c +++ /dev/null @@ -1,45 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint32s_delete_callback.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint32s_delete_callback__fails(void **state) { - - uint32_t data = 0; - uint32_t data_array[] = { data }; - f_uint32s_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_uint32s_t datass_array[] = { datas }; - - { - will_return(__wrap_f_memory_array_resize, true); - will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); - - const f_status_t status = f_uint32s_delete_callback(0, 1, (void *) datass_array); - - assert_int_equal(status, F_status_set_error(F_failure)); - } -} - -void test__f_type_array_uint32s_delete_callback__works(void **state) { - - uint32_t data = 0; - uint32_t data_array[] = { data }; - f_uint32s_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_uint32s_t datass_array[] = { datas }; - const f_number_unsigned_t length = 1; - - { - will_return(__wrap_f_memory_array_resize, false); - will_return(__wrap_f_memory_array_resize, F_none); - - const f_status_t status = f_uint32s_delete_callback(0, length, (void *) datass_array); - - assert_int_equal(status, F_none); - } -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_delete_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_delete_callback.h deleted file mode 100644 index 045dd27..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_delete_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint32s_delete_callback -#define _TEST__F_type_array__uint32s_delete_callback - -/** - * Test that the function fails. - * - * @see f_uint32s_delete_callback() - */ -extern void test__f_type_array_uint32s_delete_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_uint32s_delete_callback() - */ -extern void test__f_type_array_uint32s_delete_callback__works(void **state); - -#endif // _TEST__F_type_array__uint32s_delete_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_destroy_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_destroy_callback.c deleted file mode 100644 index d11bd91..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_destroy_callback.c +++ /dev/null @@ -1,45 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint32s_destroy_callback.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint32s_destroy_callback__fails(void **state) { - - uint32_t data = 0; - uint32_t data_array[] = { data }; - f_uint32s_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_uint32s_t datass_array[] = { datas }; - - { - will_return(__wrap_f_memory_array_adjust, true); - will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); - - const f_status_t status = f_uint32s_destroy_callback(0, 1, (void *) datass_array); - - assert_int_equal(status, F_status_set_error(F_failure)); - } -} - -void test__f_type_array_uint32s_destroy_callback__works(void **state) { - - uint32_t data = 0; - uint32_t data_array[] = { data }; - f_uint32s_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_uint32s_t datass_array[] = { datas }; - const f_number_unsigned_t length = 1; - - { - will_return(__wrap_f_memory_array_adjust, false); - will_return(__wrap_f_memory_array_adjust, F_none); - - const f_status_t status = f_uint32s_destroy_callback(0, length, (void *) datass_array); - - assert_int_equal(status, F_none); - } -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_destroy_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_destroy_callback.h deleted file mode 100644 index 764f231..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_destroy_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint32s_destroy_callback -#define _TEST__F_type_array__uint32s_destroy_callback - -/** - * Test that the function fails. - * - * @see f_uint32s_destroy_callback() - */ -extern void test__f_type_array_uint32s_destroy_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_uint32s_destroy_callback() - */ -extern void test__f_type_array_uint32s_destroy_callback__works(void **state); - -#endif // _TEST__F_type_array__uint32s_destroy_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_delete_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_delete_callback.c new file mode 100644 index 0000000..4f57ff3 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_delete_callback.c @@ -0,0 +1,57 @@ +#include "test-type_array.h" +#include "test-type_array-uint32ss_delete_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint32ss_delete_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + uint32_t data = 0; + uint32_t data_array[] = { data }; + f_uint32s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_uint32s_t datas_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_resize, true); + will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_uint32ss_delete_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_uint32ss_delete_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_uint32ss_t datass = f_uint32ss_t_initialize; + + { + f_status_t status = f_memory_array_resize(length, sizeof(f_uint32s_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_none); + + status = f_memory_array_resize(1, sizeof(uint32_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size); + assert_int_equal(status, F_none); + } + + { + const f_status_t status = f_uint32ss_delete_callback(0, length, (void *) datass.array); + + assert_int_equal(status, F_none); + assert_int_equal(datass.array[0].size, 0); + } + + free((void *) datass.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_delete_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_delete_callback.h new file mode 100644 index 0000000..6b96f29 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint32ss_delete_callback +#define _TEST__F_type_array__uint32ss_delete_callback + +/** + * Test that the function fails. + * + * @see f_uint32ss_delete_callback() + */ +extern void test__f_type_array_uint32ss_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_uint32ss_delete_callback() + */ +extern void test__f_type_array_uint32ss_delete_callback__works(void **state); + +#endif // _TEST__F_type_array__uint32ss_delete_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_destroy_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_destroy_callback.c new file mode 100644 index 0000000..d54d281 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_destroy_callback.c @@ -0,0 +1,57 @@ +#include "test-type_array.h" +#include "test-type_array-uint32ss_destroy_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint32ss_destroy_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + uint32_t data = 0; + uint32_t data_array[] = { data }; + f_uint32s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_uint32s_t datas_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_adjust, true); + will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_uint32ss_destroy_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_uint32ss_destroy_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_uint32ss_t datass = f_uint32ss_t_initialize; + + { + f_status_t status = f_memory_array_adjust(length, sizeof(f_uint32s_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_none); + + status = f_memory_array_adjust(1, sizeof(uint32_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size); + assert_int_equal(status, F_none); + } + + { + const f_status_t status = f_uint32ss_destroy_callback(0, length, (void *) datass.array); + + assert_int_equal(status, F_none); + assert_int_equal(datass.array[0].size, 0); + } + + free((void *) datass.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_destroy_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_destroy_callback.h new file mode 100644 index 0000000..3ce3521 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint32ss_destroy_callback +#define _TEST__F_type_array__uint32ss_destroy_callback + +/** + * Test that the function fails. + * + * @see f_uint32ss_destroy_callback() + */ +extern void test__f_type_array_uint32ss_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_uint32ss_destroy_callback() + */ +extern void test__f_type_array_uint32ss_destroy_callback__works(void **state); + +#endif // _TEST__F_type_array__uint32ss_destroy_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_delete_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_delete_callback.c deleted file mode 100644 index ee0f5eb..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_delete_callback.c +++ /dev/null @@ -1,45 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint64s_delete_callback.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint64s_delete_callback__fails(void **state) { - - uint64_t data = 0; - uint64_t data_array[] = { data }; - f_uint64s_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_uint64s_t datass_array[] = { datas }; - - { - will_return(__wrap_f_memory_array_resize, true); - will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); - - const f_status_t status = f_uint64s_delete_callback(0, 1, (void *) datass_array); - - assert_int_equal(status, F_status_set_error(F_failure)); - } -} - -void test__f_type_array_uint64s_delete_callback__works(void **state) { - - uint64_t data = 0; - uint64_t data_array[] = { data }; - f_uint64s_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_uint64s_t datass_array[] = { datas }; - const f_number_unsigned_t length = 1; - - { - will_return(__wrap_f_memory_array_resize, false); - will_return(__wrap_f_memory_array_resize, F_none); - - const f_status_t status = f_uint64s_delete_callback(0, length, (void *) datass_array); - - assert_int_equal(status, F_none); - } -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_delete_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_delete_callback.h deleted file mode 100644 index d5570bb..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_delete_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint64s_delete_callback -#define _TEST__F_type_array__uint64s_delete_callback - -/** - * Test that the function fails. - * - * @see f_uint64s_delete_callback() - */ -extern void test__f_type_array_uint64s_delete_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_uint64s_delete_callback() - */ -extern void test__f_type_array_uint64s_delete_callback__works(void **state); - -#endif // _TEST__F_type_array__uint64s_delete_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_destroy_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_destroy_callback.c deleted file mode 100644 index 9f80d3f..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_destroy_callback.c +++ /dev/null @@ -1,45 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint64s_destroy_callback.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint64s_destroy_callback__fails(void **state) { - - uint64_t data = 0; - uint64_t data_array[] = { data }; - f_uint64s_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_uint64s_t datass_array[] = { datas }; - - { - will_return(__wrap_f_memory_array_adjust, true); - will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); - - const f_status_t status = f_uint64s_destroy_callback(0, 1, (void *) datass_array); - - assert_int_equal(status, F_status_set_error(F_failure)); - } -} - -void test__f_type_array_uint64s_destroy_callback__works(void **state) { - - uint64_t data = 0; - uint64_t data_array[] = { data }; - f_uint64s_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_uint64s_t datass_array[] = { datas }; - const f_number_unsigned_t length = 1; - - { - will_return(__wrap_f_memory_array_adjust, false); - will_return(__wrap_f_memory_array_adjust, F_none); - - const f_status_t status = f_uint64s_destroy_callback(0, length, (void *) datass_array); - - assert_int_equal(status, F_none); - } -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_destroy_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_destroy_callback.h deleted file mode 100644 index 856868a..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_destroy_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint64s_destroy_callback -#define _TEST__F_type_array__uint64s_destroy_callback - -/** - * Test that the function fails. - * - * @see f_uint64s_destroy_callback() - */ -extern void test__f_type_array_uint64s_destroy_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_uint64s_destroy_callback() - */ -extern void test__f_type_array_uint64s_destroy_callback__works(void **state); - -#endif // _TEST__F_type_array__uint64s_destroy_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_delete_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_delete_callback.c new file mode 100644 index 0000000..8de79e4 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_delete_callback.c @@ -0,0 +1,57 @@ +#include "test-type_array.h" +#include "test-type_array-uint64ss_delete_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint64ss_delete_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + uint64_t data = 0; + uint64_t data_array[] = { data }; + f_uint64s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_uint64s_t datas_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_resize, true); + will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_uint64ss_delete_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_uint64ss_delete_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_uint64ss_t datass = f_uint64ss_t_initialize; + + { + f_status_t status = f_memory_array_resize(length, sizeof(f_uint64s_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_none); + + status = f_memory_array_resize(1, sizeof(uint64_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size); + assert_int_equal(status, F_none); + } + + { + const f_status_t status = f_uint64ss_delete_callback(0, length, (void *) datass.array); + + assert_int_equal(status, F_none); + assert_int_equal(datass.array[0].size, 0); + } + + free((void *) datass.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_delete_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_delete_callback.h new file mode 100644 index 0000000..adc2913 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint64ss_delete_callback +#define _TEST__F_type_array__uint64ss_delete_callback + +/** + * Test that the function fails. + * + * @see f_uint64ss_delete_callback() + */ +extern void test__f_type_array_uint64ss_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_uint64ss_delete_callback() + */ +extern void test__f_type_array_uint64ss_delete_callback__works(void **state); + +#endif // _TEST__F_type_array__uint64ss_delete_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_destroy_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_destroy_callback.c new file mode 100644 index 0000000..68f6e8b --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_destroy_callback.c @@ -0,0 +1,57 @@ +#include "test-type_array.h" +#include "test-type_array-uint64ss_destroy_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint64ss_destroy_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + uint64_t data = 0; + uint64_t data_array[] = { data }; + f_uint64s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_uint64s_t datas_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_adjust, true); + will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_uint64ss_destroy_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_uint64ss_destroy_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_uint64ss_t datass = f_uint64ss_t_initialize; + + { + f_status_t status = f_memory_array_adjust(length, sizeof(f_uint64s_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_none); + + status = f_memory_array_adjust(1, sizeof(uint64_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size); + assert_int_equal(status, F_none); + } + + { + const f_status_t status = f_uint64ss_destroy_callback(0, length, (void *) datass.array); + + assert_int_equal(status, F_none); + assert_int_equal(datass.array[0].size, 0); + } + + free((void *) datass.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_destroy_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_destroy_callback.h new file mode 100644 index 0000000..b422b95 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint64ss_destroy_callback +#define _TEST__F_type_array__uint64ss_destroy_callback + +/** + * Test that the function fails. + * + * @see f_uint64ss_destroy_callback() + */ +extern void test__f_type_array_uint64ss_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_uint64ss_destroy_callback() + */ +extern void test__f_type_array_uint64ss_destroy_callback__works(void **state); + +#endif // _TEST__F_type_array__uint64ss_destroy_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_delete_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_delete_callback.c deleted file mode 100644 index 597ee24..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_delete_callback.c +++ /dev/null @@ -1,45 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint8s_delete_callback.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint8s_delete_callback__fails(void **state) { - - uint8_t data = 0; - uint8_t data_array[] = { data }; - f_uint8s_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_uint8s_t datass_array[] = { datas }; - - { - will_return(__wrap_f_memory_array_resize, true); - will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); - - const f_status_t status = f_uint8s_delete_callback(0, 1, (void *) datass_array); - - assert_int_equal(status, F_status_set_error(F_failure)); - } -} - -void test__f_type_array_uint8s_delete_callback__works(void **state) { - - uint8_t data = 0; - uint8_t data_array[] = { data }; - f_uint8s_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_uint8s_t datass_array[] = { datas }; - const f_number_unsigned_t length = 1; - - { - will_return(__wrap_f_memory_array_resize, false); - will_return(__wrap_f_memory_array_resize, F_none); - - const f_status_t status = f_uint8s_delete_callback(0, length, (void *) datass_array); - - assert_int_equal(status, F_none); - } -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_delete_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_delete_callback.h deleted file mode 100644 index 8105795..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_delete_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint8s_delete_callback -#define _TEST__F_type_array__uint8s_delete_callback - -/** - * Test that the function fails. - * - * @see f_uint8s_delete_callback() - */ -extern void test__f_type_array_uint8s_delete_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_uint8s_delete_callback() - */ -extern void test__f_type_array_uint8s_delete_callback__works(void **state); - -#endif // _TEST__F_type_array__uint8s_delete_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_destroy_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_destroy_callback.c deleted file mode 100644 index 49b4cf7..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_destroy_callback.c +++ /dev/null @@ -1,45 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint8s_destroy_callback.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint8s_destroy_callback__fails(void **state) { - - uint8_t data = 0; - uint8_t data_array[] = { data }; - f_uint8s_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_uint8s_t datass_array[] = { datas }; - - { - will_return(__wrap_f_memory_array_adjust, true); - will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); - - const f_status_t status = f_uint8s_destroy_callback(0, 1, (void *) datass_array); - - assert_int_equal(status, F_status_set_error(F_failure)); - } -} - -void test__f_type_array_uint8s_destroy_callback__works(void **state) { - - uint8_t data = 0; - uint8_t data_array[] = { data }; - f_uint8s_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_uint8s_t datass_array[] = { datas }; - const f_number_unsigned_t length = 1; - - { - will_return(__wrap_f_memory_array_adjust, false); - will_return(__wrap_f_memory_array_adjust, F_none); - - const f_status_t status = f_uint8s_destroy_callback(0, length, (void *) datass_array); - - assert_int_equal(status, F_none); - } -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_destroy_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_destroy_callback.h deleted file mode 100644 index 5478875..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_destroy_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint8s_destroy_callback -#define _TEST__F_type_array__uint8s_destroy_callback - -/** - * Test that the function fails. - * - * @see f_uint8s_destroy_callback() - */ -extern void test__f_type_array_uint8s_destroy_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_uint8s_destroy_callback() - */ -extern void test__f_type_array_uint8s_destroy_callback__works(void **state); - -#endif // _TEST__F_type_array__uint8s_destroy_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_delete_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_delete_callback.c new file mode 100644 index 0000000..672be3a --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_delete_callback.c @@ -0,0 +1,57 @@ +#include "test-type_array.h" +#include "test-type_array-uint8ss_delete_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint8ss_delete_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + uint8_t data = 0; + uint8_t data_array[] = { data }; + f_uint8s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_uint8s_t datas_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_resize, true); + will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_uint8ss_delete_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_uint8ss_delete_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_uint8ss_t datass = f_uint8ss_t_initialize; + + { + f_status_t status = f_memory_array_resize(length, sizeof(f_uint8s_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_none); + + status = f_memory_array_resize(1, sizeof(uint8_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size); + assert_int_equal(status, F_none); + } + + { + const f_status_t status = f_uint8ss_delete_callback(0, length, (void *) datass.array); + + assert_int_equal(status, F_none); + assert_int_equal(datass.array[0].size, 0); + } + + free((void *) datass.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_delete_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_delete_callback.h new file mode 100644 index 0000000..1dbfbad --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint8ss_delete_callback +#define _TEST__F_type_array__uint8ss_delete_callback + +/** + * Test that the function fails. + * + * @see f_uint8ss_delete_callback() + */ +extern void test__f_type_array_uint8ss_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_uint8ss_delete_callback() + */ +extern void test__f_type_array_uint8ss_delete_callback__works(void **state); + +#endif // _TEST__F_type_array__uint8ss_delete_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_destroy_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_destroy_callback.c new file mode 100644 index 0000000..a09ef6d --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_destroy_callback.c @@ -0,0 +1,57 @@ +#include "test-type_array.h" +#include "test-type_array-uint8ss_destroy_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint8ss_destroy_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + uint8_t data = 0; + uint8_t data_array[] = { data }; + f_uint8s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_uint8s_t datas_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_adjust, true); + will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_uint8ss_destroy_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_uint8ss_destroy_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_uint8ss_t datass = f_uint8ss_t_initialize; + + { + f_status_t status = f_memory_array_adjust(length, sizeof(f_uint8s_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_none); + + status = f_memory_array_adjust(1, sizeof(uint8_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size); + assert_int_equal(status, F_none); + } + + { + const f_status_t status = f_uint8ss_destroy_callback(0, length, (void *) datass.array); + + assert_int_equal(status, F_none); + assert_int_equal(datass.array[0].size, 0); + } + + free((void *) datass.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_destroy_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_destroy_callback.h new file mode 100644 index 0000000..eb174fd --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint8ss_destroy_callback +#define _TEST__F_type_array__uint8ss_destroy_callback + +/** + * Test that the function fails. + * + * @see f_uint8ss_destroy_callback() + */ +extern void test__f_type_array_uint8ss_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_uint8ss_destroy_callback() + */ +extern void test__f_type_array_uint8ss_destroy_callback__works(void **state); + +#endif // _TEST__F_type_array__uint8ss_destroy_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array.c b/level_0/f_type_array/tests/unit/c/test-type_array.c index 7d973c9..4c01325 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array.c @@ -17,159 +17,159 @@ int setdown(void **state) { int main(void) { const struct CMUnitTest tests[] = { - cmocka_unit_test(test__f_type_array_cells_destroy_callback__fails), - cmocka_unit_test(test__f_type_array_cells_delete_callback__fails), + cmocka_unit_test(test__f_type_array_cellss_delete_callback__fails), + cmocka_unit_test(test__f_type_array_cellss_delete_callback__works), - cmocka_unit_test(test__f_type_array_files_destroy_callback__fails), - cmocka_unit_test(test__f_type_array_files_delete_callback__fails), + cmocka_unit_test(test__f_type_array_cellss_destroy_callback__fails), + cmocka_unit_test(test__f_type_array_cellss_destroy_callback__works), - cmocka_unit_test(test__f_type_array_fll_ids_destroy_callback__fails), - cmocka_unit_test(test__f_type_array_fll_ids_delete_callback__fails), + cmocka_unit_test(test__f_type_array_filess_delete_callback__fails), + cmocka_unit_test(test__f_type_array_filess_delete_callback__works), - cmocka_unit_test(test__f_type_array_int8s_destroy_callback__fails), - cmocka_unit_test(test__f_type_array_int8s_delete_callback__fails), + cmocka_unit_test(test__f_type_array_filess_destroy_callback__fails), + cmocka_unit_test(test__f_type_array_filess_destroy_callback__works), - cmocka_unit_test(test__f_type_array_int16s_destroy_callback__fails), - cmocka_unit_test(test__f_type_array_int16s_delete_callback__fails), + cmocka_unit_test(test__f_type_array_fll_idss_delete_callback__fails), + cmocka_unit_test(test__f_type_array_fll_idss_delete_callback__works), - cmocka_unit_test(test__f_type_array_int32s_destroy_callback__fails), - cmocka_unit_test(test__f_type_array_int32s_delete_callback__fails), + cmocka_unit_test(test__f_type_array_fll_idss_destroy_callback__fails), + cmocka_unit_test(test__f_type_array_fll_idss_destroy_callback__works), - cmocka_unit_test(test__f_type_array_int64s_destroy_callback__fails), - cmocka_unit_test(test__f_type_array_int64s_delete_callback__fails), + cmocka_unit_test(test__f_type_array_int8ss_delete_callback__fails), + cmocka_unit_test(test__f_type_array_int8ss_delete_callback__works), - cmocka_unit_test(test__f_type_array_int128s_destroy_callback__fails), - cmocka_unit_test(test__f_type_array_int128s_delete_callback__fails), + cmocka_unit_test(test__f_type_array_int8ss_destroy_callback__fails), + cmocka_unit_test(test__f_type_array_int8ss_destroy_callback__works), - cmocka_unit_test(test__f_type_array_number_unsigneds_destroy_callback__fails), - cmocka_unit_test(test__f_type_array_number_unsigneds_delete_callback__fails), + cmocka_unit_test(test__f_type_array_int16ss_delete_callback__fails), + cmocka_unit_test(test__f_type_array_int16ss_delete_callback__works), - cmocka_unit_test(test__f_type_array_polls_destroy_callback__fails), - cmocka_unit_test(test__f_type_array_polls_delete_callback__fails), + cmocka_unit_test(test__f_type_array_int16ss_destroy_callback__fails), + cmocka_unit_test(test__f_type_array_int16ss_destroy_callback__works), - cmocka_unit_test(test__f_type_array_states_destroy_callback__fails), - cmocka_unit_test(test__f_type_array_states_delete_callback__fails), + cmocka_unit_test(test__f_type_array_int32ss_delete_callback__fails), + cmocka_unit_test(test__f_type_array_int32ss_delete_callback__works), - cmocka_unit_test(test__f_type_array_statuss_destroy_callback__fails), - cmocka_unit_test(test__f_type_array_statuss_delete_callback__fails), + cmocka_unit_test(test__f_type_array_int32ss_destroy_callback__fails), + cmocka_unit_test(test__f_type_array_int32ss_destroy_callback__works), - cmocka_unit_test(test__f_type_array_uint8s_destroy_callback__fails), - cmocka_unit_test(test__f_type_array_uint8s_delete_callback__fails), + cmocka_unit_test(test__f_type_array_int64ss_delete_callback__fails), + cmocka_unit_test(test__f_type_array_int64ss_delete_callback__works), - cmocka_unit_test(test__f_type_array_uint16s_destroy_callback__fails), - cmocka_unit_test(test__f_type_array_uint16s_delete_callback__fails), + cmocka_unit_test(test__f_type_array_int64ss_destroy_callback__fails), + cmocka_unit_test(test__f_type_array_int64ss_destroy_callback__works), - cmocka_unit_test(test__f_type_array_uint32s_destroy_callback__fails), - cmocka_unit_test(test__f_type_array_uint32s_delete_callback__fails), + cmocka_unit_test(test__f_type_array_int128ss_delete_callback__fails), + cmocka_unit_test(test__f_type_array_int128ss_delete_callback__works), - cmocka_unit_test(test__f_type_array_uint64s_destroy_callback__fails), - cmocka_unit_test(test__f_type_array_uint64s_delete_callback__fails), + cmocka_unit_test(test__f_type_array_int128ss_destroy_callback__fails), + cmocka_unit_test(test__f_type_array_int128ss_destroy_callback__works), - cmocka_unit_test(test__f_type_array_uint128s_destroy_callback__fails), - cmocka_unit_test(test__f_type_array_uint128s_delete_callback__fails), + cmocka_unit_test(test__f_type_array_number_unsignedss_delete_callback__fails), + cmocka_unit_test(test__f_type_array_number_unsignedss_delete_callback__works), - cmocka_unit_test(test__f_type_array_cells_destroy_callback__works), - cmocka_unit_test(test__f_type_array_cells_delete_callback__works), + cmocka_unit_test(test__f_type_array_number_unsignedss_destroy_callback__fails), + cmocka_unit_test(test__f_type_array_number_unsignedss_destroy_callback__works), - cmocka_unit_test(test__f_type_array_files_destroy_callback__works), - cmocka_unit_test(test__f_type_array_files_delete_callback__works), + cmocka_unit_test(test__f_type_array_pollss_delete_callback__fails), + cmocka_unit_test(test__f_type_array_pollss_delete_callback__works), - cmocka_unit_test(test__f_type_array_fll_ids_destroy_callback__works), - cmocka_unit_test(test__f_type_array_fll_ids_delete_callback__works), + cmocka_unit_test(test__f_type_array_pollss_destroy_callback__fails), + cmocka_unit_test(test__f_type_array_pollss_destroy_callback__works), - cmocka_unit_test(test__f_type_array_int8s_destroy_callback__works), - cmocka_unit_test(test__f_type_array_int8s_delete_callback__works), + cmocka_unit_test(test__f_type_array_statess_delete_callback__fails), + cmocka_unit_test(test__f_type_array_statess_delete_callback__works), - cmocka_unit_test(test__f_type_array_int16s_destroy_callback__works), - cmocka_unit_test(test__f_type_array_int16s_delete_callback__works), + cmocka_unit_test(test__f_type_array_statess_destroy_callback__fails), + cmocka_unit_test(test__f_type_array_statess_destroy_callback__works), - cmocka_unit_test(test__f_type_array_int32s_destroy_callback__works), - cmocka_unit_test(test__f_type_array_int32s_delete_callback__works), + cmocka_unit_test(test__f_type_array_statusss_delete_callback__fails), + cmocka_unit_test(test__f_type_array_statusss_delete_callback__works), - cmocka_unit_test(test__f_type_array_int64s_destroy_callback__works), - cmocka_unit_test(test__f_type_array_int64s_delete_callback__works), + cmocka_unit_test(test__f_type_array_statusss_destroy_callback__fails), + cmocka_unit_test(test__f_type_array_statusss_destroy_callback__works), - cmocka_unit_test(test__f_type_array_int128s_destroy_callback__works), - cmocka_unit_test(test__f_type_array_int128s_delete_callback__works), + cmocka_unit_test(test__f_type_array_uint8ss_delete_callback__fails), + cmocka_unit_test(test__f_type_array_uint8ss_delete_callback__works), - cmocka_unit_test(test__f_type_array_number_unsigneds_destroy_callback__works), - cmocka_unit_test(test__f_type_array_number_unsigneds_delete_callback__works), + cmocka_unit_test(test__f_type_array_uint8ss_destroy_callback__fails), + cmocka_unit_test(test__f_type_array_uint8ss_destroy_callback__works), - cmocka_unit_test(test__f_type_array_polls_destroy_callback__works), - cmocka_unit_test(test__f_type_array_polls_delete_callback__works), + cmocka_unit_test(test__f_type_array_uint16ss_delete_callback__fails), + cmocka_unit_test(test__f_type_array_uint16ss_delete_callback__works), - cmocka_unit_test(test__f_type_array_states_destroy_callback__works), - cmocka_unit_test(test__f_type_array_states_delete_callback__works), + cmocka_unit_test(test__f_type_array_uint16ss_destroy_callback__fails), + cmocka_unit_test(test__f_type_array_uint16ss_destroy_callback__works), - cmocka_unit_test(test__f_type_array_statuss_destroy_callback__works), - cmocka_unit_test(test__f_type_array_statuss_delete_callback__works), + cmocka_unit_test(test__f_type_array_uint32ss_delete_callback__fails), + cmocka_unit_test(test__f_type_array_uint32ss_delete_callback__works), - cmocka_unit_test(test__f_type_array_uint8s_destroy_callback__works), - cmocka_unit_test(test__f_type_array_uint8s_delete_callback__works), + cmocka_unit_test(test__f_type_array_uint32ss_destroy_callback__fails), + cmocka_unit_test(test__f_type_array_uint32ss_destroy_callback__works), - cmocka_unit_test(test__f_type_array_uint16s_destroy_callback__works), - cmocka_unit_test(test__f_type_array_uint16s_delete_callback__works), + cmocka_unit_test(test__f_type_array_uint64ss_delete_callback__fails), + cmocka_unit_test(test__f_type_array_uint64ss_delete_callback__works), - cmocka_unit_test(test__f_type_array_uint32s_destroy_callback__works), - cmocka_unit_test(test__f_type_array_uint32s_delete_callback__works), + cmocka_unit_test(test__f_type_array_uint64ss_destroy_callback__fails), + cmocka_unit_test(test__f_type_array_uint64ss_destroy_callback__works), - cmocka_unit_test(test__f_type_array_uint64s_destroy_callback__works), - cmocka_unit_test(test__f_type_array_uint64s_delete_callback__works), + cmocka_unit_test(test__f_type_array_uint128ss_delete_callback__fails), + cmocka_unit_test(test__f_type_array_uint128ss_delete_callback__works), - cmocka_unit_test(test__f_type_array_uint128s_destroy_callback__works), - cmocka_unit_test(test__f_type_array_uint128s_delete_callback__works), + cmocka_unit_test(test__f_type_array_uint128ss_destroy_callback__fails), + cmocka_unit_test(test__f_type_array_uint128ss_destroy_callback__works), #ifndef _di_level_0_parameter_checking_ - // f_cells_destroy_callback() doesn't use parameter checking. - // f_cells_delete_callback() doesn't use parameter checking. + // f_cellss_destroy_callback() doesn't use parameter checking. + // f_cellss_delete_callback() doesn't use parameter checking. - // f_files_destroy_callback() doesn't use parameter checking. - // f_files_delete_callback() doesn't use parameter checking. + // f_filess_destroy_callback() doesn't use parameter checking. + // f_filess_delete_callback() doesn't use parameter checking. - // f_fll_ids_destroy_callback() doesn't use parameter checking. - // f_fll_ids_delete_callback() doesn't use parameter checking. + // f_fll_idss_destroy_callback() doesn't use parameter checking. + // f_fll_idss_delete_callback() doesn't use parameter checking. - // f_int8s_destroy_callback() doesn't use parameter checking. - // f_int8s_delete_callback() doesn't use parameter checking. + // f_int8ss_destroy_callback() doesn't use parameter checking. + // f_int8ss_delete_callback() doesn't use parameter checking. - // f_int16s_destroy_callback() doesn't use parameter checking. - // f_int16s_delete_callback() doesn't use parameter checking. + // f_int16ss_destroy_callback() doesn't use parameter checking. + // f_int16ss_delete_callback() doesn't use parameter checking. - // f_int32s_destroy_callback() doesn't use parameter checking. - // f_int32s_delete_callback() doesn't use parameter checking. + // f_int32ss_destroy_callback() doesn't use parameter checking. + // f_int32ss_delete_callback() doesn't use parameter checking. - // f_int64s_destroy_callback() doesn't use parameter checking. - // f_int64s_delete_callback() doesn't use parameter checking. + // f_int64ss_destroy_callback() doesn't use parameter checking. + // f_int64ss_delete_callback() doesn't use parameter checking. - // f_int128s_destroy_callback() doesn't use parameter checking. - // f_int128s_delete_callback() doesn't use parameter checking. + // f_int128ss_destroy_callback() doesn't use parameter checking. + // f_int128ss_delete_callback() doesn't use parameter checking. - // f_number_unsigneds_destroy_callback() doesn't use parameter checking. - // f_number_unsigneds_delete_callback() doesn't use parameter checking. + // f_number_unsignedss_destroy_callback() doesn't use parameter checking. + // f_number_unsignedss_delete_callback() doesn't use parameter checking. - // f_polls_destroy_callback() doesn't use parameter checking. - // f_polls_delete_callback() doesn't use parameter checking. + // f_pollss_destroy_callback() doesn't use parameter checking. + // f_pollss_delete_callback() doesn't use parameter checking. - // f_states_destroy_callback() doesn't use parameter checking. - // f_states_delete_callback() doesn't use parameter checking. + // f_statess_destroy_callback() doesn't use parameter checking. + // f_statess_delete_callback() doesn't use parameter checking. - // f_statuss_destroy_callback() doesn't use parameter checking. - // f_statuss_delete_callback() doesn't use parameter checking. + // f_statusss_destroy_callback() doesn't use parameter checking. + // f_statusss_delete_callback() doesn't use parameter checking. - // f_uint8s_destroy_callback() doesn't use parameter checking. - // f_uint8s_delete_callback() doesn't use parameter checking. + // f_uint8ss_destroy_callback() doesn't use parameter checking. + // f_uint8ss_delete_callback() doesn't use parameter checking. - // f_uint16s_destroy_callback() doesn't use parameter checking. - // f_uint16s_delete_callback() doesn't use parameter checking. + // f_uint16ss_destroy_callback() doesn't use parameter checking. + // f_uint16ss_delete_callback() doesn't use parameter checking. - // f_uint32s_destroy_callback() doesn't use parameter checking. - // f_uint32s_delete_callback() doesn't use parameter checking. + // f_uint32ss_destroy_callback() doesn't use parameter checking. + // f_uint32ss_delete_callback() doesn't use parameter checking. - // f_uint64s_destroy_callback() doesn't use parameter checking. - // f_uint64s_delete_callback() doesn't use parameter checking. + // f_uint64ss_destroy_callback() doesn't use parameter checking. + // f_uint64ss_delete_callback() doesn't use parameter checking. - // f_uint128s_destroy_callback() doesn't use parameter checking. - // f_uint128s_delete_callback() doesn't use parameter checking. + // f_uint128ss_destroy_callback() doesn't use parameter checking. + // f_uint128ss_delete_callback() doesn't use parameter checking. #endif // _di_level_0_parameter_checking_ }; diff --git a/level_0/f_type_array/tests/unit/c/test-type_array.h b/level_0/f_type_array/tests/unit/c/test-type_array.h index 9acc4dd..66c9bde 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array.h @@ -26,41 +26,44 @@ #include #include +// Mock includes. +#include "mock-type_array.h" + // Test includes. -#include "test-type_array-cells_destroy_callback.h" -#include "test-type_array-cells_delete_callback.h" -#include "test-type_array-files_destroy_callback.h" -#include "test-type_array-files_delete_callback.h" -#include "test-type_array-fll_ids_destroy_callback.h" -#include "test-type_array-fll_ids_delete_callback.h" -#include "test-type_array-int8s_destroy_callback.h" -#include "test-type_array-int8s_delete_callback.h" -#include "test-type_array-int16s_destroy_callback.h" -#include "test-type_array-int16s_delete_callback.h" -#include "test-type_array-int32s_destroy_callback.h" -#include "test-type_array-int32s_delete_callback.h" -#include "test-type_array-int64s_destroy_callback.h" -#include "test-type_array-int64s_delete_callback.h" -#include "test-type_array-int128s_destroy_callback.h" -#include "test-type_array-int128s_delete_callback.h" -#include "test-type_array-number_unsigneds_destroy_callback.h" -#include "test-type_array-number_unsigneds_delete_callback.h" -#include "test-type_array-polls_destroy_callback.h" -#include "test-type_array-polls_delete_callback.h" -#include "test-type_array-states_destroy_callback.h" -#include "test-type_array-states_delete_callback.h" -#include "test-type_array-statuss_destroy_callback.h" -#include "test-type_array-statuss_delete_callback.h" -#include "test-type_array-uint8s_destroy_callback.h" -#include "test-type_array-uint8s_delete_callback.h" -#include "test-type_array-uint16s_destroy_callback.h" -#include "test-type_array-uint16s_delete_callback.h" -#include "test-type_array-uint32s_destroy_callback.h" -#include "test-type_array-uint32s_delete_callback.h" -#include "test-type_array-uint64s_destroy_callback.h" -#include "test-type_array-uint64s_delete_callback.h" -#include "test-type_array-uint128s_destroy_callback.h" -#include "test-type_array-uint128s_delete_callback.h" +#include "test-type_array-cellss_delete_callback.h" +#include "test-type_array-cellss_destroy_callback.h" +#include "test-type_array-filess_delete_callback.h" +#include "test-type_array-filess_destroy_callback.h" +#include "test-type_array-fll_idss_delete_callback.h" +#include "test-type_array-fll_idss_destroy_callback.h" +#include "test-type_array-int8ss_delete_callback.h" +#include "test-type_array-int8ss_destroy_callback.h" +#include "test-type_array-int16ss_delete_callback.h" +#include "test-type_array-int16ss_destroy_callback.h" +#include "test-type_array-int32ss_delete_callback.h" +#include "test-type_array-int32ss_destroy_callback.h" +#include "test-type_array-int64ss_delete_callback.h" +#include "test-type_array-int64ss_destroy_callback.h" +#include "test-type_array-int128ss_delete_callback.h" +#include "test-type_array-int128ss_destroy_callback.h" +#include "test-type_array-number_unsignedss_delete_callback.h" +#include "test-type_array-number_unsignedss_destroy_callback.h" +#include "test-type_array-pollss_delete_callback.h" +#include "test-type_array-pollss_destroy_callback.h" +#include "test-type_array-statess_delete_callback.h" +#include "test-type_array-statess_destroy_callback.h" +#include "test-type_array-statusss_delete_callback.h" +#include "test-type_array-statusss_destroy_callback.h" +#include "test-type_array-uint8ss_delete_callback.h" +#include "test-type_array-uint8ss_destroy_callback.h" +#include "test-type_array-uint16ss_delete_callback.h" +#include "test-type_array-uint16ss_destroy_callback.h" +#include "test-type_array-uint32ss_delete_callback.h" +#include "test-type_array-uint32ss_destroy_callback.h" +#include "test-type_array-uint64ss_delete_callback.h" +#include "test-type_array-uint64ss_destroy_callback.h" +#include "test-type_array-uint128ss_delete_callback.h" +#include "test-type_array-uint128ss_destroy_callback.h" #ifdef __cplusplus extern "C" { -- 1.8.3.1