From f93204b1f075644007f0a2f3fb11f123c528635e Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Wed, 23 Aug 2023 00:49:48 -0500 Subject: [PATCH] Progress: Continue re-designing of the memory logic, focusing on unit tests for recent changes to f_string_dynamic_t and similar. --- build/stand_alone/fake.config.h | 26 +- level_0/f_account/data/build/functions | 34 --- level_0/f_account/data/build/settings-mocks | 4 +- level_0/f_account/tests/unit/c/mock-account.c | 20 +- level_0/f_account/tests/unit/c/mock-account.h | 10 +- .../tests/unit/c/test-account-group_name_by_id.c | 6 +- .../tests/unit/c/test-account-name_by_id.c | 6 +- .../tests/unit/c/test-account-s_delete_callback.c | 74 +++--- .../tests/unit/c/test-account-s_destroy_callback.c | 74 +++--- .../tests/unit/c/test-account-ss_delete_callback.c | 92 +++---- .../unit/c/test-account-ss_destroy_callback.c | 92 +++---- .../tests/unit/c/test-capability-to_name.c | 2 +- .../tests/unit/c/test-capability-to_text.c | 2 +- level_0/f_color/c/color/common.h | 39 --- .../tests/unit/c/test-color-context_delete.c | 20 +- .../tests/unit/c/test-color-context_destroy.c | 20 +- .../f_color/tests/unit/c/test-color-load_context.c | 26 +- level_0/f_color/tests/unit/c/test-color-save_1.c | 26 +- level_0/f_color/tests/unit/c/test-color-save_2.c | 26 +- level_0/f_color/tests/unit/c/test-color-save_3.c | 26 +- level_0/f_color/tests/unit/c/test-color-save_4.c | 26 +- level_0/f_color/tests/unit/c/test-color-save_5.c | 26 +- level_0/f_console/c/console/common.c | 56 ++-- level_0/f_console/c/private-console.c | 55 ++-- .../tests/unit/c/test-console-parameters_delete.c | 2 +- .../tests/unit/c/test-console-parameters_destroy.c | 2 +- level_0/f_control_group/c/control_group.c | 22 +- level_0/f_control_group/c/control_group/common.h | 8 - .../tests/unit/c/test-control_group-copy.c | 12 +- .../c/test-conversion-number_signed_to_string.c | 6 +- .../c/test-conversion-number_unsigned_to_string.c | 6 +- level_0/f_directory/data/build/settings-mocks | 6 +- level_0/f_directory/tests/unit/c/mock-directory.c | 54 +--- level_0/f_directory/tests/unit/c/mock-directory.h | 14 +- .../f_directory/tests/unit/c/test-directory-list.c | 8 +- .../c/test-directory-listings_delete_callback.c | 201 ++++++++------- .../c/test-directory-listings_destroy_callback.c | 201 ++++++++------- .../c/test-directory-listingss_delete_callback.c | 194 +++++++------- .../c/test-directory-listingss_destroy_callback.c | 196 +++++++------- .../c/test-directory-recurse_dos_delete_callback.c | 287 +++++++++++---------- .../test-directory-recurse_dos_destroy_callback.c | 287 +++++++++++---------- .../test-directory-recurse_doss_delete_callback.c | 282 ++++++++++---------- .../test-directory-recurse_doss_destroy_callback.c | 286 ++++++++++---------- .../c/test-directory-statuss_delete_callback.c | 23 +- .../c/test-directory-statuss_destroy_callback.c | 23 +- .../c/test-directory-statusss_delete_callback.c | 12 +- .../c/test-directory-statusss_destroy_callback.c | 12 +- .../tests/unit/c/test-environment-get.c | 6 +- level_0/f_file/tests/unit/c/test-file-link_read.c | 8 +- .../f_file/tests/unit/c/test-file-link_read_at.c | 10 +- level_0/f_file/tests/unit/c/test-file-name_base.c | 4 +- .../f_file/tests/unit/c/test-file-name_directory.c | 4 +- level_0/f_file/tests/unit/c/test-file-read.c | 8 +- level_0/f_file/tests/unit/c/test-file-read_block.c | 8 +- level_0/f_file/tests/unit/c/test-file-read_until.c | 8 +- .../f_file/tests/unit/c/test-file-stream_read.c | 6 +- .../tests/unit/c/test-file-stream_read_block.c | 4 +- .../tests/unit/c/test-file-stream_read_until.c | 6 +- level_0/f_fss/c/fss/private-item.h | 2 - level_0/f_fss/c/fss/private-nest.h | 4 - level_0/f_fss/c/fss/private-simple_packet.c | 2 +- level_0/f_fss/data/build/settings-mocks | 2 - level_0/f_fss/tests/unit/c/mock-fss.c | 34 --- level_0/f_fss/tests/unit/c/mock-fss.h | 4 - .../c/test-fss-simple_packets_delete_callback.c | 26 +- .../c/test-fss-simple_packets_destroy_callback.c | 26 +- .../c/test-fss-simple_packetss_delete_callback.c | 12 +- .../c/test-fss-simple_packetss_destroy_callback.c | 16 +- .../unit/c/test-limit-setss_delete_callback.c | 2 +- .../unit/c/test-limit-setss_destroy_callback.c | 2 +- .../unit/c/test-limit-valuess_delete_callback.c | 2 +- .../unit/c/test-limit-valuess_destroy_callback.c | 2 +- level_0/f_path/tests/unit/c/test-path-current.c | 4 +- .../tests/unit/c/test-path-directory_cleanup.c | 10 +- level_0/f_path/tests/unit/c/test-path-real.c | 4 +- .../tests/unit/c/test-serialize-from_simple.c | 4 +- .../tests/unit/c/test-serialize-from_simple_get.c | 4 +- .../tests/unit/c/test-serialize-to_simple.c | 4 +- .../unit/c/test-socket-addressss_delete_callback.c | 2 +- .../c/test-socket-addressss_destroy_callback.c | 2 +- .../tests/unit/c/test-socket-ss_delete_callback.c | 2 +- .../tests/unit/c/test-socket-ss_destroy_callback.c | 2 +- level_0/f_string/data/build/settings | 2 +- level_0/f_string/data/build/settings-tests | 6 +- .../tests/unit/c/test-string-dynamic_adjust.c | 42 --- .../tests/unit/c/test-string-dynamic_adjust.h | 27 -- .../tests/unit/c/test-string-dynamic_decimate_by.c | 50 ---- .../tests/unit/c/test-string-dynamic_decimate_by.h | 27 -- .../tests/unit/c/test-string-dynamic_decrease_by.c | 50 ---- .../tests/unit/c/test-string-dynamic_decrease_by.h | 27 -- .../tests/unit/c/test-string-dynamic_increase.c | 76 ------ .../tests/unit/c/test-string-dynamic_increase.h | 34 --- .../tests/unit/c/test-string-dynamic_increase_by.c | 52 ---- .../tests/unit/c/test-string-dynamic_increase_by.h | 27 -- .../tests/unit/c/test-string-dynamic_resize.c | 42 --- .../tests/unit/c/test-string-dynamic_resize.h | 27 -- .../tests/unit/c/test-string-dynamic_terminate.c | 4 +- .../unit/c/test-string-dynamic_terminate_after.c | 4 +- .../tests/unit/c/test-string-dynamics_adjust.c | 42 --- .../tests/unit/c/test-string-dynamics_adjust.h | 27 -- .../tests/unit/c/test-string-dynamics_append_all.c | 4 +- .../unit/c/test-string-dynamics_decimate_by.c | 50 ---- .../unit/c/test-string-dynamics_decimate_by.h | 27 -- .../unit/c/test-string-dynamics_decrease_by.c | 50 ---- .../unit/c/test-string-dynamics_decrease_by.h | 27 -- .../tests/unit/c/test-string-dynamics_increase.c | 76 ------ .../tests/unit/c/test-string-dynamics_increase.h | 34 --- .../unit/c/test-string-dynamics_increase_by.c | 52 ---- .../unit/c/test-string-dynamics_increase_by.h | 27 -- .../tests/unit/c/test-string-dynamics_resize.c | 42 --- .../tests/unit/c/test-string-dynamics_resize.h | 27 -- .../tests/unit/c/test-string-dynamicss_adjust.c | 42 --- .../tests/unit/c/test-string-dynamicss_adjust.h | 27 -- .../tests/unit/c/test-string-dynamicss_append.c | 4 +- .../unit/c/test-string-dynamicss_append_all.c | 6 +- .../unit/c/test-string-dynamicss_decimate_by.c | 50 ---- .../unit/c/test-string-dynamicss_decimate_by.h | 27 -- .../unit/c/test-string-dynamicss_decrease_by.c | 50 ---- .../unit/c/test-string-dynamicss_decrease_by.h | 27 -- .../tests/unit/c/test-string-dynamicss_increase.c | 76 ------ .../tests/unit/c/test-string-dynamicss_increase.h | 34 --- .../unit/c/test-string-dynamicss_increase_by.c | 52 ---- .../unit/c/test-string-dynamicss_increase_by.h | 27 -- .../tests/unit/c/test-string-dynamicss_resize.c | 42 --- .../tests/unit/c/test-string-dynamicss_resize.h | 27 -- level_0/f_string/tests/unit/c/test-string.c | 48 +--- level_0/f_string/tests/unit/c/test-string.h | 18 -- level_1/fl_path/tests/unit/c/test-path-canonical.c | 10 +- level_3/controller/c/common.c | 11 +- level_3/controller/c/common/private-rule.c | 9 +- level_3/controller/c/common/private-rule.h | 9 +- level_3/controller/c/rule/private-rule.c | 4 +- level_3/fake/c/main/build/library.h | 2 - level_3/fake/c/main/make/load_fakefile.h | 2 - level_3/fake/c/main/make/operate_process_type.h | 2 - level_3/firewall/c/private-common.c | 4 +- level_3/firewall/c/private-firewall.c | 14 +- level_3/fss_read/c/main/common.h | 2 - level_3/fss_read/c/main/main.h | 2 - level_3/fss_write/c/main/common.h | 2 - level_3/fss_write/c/main/main.h | 2 - level_3/iki_write/c/main/common.h | 2 - 142 files changed, 1666 insertions(+), 3128 deletions(-) delete mode 100644 level_0/f_string/tests/unit/c/test-string-dynamic_adjust.c delete mode 100644 level_0/f_string/tests/unit/c/test-string-dynamic_adjust.h delete mode 100644 level_0/f_string/tests/unit/c/test-string-dynamic_decimate_by.c delete mode 100644 level_0/f_string/tests/unit/c/test-string-dynamic_decimate_by.h delete mode 100644 level_0/f_string/tests/unit/c/test-string-dynamic_decrease_by.c delete mode 100644 level_0/f_string/tests/unit/c/test-string-dynamic_decrease_by.h delete mode 100644 level_0/f_string/tests/unit/c/test-string-dynamic_increase.c delete mode 100644 level_0/f_string/tests/unit/c/test-string-dynamic_increase.h delete mode 100644 level_0/f_string/tests/unit/c/test-string-dynamic_increase_by.c delete mode 100644 level_0/f_string/tests/unit/c/test-string-dynamic_increase_by.h delete mode 100644 level_0/f_string/tests/unit/c/test-string-dynamic_resize.c delete mode 100644 level_0/f_string/tests/unit/c/test-string-dynamic_resize.h delete mode 100644 level_0/f_string/tests/unit/c/test-string-dynamics_adjust.c delete mode 100644 level_0/f_string/tests/unit/c/test-string-dynamics_adjust.h delete mode 100644 level_0/f_string/tests/unit/c/test-string-dynamics_decimate_by.c delete mode 100644 level_0/f_string/tests/unit/c/test-string-dynamics_decimate_by.h delete mode 100644 level_0/f_string/tests/unit/c/test-string-dynamics_decrease_by.c delete mode 100644 level_0/f_string/tests/unit/c/test-string-dynamics_decrease_by.h delete mode 100644 level_0/f_string/tests/unit/c/test-string-dynamics_increase.c delete mode 100644 level_0/f_string/tests/unit/c/test-string-dynamics_increase.h delete mode 100644 level_0/f_string/tests/unit/c/test-string-dynamics_increase_by.c delete mode 100644 level_0/f_string/tests/unit/c/test-string-dynamics_increase_by.h delete mode 100644 level_0/f_string/tests/unit/c/test-string-dynamics_resize.c delete mode 100644 level_0/f_string/tests/unit/c/test-string-dynamics_resize.h delete mode 100644 level_0/f_string/tests/unit/c/test-string-dynamicss_adjust.c delete mode 100644 level_0/f_string/tests/unit/c/test-string-dynamicss_adjust.h delete mode 100644 level_0/f_string/tests/unit/c/test-string-dynamicss_decimate_by.c delete mode 100644 level_0/f_string/tests/unit/c/test-string-dynamicss_decimate_by.h delete mode 100644 level_0/f_string/tests/unit/c/test-string-dynamicss_decrease_by.c delete mode 100644 level_0/f_string/tests/unit/c/test-string-dynamicss_decrease_by.h delete mode 100644 level_0/f_string/tests/unit/c/test-string-dynamicss_increase.c delete mode 100644 level_0/f_string/tests/unit/c/test-string-dynamicss_increase.h delete mode 100644 level_0/f_string/tests/unit/c/test-string-dynamicss_increase_by.c delete mode 100644 level_0/f_string/tests/unit/c/test-string-dynamicss_increase_by.h delete mode 100644 level_0/f_string/tests/unit/c/test-string-dynamicss_resize.c delete mode 100644 level_0/f_string/tests/unit/c/test-string-dynamicss_resize.h diff --git a/build/stand_alone/fake.config.h b/build/stand_alone/fake.config.h index d996fd6..dc358ba 100644 --- a/build/stand_alone/fake.config.h +++ b/build/stand_alone/fake.config.h @@ -613,7 +613,6 @@ #define _di_f_fss_sets_resize_ #define _di_f_fss_setss_delete_callback_ #define _di_f_fss_setss_destroy_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_ @@ -813,13 +812,11 @@ //#define _di_f_limit_process_ #define _di_f_limit_setss_delete_callback_ #define _di_f_limit_setss_destroy_callback_ -#define _di_f_limit_setss_destroy_callback_ #define _di_f_limit_setss_t_ //#define _di_f_limit_sets_t_ //#define _di_f_limit_set_t_ #define _di_f_limit_valuess_delete_callback_ #define _di_f_limit_valuess_destroy_callback_ -#define _di_f_limit_valuess_destroy_callback_ #define _di_f_limit_valuess_t_ #define _di_f_limit_values_t_ //#define _di_f_limit_value_t_ @@ -1344,7 +1341,6 @@ #define _di_f_socket_address_family_e_ #define _di_f_socket_addressss_delete_callback_ #define _di_f_socket_addressss_destroy_callback_ -#define _di_f_socket_addressss_destroy_callback_ #define _di_f_socket_addressss_t_ #define _di_f_socket_addresss_t_ #define _di_f_socket_address_t_ @@ -1375,7 +1371,6 @@ #define _di_f_socket_read_stream_ #define _di_f_socketss_delete_callback_ #define _di_f_socketss_destroy_callback_ -#define _di_f_socketss_destroy_callback_ #define _di_f_socketss_t_ #define _di_f_sockets_t_ #define _di_f_socket_t_ @@ -1429,11 +1424,15 @@ #define _di_f_string_dynamic_prepend_nulless_ #define _di_f_string_dynamics_append_ #define _di_f_string_dynamics_append_all_ +//#define _di_f_string_dynamics_delete_callback_ +#define _di_f_string_dynamics_destroy_callback_ #define _di_f_string_dynamic_seek_line_ #define _di_f_string_dynamic_seek_line_to_ #define _di_f_string_dynamic_seek_to_ #define _di_f_string_dynamicss_append_ #define _di_f_string_dynamicss_append_all_ +#define _di_f_string_dynamicss_delete_callback_ +#define _di_f_string_dynamicss_destroy_callback_ #define _di_f_string_dynamicss_t_ //#define _di_f_string_dynamics_t_ //#define _di_f_string_dynamic_t_ @@ -1441,6 +1440,7 @@ //#define _di_f_string_dynamic_terminate_after_ //#define _di_f_string_empty_s_ //#define _di_f_string_eol_s_ +//#define _di_f_string_format_s_ #define _di_f_string_map_multis_adjust_ #define _di_f_string_map_multis_append_ #define _di_f_string_map_multis_append_all_ @@ -1916,13 +1916,29 @@ #define _di_f_utf_string_dynamic_prepend_assure_ #define _di_f_utf_string_dynamic_prepend_assure_nulless_ #define _di_f_utf_string_dynamic_prepend_nulless_ +#define _di_f_utf_string_dynamic_resize_ +#define _di_f_utf_string_dynamics_adjust_ #define _di_f_utf_string_dynamics_append_ #define _di_f_utf_string_dynamics_append_all_ +#define _di_f_utf_string_dynamics_decimate_by_ +#define _di_f_utf_string_dynamics_decrease_by +#define _di_f_utf_string_dynamics_decrease_by_ #define _di_f_utf_string_dynamic_seek_line_ #define _di_f_utf_string_dynamic_seek_line_to_ #define _di_f_utf_string_dynamic_seek_to_ +#define _di_f_utf_string_dynamics_increase +#define _di_f_utf_string_dynamics_increase_ +#define _di_f_utf_string_dynamics_increase_by +#define _di_f_utf_string_dynamics_increase_by_ +#define _di_f_utf_string_dynamics_resize_ +#define _di_f_utf_string_dynamicss_adjust_ #define _di_f_utf_string_dynamicss_append_ #define _di_f_utf_string_dynamicss_append_all_ +#define _di_f_utf_string_dynamicss_decimate_by_ +#define _di_f_utf_string_dynamicss_decrease_by_ +#define _di_f_utf_string_dynamicss_increase_ +#define _di_f_utf_string_dynamicss_increase_by_ +#define _di_f_utf_string_dynamicss_resize_ #define _di_f_utf_string_dynamicss_t_ //#define _di_f_utf_string_dynamics_t_ //#define _di_f_utf_string_dynamic_t_ diff --git a/level_0/f_account/data/build/functions b/level_0/f_account/data/build/functions index 40ec0dc..dccf3c5 100644 --- a/level_0/f_account/data/build/functions +++ b/level_0/f_account/data/build/functions @@ -8,106 +8,72 @@ main: f_account_id_by_name f_account_name_by_id - f_accounts_adjust f_accounts_append f_accounts_append_all - f_accounts_decimate_by - f_accounts_decrease_by - f_accounts_increase - f_accounts_increase_by - f_accounts_resize - f_accountss_adjust f_accountss_append f_accountss_append_all - f_accountss_decimate_by - f_accountss_decrease_by - f_accountss_increase - f_accountss_increase_by - f_accountss_resize f_account_by_id: - f_string_dynamic_increase_by f_account_by_name: - f_string_dynamic_increase_by f_account_delete: - f_string_dynamic_resize f_account_destroy: - f_string_dynamic_adjust f_account_group_id_by_name: f_account_group_name_by_id: - f_string_dynamic_increase_by f_account_id_by_name: f_account_name_by_id: - f_string_dynamic_increase_by f_accounts_adjust: f_memory_adjust - f_string_dynamic_adjust f_accounts_append: f_memory_resize - f_string_dynamic_append f_accounts_append_all: f_memory_resize - f_string_dynamic_append f_accounts_decimate_by: f_memory_adjust - f_string_dynamic_adjust f_accounts_decrease_by: f_memory_resize - f_string_dynamic_resize f_accounts_increase: f_memory_resize - f_string_dynamic_resize f_accounts_increase_by: f_memory_resize - f_string_dynamic_resize f_accounts_resize: f_memory_resize - f_string_dynamic_resize f_accountss_adjust: f_memory_adjust - f_string_dynamic_adjust f_accountss_append: f_memory_resize - f_string_dynamic_resize f_accountss_append_all: f_memory_resize - f_string_dynamic_resize f_accountss_decimate_by: f_memory_adjust - f_string_dynamic_adjust f_accountss_decrease_by: f_memory_resize - f_string_dynamic_resize f_accountss_increase: f_memory_resize - f_string_dynamic_resize f_accountss_increase_by: f_memory_resize - f_string_dynamic_resize f_accountss_resize: f_memory_resize - f_string_dynamic_resize diff --git a/level_0/f_account/data/build/settings-mocks b/level_0/f_account/data/build/settings-mocks index 470120a..2058d45 100644 --- a/level_0/f_account/data/build/settings-mocks +++ b/level_0/f_account/data/build/settings-mocks @@ -64,8 +64,8 @@ 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_memory_arrays_adjust +flags -Wl,--wrap=f_memory_arrays_resize flags -Wl,--wrap=getpwnam_r flags -Wl,--wrap=getpwuid_r flags -Wl,--wrap=getgrnam_r diff --git a/level_0/f_account/tests/unit/c/mock-account.c b/level_0/f_account/tests/unit/c/mock-account.c index 81cf5a5..434343d 100644 --- a/level_0/f_account/tests/unit/c/mock-account.c +++ b/level_0/f_account/tests/unit/c/mock-account.c @@ -41,36 +41,36 @@ 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_string_dynamic_adjust(const f_number_unsigned_t length, f_string_dynamic_t * const structure) { +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) { - return __real_f_string_dynamic_adjust(length, structure); + if (mock_unwrap_f_memory) { + return __real_f_memory_arrays_resize(length, width, array, used, size, callback); } - if (!structure) return F_status_set_error(F_parameter_not); + 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); - structure->size = length; + *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) { +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) { - return __real_f_string_dynamic_resize(length, structure); + if (mock_unwrap_f_memory) { + return __real_f_memory_arrays_resize(length, width, array, used, size, callback); } - if (!structure) return F_status_set_error(F_parameter_not); + 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); - structure->size = length; + *size = length; return mock_type(f_status_t); } 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 df2b6b9..d09205e 100644 --- a/level_0/f_account/tests/unit/c/mock-account.h +++ b/level_0/f_account/tests/unit/c/mock-account.h @@ -33,15 +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 __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 __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_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_getpwnam_r(const char * const name, struct passwd *pwd, char *buf, size_t buflen, struct passwd **result); extern int __wrap_getpwuid_r(uid_t uid, struct passwd *pwd, char *buf, size_t buflen, struct passwd **result); diff --git a/level_0/f_account/tests/unit/c/test-account-group_name_by_id.c b/level_0/f_account/tests/unit/c/test-account-group_name_by_id.c index 881ef16..af9fb9c 100644 --- a/level_0/f_account/tests/unit/c/test-account-group_name_by_id.c +++ b/level_0/f_account/tests/unit/c/test-account-group_name_by_id.c @@ -42,7 +42,7 @@ void test__f_account_group_name_by_id__fails(void **state) { assert_int_equal(status, F_status_set_error(statuss[i])); } // for - f_string_dynamic_resize(0, &name); + free((void *) name.string); } void test__f_account_group_name_by_id__not_found(void **state) { @@ -63,7 +63,7 @@ void test__f_account_group_name_by_id__not_found(void **state) { assert_int_equal(status, F_exist_not); } - f_string_dynamic_resize(0, &name); + free((void *) name.string); } void test__f_account_group_name_by_id__parameter_checking(void **state) { @@ -103,7 +103,7 @@ void test__f_account_group_name_by_id__works(void **state) { assert_string_equal(name.string, group_data.gr_name); } - f_string_dynamic_resize(0, &name); + free((void *) name.string); } #ifdef __cplusplus diff --git a/level_0/f_account/tests/unit/c/test-account-name_by_id.c b/level_0/f_account/tests/unit/c/test-account-name_by_id.c index af129eb..8fea7d9 100644 --- a/level_0/f_account/tests/unit/c/test-account-name_by_id.c +++ b/level_0/f_account/tests/unit/c/test-account-name_by_id.c @@ -42,7 +42,7 @@ void test__f_account_name_by_id__fails(void **state) { assert_int_equal(status, F_status_set_error(statuss[i])); } // for - f_string_dynamic_resize(0, &name); + free((void *) name.string); } void test__f_account_name_by_id__not_found(void **state) { @@ -63,7 +63,7 @@ void test__f_account_name_by_id__not_found(void **state) { assert_int_equal(status, F_exist_not); } - f_string_dynamic_resize(0, &name); + free((void *) name.string); } void test__f_account_name_by_id__parameter_checking(void **state) { @@ -105,7 +105,7 @@ void test__f_account_name_by_id__works(void **state) { assert_string_equal(name.string, password.pw_name); } - f_string_dynamic_resize(0, &name); + free((void *) name.string); } #ifdef __cplusplus diff --git a/level_0/f_account/tests/unit/c/test-account-s_delete_callback.c b/level_0/f_account/tests/unit/c/test-account-s_delete_callback.c index ce0694c..6bb4669 100644 --- a/level_0/f_account/tests/unit/c/test-account-s_delete_callback.c +++ b/level_0/f_account/tests/unit/c/test-account-s_delete_callback.c @@ -8,14 +8,14 @@ extern "C" { void test__f_accounts_delete_callback__fails(void **state) { mock_unwrap = 0; - mock_unwrap_f_memory = 1; + mock_unwrap_f_memory = 0; f_account_t data = f_account_t_initialize; f_account_t data_array[] = { data }; { - will_return(__wrap_f_string_dynamic_resize, true); - will_return(__wrap_f_string_dynamic_resize, F_status_set_error(F_failure)); + 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_accounts_delete_callback(0, 1, (void *) data_array); @@ -23,11 +23,11 @@ void test__f_accounts_delete_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamic_resize, true); - will_return(__wrap_f_string_dynamic_resize, F_status_set_error(F_failure)); + 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_accounts_delete_callback(0, 1, (void *) data_array); @@ -35,14 +35,14 @@ void test__f_accounts_delete_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamic_resize, true); - will_return(__wrap_f_string_dynamic_resize, F_status_set_error(F_failure)); + 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_accounts_delete_callback(0, 1, (void *) data_array); @@ -50,17 +50,17 @@ void test__f_accounts_delete_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamic_resize, true); - will_return(__wrap_f_string_dynamic_resize, F_status_set_error(F_failure)); + 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_accounts_delete_callback(0, 1, (void *) data_array); @@ -68,20 +68,20 @@ void test__f_accounts_delete_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamic_resize, true); - will_return(__wrap_f_string_dynamic_resize, F_status_set_error(F_failure)); + 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_accounts_delete_callback(0, 1, (void *) data_array); @@ -91,7 +91,7 @@ void test__f_accounts_delete_callback__fails(void **state) { void test__f_accounts_delete_callback__works(void **state) { - mock_unwrap = 1; + mock_unwrap = 0; mock_unwrap_f_memory = 1; const f_number_unsigned_t length = 1; @@ -102,19 +102,19 @@ void test__f_accounts_delete_callback__works(void **state) { f_status_t status = f_memory_array_resize(length, sizeof(f_account_t), (void **) &datas.array, &datas.used, &datas.size); assert_int_equal(status, F_okay); - status = f_string_dynamic_resize(1, &datas.array[0].home); + status = f_memory_array_resize(1, sizeof(f_char_t), (void **) &datas.array[0].home.string, &datas.array[0].home.used, &datas.array[0].home.size); assert_int_equal(status, F_okay); - status = f_string_dynamic_resize(1, &datas.array[0].label); + status = f_memory_array_resize(1, sizeof(f_char_t), (void **) &datas.array[0].label.string, &datas.array[0].label.used, &datas.array[0].label.size); assert_int_equal(status, F_okay); - status = f_string_dynamic_resize(1, &datas.array[0].name); + status = f_memory_array_resize(1, sizeof(f_char_t), (void **) &datas.array[0].name.string, &datas.array[0].name.used, &datas.array[0].name.size); assert_int_equal(status, F_okay); - status = f_string_dynamic_resize(1, &datas.array[0].password); + status = f_memory_array_resize(1, sizeof(f_char_t), (void **) &datas.array[0].password.string, &datas.array[0].password.used, &datas.array[0].password.size); assert_int_equal(status, F_okay); - status = f_string_dynamic_resize(1, &datas.array[0].shell); + status = f_memory_array_resize(1, sizeof(f_char_t), (void **) &datas.array[0].shell.string, &datas.array[0].shell.used, &datas.array[0].shell.size); assert_int_equal(status, F_okay); } diff --git a/level_0/f_account/tests/unit/c/test-account-s_destroy_callback.c b/level_0/f_account/tests/unit/c/test-account-s_destroy_callback.c index ca16372..cef429c 100644 --- a/level_0/f_account/tests/unit/c/test-account-s_destroy_callback.c +++ b/level_0/f_account/tests/unit/c/test-account-s_destroy_callback.c @@ -8,14 +8,14 @@ extern "C" { void test__f_accounts_destroy_callback__fails(void **state) { mock_unwrap = 0; - mock_unwrap_f_memory = 1; + mock_unwrap_f_memory = 0; f_account_t data = f_account_t_initialize; f_account_t data_array[] = { data }; { - will_return(__wrap_f_string_dynamic_adjust, true); - will_return(__wrap_f_string_dynamic_adjust, F_status_set_error(F_failure)); + 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_accounts_destroy_callback(0, 1, (void *) data_array); @@ -23,11 +23,11 @@ void test__f_accounts_destroy_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamic_adjust, true); - will_return(__wrap_f_string_dynamic_adjust, F_status_set_error(F_failure)); + 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_accounts_destroy_callback(0, 1, (void *) data_array); @@ -35,14 +35,14 @@ void test__f_accounts_destroy_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamic_adjust, true); - will_return(__wrap_f_string_dynamic_adjust, F_status_set_error(F_failure)); + 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_accounts_destroy_callback(0, 1, (void *) data_array); @@ -50,17 +50,17 @@ void test__f_accounts_destroy_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamic_adjust, true); - will_return(__wrap_f_string_dynamic_adjust, F_status_set_error(F_failure)); + 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_accounts_destroy_callback(0, 1, (void *) data_array); @@ -68,20 +68,20 @@ void test__f_accounts_destroy_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamic_adjust, true); - will_return(__wrap_f_string_dynamic_adjust, F_status_set_error(F_failure)); + 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_accounts_destroy_callback(0, 1, (void *) data_array); @@ -91,7 +91,7 @@ void test__f_accounts_destroy_callback__fails(void **state) { void test__f_accounts_destroy_callback__works(void **state) { - mock_unwrap = 1; + mock_unwrap = 0; mock_unwrap_f_memory = 1; const f_number_unsigned_t length = 1; @@ -102,19 +102,19 @@ void test__f_accounts_destroy_callback__works(void **state) { f_status_t status = f_memory_array_resize(length, sizeof(f_account_t), (void **) &datas.array, &datas.used, &datas.size); assert_int_equal(status, F_okay); - status = f_string_dynamic_resize(1, &datas.array[0].home); + status = f_memory_array_resize(1, sizeof(f_char_t), (void **) &datas.array[0].home.string, &datas.array[0].home.used, &datas.array[0].home.size); assert_int_equal(status, F_okay); - status = f_string_dynamic_resize(1, &datas.array[0].label); + status = f_memory_array_resize(1, sizeof(f_char_t), (void **) &datas.array[0].label.string, &datas.array[0].label.used, &datas.array[0].label.size); assert_int_equal(status, F_okay); - status = f_string_dynamic_resize(1, &datas.array[0].name); + status = f_memory_array_resize(1, sizeof(f_char_t), (void **) &datas.array[0].name.string, &datas.array[0].name.used, &datas.array[0].name.size); assert_int_equal(status, F_okay); - status = f_string_dynamic_resize(1, &datas.array[0].password); + status = f_memory_array_resize(1, sizeof(f_char_t), (void **) &datas.array[0].password.string, &datas.array[0].password.used, &datas.array[0].password.size); assert_int_equal(status, F_okay); - status = f_string_dynamic_resize(1, &datas.array[0].shell); + status = f_memory_array_resize(1, sizeof(f_char_t), (void **) &datas.array[0].shell.string, &datas.array[0].shell.used, &datas.array[0].shell.size); assert_int_equal(status, F_okay); } 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 230ae7b..54748c2 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 @@ -16,8 +16,8 @@ void test__f_accountss_delete_callback__fails(void **state) { 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)); + 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 *) datas_array); @@ -25,11 +25,11 @@ void test__f_accountss_delete_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamic_resize, true); - will_return(__wrap_f_string_dynamic_resize, F_status_set_error(F_failure)); + 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 *) datas_array); @@ -37,14 +37,14 @@ void test__f_accountss_delete_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamic_resize, true); - will_return(__wrap_f_string_dynamic_resize, F_status_set_error(F_failure)); + 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 *) datas_array); @@ -52,17 +52,17 @@ void test__f_accountss_delete_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamic_resize, true); - will_return(__wrap_f_string_dynamic_resize, F_status_set_error(F_failure)); + 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 *) datas_array); @@ -70,20 +70,20 @@ void test__f_accountss_delete_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamic_resize, true); - will_return(__wrap_f_string_dynamic_resize, F_status_set_error(F_failure)); + 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 *) datas_array); @@ -91,20 +91,20 @@ void test__f_accountss_delete_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); will_return(__wrap_f_memory_array_resize, true); will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); @@ -117,7 +117,7 @@ void test__f_accountss_delete_callback__fails(void **state) { void test__f_accountss_delete_callback__works(void **state) { - mock_unwrap = 1; + mock_unwrap = 0; mock_unwrap_f_memory = 1; const f_number_unsigned_t length = 1; @@ -131,19 +131,19 @@ void test__f_accountss_delete_callback__works(void **state) { status = f_memory_array_resize(1, sizeof(f_account_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size); assert_int_equal(status, F_okay); - status = f_string_dynamic_resize(1, &datass.array[0].array[0].home); + status = f_memory_array_resize(1, sizeof(f_char_t), (void **) &datass.array[0].array[0].home.string, &datass.array[0].array[0].home.used, &datass.array[0].array[0].home.size); assert_int_equal(status, F_okay); - status = f_string_dynamic_resize(1, &datass.array[0].array[0].label); + status = f_memory_array_resize(1, sizeof(f_char_t), (void **) &datass.array[0].array[0].label.string, &datass.array[0].array[0].label.used, &datass.array[0].array[0].label.size); assert_int_equal(status, F_okay); - status = f_string_dynamic_resize(1, &datass.array[0].array[0].name); + status = f_memory_array_resize(1, sizeof(f_char_t), (void **) &datass.array[0].array[0].name.string, &datass.array[0].array[0].name.used, &datass.array[0].array[0].name.size); assert_int_equal(status, F_okay); - status = f_string_dynamic_resize(1, &datass.array[0].array[0].password); + status = f_memory_array_resize(1, sizeof(f_char_t), (void **) &datass.array[0].array[0].password.string, &datass.array[0].array[0].password.used, &datass.array[0].array[0].password.size); assert_int_equal(status, F_okay); - status = f_string_dynamic_resize(1, &datass.array[0].array[0].shell); + status = f_memory_array_resize(1, sizeof(f_char_t), (void **) &datass.array[0].array[0].shell.string, &datass.array[0].array[0].shell.used, &datass.array[0].array[0].shell.size); assert_int_equal(status, F_okay); } 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 4566213..3da6379 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 @@ -16,8 +16,8 @@ void test__f_accountss_destroy_callback__fails(void **state) { 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)); + 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 *) datas_array); @@ -25,11 +25,11 @@ void test__f_accountss_destroy_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamic_adjust, true); - will_return(__wrap_f_string_dynamic_adjust, F_status_set_error(F_failure)); + 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 *) datas_array); @@ -37,14 +37,14 @@ void test__f_accountss_destroy_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamic_adjust, true); - will_return(__wrap_f_string_dynamic_adjust, F_status_set_error(F_failure)); + 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 *) datas_array); @@ -52,17 +52,17 @@ void test__f_accountss_destroy_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamic_adjust, true); - will_return(__wrap_f_string_dynamic_adjust, F_status_set_error(F_failure)); + 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 *) datas_array); @@ -70,20 +70,20 @@ void test__f_accountss_destroy_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamic_adjust, true); - will_return(__wrap_f_string_dynamic_adjust, F_status_set_error(F_failure)); + 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 *) datas_array); @@ -91,20 +91,20 @@ void test__f_accountss_destroy_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); will_return(__wrap_f_memory_array_adjust, true); will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); @@ -117,7 +117,7 @@ void test__f_accountss_destroy_callback__fails(void **state) { void test__f_accountss_destroy_callback__works(void **state) { - mock_unwrap = 1; + mock_unwrap = 0; mock_unwrap_f_memory = 1; const f_number_unsigned_t length = 1; @@ -131,19 +131,19 @@ void test__f_accountss_destroy_callback__works(void **state) { status = f_memory_array_resize(1, sizeof(f_account_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size); assert_int_equal(status, F_okay); - status = f_string_dynamic_resize(1, &datass.array[0].array[0].home); + status = f_memory_array_resize(1, sizeof(f_char_t), (void **) &datass.array[0].array[0].home.string, &datass.array[0].array[0].home.used, &datass.array[0].array[0].home.size); assert_int_equal(status, F_okay); - status = f_string_dynamic_resize(1, &datass.array[0].array[0].label); + status = f_memory_array_resize(1, sizeof(f_char_t), (void **) &datass.array[0].array[0].label.string, &datass.array[0].array[0].label.used, &datass.array[0].array[0].label.size); assert_int_equal(status, F_okay); - status = f_string_dynamic_resize(1, &datass.array[0].array[0].name); + status = f_memory_array_resize(1, sizeof(f_char_t), (void **) &datass.array[0].array[0].name.string, &datass.array[0].array[0].name.used, &datass.array[0].array[0].name.size); assert_int_equal(status, F_okay); - status = f_string_dynamic_resize(1, &datass.array[0].array[0].password); + status = f_memory_array_resize(1, sizeof(f_char_t), (void **) &datass.array[0].array[0].password.string, &datass.array[0].array[0].password.used, &datass.array[0].array[0].password.size); assert_int_equal(status, F_okay); - status = f_string_dynamic_resize(1, &datass.array[0].array[0].shell); + status = f_memory_array_resize(1, sizeof(f_char_t), (void **) &datass.array[0].array[0].shell.string, &datass.array[0].array[0].shell.used, &datass.array[0].array[0].shell.size); assert_int_equal(status, F_okay); } diff --git a/level_0/f_capability/tests/unit/c/test-capability-to_name.c b/level_0/f_capability/tests/unit/c/test-capability-to_name.c index 34d61aa..3aba322 100644 --- a/level_0/f_capability/tests/unit/c/test-capability-to_name.c +++ b/level_0/f_capability/tests/unit/c/test-capability-to_name.c @@ -73,7 +73,7 @@ void test__f_capability_to_name__works(void **state) { #endif // defined(_di_libcap_) } - f_string_dynamic_resize(0, &name); + free((void *) name.string); } #ifdef __cplusplus diff --git a/level_0/f_capability/tests/unit/c/test-capability-to_text.c b/level_0/f_capability/tests/unit/c/test-capability-to_text.c index 08855d2..e4c4490 100644 --- a/level_0/f_capability/tests/unit/c/test-capability-to_text.c +++ b/level_0/f_capability/tests/unit/c/test-capability-to_text.c @@ -74,7 +74,7 @@ void test__f_capability_to_text__works(void **state) { #endif // defined(_di_libcap_) } - f_string_dynamic_resize(0, &text); + free((void *) text.string); } #ifdef __cplusplus diff --git a/level_0/f_color/c/color/common.h b/level_0/f_color/c/color/common.h index 94172cf..5f705b1 100644 --- a/level_0/f_color/c/color/common.h +++ b/level_0/f_color/c/color/common.h @@ -966,45 +966,6 @@ extern "C" { macro_f_string_dynamic_t_clear(context.success) \ macro_f_string_dynamic_t_clear(context.title) \ macro_f_string_dynamic_t_clear(context.warning) - - #define macro_f_color_context_t_new(status, context) \ - macro_f_string_dynamic_t_resize(status, context.reset, F_color_max_size_terminated_d) \ - if (F_status_is_error_not(status)) macro_f_string_dynamic_t_resize(status, context.error, F_color_max_size_terminated_d) \ - if (F_status_is_error_not(status)) macro_f_string_dynamic_t_resize(status, context.important, F_color_max_size_terminated_d) \ - if (F_status_is_error_not(status)) macro_f_string_dynamic_t_resize(status, context.normal, F_color_max_size_terminated_d) \ - if (F_status_is_error_not(status)) macro_f_string_dynamic_t_resize(status, context.normal_reset, F_color_max_size_terminated_d) \ - if (F_status_is_error_not(status)) macro_f_string_dynamic_t_resize(status, context.notable, F_color_max_size_terminated_d) \ - if (F_status_is_error_not(status)) macro_f_string_dynamic_t_resize(status, context.reset, F_color_max_size_terminated_d) \ - if (F_status_is_error_not(status)) macro_f_string_dynamic_t_resize(status, context.standout, F_color_max_size_terminated_d) \ - if (F_status_is_error_not(status)) macro_f_string_dynamic_t_resize(status, context.success, F_color_max_size_terminated_d) \ - if (F_status_is_error_not(status)) macro_f_string_dynamic_t_resize(status, context.title, F_color_max_size_terminated_d) \ - if (F_status_is_error_not(status)) macro_f_string_dynamic_t_resize(status, context.warning, F_color_max_size_terminated_d) - - #define macro_f_color_context_t_delete_simple(context) \ - macro_f_string_dynamic_t_delete_simple(context.error) \ - macro_f_string_dynamic_t_delete_simple(context.important) \ - macro_f_string_dynamic_t_delete_simple(context.normal) \ - macro_f_string_dynamic_t_delete_simple(context.normal_reset) \ - macro_f_string_dynamic_t_delete_simple(context.notable) \ - macro_f_string_dynamic_t_delete_simple(context.reset) \ - macro_f_string_dynamic_t_delete_simple(context.standout) \ - macro_f_string_dynamic_t_delete_simple(context.success) \ - macro_f_string_dynamic_t_delete_simple(context.title) \ - macro_f_string_dynamic_t_delete_simple(context.warning) \ - macro_f_color_context_t_clear(context) - - #define macro_f_color_context_t_destroy_simple(context, size) \ - macro_f_string_dynamic_t_destroy_simple(context.error, size) \ - macro_f_string_dynamic_t_destroy_simple(context.important, size) \ - macro_f_string_dynamic_t_destroy_simple(context.normal) \ - macro_f_string_dynamic_t_destroy_simple(context.normal_reset) \ - macro_f_string_dynamic_t_destroy_simple(context.notable, size) \ - macro_f_string_dynamic_t_destroy_simple(context.reset) \ - macro_f_string_dynamic_t_destroy_simple(context.standout, size) \ - macro_f_string_dynamic_t_destroy_simple(context.success, size) \ - macro_f_string_dynamic_t_destroy_simple(context.title, size) \ - macro_f_string_dynamic_t_destroy_simple(context.warning, size) \ - macro_f_color_context_t_clear(context) #endif // _di_f_color_context_t_ /** diff --git a/level_0/f_color/tests/unit/c/test-color-context_delete.c b/level_0/f_color/tests/unit/c/test-color-context_delete.c index 52454dd..4fbbaf3 100644 --- a/level_0/f_color/tests/unit/c/test-color-context_delete.c +++ b/level_0/f_color/tests/unit/c/test-color-context_delete.c @@ -12,7 +12,7 @@ void test__f_color_context_delete__frees_memory(void **state) { f_color_context_t context = f_color_context_t_initialize; { - const f_status_t status = f_string_dynamic_resize(size, &context.reset); + const f_status_t status = f_memory_array_resize(size, sizeof(f_char_t), (void **) &context.reset.string, &context.reset.used, &context.reset.size); assert_int_equal(status, F_okay); assert_int_not_equal(context.reset.size, 0); @@ -20,7 +20,7 @@ void test__f_color_context_delete__frees_memory(void **state) { } { - const f_status_t status = f_string_dynamic_resize(size, &context.warning); + const f_status_t status = f_memory_array_resize(size, sizeof(f_char_t), (void **) &context.warning.string, &context.warning.used, &context.warning.size); assert_int_equal(status, F_okay); assert_int_not_equal(context.warning.size, 0); @@ -28,7 +28,7 @@ void test__f_color_context_delete__frees_memory(void **state) { } { - const f_status_t status = f_string_dynamic_resize(size, &context.error); + const f_status_t status = f_memory_array_resize(size, sizeof(f_char_t), (void **) &context.error.string, &context.error.used, &context.error.size); assert_int_equal(status, F_okay); assert_int_not_equal(context.error.size, 0); @@ -36,7 +36,7 @@ void test__f_color_context_delete__frees_memory(void **state) { } { - const f_status_t status = f_string_dynamic_resize(size, &context.title); + const f_status_t status = f_memory_array_resize(size, sizeof(f_char_t), (void **) &context.title.string, &context.title.used, &context.title.size); assert_int_equal(status, F_okay); assert_int_not_equal(context.title.size, 0); @@ -44,7 +44,7 @@ void test__f_color_context_delete__frees_memory(void **state) { } { - const f_status_t status = f_string_dynamic_resize(size, &context.notable); + const f_status_t status = f_memory_array_resize(size, sizeof(f_char_t), (void **) &context.notable.string, &context.notable.used, &context.notable.size); assert_int_equal(status, F_okay); assert_int_not_equal(context.notable.size, 0); @@ -52,7 +52,7 @@ void test__f_color_context_delete__frees_memory(void **state) { } { - const f_status_t status = f_string_dynamic_resize(size, &context.important); + const f_status_t status = f_memory_array_resize(size, sizeof(f_char_t), (void **) &context.important.string, &context.important.used, &context.important.size); assert_int_equal(status, F_okay); assert_int_not_equal(context.important.size, 0); @@ -60,7 +60,7 @@ void test__f_color_context_delete__frees_memory(void **state) { } { - const f_status_t status = f_string_dynamic_resize(size, &context.standout); + const f_status_t status = f_memory_array_resize(size, sizeof(f_char_t), (void **) &context.standout.string, &context.standout.used, &context.standout.size); assert_int_equal(status, F_okay); assert_int_not_equal(context.standout.size, 0); @@ -68,7 +68,7 @@ void test__f_color_context_delete__frees_memory(void **state) { } { - const f_status_t status = f_string_dynamic_resize(size, &context.success); + const f_status_t status = f_memory_array_resize(size, sizeof(f_char_t), (void **) &context.success.string, &context.success.used, &context.success.size); assert_int_equal(status, F_okay); assert_int_not_equal(context.success.size, 0); @@ -76,7 +76,7 @@ void test__f_color_context_delete__frees_memory(void **state) { } { - const f_status_t status = f_string_dynamic_resize(size, &context.normal); + const f_status_t status = f_memory_array_resize(size, sizeof(f_char_t), (void **) &context.normal.string, &context.normal.used, &context.normal.size); assert_int_equal(status, F_okay); assert_int_not_equal(context.normal.size, 0); @@ -84,7 +84,7 @@ void test__f_color_context_delete__frees_memory(void **state) { } { - const f_status_t status = f_string_dynamic_resize(size, &context.normal_reset); + const f_status_t status = f_memory_array_resize(size, sizeof(f_char_t), (void **) &context.normal_reset.string, &context.normal_reset.used, &context.normal_reset.size); assert_int_equal(status, F_okay); assert_int_not_equal(context.normal_reset.size, 0); diff --git a/level_0/f_color/tests/unit/c/test-color-context_destroy.c b/level_0/f_color/tests/unit/c/test-color-context_destroy.c index c3a5a76..a5e7c35 100644 --- a/level_0/f_color/tests/unit/c/test-color-context_destroy.c +++ b/level_0/f_color/tests/unit/c/test-color-context_destroy.c @@ -12,7 +12,7 @@ void test__f_color_context_destroy__frees_memory(void **state) { f_color_context_t context = f_color_context_t_initialize; { - const f_status_t status = f_string_dynamic_resize(size, &context.reset); + const f_status_t status = f_memory_array_resize(size, sizeof(f_char_t), (void **) &context.reset.string, &context.reset.used, &context.reset.size); assert_int_equal(status, F_okay); assert_int_not_equal(context.reset.size, 0); @@ -20,7 +20,7 @@ void test__f_color_context_destroy__frees_memory(void **state) { } { - const f_status_t status = f_string_dynamic_resize(size, &context.warning); + const f_status_t status = f_memory_array_resize(size, sizeof(f_char_t), (void **) &context.warning.string, &context.warning.used, &context.warning.size); assert_int_equal(status, F_okay); assert_int_not_equal(context.warning.size, 0); @@ -28,7 +28,7 @@ void test__f_color_context_destroy__frees_memory(void **state) { } { - const f_status_t status = f_string_dynamic_resize(size, &context.error); + const f_status_t status = f_memory_array_resize(size, sizeof(f_char_t), (void **) &context.error.string, &context.error.used, &context.error.size); assert_int_equal(status, F_okay); assert_int_not_equal(context.error.size, 0); @@ -36,7 +36,7 @@ void test__f_color_context_destroy__frees_memory(void **state) { } { - const f_status_t status = f_string_dynamic_resize(size, &context.title); + const f_status_t status = f_memory_array_resize(size, sizeof(f_char_t), (void **) &context.title.string, &context.title.used, &context.title.size); assert_int_equal(status, F_okay); assert_int_not_equal(context.title.size, 0); @@ -44,7 +44,7 @@ void test__f_color_context_destroy__frees_memory(void **state) { } { - const f_status_t status = f_string_dynamic_resize(size, &context.notable); + const f_status_t status = f_memory_array_resize(size, sizeof(f_char_t), (void **) &context.notable.string, &context.notable.used, &context.notable.size); assert_int_equal(status, F_okay); assert_int_not_equal(context.notable.size, 0); @@ -52,7 +52,7 @@ void test__f_color_context_destroy__frees_memory(void **state) { } { - const f_status_t status = f_string_dynamic_resize(size, &context.important); + const f_status_t status = f_memory_array_resize(size, sizeof(f_char_t), (void **) &context.important.string, &context.important.used, &context.important.size); assert_int_equal(status, F_okay); assert_int_not_equal(context.important.size, 0); @@ -60,7 +60,7 @@ void test__f_color_context_destroy__frees_memory(void **state) { } { - const f_status_t status = f_string_dynamic_resize(size, &context.standout); + const f_status_t status = f_memory_array_resize(size, sizeof(f_char_t), (void **) &context.standout.string, &context.standout.used, &context.standout.size); assert_int_equal(status, F_okay); assert_int_not_equal(context.standout.size, 0); @@ -68,7 +68,7 @@ void test__f_color_context_destroy__frees_memory(void **state) { } { - const f_status_t status = f_string_dynamic_resize(size, &context.success); + const f_status_t status = f_memory_array_resize(size, sizeof(f_char_t), (void **) &context.success.string, &context.success.used, &context.success.size); assert_int_equal(status, F_okay); assert_int_not_equal(context.success.size, 0); @@ -76,7 +76,7 @@ void test__f_color_context_destroy__frees_memory(void **state) { } { - const f_status_t status = f_string_dynamic_resize(size, &context.normal); + const f_status_t status = f_memory_array_resize(size, sizeof(f_char_t), (void **) &context.normal.string, &context.normal.used, &context.normal.size); assert_int_equal(status, F_okay); assert_int_not_equal(context.normal.size, 0); @@ -84,7 +84,7 @@ void test__f_color_context_destroy__frees_memory(void **state) { } { - const f_status_t status = f_string_dynamic_resize(size, &context.normal_reset); + const f_status_t status = f_memory_array_resize(size, sizeof(f_char_t), (void **) &context.normal_reset.string, &context.normal_reset.used, &context.normal_reset.size); assert_int_equal(status, F_okay); assert_int_not_equal(context.normal_reset.size, 0); diff --git a/level_0/f_color/tests/unit/c/test-color-load_context.c b/level_0/f_color/tests/unit/c/test-color-load_context.c index b32395f..2b76c89 100644 --- a/level_0/f_color/tests/unit/c/test-color-load_context.c +++ b/level_0/f_color/tests/unit/c/test-color-load_context.c @@ -40,9 +40,20 @@ void test__f_color_load_context__works(void **state) { }; { - f_status_t status = F_okay; + f_status_t status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.reset.string, &context.reset.used, &context.reset.size); - macro_f_color_context_t_new(status, context); + + + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.reset.string, &context.reset.used, &context.reset.size); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.error.string, &context.error.used, &context.error.size); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.important.string, &context.important.used, &context.important.size); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.normal.string, &context.normal.used, &context.normal.size); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.normal_reset.string, &context.normal_reset.used, &context.normal_reset.size); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.notable.string, &context.notable.used, &context.notable.size); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.standout.string, &context.standout.used, &context.standout.size); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.success.string, &context.success.used, &context.success.size); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.title.string, &context.title.used, &context.title.size); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.warning.string, &context.warning.used, &context.warning.size); } for (uint8_t i = 0; i < 4; ++i) { @@ -126,7 +137,16 @@ void test__f_color_load_context__works(void **state) { } // for } // for - macro_f_color_context_t_delete_simple(context); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.reset.string, &context.reset.used, &context.reset.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.error.string, &context.error.used, &context.error.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.important.string, &context.important.used, &context.important.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.normal.string, &context.normal.used, &context.normal.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.normal_reset.string, &context.normal_reset.used, &context.normal_reset.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.notable.string, &context.notable.used, &context.notable.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.standout.string, &context.standout.used, &context.standout.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.success.string, &context.success.used, &context.success.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.title.string, &context.title.used, &context.title.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.warning.string, &context.warning.used, &context.warning.size); } #ifdef __cplusplus diff --git a/level_0/f_color/tests/unit/c/test-color-save_1.c b/level_0/f_color/tests/unit/c/test-color-save_1.c index 9cebbdf..40fdb1d 100644 --- a/level_0/f_color/tests/unit/c/test-color-save_1.c +++ b/level_0/f_color/tests/unit/c/test-color-save_1.c @@ -25,9 +25,18 @@ void test__f_color_save_1_works(void **state) { const f_string_static_t color1 = macro_f_string_static_t_initialize_2("color1", 6); { - f_status_t status = F_okay; + f_status_t status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.reset.string, &context.reset.used, &context.reset.size); - macro_f_color_context_t_new(status, context); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.reset.string, &context.reset.used, &context.reset.size); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.error.string, &context.error.used, &context.error.size); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.important.string, &context.important.used, &context.important.size); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.normal.string, &context.normal.used, &context.normal.size); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.normal_reset.string, &context.normal_reset.used, &context.normal_reset.size); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.notable.string, &context.notable.used, &context.notable.size); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.standout.string, &context.standout.used, &context.standout.size); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.success.string, &context.success.used, &context.success.size); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.title.string, &context.title.used, &context.title.size); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.warning.string, &context.warning.used, &context.warning.size); } { @@ -37,9 +46,18 @@ void test__f_color_save_1_works(void **state) { assert_string_equal(buffer.string, "color1"); } - macro_f_color_context_t_delete_simple(context); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.reset.string, &context.reset.used, &context.reset.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.error.string, &context.error.used, &context.error.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.important.string, &context.important.used, &context.important.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.normal.string, &context.normal.used, &context.normal.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.normal_reset.string, &context.normal_reset.used, &context.normal_reset.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.notable.string, &context.notable.used, &context.notable.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.standout.string, &context.standout.used, &context.standout.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.success.string, &context.success.used, &context.success.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.title.string, &context.title.used, &context.title.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.warning.string, &context.warning.used, &context.warning.size); - f_string_dynamic_resize(0, &buffer); + free((void *) buffer.string); } #ifdef __cplusplus diff --git a/level_0/f_color/tests/unit/c/test-color-save_2.c b/level_0/f_color/tests/unit/c/test-color-save_2.c index ffbe2d7..25c3bb5 100644 --- a/level_0/f_color/tests/unit/c/test-color-save_2.c +++ b/level_0/f_color/tests/unit/c/test-color-save_2.c @@ -26,9 +26,18 @@ void test__f_color_save_2_works(void **state) { const f_string_static_t color2 = macro_f_string_static_t_initialize_2("color2", 6); { - f_status_t status = F_okay; + f_status_t status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.reset.string, &context.reset.used, &context.reset.size); - macro_f_color_context_t_new(status, context); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.reset.string, &context.reset.used, &context.reset.size); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.error.string, &context.error.used, &context.error.size); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.important.string, &context.important.used, &context.important.size); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.normal.string, &context.normal.used, &context.normal.size); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.normal_reset.string, &context.normal_reset.used, &context.normal_reset.size); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.notable.string, &context.notable.used, &context.notable.size); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.standout.string, &context.standout.used, &context.standout.size); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.success.string, &context.success.used, &context.success.size); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.title.string, &context.title.used, &context.title.size); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.warning.string, &context.warning.used, &context.warning.size); } { @@ -38,9 +47,18 @@ void test__f_color_save_2_works(void **state) { assert_string_equal(buffer.string, "color1color2"); } - macro_f_color_context_t_delete_simple(context); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.reset.string, &context.reset.used, &context.reset.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.error.string, &context.error.used, &context.error.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.important.string, &context.important.used, &context.important.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.normal.string, &context.normal.used, &context.normal.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.normal_reset.string, &context.normal_reset.used, &context.normal_reset.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.notable.string, &context.notable.used, &context.notable.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.standout.string, &context.standout.used, &context.standout.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.success.string, &context.success.used, &context.success.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.title.string, &context.title.used, &context.title.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.warning.string, &context.warning.used, &context.warning.size); - f_string_dynamic_resize(0, &buffer); + free((void *) buffer.string); } #ifdef __cplusplus diff --git a/level_0/f_color/tests/unit/c/test-color-save_3.c b/level_0/f_color/tests/unit/c/test-color-save_3.c index 95ab609..1c782fd 100644 --- a/level_0/f_color/tests/unit/c/test-color-save_3.c +++ b/level_0/f_color/tests/unit/c/test-color-save_3.c @@ -27,9 +27,18 @@ void test__f_color_save_3_works(void **state) { const f_string_static_t color3 = macro_f_string_static_t_initialize_2("color3", 6); { - f_status_t status = F_okay; + f_status_t status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.reset.string, &context.reset.used, &context.reset.size); - macro_f_color_context_t_new(status, context); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.reset.string, &context.reset.used, &context.reset.size); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.error.string, &context.error.used, &context.error.size); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.important.string, &context.important.used, &context.important.size); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.normal.string, &context.normal.used, &context.normal.size); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.normal_reset.string, &context.normal_reset.used, &context.normal_reset.size); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.notable.string, &context.notable.used, &context.notable.size); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.standout.string, &context.standout.used, &context.standout.size); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.success.string, &context.success.used, &context.success.size); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.title.string, &context.title.used, &context.title.size); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.warning.string, &context.warning.used, &context.warning.size); } { @@ -39,9 +48,18 @@ void test__f_color_save_3_works(void **state) { assert_string_equal(buffer.string, "color1color2color3"); } - macro_f_color_context_t_delete_simple(context); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.reset.string, &context.reset.used, &context.reset.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.error.string, &context.error.used, &context.error.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.important.string, &context.important.used, &context.important.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.normal.string, &context.normal.used, &context.normal.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.normal_reset.string, &context.normal_reset.used, &context.normal_reset.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.notable.string, &context.notable.used, &context.notable.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.standout.string, &context.standout.used, &context.standout.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.success.string, &context.success.used, &context.success.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.title.string, &context.title.used, &context.title.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.warning.string, &context.warning.used, &context.warning.size); - f_string_dynamic_resize(0, &buffer); + free((void *) buffer.string); } #ifdef __cplusplus diff --git a/level_0/f_color/tests/unit/c/test-color-save_4.c b/level_0/f_color/tests/unit/c/test-color-save_4.c index 48438ae..439373b 100644 --- a/level_0/f_color/tests/unit/c/test-color-save_4.c +++ b/level_0/f_color/tests/unit/c/test-color-save_4.c @@ -28,9 +28,18 @@ void test__f_color_save_4_works(void **state) { const f_string_static_t color4 = macro_f_string_static_t_initialize_2("color4", 6); { - f_status_t status = F_okay; + f_status_t status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.reset.string, &context.reset.used, &context.reset.size); - macro_f_color_context_t_new(status, context); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.reset.string, &context.reset.used, &context.reset.size); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.error.string, &context.error.used, &context.error.size); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.important.string, &context.important.used, &context.important.size); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.normal.string, &context.normal.used, &context.normal.size); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.normal_reset.string, &context.normal_reset.used, &context.normal_reset.size); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.notable.string, &context.notable.used, &context.notable.size); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.standout.string, &context.standout.used, &context.standout.size); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.success.string, &context.success.used, &context.success.size); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.title.string, &context.title.used, &context.title.size); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.warning.string, &context.warning.used, &context.warning.size); } { @@ -40,9 +49,18 @@ void test__f_color_save_4_works(void **state) { assert_string_equal(buffer.string, "color1color2color3color4"); } - macro_f_color_context_t_delete_simple(context); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.reset.string, &context.reset.used, &context.reset.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.error.string, &context.error.used, &context.error.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.important.string, &context.important.used, &context.important.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.normal.string, &context.normal.used, &context.normal.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.normal_reset.string, &context.normal_reset.used, &context.normal_reset.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.notable.string, &context.notable.used, &context.notable.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.standout.string, &context.standout.used, &context.standout.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.success.string, &context.success.used, &context.success.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.title.string, &context.title.used, &context.title.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.warning.string, &context.warning.used, &context.warning.size); - f_string_dynamic_resize(0, &buffer); + free((void *) buffer.string); } #ifdef __cplusplus diff --git a/level_0/f_color/tests/unit/c/test-color-save_5.c b/level_0/f_color/tests/unit/c/test-color-save_5.c index 7ad6d33..791cb95 100644 --- a/level_0/f_color/tests/unit/c/test-color-save_5.c +++ b/level_0/f_color/tests/unit/c/test-color-save_5.c @@ -29,9 +29,18 @@ void test__f_color_save_5_works(void **state) { const f_string_static_t color5 = macro_f_string_static_t_initialize_2("color5", 6); { - f_status_t status = F_okay; + f_status_t status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.reset.string, &context.reset.used, &context.reset.size); - macro_f_color_context_t_new(status, context); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.reset.string, &context.reset.used, &context.reset.size); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.error.string, &context.error.used, &context.error.size); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.important.string, &context.important.used, &context.important.size); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.normal.string, &context.normal.used, &context.normal.size); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.normal_reset.string, &context.normal_reset.used, &context.normal_reset.size); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.notable.string, &context.notable.used, &context.notable.size); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.standout.string, &context.standout.used, &context.standout.size); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.success.string, &context.success.used, &context.success.size); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.title.string, &context.title.used, &context.title.size); + if (F_status_is_error_not(status)) status = f_memory_array_resize(F_color_max_size_terminated_d, sizeof(f_char_t), (void **) &context.warning.string, &context.warning.used, &context.warning.size); } { @@ -41,9 +50,18 @@ void test__f_color_save_5_works(void **state) { assert_string_equal(buffer.string, "color1color2color3color4color5"); } - macro_f_color_context_t_delete_simple(context); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.reset.string, &context.reset.used, &context.reset.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.error.string, &context.error.used, &context.error.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.important.string, &context.important.used, &context.important.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.normal.string, &context.normal.used, &context.normal.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.normal_reset.string, &context.normal_reset.used, &context.normal_reset.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.notable.string, &context.notable.used, &context.notable.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.standout.string, &context.standout.used, &context.standout.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.success.string, &context.success.used, &context.success.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.title.string, &context.title.used, &context.title.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &context.warning.string, &context.warning.used, &context.warning.size); - f_string_dynamic_resize(0, &buffer); + free((void *) buffer.string); } #ifdef __cplusplus diff --git a/level_0/f_console/c/console/common.c b/level_0/f_console/c/console/common.c index 36967fb..c7646c5 100644 --- a/level_0/f_console/c/console/common.c +++ b/level_0/f_console/c/console/common.c @@ -170,25 +170,27 @@ extern "C" { if (!parameters) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - f_status_t status = F_okay; + { + f_status_t status = F_okay; - for (f_number_unsigned_t i = 0; i < parameters->used; ++i) { + for (f_number_unsigned_t i = 0; i < parameters->used; ++i) { - status = f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) ¶meters->array[i].locations.array, ¶meters->array[i].locations.used, ¶meters->array[i].locations.size); - if (F_status_is_error(status)) return status; + status = f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) ¶meters->array[i].locations.array, ¶meters->array[i].locations.used, ¶meters->array[i].locations.size); + if (F_status_is_error(status)) return status; - status = f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) ¶meters->array[i].locations_sub.array, ¶meters->array[i].locations_sub.used, ¶meters->array[i].locations_sub.size); - if (F_status_is_error(status)) return status; + status = f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) ¶meters->array[i].locations_sub.array, ¶meters->array[i].locations_sub.used, ¶meters->array[i].locations_sub.size); + if (F_status_is_error(status)) return status; - status = f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) ¶meters->array[i].values.array, ¶meters->array[i].values.used, ¶meters->array[i].values.size); - if (F_status_is_error(status)) return status; - } // for + status = f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) ¶meters->array[i].values.array, ¶meters->array[i].values.used, ¶meters->array[i].values.size); + if (F_status_is_error(status)) return status; + } // for - status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) ¶meters->arguments.array, ¶meters->arguments.used, ¶meters->arguments.size, &f_string_dynamics_delete_callback); - if (F_status_is_error(status)) return status; + status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) ¶meters->arguments.array, ¶meters->arguments.used, ¶meters->arguments.size, &f_string_dynamics_delete_callback); + if (F_status_is_error(status)) return status; - status = f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) ¶meters->remaining.array, ¶meters->remaining.used, ¶meters->remaining.size); - if (F_status_is_error(status)) return status; + status = f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) ¶meters->remaining.array, ¶meters->remaining.used, ¶meters->remaining.size); + if (F_status_is_error(status)) return status; + } return F_okay; } @@ -200,26 +202,28 @@ extern "C" { if (!parameters) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - f_status_t status = F_okay; + { + f_status_t status = F_okay; - for (f_number_unsigned_t i = 0; i < parameters->used; ++i) { + for (f_number_unsigned_t i = 0; i < parameters->used; ++i) { - status = f_memory_array_adjust(0, sizeof(f_number_unsigned_t), (void **) ¶meters->array[i].locations.array, ¶meters->array[i].locations.used, ¶meters->array[i].locations.size); - if (F_status_is_error(status)) return status; + status = f_memory_array_adjust(0, sizeof(f_number_unsigned_t), (void **) ¶meters->array[i].locations.array, ¶meters->array[i].locations.used, ¶meters->array[i].locations.size); + if (F_status_is_error(status)) return status; - status = f_memory_array_adjust(0, sizeof(f_number_unsigned_t), (void **) ¶meters->array[i].locations_sub.array, ¶meters->array[i].locations_sub.used, ¶meters->array[i].locations_sub.size); - if (F_status_is_error(status)) return status; + status = f_memory_array_adjust(0, sizeof(f_number_unsigned_t), (void **) ¶meters->array[i].locations_sub.array, ¶meters->array[i].locations_sub.used, ¶meters->array[i].locations_sub.size); + if (F_status_is_error(status)) return status; - status = f_memory_array_adjust(0, sizeof(f_number_unsigned_t), (void **) ¶meters->array[i].values.array, ¶meters->array[i].values.used, ¶meters->array[i].values.size); - if (F_status_is_error(status)) return status; - } // for + status = f_memory_array_adjust(0, sizeof(f_number_unsigned_t), (void **) ¶meters->array[i].values.array, ¶meters->array[i].values.used, ¶meters->array[i].values.size); + if (F_status_is_error(status)) return status; + } // for - status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) ¶meters->arguments.array, ¶meters->arguments.used, ¶meters->arguments.size, &f_string_dynamics_destroy_callback); - if (F_status_is_error(status)) return status; + status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) ¶meters->arguments.array, ¶meters->arguments.used, ¶meters->arguments.size, &f_string_dynamics_destroy_callback); + if (F_status_is_error(status)) return status; - status = f_memory_array_adjust(0, sizeof(f_number_unsigned_t), (void **) ¶meters->remaining.array, ¶meters->remaining.used, ¶meters->remaining.size); - if (F_status_is_error(status)) return status; + status = f_memory_array_adjust(0, sizeof(f_number_unsigned_t), (void **) ¶meters->remaining.array, ¶meters->remaining.used, ¶meters->remaining.size); + if (F_status_is_error(status)) return status; + } return F_okay; } diff --git a/level_0/f_console/c/private-console.c b/level_0/f_console/c/private-console.c index 091788c..c5d32b0 100644 --- a/level_0/f_console/c/private-console.c +++ b/level_0/f_console/c/private-console.c @@ -12,47 +12,50 @@ extern "C" { if (!input) return F_data_not; - // Only the first three characters need to be scanned. - const f_number_unsigned_t length = strnlen(input, 3); - if (!length) return F_data_not; + { - if (input[0] == f_console_symbol_short_normal_s.string[0]) { - *result = f_console_result_found_e | f_console_result_normal_e; + // Only the first three characters need to be scanned. + const f_number_unsigned_t length = strnlen(input, 3); + if (!length) return F_data_not; - if (length > 1) { - if (input[1] == f_console_symbol_short_normal_s.string[0]) { - *result |= f_console_result_long_e; + if (input[0] == f_console_symbol_short_normal_s.string[0]) { + *result = f_console_result_found_e | f_console_result_normal_e; - if (length < 3) { - *result |= f_console_result_alone_e; + if (length > 1) { + if (input[1] == f_console_symbol_short_normal_s.string[0]) { + *result |= f_console_result_long_e; + + if (length < 3) { + *result |= f_console_result_alone_e; + } + } + else { + *result |= f_console_result_short_e; } } else { - *result |= f_console_result_short_e; + *result |= f_console_result_short_e | f_console_result_alone_e; } } - else { - *result |= f_console_result_short_e | f_console_result_alone_e; - } - } - else if (input[0] == f_console_symbol_short_inverse_s.string[0]) { - *result = f_console_result_found_e | f_console_result_inverse_e; + else if (input[0] == f_console_symbol_short_inverse_s.string[0]) { + *result = f_console_result_found_e | f_console_result_inverse_e; - if (length > 1) { - if (input[1] == f_console_symbol_short_inverse_s.string[0]) { - *result |= f_console_result_long_e; + if (length > 1) { + if (input[1] == f_console_symbol_short_inverse_s.string[0]) { + *result |= f_console_result_long_e; - if (length < 3) { - *result |= f_console_result_alone_e; + if (length < 3) { + *result |= f_console_result_alone_e; + } + } + else { + *result |= f_console_result_short_e; } } else { - *result |= f_console_result_short_e; + *result |= f_console_result_short_e | f_console_result_alone_e; } } - else { - *result |= f_console_result_short_e | f_console_result_alone_e; - } } return F_okay; diff --git a/level_0/f_console/tests/unit/c/test-console-parameters_delete.c b/level_0/f_console/tests/unit/c/test-console-parameters_delete.c index 9f65011..79efb63 100644 --- a/level_0/f_console/tests/unit/c/test-console-parameters_delete.c +++ b/level_0/f_console/tests/unit/c/test-console-parameters_delete.c @@ -17,7 +17,7 @@ void test__f_console_parameters_delete__frees_memory(void **state) { parameters.used = 1; { - const f_status_t status = f_string_dynamics_resize(size, ¶meters.arguments); + const f_status_t status = f_memory_arrays_resize(size, sizeof(f_string_dynamic_t), (void **) ¶meters.arguments.array, ¶meters.arguments.used, ¶meters.arguments.size, &f_string_dynamics_delete_callback); assert_int_equal(status, F_okay); assert_int_not_equal(parameters.arguments.size, 0); diff --git a/level_0/f_console/tests/unit/c/test-console-parameters_destroy.c b/level_0/f_console/tests/unit/c/test-console-parameters_destroy.c index 90286ac..ab4e8c1 100644 --- a/level_0/f_console/tests/unit/c/test-console-parameters_destroy.c +++ b/level_0/f_console/tests/unit/c/test-console-parameters_destroy.c @@ -17,7 +17,7 @@ void test__f_console_parameters_destroy__frees_memory(void **state) { parameters.used = 1; { - const f_status_t status = f_string_dynamics_resize(size, ¶meters.arguments); + const f_status_t status = f_memory_arrays_resize(size, sizeof(f_string_dynamic_t), (void **) ¶meters.arguments.array, ¶meters.arguments.used, ¶meters.arguments.size, &f_string_dynamics_delete_callback); assert_int_equal(status, F_okay); assert_int_not_equal(parameters.arguments.size, 0); diff --git a/level_0/f_control_group/c/control_group.c b/level_0/f_control_group/c/control_group.c index 26ddce0..ea4f911 100644 --- a/level_0/f_control_group/c/control_group.c +++ b/level_0/f_control_group/c/control_group.c @@ -14,16 +14,18 @@ extern "C" { destination->path.used = 0; destination->groups.used = 0; - f_status_t status = F_okay; - - if (source.path.used) { - status = f_string_dynamic_append(source.path, &destination->path); - if (F_status_is_error(status)) return status; - } - - if (source.groups.used) { - status = f_string_dynamics_append_all(source.groups, &destination->groups); - if (F_status_is_error(status)) return status; + { + f_status_t status = F_okay; + + if (source.path.used) { + status = f_string_dynamic_append(source.path, &destination->path); + if (F_status_is_error(status)) return status; + } + + if (source.groups.used) { + status = f_string_dynamics_append_all(source.groups, &destination->groups); + if (F_status_is_error(status)) return status; + } } return F_okay; diff --git a/level_0/f_control_group/c/control_group/common.h b/level_0/f_control_group/c/control_group/common.h index 61de4fb..14eeb01 100644 --- a/level_0/f_control_group/c/control_group/common.h +++ b/level_0/f_control_group/c/control_group/common.h @@ -72,14 +72,6 @@ extern "C" { control.as_new = F_false; \ macro_f_string_dynamic_t_clear(control.path); \ macro_f_string_dynamics_t_clear(control.groups); - - #define macro_f_control_group_t_delete_simple(control) \ - macro_f_string_dynamic_t_delete_simple(control.path); \ - macro_f_string_dynamics_t_delete_simple(control.groups); - - #define macro_f_control_group_t_destroy_simple(control) \ - macro_f_string_dynamic_t_destroy_simple(control.path); \ - macro_f_string_dynamics_t_destroy_simple(control.groups); #endif // _di_f_control_group_t_ #ifdef __cplusplus diff --git a/level_0/f_control_group/tests/unit/c/test-control_group-copy.c b/level_0/f_control_group/tests/unit/c/test-control_group-copy.c index a0d094a..560be81 100644 --- a/level_0/f_control_group/tests/unit/c/test-control_group-copy.c +++ b/level_0/f_control_group/tests/unit/c/test-control_group-copy.c @@ -29,7 +29,8 @@ void test__f_control_group_copy__works(void **state) { assert_int_equal(status, F_okay); - macro_f_control_group_t_delete_simple(destination); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &destination.path.string, &destination.path.used, &destination.path.size); + f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &destination.groups.array, &destination.groups.used, &destination.groups.size, &f_string_dynamics_delete_callback); assert_int_equal(destination.as_new, source.as_new); @@ -60,7 +61,8 @@ void test__f_control_group_copy__works(void **state) { assert_null(destination.groups.array); assert_int_equal(destination.groups.used, 0); - macro_f_control_group_t_delete_simple(destination); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &destination.path.string, &destination.path.used, &destination.path.size); + f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &destination.groups.array, &destination.groups.used, &destination.groups.size, &f_string_dynamics_delete_callback); } { @@ -106,7 +108,8 @@ void test__f_control_group_copy__works(void **state) { assert_int_equal(destination.groups.array[0].used, source.groups.array[0].used); assert_int_equal(destination.groups.array[1].used, source.groups.array[1].used); - macro_f_control_group_t_delete_simple(destination); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &destination.path.string, &destination.path.used, &destination.path.size); + f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &destination.groups.array, &destination.groups.used, &destination.groups.size, &f_string_dynamics_delete_callback); } { @@ -159,7 +162,8 @@ void test__f_control_group_copy__works(void **state) { assert_int_equal(destination.groups.array[1].used, source.groups.array[1].used); assert_int_equal(destination.groups.array[2].used, source.groups.array[2].used); - macro_f_control_group_t_delete_simple(destination); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &destination.path.string, &destination.path.used, &destination.path.size); + f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &destination.groups.array, &destination.groups.used, &destination.groups.size, &f_string_dynamics_delete_callback); } } diff --git a/level_0/f_conversion/tests/unit/c/test-conversion-number_signed_to_string.c b/level_0/f_conversion/tests/unit/c/test-conversion-number_signed_to_string.c index 0950ca4..a6e4473 100644 --- a/level_0/f_conversion/tests/unit/c/test-conversion-number_signed_to_string.c +++ b/level_0/f_conversion/tests/unit/c/test-conversion-number_signed_to_string.c @@ -38,7 +38,7 @@ void test__f_conversion_number_signed_to_string__works(void **state) { assert_string_equal(destination.string, "1"); } - f_string_dynamic_resize(0, &destination); + free((void *) destination.string); } void test__f_conversion_number_signed_to_string__works_for_prepend(void **state) { @@ -162,7 +162,7 @@ void test__f_conversion_number_signed_to_string__works_for_prepend(void **state) assert_string_equal(destination.string, "0X1"); } - f_string_dynamic_resize(0, &destination); + free((void *) destination.string); } void test__f_conversion_number_signed_to_string__works_for_zero(void **state) { @@ -286,7 +286,7 @@ void test__f_conversion_number_signed_to_string__works_for_zero(void **state) { assert_string_equal(destination.string, " 00"); } - f_string_dynamic_resize(0, &destination); + free((void *) destination.string); } #ifdef __cplusplus diff --git a/level_0/f_conversion/tests/unit/c/test-conversion-number_unsigned_to_string.c b/level_0/f_conversion/tests/unit/c/test-conversion-number_unsigned_to_string.c index 168a69a..2c54e52 100644 --- a/level_0/f_conversion/tests/unit/c/test-conversion-number_unsigned_to_string.c +++ b/level_0/f_conversion/tests/unit/c/test-conversion-number_unsigned_to_string.c @@ -38,7 +38,7 @@ void test__f_conversion_number_unsigned_to_string__works(void **state) { assert_string_equal(destination.string, "1"); } - f_string_dynamic_resize(0, &destination); + free((void *) destination.string); } void test__f_conversion_number_unsigned_to_string__works_for_prepend(void **state) { @@ -162,7 +162,7 @@ void test__f_conversion_number_unsigned_to_string__works_for_prepend(void **stat assert_string_equal(destination.string, "0X1"); } - f_string_dynamic_resize(0, &destination); + free((void *) destination.string); } void test__f_conversion_number_unsigned_to_string__works_for_zero(void **state) { @@ -286,7 +286,7 @@ void test__f_conversion_number_unsigned_to_string__works_for_zero(void **state) assert_string_equal(destination.string, " 00"); } - f_string_dynamic_resize(0, &destination); + free((void *) destination.string); } #ifdef __cplusplus diff --git a/level_0/f_directory/data/build/settings-mocks b/level_0/f_directory/data/build/settings-mocks index 285772d..475e9df 100644 --- a/level_0/f_directory/data/build/settings-mocks +++ b/level_0/f_directory/data/build/settings-mocks @@ -65,10 +65,8 @@ 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 -flags -Wl,--wrap=f_string_dynamics_resize +flags -Wl,--wrap=f_memory_arrays_adjust +flags -Wl,--wrap=f_memory_arrays_resize flags -Wl,--wrap=alphasort flags -Wl,--wrap=fstatat flags -Wl,--wrap=mkdir 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 fa8be2d..6c58d0b 100644 --- a/level_0/f_directory/tests/unit/c/mock-directory.c +++ b/level_0/f_directory/tests/unit/c/mock-directory.c @@ -41,70 +41,36 @@ 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_string_dynamic_adjust(const f_number_unsigned_t length, f_string_dynamic_t * const structure) { +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) { - 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_dynamics_adjust(const f_number_unsigned_t length, f_string_dynamics_t * const structure) { - - if (mock_unwrap) { - return __real_f_string_dynamics_adjust(length, structure); + if (mock_unwrap_f_memory) { + return __real_f_memory_arrays_resize(length, width, array, used, size, callback); } - if (!structure) return F_status_set_error(F_parameter_not); + 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); - structure->size = length; + *size = length; return mock_type(f_status_t); } -f_status_t __wrap_f_string_dynamics_resize(const f_number_unsigned_t length, f_string_dynamics_t * const structure) { +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) { - return __real_f_string_dynamics_resize(length, structure); + if (mock_unwrap_f_memory) { + return __real_f_memory_arrays_resize(length, width, array, used, size, callback); } - if (!structure) return F_status_set_error(F_parameter_not); + 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); - structure->size = length; + *size = length; return mock_type(f_status_t); } 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 8671401..e63aedb 100644 --- a/level_0/f_directory/tests/unit/c/mock-directory.h +++ b/level_0/f_directory/tests/unit/c/mock-directory.h @@ -33,19 +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 __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 __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 __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); -extern f_status_t __wrap_f_string_dynamics_resize(const f_number_unsigned_t length, f_string_dynamics_t * const structure); +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_alphasort(const struct dirent **a, const struct dirent **b); extern int __wrap_fstatat(int dirfd, const char *pathname, struct stat *statbuf, int flags); diff --git a/level_0/f_directory/tests/unit/c/test-directory-list.c b/level_0/f_directory/tests/unit/c/test-directory-list.c index 861de6a..379747e 100644 --- a/level_0/f_directory/tests/unit/c/test-directory-list.c +++ b/level_0/f_directory/tests/unit/c/test-directory-list.c @@ -34,7 +34,7 @@ void test__f_directory_list__fails(void **state) { } // for } - f_string_dynamics_resize(0, &names); + f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &names.array, &names.used, &names.size, &f_string_dynamics_delete_callback); } void test__f_directory_list__parameter_checking(void **state) { @@ -58,7 +58,7 @@ void test__f_directory_list__returns_data_not(void **state) { assert_int_equal(status, F_data_not); } - f_string_dynamics_resize(0, &names); + f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &names.array, &names.used, &names.size, &f_string_dynamics_delete_callback); } void test__f_directory_list__returns_directory_empty(void **state) { @@ -81,7 +81,7 @@ void test__f_directory_list__returns_directory_empty(void **state) { assert_int_equal(status, F_directory_empty); } - f_string_dynamics_resize(0, &names); + f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &names.array, &names.used, &names.size, &f_string_dynamics_delete_callback); } void test__f_directory_list__works(void **state) { @@ -109,7 +109,7 @@ void test__f_directory_list__works(void **state) { assert_int_equal(status, F_okay); } - f_string_dynamics_resize(0, &names); + f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &names.array, &names.used, &names.size, &f_string_dynamics_delete_callback); } #ifdef __cplusplus 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 27f397d..4d6b942 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 @@ -8,6 +8,7 @@ extern "C" { void test__f_directory_listings_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 }; @@ -15,8 +16,8 @@ void test__f_directory_listings_delete_callback__fails(void **state) { 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)); + 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_directory_listings_delete_callback(0, 1, (void *) datas_array); @@ -24,11 +25,11 @@ void test__f_directory_listings_delete_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - 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_memory_arrays_resize, true); + will_return(__wrap_f_memory_arrays_resize, F_status_set_error(F_failure)); const f_status_t status = f_directory_listings_delete_callback(0, 1, (void *) datas_array); @@ -36,14 +37,14 @@ void test__f_directory_listings_delete_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - 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_memory_arrays_resize, true); + will_return(__wrap_f_memory_arrays_resize, F_status_set_error(F_failure)); const f_status_t status = f_directory_listings_delete_callback(0, 1, (void *) datas_array); @@ -51,17 +52,17 @@ void test__f_directory_listings_delete_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - 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_memory_arrays_resize, true); + will_return(__wrap_f_memory_arrays_resize, F_status_set_error(F_failure)); const f_status_t status = f_directory_listings_delete_callback(0, 1, (void *) datas_array); @@ -69,20 +70,20 @@ void test__f_directory_listings_delete_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - 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_memory_arrays_resize, true); + will_return(__wrap_f_memory_arrays_resize, F_status_set_error(F_failure)); const f_status_t status = f_directory_listings_delete_callback(0, 1, (void *) datas_array); @@ -90,23 +91,23 @@ void test__f_directory_listings_delete_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - 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_memory_arrays_resize, true); + will_return(__wrap_f_memory_arrays_resize, F_status_set_error(F_failure)); const f_status_t status = f_directory_listings_delete_callback(0, 1, (void *) datas_array); @@ -114,26 +115,26 @@ void test__f_directory_listings_delete_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - 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_memory_arrays_resize, true); + will_return(__wrap_f_memory_arrays_resize, F_status_set_error(F_failure)); const f_status_t status = f_directory_listings_delete_callback(0, 1, (void *) datas_array); @@ -141,29 +142,29 @@ void test__f_directory_listings_delete_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - 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_memory_arrays_resize, true); + will_return(__wrap_f_memory_arrays_resize, F_status_set_error(F_failure)); const f_status_t status = f_directory_listings_delete_callback(0, 1, (void *) datas_array); @@ -174,42 +175,56 @@ void test__f_directory_listings_delete_callback__fails(void **state) { void test__f_directory_listings_delete_callback__works(void **state) { mock_unwrap = 0; + mock_unwrap_f_memory = 1; - 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 }; const f_number_unsigned_t length = 1; + f_directory_listings_t datas = f_directory_listings_t_initialize; + { - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + f_status_t status = f_memory_array_resize(length, sizeof(f_directory_listing_t), (void **) &datas.array, &datas.used, &datas.size); + assert_int_equal(status, F_okay); + + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datas.array[0].block.array, &datas.array[0].block.used, &datas.array[0].block.size, &f_string_dynamics_delete_callback); + assert_int_equal(status, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datas.array[0].character.array, &datas.array[0].character.used, &datas.array[0].character.size, &f_string_dynamics_delete_callback); + assert_int_equal(status, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datas.array[0].directory.array, &datas.array[0].directory.used, &datas.array[0].directory.size, &f_string_dynamics_delete_callback); + assert_int_equal(status, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datas.array[0].regular.array, &datas.array[0].regular.used, &datas.array[0].regular.size, &f_string_dynamics_delete_callback); + assert_int_equal(status, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datas.array[0].link.array, &datas.array[0].link.used, &datas.array[0].link.size, &f_string_dynamics_delete_callback); + assert_int_equal(status, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datas.array[0].fifo.array, &datas.array[0].fifo.used, &datas.array[0].fifo.size, &f_string_dynamics_delete_callback); + assert_int_equal(status, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datas.array[0].socket.array, &datas.array[0].socket.used, &datas.array[0].socket.size, &f_string_dynamics_delete_callback); + assert_int_equal(status, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datas.array[0].unknown.array, &datas.array[0].unknown.used, &datas.array[0].unknown.size, &f_string_dynamics_delete_callback); + assert_int_equal(status, F_okay); + } - const f_status_t status = f_directory_listings_delete_callback(0, length, (void *) datas_array); + { + const f_status_t status = f_directory_listings_delete_callback(0, length, (void *) datas.array); assert_int_equal(status, F_okay); + assert_int_equal(datas.array[0].block.size, 0); + assert_int_equal(datas.array[0].character.size, 0); + assert_int_equal(datas.array[0].directory.size, 0); + assert_int_equal(datas.array[0].regular.size, 0); + assert_int_equal(datas.array[0].link.size, 0); + assert_int_equal(datas.array[0].fifo.size, 0); + assert_int_equal(datas.array[0].socket.size, 0); + assert_int_equal(datas.array[0].unknown.size, 0); } + + free((void *) datas.array); } #ifdef __cplusplus 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 6bb2777..641b5bf 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 @@ -8,6 +8,7 @@ extern "C" { void test__f_directory_listings_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 }; @@ -15,8 +16,8 @@ void test__f_directory_listings_destroy_callback__fails(void **state) { 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)); + 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_directory_listings_destroy_callback(0, 1, (void *) datas_array); @@ -24,11 +25,11 @@ void test__f_directory_listings_destroy_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - 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_memory_arrays_adjust, true); + will_return(__wrap_f_memory_arrays_adjust, F_status_set_error(F_failure)); const f_status_t status = f_directory_listings_destroy_callback(0, 1, (void *) datas_array); @@ -36,14 +37,14 @@ void test__f_directory_listings_destroy_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - 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_memory_arrays_adjust, true); + will_return(__wrap_f_memory_arrays_adjust, F_status_set_error(F_failure)); const f_status_t status = f_directory_listings_destroy_callback(0, 1, (void *) datas_array); @@ -51,17 +52,17 @@ void test__f_directory_listings_destroy_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - 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_memory_arrays_adjust, true); + will_return(__wrap_f_memory_arrays_adjust, F_status_set_error(F_failure)); const f_status_t status = f_directory_listings_destroy_callback(0, 1, (void *) datas_array); @@ -69,20 +70,20 @@ void test__f_directory_listings_destroy_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - 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_memory_arrays_adjust, true); + will_return(__wrap_f_memory_arrays_adjust, F_status_set_error(F_failure)); const f_status_t status = f_directory_listings_destroy_callback(0, 1, (void *) datas_array); @@ -90,23 +91,23 @@ void test__f_directory_listings_destroy_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - 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_memory_arrays_adjust, true); + will_return(__wrap_f_memory_arrays_adjust, F_status_set_error(F_failure)); const f_status_t status = f_directory_listings_destroy_callback(0, 1, (void *) datas_array); @@ -114,26 +115,26 @@ void test__f_directory_listings_destroy_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - 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_memory_arrays_adjust, true); + will_return(__wrap_f_memory_arrays_adjust, F_status_set_error(F_failure)); const f_status_t status = f_directory_listings_destroy_callback(0, 1, (void *) datas_array); @@ -141,29 +142,29 @@ void test__f_directory_listings_destroy_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - 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_memory_arrays_adjust, true); + will_return(__wrap_f_memory_arrays_adjust, F_status_set_error(F_failure)); const f_status_t status = f_directory_listings_destroy_callback(0, 1, (void *) datas_array); @@ -174,42 +175,56 @@ void test__f_directory_listings_destroy_callback__fails(void **state) { void test__f_directory_listings_destroy_callback__works(void **state) { mock_unwrap = 0; + mock_unwrap_f_memory = 1; - 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 }; const f_number_unsigned_t length = 1; + f_directory_listings_t datas = f_directory_listings_t_initialize; + { - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + f_status_t status = f_memory_array_resize(length, sizeof(f_directory_listing_t), (void **) &datas.array, &datas.used, &datas.size); + assert_int_equal(status, F_okay); + + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datas.array[0].block.array, &datas.array[0].block.used, &datas.array[0].block.size, &f_string_dynamics_delete_callback); + assert_int_equal(status, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datas.array[0].character.array, &datas.array[0].character.used, &datas.array[0].character.size, &f_string_dynamics_delete_callback); + assert_int_equal(status, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datas.array[0].directory.array, &datas.array[0].directory.used, &datas.array[0].directory.size, &f_string_dynamics_delete_callback); + assert_int_equal(status, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datas.array[0].regular.array, &datas.array[0].regular.used, &datas.array[0].regular.size, &f_string_dynamics_delete_callback); + assert_int_equal(status, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datas.array[0].link.array, &datas.array[0].link.used, &datas.array[0].link.size, &f_string_dynamics_delete_callback); + assert_int_equal(status, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datas.array[0].fifo.array, &datas.array[0].fifo.used, &datas.array[0].fifo.size, &f_string_dynamics_delete_callback); + assert_int_equal(status, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datas.array[0].socket.array, &datas.array[0].socket.used, &datas.array[0].socket.size, &f_string_dynamics_delete_callback); + assert_int_equal(status, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datas.array[0].unknown.array, &datas.array[0].unknown.used, &datas.array[0].unknown.size, &f_string_dynamics_delete_callback); + assert_int_equal(status, F_okay); + } - const f_status_t status = f_directory_listings_destroy_callback(0, length, (void *) datas_array); + { + const f_status_t status = f_directory_listings_destroy_callback(0, length, (void *) datas.array); assert_int_equal(status, F_okay); + assert_int_equal(datas.array[0].block.size, 0); + assert_int_equal(datas.array[0].character.size, 0); + assert_int_equal(datas.array[0].directory.size, 0); + assert_int_equal(datas.array[0].regular.size, 0); + assert_int_equal(datas.array[0].link.size, 0); + assert_int_equal(datas.array[0].fifo.size, 0); + assert_int_equal(datas.array[0].socket.size, 0); + assert_int_equal(datas.array[0].unknown.size, 0); } + + free((void *) datas.array); } #ifdef __cplusplus 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 index e9a4921..fb69843 100644 --- 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 @@ -16,8 +16,8 @@ void test__f_directory_listingss_delete_callback__fails(void **state) { 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)); + 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_directory_listingss_delete_callback(0, 1, (void *) datas_array); @@ -25,11 +25,11 @@ void test__f_directory_listingss_delete_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - 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_memory_arrays_resize, true); + will_return(__wrap_f_memory_arrays_resize, F_status_set_error(F_failure)); const f_status_t status = f_directory_listingss_delete_callback(0, 1, (void *) datas_array); @@ -37,14 +37,14 @@ void test__f_directory_listingss_delete_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - 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_memory_arrays_resize, true); + will_return(__wrap_f_memory_arrays_resize, F_status_set_error(F_failure)); const f_status_t status = f_directory_listingss_delete_callback(0, 1, (void *) datas_array); @@ -52,17 +52,17 @@ void test__f_directory_listingss_delete_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - 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_memory_arrays_resize, true); + will_return(__wrap_f_memory_arrays_resize, F_status_set_error(F_failure)); const f_status_t status = f_directory_listingss_delete_callback(0, 1, (void *) datas_array); @@ -70,20 +70,20 @@ void test__f_directory_listingss_delete_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - 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_memory_arrays_resize, true); + will_return(__wrap_f_memory_arrays_resize, F_status_set_error(F_failure)); const f_status_t status = f_directory_listingss_delete_callback(0, 1, (void *) datas_array); @@ -91,23 +91,23 @@ void test__f_directory_listingss_delete_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - 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_memory_arrays_resize, true); + will_return(__wrap_f_memory_arrays_resize, F_status_set_error(F_failure)); const f_status_t status = f_directory_listingss_delete_callback(0, 1, (void *) datas_array); @@ -115,26 +115,26 @@ void test__f_directory_listingss_delete_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - 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_memory_arrays_resize, true); + will_return(__wrap_f_memory_arrays_resize, F_status_set_error(F_failure)); const f_status_t status = f_directory_listingss_delete_callback(0, 1, (void *) datas_array); @@ -142,29 +142,29 @@ void test__f_directory_listingss_delete_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - 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_memory_arrays_resize, true); + will_return(__wrap_f_memory_arrays_resize, F_status_set_error(F_failure)); const f_status_t status = f_directory_listingss_delete_callback(0, 1, (void *) datas_array); @@ -172,29 +172,29 @@ void test__f_directory_listingss_delete_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); will_return(__wrap_f_memory_array_resize, true); will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); @@ -207,7 +207,7 @@ void test__f_directory_listingss_delete_callback__fails(void **state) { void test__f_directory_listingss_delete_callback__works(void **state) { - mock_unwrap = 1; + mock_unwrap = 0; mock_unwrap_f_memory = 1; const f_number_unsigned_t length = 1; @@ -221,28 +221,28 @@ void test__f_directory_listingss_delete_callback__works(void **state) { 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_okay); - status = f_string_dynamics_resize(1, &datass.array[0].array[0].block); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datass.array[0].array[0].block.array, &datass.array[0].array[0].block.used, &datass.array[0].array[0].block.size, &f_string_dynamics_delete_callback); assert_int_equal(status, F_okay); - status = f_string_dynamics_resize(1, &datass.array[0].array[0].character); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datass.array[0].array[0].character.array, &datass.array[0].array[0].character.used, &datass.array[0].array[0].character.size, &f_string_dynamics_delete_callback); assert_int_equal(status, F_okay); - status = f_string_dynamics_resize(1, &datass.array[0].array[0].directory); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datass.array[0].array[0].directory.array, &datass.array[0].array[0].directory.used, &datass.array[0].array[0].directory.size, &f_string_dynamics_delete_callback); assert_int_equal(status, F_okay); - status = f_string_dynamics_resize(1, &datass.array[0].array[0].regular); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datass.array[0].array[0].regular.array, &datass.array[0].array[0].regular.used, &datass.array[0].array[0].regular.size, &f_string_dynamics_delete_callback); assert_int_equal(status, F_okay); - status = f_string_dynamics_resize(1, &datass.array[0].array[0].link); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datass.array[0].array[0].link.array, &datass.array[0].array[0].link.used, &datass.array[0].array[0].link.size, &f_string_dynamics_delete_callback); assert_int_equal(status, F_okay); - status = f_string_dynamics_resize(1, &datass.array[0].array[0].fifo); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datass.array[0].array[0].fifo.array, &datass.array[0].array[0].fifo.used, &datass.array[0].array[0].fifo.size, &f_string_dynamics_delete_callback); assert_int_equal(status, F_okay); - status = f_string_dynamics_resize(1, &datass.array[0].array[0].socket); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datass.array[0].array[0].socket.array, &datass.array[0].array[0].socket.used, &datass.array[0].array[0].socket.size, &f_string_dynamics_delete_callback); assert_int_equal(status, F_okay); - status = f_string_dynamics_resize(1, &datass.array[0].array[0].unknown); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datass.array[0].array[0].unknown.array, &datass.array[0].array[0].unknown.used, &datass.array[0].array[0].unknown.size, &f_string_dynamics_delete_callback); assert_int_equal(status, F_okay); } 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 index d5565a3..9390411 100644 --- 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 @@ -16,8 +16,8 @@ void test__f_directory_listingss_destroy_callback__fails(void **state) { 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)); + 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_directory_listingss_destroy_callback(0, 1, (void *) datas_array); @@ -25,11 +25,11 @@ void test__f_directory_listingss_destroy_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - 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_memory_arrays_adjust, true); + will_return(__wrap_f_memory_arrays_adjust, F_status_set_error(F_failure)); const f_status_t status = f_directory_listingss_destroy_callback(0, 1, (void *) datas_array); @@ -37,14 +37,14 @@ void test__f_directory_listingss_destroy_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - 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_memory_arrays_adjust, true); + will_return(__wrap_f_memory_arrays_adjust, F_status_set_error(F_failure)); const f_status_t status = f_directory_listingss_destroy_callback(0, 1, (void *) datas_array); @@ -52,17 +52,17 @@ void test__f_directory_listingss_destroy_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - 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_memory_arrays_adjust, true); + will_return(__wrap_f_memory_arrays_adjust, F_status_set_error(F_failure)); const f_status_t status = f_directory_listingss_destroy_callback(0, 1, (void *) datas_array); @@ -70,20 +70,20 @@ void test__f_directory_listingss_destroy_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - 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_memory_arrays_adjust, true); + will_return(__wrap_f_memory_arrays_adjust, F_status_set_error(F_failure)); const f_status_t status = f_directory_listingss_destroy_callback(0, 1, (void *) datas_array); @@ -91,23 +91,23 @@ void test__f_directory_listingss_destroy_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - 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_memory_arrays_adjust, true); + will_return(__wrap_f_memory_arrays_adjust, F_status_set_error(F_failure)); const f_status_t status = f_directory_listingss_destroy_callback(0, 1, (void *) datas_array); @@ -115,26 +115,26 @@ void test__f_directory_listingss_destroy_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - 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_memory_arrays_adjust, true); + will_return(__wrap_f_memory_arrays_adjust, F_status_set_error(F_failure)); const f_status_t status = f_directory_listingss_destroy_callback(0, 1, (void *) datas_array); @@ -142,29 +142,29 @@ void test__f_directory_listingss_destroy_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - 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_memory_arrays_adjust, true); + will_return(__wrap_f_memory_arrays_adjust, F_status_set_error(F_failure)); const f_status_t status = f_directory_listingss_destroy_callback(0, 1, (void *) datas_array); @@ -172,29 +172,29 @@ void test__f_directory_listingss_destroy_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); will_return(__wrap_f_memory_array_adjust, true); will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); @@ -207,7 +207,7 @@ void test__f_directory_listingss_destroy_callback__fails(void **state) { void test__f_directory_listingss_destroy_callback__works(void **state) { - mock_unwrap = 1; + mock_unwrap = 0; mock_unwrap_f_memory = 1; const f_number_unsigned_t length = 1; @@ -215,34 +215,34 @@ void test__f_directory_listingss_destroy_callback__works(void **state) { 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); + 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_okay); 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_okay); - status = f_string_dynamics_adjust(1, &datass.array[0].array[0].block); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datass.array[0].array[0].block.array, &datass.array[0].array[0].block.used, &datass.array[0].array[0].block.size, &f_string_dynamics_delete_callback); assert_int_equal(status, F_okay); - status = f_string_dynamics_adjust(1, &datass.array[0].array[0].character); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datass.array[0].array[0].character.array, &datass.array[0].array[0].character.used, &datass.array[0].array[0].character.size, &f_string_dynamics_delete_callback); assert_int_equal(status, F_okay); - status = f_string_dynamics_adjust(1, &datass.array[0].array[0].directory); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datass.array[0].array[0].directory.array, &datass.array[0].array[0].directory.used, &datass.array[0].array[0].directory.size, &f_string_dynamics_delete_callback); assert_int_equal(status, F_okay); - status = f_string_dynamics_adjust(1, &datass.array[0].array[0].regular); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datass.array[0].array[0].regular.array, &datass.array[0].array[0].regular.used, &datass.array[0].array[0].regular.size, &f_string_dynamics_delete_callback); assert_int_equal(status, F_okay); - status = f_string_dynamics_adjust(1, &datass.array[0].array[0].link); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datass.array[0].array[0].link.array, &datass.array[0].array[0].link.used, &datass.array[0].array[0].link.size, &f_string_dynamics_delete_callback); assert_int_equal(status, F_okay); - status = f_string_dynamics_adjust(1, &datass.array[0].array[0].fifo); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datass.array[0].array[0].fifo.array, &datass.array[0].array[0].fifo.used, &datass.array[0].array[0].fifo.size, &f_string_dynamics_delete_callback); assert_int_equal(status, F_okay); - status = f_string_dynamics_adjust(1, &datass.array[0].array[0].socket); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datass.array[0].array[0].socket.array, &datass.array[0].array[0].socket.used, &datass.array[0].array[0].socket.size, &f_string_dynamics_delete_callback); assert_int_equal(status, F_okay); - status = f_string_dynamics_adjust(1, &datass.array[0].array[0].unknown); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datass.array[0].array[0].unknown.array, &datass.array[0].array[0].unknown.used, &datass.array[0].array[0].unknown.size, &f_string_dynamics_delete_callback); assert_int_equal(status, F_okay); } diff --git a/level_0/f_directory/tests/unit/c/test-directory-recurse_dos_delete_callback.c b/level_0/f_directory/tests/unit/c/test-directory-recurse_dos_delete_callback.c index 0a2d04e..7509d42 100644 --- a/level_0/f_directory/tests/unit/c/test-directory-recurse_dos_delete_callback.c +++ b/level_0/f_directory/tests/unit/c/test-directory-recurse_dos_delete_callback.c @@ -8,6 +8,7 @@ extern "C" { void test__f_directory_recurse_dos_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 }; @@ -15,8 +16,8 @@ void test__f_directory_recurse_dos_delete_callback__fails(void **state) { 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)); + 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_dos_delete_callback(0, 1, (void *) datass_array); @@ -24,11 +25,11 @@ void test__f_directory_recurse_dos_delete_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamic_resize, true); - will_return(__wrap_f_string_dynamic_resize, F_status_set_error(F_failure)); + 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_dos_delete_callback(0, 1, (void *) datass_array); @@ -36,14 +37,14 @@ void test__f_directory_recurse_dos_delete_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - 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_memory_arrays_resize, true); + will_return(__wrap_f_memory_arrays_resize, F_status_set_error(F_failure)); const f_status_t status = f_directory_recurse_dos_delete_callback(0, 1, (void *) datass_array); @@ -51,17 +52,17 @@ void test__f_directory_recurse_dos_delete_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - 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_memory_arrays_resize, true); + will_return(__wrap_f_memory_arrays_resize, F_status_set_error(F_failure)); const f_status_t status = f_directory_recurse_dos_delete_callback(0, 1, (void *) datass_array); @@ -69,20 +70,20 @@ void test__f_directory_recurse_dos_delete_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - 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_memory_arrays_resize, true); + will_return(__wrap_f_memory_arrays_resize, F_status_set_error(F_failure)); const f_status_t status = f_directory_recurse_dos_delete_callback(0, 1, (void *) datass_array); @@ -90,23 +91,23 @@ void test__f_directory_recurse_dos_delete_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - 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_memory_arrays_resize, true); + will_return(__wrap_f_memory_arrays_resize, F_status_set_error(F_failure)); const f_status_t status = f_directory_recurse_dos_delete_callback(0, 1, (void *) datass_array); @@ -114,26 +115,26 @@ void test__f_directory_recurse_dos_delete_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - 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_memory_arrays_resize, true); + will_return(__wrap_f_memory_arrays_resize, F_status_set_error(F_failure)); const f_status_t status = f_directory_recurse_dos_delete_callback(0, 1, (void *) datass_array); @@ -141,29 +142,29 @@ void test__f_directory_recurse_dos_delete_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - 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_memory_arrays_resize, true); + will_return(__wrap_f_memory_arrays_resize, F_status_set_error(F_failure)); const f_status_t status = f_directory_recurse_dos_delete_callback(0, 1, (void *) datass_array); @@ -171,32 +172,32 @@ void test__f_directory_recurse_dos_delete_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - 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_memory_arrays_resize, true); + will_return(__wrap_f_memory_arrays_resize, F_status_set_error(F_failure)); const f_status_t status = f_directory_recurse_dos_delete_callback(0, 1, (void *) datass_array); @@ -204,35 +205,35 @@ void test__f_directory_recurse_dos_delete_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - 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_memory_arrays_resize, true); + will_return(__wrap_f_memory_arrays_resize, F_status_set_error(F_failure)); const f_status_t status = f_directory_recurse_dos_delete_callback(0, 1, (void *) datass_array); @@ -243,48 +244,64 @@ void test__f_directory_recurse_dos_delete_callback__fails(void **state) { void test__f_directory_recurse_dos_delete_callback__works(void **state) { mock_unwrap = 0; + mock_unwrap_f_memory = 1; - 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 }; const f_number_unsigned_t length = 1; + f_directory_recurse_dos_t datas = f_directory_recurse_dos_t_initialize; + { - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + f_status_t status = f_memory_array_resize(1, sizeof(f_directory_recurse_do_t), (void **) &datas.array, &datas.used, &datas.size); + assert_int_equal(status, F_okay); - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + status = f_memory_array_resize(1, sizeof(f_char_t), (void **) &datas.array[0].path.string, &datas.array[0].path.used, &datas.array[0].path.size); + assert_int_equal(status, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + status = f_memory_array_resize(1, sizeof(f_char_t), (void **) &datas.array[0].path_cache.string, &datas.array[0].path_cache.used, &datas.array[0].path_cache.size); + assert_int_equal(status, F_okay); + + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datas.array[0].listing.block.array, &datas.array[0].listing.block.used, &datas.array[0].listing.block.size, &f_string_dynamics_delete_callback); + assert_int_equal(status, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datas.array[0].listing.character.array, &datas.array[0].listing.character.used, &datas.array[0].listing.character.size, &f_string_dynamics_delete_callback); + assert_int_equal(status, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datas.array[0].listing.directory.array, &datas.array[0].listing.directory.used, &datas.array[0].listing.directory.size, &f_string_dynamics_delete_callback); + assert_int_equal(status, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datas.array[0].listing.regular.array, &datas.array[0].listing.regular.used, &datas.array[0].listing.regular.size, &f_string_dynamics_delete_callback); + assert_int_equal(status, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datas.array[0].listing.link.array, &datas.array[0].listing.link.used, &datas.array[0].listing.link.size, &f_string_dynamics_delete_callback); + assert_int_equal(status, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datas.array[0].listing.fifo.array, &datas.array[0].listing.fifo.used, &datas.array[0].listing.fifo.size, &f_string_dynamics_delete_callback); + assert_int_equal(status, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datas.array[0].listing.socket.array, &datas.array[0].listing.socket.used, &datas.array[0].listing.socket.size, &f_string_dynamics_delete_callback); + assert_int_equal(status, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datas.array[0].listing.unknown.array, &datas.array[0].listing.unknown.used, &datas.array[0].listing.unknown.size, &f_string_dynamics_delete_callback); + assert_int_equal(status, F_okay); + } - const f_status_t status = f_directory_recurse_dos_delete_callback(0, length, (void *) datass_array); + { + const f_status_t status = f_directory_recurse_dos_delete_callback(0, length, (void *) datas.array); assert_int_equal(status, F_okay); + assert_int_equal(datas.array[0].path.size, 0); + assert_int_equal(datas.array[0].path_cache.size, 0); + assert_int_equal(datas.array[0].listing.block.size, 0); + assert_int_equal(datas.array[0].listing.character.size, 0); + assert_int_equal(datas.array[0].listing.directory.size, 0); + assert_int_equal(datas.array[0].listing.regular.size, 0); + assert_int_equal(datas.array[0].listing.link.size, 0); + assert_int_equal(datas.array[0].listing.fifo.size, 0); + assert_int_equal(datas.array[0].listing.socket.size, 0); + assert_int_equal(datas.array[0].listing.unknown.size, 0); } + + free((void *) datas.array); } #ifdef __cplusplus diff --git a/level_0/f_directory/tests/unit/c/test-directory-recurse_dos_destroy_callback.c b/level_0/f_directory/tests/unit/c/test-directory-recurse_dos_destroy_callback.c index ee867af..b428b42 100644 --- a/level_0/f_directory/tests/unit/c/test-directory-recurse_dos_destroy_callback.c +++ b/level_0/f_directory/tests/unit/c/test-directory-recurse_dos_destroy_callback.c @@ -8,6 +8,7 @@ extern "C" { void test__f_directory_recurse_dos_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 }; @@ -15,8 +16,8 @@ void test__f_directory_recurse_dos_destroy_callback__fails(void **state) { 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)); + 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_dos_destroy_callback(0, 1, (void *) datass_array); @@ -24,11 +25,11 @@ void test__f_directory_recurse_dos_destroy_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamic_adjust, true); - will_return(__wrap_f_string_dynamic_adjust, F_status_set_error(F_failure)); + 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_dos_destroy_callback(0, 1, (void *) datass_array); @@ -36,14 +37,14 @@ void test__f_directory_recurse_dos_destroy_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - 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_memory_arrays_adjust, true); + will_return(__wrap_f_memory_arrays_adjust, F_status_set_error(F_failure)); const f_status_t status = f_directory_recurse_dos_destroy_callback(0, 1, (void *) datass_array); @@ -51,17 +52,17 @@ void test__f_directory_recurse_dos_destroy_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - 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_memory_arrays_adjust, true); + will_return(__wrap_f_memory_arrays_adjust, F_status_set_error(F_failure)); const f_status_t status = f_directory_recurse_dos_destroy_callback(0, 1, (void *) datass_array); @@ -69,20 +70,20 @@ void test__f_directory_recurse_dos_destroy_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - 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_memory_arrays_adjust, true); + will_return(__wrap_f_memory_arrays_adjust, F_status_set_error(F_failure)); const f_status_t status = f_directory_recurse_dos_destroy_callback(0, 1, (void *) datass_array); @@ -90,23 +91,23 @@ void test__f_directory_recurse_dos_destroy_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - 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_memory_arrays_adjust, true); + will_return(__wrap_f_memory_arrays_adjust, F_status_set_error(F_failure)); const f_status_t status = f_directory_recurse_dos_destroy_callback(0, 1, (void *) datass_array); @@ -114,26 +115,26 @@ void test__f_directory_recurse_dos_destroy_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - 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_memory_arrays_adjust, true); + will_return(__wrap_f_memory_arrays_adjust, F_status_set_error(F_failure)); const f_status_t status = f_directory_recurse_dos_destroy_callback(0, 1, (void *) datass_array); @@ -141,29 +142,29 @@ void test__f_directory_recurse_dos_destroy_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - 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_memory_arrays_adjust, true); + will_return(__wrap_f_memory_arrays_adjust, F_status_set_error(F_failure)); const f_status_t status = f_directory_recurse_dos_destroy_callback(0, 1, (void *) datass_array); @@ -171,32 +172,32 @@ void test__f_directory_recurse_dos_destroy_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - 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_memory_arrays_adjust, true); + will_return(__wrap_f_memory_arrays_adjust, F_status_set_error(F_failure)); const f_status_t status = f_directory_recurse_dos_destroy_callback(0, 1, (void *) datass_array); @@ -204,35 +205,35 @@ void test__f_directory_recurse_dos_destroy_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - 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_memory_arrays_adjust, true); + will_return(__wrap_f_memory_arrays_adjust, F_status_set_error(F_failure)); const f_status_t status = f_directory_recurse_dos_destroy_callback(0, 1, (void *) datass_array); @@ -243,48 +244,64 @@ void test__f_directory_recurse_dos_destroy_callback__fails(void **state) { void test__f_directory_recurse_dos_destroy_callback__works(void **state) { mock_unwrap = 0; + mock_unwrap_f_memory = 1; - 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 }; const f_number_unsigned_t length = 1; + f_directory_recurse_dos_t datas = f_directory_recurse_dos_t_initialize; + { - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + f_status_t status = f_memory_array_resize(1, sizeof(f_directory_recurse_do_t), (void **) &datas.array, &datas.used, &datas.size); + assert_int_equal(status, F_okay); - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + status = f_memory_array_resize(1, sizeof(f_char_t), (void **) &datas.array[0].path.string, &datas.array[0].path.used, &datas.array[0].path.size); + assert_int_equal(status, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + status = f_memory_array_resize(1, sizeof(f_char_t), (void **) &datas.array[0].path_cache.string, &datas.array[0].path_cache.used, &datas.array[0].path_cache.size); + assert_int_equal(status, F_okay); + + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datas.array[0].listing.block.array, &datas.array[0].listing.block.used, &datas.array[0].listing.block.size, &f_string_dynamics_destroy_callback); + assert_int_equal(status, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datas.array[0].listing.character.array, &datas.array[0].listing.character.used, &datas.array[0].listing.character.size, &f_string_dynamics_destroy_callback); + assert_int_equal(status, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datas.array[0].listing.directory.array, &datas.array[0].listing.directory.used, &datas.array[0].listing.directory.size, &f_string_dynamics_destroy_callback); + assert_int_equal(status, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datas.array[0].listing.regular.array, &datas.array[0].listing.regular.used, &datas.array[0].listing.regular.size, &f_string_dynamics_destroy_callback); + assert_int_equal(status, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datas.array[0].listing.link.array, &datas.array[0].listing.link.used, &datas.array[0].listing.link.size, &f_string_dynamics_destroy_callback); + assert_int_equal(status, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datas.array[0].listing.fifo.array, &datas.array[0].listing.fifo.used, &datas.array[0].listing.fifo.size, &f_string_dynamics_destroy_callback); + assert_int_equal(status, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datas.array[0].listing.socket.array, &datas.array[0].listing.socket.used, &datas.array[0].listing.socket.size, &f_string_dynamics_destroy_callback); + assert_int_equal(status, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datas.array[0].listing.unknown.array, &datas.array[0].listing.unknown.used, &datas.array[0].listing.unknown.size, &f_string_dynamics_destroy_callback); + assert_int_equal(status, F_okay); + } - const f_status_t status = f_directory_recurse_dos_destroy_callback(0, length, (void *) datass_array); + { + const f_status_t status = f_directory_recurse_dos_destroy_callback(0, length, (void *) datas.array); assert_int_equal(status, F_okay); + assert_int_equal(datas.array[0].path.size, 0); + assert_int_equal(datas.array[0].path_cache.size, 0); + assert_int_equal(datas.array[0].listing.block.size, 0); + assert_int_equal(datas.array[0].listing.character.size, 0); + assert_int_equal(datas.array[0].listing.directory.size, 0); + assert_int_equal(datas.array[0].listing.regular.size, 0); + assert_int_equal(datas.array[0].listing.link.size, 0); + assert_int_equal(datas.array[0].listing.fifo.size, 0); + assert_int_equal(datas.array[0].listing.socket.size, 0); + assert_int_equal(datas.array[0].listing.unknown.size, 0); } + + free((void *) datas.array); } #ifdef __cplusplus 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 index 3e64686..64ad08c 100644 --- 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 @@ -16,8 +16,8 @@ void test__f_directory_recurse_doss_delete_callback__fails(void **state) { 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)); + 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); @@ -25,11 +25,11 @@ void test__f_directory_recurse_doss_delete_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamic_resize, true); - will_return(__wrap_f_string_dynamic_resize, F_status_set_error(F_failure)); + 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); @@ -37,14 +37,14 @@ void test__f_directory_recurse_doss_delete_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - 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_memory_arrays_resize, true); + will_return(__wrap_f_memory_arrays_resize, F_status_set_error(F_failure)); const f_status_t status = f_directory_recurse_doss_delete_callback(0, 1, (void *) datass_array); @@ -52,17 +52,17 @@ void test__f_directory_recurse_doss_delete_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - 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_memory_arrays_resize, true); + will_return(__wrap_f_memory_arrays_resize, F_status_set_error(F_failure)); const f_status_t status = f_directory_recurse_doss_delete_callback(0, 1, (void *) datass_array); @@ -70,20 +70,20 @@ void test__f_directory_recurse_doss_delete_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - 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_memory_arrays_resize, true); + will_return(__wrap_f_memory_arrays_resize, F_status_set_error(F_failure)); const f_status_t status = f_directory_recurse_doss_delete_callback(0, 1, (void *) datass_array); @@ -91,23 +91,23 @@ void test__f_directory_recurse_doss_delete_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - 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_memory_arrays_resize, true); + will_return(__wrap_f_memory_arrays_resize, F_status_set_error(F_failure)); const f_status_t status = f_directory_recurse_doss_delete_callback(0, 1, (void *) datass_array); @@ -115,26 +115,26 @@ void test__f_directory_recurse_doss_delete_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - 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_memory_arrays_resize, true); + will_return(__wrap_f_memory_arrays_resize, F_status_set_error(F_failure)); const f_status_t status = f_directory_recurse_doss_delete_callback(0, 1, (void *) datass_array); @@ -142,29 +142,29 @@ void test__f_directory_recurse_doss_delete_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - 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_memory_arrays_resize, true); + will_return(__wrap_f_memory_arrays_resize, F_status_set_error(F_failure)); const f_status_t status = f_directory_recurse_doss_delete_callback(0, 1, (void *) datass_array); @@ -172,32 +172,32 @@ void test__f_directory_recurse_doss_delete_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - 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_memory_arrays_resize, true); + will_return(__wrap_f_memory_arrays_resize, F_status_set_error(F_failure)); const f_status_t status = f_directory_recurse_doss_delete_callback(0, 1, (void *) datass_array); @@ -205,35 +205,35 @@ void test__f_directory_recurse_doss_delete_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - 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_memory_arrays_resize, true); + will_return(__wrap_f_memory_arrays_resize, F_status_set_error(F_failure)); const f_status_t status = f_directory_recurse_doss_delete_callback(0, 1, (void *) datass_array); @@ -241,35 +241,35 @@ void test__f_directory_recurse_doss_delete_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); - will_return(__wrap_f_string_dynamics_resize, false); - will_return(__wrap_f_string_dynamics_resize, F_okay); + will_return(__wrap_f_memory_arrays_resize, false); + will_return(__wrap_f_memory_arrays_resize, F_okay); will_return(__wrap_f_memory_array_resize, true); will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); @@ -282,7 +282,7 @@ void test__f_directory_recurse_doss_delete_callback__fails(void **state) { void test__f_directory_recurse_doss_delete_callback__works(void **state) { - mock_unwrap = 1; + mock_unwrap = 0; mock_unwrap_f_memory = 1; const f_number_unsigned_t length = 1; @@ -296,34 +296,34 @@ void test__f_directory_recurse_doss_delete_callback__works(void **state) { 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_okay); - status = f_string_dynamic_resize(1, &datass.array[0].array[0].path); + status = f_memory_array_resize(1, sizeof(f_char_t), (void **) &datass.array[0].array[0].path.string, &datass.array[0].array[0].path.used, &datass.array[0].array[0].path.size); assert_int_equal(status, F_okay); - status = f_string_dynamic_resize(1, &datass.array[0].array[0].path_cache); + status = f_memory_array_resize(1, sizeof(f_char_t), (void **) &datass.array[0].array[0].path_cache.string, &datass.array[0].array[0].path_cache.used, &datass.array[0].array[0].path_cache.size); assert_int_equal(status, F_okay); - status = f_string_dynamics_resize(1, &datass.array[0].array[0].listing.block); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datass.array[0].array[0].listing.block.array, &datass.array[0].array[0].listing.block.used, &datass.array[0].array[0].listing.block.size, &f_string_dynamics_delete_callback); assert_int_equal(status, F_okay); - status = f_string_dynamics_resize(1, &datass.array[0].array[0].listing.character); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datass.array[0].array[0].listing.character.array, &datass.array[0].array[0].listing.character.used, &datass.array[0].array[0].listing.character.size, &f_string_dynamics_delete_callback); assert_int_equal(status, F_okay); - status = f_string_dynamics_resize(1, &datass.array[0].array[0].listing.directory); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datass.array[0].array[0].listing.directory.array, &datass.array[0].array[0].listing.directory.used, &datass.array[0].array[0].listing.directory.size, &f_string_dynamics_delete_callback); assert_int_equal(status, F_okay); - status = f_string_dynamics_resize(1, &datass.array[0].array[0].listing.regular); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datass.array[0].array[0].listing.regular.array, &datass.array[0].array[0].listing.regular.used, &datass.array[0].array[0].listing.regular.size, &f_string_dynamics_delete_callback); assert_int_equal(status, F_okay); - status = f_string_dynamics_resize(1, &datass.array[0].array[0].listing.link); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datass.array[0].array[0].listing.link.array, &datass.array[0].array[0].listing.link.used, &datass.array[0].array[0].listing.link.size, &f_string_dynamics_delete_callback); assert_int_equal(status, F_okay); - status = f_string_dynamics_resize(1, &datass.array[0].array[0].listing.fifo); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datass.array[0].array[0].listing.fifo.array, &datass.array[0].array[0].listing.fifo.used, &datass.array[0].array[0].listing.fifo.size, &f_string_dynamics_delete_callback); assert_int_equal(status, F_okay); - status = f_string_dynamics_resize(1, &datass.array[0].array[0].listing.socket); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datass.array[0].array[0].listing.socket.array, &datass.array[0].array[0].listing.socket.used, &datass.array[0].array[0].listing.socket.size, &f_string_dynamics_delete_callback); assert_int_equal(status, F_okay); - status = f_string_dynamics_resize(1, &datass.array[0].array[0].listing.unknown); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datass.array[0].array[0].listing.unknown.array, &datass.array[0].array[0].listing.unknown.used, &datass.array[0].array[0].listing.unknown.size, &f_string_dynamics_delete_callback); assert_int_equal(status, F_okay); } 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 index c3d49db..0a48a32 100644 --- 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 @@ -16,8 +16,8 @@ void test__f_directory_recurse_doss_destroy_callback__fails(void **state) { 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)); + 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); @@ -25,11 +25,11 @@ void test__f_directory_recurse_doss_destroy_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamic_adjust, true); - will_return(__wrap_f_string_dynamic_adjust, F_status_set_error(F_failure)); + 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); @@ -37,14 +37,14 @@ void test__f_directory_recurse_doss_destroy_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - 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_memory_arrays_adjust, true); + will_return(__wrap_f_memory_arrays_adjust, F_status_set_error(F_failure)); const f_status_t status = f_directory_recurse_doss_destroy_callback(0, 1, (void *) datass_array); @@ -52,17 +52,17 @@ void test__f_directory_recurse_doss_destroy_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - 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_memory_arrays_adjust, true); + will_return(__wrap_f_memory_arrays_adjust, F_status_set_error(F_failure)); const f_status_t status = f_directory_recurse_doss_destroy_callback(0, 1, (void *) datass_array); @@ -70,20 +70,20 @@ void test__f_directory_recurse_doss_destroy_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - 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_memory_arrays_adjust, true); + will_return(__wrap_f_memory_arrays_adjust, F_status_set_error(F_failure)); const f_status_t status = f_directory_recurse_doss_destroy_callback(0, 1, (void *) datass_array); @@ -91,23 +91,23 @@ void test__f_directory_recurse_doss_destroy_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - 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_memory_arrays_adjust, true); + will_return(__wrap_f_memory_arrays_adjust, F_status_set_error(F_failure)); const f_status_t status = f_directory_recurse_doss_destroy_callback(0, 1, (void *) datass_array); @@ -115,26 +115,26 @@ void test__f_directory_recurse_doss_destroy_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - 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_memory_arrays_adjust, true); + will_return(__wrap_f_memory_arrays_adjust, F_status_set_error(F_failure)); const f_status_t status = f_directory_recurse_doss_destroy_callback(0, 1, (void *) datass_array); @@ -142,29 +142,29 @@ void test__f_directory_recurse_doss_destroy_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - 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_memory_arrays_adjust, true); + will_return(__wrap_f_memory_arrays_adjust, F_status_set_error(F_failure)); const f_status_t status = f_directory_recurse_doss_destroy_callback(0, 1, (void *) datass_array); @@ -172,32 +172,32 @@ void test__f_directory_recurse_doss_destroy_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - 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_memory_arrays_adjust, true); + will_return(__wrap_f_memory_arrays_adjust, F_status_set_error(F_failure)); const f_status_t status = f_directory_recurse_doss_destroy_callback(0, 1, (void *) datass_array); @@ -205,35 +205,35 @@ void test__f_directory_recurse_doss_destroy_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - 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_memory_arrays_adjust, true); + will_return(__wrap_f_memory_arrays_adjust, F_status_set_error(F_failure)); const f_status_t status = f_directory_recurse_doss_destroy_callback(0, 1, (void *) datass_array); @@ -241,35 +241,35 @@ void test__f_directory_recurse_doss_destroy_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); - will_return(__wrap_f_string_dynamics_adjust, false); - will_return(__wrap_f_string_dynamics_adjust, F_okay); + will_return(__wrap_f_memory_arrays_adjust, false); + will_return(__wrap_f_memory_arrays_adjust, F_okay); will_return(__wrap_f_memory_array_adjust, true); will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); @@ -282,7 +282,7 @@ void test__f_directory_recurse_doss_destroy_callback__fails(void **state) { void test__f_directory_recurse_doss_destroy_callback__works(void **state) { - mock_unwrap = 1; + mock_unwrap = 0; mock_unwrap_f_memory = 1; const f_number_unsigned_t length = 1; @@ -290,40 +290,40 @@ void test__f_directory_recurse_doss_destroy_callback__works(void **state) { 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); + 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_okay); - 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); + 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_okay); - status = f_string_dynamic_adjust(1, &datass.array[0].array[0].path); + status = f_memory_array_resize(1, sizeof(f_char_t), (void **) &datass.array[0].array[0].path.string, &datass.array[0].array[0].path.used, &datass.array[0].array[0].path.size); assert_int_equal(status, F_okay); - status = f_string_dynamic_adjust(1, &datass.array[0].array[0].path_cache); + status = f_memory_array_resize(1, sizeof(f_char_t), (void **) &datass.array[0].array[0].path_cache.string, &datass.array[0].array[0].path_cache.used, &datass.array[0].array[0].path_cache.size); assert_int_equal(status, F_okay); - status = f_string_dynamics_adjust(1, &datass.array[0].array[0].listing.block); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datass.array[0].array[0].listing.block.array, &datass.array[0].array[0].listing.block.used, &datass.array[0].array[0].listing.block.size, &f_string_dynamics_destroy_callback); assert_int_equal(status, F_okay); - status = f_string_dynamics_adjust(1, &datass.array[0].array[0].listing.character); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datass.array[0].array[0].listing.character.array, &datass.array[0].array[0].listing.character.used, &datass.array[0].array[0].listing.character.size, &f_string_dynamics_destroy_callback); assert_int_equal(status, F_okay); - status = f_string_dynamics_adjust(1, &datass.array[0].array[0].listing.directory); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datass.array[0].array[0].listing.directory.array, &datass.array[0].array[0].listing.directory.used, &datass.array[0].array[0].listing.directory.size, &f_string_dynamics_destroy_callback); assert_int_equal(status, F_okay); - status = f_string_dynamics_adjust(1, &datass.array[0].array[0].listing.regular); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datass.array[0].array[0].listing.regular.array, &datass.array[0].array[0].listing.regular.used, &datass.array[0].array[0].listing.regular.size, &f_string_dynamics_destroy_callback); assert_int_equal(status, F_okay); - status = f_string_dynamics_adjust(1, &datass.array[0].array[0].listing.link); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datass.array[0].array[0].listing.link.array, &datass.array[0].array[0].listing.link.used, &datass.array[0].array[0].listing.link.size, &f_string_dynamics_destroy_callback); assert_int_equal(status, F_okay); - status = f_string_dynamics_adjust(1, &datass.array[0].array[0].listing.fifo); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datass.array[0].array[0].listing.fifo.array, &datass.array[0].array[0].listing.fifo.used, &datass.array[0].array[0].listing.fifo.size, &f_string_dynamics_destroy_callback); assert_int_equal(status, F_okay); - status = f_string_dynamics_adjust(1, &datass.array[0].array[0].listing.socket); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datass.array[0].array[0].listing.socket.array, &datass.array[0].array[0].listing.socket.used, &datass.array[0].array[0].listing.socket.size, &f_string_dynamics_destroy_callback); assert_int_equal(status, F_okay); - status = f_string_dynamics_adjust(1, &datass.array[0].array[0].listing.unknown); + status = f_memory_arrays_resize(1, sizeof(f_string_dynamic_t), (void **) &datass.array[0].array[0].listing.unknown.array, &datass.array[0].array[0].listing.unknown.used, &datass.array[0].array[0].listing.unknown.size, &f_string_dynamics_destroy_callback); assert_int_equal(status, F_okay); } diff --git a/level_0/f_directory/tests/unit/c/test-directory-statuss_delete_callback.c b/level_0/f_directory/tests/unit/c/test-directory-statuss_delete_callback.c index 747a184..839dcc5 100644 --- a/level_0/f_directory/tests/unit/c/test-directory-statuss_delete_callback.c +++ b/level_0/f_directory/tests/unit/c/test-directory-statuss_delete_callback.c @@ -8,6 +8,7 @@ extern "C" { void test__f_directory_statuss_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 }; @@ -15,8 +16,8 @@ void test__f_directory_statuss_delete_callback__fails(void **state) { 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)); + 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_statuss_delete_callback(0, 1, (void *) datass_array); @@ -27,21 +28,25 @@ void test__f_directory_statuss_delete_callback__fails(void **state) { void test__f_directory_statuss_delete_callback__works(void **state) { mock_unwrap = 0; + mock_unwrap_f_memory = 1; - 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 }; const f_number_unsigned_t length = 1; + f_directory_statuss_t datas = f_directory_statuss_t_initialize; + { - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + f_status_t status = f_memory_array_resize(length, sizeof(f_directory_status_t), (void **) &datas.array, &datas.used, &datas.size); + assert_int_equal(status, F_okay); + } - const f_status_t status = f_directory_statuss_delete_callback(0, length, (void *) datass_array); + { + const f_status_t status = f_directory_statuss_delete_callback(0, length, (void *) datas.array); assert_int_equal(status, F_okay); + assert_int_equal(datas.array[0].path.size, 0); } + + free((void *) datas.array); } #ifdef __cplusplus diff --git a/level_0/f_directory/tests/unit/c/test-directory-statuss_destroy_callback.c b/level_0/f_directory/tests/unit/c/test-directory-statuss_destroy_callback.c index 7253c33..85dfe1c 100644 --- a/level_0/f_directory/tests/unit/c/test-directory-statuss_destroy_callback.c +++ b/level_0/f_directory/tests/unit/c/test-directory-statuss_destroy_callback.c @@ -8,6 +8,7 @@ extern "C" { void test__f_directory_statuss_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 }; @@ -15,8 +16,8 @@ void test__f_directory_statuss_destroy_callback__fails(void **state) { 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)); + 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_statuss_destroy_callback(0, 1, (void *) datass_array); @@ -27,21 +28,25 @@ void test__f_directory_statuss_destroy_callback__fails(void **state) { void test__f_directory_statuss_destroy_callback__works(void **state) { mock_unwrap = 0; + mock_unwrap_f_memory = 1; - 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 }; const f_number_unsigned_t length = 1; + f_directory_statuss_t datas = f_directory_statuss_t_initialize; + { - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + f_status_t status = f_memory_array_adjust(length, sizeof(f_directory_status_t), (void **) &datas.array, &datas.used, &datas.size); + assert_int_equal(status, F_okay); + } - const f_status_t status = f_directory_statuss_destroy_callback(0, length, (void *) datass_array); + { + const f_status_t status = f_directory_statuss_destroy_callback(0, length, (void *) datas.array); assert_int_equal(status, F_okay); + assert_int_equal(datas.array[0].path.size, 0); } + + free((void *) datas.array); } #ifdef __cplusplus 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 index 186da03..d5139b5 100644 --- 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 @@ -16,8 +16,8 @@ void test__f_directory_statusss_delete_callback__fails(void **state) { 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)); + 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); @@ -25,8 +25,8 @@ void test__f_directory_statusss_delete_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); will_return(__wrap_f_memory_array_resize, true); will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); @@ -39,7 +39,7 @@ void test__f_directory_statusss_delete_callback__fails(void **state) { void test__f_directory_statusss_delete_callback__works(void **state) { - mock_unwrap = 1; + mock_unwrap = 0; mock_unwrap_f_memory = 1; const f_number_unsigned_t length = 1; @@ -53,7 +53,7 @@ void test__f_directory_statusss_delete_callback__works(void **state) { 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_okay); - status = f_string_dynamic_resize(1, &datass.array[0].array[0].path); + status = f_memory_array_adjust(1, sizeof(f_char_t), (void **) &datass.array[0].array[0].path.string, &datass.array[0].array[0].path.used, &datass.array[0].array[0].path.size); assert_int_equal(status, F_okay); } 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 index d87d321..dc3da45 100644 --- 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 @@ -16,8 +16,8 @@ void test__f_directory_statusss_destroy_callback__fails(void **state) { 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)); + 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); @@ -25,8 +25,8 @@ void test__f_directory_statusss_destroy_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); will_return(__wrap_f_memory_array_adjust, true); will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); @@ -39,7 +39,7 @@ void test__f_directory_statusss_destroy_callback__fails(void **state) { void test__f_directory_statusss_destroy_callback__works(void **state) { - mock_unwrap = 1; + mock_unwrap = 0; mock_unwrap_f_memory = 1; const f_number_unsigned_t length = 1; @@ -53,7 +53,7 @@ void test__f_directory_statusss_destroy_callback__works(void **state) { 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_okay); - status = f_string_dynamic_adjust(1, &datass.array[0].array[0].path); + status = f_memory_array_adjust(1, sizeof(f_char_t), (void **) &datass.array[0].array[0].path.string, &datass.array[0].array[0].path.used, &datass.array[0].array[0].path.size); assert_int_equal(status, F_okay); } diff --git a/level_0/f_environment/tests/unit/c/test-environment-get.c b/level_0/f_environment/tests/unit/c/test-environment-get.c index 3df70d1..78d1a67 100644 --- a/level_0/f_environment/tests/unit/c/test-environment-get.c +++ b/level_0/f_environment/tests/unit/c/test-environment-get.c @@ -19,7 +19,7 @@ void test__f_environment_get__fails(void **state) { assert_int_equal(status, F_exist_not); } - f_string_dynamic_resize(0, &buffer); + free((void *) buffer.string); } void test__f_environment_get__parameter_checking(void **state) { @@ -43,7 +43,7 @@ void test__f_environment_get__returns_data_not(void **state) { assert_int_equal(status, F_data_not); } - f_string_dynamic_resize(0, &buffer); + free((void *) buffer.string); } void test__f_environment_get__works(void **state) { @@ -74,7 +74,7 @@ void test__f_environment_get__works(void **state) { assert_string_equal(buffer.string, f_string_empty_s.string); } - f_string_dynamic_resize(0, &buffer); + free((void *) buffer.string); } #ifdef __cplusplus diff --git a/level_0/f_file/tests/unit/c/test-file-link_read.c b/level_0/f_file/tests/unit/c/test-file-link_read.c index 2afccd2..80a056f 100644 --- a/level_0/f_file/tests/unit/c/test-file-link_read.c +++ b/level_0/f_file/tests/unit/c/test-file-link_read.c @@ -59,7 +59,7 @@ void test__f_file_link_read__fails(void **state) { assert_int_equal(status, F_status_set_error(statuss[i])); } // for - f_string_dynamic_resize(0, &buffer); + free((void *) buffer.string); } void test__f_file_link_read__parameter_checking(void **state) { @@ -76,7 +76,7 @@ void test__f_file_link_read__parameter_checking(void **state) { assert_int_equal(status, F_status_set_error(F_parameter)); } - f_string_dynamic_resize(0, &buffer); + free((void *) buffer.string); } void test__f_file_link_read__returns_data_not(void **state) { @@ -96,7 +96,7 @@ void test__f_file_link_read__returns_data_not(void **state) { assert_int_equal(status, F_data_not); } - f_string_dynamic_resize(0, &buffer); + free((void *) buffer.string); } void test__f_file_link_read__works(void **state) { @@ -127,7 +127,7 @@ void test__f_file_link_read__works(void **state) { assert_int_equal(status, F_okay); } - f_string_dynamic_resize(0, &buffer); + free((void *) buffer.string); } #ifdef __cplusplus diff --git a/level_0/f_file/tests/unit/c/test-file-link_read_at.c b/level_0/f_file/tests/unit/c/test-file-link_read_at.c index c0941e3..147424a 100644 --- a/level_0/f_file/tests/unit/c/test-file-link_read_at.c +++ b/level_0/f_file/tests/unit/c/test-file-link_read_at.c @@ -60,7 +60,7 @@ void test__f_file_link_read_at__fails(void **state) { assert_int_equal(status, F_status_set_error(statuss[i])); } // for - f_string_dynamic_resize(0, &buffer); + free((void *) buffer.string); } void test__f_file_link_read_at__parameter_checking(void **state) { @@ -74,7 +74,7 @@ void test__f_file_link_read_at__parameter_checking(void **state) { assert_int_equal(status, F_status_set_error(F_parameter)); } - f_string_dynamic_resize(0, &buffer); + free((void *) buffer.string); } void test__f_file_link_read_at__returns_data_not(void **state) { @@ -88,7 +88,7 @@ void test__f_file_link_read_at__returns_data_not(void **state) { assert_int_equal(status, F_data_not); } - f_string_dynamic_resize(0, &buffer); + free((void *) buffer.string); } void test__f_file_link_read_at__returns_file_descriptor_not(void **state) { @@ -102,7 +102,7 @@ void test__f_file_link_read_at__returns_file_descriptor_not(void **state) { assert_int_equal(status, F_file_descriptor_not); } - f_string_dynamic_resize(0, &buffer); + free((void *) buffer.string); } void test__f_file_link_read_at__works(void **state) { @@ -134,7 +134,7 @@ void test__f_file_link_read_at__works(void **state) { assert_int_equal(status, F_okay); } - f_string_dynamic_resize(0, &buffer); + free((void *) buffer.string); } #ifdef __cplusplus diff --git a/level_0/f_file/tests/unit/c/test-file-name_base.c b/level_0/f_file/tests/unit/c/test-file-name_base.c index b398be1..f3f36f2 100644 --- a/level_0/f_file/tests/unit/c/test-file-name_base.c +++ b/level_0/f_file/tests/unit/c/test-file-name_base.c @@ -24,7 +24,7 @@ void test__f_file_name_base__returns_data_not(void **state) { assert_int_equal(status, F_data_not); } - f_string_dynamic_resize(0, &buffer); + free((void *) buffer.string); } void test__f_file_name_base__works(void **state) { @@ -72,7 +72,7 @@ void test__f_file_name_base__works(void **state) { assert_string_equal(buffer.string, bases[i].string); } // for - f_string_dynamic_resize(0, &buffer); + free((void *) buffer.string); } #ifdef __cplusplus diff --git a/level_0/f_file/tests/unit/c/test-file-name_directory.c b/level_0/f_file/tests/unit/c/test-file-name_directory.c index 68c9820..ffb6c47 100644 --- a/level_0/f_file/tests/unit/c/test-file-name_directory.c +++ b/level_0/f_file/tests/unit/c/test-file-name_directory.c @@ -24,7 +24,7 @@ void test__f_file_name_directory__returns_data_not(void **state) { assert_int_equal(status, F_data_not); } - f_string_dynamic_resize(0, &buffer); + free((void *) buffer.string); } void test__f_file_name_directory__works(void **state) { @@ -72,7 +72,7 @@ void test__f_file_name_directory__works(void **state) { assert_string_equal(buffer.string, bases[i].string); } // for - f_string_dynamic_resize(0, &buffer); + free((void *) buffer.string); } #ifdef __cplusplus diff --git a/level_0/f_file/tests/unit/c/test-file-read.c b/level_0/f_file/tests/unit/c/test-file-read.c index a5e1afe..9b8e433 100644 --- a/level_0/f_file/tests/unit/c/test-file-read.c +++ b/level_0/f_file/tests/unit/c/test-file-read.c @@ -46,7 +46,7 @@ void test__f_file_read__fails(void **state) { assert_int_equal(status, F_status_set_error(statuss[i])); } // for - f_string_dynamic_resize(0, &buffer); + free((void *) buffer.string); } void test__f_file_read__parameter_checking(void **state) { @@ -78,7 +78,7 @@ void test__f_file_read__parameter_checking(void **state) { assert_int_equal(status, F_status_set_error(F_parameter)); } - f_string_dynamic_resize(0, &buffer); + free((void *) buffer.string); } void test__f_file_read__returns_file_descriptor_not(void **state) { @@ -92,7 +92,7 @@ void test__f_file_read__returns_file_descriptor_not(void **state) { assert_int_equal(F_status_set_fine(status), F_file_descriptor_not); } - f_string_dynamic_resize(0, &buffer); + free((void *) buffer.string); } void test__f_file_read__works(void **state) { @@ -130,7 +130,7 @@ void test__f_file_read__works(void **state) { assert_string_equal(buffer.string, "abcdef"); } - f_string_dynamic_resize(0, &buffer); + free((void *) buffer.string); } #ifdef __cplusplus diff --git a/level_0/f_file/tests/unit/c/test-file-read_block.c b/level_0/f_file/tests/unit/c/test-file-read_block.c index 627bec2..49fbe93 100644 --- a/level_0/f_file/tests/unit/c/test-file-read_block.c +++ b/level_0/f_file/tests/unit/c/test-file-read_block.c @@ -46,7 +46,7 @@ void test__f_file_read_block__fails(void **state) { assert_int_equal(status, F_status_set_error(statuss[i])); } // for - f_string_dynamic_resize(0, &buffer); + free((void *) buffer.string); } void test__f_file_read_block__parameter_checking(void **state) { @@ -78,7 +78,7 @@ void test__f_file_read_block__parameter_checking(void **state) { assert_int_equal(status, F_status_set_error(F_parameter)); } - f_string_dynamic_resize(0, &buffer); + free((void *) buffer.string); } void test__f_file_read_block__returns_file_descriptor_not(void **state) { @@ -92,7 +92,7 @@ void test__f_file_read_block__returns_file_descriptor_not(void **state) { assert_int_equal(F_status_set_fine(status), F_file_descriptor_not); } - f_string_dynamic_resize(0, &buffer); + free((void *) buffer.string); } void test__f_file_read_block__works(void **state) { @@ -133,7 +133,7 @@ void test__f_file_read_block__works(void **state) { assert_string_equal(buffer.string, "abcd"); } - f_string_dynamic_resize(0, &buffer); + free((void *) buffer.string); } #ifdef __cplusplus diff --git a/level_0/f_file/tests/unit/c/test-file-read_until.c b/level_0/f_file/tests/unit/c/test-file-read_until.c index 3599c59..6d72140 100644 --- a/level_0/f_file/tests/unit/c/test-file-read_until.c +++ b/level_0/f_file/tests/unit/c/test-file-read_until.c @@ -46,7 +46,7 @@ void test__f_file_read_until__fails(void **state) { assert_int_equal(status, F_status_set_error(statuss[i])); } // for - f_string_dynamic_resize(0, &buffer); + free((void *) buffer.string); } void test__f_file_read_until__parameter_checking(void **state) { @@ -78,7 +78,7 @@ void test__f_file_read_until__parameter_checking(void **state) { assert_int_equal(status, F_status_set_error(F_parameter)); } - f_string_dynamic_resize(0, &buffer); + free((void *) buffer.string); } void test__f_file_read_until__returns_file_descriptor_not(void **state) { @@ -92,7 +92,7 @@ void test__f_file_read_until__returns_file_descriptor_not(void **state) { assert_int_equal(F_status_set_fine(status), F_file_descriptor_not); } - f_string_dynamic_resize(0, &buffer); + free((void *) buffer.string); } void test__f_file_read_until__works(void **state) { @@ -149,7 +149,7 @@ void test__f_file_read_until__works(void **state) { assert_string_equal(buffer.string, "abcd"); } - f_string_dynamic_resize(0, &buffer); + free((void *) buffer.string); } #ifdef __cplusplus diff --git a/level_0/f_file/tests/unit/c/test-file-stream_read.c b/level_0/f_file/tests/unit/c/test-file-stream_read.c index ba1734f..ad48724 100644 --- a/level_0/f_file/tests/unit/c/test-file-stream_read.c +++ b/level_0/f_file/tests/unit/c/test-file-stream_read.c @@ -24,7 +24,7 @@ void test__f_file_stream_read__fails(void **state) { assert_int_equal(status, F_status_set_error(F_file_read)); } - f_string_dynamic_resize(0, &buffer); + free((void *) buffer.string); } void test__f_file_stream_read__parameter_checking(void **state) { @@ -65,7 +65,7 @@ void test__f_file_stream_read__returns_stream_not(void **state) { assert_int_equal(F_status_set_fine(status), F_stream_not); } - f_string_dynamic_resize(0, &buffer); + free((void *) buffer.string); } void test__f_file_stream_read__works(void **state) { @@ -91,7 +91,7 @@ void test__f_file_stream_read__works(void **state) { assert_int_equal(status, F_okay_eof); } - f_string_dynamic_resize(0, &buffer); + free((void *) buffer.string); } #ifdef __cplusplus diff --git a/level_0/f_file/tests/unit/c/test-file-stream_read_block.c b/level_0/f_file/tests/unit/c/test-file-stream_read_block.c index 88e6eaa..9fff37d 100644 --- a/level_0/f_file/tests/unit/c/test-file-stream_read_block.c +++ b/level_0/f_file/tests/unit/c/test-file-stream_read_block.c @@ -24,7 +24,7 @@ void test__f_file_stream_read_block__fails(void **state) { assert_int_equal(status, F_status_set_error(F_file_read)); } - f_string_dynamic_resize(0, &buffer); + free((void *) buffer.string); } void test__f_file_stream_read_block__parameter_checking(void **state) { @@ -87,7 +87,7 @@ void test__f_file_stream_read_block__works(void **state) { assert_int_equal(status, F_okay); } - f_string_dynamic_resize(0, &buffer); + free((void *) buffer.string); } #ifdef __cplusplus diff --git a/level_0/f_file/tests/unit/c/test-file-stream_read_until.c b/level_0/f_file/tests/unit/c/test-file-stream_read_until.c index ec11414..bab6f9b 100644 --- a/level_0/f_file/tests/unit/c/test-file-stream_read_until.c +++ b/level_0/f_file/tests/unit/c/test-file-stream_read_until.c @@ -24,7 +24,7 @@ void test__f_file_stream_read_until__fails(void **state) { assert_int_equal(status, F_status_set_error(F_file_read)); } - f_string_dynamic_resize(0, &buffer); + free((void *) buffer.string); } void test__f_file_stream_read_until__parameter_checking(void **state) { @@ -67,7 +67,7 @@ void test__f_file_stream_read_until__returns_stream_not(void **state) { assert_int_equal(F_status_set_fine(status), F_stream_not); } - f_string_dynamic_resize(0, &buffer); + free((void *) buffer.string); } void test__f_file_stream_read_until__works(void **state) { @@ -90,7 +90,7 @@ void test__f_file_stream_read_until__works(void **state) { assert_int_equal(status, F_okay_stop); } - f_string_dynamic_resize(0, &buffer); + free((void *) buffer.string); } #ifdef __cplusplus diff --git a/level_0/f_fss/c/fss/private-item.h b/level_0/f_fss/c/fss/private-item.h index 6e46999..ffb2e5c 100644 --- a/level_0/f_fss/c/fss/private-item.h +++ b/level_0/f_fss/c/fss/private-item.h @@ -61,10 +61,8 @@ 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_string_dynamic_resize(). * * @see f_memory_array_resize() - * @see f_string_dynamic_resize() * * @see f_fss_items_decrease_by() * @see f_fss_items_resize() diff --git a/level_0/f_fss/c/fss/private-nest.h b/level_0/f_fss/c/fss/private-nest.h index a3e8361..1d2e7da 100644 --- a/level_0/f_fss/c/fss/private-nest.h +++ b/level_0/f_fss/c/fss/private-nest.h @@ -59,10 +59,8 @@ 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_string_dynamic_resize(). * * @see f_memory_array_resize() - * @see f_string_dynamic_resize() * * @see f_fss_nests_decrease_by() * @see f_fss_nests_resize() @@ -115,10 +113,8 @@ 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_string_dynamic_resize(). * * @see f_memory_array_resize() - * @see f_string_dynamic_resize() * * @see f_fss_nests_decrease_by() * @see f_fss_nests_increase() diff --git a/level_0/f_fss/c/fss/private-simple_packet.c b/level_0/f_fss/c/fss/private-simple_packet.c index 531bbf0..1fa9913 100644 --- a/level_0/f_fss/c/fss/private-simple_packet.c +++ b/level_0/f_fss/c/fss/private-simple_packet.c @@ -120,7 +120,7 @@ extern "C" { for (f_number_unsigned_t i = length; i < packets->size; ++i) { - status = f_string_dynamic_resize(0, &packets->array[i].payload); + status = f_memory_array(0, sizeof(f_char_t), (void **) &packets->array[i].payload.string, &packets->array[i].payload.used, &packets->array[i].payload.size); if (F_status_is_error(status)) return status; } // for } diff --git a/level_0/f_fss/data/build/settings-mocks b/level_0/f_fss/data/build/settings-mocks index eb8d51a..f1ed649 100644 --- a/level_0/f_fss/data/build/settings-mocks +++ b/level_0/f_fss/data/build/settings-mocks @@ -65,8 +65,6 @@ 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 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 1cc41d6..7f1d864 100644 --- a/level_0/f_fss/tests/unit/c/mock-fss.c +++ b/level_0/f_fss/tests/unit/c/mock-fss.c @@ -75,40 +75,6 @@ f_status_t __wrap_f_memory_arrays_resize(const f_number_unsigned_t length, const 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) { 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 ade2dcd..029174b 100644 --- a/level_0/f_fss/tests/unit/c/mock-fss.h +++ b/level_0/f_fss/tests/unit/c/mock-fss.h @@ -36,8 +36,6 @@ extern f_status_t __real_f_memory_array_resize(const f_number_unsigned_t length, 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); @@ -48,8 +46,6 @@ extern f_status_t __wrap_f_memory_array_resize(const f_number_unsigned_t length, 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); 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 index 4dfb92b..378f903 100644 --- 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 @@ -16,8 +16,8 @@ void test__f_fss_simple_packets_delete_callback__fails(void **state) { 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)); + 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_packets_delete_callback(0, 1, (void *) datas_array); @@ -28,22 +28,28 @@ void test__f_fss_simple_packets_delete_callback__fails(void **state) { void test__f_fss_simple_packets_delete_callback__works(void **state) { mock_unwrap = 0; - mock_unwrap_f_memory = 0; + mock_unwrap_f_memory = 1; - 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; + f_fss_simple_packets_t datas = f_fss_simple_packets_t_initialize; + { - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + f_status_t status = f_memory_array_resize(1, sizeof(f_fss_simple_packet_t), (void **) &datas.array, &datas.used, &datas.size); + assert_int_equal(status, F_okay); + + status = f_memory_array_resize(1, sizeof(f_char_t), (void **) &datas.array[0].payload, &datas.array[0].payload.used, &datas.array[0].payload.size); + assert_int_equal(status, F_okay); + } - const f_status_t status = f_fss_simple_packets_delete_callback(0, length, (void *) datas_array); + { + const f_status_t status = f_fss_simple_packets_delete_callback(0, length, (void *) datas.array); assert_int_equal(status, F_okay); + assert_int_equal(datas.array[0].payload.size, 0); } + + free((void *) datas.array); } #ifdef __cplusplus 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 index 3117b03..f8db961 100644 --- 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 @@ -16,8 +16,8 @@ void test__f_fss_simple_packets_destroy_callback__fails(void **state) { 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)); + 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_packets_destroy_callback(0, 1, (void *) datas_array); @@ -28,22 +28,28 @@ void test__f_fss_simple_packets_destroy_callback__fails(void **state) { void test__f_fss_simple_packets_destroy_callback__works(void **state) { mock_unwrap = 0; - mock_unwrap_f_memory = 0; + mock_unwrap_f_memory = 1; - 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; + f_fss_simple_packets_t datas = f_fss_simple_packets_t_initialize; + { - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + f_status_t status = f_memory_array_resize(1, sizeof(f_fss_simple_packet_t), (void **) &datas.array, &datas.used, &datas.size); + assert_int_equal(status, F_okay); + + status = f_memory_array_resize(1, sizeof(f_char_t), (void **) &datas.array[0].payload, &datas.array[0].payload.used, &datas.array[0].payload.size); + assert_int_equal(status, F_okay); + } - const f_status_t status = f_fss_simple_packets_destroy_callback(0, length, (void *) datas_array); + { + const f_status_t status = f_fss_simple_packets_destroy_callback(0, length, (void *) datas.array); assert_int_equal(status, F_okay); + assert_int_equal(datas.array[0].payload.size, 0); } + + free((void *) datas.array); } #ifdef __cplusplus 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 index 7e77c39..173b366 100644 --- 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 @@ -16,8 +16,8 @@ void test__f_fss_simple_packetss_delete_callback__fails(void **state) { 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)); + 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); @@ -25,8 +25,8 @@ void test__f_fss_simple_packetss_delete_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_resize, false); - will_return(__wrap_f_string_dynamic_resize, F_okay); + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_okay); will_return(__wrap_f_memory_array_resize, true); will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); @@ -39,7 +39,7 @@ void test__f_fss_simple_packetss_delete_callback__fails(void **state) { void test__f_fss_simple_packetss_delete_callback__works(void **state) { - mock_unwrap = 1; + mock_unwrap = 0; mock_unwrap_f_memory = 1; const f_number_unsigned_t length = 1; @@ -53,7 +53,7 @@ void test__f_fss_simple_packetss_delete_callback__works(void **state) { 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_okay); - status = f_string_dynamic_resize(1, &datass.array[0].array[0].payload); + status = f_memory_array_resize(1, sizeof(f_char_t), (void **) &datass.array[0].array[0].payload, &datass.array[0].array[0].payload.used, &datass.array[0].array[0].payload.size); assert_int_equal(status, F_okay); } 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 index 0fd6fae..f0d343a 100644 --- 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 @@ -16,8 +16,8 @@ void test__f_fss_simple_packetss_destroy_callback__fails(void **state) { 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)); + 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); @@ -25,8 +25,8 @@ void test__f_fss_simple_packetss_destroy_callback__fails(void **state) { } { - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_okay); + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_okay); will_return(__wrap_f_memory_array_adjust, true); will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); @@ -39,7 +39,7 @@ void test__f_fss_simple_packetss_destroy_callback__fails(void **state) { void test__f_fss_simple_packetss_destroy_callback__works(void **state) { - mock_unwrap = 1; + mock_unwrap = 0; mock_unwrap_f_memory = 1; const f_number_unsigned_t length = 1; @@ -47,13 +47,13 @@ void test__f_fss_simple_packetss_destroy_callback__works(void **state) { 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); + 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_okay); - 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); + 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_okay); - status = f_string_dynamic_adjust(1, &datass.array[0].array[0].payload); + status = f_memory_array_resize(1, sizeof(f_char_t), (void **) &datass.array[0].array[0].payload, &datass.array[0].array[0].payload.used, &datass.array[0].array[0].payload.size); assert_int_equal(status, F_okay); } diff --git a/level_0/f_limit/tests/unit/c/test-limit-setss_delete_callback.c b/level_0/f_limit/tests/unit/c/test-limit-setss_delete_callback.c index f9177cb..27a9a33 100644 --- a/level_0/f_limit/tests/unit/c/test-limit-setss_delete_callback.c +++ b/level_0/f_limit/tests/unit/c/test-limit-setss_delete_callback.c @@ -27,7 +27,7 @@ void test__f_limit_setss_delete_callback__fails(void **state) { void test__f_limit_setss_delete_callback__works(void **state) { - mock_unwrap = 1; + mock_unwrap = 0; mock_unwrap_f_memory = 1; const f_number_unsigned_t length = 1; diff --git a/level_0/f_limit/tests/unit/c/test-limit-setss_destroy_callback.c b/level_0/f_limit/tests/unit/c/test-limit-setss_destroy_callback.c index 1f5883c..d71e35c 100644 --- a/level_0/f_limit/tests/unit/c/test-limit-setss_destroy_callback.c +++ b/level_0/f_limit/tests/unit/c/test-limit-setss_destroy_callback.c @@ -27,7 +27,7 @@ void test__f_limit_setss_destroy_callback__fails(void **state) { void test__f_limit_setss_destroy_callback__works(void **state) { - mock_unwrap = 1; + mock_unwrap = 0; mock_unwrap_f_memory = 1; const f_number_unsigned_t length = 1; diff --git a/level_0/f_limit/tests/unit/c/test-limit-valuess_delete_callback.c b/level_0/f_limit/tests/unit/c/test-limit-valuess_delete_callback.c index 21881b5..86c1f97 100644 --- a/level_0/f_limit/tests/unit/c/test-limit-valuess_delete_callback.c +++ b/level_0/f_limit/tests/unit/c/test-limit-valuess_delete_callback.c @@ -27,7 +27,7 @@ void test__f_limit_valuess_delete_callback__fails(void **state) { void test__f_limit_valuess_delete_callback__works(void **state) { - mock_unwrap = 1; + mock_unwrap = 0; mock_unwrap_f_memory = 1; const f_number_unsigned_t length = 1; diff --git a/level_0/f_limit/tests/unit/c/test-limit-valuess_destroy_callback.c b/level_0/f_limit/tests/unit/c/test-limit-valuess_destroy_callback.c index 97052e7..ece0e4b 100644 --- a/level_0/f_limit/tests/unit/c/test-limit-valuess_destroy_callback.c +++ b/level_0/f_limit/tests/unit/c/test-limit-valuess_destroy_callback.c @@ -27,7 +27,7 @@ void test__f_limit_valuess_destroy_callback__fails(void **state) { void test__f_limit_valuess_destroy_callback__works(void **state) { - mock_unwrap = 1; + mock_unwrap = 0; mock_unwrap_f_memory = 1; const f_number_unsigned_t length = 1; diff --git a/level_0/f_path/tests/unit/c/test-path-current.c b/level_0/f_path/tests/unit/c/test-path-current.c index 65dc116..21a777c 100644 --- a/level_0/f_path/tests/unit/c/test-path-current.c +++ b/level_0/f_path/tests/unit/c/test-path-current.c @@ -84,7 +84,7 @@ void test__f_path_current__fails(void **state) { } // for } - f_string_dynamic_resize(0, &destination); + free((void *) destination.string); } void test__f_path_current__parameter_checking(void **state) { @@ -130,7 +130,7 @@ void test__f_path_current__works(void **state) { assert_string_equal(destination.string, path_real.string); } - f_string_dynamic_resize(0, &destination); + free((void *) destination.string); } #ifdef __cplusplus diff --git a/level_0/f_path/tests/unit/c/test-path-directory_cleanup.c b/level_0/f_path/tests/unit/c/test-path-directory_cleanup.c index 749246e..2e98742 100644 --- a/level_0/f_path/tests/unit/c/test-path-directory_cleanup.c +++ b/level_0/f_path/tests/unit/c/test-path-directory_cleanup.c @@ -70,10 +70,14 @@ void test__f_path_directory_cleanup__works(void **state) { } // De-allocate each pass to ensure that the NULL termination check is accurate. - f_string_dynamic_resize(0, &destination); - } // for + if (destination.size && destination.string) { + free((void *) destination.string); - f_string_dynamic_resize(0, &destination); + destination.string = 0; + destination.used = 0; + destination.size = 0; + } + } // for } #ifdef __cplusplus diff --git a/level_0/f_path/tests/unit/c/test-path-real.c b/level_0/f_path/tests/unit/c/test-path-real.c index f4f52ca..fdaa32e 100644 --- a/level_0/f_path/tests/unit/c/test-path-real.c +++ b/level_0/f_path/tests/unit/c/test-path-real.c @@ -45,7 +45,7 @@ void test__f_path_real__fails(void **state) { assert_int_equal(status, F_status_set_error(statuss[i])); } // for - f_string_dynamic_resize(0, &destination); + free((void *) destination.string); } void test__f_path_real__parameter_checking(void **state) { @@ -77,7 +77,7 @@ void test__f_path_real__works(void **state) { assert_string_equal(destination.string, path_real.string); } - f_string_dynamic_resize(0, &destination); + free((void *) destination.string); } #ifdef __cplusplus diff --git a/level_0/f_serialize/tests/unit/c/test-serialize-from_simple.c b/level_0/f_serialize/tests/unit/c/test-serialize-from_simple.c index f1f3c15..6f05146 100644 --- a/level_0/f_serialize/tests/unit/c/test-serialize-from_simple.c +++ b/level_0/f_serialize/tests/unit/c/test-serialize-from_simple.c @@ -28,7 +28,7 @@ void test__f_serialize_from_simple__returns_data_not(void **state) { assert_int_equal(status, F_data_not); } - f_string_dynamics_resize(0, &destination); + f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &destination.array, &destination.used, &destination.size, &f_string_dynamics_delete_callback); } void test__f_serialize_from_simple__works(void **state) { @@ -112,7 +112,7 @@ void test__f_serialize_from_simple__works(void **state) { } // for } - f_string_dynamics_resize(0, &destination); + f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &destination.array, &destination.used, &destination.size, &f_string_dynamics_delete_callback); } #ifdef __cplusplus diff --git a/level_0/f_serialize/tests/unit/c/test-serialize-from_simple_get.c b/level_0/f_serialize/tests/unit/c/test-serialize-from_simple_get.c index 157310d..1b64d61 100644 --- a/level_0/f_serialize/tests/unit/c/test-serialize-from_simple_get.c +++ b/level_0/f_serialize/tests/unit/c/test-serialize-from_simple_get.c @@ -26,7 +26,7 @@ void test__f_serialize_from_simple_get__returns_data_not(void **state) { assert_int_equal(status, F_data_not); } - f_string_dynamic_resize(0, &destination); + free((void *) destination.string); } void test__f_serialize_from_simple_get__works(void **state) { @@ -60,7 +60,7 @@ void test__f_serialize_from_simple_get__works(void **state) { } } // for - f_string_dynamic_resize(0, &destination); + free((void *) destination.string); } #ifdef __cplusplus diff --git a/level_0/f_serialize/tests/unit/c/test-serialize-to_simple.c b/level_0/f_serialize/tests/unit/c/test-serialize-to_simple.c index 662c99f..46c8e8b 100644 --- a/level_0/f_serialize/tests/unit/c/test-serialize-to_simple.c +++ b/level_0/f_serialize/tests/unit/c/test-serialize-to_simple.c @@ -28,7 +28,7 @@ void test__f_serialize_to_simple__returns_data_not(void **state) { assert_int_equal(status, F_data_not); } - f_string_dynamic_resize(0, &destination); + free((void *) destination.string); } void test__f_serialize_to_simple__works(void **state) { @@ -52,7 +52,7 @@ void test__f_serialize_to_simple__works(void **state) { assert_string_equal(destination.string, multiple.string); } - f_string_dynamic_resize(0, &destination); + free((void *) destination.string); } #ifdef __cplusplus diff --git a/level_0/f_socket/tests/unit/c/test-socket-addressss_delete_callback.c b/level_0/f_socket/tests/unit/c/test-socket-addressss_delete_callback.c index 76df482..7f9b0b8 100644 --- a/level_0/f_socket/tests/unit/c/test-socket-addressss_delete_callback.c +++ b/level_0/f_socket/tests/unit/c/test-socket-addressss_delete_callback.c @@ -27,7 +27,7 @@ void test__f_socket_addressss_delete_callback__fails(void **state) { void test__f_socket_addressss_delete_callback__works(void **state) { - mock_unwrap = 1; + mock_unwrap = 0; mock_unwrap_f_memory = 1; const f_number_unsigned_t length = 1; diff --git a/level_0/f_socket/tests/unit/c/test-socket-addressss_destroy_callback.c b/level_0/f_socket/tests/unit/c/test-socket-addressss_destroy_callback.c index 0494e5b..f4bc4c2 100644 --- a/level_0/f_socket/tests/unit/c/test-socket-addressss_destroy_callback.c +++ b/level_0/f_socket/tests/unit/c/test-socket-addressss_destroy_callback.c @@ -27,7 +27,7 @@ void test__f_socket_addressss_destroy_callback__fails(void **state) { void test__f_socket_addressss_destroy_callback__works(void **state) { - mock_unwrap = 1; + mock_unwrap = 0; mock_unwrap_f_memory = 1; const f_number_unsigned_t length = 1; diff --git a/level_0/f_socket/tests/unit/c/test-socket-ss_delete_callback.c b/level_0/f_socket/tests/unit/c/test-socket-ss_delete_callback.c index 1e19fff..8c3e300 100644 --- a/level_0/f_socket/tests/unit/c/test-socket-ss_delete_callback.c +++ b/level_0/f_socket/tests/unit/c/test-socket-ss_delete_callback.c @@ -27,7 +27,7 @@ void test__f_socket_ss_delete_callback__fails(void **state) { void test__f_socket_ss_delete_callback__works(void **state) { - mock_unwrap = 1; + mock_unwrap = 0; mock_unwrap_f_memory = 1; const f_number_unsigned_t length = 1; diff --git a/level_0/f_socket/tests/unit/c/test-socket-ss_destroy_callback.c b/level_0/f_socket/tests/unit/c/test-socket-ss_destroy_callback.c index 0a84229..9264d29 100644 --- a/level_0/f_socket/tests/unit/c/test-socket-ss_destroy_callback.c +++ b/level_0/f_socket/tests/unit/c/test-socket-ss_destroy_callback.c @@ -27,7 +27,7 @@ void test__f_socket_ss_destroy_callback__fails(void **state) { void test__f_socket_ss_destroy_callback__works(void **state) { - mock_unwrap = 1; + mock_unwrap = 0; mock_unwrap_f_memory = 1; const f_number_unsigned_t length = 1; diff --git a/level_0/f_string/data/build/settings b/level_0/f_string/data/build/settings index ec958fe..e80e4a7 100644 --- a/level_0/f_string/data/build/settings +++ b/level_0/f_string/data/build/settings @@ -34,7 +34,7 @@ build_libraries-individual -lf_memory build_sources_library string.c build_sources_library private-string.c string/common.c -build_sources_library string/private-dynamics.c string/private-dynamicss.c +build_sources_library string/private-dynamics.c build_sources_library string/private-maps.c string/private-mapss.c build_sources_library string/private-map_multis.c string/private-map_multiss.c build_sources_library string/private-quantitys.c string/private-quantityss.c diff --git a/level_0/f_string/data/build/settings-tests b/level_0/f_string/data/build/settings-tests index 1c151b5..3d6574f 100644 --- a/level_0/f_string/data/build/settings-tests +++ b/level_0/f_string/data/build/settings-tests @@ -26,8 +26,7 @@ build_libraries -lc -lcmocka build_libraries-individual -lf_memory -lf_string build_sources_program test-string-append.c test-string-append_assure.c test-string-append_assure_nulless.c test-string-append_nulless.c -build_sources_program test-string-dynamic_adjust.c test-string-dynamic_append.c test-string-dynamic_append_assure.c test-string-dynamic_append_assure_nulless.c test-string-dynamic_append_nulless.c -build_sources_program test-string-dynamic_decimate_by.c test-string-dynamic_decrease_by.c test-string-dynamic_increase.c test-string-dynamic_increase_by.c +build_sources_program test-string-dynamic_append.c test-string-dynamic_append_assure.c test-string-dynamic_append_assure_nulless.c test-string-dynamic_append_nulless.c build_sources_program test-string-dynamic_mash.c test-string-dynamic_mash_nulless.c build_sources_program test-string-dynamic_mish.c test-string-dynamic_mish_nulless.c build_sources_program test-string-dynamic_partial_append.c test-string-dynamic_partial_append_assure.c test-string-dynamic_partial_append_assure_nulless.c test-string-dynamic_partial_append_nulless.c @@ -35,10 +34,9 @@ build_sources_program test-string-dynamic_partial_mash.c test-string-dynamic_par build_sources_program test-string-dynamic_partial_mish.c test-string-dynamic_partial_mish_nulless.c build_sources_program test-string-dynamic_partial_prepend.c test-string-dynamic_partial_prepend_assure.c test-string-dynamic_partial_prepend_assure_nulless.c test-string-dynamic_partial_prepend_nulless.c build_sources_program test-string-dynamic_prepend.c test-string-dynamic_prepend_assure.c test-string-dynamic_prepend_assure_nulless.c test-string-dynamic_prepend_nulless.c -build_sources_program test-string-dynamic_resize.c build_sources_program test-string-dynamic_seek_line.c test-string-dynamic_seek_line_to.c test-string-dynamic_seek_to.c build_sources_program test-string-dynamic_terminate.c test-string-dynamic_terminate_after.c -build_sources_program test-string-dynamics_adjust.c test-string-dynamics_append.c test-string-dynamics_append_all.c test-string-dynamics_decimate_by.c test-string-dynamics_decrease_by.c test-string-dynamics_increase.c test-string-dynamics_increase_by.c test-string-dynamics_resize.c test-string-dynamicss_adjust.c test-string-dynamicss_append.c test-string-dynamicss_append_all.c test-string-dynamicss_decimate_by.c test-string-dynamicss_decrease_by.c test-string-dynamicss_increase.c test-string-dynamicss_increase_by.c test-string-dynamicss_resize.c +build_sources_program test-string-dynamics_append.c test-string-dynamics_append_all.c test-string-dynamicss_append.c test-string-dynamicss_append_all.c build_sources_program test-string-map_multis_adjust.c test-string-map_multis_append.c test-string-map_multis_append_all.c test-string-map_multis_decimate_by.c test-string-map_multis_decrease_by.c test-string-map_multis_increase.c test-string-map_multis_increase_by.c test-string-map_multis_resize.c test-string-map_multiss_adjust.c test-string-map_multiss_append.c test-string-map_multiss_append_all.c test-string-map_multiss_decimate_by.c test-string-map_multiss_decrease_by.c test-string-map_multiss_increase.c test-string-map_multiss_increase_by.c test-string-map_multiss_resize.c build_sources_program test-string-maps_adjust.c test-string-maps_append.c test-string-maps_append_all.c test-string-maps_decimate_by.c test-string-maps_decrease_by.c test-string-maps_increase.c test-string-maps_increase_by.c test-string-maps_resize.c test-string-mapss_adjust.c test-string-mapss_append.c test-string-mapss_append_all.c test-string-mapss_decimate_by.c test-string-mapss_decrease_by.c test-string-mapss_increase.c test-string-mapss_increase_by.c test-string-mapss_resize.c build_sources_program test-string-mash.c test-string-mash_nulless.c diff --git a/level_0/f_string/tests/unit/c/test-string-dynamic_adjust.c b/level_0/f_string/tests/unit/c/test-string-dynamic_adjust.c deleted file mode 100644 index 464b7f6..0000000 --- a/level_0/f_string/tests/unit/c/test-string-dynamic_adjust.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-string.h" -#include "test-string-dynamic_adjust.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_string_dynamic_adjust__works(void **state) { - - const int length = 5; - f_string_dynamic_t data = f_string_dynamic_t_initialize; - - { - const f_status_t status = f_string_dynamic_adjust(length, &data); - - assert_int_equal(status, F_okay); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.string); -} - -void test__f_string_dynamic_adjust__parameter_checking(void **state) { - - const int length = 5; - f_string_dynamic_t data = f_string_dynamic_t_initialize; - - { - const f_status_t status = f_string_dynamic_adjust(length, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.string); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_string/tests/unit/c/test-string-dynamic_adjust.h b/level_0/f_string/tests/unit/c/test-string-dynamic_adjust.h deleted file mode 100644 index 1f7ee7d..0000000 --- a/level_0/f_string/tests/unit/c/test-string-dynamic_adjust.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_string__string_dynamic_adjust -#define _TEST__F_string__string_dynamic_adjust - -/** - * Test that the function works. - * - * @see f_string_dynamic_adjust() - */ -extern void test__f_string_dynamic_adjust__works(void **state); - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_string_dynamic_adjust() - */ -extern void test__f_string_dynamic_adjust__parameter_checking(void **state); - -#endif // _TEST__F_string__string_dynamic_adjust diff --git a/level_0/f_string/tests/unit/c/test-string-dynamic_decimate_by.c b/level_0/f_string/tests/unit/c/test-string-dynamic_decimate_by.c deleted file mode 100644 index ddc3677..0000000 --- a/level_0/f_string/tests/unit/c/test-string-dynamic_decimate_by.c +++ /dev/null @@ -1,50 +0,0 @@ -#include "test-string.h" -#include "test-string-dynamic_decimate_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_string_dynamic_decimate_by__works(void **state) { - - const int length = 5; - f_string_dynamic_t data = f_string_dynamic_t_initialize; - - { - const f_status_t status = f_string_dynamic_resize(length, &data); - - assert_int_equal(status, F_okay); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_string_dynamic_decimate_by(length, &data); - - assert_int_equal(status, F_okay); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.string); -} - -void test__f_string_dynamic_decimate_by__parameter_checking(void **state) { - - const int length = 5; - f_string_dynamic_t data = f_string_dynamic_t_initialize; - - { - const f_status_t status = f_string_dynamic_decimate_by(length, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.string); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_string/tests/unit/c/test-string-dynamic_decimate_by.h b/level_0/f_string/tests/unit/c/test-string-dynamic_decimate_by.h deleted file mode 100644 index 201d78a..0000000 --- a/level_0/f_string/tests/unit/c/test-string-dynamic_decimate_by.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_dynamic_decimate_by_h -#define _TEST__F_dynamic_decimate_by_h - -/** - * Test that the function works. - * - * @see f_string_dynamic_decimate_by() - */ -extern void test__f_string_dynamic_decimate_by__works(void **state); - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_string_dynamic_decimate_by() - */ -extern void test__f_string_dynamic_decimate_by__parameter_checking(void **state); - -#endif // _TEST__F_dynamic_decimate_by_h diff --git a/level_0/f_string/tests/unit/c/test-string-dynamic_decrease_by.c b/level_0/f_string/tests/unit/c/test-string-dynamic_decrease_by.c deleted file mode 100644 index d0662f0..0000000 --- a/level_0/f_string/tests/unit/c/test-string-dynamic_decrease_by.c +++ /dev/null @@ -1,50 +0,0 @@ -#include "test-string.h" -#include "test-string-dynamic_decrease_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_string_dynamic_decrease_by__works(void **state) { - - const int length = 5; - f_string_dynamic_t data = f_string_dynamic_t_initialize; - - { - const f_status_t status = f_string_dynamic_resize(length, &data); - - assert_int_equal(status, F_okay); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_string_dynamic_decrease_by(length, &data); - - assert_int_equal(status, F_okay); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.string); -} - -void test__f_string_dynamic_decrease_by__parameter_checking(void **state) { - - const int length = 5; - f_string_dynamic_t data = f_string_dynamic_t_initialize; - - { - const f_status_t status = f_string_dynamic_decrease_by(length, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.string); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_string/tests/unit/c/test-string-dynamic_decrease_by.h b/level_0/f_string/tests/unit/c/test-string-dynamic_decrease_by.h deleted file mode 100644 index 46fe906..0000000 --- a/level_0/f_string/tests/unit/c/test-string-dynamic_decrease_by.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_string_dynamic_decrease_by_h -#define _TEST__F_string_dynamic_decrease_by_h - -/** - * Test that the function works. - * - * @see f_string_dynamic_decrease_by() - */ -extern void test__f_string_dynamic_decrease_by__works(void **state); - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_string_dynamic_decrease_by() - */ -extern void test__f_string_dynamic_decrease_by__parameter_checking(void **state); - -#endif // _TEST__F_string_dynamic_decrease_by_h diff --git a/level_0/f_string/tests/unit/c/test-string-dynamic_increase.c b/level_0/f_string/tests/unit/c/test-string-dynamic_increase.c deleted file mode 100644 index a1cc8ca..0000000 --- a/level_0/f_string/tests/unit/c/test-string-dynamic_increase.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-string.h" -#include "test-string-dynamic_increase.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_string_dynamic_increase__works(void **state) { - - const int length = 5; - f_string_dynamic_t data = f_string_dynamic_t_initialize; - - { - const f_status_t status = f_string_dynamic_resize(length, &data); - - assert_int_equal(status, F_okay); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_string_dynamic_increase(length, &data); - - assert_int_equal(status, F_okay); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); - } - - free((void *) data.string); -} - -void test__f_string_dynamic_increase__returns_data_not(void **state) { - - const int length = 5; - f_string_dynamic_t data = f_string_dynamic_t_initialize; - - { - const f_status_t status = f_string_dynamic_resize(length, &data); - - assert_int_equal(status, F_okay); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_string_dynamic_increase(length, &data); - - assert_int_equal(status, F_data_not); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.string); -} - -void test__f_string_dynamic_increase__parameter_checking(void **state) { - - const int length = 5; - f_string_dynamic_t data = f_string_dynamic_t_initialize; - - { - const f_status_t status = f_string_dynamic_increase(length, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - free((void *) data.string); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_string/tests/unit/c/test-string-dynamic_increase.h b/level_0/f_string/tests/unit/c/test-string-dynamic_increase.h deleted file mode 100644 index 1c9715e..0000000 --- a/level_0/f_string/tests/unit/c/test-string-dynamic_increase.h +++ /dev/null @@ -1,34 +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_string_dynamic_increase_h -#define _TEST__F_string_dynamic_increase_h - -/** - * Test that the function works. - * - * @see f_string_dynamic_increase() - */ -extern void test__f_string_dynamic_increase__works(void **state); - -/** - * Test that the function returns F_data_not when asked to copy an empty structure. - * - * @see f_string_dynamic_increase() - */ -extern void test__f_string_dynamic_increase__returns_data_not(void **state); - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_string_dynamic_increase() - */ -extern void test__f_string_dynamic_increase__parameter_checking(void **state); - -#endif // _TEST__F_string_dynamic_increase_h diff --git a/level_0/f_string/tests/unit/c/test-string-dynamic_increase_by.c b/level_0/f_string/tests/unit/c/test-string-dynamic_increase_by.c deleted file mode 100644 index 73fb929..0000000 --- a/level_0/f_string/tests/unit/c/test-string-dynamic_increase_by.c +++ /dev/null @@ -1,52 +0,0 @@ -#include "test-string.h" -#include "test-string-dynamic_increase_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_string_dynamic_increase_by__works(void **state) { - - const int length = 5; - f_string_dynamic_t data = f_string_dynamic_t_initialize; - - { - const f_status_t status = f_string_dynamic_resize(length, &data); - - assert_int_equal(status, F_okay); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_string_dynamic_increase_by(length, &data); - - assert_int_equal(status, F_okay); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); - } - - free((void *) data.string); -} - -void test__f_string_dynamic_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_string_dynamic_t data = f_string_dynamic_t_initialize; - - { - const f_status_t status = f_string_dynamic_increase_by(length, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.string); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_string/tests/unit/c/test-string-dynamic_increase_by.h b/level_0/f_string/tests/unit/c/test-string-dynamic_increase_by.h deleted file mode 100644 index 1703bea..0000000 --- a/level_0/f_string/tests/unit/c/test-string-dynamic_increase_by.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_string_dynamic_increase_by_h -#define _TEST__F_string_dynamic_increase_by_h - -/** - * Test that the function works. - * - * @see f_string_dynamic_increase_by() - */ -extern void test__f_string_dynamic_increase_by__works(void **state); - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_string_dynamic_increase_by() - */ -extern void test__f_string_dynamic_increase_by__parameter_checking(void **state); - -#endif // _TEST__F_string_dynamic_increase_by_h diff --git a/level_0/f_string/tests/unit/c/test-string-dynamic_resize.c b/level_0/f_string/tests/unit/c/test-string-dynamic_resize.c deleted file mode 100644 index 370ec19..0000000 --- a/level_0/f_string/tests/unit/c/test-string-dynamic_resize.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-string.h" -#include "test-string-dynamic_resize.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_string_dynamic_resize__works(void **state) { - - const int length = 5; - f_string_dynamic_t data = f_string_dynamic_t_initialize; - - { - const f_status_t status = f_string_dynamic_resize(length, &data); - - assert_int_equal(status, F_okay); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.string); -} - -void test__f_string_dynamic_resize__parameter_checking(void **state) { - - const int length = 5; - f_string_dynamic_t data = f_string_dynamic_t_initialize; - - { - const f_status_t status = f_string_dynamic_resize(length, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.string); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_string/tests/unit/c/test-string-dynamic_resize.h b/level_0/f_string/tests/unit/c/test-string-dynamic_resize.h deleted file mode 100644 index c1a9a2a..0000000 --- a/level_0/f_string/tests/unit/c/test-string-dynamic_resize.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_string_dynamic_resize_h -#define _TEST__F_string_dynamic_resize_h - -/** - * Test that the function works. - * - * @see f_string_dynamic_resize() - */ -extern void test__f_string_dynamic_resize__works(void **state); - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_string_dynamic_resize() - */ -extern void test__f_string_dynamic_resize__parameter_checking(void **state); - -#endif // _TEST__F_string_dynamic_resize_h diff --git a/level_0/f_string/tests/unit/c/test-string-dynamic_terminate.c b/level_0/f_string/tests/unit/c/test-string-dynamic_terminate.c index fd37da5..6deb5bb 100644 --- a/level_0/f_string/tests/unit/c/test-string-dynamic_terminate.c +++ b/level_0/f_string/tests/unit/c/test-string-dynamic_terminate.c @@ -12,7 +12,7 @@ void test__f_string_dynamic_terminate__appends_null(void **state) { // Put some value in the unused section at the end so that it gets overridden. { - const f_status_t status = f_string_dynamic_resize(length, &data); + const f_status_t status = f_memory_array_resize(length, sizeof(f_char_t), (void **) &data.string, &data.used, &data.size); assert_int_equal(status, F_okay); @@ -37,7 +37,7 @@ void test__f_string_dynamic_terminate__doesnt_append_null(void **state) { // Ensure a NULL already exists so that the test can confirm that another NULL is not appended. { - const f_status_t status = f_string_dynamic_resize(length, &data); + const f_status_t status = f_memory_array_resize(length, sizeof(f_char_t), (void **) &data.string, &data.used, &data.size); assert_int_equal(status, F_okay); diff --git a/level_0/f_string/tests/unit/c/test-string-dynamic_terminate_after.c b/level_0/f_string/tests/unit/c/test-string-dynamic_terminate_after.c index 9354a76..0c5f5e7 100644 --- a/level_0/f_string/tests/unit/c/test-string-dynamic_terminate_after.c +++ b/level_0/f_string/tests/unit/c/test-string-dynamic_terminate_after.c @@ -11,7 +11,7 @@ void test__f_string_dynamic_terminate_after__appends_null(void **state) { // Put some value in the unused section at the end so that it gets overridden. { - const f_status_t status = f_string_dynamic_resize(length, &data); + const f_status_t status = f_memory_array_resize(length, sizeof(f_char_t), (void **) &data.string, &data.used, &data.size); assert_int_equal(status, F_okay); @@ -38,7 +38,7 @@ void test__f_string_dynamic_terminate_after__doesnt_append_null(void **state) { // Ensure a NULL already exists so that the test can confirm that another NULL is not appended. { - const f_status_t status = f_string_dynamic_resize(length, &data); + const f_status_t status = f_memory_array_resize(length, sizeof(f_char_t), (void **) &data.string, &data.used, &data.size); assert_int_equal(status, F_okay); assert_in_range(data.size, length, length + F_memory_default_allocation_small_d); diff --git a/level_0/f_string/tests/unit/c/test-string-dynamics_adjust.c b/level_0/f_string/tests/unit/c/test-string-dynamics_adjust.c deleted file mode 100644 index 846219a..0000000 --- a/level_0/f_string/tests/unit/c/test-string-dynamics_adjust.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-string.h" -#include "test-string-dynamics_adjust.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_string_dynamics_adjust__works(void **state) { - - const int length = 5; - f_string_dynamics_t data = f_string_dynamics_t_initialize; - - { - const f_status_t status = f_string_dynamics_adjust(length, &data); - - assert_int_equal(status, F_okay); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -void test__f_string_dynamics_adjust__parameter_checking(void **state) { - - const int length = 5; - f_string_dynamics_t data = f_string_dynamics_t_initialize; - - { - const f_status_t status = f_string_dynamics_adjust(length, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_string/tests/unit/c/test-string-dynamics_adjust.h b/level_0/f_string/tests/unit/c/test-string-dynamics_adjust.h deleted file mode 100644 index 2ada38e..0000000 --- a/level_0/f_string/tests/unit/c/test-string-dynamics_adjust.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_string__string_dynamics_adjust -#define _TEST__F_string__string_dynamics_adjust - -/** - * Test that the function works. - * - * @see f_string_dynamics_adjust() - */ -extern void test__f_string_dynamics_adjust__works(void **state); - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_string_dynamics_adjust() - */ -extern void test__f_string_dynamics_adjust__parameter_checking(void **state); - -#endif // _TEST__F_string__string_dynamics_adjust diff --git a/level_0/f_string/tests/unit/c/test-string-dynamics_append_all.c b/level_0/f_string/tests/unit/c/test-string-dynamics_append_all.c index 88f62c5..ead7640 100644 --- a/level_0/f_string/tests/unit/c/test-string-dynamics_append_all.c +++ b/level_0/f_string/tests/unit/c/test-string-dynamics_append_all.c @@ -17,7 +17,7 @@ void test__f_string_dynamics_append_all__works(void **state) { }; { - f_status_t status = f_string_dynamics_resize(length_inner, &source); + f_status_t status = f_memory_arrays_resize(length_inner, sizeof(f_string_dynamic_t), (void **) &source.array, &source.used, &source.size, &f_string_dynamics_delete_callback); assert_int_equal(status, F_okay); assert_int_equal(source.size, length_inner); @@ -68,7 +68,7 @@ void test__f_string_dynamics_append_all__returns_data_not(void **state) { f_string_dynamics_t destination = f_string_dynamics_t_initialize; { - const f_status_t status = f_string_dynamics_resize(length, &source); + const f_status_t status = f_memory_arrays_resize(length, sizeof(f_string_dynamic_t), (void **) &source.array, &source.used, &source.size, &f_string_dynamics_delete_callback); assert_int_equal(status, F_okay); assert_int_equal(source.used, 0); diff --git a/level_0/f_string/tests/unit/c/test-string-dynamics_decimate_by.c b/level_0/f_string/tests/unit/c/test-string-dynamics_decimate_by.c deleted file mode 100644 index a83decd..0000000 --- a/level_0/f_string/tests/unit/c/test-string-dynamics_decimate_by.c +++ /dev/null @@ -1,50 +0,0 @@ -#include "test-string.h" -#include "test-string-dynamics_decimate_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_string_dynamics_decimate_by__works(void **state) { - - const int length = 5; - f_string_dynamics_t data = f_string_dynamics_t_initialize; - - { - const f_status_t status = f_string_dynamics_resize(length, &data); - - assert_int_equal(status, F_okay); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_string_dynamics_decimate_by(length, &data); - - assert_int_equal(status, F_okay); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -void test__f_string_dynamics_decimate_by__parameter_checking(void **state) { - - const int length = 5; - f_string_dynamics_t data = f_string_dynamics_t_initialize; - - { - const f_status_t status = f_string_dynamics_decimate_by(length, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_string/tests/unit/c/test-string-dynamics_decimate_by.h b/level_0/f_string/tests/unit/c/test-string-dynamics_decimate_by.h deleted file mode 100644 index df19961..0000000 --- a/level_0/f_string/tests/unit/c/test-string-dynamics_decimate_by.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_dynamics_decimate_by_h -#define _TEST__F_dynamics_decimate_by_h - -/** - * Test that the function works. - * - * @see f_string_dynamics_decimate_by() - */ -extern void test__f_string_dynamics_decimate_by__works(void **state); - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_string_dynamics_decimate_by() - */ -extern void test__f_string_dynamics_decimate_by__parameter_checking(void **state); - -#endif // _TEST__F_dynamics_decimate_by_h diff --git a/level_0/f_string/tests/unit/c/test-string-dynamics_decrease_by.c b/level_0/f_string/tests/unit/c/test-string-dynamics_decrease_by.c deleted file mode 100644 index 63dbc22..0000000 --- a/level_0/f_string/tests/unit/c/test-string-dynamics_decrease_by.c +++ /dev/null @@ -1,50 +0,0 @@ -#include "test-string.h" -#include "test-string-dynamics_decrease_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_string_dynamics_decrease_by__works(void **state) { - - const int length = 5; - f_string_dynamics_t data = f_string_dynamics_t_initialize; - - { - const f_status_t status = f_string_dynamics_resize(length, &data); - - assert_int_equal(status, F_okay); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_string_dynamics_decrease_by(length, &data); - - assert_int_equal(status, F_okay); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -void test__f_string_dynamics_decrease_by__parameter_checking(void **state) { - - const int length = 5; - f_string_dynamics_t data = f_string_dynamics_t_initialize; - - { - const f_status_t status = f_string_dynamics_decrease_by(length, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_string/tests/unit/c/test-string-dynamics_decrease_by.h b/level_0/f_string/tests/unit/c/test-string-dynamics_decrease_by.h deleted file mode 100644 index 29a90e2..0000000 --- a/level_0/f_string/tests/unit/c/test-string-dynamics_decrease_by.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_string_dynamics_decrease_by_h -#define _TEST__F_string_dynamics_decrease_by_h - -/** - * Test that the function works. - * - * @see f_string_dynamics_decrease_by() - */ -extern void test__f_string_dynamics_decrease_by__works(void **state); - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_string_dynamics_decrease_by() - */ -extern void test__f_string_dynamics_decrease_by__parameter_checking(void **state); - -#endif // _TEST__F_string_dynamics_decrease_by_h diff --git a/level_0/f_string/tests/unit/c/test-string-dynamics_increase.c b/level_0/f_string/tests/unit/c/test-string-dynamics_increase.c deleted file mode 100644 index d47798d..0000000 --- a/level_0/f_string/tests/unit/c/test-string-dynamics_increase.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-string.h" -#include "test-string-dynamics_increase.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_string_dynamics_increase__works(void **state) { - - const int length = 5; - f_string_dynamics_t data = f_string_dynamics_t_initialize; - - { - const f_status_t status = f_string_dynamics_resize(length, &data); - - assert_int_equal(status, F_okay); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_string_dynamics_increase(length, &data); - - assert_int_equal(status, F_okay); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); - } - - free((void *) data.array); -} - -void test__f_string_dynamics_increase__returns_data_not(void **state) { - - const int length = 5; - f_string_dynamics_t data = f_string_dynamics_t_initialize; - - { - const f_status_t status = f_string_dynamics_resize(length, &data); - - assert_int_equal(status, F_okay); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_string_dynamics_increase(length, &data); - - assert_int_equal(status, F_data_not); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -void test__f_string_dynamics_increase__parameter_checking(void **state) { - - const int length = 5; - f_string_dynamics_t data = f_string_dynamics_t_initialize; - - { - const f_status_t status = f_string_dynamics_increase(length, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_string/tests/unit/c/test-string-dynamics_increase.h b/level_0/f_string/tests/unit/c/test-string-dynamics_increase.h deleted file mode 100644 index ded5662..0000000 --- a/level_0/f_string/tests/unit/c/test-string-dynamics_increase.h +++ /dev/null @@ -1,34 +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_string_dynamics_increase_h -#define _TEST__F_string_dynamics_increase_h - -/** - * Test that the function works. - * - * @see f_string_dynamics_increase() - */ -extern void test__f_string_dynamics_increase__works(void **state); - -/** - * Test that the function returns F_data_not when asked to copy an empty structure. - * - * @see f_string_dynamics_increase() - */ -extern void test__f_string_dynamics_increase__returns_data_not(void **state); - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_string_dynamics_increase() - */ -extern void test__f_string_dynamics_increase__parameter_checking(void **state); - -#endif // _TEST__F_string_dynamics_increase_h diff --git a/level_0/f_string/tests/unit/c/test-string-dynamics_increase_by.c b/level_0/f_string/tests/unit/c/test-string-dynamics_increase_by.c deleted file mode 100644 index 4816174..0000000 --- a/level_0/f_string/tests/unit/c/test-string-dynamics_increase_by.c +++ /dev/null @@ -1,52 +0,0 @@ -#include "test-string.h" -#include "test-string-dynamics_increase_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_string_dynamics_increase_by__works(void **state) { - - const int length = 5; - f_string_dynamics_t data = f_string_dynamics_t_initialize; - - { - const f_status_t status = f_string_dynamics_resize(length, &data); - - assert_int_equal(status, F_okay); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_string_dynamics_increase_by(length, &data); - - assert_int_equal(status, F_okay); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); - } - - free((void *) data.array); -} - -void test__f_string_dynamics_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_string_dynamics_t data = f_string_dynamics_t_initialize; - - { - const f_status_t status = f_string_dynamics_increase_by(length, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_string/tests/unit/c/test-string-dynamics_increase_by.h b/level_0/f_string/tests/unit/c/test-string-dynamics_increase_by.h deleted file mode 100644 index 58683ea..0000000 --- a/level_0/f_string/tests/unit/c/test-string-dynamics_increase_by.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_string_dynamics_increase_by_h -#define _TEST__F_string_dynamics_increase_by_h - -/** - * Test that the function works. - * - * @see f_string_dynamics_increase_by() - */ -extern void test__f_string_dynamics_increase_by__works(void **state); - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_string_dynamics_increase_by() - */ -extern void test__f_string_dynamics_increase_by__parameter_checking(void **state); - -#endif // _TEST__F_string_dynamics_increase_by_h diff --git a/level_0/f_string/tests/unit/c/test-string-dynamics_resize.c b/level_0/f_string/tests/unit/c/test-string-dynamics_resize.c deleted file mode 100644 index 1d6c56f..0000000 --- a/level_0/f_string/tests/unit/c/test-string-dynamics_resize.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-string.h" -#include "test-string-dynamics_resize.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_string_dynamics_resize__works(void **state) { - - const int length = 5; - f_string_dynamics_t data = f_string_dynamics_t_initialize; - - { - const f_status_t status = f_string_dynamics_resize(length, &data); - - assert_int_equal(status, F_okay); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -void test__f_string_dynamics_resize__parameter_checking(void **state) { - - const int length = 5; - f_string_dynamics_t data = f_string_dynamics_t_initialize; - - { - const f_status_t status = f_string_dynamics_resize(length, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_string/tests/unit/c/test-string-dynamics_resize.h b/level_0/f_string/tests/unit/c/test-string-dynamics_resize.h deleted file mode 100644 index ae5aca5..0000000 --- a/level_0/f_string/tests/unit/c/test-string-dynamics_resize.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_string_dynamics_resize_h -#define _TEST__F_string_dynamics_resize_h - -/** - * Test that the function works. - * - * @see f_string_dynamics_resize() - */ -extern void test__f_string_dynamics_resize__works(void **state); - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_string_dynamics_resize() - */ -extern void test__f_string_dynamics_resize__parameter_checking(void **state); - -#endif // _TEST__F_string_dynamics_resize_h diff --git a/level_0/f_string/tests/unit/c/test-string-dynamicss_adjust.c b/level_0/f_string/tests/unit/c/test-string-dynamicss_adjust.c deleted file mode 100644 index 5df8040..0000000 --- a/level_0/f_string/tests/unit/c/test-string-dynamicss_adjust.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-string.h" -#include "test-string-dynamicss_adjust.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_string_dynamicss_adjust__works(void **state) { - - const int length = 5; - f_string_dynamicss_t data = f_string_dynamicss_t_initialize; - - { - const f_status_t status = f_string_dynamicss_adjust(length, &data); - - assert_int_equal(status, F_okay); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -void test__f_string_dynamicss_adjust__parameter_checking(void **state) { - - const int length = 5; - f_string_dynamicss_t data = f_string_dynamicss_t_initialize; - - { - const f_status_t status = f_string_dynamicss_adjust(length, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_string/tests/unit/c/test-string-dynamicss_adjust.h b/level_0/f_string/tests/unit/c/test-string-dynamicss_adjust.h deleted file mode 100644 index e503654..0000000 --- a/level_0/f_string/tests/unit/c/test-string-dynamicss_adjust.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_string_dynamicss_adjust_h -#define _TEST__F_string_dynamicss_adjust_h - -/** - * Test that the function works. - * - * @see f_string_dynamicss_adjust() - */ -extern void test__f_string_dynamicss_adjust__works(void **state); - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_string_dynamicss_adjust() - */ -extern void test__f_string_dynamicss_adjust__parameter_checking(void **state); - -#endif // _TEST__F_string_dynamicss_adjust_h diff --git a/level_0/f_string/tests/unit/c/test-string-dynamicss_append.c b/level_0/f_string/tests/unit/c/test-string-dynamicss_append.c index da80177..9e17da4 100644 --- a/level_0/f_string/tests/unit/c/test-string-dynamicss_append.c +++ b/level_0/f_string/tests/unit/c/test-string-dynamicss_append.c @@ -17,7 +17,7 @@ void test__f_string_dynamicss_append__works(void **state) { }; { - f_status_t status = f_string_dynamics_resize(length_inner, &source); + f_status_t status = f_memory_arrays_resize(length_inner, sizeof(f_string_dynamic_t), (void **) &source.array, &source.used, &source.size, &f_string_dynamics_delete_callback); assert_int_equal(status, F_okay); assert_int_equal(source.size, length_inner); @@ -67,7 +67,7 @@ void test__f_string_dynamicss_append__returns_data_not(void **state) { f_string_dynamicss_t destination = f_string_dynamicss_t_initialize; { - const f_status_t status = f_string_dynamics_resize(length, &source); + const f_status_t status = f_memory_arrays_resize(length, sizeof(f_string_dynamic_t), (void **) &source.array, &source.used, &source.size, &f_string_dynamics_delete_callback); assert_int_equal(status, F_okay); assert_int_equal(source.used, 0); diff --git a/level_0/f_string/tests/unit/c/test-string-dynamicss_append_all.c b/level_0/f_string/tests/unit/c/test-string-dynamicss_append_all.c index 76e6b0c..f42dd32 100644 --- a/level_0/f_string/tests/unit/c/test-string-dynamicss_append_all.c +++ b/level_0/f_string/tests/unit/c/test-string-dynamicss_append_all.c @@ -18,7 +18,7 @@ void test__f_string_dynamicss_append_all__works(void **state) { }; { - f_status_t status = f_string_dynamicss_resize(length_outer, &source); + f_status_t status = f_memory_arrays_resize(length_inner, sizeof(f_string_dynamics_t), (void **) &source.array, &source.used, &source.size, &f_string_dynamicss_delete_callback); assert_int_equal(status, F_okay); assert_int_equal(source.used, 0); @@ -28,7 +28,7 @@ void test__f_string_dynamicss_append_all__works(void **state) { for (; source.used < length_outer; ++source.used) { - status = f_string_dynamics_resize(length_inner, &source.array[source.used]); + status = f_memory_arrays_resize(length_inner, sizeof(f_string_dynamic_t), (void **) &source.array[source.used].array, &source.array[source.used].used, &source.array[source.used].size, &f_string_dynamics_delete_callback); assert_int_equal(status, F_okay); assert_int_equal(source.array[source.used].used, 0); @@ -93,7 +93,7 @@ void test__f_string_dynamicss_append_all__returns_data_not(void **state) { f_string_dynamicss_t destination = f_string_dynamicss_t_initialize; { - const f_status_t status = f_string_dynamicss_resize(length, &source); + const f_status_t status = f_memory_arrays_resize(length, sizeof(f_string_dynamics_t), (void **) &source.array, &source.used, &source.size, &f_string_dynamicss_delete_callback); assert_int_equal(status, F_okay); assert_int_equal(source.used, 0); diff --git a/level_0/f_string/tests/unit/c/test-string-dynamicss_decimate_by.c b/level_0/f_string/tests/unit/c/test-string-dynamicss_decimate_by.c deleted file mode 100644 index 1bbf434..0000000 --- a/level_0/f_string/tests/unit/c/test-string-dynamicss_decimate_by.c +++ /dev/null @@ -1,50 +0,0 @@ -#include "test-string.h" -#include "test-string-dynamicss_decimate_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_string_dynamicss_decimate_by__works(void **state) { - - const int length = 5; - f_string_dynamicss_t data = f_string_dynamics_t_initialize; - - { - const f_status_t status = f_string_dynamicss_resize(length, &data); - - assert_int_equal(status, F_okay); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_string_dynamicss_decimate_by(length, &data); - - assert_int_equal(status, F_okay); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -void test__f_string_dynamicss_decimate_by__parameter_checking(void **state) { - - const int length = 5; - f_string_dynamicss_t data = f_string_dynamics_t_initialize; - - { - const f_status_t status = f_string_dynamicss_decimate_by(length, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_string/tests/unit/c/test-string-dynamicss_decimate_by.h b/level_0/f_string/tests/unit/c/test-string-dynamicss_decimate_by.h deleted file mode 100644 index 3793bd3..0000000 --- a/level_0/f_string/tests/unit/c/test-string-dynamicss_decimate_by.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_string_dynamicss_decimate_by_h -#define _TEST__F_string_dynamicss_decimate_by_h - -/** - * Test that the function works. - * - * @see f_string_dynamicss_decimate_by() - */ -extern void test__f_string_dynamicss_decimate_by__works(void **state); - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_string_dynamicss_decimate_by() - */ -extern void test__f_string_dynamicss_decimate_by__parameter_checking(void **state); - -#endif // _TEST__F_string_dynamicss_decimate_by_h diff --git a/level_0/f_string/tests/unit/c/test-string-dynamicss_decrease_by.c b/level_0/f_string/tests/unit/c/test-string-dynamicss_decrease_by.c deleted file mode 100644 index afd124f..0000000 --- a/level_0/f_string/tests/unit/c/test-string-dynamicss_decrease_by.c +++ /dev/null @@ -1,50 +0,0 @@ -#include "test-string.h" -#include "test-string-dynamicss_decrease_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_string_dynamicss_decrease_by__works(void **state) { - - const int length = 5; - f_string_dynamicss_t data = f_string_dynamics_t_initialize; - - { - const f_status_t status = f_string_dynamicss_resize(length, &data); - - assert_int_equal(status, F_okay); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_string_dynamicss_decrease_by(length, &data); - - assert_int_equal(status, F_okay); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -void test__f_string_dynamicss_decrease_by__parameter_checking(void **state) { - - const int length = 5; - f_string_dynamicss_t data = f_string_dynamics_t_initialize; - - { - const f_status_t status = f_string_dynamicss_decrease_by(length, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_string/tests/unit/c/test-string-dynamicss_decrease_by.h b/level_0/f_string/tests/unit/c/test-string-dynamicss_decrease_by.h deleted file mode 100644 index 9f2d4b2..0000000 --- a/level_0/f_string/tests/unit/c/test-string-dynamicss_decrease_by.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_string_dynamicss_decrease_by_h -#define _TEST__F_string_dynamicss_decrease_by_h - -/** - * Test that the function works. - * - * @see f_string_dynamicss_decrease_by() - */ -extern void test__f_string_dynamicss_decrease_by__works(void **state); - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_string_dynamicss_decrease_by() - */ -extern void test__f_string_dynamicss_decrease_by__parameter_checking(void **state); - -#endif // _TEST__F_string_dynamicss_decrease_by_h diff --git a/level_0/f_string/tests/unit/c/test-string-dynamicss_increase.c b/level_0/f_string/tests/unit/c/test-string-dynamicss_increase.c deleted file mode 100644 index ae392c2..0000000 --- a/level_0/f_string/tests/unit/c/test-string-dynamicss_increase.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-string.h" -#include "test-string-dynamicss_increase.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_string_dynamicss_increase__works(void **state) { - - const int length = 5; - f_string_dynamicss_t data = f_string_dynamics_t_initialize; - - { - const f_status_t status = f_string_dynamicss_resize(length, &data); - - assert_int_equal(status, F_okay); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_string_dynamicss_increase(length, &data); - - assert_int_equal(status, F_okay); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); - } - - free((void *) data.array); -} - -void test__f_string_dynamicss_increase__returns_data_not(void **state) { - - const int length = 5; - f_string_dynamicss_t data = f_string_dynamics_t_initialize; - - { - const f_status_t status = f_string_dynamicss_resize(length, &data); - - assert_int_equal(status, F_okay); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_string_dynamicss_increase(length, &data); - - assert_int_equal(status, F_data_not); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -void test__f_string_dynamicss_increase__parameter_checking(void **state) { - - const int length = 5; - f_string_dynamicss_t data = f_string_dynamics_t_initialize; - - { - const f_status_t status = f_string_dynamicss_increase(length, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_string/tests/unit/c/test-string-dynamicss_increase.h b/level_0/f_string/tests/unit/c/test-string-dynamicss_increase.h deleted file mode 100644 index 0c3e6dd..0000000 --- a/level_0/f_string/tests/unit/c/test-string-dynamicss_increase.h +++ /dev/null @@ -1,34 +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_string_dynamicss_increase_h -#define _TEST__F_string_dynamicss_increase_h - -/** - * Test that the function works. - * - * @see f_string_dynamicss_increase() - */ -extern void test__f_string_dynamicss_increase__works(void **state); - -/** - * Test that the function returns F_data_not when asked to copy an empty structure. - * - * @see f_string_dynamicss_increase() - */ -extern void test__f_string_dynamicss_increase__returns_data_not(void **state); - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_string_dynamicss_increase() - */ -extern void test__f_string_dynamicss_increase__parameter_checking(void **state); - -#endif // _TEST__F_string_dynamicss_increase_h diff --git a/level_0/f_string/tests/unit/c/test-string-dynamicss_increase_by.c b/level_0/f_string/tests/unit/c/test-string-dynamicss_increase_by.c deleted file mode 100644 index 0f226f8..0000000 --- a/level_0/f_string/tests/unit/c/test-string-dynamicss_increase_by.c +++ /dev/null @@ -1,52 +0,0 @@ -#include "test-string.h" -#include "test-string-dynamicss_increase_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_string_dynamicss_increase_by__works(void **state) { - - const int length = 5; - f_string_dynamicss_t data = f_string_dynamics_t_initialize; - - { - const f_status_t status = f_string_dynamicss_resize(length, &data); - - assert_int_equal(status, F_okay); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_string_dynamicss_increase_by(length, &data); - - assert_int_equal(status, F_okay); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); - } - - free((void *) data.array); -} - -void test__f_string_dynamicss_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_string_dynamicss_t data = f_string_dynamics_t_initialize; - - { - const f_status_t status = f_string_dynamicss_increase_by(length, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_string/tests/unit/c/test-string-dynamicss_increase_by.h b/level_0/f_string/tests/unit/c/test-string-dynamicss_increase_by.h deleted file mode 100644 index abbc43e..0000000 --- a/level_0/f_string/tests/unit/c/test-string-dynamicss_increase_by.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_string_dynamicss_increase_by_h -#define _TEST__F_string_dynamicss_increase_by_h - -/** - * Test that the function works. - * - * @see f_string_dynamicss_increase_by() - */ -extern void test__f_string_dynamicss_increase_by__works(void **state); - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_string_dynamicss_increase_by() - */ -extern void test__f_string_dynamicss_increase_by__parameter_checking(void **state); - -#endif // _TEST__F_string_dynamicss_increase_by_h diff --git a/level_0/f_string/tests/unit/c/test-string-dynamicss_resize.c b/level_0/f_string/tests/unit/c/test-string-dynamicss_resize.c deleted file mode 100644 index 93d27de..0000000 --- a/level_0/f_string/tests/unit/c/test-string-dynamicss_resize.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-string.h" -#include "test-string-dynamicss_resize.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_string_dynamicss_resize__works(void **state) { - - const int length = 5; - f_string_dynamicss_t data = f_string_dynamicss_t_initialize; - - { - const f_status_t status = f_string_dynamicss_resize(length, &data); - - assert_int_equal(status, F_okay); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -void test__f_string_dynamicss_resize__parameter_checking(void **state) { - - const int length = 5; - f_string_dynamicss_t data = f_string_dynamicss_t_initialize; - - { - const f_status_t status = f_string_dynamicss_resize(length, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_string/tests/unit/c/test-string-dynamicss_resize.h b/level_0/f_string/tests/unit/c/test-string-dynamicss_resize.h deleted file mode 100644 index f47ca3d..0000000 --- a/level_0/f_string/tests/unit/c/test-string-dynamicss_resize.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_string_dynamicss_resize_h -#define _TEST__F_string_dynamicss_resize_h - -/** - * Test that the function works. - * - * @see f_string_dynamicss_resize() - */ -extern void test__f_string_dynamicss_resize__works(void **state); - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_string_dynamicss_resize() - */ -extern void test__f_string_dynamicss_resize__parameter_checking(void **state); - -#endif // _TEST__F_string_dynamicss_resize_h diff --git a/level_0/f_string/tests/unit/c/test-string.c b/level_0/f_string/tests/unit/c/test-string.c index 1369d1b..c42bca2 100644 --- a/level_0/f_string/tests/unit/c/test-string.c +++ b/level_0/f_string/tests/unit/c/test-string.c @@ -24,19 +24,11 @@ int main(void) { cmocka_unit_test(test__f_string_append_assure_nulless__works), cmocka_unit_test(test__f_string_append_nulless__works), - cmocka_unit_test(test__f_string_dynamic_adjust__works), - cmocka_unit_test(test__f_string_dynamic_append__works), cmocka_unit_test(test__f_string_dynamic_append_assure__works), cmocka_unit_test(test__f_string_dynamic_append_assure_nulless__works), cmocka_unit_test(test__f_string_dynamic_append_nulless__works), - cmocka_unit_test(test__f_string_dynamic_decimate_by__works), - cmocka_unit_test(test__f_string_dynamic_decrease_by__works), - cmocka_unit_test(test__f_string_dynamic_increase__works), - cmocka_unit_test(test__f_string_dynamic_increase__returns_data_not), - cmocka_unit_test(test__f_string_dynamic_increase_by__works), - cmocka_unit_test(test__f_string_dynamic_mash__works), cmocka_unit_test(test__f_string_dynamic_mash_nulless__works), @@ -64,8 +56,6 @@ int main(void) { cmocka_unit_test(test__f_string_dynamic_prepend_assure_nulless__works), cmocka_unit_test(test__f_string_dynamic_prepend_nulless__works), - cmocka_unit_test(test__f_string_dynamic_resize__works), - cmocka_unit_test(test__f_string_dynamic_seek_line__returns_data_not_stop), cmocka_unit_test(test__f_string_dynamic_seek_line__returns_none_eos), cmocka_unit_test(test__f_string_dynamic_seek_line__returns_none_stop), @@ -88,28 +78,14 @@ int main(void) { cmocka_unit_test(test__f_string_dynamic_terminate_after__appends_null), cmocka_unit_test(test__f_string_dynamic_terminate_after__doesnt_append_null), - cmocka_unit_test(test__f_string_dynamics_adjust__works), cmocka_unit_test(test__f_string_dynamics_append__works), cmocka_unit_test(test__f_string_dynamics_append_all__works), cmocka_unit_test(test__f_string_dynamics_append_all__returns_data_not), - cmocka_unit_test(test__f_string_dynamics_decimate_by__works), - cmocka_unit_test(test__f_string_dynamics_decrease_by__works), - cmocka_unit_test(test__f_string_dynamics_increase__works), - cmocka_unit_test(test__f_string_dynamics_increase__returns_data_not), - cmocka_unit_test(test__f_string_dynamics_increase_by__works), - cmocka_unit_test(test__f_string_dynamics_resize__works), - - cmocka_unit_test(test__f_string_dynamicss_adjust__works), + cmocka_unit_test(test__f_string_dynamicss_append__works), cmocka_unit_test(test__f_string_dynamicss_append__returns_data_not), cmocka_unit_test(test__f_string_dynamicss_append_all__works), cmocka_unit_test(test__f_string_dynamicss_append_all__returns_data_not), - cmocka_unit_test(test__f_string_dynamicss_decimate_by__works), - cmocka_unit_test(test__f_string_dynamicss_decrease_by__works), - cmocka_unit_test(test__f_string_dynamicss_increase__works), - cmocka_unit_test(test__f_string_dynamicss_increase__returns_data_not), - cmocka_unit_test(test__f_string_dynamicss_increase_by__works), - cmocka_unit_test(test__f_string_dynamicss_resize__works), cmocka_unit_test(test__f_string_map_multis_adjust__works), cmocka_unit_test(test__f_string_map_multis_append__works), @@ -256,19 +232,11 @@ int main(void) { cmocka_unit_test(test__f_string_append_assure_nulless__parameter_checking), cmocka_unit_test(test__f_string_append_nulless__parameter_checking), - cmocka_unit_test(test__f_string_dynamic_adjust__parameter_checking), - cmocka_unit_test(test__f_string_dynamic_append__parameter_checking), cmocka_unit_test(test__f_string_dynamic_append_assure__parameter_checking), cmocka_unit_test(test__f_string_dynamic_append_assure_nulless__parameter_checking), cmocka_unit_test(test__f_string_dynamic_append_nulless__parameter_checking), - cmocka_unit_test(test__f_string_dynamic_decimate_by__parameter_checking), - cmocka_unit_test(test__f_string_dynamic_decrease_by__parameter_checking), - cmocka_unit_test(test__f_string_dynamic_increase__parameter_checking), - cmocka_unit_test(test__f_string_dynamic_increase__returns_data_not), - cmocka_unit_test(test__f_string_dynamic_increase_by__parameter_checking), - cmocka_unit_test(test__f_string_dynamic_mash__parameter_checking), cmocka_unit_test(test__f_string_dynamic_mash_nulless__parameter_checking), @@ -296,8 +264,6 @@ int main(void) { cmocka_unit_test(test__f_string_dynamic_prepend_assure_nulless__parameter_checking), cmocka_unit_test(test__f_string_dynamic_prepend_nulless__parameter_checking), - cmocka_unit_test(test__f_string_dynamic_resize__parameter_checking), - cmocka_unit_test(test__f_string_dynamic_seek_line__parameter_checking), cmocka_unit_test(test__f_string_dynamic_seek_line_to__parameter_checking), cmocka_unit_test(test__f_string_dynamic_seek_to__parameter_checking), @@ -305,23 +271,11 @@ int main(void) { cmocka_unit_test(test__f_string_dynamic_terminate__parameter_checking), cmocka_unit_test(test__f_string_dynamic_terminate_after__parameter_checking), - cmocka_unit_test(test__f_string_dynamics_adjust__parameter_checking), cmocka_unit_test(test__f_string_dynamics_append__parameter_checking), cmocka_unit_test(test__f_string_dynamics_append_all__parameter_checking), - cmocka_unit_test(test__f_string_dynamics_decimate_by__parameter_checking), - cmocka_unit_test(test__f_string_dynamics_decrease_by__parameter_checking), - cmocka_unit_test(test__f_string_dynamics_increase__parameter_checking), - cmocka_unit_test(test__f_string_dynamics_increase_by__parameter_checking), - cmocka_unit_test(test__f_string_dynamics_resize__parameter_checking), - cmocka_unit_test(test__f_string_dynamicss_adjust__parameter_checking), cmocka_unit_test(test__f_string_dynamicss_append__parameter_checking), cmocka_unit_test(test__f_string_dynamicss_append_all__parameter_checking), - cmocka_unit_test(test__f_string_dynamicss_decimate_by__parameter_checking), - cmocka_unit_test(test__f_string_dynamicss_decrease_by__parameter_checking), - cmocka_unit_test(test__f_string_dynamicss_increase__parameter_checking), - cmocka_unit_test(test__f_string_dynamicss_increase_by__parameter_checking), - cmocka_unit_test(test__f_string_dynamicss_resize__parameter_checking), cmocka_unit_test(test__f_string_map_multis_adjust__parameter_checking), cmocka_unit_test(test__f_string_map_multis_append__parameter_checking), diff --git a/level_0/f_string/tests/unit/c/test-string.h b/level_0/f_string/tests/unit/c/test-string.h index 5de6b81..6b7f904 100644 --- a/level_0/f_string/tests/unit/c/test-string.h +++ b/level_0/f_string/tests/unit/c/test-string.h @@ -30,15 +30,10 @@ #include "test-string-append_assure.h" #include "test-string-append_assure_nulless.h" #include "test-string-append_nulless.h" -#include "test-string-dynamic_adjust.h" #include "test-string-dynamic_append.h" #include "test-string-dynamic_append_assure.h" #include "test-string-dynamic_append_assure_nulless.h" #include "test-string-dynamic_append_nulless.h" -#include "test-string-dynamic_decimate_by.h" -#include "test-string-dynamic_decrease_by.h" -#include "test-string-dynamic_increase.h" -#include "test-string-dynamic_increase_by.h" #include "test-string-dynamic_mash.h" #include "test-string-dynamic_mash_nulless.h" #include "test-string-dynamic_mish.h" @@ -59,28 +54,15 @@ #include "test-string-dynamic_prepend_assure.h" #include "test-string-dynamic_prepend_assure_nulless.h" #include "test-string-dynamic_prepend_nulless.h" -#include "test-string-dynamic_resize.h" #include "test-string-dynamic_seek_line.h" #include "test-string-dynamic_seek_line_to.h" #include "test-string-dynamic_seek_to.h" #include "test-string-dynamic_terminate.h" #include "test-string-dynamic_terminate_after.h" -#include "test-string-dynamics_adjust.h" #include "test-string-dynamics_append.h" #include "test-string-dynamics_append_all.h" -#include "test-string-dynamics_decimate_by.h" -#include "test-string-dynamics_decrease_by.h" -#include "test-string-dynamics_increase.h" -#include "test-string-dynamics_increase_by.h" -#include "test-string-dynamics_resize.h" -#include "test-string-dynamicss_adjust.h" #include "test-string-dynamicss_append.h" #include "test-string-dynamicss_append_all.h" -#include "test-string-dynamicss_decimate_by.h" -#include "test-string-dynamicss_decrease_by.h" -#include "test-string-dynamicss_increase.h" -#include "test-string-dynamicss_increase_by.h" -#include "test-string-dynamicss_resize.h" #include "test-string-map_multis_adjust.h" #include "test-string-map_multis_append.h" #include "test-string-map_multis_append_all.h" diff --git a/level_1/fl_path/tests/unit/c/test-path-canonical.c b/level_1/fl_path/tests/unit/c/test-path-canonical.c index 649a40e..bf518d2 100644 --- a/level_1/fl_path/tests/unit/c/test-path-canonical.c +++ b/level_1/fl_path/tests/unit/c/test-path-canonical.c @@ -144,7 +144,7 @@ void test__fll_path_canonical__back_paths(void **state) { } } // for - f_string_dynamic_resize(0, &path); + free((void *) path.string); } void test__fll_path_canonical__empty_becomes_pwd(void **state) { @@ -167,7 +167,7 @@ void test__fll_path_canonical__empty_becomes_pwd(void **state) { assert_string_equal(pwd, path.string); } // for - f_string_dynamic_resize(0, &path); + free((void *) path.string); } void test__fll_path_canonical__present_paths(void **state) { @@ -264,7 +264,7 @@ void test__fll_path_canonical__present_paths(void **state) { assert_string_equal(prepended.string, path.string); } // for - f_string_dynamic_resize(0, &path); + free((void *) path.string); } void test__fll_path_canonical__root_paths(void **state) { @@ -327,7 +327,7 @@ void test__fll_path_canonical__root_paths(void **state) { assert_string_equal(expected[i].string, path.string); } // for - f_string_dynamic_resize(0, &path); + free((void *) path.string); } void test__fll_path_canonical__tilde_remains(void **state) { @@ -466,7 +466,7 @@ void test__fll_path_canonical__tilde_remains(void **state) { } } // for - f_string_dynamic_resize(0, &path); + free((void *) path.string); } void test__fll_path_canonical__parameter_checking(void **state) { diff --git a/level_3/controller/c/common.c b/level_3/controller/c/common.c index b02580b..a9d714a 100644 --- a/level_3/controller/c/common.c +++ b/level_3/controller/c/common.c @@ -217,7 +217,16 @@ extern "C" { f_console_parameters_delete(&main->program.parameters); - macro_f_color_context_t_delete_simple(main->program.context); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &main->program.reset.string, &main->program.reset.used, &main->program.reset.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &main->program.error.string, &main->program.error.used, &main->program.error.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &main->program.important.string, &main->program.important.used, &main->program.important.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &main->program.normal.string, &main->program.normal.used, &main->program.normal.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &main->program.normal_reset.string, &main->program.normal_reset.used, &main->program.normal_reset.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &main->program.notable.string, &main->program.notable.used, &main->program.notable.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &main->program.standout.string, &main->program.standout.used, &main->program.standout.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &main->program.success.string, &main->program.success.used, &main->program.success.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &main->program.title.string, &main->program.title.used, &main->program.title.size); + f_memory_array_resize(, sizeof(f_char_t), (void **) &main->program.warning.string, &main->program.warning.used, &main->program.warning.size0); f_memory_array_resize(0, sizeof(f_char_t), (void **) &main->program.path_pid.string, &main->program.path_pid.used, &main->program.path_pid.size); f_memory_array_resize(0, sizeof(f_char_t), (void **) &main->program.path_setting.string, &main->program.path_setting.used, &main->program.path_setting.size); diff --git a/level_3/controller/c/common/private-rule.c b/level_3/controller/c/common/private-rule.c index a0ba892..c27eb90 100644 --- a/level_3/controller/c/common/private-rule.c +++ b/level_3/controller/c/common/private-rule.c @@ -69,10 +69,11 @@ extern "C" { f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &rule->engine_arguments.array, &rule->engine_arguments.used, &rule->engine_arguments.size, &f_string_dynamics_delete_callback); f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &rule->environment.array, &rule->environment.used, &rule->environment.size, &f_string_dynamics_delete_callback); - macro_f_int32s_t_delete_simple(rule->affinity) - macro_f_control_group_t_delete_simple(rule->cgroup) - macro_f_int32s_t_delete_simple(rule->groups) - macro_f_limit_sets_t_delete_simple(rule->limits) + f_memory_array_resize(0, sizeof(int32_t), (void **) &rule->affinity.array, &rule->affinity.used, &rule->affinity.size); + f_memory_array_resize(0, sizeof(f_char_t), (void **) &rule->cgroup.path.string, &rule->cgroup.path.used, &rule->cgroup.path.size); + f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &rule->cgroup.groups.array, &rule->cgroup.groups.used, &rule->cgroup.groups.size, &f_string_dynamics_delete_callback); + f_memory_array_resize(0, sizeof(int32_t), (void **) &rule->groups.array, &rule->groups.used, &rule->groups.size); + f_memory_array_resize(0, sizeof(f_limit_set_t), (void **) &rule->limits.array, &rule->limits.used, &rule->limits.size); if (rule->capability) { f_capability_delete(&rule->capability); diff --git a/level_3/controller/c/common/private-rule.h b/level_3/controller/c/common/private-rule.h index 2ff136e..068e6c4 100644 --- a/level_3/controller/c/common/private-rule.h +++ b/level_3/controller/c/common/private-rule.h @@ -505,17 +505,10 @@ extern "C" { * @param rule * The rule to deallocate. * - * @see macro_f_control_group_t_delete_simple() - * @see macro_f_int32s_t_delete_simple() - * @see macro_f_limit_sets_t_delete_simple() - * @see macro_f_string_dynamics_t_delete_simple() - * @see macro_f_string_maps_t_delete_simple() - * @see macro_f_thread_condition_t_delete_simple() - * @see macro_f_thread_mutex_t_delete_simple() - * * @see controller_rule_items_delete_simple() * @see f_capability_delete() * @see f_memory_array_resize() + * @see f_memory_arrays_resize() */ #ifndef _di_controller_rule_delete_simple_ extern void controller_rule_delete_simple(controller_rule_t * const rule) F_attribute_visibility_internal_d; diff --git a/level_3/controller/c/rule/private-rule.c b/level_3/controller/c/rule/private-rule.c index d0f7621..1c9e930 100644 --- a/level_3/controller/c/rule/private-rule.c +++ b/level_3/controller/c/rule/private-rule.c @@ -742,7 +742,9 @@ extern "C" { f_status_t controller_rule_copy(const controller_rule_t source, controller_rule_t *destination) { // Delete the third party structures. - macro_f_control_group_t_delete_simple(destination->cgroup) + f_memory_array_resize(0, sizeof(f_char_t), (void **) &destination->cgroup.path.string, &destination->cgroup.path.used, &destination->cgroup.path.size); + f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &destination->cgroup.groups.array, &destination->cgroup.groups.used, &destination->cgroup.groups.size, &f_string_dynamics_delete_callback); + f_capability_delete(&destination->capability); f_number_unsigned_t i = 0; diff --git a/level_3/fake/c/main/build/library.h b/level_3/fake/c/main/build/library.h index 43c4990..c354339 100644 --- a/level_3/fake/c/main/build/library.h +++ b/level_3/fake/c/main/build/library.h @@ -31,7 +31,6 @@ extern "C" { * F_okay on success. * * Errors (with error bit) from: f_file_link() - * Errors (with error bit) from: f_string_dynamics_resize() * Errors (with error bit) from: fll_execute_arguments_add() * * Errors (with error bit) from: fake_execute() @@ -51,7 +50,6 @@ extern "C" { * This generally is only needed when F_child is returned, where this holds the return status of the child process. * * @see f_file_link() - * @see f_string_dynamics_resize() * @see fll_execute_arguments_add() * * @see fake_execute() diff --git a/level_3/fake/c/main/make/load_fakefile.h b/level_3/fake/c/main/make/load_fakefile.h index cb2e71c..5e82261 100644 --- a/level_3/fake/c/main/make/load_fakefile.h +++ b/level_3/fake/c/main/make/load_fakefile.h @@ -32,7 +32,6 @@ extern "C" { * Errors (with error bit) from: f_fss_apply_delimit(). * Errors (with error bit) from: f_string_dynamic_append(). * Errors (with error bit) from: f_string_dynamic_partial_append(). - * Errors (with error bit) from: f_string_dynamics_resize(). * Errors (with error bit) from: f_string_map_multis_resize(). * Errors (with error bit) from: fll_fss_basic_list_read(). * Errors (with error bit) from: fll_fss_extended_read(). @@ -55,7 +54,6 @@ extern "C" { * @see f_fss_apply_delimit() * @see f_string_dynamic_append() * @see f_string_dynamic_partial_append() - * @see f_string_dynamics_resize() * @see f_string_map_multis_resize() * @see fll_fss_basic_list_read() * @see fll_fss_extended_read() diff --git a/level_3/fake/c/main/make/operate_process_type.h b/level_3/fake/c/main/make/operate_process_type.h index f819fb8..eff84a6 100644 --- a/level_3/fake/c/main/make/operate_process_type.h +++ b/level_3/fake/c/main/make/operate_process_type.h @@ -627,11 +627,9 @@ extern "C" { * F_failure (with error bit) on any error. * * Errors (with error bit) from: f_memory_array_resize() - * Errors (with error bit) from: f_string_dynamics_resize() * Errors (with error bit) from: f_string_map_multis_resize() * * @see f_memory_array_resize() - * @see f_string_dynamics_resize() * @see f_string_map_multis_resize() */ #ifndef _di_fake_make_operate_process_type_parameter_ diff --git a/level_3/firewall/c/private-common.c b/level_3/firewall/c/private-common.c index 54c4185..0c08398 100644 --- a/level_3/firewall/c/private-common.c +++ b/level_3/firewall/c/private-common.c @@ -8,8 +8,8 @@ extern "C" { #ifndef _di_firewall_data_delete_ f_status_t firewall_data_delete(firewall_data_t * const data) { - f_string_dynamics_resize(0, &data->chains); - f_string_dynamics_resize(0, &data->devices); + f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &data->chains.string, &data->chains.used, &data->chains.size, &f_string_dynamics_delete_callback); + f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &data->devices.string, &data->devices.used, &data->devices.size, &f_string_dynamics_delete_callback); return F_okay; } diff --git a/level_3/firewall/c/private-firewall.c b/level_3/firewall/c/private-firewall.c index 738d4fb..56751c2 100644 --- a/level_3/firewall/c/private-firewall.c +++ b/level_3/firewall/c/private-firewall.c @@ -67,7 +67,7 @@ f_status_t firewall_perform_commands(firewall_data_t * const data, firewall_loca f_memory_array_resize(0, sizeof(f_char_t), (void **) &device.string, &device.used, &device.size); f_memory_array_resize(0, sizeof(f_char_t), (void **) &protocol.string, &protocol.used, &protocol.size); - f_string_dynamics_resize(0, &arguments); + f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &arguments.string, &arguments.used, &arguments.size, &f_string_dynamics_delete_callback); return F_status_set_error(F_interrupt); } @@ -688,7 +688,7 @@ f_status_t firewall_perform_commands(firewall_data_t * const data, firewall_loca f_memory_array_resize(0, sizeof(f_char_t), (void **) &device.string, &device.used, &device.size); f_memory_array_resize(0, sizeof(f_char_t), (void **) &protocol.string, &protocol.used, &protocol.size); - f_string_dynamics_resize(0, &arguments); + f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &arguments.string, &arguments.used, &arguments.size, &f_string_dynamics_delete_callback); data->main->child = return_code; @@ -739,7 +739,7 @@ f_status_t firewall_perform_commands(firewall_data_t * const data, firewall_loca f_memory_array_resize(0, sizeof(f_char_t), (void **) &device.string, &device.used, &device.size); f_memory_array_resize(0, sizeof(f_char_t), (void **) &protocol.string, &protocol.used, &protocol.size); - f_string_dynamics_resize(0, &arguments); + f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &arguments.string, &arguments.used, &arguments.size, &f_string_dynamics_delete_callback); data->main->child = return_code; @@ -774,7 +774,7 @@ f_status_t firewall_perform_commands(firewall_data_t * const data, firewall_loca f_memory_array_resize(0, sizeof(f_char_t), (void **) &device.string, &device.used, &device.size); f_memory_array_resize(0, sizeof(f_char_t), (void **) &protocol.string, &protocol.used, &protocol.size); - f_string_dynamics_resize(0, &arguments); + f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &arguments.string, &arguments.used, &arguments.size, &f_string_dynamics_delete_callback); return status; } @@ -798,7 +798,7 @@ f_status_t firewall_create_custom_chains(firewall_data_t * const data, firewall_ local->chain_ids.used = local->chain_objects.used; - status = f_string_dynamics_resize(2, &arguments); + status = f_memory_arrays_resize(2, sizeof(f_string_dynamic_t), (void **) &arguments.string, &arguments.used, &arguments.size, &f_string_dynamics_delete_callback); if (F_status_is_error(status)) return status; status = f_memory_array_increase_by(local->chain_objects.used, sizeof(f_number_unsigned_t), (void **) &local->chain_ids.array, &local->chain_ids.used, &local->chain_ids.size); @@ -812,7 +812,7 @@ f_status_t firewall_create_custom_chains(firewall_data_t * const data, firewall_ status = f_memory_array_increase(F_memory_default_allocation_small_d, sizeof(f_char_t), (void **) &arguments.array[1].string, &arguments.array[1].used, &arguments.array[1].size); } else { - f_string_dynamics_resize(0, &arguments); + f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &arguments.string, &arguments.used, &arguments.size, &f_string_dynamics_delete_callback); return status; } @@ -966,7 +966,7 @@ f_status_t firewall_create_custom_chains(firewall_data_t * const data, firewall_ } } // for - f_string_dynamics_resize(0, &arguments); + f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &arguments.string, &arguments.used, &arguments.size, &f_string_dynamics_delete_callback); return status; } diff --git a/level_3/fss_read/c/main/common.h b/level_3/fss_read/c/main/common.h index 3be3a1d..f4b0cfe 100644 --- a/level_3/fss_read/c/main/common.h +++ b/level_3/fss_read/c/main/common.h @@ -60,7 +60,6 @@ extern "C" { * * Errors (with error bit) from: f_console_parameter_process(). * Errors (with error bit) from: f_file_stream_open(). - * Errors (with error bit) from: f_string_dynamics_resize(). * Errors (with error bit) from: fll_program_parameter_process_context(). * Errors (with error bit) from: fll_program_parameter_process_verbosity_standard(). * @@ -73,7 +72,6 @@ extern "C" { * * @see f_console_parameter_process() * @see f_file_stream_open() - * @see f_string_dynamics_resize() * @see fll_program_parameter_process_context() * @see fll_program_parameter_process_verbosity_standard() * diff --git a/level_3/fss_read/c/main/main.h b/level_3/fss_read/c/main/main.h index 10726e6..916e658 100644 --- a/level_3/fss_read/c/main/main.h +++ b/level_3/fss_read/c/main/main.h @@ -72,13 +72,11 @@ extern int main(const int argc, const f_string_t *argv, const f_string_t *envp); * * Errors (with error bit) from: f_console_parameter_process(). * Errors (with error bit) from: f_file_stream_open(). - * Errors (with error bit) from: f_string_dynamics_resize(). * Errors (with error bit) from: fll_program_parameter_process_context(). * Errors (with error bit) from: fll_program_parameter_process_verbosity_standard(). * * @see f_console_parameter_process() * @see f_file_stream_open() - * @see f_string_dynamics_resize() * @see fll_program_parameter_process_context() * @see fll_program_parameter_process_verbosity_standard() * diff --git a/level_3/fss_write/c/main/common.h b/level_3/fss_write/c/main/common.h index cc4c3d0..a3ed8ce 100644 --- a/level_3/fss_write/c/main/common.h +++ b/level_3/fss_write/c/main/common.h @@ -38,7 +38,6 @@ extern "C" { * * Errors (with error bit) from: f_console_parameter_process(). * Errors (with error bit) from: f_file_stream_open(). - * Errors (with error bit) from: f_string_dynamics_resize(). * Errors (with error bit) from: fll_program_parameter_process_context(). * Errors (with error bit) from: fll_program_parameter_process_verbosity_standard(). * @param callback @@ -48,7 +47,6 @@ extern "C" { * * @see f_console_parameter_process() * @see f_file_stream_open() - * @see f_string_dynamics_resize() * @see fll_program_parameter_process_context() * @see fll_program_parameter_process_verbosity_standard() */ diff --git a/level_3/fss_write/c/main/main.h b/level_3/fss_write/c/main/main.h index 89391dc..687b89d 100644 --- a/level_3/fss_write/c/main/main.h +++ b/level_3/fss_write/c/main/main.h @@ -76,13 +76,11 @@ extern int main(const int argc, const f_string_t *argv, const f_string_t *envp); * * Errors (with error bit) from: f_console_parameter_process(). * Errors (with error bit) from: f_file_stream_open(). - * Errors (with error bit) from: f_string_dynamics_resize(). * Errors (with error bit) from: fll_program_parameter_process_context(). * Errors (with error bit) from: fll_program_parameter_process_verbosity_standard(). * * @see f_console_parameter_process() * @see f_file_stream_open() - * @see f_string_dynamics_resize() * @see fll_program_parameter_process_context() * @see fll_program_parameter_process_verbosity_standard() * diff --git a/level_3/iki_write/c/main/common.h b/level_3/iki_write/c/main/common.h index 9da17f8..4dc2388 100644 --- a/level_3/iki_write/c/main/common.h +++ b/level_3/iki_write/c/main/common.h @@ -33,13 +33,11 @@ extern "C" { * * Errors (with error bit) from: f_console_parameter_process(). * Errors (with error bit) from: f_file_stream_open(). - * Errors (with error bit) from: f_string_dynamics_resize(). * Errors (with error bit) from: fll_program_parameter_process_context(). * Errors (with error bit) from: fll_program_parameter_process_verbosity_standard(). * * @see f_console_parameter_process() * @see f_file_stream_open() - * @see f_string_dynamics_resize() * @see fll_program_parameter_process_context() * @see fll_program_parameter_process_verbosity_standard() */ -- 1.8.3.1