From: Kevin Day Date: Sun, 13 Aug 2023 22:11:13 +0000 (-0500) Subject: Progress: Continue re-designing of the memory logic also removing *_append() and... X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=95dbc44ecd9690c23ab37418e1db4e979bb3a739;p=fll Progress: Continue re-designing of the memory logic also removing *_append() and *_append_all(). In some cases *_append() and *_append_all() functions are removed. This is a lot to manage at this time so remove it. At some future point in time I need to implement a good generic append and append all design. This is likely to use some sort of callback that performs the individual copy calls. Many of the existing *_append() and *_append_all() are left alone but may eventually be removed. The dynamic string based ones, however, will remain as an exception case. The names I originally chose for the callbacks are misleading. Rename them to be "delete" and "destroy" rather than "resize" and "adjust", respectively. Half way through changing this I came across the more complex cases for resizing. These I need callbacks both both array of arrays and arrays of arrays. I did not finish the process of converting this. The f_type_array needs more work. In particular, the arrays of arrays in f_type_array can be moved into a common f_memory function, such as f_memory_arrayss_resize(). The unit tests have not been updated but I did manage to get the unit test for the f_account done. The stand alone build config.h files are not update to date either. These changes have shown a significant improvement in the resulting binary size. The current size is actually just barely smaller than the 0.6.7 equivalent build (when compiled using the same compiler for both). The changes are not complete and so I anticipate the 0.7.0 branch to be smaller than the 0.6.7 branch as of this change set despite the 0.7.0 development branch having more functionality. --- diff --git a/build/level_0/settings b/build/level_0/settings index 84b32ef..84bba37 100644 --- a/build/level_0/settings +++ b/build/level_0/settings @@ -33,19 +33,19 @@ build_language c build_libraries -lc -lcap -build_sources_library account.c private-account.c account/accounts.c account/private-accounts.c +build_sources_library account.c private-account.c account/accounts.c build_sources_library capability.c build_sources_library color.c private-color.c color/common.c build_sources_library compare.c compare/utf.c private-compare.c compare/private-utf.c build_sources_library console.c console/common.c private-console.c build_sources_library control_group.c control_group/common.c build_sources_library conversion.c private-conversion.c conversion/common.c -build_sources_library directory.c directory/common.c directory/type.c private-directory.c directory/private-type.c +build_sources_library directory.c directory/common.c directory/listing.c directory/recurse_do.c directory/status.c +build_sources_library private-directory.c build_sources_library environment.c build_sources_library execute.c build_sources_library file.c private-file.c file/common.c file/stream.c build_sources_library fss.c fss/common.c fss/item.c fss/named.c fss/nest.c fss/quote.c fss/set.c fss/set_quote.c fss/simple_packet.c -build_sources_library fss/private-item.c fss/private-named.c fss/private-nest.c fss/private-set.c fss/private-set_quote.c fss/private-simple_packet.c build_sources_library iki.c iki/common.c iki/data.c private-iki.c iki/private-data.c build_sources_library limit.c limit/set.c limit/value.c limit/private-set.c limit/private-value.c build_sources_library memory.c memory/array.c memory/arrays.c @@ -100,7 +100,7 @@ build_sources_headers compare.h compare/utf.h build_sources_headers console.h console/common.h private-console.h build_sources_headers control_group.h control_group/common.h build_sources_headers conversion.h conversion/common.h -build_sources_headers directory.h directory/common.h directory/type.h +build_sources_headers directory.h directory/common.h directory/listing.h directory/recurse_do.h directory/status.h build_sources_headers environment.h environment/common.h build_sources_headers execute.h execute/common.h build_sources_headers file.h file/common.h file/stream.h diff --git a/build/monolithic/settings b/build/monolithic/settings index dff44ad..769d8ec 100644 --- a/build/monolithic/settings +++ b/build/monolithic/settings @@ -33,19 +33,19 @@ build_language c build_libraries -lc -lcap -build_sources_library level_0/account.c level_0/private-account.c level_0/account/accounts.c level_0/account/private-accounts.c +build_sources_library level_0/account.c level_0/private-account.c level_0/account/accounts.c build_sources_library level_0/capability.c build_sources_library level_0/color.c level_0/private-color.c level_0/color/common.c build_sources_library level_0/compare.c level_0/compare/utf.c level_0/private-compare.c level_0/compare/private-utf.c build_sources_library level_0/console.c level_0/console/common.c level_0/private-console.c build_sources_library level_0/control_group.c level_0/control_group/common.c build_sources_library level_0/conversion.c level_0/private-conversion.c level_0/conversion/common.c -build_sources_library level_0/directory.c level_0/directory/common.c level_0/directory/type.c level_0/private-directory.c level_0/directory/private-type.c +build_sources_library level_0/directory.c level_0/directory/common.c level_0/directory/listing.c level_0/directory/recurse_do.c level_0/directory/status.c +build_sources_library level_0/private-directory.c build_sources_library level_0/environment.c build_sources_library level_0/execute.c build_sources_library level_0/file.c level_0/private-file.c level_0/file/common.c level_0/file/stream.c build_sources_library level_0/fss.c level_0/fss/common.c level_0/fss/item.c level_0/fss/named.c level_0/fss/nest.c level_0/fss/quote.c level_0/fss/set.c level_0/fss/set_quote.c level_0/fss/simple_packet.c -build_sources_library level_0/fss/private-item.c level_0/fss/private-named.c level_0/fss/private-nest.c level_0/fss/private-set.c level_0/fss/private-set_quote.c level_0/fss/private-simple_packet.c build_sources_library level_0/iki.c level_0/iki/common.c level_0/iki/data.c level_0/private-iki.c level_0/iki/private-data.c build_sources_library level_0/limit.c level_0/limit/set.c level_0/limit/value.c level_0/limit/private-set.c level_0/limit/private-value.c build_sources_library level_0/memory.c level_0/memory/array.c level_0/memory/arrays.c @@ -121,7 +121,7 @@ build_sources_headers level_0/compare.h level_0/compare/utf.h build_sources_headers level_0/console.h level_0/console/common.h level_0/private-console.h build_sources_headers level_0/control_group.h level_0/control_group/common.h build_sources_headers level_0/conversion.h level_0/conversion/common.h -build_sources_headers level_0/directory.h level_0/directory/common.h level_0/directory/type.h +build_sources_headers level_0/directory.h level_0/directory/common.h level_0/directory/listing.h level_0/directory/recurse_do.h level_0/directory/status.h build_sources_headers level_0/environment.h level_0/environment/common.h build_sources_headers level_0/execute.h level_0/execute/common.h build_sources_headers level_0/file.h level_0/file/common.h level_0/file/stream.h diff --git a/build/stand_alone/fake.config.h b/build/stand_alone/fake.config.h index 508d835..bb5bd8f 100644 --- a/build/stand_alone/fake.config.h +++ b/build/stand_alone/fake.config.h @@ -24,12 +24,8 @@ #define _di_f_account_group_name_by_id_ //#define _di_f_account_id_by_name_ #define _di_f_account_name_by_id_ -#define _di_f_accounts_adjust_callback_ -#define _di_f_accounts_append_ -#define _di_f_accounts_append_all_ -#define _di_f_accounts_resize_callback_ -#define _di_f_accountss_append_ -#define _di_f_accountss_append_all_ +#define _di_f_accounts_destroy_callback_ +#define _di_f_accounts_delete_callback_ #define _di_f_accountss_t_ #define _di_f_accounts_t_ //#define _di_f_account_t_ @@ -74,8 +70,8 @@ #define _di_f_capability_to_name_ #define _di_f_capability_to_text_ #define _di_f_capability_user_set_ -#define _di_f_cells_adjust_callback_ -#define _di_f_cells_resize_callback_ +#define _di_f_cells_destroy_callback_ +#define _di_f_cells_delete_callback_ #define _di_f_cellss_t_ #define _di_f_cells_t_ #define _di_f_cell_t_ @@ -296,6 +292,7 @@ //#define _di_f_directory_listing_delete_ #define _di_f_directory_listing_destroy_ //#define _di_f_directory_listing_t_ +#define _di_f_directory_listings_t_ //#define _di_f_directory_max_d_ #define _di_f_directory_mode_ //#define _di_f_directory_open_ @@ -304,15 +301,18 @@ #define _di_f_directory_recurse_do_destroy_ //#define _di_f_directory_recurse_do_flag_e_ //#define _di_f_directory_recurse_do_t_ +#define _di_f_directory_recurses_do_t_ //#define _di_f_directory_remove_ //#define _di_f_directory_remove_custom_ #define _di_f_directory_s_ -#define _di_f_directory_statuss_adjust_ -#define _di_f_directory_statuss_decimate_by_ -#define _di_f_directory_statuss_decrease_by_ -#define _di_f_directory_statuss_increase_ -#define _di_f_directory_statuss_increase_by_ -#define _di_f_directory_statuss_resize_ +#define _di_f_directory_listings_destroy_callback_ +#define _di_f_directory_listings_delete_callback_ +#define _di_f_directory_recurses_destroy_callback_ +#define _di_f_directory_recurses_delete_callback_ +#define _di_f_directory_status_delete_ +#define _di_f_directory_status_destroy_ +#define _di_f_directory_statuss_destroy_callback_ +#define _di_f_directory_statuss_delete_callback_ //#define _di_f_directory_statuss_t_ //#define _di_f_directory_status_t_ //#define _di_f_directory_touch_ @@ -436,7 +436,7 @@ #define _di_f_file_rename_at_ //#define _di_f_file_role_change_ #define _di_f_file_role_change_at_ -#define _di_f_files_adjust_callback_ +#define _di_f_files_destroy_callback_ #define _di_f_file_seek_ #define _di_f_file_seeks_d_ #define _di_f_file_select_ @@ -444,7 +444,7 @@ //#define _di_f_file_size_ #define _di_f_file_size_at_ #define _di_f_file_size_by_id_ -#define _di_f_files_resize_callback_ +#define _di_f_files_delete_callback_ #define _di_f_filess_t_ #define _di_f_files_t_ //#define _di_f_file_stat_ @@ -491,8 +491,8 @@ #define _di_f_file_write_range_ #define _di_f_file_write_until #define _di_f_file_write_until_ -#define _di_f_fll_ids_adjust_callback_ -#define _di_f_fll_ids_resize_callback_ +#define _di_f_fll_ids_destroy_callback_ +#define _di_f_fll_ids_delete_callback_ #define _di_f_fll_idss_t_ #define _di_f_fll_ids_t_ #define _di_f_fll_id_t_ @@ -658,10 +658,10 @@ #define _di_f_iki_content_partial_is_ //#define _di_f_iki_data_delete_ #define _di_f_iki_data_destroy_ -#define _di_f_iki_datas_adjust_callback_ +#define _di_f_iki_datas_destroy_callback_ #define _di_f_iki_datas_append_ #define _di_f_iki_datas_append_all_ -#define _di_f_iki_datas_resize_callback_ +#define _di_f_iki_datas_delete_callback_ #define _di_f_iki_datass_append_ #define _di_f_iki_datass_append_all_ #define _di_f_iki_datass_t_ @@ -696,25 +696,25 @@ //#define _di_f_iki_vocabulary_0002_define_s_ //#define _di_f_iki_vocabulary_0002_parameter_s_ //#define _di_f_iki_vocabulary_0002_s_ -#define _di_f_int128s_adjust_callback_ -#define _di_f_int128s_resize_callback_ +#define _di_f_int128s_destroy_callback_ +#define _di_f_int128s_delete_callback_ #define _di_f_int128ss_t_ #define _di_f_int128s_t_ //#define _di_f_int128_t_ -#define _di_f_int16s_adjust_callback_ -#define _di_f_int16s_resize_callback_ +#define _di_f_int16s_destroy_callback_ +#define _di_f_int16s_delete_callback_ #define _di_f_int16ss_t_ #define _di_f_int16s_t_ -#define _di_f_int32s_adjust_callback_ -#define _di_f_int32s_resize_callback_ +#define _di_f_int32s_destroy_callback_ +#define _di_f_int32s_delete_callback_ #define _di_f_int32ss_t_ //#define _di_f_int32s_t_ -#define _di_f_int64s_adjust_callback_ -#define _di_f_int64s_resize_callback_ +#define _di_f_int64s_destroy_callback_ +#define _di_f_int64s_delete_callback_ #define _di_f_int64ss_t_ #define _di_f_int64s_t_ -#define _di_f_int8s_adjust_callback_ -#define _di_f_int8s_resize_callback_ +#define _di_f_int8s_destroy_callback_ +#define _di_f_int8s_delete_callback_ #define _di_f_int8ss_t_ #define _di_f_int8s_t_ //#define _di_fl_control_group_apply_ @@ -1069,8 +1069,8 @@ #define _di_f_network_to_host_long_ #define _di_f_network_to_host_short_ #define _di_f_network_to_ip_string_ -#define _di_f_number_unsigneds_adjust_callback_ -#define _di_f_number_unsigneds_resize_callback_ +#define _di_f_number_unsigneds_destroy_callback_ +#define _di_f_number_unsigneds_delete_callback_ #define _di_f_number_unsignedss_t_ //#define _di_f_number_unsigneds_t_ #define _di_f_parse_dynamic_partial_fll_identify_ @@ -1164,8 +1164,8 @@ //#define _di_f_pipe_input_exists_ #define _di_f_pipe_output_exists_ //#define _di_f_poll_e_ -#define _di_f_polls_adjust_callback_ -#define _di_f_polls_resize_callback_ +#define _di_f_polls_destroy_callback_ +#define _di_f_polls_delete_callback_ #define _di_f_pollss_t_ #define _di_f_polls_t_ //#define _di_f_poll_t_ @@ -1385,8 +1385,8 @@ #define _di_f_socket_write_ #define _di_f_socket_write_message_ #define _di_f_socket_write_stream_ -#define _di_f_states_adjust_callback_ -#define _di_f_states_resize_callback_ +#define _di_f_states_destroy_callback_ +#define _di_f_states_delete_callback_ #define _di_f_statess_t_ #define _di_f_states_t_ //#define _di_f_state_t_ @@ -1408,10 +1408,10 @@ //#define _di_f_status_number_e_ //#define _di_f_status_process_e_ //#define _di_f_status_return_e_ -#define _di_f_statuss_adjust_callback_ +#define _di_f_statuss_destroy_callback_ //#define _di_f_status_signal_e_ //#define _di_f_status_socket_e_ -#define _di_f_statuss_resize_callback_ +#define _di_f_statuss_delete_callback_ #define _di_f_statusss_t_ #define _di_f_statuss_t_ //#define _di_f_status_t_ @@ -1615,8 +1615,8 @@ #define _di_f_thread_attribute_scheduler_policy_set_ #define _di_f_thread_attribute_scope_get_ #define _di_f_thread_attribute_scope_set_ -#define _di_f_thread_attributes_adjust_callback_ -#define _di_f_thread_attributes_resize_callback_ +#define _di_f_thread_attributes_destroy_callback_ +#define _di_f_thread_attributes_delete_callback_ #define _di_f_thread_attributes_t_ #define _di_f_thread_attribute_stack_get_ #define _di_f_thread_attribute_stack_set_ @@ -1627,14 +1627,14 @@ #define _di_f_thread_barrier_attribute_delete_ #define _di_f_thread_barrier_attribute_shared_get_ #define _di_f_thread_barrier_attribute_shared_set_ -#define _di_f_thread_barrier_attributes_adjust_callback_ -#define _di_f_thread_barrier_attributes_resize_callback_ +#define _di_f_thread_barrier_attributes_destroy_callback_ +#define _di_f_thread_barrier_attributes_delete_callback_ #define _di_f_thread_barrier_attributes_t_ #define _di_f_thread_barrier_attribute_t_ #define _di_f_thread_barrier_create_ #define _di_f_thread_barrier_delete_ -#define _di_f_thread_barriers_adjust_callback_ -#define _di_f_thread_barriers_resize_callback_ +#define _di_f_thread_barriers_destroy_callback_ +#define _di_f_thread_barriers_delete_callback_ #define _di_f_thread_barriers_t_ #define _di_f_thread_barrier_t_ #define _di_f_thread_barrier_wait_ @@ -1651,16 +1651,16 @@ #define _di_f_thread_condition_attribute_delete_ #define _di_f_thread_condition_attribute_shared_get_ #define _di_f_thread_condition_attribute_shared_set_ -#define _di_f_thread_condition_attributes_adjust_callback_ -#define _di_f_thread_condition_attributes_resize_callback_ +#define _di_f_thread_condition_attributes_destroy_callback_ +#define _di_f_thread_condition_attributes_delete_callback_ #define _di_f_thread_condition_attributes_t_ #define _di_f_thread_condition_attribute_t_ #define _di_f_thread_condition_create_ #define _di_f_thread_condition_delete_ #define _di_f_thread_condition_signal_ #define _di_f_thread_condition_signal_all_ -#define _di_f_thread_conditions_adjust_callback_ -#define _di_f_thread_conditions_resize_callback_ +#define _di_f_thread_conditions_destroy_callback_ +#define _di_f_thread_conditions_delete_callback_ #define _di_f_thread_conditions_t_ #define _di_f_thread_condition_t_ #define _di_f_thread_condition_wait_ @@ -1677,18 +1677,18 @@ #define _di_f_thread_key_delete_ #define _di_f_thread_key_get_ #define _di_f_thread_key_set_ -#define _di_f_thread_keys_adjust_callback_ -#define _di_f_thread_keys_resize_callback_ +#define _di_f_thread_keys_destroy_callback_ +#define _di_f_thread_keys_delete_callback_ #define _di_f_thread_keys_t_ #define _di_f_thread_key_t_ -#define _di_f_thread_lock_attribute_adjust_callback_ +#define _di_f_thread_lock_attribute_destroy_callback_ #define _di_f_thread_lock_attribute_create_ #define _di_f_thread_lock_attribute_delete_ -#define _di_f_thread_lock_attribute_resize_callback_ +#define _di_f_thread_lock_attribute_delete_callback_ #define _di_f_thread_lock_attribute_shared_get_ #define _di_f_thread_lock_attribute_shared_set_ -#define _di_f_thread_lock_attributes_adjust_callback_ -#define _di_f_thread_lock_attributes_resize_callback_ +#define _di_f_thread_lock_attributes_destroy_callback_ +#define _di_f_thread_lock_attributes_delete_callback_ #define _di_f_thread_lock_attributes_t_ #define _di_f_thread_lock_attribute_t_ #define _di_f_thread_lock_create_ @@ -1696,25 +1696,25 @@ #define _di_f_thread_lock_read_ #define _di_f_thread_lock_read_timed_ #define _di_f_thread_lock_read_try_ -#define _di_f_thread_locks_adjust_callback_ -#define _di_f_thread_locks_resize_callback_ +#define _di_f_thread_locks_destroy_callback_ +#define _di_f_thread_locks_delete_callback_ #define _di_f_thread_locks_t_ #define _di_f_thread_lock_t_ #define _di_f_thread_lock_write_ #define _di_f_thread_lock_write_timed_ #define _di_f_thread_lock_write_try_ -#define _di_f_thread_mutex_attribute_adjust_callback_ +#define _di_f_thread_mutex_attribute_destroy_callback_ #define _di_f_thread_mutex_attribute_create_ #define _di_f_thread_mutex_attribute_delete_ #define _di_f_thread_mutex_attribute_priority_ceiling_get_ #define _di_f_thread_mutex_attribute_priority_ceiling_set_ #define _di_f_thread_mutex_attribute_protocol_get_ #define _di_f_thread_mutex_attribute_protocol_set_ -#define _di_f_thread_mutex_attribute_resize_callback_ +#define _di_f_thread_mutex_attribute_delete_callback_ #define _di_f_thread_mutex_attribute_shared_get_ #define _di_f_thread_mutex_attribute_shared_set_ -#define _di_f_thread_mutex_attributes_adjust_callback_ -#define _di_f_thread_mutex_attributes_resize_callback_ +#define _di_f_thread_mutex_attributes_destroy_callback_ +#define _di_f_thread_mutex_attributes_delete_callback_ #define _di_f_thread_mutex_attributes_t_ #define _di_f_thread_mutex_attribute_t_ #define _di_f_thread_mutex_attribute_type_get_ @@ -1726,8 +1726,8 @@ #define _di_f_thread_mutex_lock_try_ #define _di_f_thread_mutex_priority_ceiling_get_ #define _di_f_thread_mutex_priority_ceiling_set_ -#define _di_f_thread_mutexs_adjust_callback_ -#define _di_f_thread_mutexs_resize_callback_ +#define _di_f_thread_mutexs_destroy_callback_ +#define _di_f_thread_mutexs_delete_callback_ #define _di_f_thread_mutexs_t_ #define _di_f_thread_mutex_t_ #define _di_f_thread_mutex_unlock_ @@ -1745,14 +1745,14 @@ #define _di_f_thread_semaphore_lock_ #define _di_f_thread_semaphore_lock_timed_ #define _di_f_thread_semaphore_lock_try_ -#define _di_f_thread_semaphores_adjust_callback_ -#define _di_f_thread_semaphores_resize_callback_ +#define _di_f_thread_semaphores_destroy_callback_ +#define _di_f_thread_semaphores_delete_callback_ #define _di_f_thread_semaphores_t_ #define _di_f_thread_semaphore_t_ #define _di_f_thread_semaphore_unlock_ #define _di_f_thread_semaphore_value_get_ -#define _di_f_thread_sets_adjust_callback_ -#define _di_f_thread_sets_resize_callback_ +#define _di_f_thread_sets_destroy_callback_ +#define _di_f_thread_sets_delete_callback_ #define _di_f_thread_sets_t_ #define _di_f_thread_set_t_ //#define _di_f_thread_signal_mask_ @@ -1762,8 +1762,8 @@ #define _di_f_thread_spin_delete_ #define _di_f_thread_spin_lock_ #define _di_f_thread_spin_lock_try_ -#define _di_f_thread_spins_adjust_callback_ -#define _di_f_thread_spins_resize_callback_ +#define _di_f_thread_spins_destroy_callback_ +#define _di_f_thread_spins_delete_callback_ #define _di_f_thread_spins_t_ #define _di_f_thread_spin_t_ #define _di_f_thread_spin_unlock_ @@ -1777,25 +1777,25 @@ //#define _di_f_type_file_flag_d_ //#define _di_f_type_number_64_t_ //#define _di_f_type_sizes_d_ -#define _di_f_uint128s_adjust_callback_ -#define _di_f_uint128s_resize_callback_ +#define _di_f_uint128s_destroy_callback_ +#define _di_f_uint128s_delete_callback_ #define _di_f_uint128ss_t_ #define _di_f_uint128s_t_ //#define _di_f_uint128_t_ -#define _di_f_uint16s_adjust_callback_ -#define _di_f_uint16s_resize_callback_ +#define _di_f_uint16s_destroy_callback_ +#define _di_f_uint16s_delete_callback_ #define _di_f_uint16ss_t_ //#define _di_f_uint16s_t_ -#define _di_f_uint32s_adjust_callback_ -#define _di_f_uint32s_resize_callback_ +#define _di_f_uint32s_destroy_callback_ +#define _di_f_uint32s_delete_callback_ #define _di_f_uint32ss_t_ #define _di_f_uint32s_t_ -#define _di_f_uint64s_adjust_callback_ -#define _di_f_uint64s_resize_callback_ +#define _di_f_uint64s_destroy_callback_ +#define _di_f_uint64s_delete_callback_ #define _di_f_uint64ss_t_ #define _di_f_uint64s_t_ -#define _di_f_uint8s_adjust_callback_ -//#define _di_f_uint8s_resize_callback_ +#define _di_f_uint8s_destroy_callback_ +//#define _di_f_uint8s_delete_callback_ //#define _di_f_uint8ss_t_ //#define _di_f_uint8s_t_ #define _di_f_utf_buffer_decrement_ diff --git a/build/stand_alone/fake.settings b/build/stand_alone/fake.settings index 634877b..f8dc570 100644 --- a/build/stand_alone/fake.settings +++ b/build/stand_alone/fake.settings @@ -31,19 +31,18 @@ build_language c build_libraries -lc -lcap -build_sources_program fll/level_0/account.c fll/level_0/private-account.c fll/level_0/account/accounts.c fll/level_0/account/private-accounts.c +build_sources_program fll/level_0/account.c fll/level_0/private-account.c fll/level_0/account/accounts.c build_sources_program fll/level_0/capability.c build_sources_program fll/level_0/color.c fll/level_0/private-color.c fll/level_0/color/common.c build_sources_program fll/level_0/compare.c fll/level_0/compare/utf.c fll/level_0/private-compare.c fll/level_0/compare/private-utf.c build_sources_program fll/level_0/console.c fll/level_0/console/common.c fll/level_0/private-console.c build_sources_program fll/level_0/control_group.c fll/level_0/control_group/common.c build_sources_program fll/level_0/conversion.c fll/level_0/private-conversion.c fll/level_0/conversion/common.c -build_sources_program fll/level_0/directory.c fll/level_0/directory/common.c fll/level_0/directory/type.c fll/level_0/private-directory.c fll/level_0/directory/private-type.c +build_sources_program fll/level_0/directory.c fll/level_0/directory/common.c fll/level_0/directory/type.c fll/level_0/private-directory.c build_sources_program fll/level_0/environment.c build_sources_program fll/level_0/execute.c build_sources_program fll/level_0/file.c fll/level_0/private-file.c fll/level_0/file/common.c fll/level_0/file/stream.c build_sources_program fll/level_0/fss.c fll/level_0/fss/common.c fll/level_0/fss/item.c fll/level_0/fss/named.c fll/level_0/fss/nest.c fll/level_0/fss/quote.c fll/level_0/fss/set.c fll/level_0/fss/set_quote.c fll/level_0/fss/simple_packet.c -build_sources_program fll/level_0/fss/private-item.c fll/level_0/fss/private-named.c fll/level_0/fss/private-nest.c fll/level_0/fss/private-set.c fll/level_0/fss/private-set_quote.c fll/level_0/fss/private-simple_packet.c build_sources_program fll/level_0/iki.c fll/level_0/private-iki.c fll/level_0/iki/common.c fll/level_0/iki/private-data.c fll/level_0/iki/data.c build_sources_program fll/level_0/limit.c fll/level_0/limit/set.c fll/level_0/limit/value.c fll/level_0/limit/private-set.c fll/level_0/limit/private-value.c build_sources_program fll/level_0/memory.c fll/level_0/memory/array.c fll/level_0/memory/arrays.c diff --git a/level_0/f_account/c/account/accounts.c b/level_0/f_account/c/account/accounts.c index 6946d40..07eebac 100644 --- a/level_0/f_account/c/account/accounts.c +++ b/level_0/f_account/c/account/accounts.c @@ -1,6 +1,5 @@ #include "../account.h" #include "accounts.h" -#include "private-accounts.h" #ifdef __cplusplus extern "C" { @@ -12,20 +11,22 @@ extern "C" { if (!account) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - f_status_t status = f_string_dynamic_resize(0, &account->home); - if (F_status_is_error(status)) return status; + { + f_status_t status = f_string_dynamic_resize(0, &account->home); + if (F_status_is_error(status)) return status; - status = f_string_dynamic_resize(0, &account->label); - if (F_status_is_error(status)) return status; + status = f_string_dynamic_resize(0, &account->label); + if (F_status_is_error(status)) return status; - status = f_string_dynamic_resize(0, &account->name); - if (F_status_is_error(status)) return status; + status = f_string_dynamic_resize(0, &account->name); + if (F_status_is_error(status)) return status; - status = f_string_dynamic_resize(0, &account->password); - if (F_status_is_error(status)) return status; + status = f_string_dynamic_resize(0, &account->password); + if (F_status_is_error(status)) return status; - status = f_string_dynamic_resize(0, &account->shell); - if (F_status_is_error(status)) return status; + status = f_string_dynamic_resize(0, &account->shell); + if (F_status_is_error(status)) return status; + } return F_none; } @@ -37,177 +38,170 @@ extern "C" { if (!account) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - f_status_t status = f_string_dynamic_adjust(0, &account->home); - if (F_status_is_error(status)) return status; + account->id_user = 0; + account->id_group = 0; + + { + f_status_t status = f_string_dynamic_adjust(0, &account->home); + if (F_status_is_error(status)) return status; - status = f_string_dynamic_adjust(0, &account->label); - if (F_status_is_error(status)) return status; + status = f_string_dynamic_adjust(0, &account->label); + if (F_status_is_error(status)) return status; - status = f_string_dynamic_adjust(0, &account->name); - if (F_status_is_error(status)) return status; + status = f_string_dynamic_adjust(0, &account->name); + if (F_status_is_error(status)) return status; - status = f_string_dynamic_adjust(0, &account->password); - if (F_status_is_error(status)) return status; + status = f_string_dynamic_adjust(0, &account->password); + if (F_status_is_error(status)) return status; - status = f_string_dynamic_adjust(0, &account->shell); - if (F_status_is_error(status)) return status; + status = f_string_dynamic_adjust(0, &account->shell); + if (F_status_is_error(status)) return status; + } return F_none; } #endif // _di_f_account_destroy_ -#ifndef _di_f_accounts_adjust_callback_ - f_status_t f_accounts_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_accounts_delete_callback_ + f_status_t f_accounts_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { - f_accounts_t * const array = (f_accounts_t *) void_array; + f_account_t * const array = (f_account_t *) void_array; f_status_t status = F_none; for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_string_dynamic_adjust(0, &array->array[i].home); + status = f_string_dynamic_resize(0, &array[i].home); if (F_status_is_error(status)) return status; - status = f_string_dynamic_adjust(0, &array->array[i].label); + status = f_string_dynamic_resize(0, &array[i].label); if (F_status_is_error(status)) return status; - status = f_string_dynamic_adjust(0, &array->array[i].name); + status = f_string_dynamic_resize(0, &array[i].name); if (F_status_is_error(status)) return status; - status = f_string_dynamic_adjust(0, &array->array[i].password); + status = f_string_dynamic_resize(0, &array[i].password); if (F_status_is_error(status)) return status; - status = f_string_dynamic_adjust(0, &array->array[i].shell); + status = f_string_dynamic_resize(0, &array[i].shell); if (F_status_is_error(status)) return status; } // for } return F_none; } -#endif // _di_f_accounts_adjust_callback_ +#endif // _di_f_accounts_delete_callback_ -#ifndef _di_f_accounts_append_ - f_status_t f_accounts_append(const f_account_t source, f_accounts_t * const destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ +#ifndef _di_f_accounts_destroy_callback_ + f_status_t f_accounts_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { - f_status_t status = f_memory_array_increase(F_memory_default_allocation_small_d, sizeof(f_account_t), (void **) &destination->array, &destination->used, &destination->size); - if (F_status_is_error(status)) return status; + { + f_account_t * const array = (f_account_t *) void_array; + f_status_t status = F_none; - destination->array[destination->used].home.used = 0; - destination->array[destination->used].label.used = 0; - destination->array[destination->used].name.used = 0; - destination->array[destination->used].password.used = 0; - destination->array[destination->used].shell.used = 0; + for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_string_dynamic_append(source.home, &destination->array[destination->used].home); - if (F_status_is_error(status)) return status; + array[i].id_user = 0; + array[i].id_group = 0; - status = f_string_dynamic_append(source.label, &destination->array[destination->used].label); - if (F_status_is_error(status)) return status; + status = f_string_dynamic_adjust(0, &array[i].home); + if (F_status_is_error(status)) return status; - status = f_string_dynamic_append(source.name, &destination->array[destination->used].name); - if (F_status_is_error(status)) return status; + status = f_string_dynamic_adjust(0, &array[i].label); + if (F_status_is_error(status)) return status; - status = f_string_dynamic_append(source.password, &destination->array[destination->used].password); - if (F_status_is_error(status)) return status; + status = f_string_dynamic_adjust(0, &array[i].name); + if (F_status_is_error(status)) return status; - status = f_string_dynamic_append(source.shell, &destination->array[destination->used].shell); - if (F_status_is_error(status)) return status; + status = f_string_dynamic_adjust(0, &array[i].password); + if (F_status_is_error(status)) return status; - ++destination->used; + status = f_string_dynamic_adjust(0, &array[i].shell); + if (F_status_is_error(status)) return status; + } // for + } return F_none; } -#endif // _di_f_accounts_append_ - -#ifndef _di_f_accounts_append_all_ - f_status_t f_accounts_append_all(const f_accounts_t source, f_accounts_t * const destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not; - - return private_f_accounts_append_all(source, destination); - } -#endif // _di_f_accounts_append_all_ +#endif // _di_f_accounts_destroy_callback_ -#ifndef _di_f_accounts_resize_callback_ - f_status_t f_accounts_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_accountss_delete_callback_ + f_status_t f_accountss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { f_accounts_t * const array = (f_accounts_t *) void_array; f_status_t status = F_none; + f_number_unsigned_t j = 0; for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_string_dynamic_resize(0, &array->array[i].home); - if (F_status_is_error(status)) return status; + for (j = 0; j < array[i].size; ++j) { - status = f_string_dynamic_resize(0, &array->array[i].label); - if (F_status_is_error(status)) return status; + status = f_string_dynamic_resize(0, &array[i].array[j].home); + if (F_status_is_error(status)) return status; - status = f_string_dynamic_resize(0, &array->array[i].name); - if (F_status_is_error(status)) return status; + status = f_string_dynamic_resize(0, &array[i].array[j].label); + if (F_status_is_error(status)) return status; - status = f_string_dynamic_resize(0, &array->array[i].password); - if (F_status_is_error(status)) return status; + status = f_string_dynamic_resize(0, &array[i].array[j].name); + if (F_status_is_error(status)) return status; - status = f_string_dynamic_resize(0, &array->array[i].shell); - if (F_status_is_error(status)) return status; + status = f_string_dynamic_resize(0, &array[i].array[j].password); + if (F_status_is_error(status)) return status; + + status = f_string_dynamic_resize(0, &array[i].array[j].shell); + if (F_status_is_error(status)) return status; + } // for + + if (array[i].size) { + status = f_memory_array_resize(0, sizeof(f_account_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } } // for } return F_none; } -#endif // _di_f_accounts_resize_callback_ - -#ifndef _di_f_accountss_append_ - f_status_t f_accountss_append(const f_accounts_t source, f_accountss_t * const destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not; +#endif // _di_f_accountss_delete_callback_ - f_status_t status = f_memory_array_increase(F_memory_default_allocation_small_d, sizeof(f_accounts_t), (void **) &destination->array, &destination->used, &destination->size); - if (F_status_is_error(status)) return status; +#ifndef _di_f_accountss_destroy_callback_ + f_status_t f_accountss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { - status = private_f_accounts_append_all(source, &destination->array[destination->used]); - if (F_status_is_error(status)) return status; + { + f_accounts_t * const array = (f_accounts_t *) void_array; + f_status_t status = F_none; + f_number_unsigned_t j = 0; - ++destination->used; + for (f_number_unsigned_t i = start; i < stop; ++i) { - return F_none; - } -#endif // _di_f_accountss_append_ + for (j = 0; j < array[i].size; ++j) { -#ifndef _di_f_accountss_append_all_ - f_status_t f_accountss_append_all(const f_accountss_t source, f_accountss_t * const destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + status = f_string_dynamic_adjust(0, &array[i].array[j].home); + if (F_status_is_error(status)) return status; - if (!source.used) return F_data_not; + status = f_string_dynamic_adjust(0, &array[i].array[j].label); + if (F_status_is_error(status)) return status; - f_status_t status = f_memory_array_increase_by(source.used, sizeof(f_accounts_t), (void **) &destination->array, &destination->used, &destination->size); - if (F_status_is_error(status)) return status; + status = f_string_dynamic_adjust(0, &array[i].array[j].name); + if (F_status_is_error(status)) return status; - for (f_number_unsigned_t i = 0; i < source.used; ++i, ++destination->used) { + status = f_string_dynamic_adjust(0, &array[i].array[j].password); + if (F_status_is_error(status)) return status; - destination->array[destination->used].used = 0; + status = f_string_dynamic_adjust(0, &array[i].array[j].shell); + if (F_status_is_error(status)) return status; + } // for - if (source.array[i].used) { - status = private_f_accounts_append_all(source.array[i], &destination->array[destination->used]); - if (F_status_is_error(status)) return status; - } - } // for + if (array[i].size) { + status = f_memory_array_adjust(0, sizeof(f_account_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } + } // for + } return F_none; } -#endif // _di_f_accountss_append_all_ +#endif // _di_f_accountss_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_account/c/account/accounts.h b/level_0/f_account/c/account/accounts.h index b67e906..7dea123 100644 --- a/level_0/f_account/c/account/accounts.h +++ b/level_0/f_account/c/account/accounts.h @@ -55,7 +55,9 @@ extern "C" { #endif // _di_f_account_destroy_ /** - * A callback intended to be passed to f_memory_arrays_adjust() for an f_accountss_t structure. + * A callback intended to be passed to f_memory_arrays_resize() for an f_accounts_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. * * This does not do parameter checking. * @@ -72,66 +74,47 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_memory_array_adjust(). + * Errors (with error bit) from: f_string_dynamic_resize(). * - * @see f_memory_array_adjust() - * @see f_memory_arrays_adjust() + * @see f_string_dynamic_resize() */ -#ifndef _di_f_accounts_adjust_callback_ - extern f_status_t f_accounts_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_accounts_adjust_callback_ +#ifndef _di_f_accounts_delete_callback_ + extern f_status_t f_accounts_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_accounts_delete_callback_ /** - * Append the single source account onto the destination. - * - * @param source - * The source account to append. - * @param destination - * The destination accounts the source is appended onto. + * A callback intended to be passed to f_memory_arrays_adjust() for an f_accounts_t structure. * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. + * This is only called when shrinking the array and generally should perform deallocations. * - * Errors (with error bit) from: f_memory_resize(). - * Errors (with error bit) from: f_string_dynamic_append(). - * - * @see f_memory_resize() - * @see f_string_dynamic_append() - */ -#ifndef _di_f_accounts_append_ - extern f_status_t f_accounts_append(const f_account_t source, f_accounts_t * const destination); -#endif // _di_f_accounts_append_ - -/** - * Append the source accounts onto the destination. + * This does not do parameter checking. * - * @param source - * The source accounts to append. - * @param destination - * The destination accounts the source is appended onto. + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_memory_resize(). - * Errors (with error bit) from: f_string_dynamic_append(). + * Errors (with error bit) from: f_string_dynamic_adjust(). * - * @see f_memory_resize() - * @see f_string_dynamic_append() + * @see f_string_dynamic_adjust() */ -#ifndef _di_f_accounts_append_all_ - extern f_status_t f_accounts_append_all(const f_accounts_t source, f_accounts_t * const destination); -#endif // _di_f_accounts_append_all_ +#ifndef _di_f_accounts_destroy_callback_ + extern f_status_t f_accounts_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_accounts_destroy_callback_ /** * A callback intended to be passed to f_memory_arrays_resize() for an f_accountss_t structure. * + * This is only called when shrinking the array and generally should perform deallocations. + * * This does not do parameter checking. * * @param start @@ -148,61 +131,44 @@ 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_memory_arrays_resize() + * @see f_string_dynamic_resize() */ -#ifndef _di_f_accounts_resize_callback_ - extern f_status_t f_accounts_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_accounts_resize_callback_ +#ifndef _di_f_accountss_delete_callback_ + extern f_status_t f_accountss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_accountss_delete_callback_ /** - * Append the single source accounts onto the destination. - * - * @param source - * The source accounts to append. - * @param destination - * The destination ranges the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. + * A callback intended to be passed to f_memory_arrays_adjust() for an f_accountss_t structure. * - * Errors (with error bit) from: f_memory_resize(). - * Errors (with error bit) from: f_string_dynamic_resize(). + * This is only called when shrinking the array and generally should perform deallocations. * - * @see f_memory_resize() - * @see f_string_dynamic_resize() - */ -#ifndef _di_f_accountss_append_ - extern f_status_t f_accountss_append(const f_accounts_t source, f_accountss_t * const destination); -#endif // _di_f_accountss_append_ - -/** - * Append the source accountss onto the destination. + * This does not do parameter checking. * - * @param source - * The source accountss to append. - * @param destination - * The destination ranges the source is appended onto. + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_memory_resize(). - * Errors (with error bit) from: f_string_dynamic_resize(). + * Errors (with error bit) from: f_memory_array_adjust(). + * Errors (with error bit) from: f_string_dynamic_adjust(). * - * @see f_memory_resize() - * @see f_string_dynamic_resize() + * @see f_memory_array_adjust() + * @see f_string_dynamic_adjust() */ -#ifndef _di_f_accountss_append_all_ - extern f_status_t f_accountss_append_all(const f_accountss_t source, f_accountss_t * const destination); -#endif // _di_f_accountss_append_all_ +#ifndef _di_f_accountss_destroy_callback_ + extern f_status_t f_accountss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_accountss_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_account/data/build/settings b/level_0/f_account/data/build/settings index 6e14db1..d8ab74b 100644 --- a/level_0/f_account/data/build/settings +++ b/level_0/f_account/data/build/settings @@ -32,7 +32,7 @@ build_language c build_libraries -lc build_libraries-individual -lf_memory -lf_string -build_sources_library account.c private-account.c account/accounts.c account/private-accounts.c +build_sources_library account.c private-account.c account/accounts.c build_sources_headers account.h account/accounts.h account/common.h diff --git a/level_0/f_account/data/build/settings-mocks b/level_0/f_account/data/build/settings-mocks index 5f917a3..470120a 100644 --- a/level_0/f_account/data/build/settings-mocks +++ b/level_0/f_account/data/build/settings-mocks @@ -30,7 +30,8 @@ build_language c build_libraries -lc build_libraries-individual -lf_memory -lf_string -build_sources_library account.c private-account.c account/accounts.c account/private-accounts.c ../../tests/unit/c/mock-account.c +build_sources_library account.c private-account.c account/accounts.c +build_sources_library ../../tests/unit/c/mock-account.c build_sources_headers account.h account/accounts.h account/common.h @@ -61,6 +62,8 @@ flags-coverage --coverage -fprofile-abs-path -fprofile-dir=build/coverage/ flags_library -fPIC # Inject mocks. +flags -Wl,--wrap=f_memory_array_adjust +flags -Wl,--wrap=f_memory_array_resize flags -Wl,--wrap=f_string_dynamic_adjust flags -Wl,--wrap=f_string_dynamic_resize flags -Wl,--wrap=getpwnam_r diff --git a/level_0/f_account/data/build/settings-tests b/level_0/f_account/data/build/settings-tests index d752945..0f9c877 100644 --- a/level_0/f_account/data/build/settings-tests +++ b/level_0/f_account/data/build/settings-tests @@ -26,8 +26,7 @@ build_libraries -lc -lcmocka build_libraries-individual -lf_memory -lf_string -lf_type_array -lf_account build_sources_program test-account-by_id.c test-account-by_name.c test-account-group_name_by_id.c test-account-group_id_by_name.c test-account-id_by_name.c test-account-name_by_id.c -build_sources_program test-account-s_adjust_callback.c test-account-s_append.c test-account-s_append_all.c test-account-s_resize_callback.c -build_sources_program test-account-ss_append.c test-account-ss_append_all.c +build_sources_program test-account-s_delete_callback.c test-account-s_destroy_callback.c test-account-ss_delete_callback.c test-account-ss_destroy_callback.c build_sources_program test-account.c build_script no 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 00add2f..81cf5a5 100644 --- a/level_0/f_account/tests/unit/c/mock-account.c +++ b/level_0/f_account/tests/unit/c/mock-account.c @@ -5,6 +5,41 @@ extern "C" { #endif int mock_unwrap = 0; +int mock_unwrap_f_memory = 1; + +f_status_t __wrap_f_memory_array_adjust(const f_number_unsigned_t length, const size_t width, void ** const array, f_number_unsigned_t * const used, f_number_unsigned_t * const size) { + + if (mock_unwrap_f_memory) { + return __real_f_memory_array_adjust(length, width, array, used, size); + } + + if (!array || !used || !size) return F_status_set_error(F_parameter_not); + + const bool failure = mock_type(bool); + + if (failure) return mock_type(f_status_t); + + *size = length; + + return mock_type(f_status_t); +} + +f_status_t __wrap_f_memory_array_resize(const f_number_unsigned_t length, const size_t width, void ** const array, f_number_unsigned_t * const used, f_number_unsigned_t * const size) { + + if (mock_unwrap_f_memory) { + return __real_f_memory_array_resize(length, width, array, used, size); + } + + if (!array || !used || !size) return F_status_set_error(F_parameter_not); + + const bool failure = mock_type(bool); + + if (failure) return mock_type(f_status_t); + + *size = length; + + return mock_type(f_status_t); +} f_status_t __wrap_f_string_dynamic_adjust(const f_number_unsigned_t length, f_string_dynamic_t * const structure) { diff --git a/level_0/f_account/tests/unit/c/mock-account.h b/level_0/f_account/tests/unit/c/mock-account.h index 76c0412..529f229 100644 --- a/level_0/f_account/tests/unit/c/mock-account.h +++ b/level_0/f_account/tests/unit/c/mock-account.h @@ -29,10 +29,15 @@ extern "C" { const static int mock_errno_generic = 32767; extern int mock_unwrap; +extern int mock_unwrap_f_memory; +extern f_status_t __real_f_memory_array_adjust(const f_number_unsigned_t length, const size_t width, void ** const array, f_number_unsigned_t * const used, f_number_unsigned_t * const size); +extern f_status_t __real_f_memory_array_resize(const f_number_unsigned_t length, const size_t width, void ** const array, f_number_unsigned_t * const used, f_number_unsigned_t * const size); extern f_status_t __real_f_string_dynamic_adjust(const f_number_unsigned_t length, f_string_dynamic_t * const structure); extern f_status_t __real_f_string_dynamic_resize(const f_number_unsigned_t length, f_string_dynamic_t * const structure); +extern f_status_t __wrap_f_memory_array_adjust(const f_number_unsigned_t length, const size_t width, void ** const array, f_number_unsigned_t * const used, f_number_unsigned_t * const size); +extern f_status_t __wrap_f_memory_array_resize(const f_number_unsigned_t length, const size_t width, void ** const array, f_number_unsigned_t * const used, f_number_unsigned_t * const size); extern f_status_t __wrap_f_string_dynamic_adjust(const f_number_unsigned_t length, f_string_dynamic_t * const structure); extern f_status_t __wrap_f_string_dynamic_resize(const f_number_unsigned_t length, f_string_dynamic_t * const structure); diff --git a/level_0/f_account/tests/unit/c/test-account-s_adjust_callback.c b/level_0/f_account/tests/unit/c/test-account-s_adjust_callback.c deleted file mode 100644 index 37bcc5a..0000000 --- a/level_0/f_account/tests/unit/c/test-account-s_adjust_callback.c +++ /dev/null @@ -1,61 +0,0 @@ -#include "test-account.h" -#include "test-account-s_adjust_callback.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_accounts_adjust_callback__fails(void **state) { - - mock_unwrap = 0; - - f_account_t data = f_account_t_initialize; - f_account_t data_array[] = { data }; - f_accounts_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_accounts_t datass_array[] = { datas }; - - { - will_return(__wrap_f_string_dynamic_adjust, true); - will_return(__wrap_f_string_dynamic_adjust, F_status_set_error(F_failure)); - - const f_status_t status = f_accounts_adjust_callback(0, 1, (void *) datass_array); - - assert_int_equal(status, F_status_set_error(F_failure)); - } -} - -void test__f_accounts_adjust_callback__works(void **state) { - - mock_unwrap = 0; - - f_account_t data = f_account_t_initialize; - f_account_t data_array[] = { data }; - f_accounts_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_accounts_t datass_array[] = { datas }; - const f_number_unsigned_t length = 1; - - { - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_none); - - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_none); - - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_none); - - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_none); - - will_return(__wrap_f_string_dynamic_adjust, false); - will_return(__wrap_f_string_dynamic_adjust, F_none); - - const f_status_t status = f_accounts_adjust_callback(0, length, (void *) datass_array); - - assert_int_equal(status, F_none); - } -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_account/tests/unit/c/test-account-s_adjust_callback.h b/level_0/f_account/tests/unit/c/test-account-s_adjust_callback.h deleted file mode 100644 index 98039dd..0000000 --- a/level_0/f_account/tests/unit/c/test-account-s_adjust_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Account - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_account__s_adjust_callback -#define _TEST__F_account__s_adjust_callback - -/** - * Test that the function fails. - * - * @see f_accounts_adjust_callback() - */ -extern void test__f_accounts_adjust_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_accounts_adjust_callback() - */ -extern void test__f_accounts_adjust_callback__works(void **state); - -#endif // _TEST__F_account__s_adjust_callback diff --git a/level_0/f_account/tests/unit/c/test-account-s_append.c b/level_0/f_account/tests/unit/c/test-account-s_append.c deleted file mode 100644 index bb5b43b..0000000 --- a/level_0/f_account/tests/unit/c/test-account-s_append.c +++ /dev/null @@ -1,61 +0,0 @@ -#include "test-account.h" -#include "test-account-s_append.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_accounts_append__parameter_checking(void **state) { - - const f_account_t data = f_account_t_initialize; - - { - const f_status_t status = f_accounts_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_accounts_append__works(void **state) { - - mock_unwrap = 1; - - f_string_static_t home = macro_f_string_static_t_initialize_1("home", 0, 4); - f_string_static_t label = macro_f_string_static_t_initialize_1("label", 0, 5); - f_string_static_t name = macro_f_string_static_t_initialize_1("name", 0, 4); - f_string_static_t password = macro_f_string_static_t_initialize_1("password", 0, 8); - f_string_static_t shell = macro_f_string_static_t_initialize_1("shell", 0, 5); - - const f_account_t source = { .home = home, .label = label, .name = name, .password = password, .shell = shell }; - f_accounts_t destination = f_accounts_t_initialize; - - { - const f_status_t status = f_accounts_append(source, &destination); - - assert_int_equal(status, F_none); - assert_int_equal(destination.used, 1); - - assert_string_equal(destination.array[0].home.string, source.home.string); - assert_string_equal(destination.array[0].label.string, source.label.string); - assert_string_equal(destination.array[0].name.string, source.name.string); - assert_string_equal(destination.array[0].password.string, source.password.string); - assert_string_equal(destination.array[0].shell.string, source.shell.string); - - assert_int_equal(destination.array[0].home.used, source.home.used); - assert_int_equal(destination.array[0].label.used, source.label.used); - assert_int_equal(destination.array[0].name.used, source.name.used); - assert_int_equal(destination.array[0].password.used, source.password.used); - assert_int_equal(destination.array[0].shell.used, source.shell.used); - } - - free((void *) destination.array[0].home.string); - free((void *) destination.array[0].label.string); - free((void *) destination.array[0].name.string); - free((void *) destination.array[0].password.string); - free((void *) destination.array[0].shell.string); - free((void *) destination.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_account/tests/unit/c/test-account-s_append.h b/level_0/f_account/tests/unit/c/test-account-s_append.h deleted file mode 100644 index 1811817..0000000 --- a/level_0/f_account/tests/unit/c/test-account-s_append.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Account - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_account_s_append -#define _TEST__F_account_s_append - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_accounts_append() - */ -extern void test__f_accounts_append__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_accounts_append() - */ -extern void test__f_accounts_append__works(void **state); - -#endif // _TEST__F_account_s_append diff --git a/level_0/f_account/tests/unit/c/test-account-s_append_all.c b/level_0/f_account/tests/unit/c/test-account-s_append_all.c deleted file mode 100644 index fa7e1f6..0000000 --- a/level_0/f_account/tests/unit/c/test-account-s_append_all.c +++ /dev/null @@ -1,116 +0,0 @@ -#include "test-account.h" -#include "test-account-s_append_all.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_accounts_append_all__parameter_checking(void **state) { - - const f_accounts_t data = f_accounts_t_initialize; - - { - const f_status_t status = f_accounts_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_accounts_append_all__returns_data_not(void **state) { - - const int length = 5; - f_accounts_t source = f_accounts_t_initialize; - f_accounts_t destination = f_accounts_t_initialize; - - { - const f_status_t status = f_memory_array_resize(length, sizeof(f_account_t), (void **) &source.array, &source.used, &source.size); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_accounts_append_all(source, &destination); - - assert_int_equal(status, F_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); - } - - free((void *) source.array); -} - -void test__f_accounts_append_all__works(void **state) { - - mock_unwrap = 1; - - const int length = 5; - f_accounts_t source = f_accounts_t_initialize; - f_accounts_t destination = f_accounts_t_initialize; - - f_string_static_t home_0 = macro_f_string_static_t_initialize_1("home_0", 0, 6); - f_string_static_t label_0 = macro_f_string_static_t_initialize_1("label_0", 0, 7); - f_string_static_t name_0 = macro_f_string_static_t_initialize_1("name_0", 0, 6); - f_string_static_t password_0 = macro_f_string_static_t_initialize_1("password_0", 0, 10); - f_string_static_t shell_0 = macro_f_string_static_t_initialize_1("shell_0", 0, 7); - - f_string_static_t home_1 = macro_f_string_static_t_initialize_1("home_1", 0, 6); - f_string_static_t label_1 = macro_f_string_static_t_initialize_1("label_1", 0, 7); - f_string_static_t name_1 = macro_f_string_static_t_initialize_1("name_1", 0, 6); - f_string_static_t password_1 = macro_f_string_static_t_initialize_1("password_1", 0, 10); - f_string_static_t shell_1 = macro_f_string_static_t_initialize_1("shell_1", 0, 7); - - const f_account_t account_0 = { .home = home_0, .label = label_0, .name = name_0, .password = password_0, .shell = shell_0 }; - const f_account_t account_1 = { .home = home_1, .label = label_1, .name = name_1, .password = password_1, .shell = shell_1 }; - - { - const f_status_t status = f_memory_array_resize(length, sizeof(f_account_t), (void **) &source.array, &source.used, &source.size); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - memcpy(&source.array[source.used++], (void *) &account_0, sizeof(f_account_t)); - memcpy(&source.array[source.used++], (void *) &account_1, sizeof(f_account_t)); - - { - const f_status_t status = f_accounts_append_all(source, &destination); - - assert_int_equal(status, F_none); - assert_int_equal(destination.used, source.used); - assert_int_equal(destination.size, source.used); - - assert_string_equal(destination.array[0].home.string, account_0.home.string); - assert_string_equal(destination.array[0].label.string, account_0.label.string); - assert_string_equal(destination.array[0].name.string, account_0.name.string); - assert_string_equal(destination.array[0].password.string, account_0.password.string); - assert_string_equal(destination.array[0].shell.string, account_0.shell.string); - - assert_string_equal(destination.array[1].home.string, account_1.home.string); - assert_string_equal(destination.array[1].label.string, account_1.label.string); - assert_string_equal(destination.array[1].name.string, account_1.name.string); - assert_string_equal(destination.array[1].password.string, account_1.password.string); - assert_string_equal(destination.array[1].shell.string, account_1.shell.string); - } - - free((void *) source.array); - - free((void *) destination.array[0].home.string); - free((void *) destination.array[0].label.string); - free((void *) destination.array[0].name.string); - free((void *) destination.array[0].password.string); - free((void *) destination.array[0].shell.string); - free((void *) destination.array[1].home.string); - free((void *) destination.array[1].label.string); - free((void *) destination.array[1].name.string); - free((void *) destination.array[1].password.string); - free((void *) destination.array[1].shell.string); - free((void *) destination.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_account/tests/unit/c/test-account-s_append_all.h b/level_0/f_account/tests/unit/c/test-account-s_append_all.h deleted file mode 100644 index 43ef5fa..0000000 --- a/level_0/f_account/tests/unit/c/test-account-s_append_all.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Account - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_account_s_append_all -#define _TEST__F_account_s_append_all - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_accounts_append_all() - */ -extern void test__f_accounts_append_all__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_accounts_append_all() - */ -extern void test__f_accounts_append_all__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_accounts_append_all() - */ -extern void test__f_accounts_append_all__works(void **state); - -#endif // _TEST__F_account_s_append_all 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 new file mode 100644 index 0000000..5eedd3d --- /dev/null +++ b/level_0/f_account/tests/unit/c/test-account-s_delete_callback.c @@ -0,0 +1,137 @@ +#include "test-account.h" +#include "test-account-s_delete_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_accounts_delete_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 1; + + 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)); + + const f_status_t status = f_accounts_delete_callback(0, 1, (void *) data_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamic_resize, false); + will_return(__wrap_f_string_dynamic_resize, F_none); + + will_return(__wrap_f_string_dynamic_resize, true); + will_return(__wrap_f_string_dynamic_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_accounts_delete_callback(0, 1, (void *) data_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamic_resize, false); + will_return(__wrap_f_string_dynamic_resize, F_none); + + will_return(__wrap_f_string_dynamic_resize, false); + will_return(__wrap_f_string_dynamic_resize, F_none); + + will_return(__wrap_f_string_dynamic_resize, true); + will_return(__wrap_f_string_dynamic_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_accounts_delete_callback(0, 1, (void *) data_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamic_resize, false); + will_return(__wrap_f_string_dynamic_resize, F_none); + + will_return(__wrap_f_string_dynamic_resize, false); + will_return(__wrap_f_string_dynamic_resize, F_none); + + will_return(__wrap_f_string_dynamic_resize, false); + will_return(__wrap_f_string_dynamic_resize, F_none); + + will_return(__wrap_f_string_dynamic_resize, true); + will_return(__wrap_f_string_dynamic_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_accounts_delete_callback(0, 1, (void *) data_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamic_resize, false); + will_return(__wrap_f_string_dynamic_resize, F_none); + + will_return(__wrap_f_string_dynamic_resize, false); + will_return(__wrap_f_string_dynamic_resize, F_none); + + will_return(__wrap_f_string_dynamic_resize, false); + will_return(__wrap_f_string_dynamic_resize, F_none); + + will_return(__wrap_f_string_dynamic_resize, false); + will_return(__wrap_f_string_dynamic_resize, F_none); + + will_return(__wrap_f_string_dynamic_resize, true); + will_return(__wrap_f_string_dynamic_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_accounts_delete_callback(0, 1, (void *) data_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_accounts_delete_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_accounts_t datas = f_accounts_t_initialize; + + { + 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_none); + + status = f_string_dynamic_resize(1, &datas.array[0].home); + assert_int_equal(status, F_none); + + status = f_string_dynamic_resize(1, &datas.array[0].label); + assert_int_equal(status, F_none); + + status = f_string_dynamic_resize(1, &datas.array[0].name); + assert_int_equal(status, F_none); + + status = f_string_dynamic_resize(1, &datas.array[0].password); + assert_int_equal(status, F_none); + + status = f_string_dynamic_resize(1, &datas.array[0].shell); + assert_int_equal(status, F_none); + } + + { + const f_status_t status = f_accounts_delete_callback(0, length, (void *) datas.array); + + assert_int_equal(status, F_none); + assert_int_equal(datas.array[0].home.size, 0); + assert_int_equal(datas.array[0].label.size, 0); + assert_int_equal(datas.array[0].name.size, 0); + assert_int_equal(datas.array[0].password.size, 0); + assert_int_equal(datas.array[0].shell.size, 0); + } + + free((void *) datas.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_account/tests/unit/c/test-account-s_delete_callback.h b/level_0/f_account/tests/unit/c/test-account-s_delete_callback.h new file mode 100644 index 0000000..b909978 --- /dev/null +++ b/level_0/f_account/tests/unit/c/test-account-s_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Account + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_account__s_delete_callback +#define _TEST__F_account__s_delete_callback + +/** + * Test that the function fails. + * + * @see f_accounts_delete_callback() + */ +extern void test__f_accounts_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_accounts_delete_callback() + */ +extern void test__f_accounts_delete_callback__works(void **state); + +#endif // _TEST__F_account__s_delete_callback 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 new file mode 100644 index 0000000..fcf7d40 --- /dev/null +++ b/level_0/f_account/tests/unit/c/test-account-s_destroy_callback.c @@ -0,0 +1,137 @@ +#include "test-account.h" +#include "test-account-s_destroy_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_accounts_destroy_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 1; + + 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)); + + const f_status_t status = f_accounts_destroy_callback(0, 1, (void *) data_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamic_adjust, true); + will_return(__wrap_f_string_dynamic_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_accounts_destroy_callback(0, 1, (void *) data_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamic_adjust, true); + will_return(__wrap_f_string_dynamic_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_accounts_destroy_callback(0, 1, (void *) data_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamic_adjust, true); + will_return(__wrap_f_string_dynamic_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_accounts_destroy_callback(0, 1, (void *) data_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamic_adjust, true); + will_return(__wrap_f_string_dynamic_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_accounts_destroy_callback(0, 1, (void *) data_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_accounts_destroy_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_accounts_t datas = f_accounts_t_initialize; + + { + 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_none); + + status = f_string_dynamic_resize(1, &datas.array[0].home); + assert_int_equal(status, F_none); + + status = f_string_dynamic_resize(1, &datas.array[0].label); + assert_int_equal(status, F_none); + + status = f_string_dynamic_resize(1, &datas.array[0].name); + assert_int_equal(status, F_none); + + status = f_string_dynamic_resize(1, &datas.array[0].password); + assert_int_equal(status, F_none); + + status = f_string_dynamic_resize(1, &datas.array[0].shell); + assert_int_equal(status, F_none); + } + + { + const f_status_t status = f_accounts_destroy_callback(0, length, (void *) datas.array); + + assert_int_equal(status, F_none); + assert_int_equal(datas.array[0].home.size, 0); + assert_int_equal(datas.array[0].label.size, 0); + assert_int_equal(datas.array[0].name.size, 0); + assert_int_equal(datas.array[0].password.size, 0); + assert_int_equal(datas.array[0].shell.size, 0); + } + + free((void *) datas.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_account/tests/unit/c/test-account-s_destroy_callback.h b/level_0/f_account/tests/unit/c/test-account-s_destroy_callback.h new file mode 100644 index 0000000..65f8a14 --- /dev/null +++ b/level_0/f_account/tests/unit/c/test-account-s_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Account + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_account__s_destroy_callback +#define _TEST__F_account__s_destroy_callback + +/** + * Test that the function fails. + * + * @see f_accounts_destroy_callback() + */ +extern void test__f_accounts_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_accounts_destroy_callback() + */ +extern void test__f_accounts_destroy_callback__works(void **state); + +#endif // _TEST__F_account__s_destroy_callback diff --git a/level_0/f_account/tests/unit/c/test-account-s_resize_callback.h b/level_0/f_account/tests/unit/c/test-account-s_resize_callback.h deleted file mode 100644 index 3fe68d0..0000000 --- a/level_0/f_account/tests/unit/c/test-account-s_resize_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Account - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_account__s_resize_callback -#define _TEST__F_account__s_resize_callback - -/** - * Test that the function fails. - * - * @see f_accounts_resize_callback() - */ -extern void test__f_accounts_resize_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_accounts_resize_callback() - */ -extern void test__f_accounts_resize_callback__works(void **state); - -#endif // _TEST__F_account__s_resize_callback diff --git a/level_0/f_account/tests/unit/c/test-account-ss_append.c b/level_0/f_account/tests/unit/c/test-account-ss_append.c deleted file mode 100644 index 66a1e1d..0000000 --- a/level_0/f_account/tests/unit/c/test-account-ss_append.c +++ /dev/null @@ -1,117 +0,0 @@ -#include "test-account.h" -#include "test-account-ss_append.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_accountss_append__parameter_checking(void **state) { - - f_accounts_t data = f_accounts_t_initialize; - - { - const f_status_t status = f_accountss_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_accountss_append__returns_data_not(void **state) { - - const int length = 5; - f_accounts_t source = f_accountss_t_initialize; - f_accountss_t destination = f_accountss_t_initialize; - - { - const f_status_t status = f_memory_array_resize(length, sizeof(f_account_t), (void **) &source.array, &source.used, &source.size); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_accountss_append(source, &destination); - - assert_int_equal(status, F_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); - } - - free((void *) source.array); -} - -void test__f_accountss_append__works(void **state) { - - mock_unwrap = 1; - - const int length = 5; - f_accounts_t sources = f_accounts_t_initialize; - f_accountss_t destination = f_accountss_t_initialize; - - f_string_static_t home = macro_f_string_static_t_initialize_1("home", 0, 4); - f_string_static_t label = macro_f_string_static_t_initialize_1("label", 0, 5); - f_string_static_t name = macro_f_string_static_t_initialize_1("name", 0, 4); - f_string_static_t password = macro_f_string_static_t_initialize_1("password", 0, 8); - f_string_static_t shell = macro_f_string_static_t_initialize_1("shell", 0, 5); - - const f_account_t source = { .home = home, .label = label, .name = name, .password = password, .shell = shell }; - - { - const f_status_t status = f_memory_array_resize(length, sizeof(f_account_t), (void **) &sources.array, &sources.used, &sources.size); - - assert_int_equal(status, F_none); - assert_int_equal(sources.used, 0); - assert_int_equal(sources.size, length); - } - - while (sources.used < length) { - memcpy(&sources.array[sources.used++], (void *) &source, sizeof(f_account_t)); - } // while - - { - const f_status_t status = f_accountss_append(sources, &destination); - - assert_int_equal(status, F_none); - assert_int_equal(destination.used, 1); - assert_int_equal(destination.array[0].used, sources.used); - assert_int_equal(destination.array[0].size, sources.used); - - for (f_number_unsigned_t i = 0; i < destination.array[0].used; ++i) { - - assert_string_equal(destination.array[0].array[i].home.string, source.home.string); - assert_string_equal(destination.array[0].array[i].label.string, source.label.string); - assert_string_equal(destination.array[0].array[i].name.string, source.name.string); - assert_string_equal(destination.array[0].array[i].password.string, source.password.string); - assert_string_equal(destination.array[0].array[i].shell.string, source.shell.string); - - assert_int_equal(destination.array[0].array[i].home.used, source.home.used); - assert_int_equal(destination.array[0].array[i].label.used, source.label.used); - assert_int_equal(destination.array[0].array[i].name.used, source.name.used); - assert_int_equal(destination.array[0].array[i].password.used, source.password.used); - assert_int_equal(destination.array[0].array[i].shell.used, source.shell.used); - } // for - } - - for (f_number_unsigned_t i = 0; i < destination.used; ++i) { - - for (f_number_unsigned_t j = 0; j < destination.array[i].used; ++j) { - - free((void *) destination.array[i].array[j].home.string); - free((void *) destination.array[i].array[j].label.string); - free((void *) destination.array[i].array[j].name.string); - free((void *) destination.array[i].array[j].password.string); - free((void *) destination.array[i].array[j].shell.string); - } - - free((void *) destination.array[i].array); - } // for - - free((void *) sources.array); - free((void *) destination.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_account/tests/unit/c/test-account-ss_append.h b/level_0/f_account/tests/unit/c/test-account-ss_append.h deleted file mode 100644 index ca626a4..0000000 --- a/level_0/f_account/tests/unit/c/test-account-ss_append.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Account - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_account_ss_append -#define _TEST__F_account_ss_append - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_accountss_append() - */ -extern void test__f_accountss_append__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_accountss_append() - */ -extern void test__f_accountss_append__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_accountss_append() - */ -extern void test__f_accountss_append__works(void **state); - -#endif // _TEST__F_account_ss_append diff --git a/level_0/f_account/tests/unit/c/test-account-ss_append_all.c b/level_0/f_account/tests/unit/c/test-account-ss_append_all.c deleted file mode 100644 index e4e1cca..0000000 --- a/level_0/f_account/tests/unit/c/test-account-ss_append_all.c +++ /dev/null @@ -1,139 +0,0 @@ -#include "test-account.h" -#include "test-account-ss_append_all.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_accountss_append_all__parameter_checking(void **state) { - - const f_accountss_t data = f_accountss_t_initialize; - - { - const f_status_t status = f_accountss_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_accountss_append_all__returns_data_not(void **state) { - - const int length = 5; - f_accountss_t source = f_accountss_t_initialize; - f_accountss_t destination = f_accountss_t_initialize; - - { - const f_status_t status = f_memory_arrays_resize(length, sizeof(f_accounts_t), (void **) &source.array, &source.used, &source.size, &f_accounts_resize_callback); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_accountss_append_all(source, &destination); - - assert_int_equal(status, F_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); - } - - free((void *) source.array); -} - -void test__f_accountss_append_all__works(void **state) { - - mock_unwrap = 1; - - const int length = 5; - const int length_inner = 2; - f_accountss_t source = f_accountss_t_initialize; - f_accountss_t destination = f_accountss_t_initialize; - - f_string_static_t home_0 = macro_f_string_static_t_initialize_1("home_0", 0, 6); - f_string_static_t label_0 = macro_f_string_static_t_initialize_1("label_0", 0, 7); - f_string_static_t name_0 = macro_f_string_static_t_initialize_1("name_0", 0, 6); - f_string_static_t password_0 = macro_f_string_static_t_initialize_1("password_0", 0, 10); - f_string_static_t shell_0 = macro_f_string_static_t_initialize_1("shell_0", 0, 7); - - f_string_static_t home_1 = macro_f_string_static_t_initialize_1("home_1", 0, 6); - f_string_static_t label_1 = macro_f_string_static_t_initialize_1("label_1", 0, 7); - f_string_static_t name_1 = macro_f_string_static_t_initialize_1("name_1", 0, 6); - f_string_static_t password_1 = macro_f_string_static_t_initialize_1("password_1", 0, 10); - f_string_static_t shell_1 = macro_f_string_static_t_initialize_1("shell_1", 0, 7); - - const f_account_t account_0 = { .home = home_0, .label = label_0, .name = name_0, .password = password_0, .shell = shell_0 }; - const f_account_t account_1 = { .home = home_1, .label = label_1, .name = name_1, .password = password_1, .shell = shell_1 }; - - { - const f_status_t status = f_memory_arrays_resize(length, sizeof(f_accounts_t), (void **) &source.array, &source.used, &source.size, &f_accounts_resize_callback); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - for (; source.used < length; ++source.used) { - - const f_status_t status = f_memory_array_resize(length_inner, sizeof(f_account_t), (void **) &source.array[source.used].array, &source.array[source.used].used, &source.array[source.used].size); - - assert_int_equal(status, F_none); - - memcpy(&source.array[source.used].array[source.array[source.used].used++], (void *) &account_0, sizeof(f_account_t)); - memcpy(&source.array[source.used].array[source.array[source.used].used++], (void *) &account_1, sizeof(f_account_t)); - } // for - } - - { - const f_status_t status = f_accountss_append_all(source, &destination); - - assert_int_equal(status, F_none); - assert_int_equal(destination.used, source.used); - assert_int_equal(destination.size, source.used); - - for (f_number_unsigned_t i = 0; i < destination.used; ++i) { - - assert_int_equal(destination.array[i].used, length_inner); - assert_int_equal(destination.array[i].size, length_inner); - - assert_string_equal(destination.array[i].array[0].home.string, account_0.home.string); - assert_string_equal(destination.array[i].array[0].label.string, account_0.label.string); - assert_string_equal(destination.array[i].array[0].name.string, account_0.name.string); - assert_string_equal(destination.array[i].array[0].password.string, account_0.password.string); - assert_string_equal(destination.array[i].array[0].shell.string, account_0.shell.string); - - assert_string_equal(destination.array[i].array[1].home.string, account_1.home.string); - assert_string_equal(destination.array[i].array[1].label.string, account_1.label.string); - assert_string_equal(destination.array[i].array[1].name.string, account_1.name.string); - assert_string_equal(destination.array[i].array[1].password.string, account_1.password.string); - assert_string_equal(destination.array[i].array[1].shell.string, account_1.shell.string); - } // for - } - - for (f_number_unsigned_t i = 0; i < source.used; ++i) { - free((void *) source.array[i].array); - } // for - - for (f_number_unsigned_t i = 0; i < destination.used; ++i) { - - for (f_number_unsigned_t j = 0; j < destination.array[i].used; ++j) { - - free((void *) destination.array[i].array[j].home.string); - free((void *) destination.array[i].array[j].label.string); - free((void *) destination.array[i].array[j].name.string); - free((void *) destination.array[i].array[j].password.string); - free((void *) destination.array[i].array[j].shell.string); - } - - free((void *) destination.array[i].array); - } // for - - free((void *) source.array); - free((void *) destination.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_account/tests/unit/c/test-account-ss_append_all.h b/level_0/f_account/tests/unit/c/test-account-ss_append_all.h deleted file mode 100644 index 4074adb..0000000 --- a/level_0/f_account/tests/unit/c/test-account-ss_append_all.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Account - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_account_ss_append_all -#define _TEST__F_account_ss_append_all - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_accountss_append_all() - */ -extern void test__f_accountss_append_all__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_accountss_append_all() - */ -extern void test__f_accountss_append_all__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_accountss_append_all() - */ -extern void test__f_accountss_append_all__works(void **state); - -#endif // _TEST__F_account_ss_append_all diff --git a/level_0/f_account/tests/unit/c/test-account-s_resize_callback.c b/level_0/f_account/tests/unit/c/test-account-ss_delete_callback.c similarity index 59% rename from level_0/f_account/tests/unit/c/test-account-s_resize_callback.c rename to level_0/f_account/tests/unit/c/test-account-ss_delete_callback.c index abcd324..2042eda 100644 --- a/level_0/f_account/tests/unit/c/test-account-s_resize_callback.c +++ b/level_0/f_account/tests/unit/c/test-account-ss_delete_callback.c @@ -1,13 +1,14 @@ #include "test-account.h" -#include "test-account-s_resize_callback.h" +#include "test-account-ss_delete_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_accounts_resize_callback__fails(void **state) { +void test__f_accountss_delete_callback__fails(void **state) { mock_unwrap = 0; + mock_unwrap_f_memory = 0; f_account_t data = f_account_t_initialize; f_account_t data_array[] = { data }; @@ -18,7 +19,7 @@ void test__f_accounts_resize_callback__fails(void **state) { will_return(__wrap_f_string_dynamic_resize, true); will_return(__wrap_f_string_dynamic_resize, F_status_set_error(F_failure)); - const f_status_t status = f_accounts_resize_callback(0, 1, (void *) datass_array); + const f_status_t status = f_accountss_delete_callback(0, 1, (void *) datass_array); assert_int_equal(status, F_status_set_error(F_failure)); } @@ -30,7 +31,7 @@ void test__f_accounts_resize_callback__fails(void **state) { will_return(__wrap_f_string_dynamic_resize, true); will_return(__wrap_f_string_dynamic_resize, F_status_set_error(F_failure)); - const f_status_t status = f_accounts_resize_callback(0, 1, (void *) datass_array); + const f_status_t status = f_accountss_delete_callback(0, 1, (void *) datass_array); assert_int_equal(status, F_status_set_error(F_failure)); } @@ -45,7 +46,7 @@ void test__f_accounts_resize_callback__fails(void **state) { will_return(__wrap_f_string_dynamic_resize, true); will_return(__wrap_f_string_dynamic_resize, F_status_set_error(F_failure)); - const f_status_t status = f_accounts_resize_callback(0, 1, (void *) datass_array); + const f_status_t status = f_accountss_delete_callback(0, 1, (void *) datass_array); assert_int_equal(status, F_status_set_error(F_failure)); } @@ -63,7 +64,7 @@ void test__f_accounts_resize_callback__fails(void **state) { will_return(__wrap_f_string_dynamic_resize, true); will_return(__wrap_f_string_dynamic_resize, F_status_set_error(F_failure)); - const f_status_t status = f_accounts_resize_callback(0, 1, (void *) datass_array); + const f_status_t status = f_accountss_delete_callback(0, 1, (void *) datass_array); assert_int_equal(status, F_status_set_error(F_failure)); } @@ -84,21 +85,10 @@ void test__f_accounts_resize_callback__fails(void **state) { will_return(__wrap_f_string_dynamic_resize, true); will_return(__wrap_f_string_dynamic_resize, F_status_set_error(F_failure)); - const f_status_t status = f_accounts_resize_callback(0, 1, (void *) datass_array); + const f_status_t status = f_accountss_delete_callback(0, 1, (void *) datass_array); assert_int_equal(status, F_status_set_error(F_failure)); } -} - -void test__f_accounts_resize_callback__works(void **state) { - - mock_unwrap = 0; - - f_account_t data = f_account_t_initialize; - f_account_t data_array[] = { data }; - f_accounts_t datas = { .array = data_array, .used = 1, .size = 1 }; - f_accounts_t datass_array[] = { datas }; - const f_number_unsigned_t length = 1; { will_return(__wrap_f_string_dynamic_resize, false); @@ -116,10 +106,55 @@ void test__f_accounts_resize_callback__works(void **state) { will_return(__wrap_f_string_dynamic_resize, false); will_return(__wrap_f_string_dynamic_resize, F_none); - const f_status_t status = f_accounts_resize_callback(0, length, (void *) datass_array); + will_return(__wrap_f_memory_array_resize, true); + will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_accountss_delete_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_accountss_delete_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_accountss_t datass = f_accountss_t_initialize; + { + f_status_t status = f_memory_array_resize(length, sizeof(f_accounts_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_none); + + 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_none); + + status = f_string_dynamic_resize(1, &datass.array[0].array[0].home); + assert_int_equal(status, F_none); + + status = f_string_dynamic_resize(1, &datass.array[0].array[0].label); + assert_int_equal(status, F_none); + + status = f_string_dynamic_resize(1, &datass.array[0].array[0].name); + assert_int_equal(status, F_none); + + status = f_string_dynamic_resize(1, &datass.array[0].array[0].password); + assert_int_equal(status, F_none); + + status = f_string_dynamic_resize(1, &datass.array[0].array[0].shell); assert_int_equal(status, F_none); } + + { + const f_status_t status = f_accountss_delete_callback(0, length, (void *) datass.array); + + assert_int_equal(status, F_none); + assert_int_equal(datass.array[0].size, 0); + } + + free((void *) datass.array); } #ifdef __cplusplus diff --git a/level_0/f_account/tests/unit/c/test-account-ss_delete_callback.h b/level_0/f_account/tests/unit/c/test-account-ss_delete_callback.h new file mode 100644 index 0000000..791f6d0 --- /dev/null +++ b/level_0/f_account/tests/unit/c/test-account-ss_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Account + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_account__ss_delete_callback +#define _TEST__F_account__ss_delete_callback + +/** + * Test that the function fails. + * + * @see f_accountss_delete_callback() + */ +extern void test__f_accountss_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_accountss_delete_callback() + */ +extern void test__f_accountss_delete_callback__works(void **state); + +#endif // _TEST__F_account__ss_delete_callback 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 new file mode 100644 index 0000000..1c398a9 --- /dev/null +++ b/level_0/f_account/tests/unit/c/test-account-ss_destroy_callback.c @@ -0,0 +1,162 @@ +#include "test-account.h" +#include "test-account-ss_destroy_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_accountss_destroy_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + f_account_t data = f_account_t_initialize; + f_account_t data_array[] = { data }; + f_accounts_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_accounts_t datass_array[] = { datas }; + + { + will_return(__wrap_f_string_dynamic_adjust, true); + will_return(__wrap_f_string_dynamic_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_accountss_destroy_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamic_adjust, true); + will_return(__wrap_f_string_dynamic_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_accountss_destroy_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamic_adjust, true); + will_return(__wrap_f_string_dynamic_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_accountss_destroy_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamic_adjust, true); + will_return(__wrap_f_string_dynamic_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_accountss_destroy_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamic_adjust, true); + will_return(__wrap_f_string_dynamic_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_accountss_destroy_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_memory_array_adjust, true); + will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_accountss_destroy_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_accountss_destroy_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_accountss_t datass = f_accountss_t_initialize; + + { + f_status_t status = f_memory_array_resize(length, sizeof(f_accounts_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_none); + + 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_none); + + status = f_string_dynamic_resize(1, &datass.array[0].array[0].home); + assert_int_equal(status, F_none); + + status = f_string_dynamic_resize(1, &datass.array[0].array[0].label); + assert_int_equal(status, F_none); + + status = f_string_dynamic_resize(1, &datass.array[0].array[0].name); + assert_int_equal(status, F_none); + + status = f_string_dynamic_resize(1, &datass.array[0].array[0].password); + assert_int_equal(status, F_none); + + status = f_string_dynamic_resize(1, &datass.array[0].array[0].shell); + assert_int_equal(status, F_none); + } + + { + const f_status_t status = f_accountss_destroy_callback(0, length, (void *) datass.array); + + assert_int_equal(status, F_none); + assert_int_equal(datass.array[0].size, 0); + } + + free((void *) datass.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_account/tests/unit/c/test-account-ss_destroy_callback.h b/level_0/f_account/tests/unit/c/test-account-ss_destroy_callback.h new file mode 100644 index 0000000..3728bd8 --- /dev/null +++ b/level_0/f_account/tests/unit/c/test-account-ss_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Account + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_account__ss_destroy_callback +#define _TEST__F_account__ss_destroy_callback + +/** + * Test that the function fails. + * + * @see f_accountss_destroy_callback() + */ +extern void test__f_accountss_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_accountss_destroy_callback() + */ +extern void test__f_accountss_destroy_callback__works(void **state); + +#endif // _TEST__F_account__ss_destroy_callback diff --git a/level_0/f_account/tests/unit/c/test-account.c b/level_0/f_account/tests/unit/c/test-account.c index a6c2512..ed6bb9a 100644 --- a/level_0/f_account/tests/unit/c/test-account.c +++ b/level_0/f_account/tests/unit/c/test-account.c @@ -43,22 +43,17 @@ int main(void) { cmocka_unit_test(test__f_account_name_by_id__not_found), cmocka_unit_test(test__f_account_name_by_id__works), - cmocka_unit_test(test__f_accounts_adjust_callback__fails), - cmocka_unit_test(test__f_accounts_resize_callback__fails), + cmocka_unit_test(test__f_accounts_delete_callback__fails), + cmocka_unit_test(test__f_accounts_destroy_callback__fails), - cmocka_unit_test(test__f_accounts_adjust_callback__works), - cmocka_unit_test(test__f_accounts_resize_callback__works), + cmocka_unit_test(test__f_accounts_delete_callback__works), + cmocka_unit_test(test__f_accounts_destroy_callback__works), - cmocka_unit_test(test__f_accounts_append_all__returns_data_not), + cmocka_unit_test(test__f_accountss_delete_callback__fails), + cmocka_unit_test(test__f_accountss_destroy_callback__fails), - cmocka_unit_test(test__f_accounts_append__works), - cmocka_unit_test(test__f_accounts_append_all__works), - - cmocka_unit_test(test__f_accountss_append__returns_data_not), - cmocka_unit_test(test__f_accountss_append_all__returns_data_not), - - cmocka_unit_test(test__f_accountss_append__works), - cmocka_unit_test(test__f_accountss_append_all__works), + cmocka_unit_test(test__f_accountss_delete_callback__works), + //cmocka_unit_test(test__f_accountss_destroy_callback__works), #ifndef _di_level_0_parameter_checking_ cmocka_unit_test(test__f_account_by_id__parameter_checking), @@ -68,14 +63,11 @@ int main(void) { cmocka_unit_test(test__f_account_id_by_name__parameter_checking), cmocka_unit_test(test__f_account_name_by_id__parameter_checking), - // f_accounts_adjust_callback() doesn't use parameter checking. - // f_accounts_resize_callback() doesn't use parameter checking. - - cmocka_unit_test(test__f_accounts_append__parameter_checking), - cmocka_unit_test(test__f_accounts_append_all__parameter_checking), + // f_accounts_delete_callback() doesn't use parameter checking. + // f_accounts_destroy_callback() doesn't use parameter checking. - cmocka_unit_test(test__f_accountss_append__parameter_checking), - cmocka_unit_test(test__f_accountss_append_all__parameter_checking), + // f_accountss_delete_callback() doesn't use parameter checking. + // f_accountss_destroy_callback() doesn't use parameter checking. #endif // _di_level_0_parameter_checking_ }; diff --git a/level_0/f_account/tests/unit/c/test-account.h b/level_0/f_account/tests/unit/c/test-account.h index d2689c0..e67a137 100644 --- a/level_0/f_account/tests/unit/c/test-account.h +++ b/level_0/f_account/tests/unit/c/test-account.h @@ -32,12 +32,10 @@ #include "test-account-group_name_by_id.h" #include "test-account-id_by_name.h" #include "test-account-name_by_id.h" -#include "test-account-s_adjust_callback.h" -#include "test-account-s_append.h" -#include "test-account-s_append_all.h" -#include "test-account-s_resize_callback.h" -#include "test-account-ss_append.h" -#include "test-account-ss_append_all.h" +#include "test-account-s_destroy_callback.h" +#include "test-account-s_delete_callback.h" +#include "test-account-ss_destroy_callback.h" +#include "test-account-ss_delete_callback.h" #ifdef __cplusplus extern "C" { diff --git a/level_0/f_directory/c/directory.h b/level_0/f_directory/c/directory.h index 49be0c7..3793cdc 100644 --- a/level_0/f_directory/c/directory.h +++ b/level_0/f_directory/c/directory.h @@ -38,7 +38,9 @@ // FLL-0 directory includes. #include -#include +#include +#include +#include #ifdef __cplusplus extern "C" { diff --git a/level_0/f_directory/c/directory/listing.c b/level_0/f_directory/c/directory/listing.c new file mode 100644 index 0000000..f8772e0 --- /dev/null +++ b/level_0/f_directory/c/directory/listing.c @@ -0,0 +1,255 @@ +#include "../directory.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_f_directory_listing_delete_ + f_status_t f_directory_listing_delete(f_directory_listing_t * const listing) { + #ifndef _di_level_0_parameter_checking_ + if (!listing) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + { + f_status_t status = f_string_dynamics_resize(0, &listing->block); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_resize(0, &listing->character); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_resize(0, &listing->directory); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_resize(0, &listing->regular); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_resize(0, &listing->link); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_resize(0, &listing->fifo); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_resize(0, &listing->socket); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_resize(0, &listing->unknown); + if (F_status_is_error(status)) return status; + } + + return F_none; + } +#endif // _di_f_directory_listing_delete_ + +#ifndef _di_f_directory_listing_destroy_ + f_status_t f_directory_listing_destroy(f_directory_listing_t * const listing) { + #ifndef _di_level_0_parameter_checking_ + if (!listing) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + { + f_status_t status = f_string_dynamics_adjust(0, &listing->block); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_adjust(0, &listing->character); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_adjust(0, &listing->directory); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_adjust(0, &listing->regular); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_adjust(0, &listing->link); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_adjust(0, &listing->fifo); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_adjust(0, &listing->socket); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_adjust(0, &listing->unknown); + if (F_status_is_error(status)) return status; + } + + return F_none; + } +#endif // _di_f_directory_listing_destroy_ + +#ifndef _di_f_directory_listings_delete_callback_ + f_status_t f_directory_listings_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { + + { + f_directory_listing_t * const array = (f_directory_listing_t *) void_array; + f_status_t status = F_none; + + for (f_number_unsigned_t i = start; i < stop; ++i) { + + status = f_string_dynamics_resize(0, &array[i].block); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_resize(0, &array[i].character); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_resize(0, &array[i].directory); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_resize(0, &array[i].regular); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_resize(0, &array[i].link); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_resize(0, &array[i].fifo); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_resize(0, &array[i].socket); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_resize(0, &array[i].unknown); + if (F_status_is_error(status)) return status; + } // for + } + + return F_none; + } +#endif // _di_f_directory_listings_delete_callback_ + +#ifndef _di_f_directory_listings_destroy_callback_ + f_status_t f_directory_listings_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { + + { + f_directory_listing_t * const array = (f_directory_listing_t *) void_array; + f_status_t status = F_none; + + for (f_number_unsigned_t i = start; i < stop; ++i) { + + status = f_string_dynamics_adjust(0, &array[i].block); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_adjust(0, &array[i].character); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_adjust(0, &array[i].directory); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_adjust(0, &array[i].regular); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_adjust(0, &array[i].link); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_adjust(0, &array[i].fifo); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_adjust(0, &array[i].socket); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_adjust(0, &array[i].unknown); + if (F_status_is_error(status)) return status; + } // for + } + + return F_none; + } +#endif // _di_f_directory_listings_destroy_callback_ + +#ifndef _di_f_directory_listingss_delete_callback_ + f_status_t f_directory_listingss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { + + { + f_directory_listings_t * const array = (f_directory_listings_t *) void_array; + f_status_t status = F_none; + f_number_unsigned_t j = 0; + + for (f_number_unsigned_t i = start; i < stop; ++i) { + + for (j = 0; j < array[i].size; ++j) { + + status = f_string_dynamics_resize(0, &array[i].array[j].block); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_resize(0, &array[i].array[j].character); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_resize(0, &array[i].array[j].directory); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_resize(0, &array[i].array[j].regular); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_resize(0, &array[i].array[j].link); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_resize(0, &array[i].array[j].fifo); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_resize(0, &array[i].array[j].socket); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_resize(0, &array[i].array[j].unknown); + if (F_status_is_error(status)) return status; + } // for + + if (array[i].size) { + status = f_memory_array_resize(0, sizeof(f_directory_listing_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } + } // for + } + + return F_none; + } +#endif // _di_f_directory_listingss_delete_callback_ + +#ifndef _di_f_directory_listingss_destroy_callback_ + f_status_t f_directory_listingss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { + + { + f_directory_listings_t * const array = (f_directory_listings_t *) void_array; + f_status_t status = F_none; + f_number_unsigned_t j = 0; + + for (f_number_unsigned_t i = start; i < stop; ++i) { + + for (j = 0; j < array[i].size; ++j) { + + status = f_string_dynamics_adjust(0, &array[i].array[j].block); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_adjust(0, &array[i].array[j].character); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_adjust(0, &array[i].array[j].directory); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_adjust(0, &array[i].array[j].regular); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_adjust(0, &array[i].array[j].link); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_adjust(0, &array[i].array[j].fifo); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_adjust(0, &array[i].array[j].socket); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_adjust(0, &array[i].array[j].unknown); + if (F_status_is_error(status)) return status; + } // for + + if (array[i].size) { + status = f_memory_array_adjust(0, sizeof(f_directory_listing_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } + } // for + } + + return F_none; + } +#endif // _di_f_directory_listingss_destroy_callback_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_directory/c/directory/listing.h b/level_0/f_directory/c/directory/listing.h new file mode 100644 index 0000000..e9ffea4 --- /dev/null +++ b/level_0/f_directory/c/directory/listing.h @@ -0,0 +1,246 @@ +/** + * FLL - Level 0 + * + * Project: Directory + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Defines type-specific data to be used for/by project directory. + * + * This is auto-included by directory.h and should not need to be explicitly included. + */ +#ifndef _F_directory_listing_h +#define _F_directory_listing_h + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * A structure representing a listing of paths found within a directory. + * + * Each property represents a set of paths grouped by directory entity file type. + * + * Properties: + * - block: For S_IFBLK. + * - character: For S_IFCHR. + * - directory: For S_IFDIR. + * - regular: For S_IFREG. + * - link: For S_IFLNK. + * - fifo: For S_IFIFO. + * - socket: For S_IFSOCK. + * - unknown: For anything else. + */ +#ifndef _di_f_directory_listing_t_ + typedef struct { + f_string_dynamics_t block; // S_IFBLK + f_string_dynamics_t character; // S_IFCHR + f_string_dynamics_t directory; // S_IFDIR + f_string_dynamics_t regular; // S_IFREG + f_string_dynamics_t link; // S_IFLNK + f_string_dynamics_t fifo; // S_IFIFO + f_string_dynamics_t socket; // S_IFSOCK + f_string_dynamics_t unknown; + } f_directory_listing_t; + + #define f_directory_listing_t_initialize { \ + f_string_dynamics_t_initialize, \ + f_string_dynamics_t_initialize, \ + f_string_dynamics_t_initialize, \ + f_string_dynamics_t_initialize, \ + f_string_dynamics_t_initialize, \ + f_string_dynamics_t_initialize, \ + f_string_dynamics_t_initialize, \ + f_string_dynamics_t_initialize, \ + } + + #define macro_f_directory_listing_t_initialize_1(block, character, directory, regular, link, fifo, socket, unknown) { \ + block, \ + character, \ + directory, \ + regular, \ + link, \ + fifo, \ + socket, \ + unknown, \ + } +#endif // _di_f_directory_listing_t_ + +/** + * An array of directory listing. + * + * Properties: + * - array: An array of directory status. + * - size: Total amount of allocated space. + * - used: Total number of allocated spaces used. + */ +#ifndef _di_f_directory_listings_t_ + typedef struct { + f_directory_listing_t *array; + f_number_unsigned_t size; + f_number_unsigned_t used; + } f_directory_listings_t; + + #define f_directory_listings_t_initialize { 0, 0, 0 } + + #define macro_f_directory_listings_t_initialize_1(content, size, used) { array, size, used } + #define macro_f_directory_listings_t_initialize_2(array, length) { array, length, length } + + #define macro_f_directory_listings_t_clear(structures) macro_f_memory_structures_clear(structures) +#endif // _di_f_directory_listings_t_ + +/** + * Delete all arrays within the listing. + * + * @param listing + * The listing to fully delete. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_string_dynamics_resize(). + * + * @see f_string_dynamics_resize() + */ +#ifndef _di_f_directory_listing_delete_ + extern f_status_t f_directory_listing_delete(f_directory_listing_t * const listing); +#endif // _di_f_directory_listing_delete_ + +/** + * Destroy all arrays within the listing. + * + * @param listing + * The listing to fully destroy. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_string_dynamics_adjust(). + * + * @see f_string_dynamics_adjust() + */ +#ifndef _di_f_directory_listing_destroy_ + extern f_status_t f_directory_listing_destroy(f_directory_listing_t * const listing); +#endif // _di_f_directory_listing_destroy_ + +/** + * A callback intended to be passed to f_memory_arrays_resize() for an f_directory_listings_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. + * + * This does not do parameter checking. + * + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_string_dynamics_resize(). + * + * @see f_string_dynamics_resize() + */ +#ifndef _di_f_directory_listings_delete_callback_ + extern f_status_t f_directory_listings_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_directory_listings_delete_callback_ + +/** + * A callback intended to be passed to f_memory_arrays_adjust() for an f_directory_listings_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. + * + * This does not do parameter checking. + * + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_string_dynamics_adjust(). + * + * @see f_string_dynamics_adjust() + */ +#ifndef _di_f_directory_listings_destroy_callback_ + extern f_status_t f_directory_listings_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_directory_listings_destroy_callback_ + +/** + * A callback intended to be passed to f_memory_arrays_resize() for an f_directory_listingss_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. + * + * This does not do parameter checking. + * + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_string_dynamics_resize(). + * + * @see f_string_dynamics_resize() + */ +#ifndef _di_f_directory_listingss_delete_callback_ + extern f_status_t f_directory_listingss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_directory_listingss_delete_callback_ + +/** + * A callback intended to be passed to f_memory_arrays_adjust() for an f_directory_listingss_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. + * + * This does not do parameter checking. + * + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_string_dynamics_adjust(). + * + * @see f_string_dynamics_adjust() + */ +#ifndef _di_f_directory_listingss_destroy_callback_ + extern f_status_t f_directory_listingss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_directory_listingss_destroy_callback_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _F_directory_listing_h diff --git a/level_0/f_directory/c/directory/private-type.c b/level_0/f_directory/c/directory/private-type.c deleted file mode 100644 index 890c911..0000000 --- a/level_0/f_directory/c/directory/private-type.c +++ /dev/null @@ -1,44 +0,0 @@ -#include "../directory.h" -#include "private-type.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#if !defined(_di_f_directory_statuss_adjust_) || !defined(_di_f_directory_statuss_decimate_by_) - f_status_t private_f_directory_statuss_adjust(const f_number_unsigned_t length, f_directory_statuss_t * const statuss) { - - { - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < statuss->size; ++i) { - - status = f_string_dynamic_adjust(0, &statuss->array[i].path); - if (F_status_is_error(status)) return status; - } // for - } - - return f_memory_array_adjust(length, sizeof(f_directory_status_t), (void **) &statuss->array, &statuss->used, &statuss->size); - } -#endif // !defined(_di_f_directory_statuss_adjust_) || !defined(_di_f_directory_statuss_decimate_by_) - -#if !defined(_di_f_directory_statuss_decrease_by_) || !defined(_di_f_directory_statuss_resize_) - f_status_t private_f_directory_statuss_resize(const f_number_unsigned_t length, f_directory_statuss_t * const statuss) { - - { - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < statuss->size; ++i) { - - status = f_string_dynamic_resize(0, &statuss->array[i].path); - if (F_status_is_error(status)) return status; - } // for - } - - return f_memory_array_resize(length, sizeof(f_directory_status_t), (void **) &statuss->array, &statuss->used, &statuss->size); - } -#endif // !defined(_di_f_directory_statuss_decrease_by_) || !defined(_di_f_directory_statuss_resize_) - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_directory/c/directory/private-type.h b/level_0/f_directory/c/directory/private-type.h deleted file mode 100644 index 251c379..0000000 --- a/level_0/f_directory/c/directory/private-type.h +++ /dev/null @@ -1,78 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Directory - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * These are provided for internal reduction in redundant code. - * These should not be exposed/used outside of this project. - */ -#ifndef _PRIVATE_F_directory_type_h -#define _PRIVATE_F_directory_type_h - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Private implementation for resizing. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The new size to use. - * @param statuss - * The statuss to adjust. - * - * @return - * Success from f_memory_array_adjust(). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_adjust(). - * Errors (with error bit) from: f_string_dynamic_adjust(). - * - * @see f_memory_array_adjust() - * @see f_string_dynamic_adjust() - * - * @see f_directory_statuss_adjust() - * @see f_directory_statuss_decimate_by() - */ -#if !defined(_di_f_directory_statuss_adjust_) || !defined(_di_f_directory_statuss_decimate_by_) - extern f_status_t private_f_directory_statuss_adjust(const f_number_unsigned_t length, f_directory_statuss_t * const statuss) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_directory_statuss_adjust_) || !defined(_di_f_directory_statuss_decimate_by_) - -/** - * Private implementation for resizing. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The new size to use. - * @param statuss - * The statuss to resize. - * - * @return - * Success from f_memory_array_resize(). - * - * 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_directory_statuss_resize() - * @see f_directory_statuss_decimate_by() - */ -#if !defined(_di_f_directory_statuss_decrease_by_) || !defined(_di_f_directory_statuss_resize_) - extern f_status_t private_f_directory_statuss_resize(const f_number_unsigned_t length, f_directory_statuss_t * const statuss) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_directory_statuss_decrease_by_) || !defined(_di_f_directory_statuss_resize_) - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_F_directory_type_h diff --git a/level_0/f_directory/c/directory/recurse_do.c b/level_0/f_directory/c/directory/recurse_do.c new file mode 100644 index 0000000..066bc7f --- /dev/null +++ b/level_0/f_directory/c/directory/recurse_do.c @@ -0,0 +1,317 @@ +#include "../directory.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_f_directory_recurse_do_delete_ + f_status_t f_directory_recurse_do_delete(f_directory_recurse_do_t * const recurse) { + #ifndef _di_level_0_parameter_checking_ + if (!recurse) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + { + f_status_t status = f_string_dynamic_resize(0, &recurse->path); + if (F_status_is_error(status)) return status; + + status = f_string_dynamic_resize(0, &recurse->path_cache); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_resize(0, &recurse->listing.block); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_resize(0, &recurse->listing.character); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_resize(0, &recurse->listing.directory); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_resize(0, &recurse->listing.regular); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_resize(0, &recurse->listing.link); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_resize(0, &recurse->listing.fifo); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_resize(0, &recurse->listing.socket); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_resize(0, &recurse->listing.unknown); + if (F_status_is_error(status)) return status; + } + + return F_none; + } +#endif // _di_f_directory_recurse_do_delete_ + +#ifndef _di_f_directory_recurse_do_destroy_ + f_status_t f_directory_recurse_do_destroy(f_directory_recurse_do_t * const recurse) { + #ifndef _di_level_0_parameter_checking_ + if (!recurse) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + recurse->depth = 0; + recurse->depth_max = 0; + recurse->flag = 0; + recurse->path_top = 0; + + macro_f_state_t_clear(recurse->state); + memset((void *) &recurse->mode, 0, sizeof(f_mode_t)); + + { + f_status_t status = f_string_dynamic_adjust(0, &recurse->path); + if (F_status_is_error(status)) return status; + + status = f_string_dynamic_adjust(0, &recurse->path_cache); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_adjust(0, &recurse->listing.block); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_adjust(0, &recurse->listing.character); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_adjust(0, &recurse->listing.directory); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_adjust(0, &recurse->listing.regular); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_adjust(0, &recurse->listing.link); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_adjust(0, &recurse->listing.fifo); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_adjust(0, &recurse->listing.socket); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_adjust(0, &recurse->listing.unknown); + if (F_status_is_error(status)) return status; + } + + return F_none; + } +#endif // _di_f_directory_recurse_do_destroy_ + +#ifndef _di_f_directory_recurse_dos_delete_callback_ + f_status_t f_directory_recurse_dos_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { + + { + f_directory_recurse_do_t * const array = (f_directory_recurse_do_t *) void_array; + f_status_t status = F_none; + + for (f_number_unsigned_t i = start; i < stop; ++i) { + + status = f_string_dynamic_resize(0, &array[i].path); + if (F_status_is_error(status)) return status; + + status = f_string_dynamic_resize(0, &array[i].path_cache); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_resize(0, &array[i].listing.block); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_resize(0, &array[i].listing.character); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_resize(0, &array[i].listing.directory); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_resize(0, &array[i].listing.regular); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_resize(0, &array[i].listing.link); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_resize(0, &array[i].listing.fifo); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_resize(0, &array[i].listing.socket); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_resize(0, &array[i].listing.unknown); + if (F_status_is_error(status)) return status; + } // for + } + + return F_none; + } +#endif // _di_f_directory_recurse_dos_delete_callback_ + +#ifndef _di_f_directory_recurse_dos_destroy_callback_ + f_status_t f_directory_recurse_dos_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { + + { + f_directory_recurse_do_t * const array = (f_directory_recurse_do_t *) void_array; + f_status_t status = F_none; + + for (f_number_unsigned_t i = start; i < stop; ++i) { + + array[i].depth = 0; + array[i].depth_max = 0; + array[i].flag = 0; + array[i].path_top = 0; + + macro_f_state_t_clear(array[i].state); + + memset((void *) &array[i].mode, 0, sizeof(f_mode_t)); + + status = f_string_dynamic_adjust(0, &array[i].path); + if (F_status_is_error(status)) return status; + + status = f_string_dynamic_adjust(0, &array[i].path_cache); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_adjust(0, &array[i].listing.block); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_adjust(0, &array[i].listing.character); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_adjust(0, &array[i].listing.directory); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_adjust(0, &array[i].listing.regular); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_adjust(0, &array[i].listing.link); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_adjust(0, &array[i].listing.fifo); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_adjust(0, &array[i].listing.socket); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_adjust(0, &array[i].listing.unknown); + if (F_status_is_error(status)) return status; + } // for + } + + return F_none; + } +#endif // _di_f_directory_recurse_dos_destroy_callback_ + +#ifndef _di_f_directory_recurse_doss_delete_callback_ + f_status_t f_directory_recurse_doss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { + + { + f_directory_recurse_dos_t * const array = (f_directory_recurse_dos_t *) void_array; + f_status_t status = F_none; + f_number_unsigned_t j = 0; + + for (f_number_unsigned_t i = start; i < stop; ++i) { + + for (j = 0; j < array[i].size; ++j) { + + status = f_string_dynamic_resize(0, &array[i].array[j].path); + if (F_status_is_error(status)) return status; + + status = f_string_dynamic_resize(0, &array[i].array[j].path_cache); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_resize(0, &array[i].array[j].listing.block); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_resize(0, &array[i].array[j].listing.character); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_resize(0, &array[i].array[j].listing.directory); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_resize(0, &array[i].array[j].listing.regular); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_resize(0, &array[i].array[j].listing.link); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_resize(0, &array[i].array[j].listing.fifo); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_resize(0, &array[i].array[j].listing.socket); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_resize(0, &array[i].array[j].listing.unknown); + if (F_status_is_error(status)) return status; + } // for + + if (array[i].size) { + status = f_memory_array_resize(0, sizeof(f_directory_recurse_do_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } + } // for + } + + return F_none; + } +#endif // _di_f_directory_recurse_doss_delete_callback_ + +#ifndef _di_f_directory_recurse_doss_destroy_callback_ + f_status_t f_directory_recurse_doss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { + + { + f_directory_recurse_dos_t * const array = (f_directory_recurse_dos_t *) void_array; + f_status_t status = F_none; + f_number_unsigned_t j = 0; + + for (f_number_unsigned_t i = start; i < stop; ++i) { + + for (j = 0; j < array[i].size; ++j) { + + array[i].array[j].depth = 0; + array[i].array[j].depth_max = 0; + array[i].array[j].flag = 0; + array[i].array[j].path_top = 0; + + macro_f_state_t_clear(array[i].array[j].state); + + memset((void *) &array[i].array[j].mode, 0, sizeof(f_mode_t)); + + status = f_string_dynamic_adjust(0, &array[i].array[j].path); + if (F_status_is_error(status)) return status; + + status = f_string_dynamic_adjust(0, &array[i].array[j].path_cache); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_adjust(0, &array[i].array[j].listing.block); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_adjust(0, &array[i].array[j].listing.character); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_adjust(0, &array[i].array[j].listing.directory); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_adjust(0, &array[i].array[j].listing.regular); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_adjust(0, &array[i].array[j].listing.link); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_adjust(0, &array[i].array[j].listing.fifo); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_adjust(0, &array[i].array[j].listing.socket); + if (F_status_is_error(status)) return status; + + status = f_string_dynamics_adjust(0, &array[i].array[j].listing.unknown); + if (F_status_is_error(status)) return status; + } // for + + if (array[i].size) { + status = f_memory_array_adjust(0, sizeof(f_directory_recurse_do_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } + } // for + } + + return F_none; + } +#endif // _di_f_directory_recurse_doss_destroy_callback_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_directory/c/directory/recurse_do.h b/level_0/f_directory/c/directory/recurse_do.h new file mode 100644 index 0000000..c6e98d9 --- /dev/null +++ b/level_0/f_directory/c/directory/recurse_do.h @@ -0,0 +1,309 @@ +/** + * FLL - Level 0 + * + * Project: Directory + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Defines type-specific data to be used for/by project directory. + * + * This is auto-included by directory.h and should not need to be explicitly included. + */ +#ifndef _F_directory_recurse_do_h +#define _F_directory_recurse_do_h + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * A structure containing directory recursion information. + * + * The action() callback provide full access to this f_directory_recurse_do_t structure. + * The action callback may set any of the following on the state.status to have the following effects: + * - Any status (with error bit set): Immediately return as error. + * - F_break: Break out of the current loop. + * - F_continue: Skip to the next iteration in the current loop. + * - F_done: Immedately return as success but do nothing else in this recursion. + * + * The action parameters are: + * - recurse: Must be of type f_directory_recurse_do_t and represents this data. Must not be NULL. + * - name: The name of the file or directory the action is being performed on (does not have the parent directory path) (may be empty at the top level). + * - flag: A flag representing the particular action being performed. + * + * The handle() callback provides a callback identical to the handle() except that it is for handling exceptions in place of state.handle(). + * The handle() provides additional information not provided by state.handle() but if it is NULL, then state.handle() is called. + * The state.handle() and state.interrupt() callbacks internal parameter must be of type f_directory_recurse_do_t. + * + * The callbacks must take care to properly modify the structure or they could cause security, integrity, or functionality problems. + * + * Properties: + * - depth: A number representing the depth recursed thus far (generally assigned internally). + * - depth_max: The maximum recursion depth to use. + * - flag: A set of flags used exclusively by the directory recurse process (not to be confused with state.flag). + * - mode: A file mode flag to use when working on files, such as when copying a file. + * + * - state: A pointer to the state information, where state.interrupt() and state.handle() are called appopriately. + * - listing: A directory listing structure used internally to help reduce repeated memory allocation overhead. + * + * - path: A path representing the current directory path being operated on and usually represents the parent path of some file or directory (generally assigned internally). + * - path_cache: A path-related cache made available for the caller to use, such as combining the path and the file name in the action callback. + * - path_top: A pointer to the top path string, used for error handling and printing (generally assigned internally). + * + * - action: A callback used for performing some action (this is required to do anything). + * - handle: A callback used for performing error handling during recursion directly relating to a file. + * + * The macro_f_directory_recurse_do_t_initialize_1() all arguments. + * The macro_f_directory_recurse_do_t_initialize_2() all arguments except for internally managed source, destination, mode, and depth. + */ +#ifndef _di_f_directory_recurse_do_t_ + typedef struct { + f_number_unsigned_t depth; + f_number_unsigned_t depth_max; + uint16_t flag; + f_mode_t mode; + + f_state_t state; + f_directory_listing_t listing; + + f_string_dynamic_t path; + f_string_dynamic_t path_cache; + const f_string_static_t *path_top; + + void (*action)(void * const recurse, const f_string_static_t name, const uint16_t flag); + void (*handle)(void * const recurse, const f_string_static_t name, const uint16_t flag); + } f_directory_recurse_do_t; + + #define f_directory_recurse_do_t_initialize { \ + 0, \ + F_directory_max_recurse_depth_d, \ + f_directory_recurse_do_flag_none_e, \ + f_mode_t_initialize, \ + f_state_t_initialize, \ + f_directory_listing_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + 0, \ + 0, \ + 0, \ + } + + #define macro_f_directory_recurse_do_t_initialize_1(depth, depth_max, flag, mode, state, listing, path, path_cache, path_top, action, handle) { \ + depth, \ + depth_max, \ + flag, \ + mode, \ + state, \ + listing, \ + path, \ + path_cache, \ + path_top, \ + action, \ + handle, \ + } + + #define macro_f_directory_recurse_do_t_initialize_2(depth, depth_max, flag, mode, state, action, handle) { \ + depth,\ + depth_max \ + flag, \ + mode, \ + state, \ + f_directory_listing_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ + 0, \ + action, \ + handle, \ + } +#endif // _di_f_directory_recurse_do_t_ + +/** + * An array of directory recurse. + * + * Properties: + * - array: An array of directory status. + * - size: Total amount of allocated space. + * - used: Total number of allocated spaces used. + */ +#ifndef _di_f_directory_recurse_dos_t_ + typedef struct { + f_directory_recurse_do_t *array; + f_number_unsigned_t size; + f_number_unsigned_t used; + } f_directory_recurse_dos_t; + + #define f_directory_recurse_dos_t_initialize { 0, 0, 0 } + + #define macro_f_directory_recurse_dos_t_initialize_1(content, size, used) { array, size, used } + #define macro_f_directory_recurse_dos_t_initialize_2(array, length) { array, length, length } + + #define macro_f_directory_recurse_dos_t_clear(structures) macro_f_memory_structures_clear(structures) +#endif // _di_f_directory_recurse_dos_t_ + +/** + * Delete all non-pointer based dynamic arrays within the recurse. + * + * @param recurse + * The recurse to fully delete. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_string_dynamic_resize(). + * Errors (with error bit) from: f_string_dynamics_resize(). + * + * @see f_string_dynamic_resize() + * @see f_string_dynamics_resize() + */ +#ifndef _di_f_directory_recurse_do_delete_ + extern f_status_t f_directory_recurse_do_delete(f_directory_recurse_do_t * const recurse); +#endif // _di_f_directory_recurse_do_delete_ + +/** + * Destroy all non-pointer based dynamic arrays within the recurse. + * + * @param recurse + * The recurse to fully destroy. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_string_dynamic_adjust(). + * Errors (with error bit) from: f_string_dynamics_adjust(). + * + * @see f_string_dynamic_adjust() + * @see f_string_dynamics_adjust() + */ +#ifndef _di_f_directory_recurse_do_destroy_ + extern f_status_t f_directory_recurse_do_destroy(f_directory_recurse_do_t * const recurse); +#endif // _di_f_directory_recurse_do_destroy_ + +/** + * A callback intended to be passed to f_memory_arrays_resize() for an f_directory_recurse_dos_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. + * + * This does not do parameter checking. + * + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_string_dynamic_resize(). + * Errors (with error bit) from: f_string_dynamics_resize(). + * + * @see f_string_dynamic_resize() + * @see f_string_dynamics_resize() + */ +#ifndef _di_f_directory_recurse_dos_delete_callback_ + extern f_status_t f_directory_recurse_dos_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_directory_recurse_dos_delete_callback_ + +/** + * A callback intended to be passed to f_memory_arrays_adjust() for an f_directory_recurse_dos_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. + * + * This does not do parameter checking. + * + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_string_dynamic_adjust(). + * Errors (with error bit) from: f_string_dynamics_adjust(). + * + * @see f_string_dynamic_adjust() + * @see f_string_dynamics_adjust() + */ +#ifndef _di_f_directory_recurse_dos_destroy_callback_ + extern f_status_t f_directory_recurse_dos_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_directory_recurse_dos_destroy_callback_ + +/** + * A callback intended to be passed to f_memory_arrays_resize() for an f_directory_recurse_doss_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. + * + * This does not do parameter checking. + * + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_string_dynamic_resize(). + * Errors (with error bit) from: f_string_dynamics_resize(). + * + * @see f_string_dynamic_resize() + * @see f_string_dynamics_resize() + */ +#ifndef _di_f_directory_recurse_doss_delete_callback_ + extern f_status_t f_directory_recurse_doss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_directory_recurse_doss_delete_callback_ + +/** + * A callback intended to be passed to f_memory_arrays_adjust() for an f_directory_recurse_doss_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. + * + * This does not do parameter checking. + * + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_string_dynamic_adjust(). + * Errors (with error bit) from: f_string_dynamics_adjust(). + * + * @see f_string_dynamic_adjust() + * @see f_string_dynamics_adjust() + */ +#ifndef _di_f_directory_recurse_doss_destroy_callback_ + extern f_status_t f_directory_recurse_doss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_directory_recurse_doss_destroy_callback_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _F_directory_recurse_do_h diff --git a/level_0/f_directory/c/directory/status.c b/level_0/f_directory/c/directory/status.c new file mode 100644 index 0000000..5538fe5 --- /dev/null +++ b/level_0/f_directory/c/directory/status.c @@ -0,0 +1,135 @@ +#include "../directory.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_f_directory_status_delete_ + f_status_t f_directory_status_delete(f_directory_status_t * const directory_status) { + #ifndef _di_level_0_parameter_checking_ + if (!directory_status) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + { + const f_status_t status = f_string_dynamic_resize(0, &directory_status->path); + if (F_status_is_error(status)) return status; + } + + return F_none; + } +#endif // _di_f_directory_status_delete_ + +#ifndef _di_f_directory_status_destroy_ + f_status_t f_directory_status_destroy(f_directory_status_t * const directory_status) { + #ifndef _di_level_0_parameter_checking_ + if (!directory_status) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + directory_status->status = 0; + + { + const f_status_t status = f_string_dynamic_adjust(0, &directory_status->path); + if (F_status_is_error(status)) return status; + } + + return F_none; + } +#endif // _di_f_directory_status_destroy_ + +#ifndef _di_f_directory_statuss_delete_callback_ + f_status_t f_directory_statuss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { + + { + f_directory_status_t * const array = (f_directory_status_t *) void_array; + f_status_t status = F_none; + + for (f_number_unsigned_t i = start; i < stop; ++i) { + + status = f_string_dynamic_resize(0, &array[i].path); + if (F_status_is_error(status)) return status; + } // for + } + + return F_none; + } +#endif // _di_f_directory_statuss_delete_callback_ + +#ifndef _di_f_directory_statuss_destroy_callback_ + f_status_t f_directory_statuss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { + + { + f_directory_status_t * const array = (f_directory_status_t *) void_array; + f_status_t status = F_none; + + for (f_number_unsigned_t i = start; i < stop; ++i) { + + array[i].status = F_none; + + status = f_string_dynamic_adjust(0, &array[i].path); + if (F_status_is_error(status)) return status; + } // for + } + + return F_none; + } +#endif // _di_f_directory_statuss_destroy_callback_ + +#ifndef _di_f_directory_statusss_delete_callback_ + f_status_t f_directory_statusss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { + + { + f_directory_statuss_t * const array = (f_directory_statuss_t *) void_array; + f_status_t status = F_none; + f_number_unsigned_t j = 0; + + for (f_number_unsigned_t i = start; i < stop; ++i) { + + for (j = 0; j < array[i].size; ++j) { + + status = f_string_dynamic_resize(0, &array[i].array[j].path); + if (F_status_is_error(status)) return status; + } // for + + if (array[i].size) { + status = f_memory_array_resize(0, sizeof(f_directory_status_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } + } // for + } + + return F_none; + } +#endif // _di_f_directory_statusss_delete_callback_ + +#ifndef _di_f_directory_statusss_destroy_callback_ + f_status_t f_directory_statusss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { + + { + f_directory_statuss_t * const array = (f_directory_statuss_t *) void_array; + f_status_t status = F_none; + f_number_unsigned_t j = 0; + + for (f_number_unsigned_t i = start; i < stop; ++i) { + + for (j = 0; j < array[i].size; ++j) { + + array[i].array[j].status = F_none; + + status = f_string_dynamic_adjust(0, &array[i].array[j].path); + if (F_status_is_error(status)) return status; + } // for + + if (array[i].size) { + status = f_memory_array_adjust(0, sizeof(f_directory_status_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } + } // for + } + + return F_none; + } +#endif // _di_f_directory_statusss_destroy_callback_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_directory/c/directory/status.h b/level_0/f_directory/c/directory/status.h new file mode 100644 index 0000000..18e55ff --- /dev/null +++ b/level_0/f_directory/c/directory/status.h @@ -0,0 +1,183 @@ +/** + * FLL - Level 0 + * + * Project: Directory + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Defines type-specific data to be used for/by project directory. + * + * This is auto-included by directory.h and should not need to be explicitly included. + */ +#ifndef _F_directory_status_h +#define _F_directory_status_h + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * An association of a path and a status code. + * + * The allocation macros apply to the path. + * + * Properties: + * - step: The allocation step. + * - status: The status code. + * - path: The dynamically allocated path associated with the status code. + */ +#ifndef _di_f_directory_status_t_ + typedef struct { + f_status_t status; + f_string_dynamic_t path; + } f_directory_status_t; + + #define f_directory_status_t_initialize { 0, f_string_dynamic_t_initialize } + + #define macro_f_directory_status_t_initialize_1(status, path) { status, path } + + #define macro_f_directory_status_t_clear(directory) \ + directory.status = 0; \ + macro_f_string_dynamic_t_clear(directory.path); +#endif // _di_f_directory_status_t_ + +/** + * An array of directory status. + * + * Properties: + * - array: An array of directory status. + * - size: Total amount of allocated space. + * - used: Total number of allocated spaces used. + */ +#ifndef _di_f_directory_statuss_t_ + typedef struct { + f_directory_status_t *array; + f_number_unsigned_t size; + f_number_unsigned_t used; + } f_directory_statuss_t; + + #define f_directory_statuss_t_initialize { 0, 0, 0 } + + #define macro_f_directory_statuss_t_initialize_1(content, size, used) { array, size, used } + #define macro_f_directory_statuss_t_initialize_2(array, length) { array, length, length } + + #define macro_f_directory_statuss_t_clear(structures) macro_f_memory_structures_clear(structures) +#endif // _di_f_directory_statuss_t_ + +/** + * A callback intended to be passed to f_memory_arrays_resize() for an f_directory_statuss_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. + * + * This does not do parameter checking. + * + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_string_dynamic_resize(). + * + * @see f_string_dynamic_resize() + */ +#ifndef _di_f_directory_statuss_delete_callback_ + extern f_status_t f_directory_statuss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_directory_statuss_delete_callback_ + +/** + * A callback intended to be passed to f_memory_arrays_adjust() for an f_directory_statuss_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. + * + * This does not do parameter checking. + * + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_string_dynamic_adjust(). + * + * @see f_string_dynamic_adjust() + */ +#ifndef _di_f_directory_statuss_destroy_callback_ + extern f_status_t f_directory_statuss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_directory_statuss_destroy_callback_ + +/** + * A callback intended to be passed to f_memory_arrays_resize() for an f_directory_statusss_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. + * + * This does not do parameter checking. + * + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_string_dynamic_resize(). + * + * @see f_string_dynamic_resize() + */ +#ifndef _di_f_directory_statusss_delete_callback_ + extern f_status_t f_directory_statusss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_directory_statusss_delete_callback_ + +/** + * A callback intended to be passed to f_memory_arrays_adjust() for an f_directory_statusss_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. + * + * This does not do parameter checking. + * + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_string_dynamic_adjust(). + * + * @see f_string_dynamic_adjust() + */ +#ifndef _di_f_directory_statusss_destroy_callback_ + extern f_status_t f_directory_statusss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_directory_statusss_destroy_callback_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _F_directory_status_h diff --git a/level_0/f_directory/c/directory/type.c b/level_0/f_directory/c/directory/type.c deleted file mode 100644 index f3c7e68..0000000 --- a/level_0/f_directory/c/directory/type.c +++ /dev/null @@ -1,142 +0,0 @@ -#include "../directory.h" -#include "private-type.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _di_f_directory_listing_delete_ - f_status_t f_directory_listing_delete(f_directory_listing_t * const listing) { - #ifndef _di_level_0_parameter_checking_ - if (!listing) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - f_string_dynamics_resize(0, &listing->block); - f_string_dynamics_resize(0, &listing->character); - f_string_dynamics_resize(0, &listing->directory); - f_string_dynamics_resize(0, &listing->regular); - f_string_dynamics_resize(0, &listing->link); - f_string_dynamics_resize(0, &listing->fifo); - f_string_dynamics_resize(0, &listing->socket); - f_string_dynamics_resize(0, &listing->unknown); - - return F_none; - } -#endif // _di_f_directory_listing_delete_ - -#ifndef _di_f_directory_listing_destroy_ - f_status_t f_directory_listing_destroy(f_directory_listing_t * const listing) { - #ifndef _di_level_0_parameter_checking_ - if (!listing) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - f_string_dynamics_adjust(0, &listing->block); - f_string_dynamics_adjust(0, &listing->character); - f_string_dynamics_adjust(0, &listing->directory); - f_string_dynamics_adjust(0, &listing->regular); - f_string_dynamics_adjust(0, &listing->link); - f_string_dynamics_adjust(0, &listing->fifo); - f_string_dynamics_adjust(0, &listing->socket); - f_string_dynamics_adjust(0, &listing->unknown); - - return F_none; - } -#endif // _di_f_directory_listing_destroy_ - -#ifndef _di_f_directory_recurse_do_delete_ - f_status_t f_directory_recurse_do_delete(f_directory_recurse_do_t * const recurse) { - #ifndef _di_level_0_parameter_checking_ - if (!recurse) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - f_directory_listing_delete(&recurse->listing); - - f_string_dynamic_resize(0, &recurse->path); - f_string_dynamic_resize(0, &recurse->path_cache); - - return F_none; - } -#endif // _di_f_directory_recurse_do_delete_ - -#ifndef _di_f_directory_recurse_do_destroy_ - f_status_t f_directory_recurse_do_destroy(f_directory_recurse_do_t * const recurse) { - #ifndef _di_level_0_parameter_checking_ - if (!recurse) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - f_directory_listing_destroy(&recurse->listing); - - f_string_dynamic_adjust(0, &recurse->path); - f_string_dynamic_adjust(0, &recurse->path_cache); - - return F_none; - } -#endif // _di_f_directory_recurse_do_destroy_ - -#ifndef _di_f_directory_statuss_adjust_ - f_status_t f_directory_statuss_adjust(const f_number_unsigned_t length, f_directory_statuss_t * const statuss) { - #ifndef _di_level_0_parameter_checking_ - if (!statuss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_directory_statuss_adjust(length, statuss); - } -#endif // _di_f_directory_statuss_adjust_ - -#ifndef _di_f_directory_statuss_decimate_by_ - f_status_t f_directory_statuss_decimate_by(const f_number_unsigned_t amount, f_directory_statuss_t * const statuss) { - #ifndef _di_level_0_parameter_checking_ - if (!statuss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!amount) return F_data_not; - - return private_f_directory_statuss_adjust((statuss->size - amount > 0) ? statuss->size - amount : 0, statuss); - } -#endif // _di_f_directory_statuss_decimate_by_ - -#ifndef _di_f_directory_statuss_decrease_by_ - f_status_t f_directory_statuss_decrease_by(const f_number_unsigned_t amount, f_directory_statuss_t * const statuss) { - #ifndef _di_level_0_parameter_checking_ - if (!statuss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!amount) return F_data_not; - - return private_f_directory_statuss_resize((statuss->size - amount > 0) ? statuss->size - amount : 0, statuss); - } -#endif // _di_f_directory_statuss_decrease_by_ - -#ifndef _di_f_directory_statuss_increase_ - f_status_t f_directory_statuss_increase(const f_number_unsigned_t step, f_directory_statuss_t * const statuss) { - #ifndef _di_level_0_parameter_checking_ - if (!statuss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_increase(step, sizeof(f_directory_status_t), (void **) &statuss->array, &statuss->used, &statuss->size); - } -#endif // _di_f_directory_statuss_increase_ - -#ifndef _di_f_directory_statuss_increase_by_ - f_status_t f_directory_statuss_increase_by(const f_number_unsigned_t amount, f_directory_statuss_t * const statuss) { - #ifndef _di_level_0_parameter_checking_ - if (!statuss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_increase_by(amount, sizeof(f_directory_status_t), (void **) &statuss->array, &statuss->used, &statuss->size); - } -#endif // _di_f_directory_statuss_increase_by_ - -#ifndef _di_f_directory_statuss_resize_ - f_status_t f_directory_statuss_resize(const f_number_unsigned_t length, f_directory_statuss_t * const statuss) { - #ifndef _di_level_0_parameter_checking_ - if (!statuss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_directory_statuss_resize(length, statuss); - } -#endif // _di_f_directory_statuss_resize_ - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_directory/c/directory/type.h b/level_0/f_directory/c/directory/type.h deleted file mode 100644 index bab9b52..0000000 --- a/level_0/f_directory/c/directory/type.h +++ /dev/null @@ -1,452 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Directory - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Defines type-specific data to be used for/by project directory. - * - * This is auto-included by directory.h and should not need to be explicitly included. - */ -#ifndef _F_directory_type_h -#define _F_directory_type_h - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * A structure representing a listing of paths found within a directory. - * - * Each property represents a set of paths grouped by directory entity file type. - * - * Properties: - * - block: For S_IFBLK. - * - character: For S_IFCHR. - * - directory: For S_IFDIR. - * - regular: For S_IFREG. - * - link: For S_IFLNK. - * - fifo: For S_IFIFO. - * - socket: For S_IFSOCK. - * - unknown: For anything else. - */ -#ifndef _di_f_directory_listing_t_ - typedef struct { - f_string_dynamics_t block; // S_IFBLK - f_string_dynamics_t character; // S_IFCHR - f_string_dynamics_t directory; // S_IFDIR - f_string_dynamics_t regular; // S_IFREG - f_string_dynamics_t link; // S_IFLNK - f_string_dynamics_t fifo; // S_IFIFO - f_string_dynamics_t socket; // S_IFSOCK - f_string_dynamics_t unknown; - } f_directory_listing_t; - - #define f_directory_listing_t_initialize { \ - f_string_dynamics_t_initialize, \ - f_string_dynamics_t_initialize, \ - f_string_dynamics_t_initialize, \ - f_string_dynamics_t_initialize, \ - f_string_dynamics_t_initialize, \ - f_string_dynamics_t_initialize, \ - f_string_dynamics_t_initialize, \ - f_string_dynamics_t_initialize, \ - } - - #define macro_f_directory_listing_t_initialize_1(block, character, directory, regular, link, fifo, socket, unknown) { \ - block, \ - character, \ - directory, \ - regular, \ - link, \ - fifo, \ - socket, \ - unknown, \ - } -#endif // _di_f_directory_listing_t_ - -/** - * An association of a path and a status code. - * - * The allocation macros apply to the path. - * - * Properties: - * - step: The allocation step. - * - status: The status code. - * - path: The dynamically allocated path associated with the status code. - */ -#ifndef _di_f_directory_status_t_ - typedef struct { - f_status_t status; - f_string_dynamic_t path; - } f_directory_status_t; - - #define f_directory_status_t_initialize { 0, f_string_dynamic_t_initialize } - - #define macro_f_directory_status_t_initialize_1(status, path) { status, path } - - #define macro_f_directory_status_t_clear(directory) \ - directory.status = 0; \ - macro_f_string_dynamic_t_clear(directory.path); -#endif // _di_f_directory_status_t_ - -/** - * An array of directory status. - * - * Properties: - * - array: An array of directory status. - * - size: Total amount of allocated space. - * - used: Total number of allocated spaces used. - */ -#ifndef _di_f_directory_statuss_t_ - typedef struct { - f_directory_status_t *array; - f_number_unsigned_t size; - f_number_unsigned_t used; - } f_directory_statuss_t; - - #define f_directory_statuss_t_initialize { 0, 0, 0 } - - #define macro_f_directory_statuss_t_initialize_1(content, size, used) { array, size, used } - #define macro_f_directory_statuss_t_initialize_2(array, length) { array, length, length } - - #define macro_f_directory_statuss_t_clear(structures) macro_f_memory_structures_clear(structures) -#endif // _di_f_directory_statuss_t_ - -/** - * A structure containing directory recursion information. - * - * The action() callback provide full access to this f_directory_recurse_do_t structure. - * The action callback may set any of the following on the state.status to have the following effects: - * - Any status (with error bit set): Immediately return as error. - * - F_break: Break out of the current loop. - * - F_continue: Skip to the next iteration in the current loop. - * - F_done: Immedately return as success but do nothing else in this recursion. - * - * The action parameters are: - * - recurse: Must be of type f_directory_recurse_do_t and represents this data. Must not be NULL. - * - name: The name of the file or directory the action is being performed on (does not have the parent directory path) (may be empty at the top level). - * - flag: A flag representing the particular action being performed. - * - * The handle() callback provides a callback identical to the handle() except that it is for handling exceptions in place of state.handle(). - * The handle() provides additional information not provided by state.handle() but if it is NULL, then state.handle() is called. - * The state.handle() and state.interrupt() callbacks internal parameter must be of type f_directory_recurse_do_t. - * - * The callbacks must take care to properly modify the structure or they could cause security, integrity, or functionality problems. - * - * Properties: - * - depth: A number representing the depth recursed thus far (generally assigned internally). - * - depth_max: The maximum recursion depth to use. - * - flag: A set of flags used exclusively by the directory recurse process (not to be confused with state.flag). - * - mode: A file mode flag to use when working on files, such as when copying a file. - * - * - state: A pointer to the state information, where state.interrupt() and state.handle() are called appopriately. - * - listing: A directory listing structure used internally to help reduce repeated memory allocation overhead. - * - * - path: A path representing the current directory path being operated on and usually represents the parent path of some file or directory (generally assigned internally). - * - path_cache: A path-related cache made available for the caller to use, such as combining the path and the file name in the action callback. - * - path_top: A pointer to the top path string, used for error handling and printing (generally assigned internally). - * - * - action: A callback used for performing some action (this is required to do anything). - * - handle: A callback used for performing error handling during recursion directly relating to a file. - * - * The macro_f_directory_recurse_do_t_initialize_1() all arguments. - * The macro_f_directory_recurse_do_t_initialize_2() all arguments except for internally managed source, destination, mode, and depth. - */ -#ifndef _di_f_directory_recurse_do_t_ - typedef struct { - f_number_unsigned_t depth; - f_number_unsigned_t depth_max; - uint16_t flag; - f_mode_t mode; - - f_state_t state; - f_directory_listing_t listing; - - f_string_dynamic_t path; - f_string_dynamic_t path_cache; - const f_string_static_t *path_top; - - void (*action)(void * const recurse, const f_string_static_t name, const uint16_t flag); - void (*handle)(void * const recurse, const f_string_static_t name, const uint16_t flag); - } f_directory_recurse_do_t; - - #define f_directory_recurse_do_t_initialize { \ - 0, \ - F_directory_max_recurse_depth_d, \ - f_directory_recurse_do_flag_none_e, \ - f_mode_t_initialize, \ - f_state_t_initialize, \ - f_directory_listing_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - 0, \ - 0, \ - 0, \ - } - - #define macro_f_directory_recurse_do_t_initialize_1(depth, depth_max, flag, mode, state, listing, path, path_cache, path_top, action, handle) { \ - depth, \ - depth_max, \ - flag, \ - mode, \ - state, \ - listing, \ - path, \ - path_cache, \ - path_top, \ - action, \ - handle, \ - } - - #define macro_f_directory_recurse_do_t_initialize_2(depth, depth_max, flag, mode, state, action, handle) { \ - depth,\ - depth_max \ - flag, \ - mode, \ - state, \ - f_directory_listing_t_initialize, \ - f_string_dynamic_t_initialize, \ - f_string_dynamic_t_initialize, \ - 0, \ - action, \ - handle, \ - } -#endif // _di_f_directory_recurse_do_t_ - -/** - * Delete all arrays within the listing. - * - * @param listing - * The listing to fully delete. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_string_dynamics_resize(). - * - * @see f_string_dynamics_resize() - */ -#ifndef _di_f_directory_listing_delete_ - extern f_status_t f_directory_listing_delete(f_directory_listing_t * const listing); -#endif // _di_f_directory_listing_delete_ - -/** - * Destroy all arrays within the listing. - * - * @param listing - * The listing to fully destroy. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_string_dynamics_adjust(). - * - * @see f_string_dynamics_adjust() - */ -#ifndef _di_f_directory_listing_destroy_ - extern f_status_t f_directory_listing_destroy(f_directory_listing_t * const listing); -#endif // _di_f_directory_listing_destroy_ - -/** - * Delete all non-pointer based dynamic arrays within the recurse. - * - * @param recurse - * The recurse to fully delete. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_directory_listing_delete(). - * Errors (with error bit) from: f_string_dynamic_resize(). - * - * @see f_directory_listing_delete() - * @see f_string_dynamic_resize() - */ -#ifndef _di_f_directory_recurse_do_delete_ - extern f_status_t f_directory_recurse_do_delete(f_directory_recurse_do_t * const recurse); -#endif // _di_f_directory_recurse_do_delete_ - -/** - * Destroy all non-pointer based dynamic arrays within the recurse. - * - * @param recurse - * The recurse to fully destroy. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_directory_listing_destroy(). - * Errors (with error bit) from: f_string_dynamic_adjust(). - * - * @see f_directory_listing_destroy() - * @see f_string_dynamic_adjust() - */ -#ifndef _di_f_directory_recurse_do_destroy_ - extern f_status_t f_directory_recurse_do_destroy(f_directory_recurse_do_t * const recurse); -#endif // _di_f_directory_recurse_do_destroy_ - -/** - * Resize all parts of the directory statuss structure using the same length. - * - * @param length - * The new size to use. - * @param statuss - * The statuss structure to adjust. - * - * @return - * Success from f_memory_array_adjust(). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_adjust(). - * Errors (with error bit) from: f_string_dynamic_adjust(). - * - * @see f_memory_array_adjust() - * @see f_string_dynamic_adjust() - */ -#ifndef _di_f_directory_statuss_adjust_ - extern f_status_t f_directory_statuss_adjust(const f_number_unsigned_t length, f_directory_statuss_t * const statuss); -#endif // _di_f_directory_statuss_adjust_ - -/** - * Resize all parts of the directory statuss structure to a smaller size. - * - * This will resize making the array smaller based on (size - given length). - * If the given length is too small, then the resize will fail. - * This will not shrink the size to less than 0. - * - * @param amount - * A positive number representing how much to decimate the size by. - * @param statuss - * The statuss array to resize. - * - * @return - * Success from f_memory_array_adjust(). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_adjust(). - * Errors (with error bit) from: f_string_dynamic_adjust(). - * - * @see f_memory_array_adjust() - * @see f_string_dynamic_adjust() - */ -#ifndef _di_f_directory_statuss_decimate_by_ - extern f_status_t f_directory_statuss_decimate_by(const f_number_unsigned_t amount, f_directory_statuss_t * const statuss); -#endif // _di_f_directory_statuss_decimate_by_ - -/** - * Resize all parts of the directory statuss structure to a smaller size. - * - * This will resize making the array smaller based on (size - given length). - * If the given length is too small, then the resize will fail. - * This will not shrink the size to less than 0. - * - * @param amount - * A positive number representing how much to decrease the size by. - * @param statuss - * The statuss array to resize. - * - * @return - * Success from f_memory_array_resize(). - * - * 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() - */ -#ifndef _di_f_directory_statuss_decrease_by_ - extern f_status_t f_directory_statuss_decrease_by(const f_number_unsigned_t amount, f_directory_statuss_t * const statuss); -#endif // _di_f_directory_statuss_decrease_by_ - -/** - * Increase the size of all parts of the directory statuss structure, but only if necessary. - * - * If the given length is too large for the buffer, then attempt to set max buffer size (F_number_t_size_unsigned_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param statuss - * The statuss array to resize. - * - * @return - * Success from f_memory_array_increase(). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase(). - * - * @see f_memory_array_increase() - */ -#ifndef _di_f_directory_statuss_increase_ - extern f_status_t f_directory_statuss_increase(const f_number_unsigned_t step, f_directory_statuss_t * const statuss); -#endif // _di_f_directory_statuss_increase_ - -/** - * Resize all parts of the directory statuss structure to a larger size. - * - * This will resize making the array larger based on the given length. - * If the given length is too large for the buffer, then attempt to set max buffer size (F_number_t_size_unsigned_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param amount - * A positive number representing how much to increase the size by. - * @param statuss - * The statuss array to resize. - * - * @return - * Success from f_memory_array_increase_by(). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_directory_statuss_increase_by_ - extern f_status_t f_directory_statuss_increase_by(const f_number_unsigned_t amount, f_directory_statuss_t * const statuss); -#endif // _di_f_directory_statuss_increase_by_ - -/** - * Resize all parts of the directory statuss structure using the same length. - * - * @param length - * The new size to use. - * @param statuss - * The directory status array to resize. - * - * @return - * Success from f_memory_array_resize(). - * - * 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() - */ -#ifndef _di_f_directory_statuss_resize_ - extern f_status_t f_directory_statuss_resize(const f_number_unsigned_t length, f_directory_statuss_t * const statuss); -#endif // _di_f_directory_statuss_resize_ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _F_directory_type_h diff --git a/level_0/f_directory/data/build/settings b/level_0/f_directory/data/build/settings index ba1a85a..d0d2d6f 100644 --- a/level_0/f_directory/data/build/settings +++ b/level_0/f_directory/data/build/settings @@ -32,9 +32,10 @@ build_language c build_libraries -lc build_libraries-individual -lf_memory -lf_string -build_sources_library directory.c directory/common.c directory/type.c private-directory.c directory/private-type.c +build_sources_library directory.c directory/common.c directory/listing.c directory/recurse_do.c directory/status.c +build_sources_library private-directory.c -build_sources_headers directory.h directory/common.h directory/type.h +build_sources_headers directory.h directory/common.h directory/listing.h directory/recurse_do.h directory/status.h build_script yes build_shared yes diff --git a/level_0/f_directory/data/build/settings-mocks b/level_0/f_directory/data/build/settings-mocks index c5e1d90..5a72c32 100644 --- a/level_0/f_directory/data/build/settings-mocks +++ b/level_0/f_directory/data/build/settings-mocks @@ -30,9 +30,11 @@ build_language c build_libraries -lc build_libraries-individual -lf_memory -lf_string -build_sources_library directory.c directory/common.c directory/type.c private-directory.c directory/private-type.c ../../tests/unit/c/mock-directory.c +build_sources_library directory.c directory/common.c directory/listing.c directory/recurse_do.c directory/status.c +build_sources_library private-directory.c +build_sources_library ../../tests/unit/c/mock-directory.c -build_sources_headers directory.h directory/common.h directory/type.h +build_sources_headers directory.h directory/common.h directory/listing.h directory/recurse_do.h directory/status.h build_script yes build_shared yes @@ -61,6 +63,10 @@ flags-coverage --coverage -fprofile-abs-path -fprofile-dir=build/coverage/ flags_library -fPIC # Inject mocks. +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=alphasort flags -Wl,--wrap=fstatat flags -Wl,--wrap=mkdir diff --git a/level_0/f_directory/data/build/settings-tests b/level_0/f_directory/data/build/settings-tests index 5eca749..a60e9ea 100644 --- a/level_0/f_directory/data/build/settings-tests +++ b/level_0/f_directory/data/build/settings-tests @@ -25,7 +25,10 @@ build_language c build_libraries -lc -lcmocka build_libraries-individual -lf_memory -lf_string -lf_directory -build_sources_program test-directory-create.c test-directory-create_at.c test-directory-exists.c test-directory-exists_at.c test-directory-is.c test-directory-is_at.c test-directory-list.c test-directory-open.c test-directory-open_at.c test-directory-remove.c test-directory-remove_custom.c test-directory-touch.c test-directory-touch_at.c test-directory.c +build_sources_program test-directory.c test-directory-create.c test-directory-create_at.c test-directory-exists.c test-directory-exists_at.c test-directory-is.c test-directory-is_at.c test-directory-list.c test-directory-open.c test-directory-open_at.c test-directory-remove.c test-directory-remove_custom.c test-directory-touch.c test-directory-touch_at.c +build_sources_program test-directory-listings_destroy_callback.c test-directory-listings_delete_callback.c +build_sources_program test-directory-recurse_dos_destroy_callback.c test-directory-recurse_dos_delete_callback.c +build_sources_program test-directory-statuss_destroy_callback.c test-directory-statuss_delete_callback.c build_script no build_shared yes diff --git a/level_0/f_directory/tests/unit/c/mock-directory.c b/level_0/f_directory/tests/unit/c/mock-directory.c index 9d0515c..01efdd6 100644 --- a/level_0/f_directory/tests/unit/c/mock-directory.c +++ b/level_0/f_directory/tests/unit/c/mock-directory.c @@ -4,6 +4,76 @@ extern "C" { #endif +int mock_unwrap = 0; + +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_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 (!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_resize(const f_number_unsigned_t length, f_string_dynamics_t * const structure) { + + if (mock_unwrap) { + return __real_f_string_dynamics_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); +} + int __wrap_alphasort(const struct dirent **a, const struct dirent **b) { const bool failure = mock_type(bool); 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 e1fee5c..15f1562 100644 --- a/level_0/f_directory/tests/unit/c/mock-directory.h +++ b/level_0/f_directory/tests/unit/c/mock-directory.h @@ -28,6 +28,18 @@ extern "C" { const static int mock_errno_generic = 32767; +extern int mock_unwrap; + +extern f_status_t __real_f_string_dynamic_adjust(const f_number_unsigned_t length, f_string_dynamic_t * const structure); +extern f_status_t __real_f_string_dynamic_resize(const f_number_unsigned_t length, f_string_dynamic_t * const structure); +extern f_status_t __real_f_string_dynamics_adjust(const f_number_unsigned_t length, f_string_dynamics_t * const structure); +extern f_status_t __real_f_string_dynamics_resize(const f_number_unsigned_t length, f_string_dynamics_t * const structure); + +extern f_status_t __wrap_f_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 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); extern int __wrap_mkdir(const char *pathname, mode_t mode); 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 new file mode 100644 index 0000000..c9b5c57 --- /dev/null +++ b/level_0/f_directory/tests/unit/c/test-directory-listings_delete_callback.c @@ -0,0 +1,217 @@ +#include "test-directory.h" +#include "test-directory-listings_delete_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_directory_listings_delete_callback__fails(void **state) { + + mock_unwrap = 0; + + f_directory_listing_t data = f_directory_listing_t_initialize; + f_directory_listing_t data_array[] = { data }; + f_directory_listings_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_directory_listings_t datass_array[] = { datas }; + + { + will_return(__wrap_f_string_dynamics_resize, true); + will_return(__wrap_f_string_dynamics_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_listings_delete_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, true); + will_return(__wrap_f_string_dynamics_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_listings_delete_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, true); + will_return(__wrap_f_string_dynamics_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_listings_delete_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, true); + will_return(__wrap_f_string_dynamics_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_listings_delete_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, true); + will_return(__wrap_f_string_dynamics_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_listings_delete_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, true); + will_return(__wrap_f_string_dynamics_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_listings_delete_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, true); + will_return(__wrap_f_string_dynamics_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_listings_delete_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, true); + will_return(__wrap_f_string_dynamics_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_listings_delete_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_directory_listings_delete_callback__works(void **state) { + + mock_unwrap = 0; + + f_directory_listing_t data = f_directory_listing_t_initialize; + f_directory_listing_t data_array[] = { data }; + f_directory_listings_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_directory_listings_t datass_array[] = { datas }; + const f_number_unsigned_t length = 1; + + { + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + const f_status_t status = f_directory_listings_delete_callback(0, length, (void *) datass_array); + + assert_int_equal(status, F_none); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_directory/tests/unit/c/test-directory-listings_delete_callback.h b/level_0/f_directory/tests/unit/c/test-directory-listings_delete_callback.h new file mode 100644 index 0000000..2ca4b6a --- /dev/null +++ b/level_0/f_directory/tests/unit/c/test-directory-listings_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Directory + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_directory__listings_delete_callback +#define _TEST__F_directory__listings_delete_callback + +/** + * Test that the function fails. + * + * @see f_directory_listings_delete_callback() + */ +extern void test__f_directory_listings_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_directory_listings_delete_callback() + */ +extern void test__f_directory_listings_delete_callback__works(void **state); + +#endif // _TEST__F_directory__listings_delete_callback 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 new file mode 100644 index 0000000..007c43c --- /dev/null +++ b/level_0/f_directory/tests/unit/c/test-directory-listings_destroy_callback.c @@ -0,0 +1,217 @@ +#include "test-directory.h" +#include "test-directory-listings_destroy_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_directory_listings_destroy_callback__fails(void **state) { + + mock_unwrap = 0; + + f_directory_listing_t data = f_directory_listing_t_initialize; + f_directory_listing_t data_array[] = { data }; + f_directory_listings_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_directory_listings_t datass_array[] = { datas }; + + { + will_return(__wrap_f_string_dynamics_adjust, true); + will_return(__wrap_f_string_dynamics_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_listings_destroy_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, true); + will_return(__wrap_f_string_dynamics_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_listings_destroy_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, true); + will_return(__wrap_f_string_dynamics_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_listings_destroy_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, true); + will_return(__wrap_f_string_dynamics_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_listings_destroy_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, true); + will_return(__wrap_f_string_dynamics_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_listings_destroy_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, true); + will_return(__wrap_f_string_dynamics_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_listings_destroy_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, true); + will_return(__wrap_f_string_dynamics_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_listings_destroy_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, true); + will_return(__wrap_f_string_dynamics_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_listings_destroy_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_directory_listings_destroy_callback__works(void **state) { + + mock_unwrap = 0; + + f_directory_listing_t data = f_directory_listing_t_initialize; + f_directory_listing_t data_array[] = { data }; + f_directory_listings_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_directory_listings_t datass_array[] = { datas }; + const f_number_unsigned_t length = 1; + + { + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + const f_status_t status = f_directory_listings_destroy_callback(0, length, (void *) datass_array); + + assert_int_equal(status, F_none); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_directory/tests/unit/c/test-directory-listings_destroy_callback.h b/level_0/f_directory/tests/unit/c/test-directory-listings_destroy_callback.h new file mode 100644 index 0000000..fb67d02 --- /dev/null +++ b/level_0/f_directory/tests/unit/c/test-directory-listings_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Directory + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_directory__listings_destroy_callback +#define _TEST__F_directory__listings_destroy_callback + +/** + * Test that the function fails. + * + * @see f_directory_listings_destroy_callback() + */ +extern void test__f_directory_listings_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_directory_listings_destroy_callback() + */ +extern void test__f_directory_listings_destroy_callback__works(void **state); + +#endif // _TEST__F_directory__listings_destroy_callback 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 new file mode 100644 index 0000000..1c34c95 --- /dev/null +++ b/level_0/f_directory/tests/unit/c/test-directory-recurse_dos_delete_callback.c @@ -0,0 +1,292 @@ +#include "test-directory.h" +#include "test-directory-recurse_dos_delete_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_directory_recurse_dos_delete_callback__fails(void **state) { + + mock_unwrap = 0; + + f_directory_recurse_do_t data = f_directory_recurse_do_t_initialize; + f_directory_recurse_do_t data_array[] = { data }; + f_directory_recurse_dos_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_directory_recurse_dos_t datass_array[] = { datas }; + + { + will_return(__wrap_f_string_dynamic_resize, true); + will_return(__wrap_f_string_dynamic_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_recurse_dos_delete_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamic_resize, false); + will_return(__wrap_f_string_dynamic_resize, F_none); + + will_return(__wrap_f_string_dynamic_resize, true); + will_return(__wrap_f_string_dynamic_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_recurse_dos_delete_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamic_resize, false); + will_return(__wrap_f_string_dynamic_resize, F_none); + + will_return(__wrap_f_string_dynamic_resize, false); + will_return(__wrap_f_string_dynamic_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, true); + will_return(__wrap_f_string_dynamics_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_recurse_dos_delete_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamic_resize, false); + will_return(__wrap_f_string_dynamic_resize, F_none); + + will_return(__wrap_f_string_dynamic_resize, false); + will_return(__wrap_f_string_dynamic_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, true); + will_return(__wrap_f_string_dynamics_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_recurse_dos_delete_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamic_resize, false); + will_return(__wrap_f_string_dynamic_resize, F_none); + + will_return(__wrap_f_string_dynamic_resize, false); + will_return(__wrap_f_string_dynamic_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, true); + will_return(__wrap_f_string_dynamics_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_recurse_dos_delete_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamic_resize, false); + will_return(__wrap_f_string_dynamic_resize, F_none); + + will_return(__wrap_f_string_dynamic_resize, false); + will_return(__wrap_f_string_dynamic_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, true); + will_return(__wrap_f_string_dynamics_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_recurse_dos_delete_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamic_resize, false); + will_return(__wrap_f_string_dynamic_resize, F_none); + + will_return(__wrap_f_string_dynamic_resize, false); + will_return(__wrap_f_string_dynamic_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, true); + will_return(__wrap_f_string_dynamics_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_recurse_dos_delete_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamic_resize, false); + will_return(__wrap_f_string_dynamic_resize, F_none); + + will_return(__wrap_f_string_dynamic_resize, false); + will_return(__wrap_f_string_dynamic_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, true); + will_return(__wrap_f_string_dynamics_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_recurse_dos_delete_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamic_resize, false); + will_return(__wrap_f_string_dynamic_resize, F_none); + + will_return(__wrap_f_string_dynamic_resize, false); + will_return(__wrap_f_string_dynamic_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, true); + will_return(__wrap_f_string_dynamics_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_recurse_dos_delete_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamic_resize, false); + will_return(__wrap_f_string_dynamic_resize, F_none); + + will_return(__wrap_f_string_dynamic_resize, false); + will_return(__wrap_f_string_dynamic_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, true); + will_return(__wrap_f_string_dynamics_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_recurse_dos_delete_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_directory_recurse_dos_delete_callback__works(void **state) { + + mock_unwrap = 0; + + f_directory_recurse_do_t data = f_directory_recurse_do_t_initialize; + f_directory_recurse_do_t data_array[] = { data }; + f_directory_recurse_dos_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_directory_recurse_dos_t datass_array[] = { datas }; + const f_number_unsigned_t length = 1; + + { + will_return(__wrap_f_string_dynamic_resize, false); + will_return(__wrap_f_string_dynamic_resize, F_none); + + will_return(__wrap_f_string_dynamic_resize, false); + will_return(__wrap_f_string_dynamic_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + const f_status_t status = f_directory_recurse_dos_delete_callback(0, length, (void *) datass_array); + + assert_int_equal(status, F_none); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_directory/tests/unit/c/test-directory-recurse_dos_delete_callback.h b/level_0/f_directory/tests/unit/c/test-directory-recurse_dos_delete_callback.h new file mode 100644 index 0000000..a1803c2 --- /dev/null +++ b/level_0/f_directory/tests/unit/c/test-directory-recurse_dos_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Directory + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_directory__recurse_dos_delete_callback +#define _TEST__F_directory__recurse_dos_delete_callback + +/** + * Test that the function fails. + * + * @see f_directory_recurse_dos_delete_callback() + */ +extern void test__f_directory_recurse_dos_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_directory_recurse_dos_delete_callback() + */ +extern void test__f_directory_recurse_dos_delete_callback__works(void **state); + +#endif // _TEST__F_directory__recurse_dos_delete_callback 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 new file mode 100644 index 0000000..5dd9b4c --- /dev/null +++ b/level_0/f_directory/tests/unit/c/test-directory-recurse_dos_destroy_callback.c @@ -0,0 +1,292 @@ +#include "test-directory.h" +#include "test-directory-recurse_dos_destroy_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_directory_recurse_dos_destroy_callback__fails(void **state) { + + mock_unwrap = 0; + + f_directory_recurse_do_t data = f_directory_recurse_do_t_initialize; + f_directory_recurse_do_t data_array[] = { data }; + f_directory_recurse_dos_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_directory_recurse_dos_t datass_array[] = { datas }; + + { + will_return(__wrap_f_string_dynamic_adjust, true); + will_return(__wrap_f_string_dynamic_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_recurse_dos_destroy_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamic_adjust, true); + will_return(__wrap_f_string_dynamic_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_recurse_dos_destroy_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, true); + will_return(__wrap_f_string_dynamics_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_recurse_dos_destroy_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, true); + will_return(__wrap_f_string_dynamics_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_recurse_dos_destroy_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, true); + will_return(__wrap_f_string_dynamics_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_recurse_dos_destroy_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, true); + will_return(__wrap_f_string_dynamics_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_recurse_dos_destroy_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, true); + will_return(__wrap_f_string_dynamics_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_recurse_dos_destroy_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, true); + will_return(__wrap_f_string_dynamics_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_recurse_dos_destroy_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, true); + will_return(__wrap_f_string_dynamics_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_recurse_dos_destroy_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, true); + will_return(__wrap_f_string_dynamics_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_recurse_dos_destroy_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_directory_recurse_dos_destroy_callback__works(void **state) { + + mock_unwrap = 0; + + f_directory_recurse_do_t data = f_directory_recurse_do_t_initialize; + f_directory_recurse_do_t data_array[] = { data }; + f_directory_recurse_dos_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_directory_recurse_dos_t datass_array[] = { datas }; + const f_number_unsigned_t length = 1; + + { + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + const f_status_t status = f_directory_recurse_dos_destroy_callback(0, length, (void *) datass_array); + + assert_int_equal(status, F_none); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_directory/tests/unit/c/test-directory-recurse_dos_destroy_callback.h b/level_0/f_directory/tests/unit/c/test-directory-recurse_dos_destroy_callback.h new file mode 100644 index 0000000..23af902 --- /dev/null +++ b/level_0/f_directory/tests/unit/c/test-directory-recurse_dos_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Directory + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_directory__recurse_dos_destroy_callback +#define _TEST__F_directory__recurse_dos_destroy_callback + +/** + * Test that the function fails. + * + * @see f_directory_recurse_dos_destroy_callback() + */ +extern void test__f_directory_recurse_dos_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_directory_recurse_dos_destroy_callback() + */ +extern void test__f_directory_recurse_dos_destroy_callback__works(void **state); + +#endif // _TEST__F_directory__recurse_dos_destroy_callback 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 new file mode 100644 index 0000000..f1a700a --- /dev/null +++ b/level_0/f_directory/tests/unit/c/test-directory-statuss_delete_callback.c @@ -0,0 +1,49 @@ +#include "test-directory.h" +#include "test-directory-statuss_delete_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_directory_statuss_delete_callback__fails(void **state) { + + mock_unwrap = 0; + + f_directory_status_t data = f_directory_status_t_initialize; + f_directory_status_t data_array[] = { data }; + f_directory_statuss_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_directory_statuss_t datass_array[] = { datas }; + + { + will_return(__wrap_f_string_dynamic_resize, true); + will_return(__wrap_f_string_dynamic_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_statuss_delete_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_directory_statuss_delete_callback__works(void **state) { + + mock_unwrap = 0; + + f_directory_status_t data = f_directory_status_t_initialize; + f_directory_status_t data_array[] = { data }; + f_directory_statuss_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_directory_statuss_t datass_array[] = { datas }; + const f_number_unsigned_t length = 1; + + { + will_return(__wrap_f_string_dynamic_resize, false); + will_return(__wrap_f_string_dynamic_resize, F_none); + + const f_status_t status = f_directory_statuss_delete_callback(0, length, (void *) datass_array); + + assert_int_equal(status, F_none); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_directory/tests/unit/c/test-directory-statuss_delete_callback.h b/level_0/f_directory/tests/unit/c/test-directory-statuss_delete_callback.h new file mode 100644 index 0000000..052dd29 --- /dev/null +++ b/level_0/f_directory/tests/unit/c/test-directory-statuss_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Directory + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_directory__statuss_delete_callback +#define _TEST__F_directory__statuss_delete_callback + +/** + * Test that the function fails. + * + * @see f_directory_statuss_delete_callback() + */ +extern void test__f_directory_statuss_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_directory_statuss_delete_callback() + */ +extern void test__f_directory_statuss_delete_callback__works(void **state); + +#endif // _TEST__F_directory__statuss_delete_callback 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 new file mode 100644 index 0000000..f1fe76a --- /dev/null +++ b/level_0/f_directory/tests/unit/c/test-directory-statuss_destroy_callback.c @@ -0,0 +1,49 @@ +#include "test-directory.h" +#include "test-directory-statuss_destroy_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_directory_statuss_destroy_callback__fails(void **state) { + + mock_unwrap = 0; + + f_directory_status_t data = f_directory_status_t_initialize; + f_directory_status_t data_array[] = { data }; + f_directory_statuss_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_directory_statuss_t datass_array[] = { datas }; + + { + will_return(__wrap_f_string_dynamic_adjust, true); + will_return(__wrap_f_string_dynamic_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_directory_statuss_destroy_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_directory_statuss_destroy_callback__works(void **state) { + + mock_unwrap = 0; + + f_directory_status_t data = f_directory_status_t_initialize; + f_directory_status_t data_array[] = { data }; + f_directory_statuss_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_directory_statuss_t datass_array[] = { datas }; + const f_number_unsigned_t length = 1; + + { + will_return(__wrap_f_string_dynamic_adjust, false); + will_return(__wrap_f_string_dynamic_adjust, F_none); + + const f_status_t status = f_directory_statuss_destroy_callback(0, length, (void *) datass_array); + + assert_int_equal(status, F_none); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_directory/tests/unit/c/test-directory-statuss_destroy_callback.h b/level_0/f_directory/tests/unit/c/test-directory-statuss_destroy_callback.h new file mode 100644 index 0000000..4445430 --- /dev/null +++ b/level_0/f_directory/tests/unit/c/test-directory-statuss_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Directory + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_directory__statuss_destroy_callback +#define _TEST__F_directory__statuss_destroy_callback + +/** + * Test that the function fails. + * + * @see f_directory_statuss_destroy_callback() + */ +extern void test__f_directory_statuss_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_directory_statuss_destroy_callback() + */ +extern void test__f_directory_statuss_destroy_callback__works(void **state); + +#endif // _TEST__F_directory__statuss_destroy_callback diff --git a/level_0/f_directory/tests/unit/c/test-directory.c b/level_0/f_directory/tests/unit/c/test-directory.c index da29a28..f0aaaa9 100644 --- a/level_0/f_directory/tests/unit/c/test-directory.c +++ b/level_0/f_directory/tests/unit/c/test-directory.c @@ -68,6 +68,24 @@ int main(void) { cmocka_unit_test(test__f_directory_remove_custom__returns_data_not), cmocka_unit_test(test__f_directory_remove_custom__works), + cmocka_unit_test(test__f_directory_listings_destroy_callback__fails), + cmocka_unit_test(test__f_directory_listings_delete_callback__fails), + + cmocka_unit_test(test__f_directory_listings_destroy_callback__works), + cmocka_unit_test(test__f_directory_listings_delete_callback__works), + + cmocka_unit_test(test__f_directory_recurse_dos_destroy_callback__fails), + cmocka_unit_test(test__f_directory_recurse_dos_delete_callback__fails), + + cmocka_unit_test(test__f_directory_recurse_dos_destroy_callback__works), + cmocka_unit_test(test__f_directory_recurse_dos_delete_callback__works), + + cmocka_unit_test(test__f_directory_statuss_destroy_callback__fails), + cmocka_unit_test(test__f_directory_statuss_delete_callback__fails), + + cmocka_unit_test(test__f_directory_statuss_destroy_callback__works), + cmocka_unit_test(test__f_directory_statuss_delete_callback__works), + cmocka_unit_test(test__f_directory_touch__fails), cmocka_unit_test(test__f_directory_touch__returns_data_not), cmocka_unit_test(test__f_directory_touch__works), @@ -88,6 +106,8 @@ int main(void) { cmocka_unit_test(test__f_directory_open_at__parameter_checking), cmocka_unit_test(test__f_directory_remove__parameter_checking), cmocka_unit_test(test__f_directory_remove_custom__parameter_checking), + // f_directory_statuss_destroy_callback() doesn't use parameter checking. + // f_directory_statuss_delete_callback() doesn't use parameter checking. // f_directory_touch() doesn't use parameter checking. // f_directory_touch_at() doesn't use parameter checking. #endif // _di_level_0_parameter_checking_ diff --git a/level_0/f_directory/tests/unit/c/test-directory.h b/level_0/f_directory/tests/unit/c/test-directory.h index f5dc19a..196169f 100644 --- a/level_0/f_directory/tests/unit/c/test-directory.h +++ b/level_0/f_directory/tests/unit/c/test-directory.h @@ -37,9 +37,16 @@ #include "test-directory-open_at.h" #include "test-directory-remove.h" #include "test-directory-remove_custom.h" +#include "test-directory-listings_destroy_callback.h" +#include "test-directory-listings_delete_callback.h" +#include "test-directory-recurse_dos_destroy_callback.h" +#include "test-directory-recurse_dos_delete_callback.h" +#include "test-directory-statuss_destroy_callback.h" +#include "test-directory-statuss_delete_callback.h" #include "test-directory-touch.h" #include "test-directory-touch_at.h" + #ifdef __cplusplus extern "C" { #endif diff --git a/level_0/f_fss/c/fss/item.c b/level_0/f_fss/c/fss/item.c index 9d2e877..b4b6561 100644 --- a/level_0/f_fss/c/fss/item.c +++ b/level_0/f_fss/c/fss/item.c @@ -1,73 +1,130 @@ #include "../fss.h" -#include "private-item.h" #ifdef __cplusplus extern "C" { #endif -#ifndef _di_f_fss_items_adjust_ - f_status_t f_fss_items_adjust(const f_number_unsigned_t length, f_fss_items_t * const items) { +#ifndef _di_f_fss_item_delete_ + f_status_t f_fss_item_delete(f_fss_item_t * const item) { #ifndef _di_level_0_parameter_checking_ - if (!items) return F_status_set_error(F_parameter); + if (!item) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - return private_f_fss_items_adjust(length, items); + return f_string_ranges_resize(0, &item->content); } -#endif // _di_f_fss_items_adjust_ +#endif // _di_f_fss_item_delete_ -#ifndef _di_f_fss_items_decimate_by_ - f_status_t f_fss_items_decimate_by(const f_number_unsigned_t amount, f_fss_items_t * const items) { +#ifndef _di_f_fss_item_destroy_ + f_status_t f_fss_item_destroy(f_fss_item_t * const item) { #ifndef _di_level_0_parameter_checking_ - if (!items) return F_status_set_error(F_parameter); + if (!item) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!amount) return F_data_not; + item->object.start = 1; + item->object.stop = 0; + item->parent = 0; - return private_f_fss_items_adjust((items->size > amount) ? items->size - amount : 0, items); + return f_string_ranges_adjust(0, &item->content); } -#endif // _di_f_fss_items_decimate_by_ +#endif // _di_f_fss_item_destroy_ -#ifndef _di_f_fss_items_decrease_by_ - f_status_t f_fss_items_decrease_by(const f_number_unsigned_t amount, f_fss_items_t * const items) { - #ifndef _di_level_0_parameter_checking_ - if (!items) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ +#ifndef _di_f_fss_items_delete_callback_ + f_status_t f_fss_items_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { + + { + f_fss_item_t * const array = (f_fss_item_t *) void_array; + f_status_t status = F_none; + + for (f_number_unsigned_t i = start; i < stop; ++i) { - if (!amount) return F_data_not; + status = f_string_ranges_resize(0, &array[i].content); + if (F_status_is_error(status)) return status; + } // for + } - return private_f_fss_items_resize((items->size > amount) ? items->size - amount : 0, items); + return F_none; } -#endif // _di_f_fss_items_decrease_by_ +#endif // _di_f_fss_items_delete_callback_ -#ifndef _di_f_fss_items_increase_ - f_status_t f_fss_items_increase(const f_number_unsigned_t step, f_fss_items_t * const items) { - #ifndef _di_level_0_parameter_checking_ - if (!items) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ +#ifndef _di_f_fss_items_destroy_callback_ + f_status_t f_fss_items_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { + + { + f_fss_item_t * const array = (f_fss_item_t *) void_array; + f_status_t status = F_none; - return f_memory_array_increase(step, sizeof(f_fss_item_t), (void **) &items->array, &items->used, &items->size); + for (f_number_unsigned_t i = start; i < stop; ++i) { + + array[i].object.start = 1; + array[i].object.stop = 0; + array[i].parent = 0; + + status = f_string_ranges_adjust(0, &array[i].content); + if (F_status_is_error(status)) return status; + } // for + } + + return F_none; } -#endif // _di_f_fss_items_increase_ +#endif // _di_f_fss_items_destroy_callback_ -#ifndef _di_f_fss_items_increase_by_ - f_status_t f_fss_items_increase_by(const f_number_unsigned_t amount, f_fss_items_t * const items) { - #ifndef _di_level_0_parameter_checking_ - if (!items) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ +#ifndef _di_f_fss_itemss_delete_callback_ + f_status_t f_fss_itemss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { + + { + f_fss_items_t * const array = (f_fss_items_t *) void_array; + f_status_t status = F_none; + f_number_unsigned_t j = 0; - return f_memory_array_increase_by(amount, sizeof(f_fss_item_t), (void **) &items->array, &items->used, &items->size); + for (f_number_unsigned_t i = start; i < stop; ++i) { + + for (j = 0; j < array[i].size; ++j) { + + status = f_string_ranges_resize(0, &array[i].array[j].content); + if (F_status_is_error(status)) return status; + } // for + + if (array[i].size) { + status = f_memory_array_resize(0, sizeof(f_fss_item_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } + } // for + } + + return F_none; } -#endif // _di_f_fss_items_increase_by_ +#endif // _di_f_fss_itemss_delete_callback_ -#ifndef _di_f_fss_items_resize_ - f_status_t f_fss_items_resize(const f_number_unsigned_t length, f_fss_items_t * const items) { - #ifndef _di_level_0_parameter_checking_ - if (!items) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ +#ifndef _di_f_fss_itemss_destroy_callback_ + f_status_t f_fss_itemss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { + + { + f_fss_items_t * const array = (f_fss_items_t *) void_array; + f_status_t status = F_none; + f_number_unsigned_t j = 0; + + for (f_number_unsigned_t i = start; i < stop; ++i) { + + for (j = 0; j < array[i].size; ++j) { + + array[i].array[j].object.start = 1; + array[i].array[j].object.stop = 0; + array[i].array[j].parent = 0; + + status = f_string_ranges_adjust(0, &array[i].array[j].content); + if (F_status_is_error(status)) return status; + } // for + + if (array[i].size) { + status = f_memory_array_adjust(0, sizeof(f_fss_item_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } + } // for + } - return private_f_fss_items_resize(length, items); + return F_none; } -#endif // _di_f_fss_items_resize_ +#endif // _di_f_fss_itemss_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_fss/c/fss/item.h b/level_0/f_fss/c/fss/item.h index d8ed268..a1f397d 100644 --- a/level_0/f_fss/c/fss/item.h +++ b/level_0/f_fss/c/fss/item.h @@ -48,17 +48,6 @@ extern "C" { macro_f_string_range_t_clear(item.object); \ macro_f_string_ranges_t_clear(item.content); \ item.parent = 0; - - #define macro_f_fss_item_t_resize(status, item, length) macro_f_string_ranges_t_resize(status, item.content, length) - #define macro_f_fss_item_t_adjust(status, item, length) macro_f_string_ranges_t_adjust(status, item.content, length) - - #define macro_f_fss_item_t_delete_simple(item) macro_f_string_ranges_t_delete_simple(item.content) - #define macro_f_fss_item_t_destroy_simple(item) macro_f_string_ranges_t_destroy_simple(item.content) - - #define macro_f_fss_item_t_increase(status, step, item) macro_f_string_ranges_t_increase(status, step, item.content) - #define macro_f_fss_item_t_increase_by(status, item, amount) macro_f_string_ranges_t_increase_by(status, item.content, amount) - #define macro_f_fss_item_t_decrease_by(status, item, amount) macro_f_string_ranges_t_decrease_by(status, item.content, amount) - #define macro_f_fss_item_t_decimate_by(status, item, amount) macro_f_string_ranges_t_decimate_by(status, item.content, amount) #endif // _di_f_fss_item_t_ /** @@ -102,159 +91,157 @@ extern "C" { #define macro_f_fss_items_t_initialize_1(array, size, used) { array, size, used } #define macro_f_fss_items_t_initialize_2(array, length) { array, length, length } - - #define macro_f_fss_items_t_resize(status, items, length) status = f_fss_items_resize(length, &items); - #define macro_f_fss_items_t_adjust(status, items, length) status = f_fss_items_adjust(length, &items); - - #define macro_f_fss_items_t_delete_simple(items) f_fss_items_resize(0, &items); - #define macro_f_fss_items_t_destroy_simple(items) f_fss_items_adjust(0, &items); - - #define macro_f_fss_items_t_increase(status, step, items) status = f_fss_items_increase(step, &items); - #define macro_f_fss_items_t_increase_by(status, items, amount) status = f_fss_items_increase_by(amount, &items); - #define macro_f_fss_items_t_decrease_by(status, items, amount) status = f_fss_items_decrease_by(amount, &items); - #define macro_f_fss_items_t_decimate_by(status, items, amount) status = f_fss_items_decimate_by(amount, &items); #endif // _di_f_fss_items_t_ /** - * Resize the nest array. + * Delete an item. * - * @param length - * The new size to use. - * @param items - * The items array to resize. + * @param item + * The item to delete. * * @return * F_none on success. * - * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_string_ranges_resize(). + * + * @see f_string_ranges_resize() */ -#ifndef _di_f_fss_items_adjust_ - extern f_status_t f_fss_items_adjust(const f_number_unsigned_t length, f_fss_items_t * const items); -#endif // _di_f_fss_items_adjust_ +#ifndef _di_f_fss_item_delete_ + extern f_status_t f_fss_item_delete(f_fss_item_t * const item); +#endif // _di_f_fss_item_delete_ /** - * Resize the nest array to a smaller size. + * Destroy an item. * - * This will resize making the array smaller based on (size - given length). - * If the given length is too small, then the resize will fail. - * This will not shrink the size to less than 0. - * - * @param amount - * A positive number representing how much to decimate the size by. - * @param items - * The items array to resize. + * @param item + * The item to destroy. * * @return * F_none on success. - * F_data_not if amount is 0. * - * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_string_ranges_adjust(). + * + * @see f_string_ranges_adjust() */ -#ifndef _di_f_fss_items_decimate_by_ - extern f_status_t f_fss_items_decimate_by(const f_number_unsigned_t amount, f_fss_items_t * const items); -#endif // _di_f_fss_items_decimate_by_ +#ifndef _di_f_fss_item_destroy_ + extern f_status_t f_fss_item_destroy(f_fss_item_t * const item); +#endif // _di_f_fss_item_destroy_ /** - * Resize the nest array to a smaller size. + * A callback intended to be passed to f_memory_arrays_resize() for an f_items_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. * - * This will resize making the array smaller based on (size - given length). - * If the given length is too small, then the resize will fail. - * This will not shrink the size to less than 0. + * This does not do parameter checking. * - * @param amount - * A positive number representing how much to decrease the size by. - * @param items - * The items array to resize. + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return - * Success from f_memory_array_adjust(). + * F_none on success. * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_memory_array_adjust(). - * Errors (with error bit) from: f_string_dynamic_adjust(). + * Errors (with error bit) from: f_string_ranges_resize(). * - * @see f_memory_array_adjust() - * @see f_string_dynamic_adjust() + * @see f_string_ranges_resize() */ -#ifndef _di_f_fss_items_decrease_by_ - extern f_status_t f_fss_items_decrease_by(const f_number_unsigned_t amount, f_fss_items_t * const items); -#endif // _di_f_fss_items_decrease_by_ +#ifndef _di_f_fss_items_delete_callback_ + extern f_status_t f_fss_items_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_fss_items_delete_callback_ /** - * Increase the size of the items array, but only if necessary. + * A callback intended to be passed to f_memory_arrays_adjust() for an f_items_t structure. * - * If the given length is too large for the buffer, then attempt to set max buffer size (F_number_t_size_unsigned_d). - * If already set to the maximum buffer size, then the resize will fail. + * This is only called when shrinking the array and generally should perform deallocations. * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param items - * The items array to resize. + * This does not do parameter checking. + * + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return - * Success from f_memory_array_increase(). + * F_none on success. * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_memory_array_increase(). + * Errors (with error bit) from: f_string_ranges_adjust(). * - * @see f_memory_array_increase() + * @see f_string_ranges_adjust() */ -#ifndef _di_f_fss_items_increase_ - extern f_status_t f_fss_items_increase(const f_number_unsigned_t step, f_fss_items_t * const items); -#endif // _di_f_fss_items_increase_ +#ifndef _di_f_fss_items_destroy_callback_ + extern f_status_t f_fss_items_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_fss_items_destroy_callback_ /** - * Resize the items array to a larger size. + * A callback intended to be passed to f_memory_arrays_resize() for an f_itemss_t structure. * - * This will resize making the array larger based on the given length. - * If the given length is too large for the buffer, then attempt to set max buffer size (F_number_t_size_unsigned_d). - * If already set to the maximum buffer size, then the resize will fail. + * This is only called when shrinking the array and generally should perform deallocations. * - * @param amount - * A positive number representing how much to increase the size by. - * @param items - * The items array to resize. + * This does not do parameter checking. + * + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return - * Success from f_memory_array_increase_by(). + * F_none on success. * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_memory_array_increase_by(). + * Errors (with error bit) from: f_string_ranges_resize(). * - * @see f_memory_array_increase_by() + * @see f_string_ranges_resize() */ -#ifndef _di_f_fss_items_increase_by_ - extern f_status_t f_fss_items_increase_by(const f_number_unsigned_t amount, f_fss_items_t * const items); -#endif // _di_f_fss_items_increase_by_ +#ifndef _di_f_fss_itemss_delete_callback_ + extern f_status_t f_fss_itemss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_fss_itemss_delete_callback_ /** - * Resize the items array. + * A callback intended to be passed to f_memory_arrays_adjust() for an f_itemss_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. * - * @param length - * The new size to use. - * @param items - * The items array to resize. + * This does not do parameter checking. + * + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return - * Success from f_memory_array_resize(). + * F_none on success. * * 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(). + * Errors (with error bit) from: f_string_ranges_adjust(). * - * @see f_memory_array_resize() - * @see f_string_dynamic_resize() + * @see f_string_ranges_adjust() */ -#ifndef _di_f_fss_items_resize_ - extern f_status_t f_fss_items_resize(const f_number_unsigned_t length, f_fss_items_t * const items); -#endif // _di_f_fss_items_resize_ +#ifndef _di_f_fss_itemss_destroy_callback_ + extern f_status_t f_fss_itemss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_fss_itemss_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_fss/c/fss/named.c b/level_0/f_fss/c/fss/named.c index 2f58715..c663e2b 100644 --- a/level_0/f_fss/c/fss/named.c +++ b/level_0/f_fss/c/fss/named.c @@ -1,163 +1,173 @@ #include "../fss.h" -#include "private-named.h" #ifdef __cplusplus extern "C" { #endif -#ifndef _di_f_fss_named_adjust_ - f_status_t f_fss_named_adjust(const f_number_unsigned_t length, f_fss_named_t * const named) { +#ifndef _di_f_fss_named_delete_ + f_status_t f_fss_named_delete(f_fss_named_t * const named) { #ifndef _di_level_0_parameter_checking_ if (!named) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - return private_f_fss_named_adjust(length, named); - } -#endif // _di_f_fss_named_adjust_ + { + f_status_t status = f_string_ranges_resize(0, &named->objects); + if (F_status_is_error(status)) return status; -#ifndef _di_f_fss_named_decimate_by_ - f_status_t f_fss_named_decimate_by(const f_number_unsigned_t amount, f_fss_named_t * const named) { - #ifndef _di_level_0_parameter_checking_ - if (!named) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + status = f_string_rangess_resize(0, &named->contents); + if (F_status_is_error(status)) return status; - if (!amount) return F_data_not; + status = f_memory_arrays_resize(0, sizeof(uint8_t), (void **) &named->quotess.array, &named->quotess.used, &named->quotess.size, &f_uint8ss_delete_callback); + if (F_status_is_error(status)) return status; + } - return private_f_fss_named_adjust((named->objects.size - amount > 0) ? named->objects.size - amount : 0, named); + return F_none; } -#endif // _di_f_fss_named_decimate_by_ +#endif // _di_f_fss_named_delete_ -#ifndef _di_f_fss_named_decrease_by_ - f_status_t f_fss_named_decrease_by(const f_number_unsigned_t amount, f_fss_named_t * const named) { +#ifndef _di_f_fss_named_destroy_ + f_status_t f_fss_named_destroy(f_fss_named_t * const named) { #ifndef _di_level_0_parameter_checking_ if (!named) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!amount) return F_data_not; + named->name.start = 1; + named->name.stop = 0; + + { + f_status_t status = f_string_ranges_adjust(0, &named->objects); + if (F_status_is_error(status)) return status; - return private_f_fss_named_resize((named->objects.size - amount > 0) ? named->objects.size - amount : 0, named); + status = f_string_rangess_adjust(0, &named->contents); + if (F_status_is_error(status)) return status; + + status = f_memory_arrays_adjust(0, sizeof(uint8_t), (void **) &named->quotess.array, &named->quotess.used, &named->quotess.size, &f_uint8ss_destroy_callback); + if (F_status_is_error(status)) return status; + } + + return F_none; } -#endif // _di_f_fss_named_decrease_by_ +#endif // _di_f_fss_named_destroy_ -#ifndef _di_f_fss_named_increase_ - f_status_t f_fss_named_increase(const f_number_unsigned_t step, f_fss_named_t * const named) { - #ifndef _di_level_0_parameter_checking_ - if (!named) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ +#ifndef _di_f_fss_nameds_delete_callback_ + f_status_t f_fss_nameds_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { - if (step && named->objects.used + 1 > named->objects.size) { - if (named->objects.used >= F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); + { + f_fss_named_t * const array = (f_fss_named_t *) void_array; + f_status_t status = F_none; - f_number_unsigned_t length = named->objects.used + step; + for (f_number_unsigned_t i = start; i < stop; ++i) { - if (length > F_number_t_size_unsigned_d) { - if (named->objects.used + 1 > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); + status = f_string_ranges_resize(0, &array[i].objects); + if (F_status_is_error(status)) return status; - length = F_number_t_size_unsigned_d; - } + status = f_string_rangess_resize(0, &array[i].contents); + if (F_status_is_error(status)) return status; - return private_f_fss_named_resize(length, named); + status = f_memory_arrays_resize(0, sizeof(uint8_t), (void **) &array[i].quotess.array, &array[i].quotess.used, &array[i].quotess.size, &f_uint8ss_delete_callback); + if (F_status_is_error(status)) return status; + } // for } - return F_data_not; + return F_none; } -#endif // _di_f_fss_named_increase_ +#endif // _di_f_fss_nameds_delete_callback_ -#ifndef _di_f_fss_named_increase_by_ - f_status_t f_fss_named_increase_by(const f_number_unsigned_t amount, f_fss_named_t * const named) { - #ifndef _di_level_0_parameter_checking_ - if (!named) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ +#ifndef _di_f_fss_nameds_destroy_callback_ + f_status_t f_fss_nameds_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { + + { + f_fss_named_t * const array = (f_fss_named_t *) void_array; + f_status_t status = F_none; - if (amount) { - if (named->objects.used >= F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); + for (f_number_unsigned_t i = start; i < stop; ++i) { - const f_number_unsigned_t length = named->objects.used + amount; + array[i].name.start = 1; + array[i].name.stop = 0; - if (length > named->objects.size) { - if (length > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); + status = f_string_ranges_adjust(0, &array[i].objects); + if (F_status_is_error(status)) return status; - return private_f_fss_named_resize(length, named); - } + status = f_string_rangess_adjust(0, &array[i].contents); + if (F_status_is_error(status)) return status; + + status = f_memory_arrays_adjust(0, sizeof(uint8_t), (void **) &array[i].quotess.array, &array[i].quotess.used, &array[i].quotess.size, &f_uint8ss_destroy_callback); + if (F_status_is_error(status)) return status; + } // for } - return F_data_not; + return F_none; } -#endif // _di_f_fss_named_increase_by_ +#endif // _di_f_fss_nameds_destroy_callback_ -#ifndef _di_f_fss_named_resize_ - f_status_t f_fss_named_resize(const f_number_unsigned_t length, f_fss_named_t * const named) { - #ifndef _di_level_0_parameter_checking_ - if (!named) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ +#ifndef _di_f_fss_namedss_delete_callback_ + f_status_t f_fss_namedss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { - return private_f_fss_named_resize(length, named); - } -#endif // _di_f_fss_named_resize_ + { + f_fss_nameds_t * const array = (f_fss_nameds_t *) void_array; + f_status_t status = F_none; + f_number_unsigned_t j = 0; -#ifndef _di_f_fss_nameds_adjust_ - f_status_t f_fss_nameds_adjust(const f_number_unsigned_t length, f_fss_nameds_t * const nameds) { - #ifndef _di_level_0_parameter_checking_ - if (!nameds) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + for (f_number_unsigned_t i = start; i < stop; ++i) { - return private_f_fss_nameds_adjust(length, nameds); - } -#endif // _di_f_fss_nameds_adjust_ + for (j = 0; j < array[i].size; ++j) { -#ifndef _di_f_fss_nameds_decimate_by_ - f_status_t f_fss_nameds_decimate_by(const f_number_unsigned_t amount, f_fss_nameds_t * const nameds) { - #ifndef _di_level_0_parameter_checking_ - if (!nameds) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + status = f_string_ranges_resize(0, &array[i].array[j].objects); + if (F_status_is_error(status)) return status; + + status = f_string_rangess_resize(0, &array[i].array[j].contents); + if (F_status_is_error(status)) return status; - if (!amount) return F_data_not; + status = f_memory_arrays_resize(0, sizeof(uint8_t), (void **) &array[i].array[j].quotess.array, &array[i].array[j].quotess.used, &array[i].array[j].quotess.size, &f_uint8ss_delete_callback); + if (F_status_is_error(status)) return status; + } // for - return private_f_fss_nameds_adjust((nameds->size > amount) ? nameds->size - amount : 0, nameds); + if (array[i].size) { + status = f_memory_array_resize(0, sizeof(f_fss_named_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } + } // for + } + + return F_none; } -#endif // _di_f_fss_nameds_decimate_by_ +#endif // _di_f_fss_namedss_delete_callback_ -#ifndef _di_f_fss_nameds_decrease_by_ - f_status_t f_fss_nameds_decrease_by(const f_number_unsigned_t amount, f_fss_nameds_t * const nameds) { - #ifndef _di_level_0_parameter_checking_ - if (!nameds) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ +#ifndef _di_f_fss_namedss_destroy_callback_ + f_status_t f_fss_namedss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { - if (!amount) return F_data_not; + { + f_fss_nameds_t * const array = (f_fss_nameds_t *) void_array; + f_status_t status = F_none; + f_number_unsigned_t j = 0; - return private_f_fss_nameds_resize((nameds->size > amount) ? nameds->size - amount : 0, nameds); - } -#endif // _di_f_fss_nameds_decrease_by_ + for (f_number_unsigned_t i = start; i < stop; ++i) { -#ifndef _di_f_fss_nameds_increase_ - f_status_t f_fss_nameds_increase(const f_number_unsigned_t step, f_fss_nameds_t * const nameds) { - #ifndef _di_level_0_parameter_checking_ - if (!nameds) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + for (j = 0; j < array[i].size; ++j) { - return f_memory_array_increase(step, sizeof(f_fss_named_t), (void **) &nameds->array, &nameds->used, &nameds->size); - } -#endif // _di_f_fss_nameds_increase_ + array[i].array[j].name.start = 1; + array[i].array[j].name.stop = 0; -#ifndef _di_f_fss_nameds_increase_by_ - f_status_t f_fss_nameds_increase_by(const f_number_unsigned_t amount, f_fss_nameds_t * const nameds) { - #ifndef _di_level_0_parameter_checking_ - if (!nameds) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + status = f_string_ranges_adjust(0, &array[i].array[j].objects); + if (F_status_is_error(status)) return status; - return f_memory_array_increase_by(amount, sizeof(f_fss_named_t), (void **) &nameds->array, &nameds->used, &nameds->size); - } -#endif // _di_f_fss_nameds_increase_by_ + status = f_string_rangess_adjust(0, &array[i].array[j].contents); + if (F_status_is_error(status)) return status; -#ifndef _di_f_fss_nameds_resize_ - f_status_t f_fss_nameds_resize(const f_number_unsigned_t length, f_fss_nameds_t * const nameds) { - #ifndef _di_level_0_parameter_checking_ - if (!nameds) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + status = f_memory_arrays_adjust(0, sizeof(uint8_t), (void **) &array[i].array[j].quotess.array, &array[i].array[j].quotess.used, &array[i].array[j].quotess.size, &f_uint8ss_destroy_callback); + if (F_status_is_error(status)) return status; + } // for + + if (array[i].size) { + status = f_memory_array_adjust(0, sizeof(f_fss_named_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } + } // for + } - return private_f_fss_nameds_resize(length, nameds); + return F_none; } -#endif // _di_f_fss_nameds_resize_ +#endif // _di_f_fss_namedss_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_fss/c/fss/named.h b/level_0/f_fss/c/fss/named.h index 3fedc2b..66cd709 100644 --- a/level_0/f_fss/c/fss/named.h +++ b/level_0/f_fss/c/fss/named.h @@ -46,17 +46,6 @@ extern "C" { macro_f_string_ranges_t_clear(named.objects) \ macro_f_string_rangess_t_clear(named.contents) \ macro_f_uint8ss_t_clear(named.quotess) - - #define macro_f_fss_named_t_resize(status, named, length) status = f_fss_named_resize(length, &named); - #define macro_f_fss_named_t_adjust(status, named, length) status = f_fss_named_adjust(length, &named); - - #define macro_f_fss_named_t_delete_simple(named) f_fss_named_resize(0, &named); - #define macro_f_fss_named_t_destroy_simple(named) f_fss_named_adjust(0, &named); - - #define macro_f_fss_named_t_increase(status, step, named) status = f_fss_named_increase(step, &named); - #define macro_f_fss_named_t_increase_by(status, named, amount) status = f_fss_named_increase_by(amount, &named); - #define macro_f_fss_named_t_decrease_by(status, named, amount) status = f_fss_named_decrease_by(amount, &named); - #define macro_f_fss_named_t_decimate_by(status, named, amount) status = f_fss_named_decimate_by(amount, &named); #endif // _di_f_fss_named_t_ /** @@ -80,295 +69,182 @@ extern "C" { #define macro_f_fss_nameds_t_initialize_1(array, size, used) { array, size, used } #define macro_f_fss_nameds_t_initialize_2(array, length) { array, length, length } - #define macro_f_fss_nameds_t_resize(status, nameds, length) status = f_fss_nameds_resize(length, &nameds); - #define macro_f_fss_nameds_t_adjust(status, nameds, length) status = f_fss_nameds_adjust(length, &nameds); - - #define macro_f_fss_nameds_t_delete_simple(nameds) f_fss_nameds_resize(0, &nameds); - #define macro_f_fss_nameds_t_destroy_simple(nameds) f_fss_nameds_adjust(0, &nameds); - - #define macro_f_fss_nameds_t_increase(status, step, nameds) status = f_fss_nameds_increase(step, &nameds); - #define macro_f_fss_nameds_t_increase_by(status, nameds, amount) status = f_fss_nameds_increase_by(amount, &nameds); - #define macro_f_fss_nameds_t_decrease_by(status, nameds, amount) status = f_fss_nameds_decrease_by(amount, &nameds); - #define macro_f_fss_nameds_t_decimate_by(status, nameds, amount) status = f_fss_nameds_decimate_by(amount, &nameds); + #define macro_f_fss_nameds_t_clear(nameds) macro_f_memory_structures_clear(nameds) #endif // _di_f_fss_nameds_t_ /** - * Resize all parts of the named structure using the same length. + * Delete a named. * - * @param length - * The new size to use. * @param named - * The named structure to adjust. + * The named to delete. * * @return * F_none on success. * - * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. - */ -#ifndef _di_f_fss_named_adjust_ - extern f_status_t f_fss_named_adjust(const f_number_unsigned_t length, f_fss_named_t * const named); -#endif // _di_f_fss_named_adjust_ - -/** - * Resize all parts of the named structure to a smaller size. - * - * This will resize making the array smaller based on (size - given length). - * If the given length is too small, then the resize will fail. - * This will not shrink the size to less than 0. - * - * @param amount - * A positive number representing how much to decimate the size by. - * @param named - * The named array to resize. * - * @return - * F_none on success. - * F_data_not if amount is 0. + * Errors (with error bit) from: f_string_ranges_resize(). + * Errors (with error bit) from: f_string_rangess_resize(). + * Errors (with error bit) from: f_memory_arrays_resize(). * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. + * @see f_string_ranges_resize() + * @see f_string_rangess_resize() + * @see f_memory_arrays_resize() */ -#ifndef _di_f_fss_named_decimate_by_ - extern f_status_t f_fss_named_decimate_by(const f_number_unsigned_t amount, f_fss_named_t * const named); -#endif // _di_f_fss_named_decimate_by_ +#ifndef _di_f_fss_named_delete_ + extern f_status_t f_fss_named_delete(f_fss_named_t * const named); +#endif // _di_f_fss_named_delete_ /** - * Resize all parts of the named structure to a smaller size. + * Destroy a named. * - * This will resize making the array smaller based on (size - given length). - * If the given length is too small, then the resize will fail. - * This will not shrink the size to less than 0. - * - * @param amount - * A positive number representing how much to decrease the size by. * @param named - * The named array to resize. + * The named to destroy. * * @return * F_none on success. - * F_data_not if amount is 0. * - * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. - */ -#ifndef _di_f_fss_named_decrease_by_ - extern f_status_t f_fss_named_decrease_by(const f_number_unsigned_t amount, f_fss_named_t * const named); -#endif // _di_f_fss_named_decrease_by_ - -/** - * Increase the size of all parts of the named structure, but only if necessary. - * - * If the given length is too large for the buffer, then attempt to set max buffer size (F_number_t_size_unsigned_d). - * If already set to the maximum buffer size, then the resize will fail. * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param named - * The named array to resize. + * Errors (with error bit) from: f_string_ranges_adjust(). + * Errors (with error bit) from: f_string_rangess_adjust(). + * Errors (with error bit) from: f_memory_arrays_adjust(). * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. + * @see f_string_ranges_adjust() + * @see f_string_rangess_adjust() + * @see f_memory_arrays_adjust() */ -#ifndef _di_f_fss_named_increase_ - extern f_status_t f_fss_named_increase(const f_number_unsigned_t step, f_fss_named_t * const named); -#endif // _di_f_fss_named_increase_ +#ifndef _di_f_fss_named_destroy_ + extern f_status_t f_fss_named_destroy(f_fss_named_t * const named); +#endif // _di_f_fss_named_destroy_ /** - * Resize all parts of the named structure to a larger size. + * A callback intended to be passed to f_memory_arrays_resize() for an f_nameds_t structure. * - * This will resize making the array larger based on the given length. - * If the given length is too large for the buffer, then attempt to set max buffer size (F_number_t_size_unsigned_d). - * If already set to the maximum buffer size, then the resize will fail. + * This is only called when shrinking the array and generally should perform deallocations. * - * @param amount - * A positive number representing how much to increase the size by. - * @param named - * The named array to resize. + * This does not do parameter checking. * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - * F_array_too_large (with error bit) if the new array length is too large. - */ -#ifndef _di_f_fss_named_increase_by_ - extern f_status_t f_fss_named_increase_by(const f_number_unsigned_t amount, f_fss_named_t * const named); -#endif // _di_f_fss_named_increase_by_ - -/** - * Resize all parts of the named structure using the same length. - * - * @param length - * The new size to use. - * @param named - * The named array to resize. + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return * F_none on success. * - * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. - */ -#ifndef _di_f_fss_named_resize_ - extern f_status_t f_fss_named_resize(const f_number_unsigned_t length, f_fss_named_t * const named); -#endif // _di_f_fss_named_resize_ - -/** - * Adjust the named array. * - * @param length - * The new size to use. - * @param nameds - * The nameds array to adjust. - * - * @return - * Success from f_memory_array_resize(). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_resize(). - * Errors (with error bit) from: f_memory_arrays_resize(). * Errors (with error bit) from: f_string_ranges_resize(). * Errors (with error bit) from: f_string_rangess_resize(). + * Errors (with error bit) from: f_memory_arrays_resize(). * - * @see f_memory_array_resize() - * @see f_memory_arrays_resize() * @see f_string_ranges_resize() * @see f_string_rangess_resize() + * @see f_memory_arrays_resize() */ -#ifndef _di_f_fss_nameds_adjust_ - extern f_status_t f_fss_nameds_adjust(const f_number_unsigned_t length, f_fss_nameds_t * const nameds); -#endif // _di_f_fss_nameds_adjust_ +#ifndef _di_f_fss_nameds_delete_callback_ + extern f_status_t f_fss_nameds_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_fss_nameds_delete_callback_ /** - * Resize the named array to a smaller size. + * A callback intended to be passed to f_memory_arrays_adjust() for an f_nameds_t structure. * - * This will resize making the array smaller based on (size - given length). - * If the given length is too small, then the resize will fail. - * This will not shrink the size to less than 0. + * This is only called when shrinking the array and generally should perform deallocations. * - * @param amount - * A positive number representing how much to decimate the size by. - * @param nameds - * The nameds array to resize. + * This does not do parameter checking. + * + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return * F_none on success. * - * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. - */ -#ifndef _di_f_fss_nameds_decimate_by_ - extern f_status_t f_fss_nameds_decimate_by(const f_number_unsigned_t amount, f_fss_nameds_t * const nameds); -#endif // _di_f_fss_nameds_decimate_by_ - -/** - * Resize the named array to a smaller size. - * - * This will resize making the array smaller based on (size - given length). - * If the given length is too small, then the resize will fail. - * This will not shrink the size to less than 0. * - * @param amount - * A positive number representing how much to decrease the size by. - * @param nameds - * The nameds array to resize. - * - * @return - * F_none on success. + * Errors (with error bit) from: f_string_ranges_adjust(). + * Errors (with error bit) from: f_string_rangess_adjust(). + * Errors (with error bit) from: f_memory_arrays_adjust(). * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. + * @see f_string_ranges_adjust() + * @see f_string_rangess_adjust() + * @see f_memory_arrays_adjust() */ -#ifndef _di_f_fss_nameds_decrease_by_ - extern f_status_t f_fss_nameds_decrease_by(const f_number_unsigned_t amount, f_fss_nameds_t * const nameds); -#endif // _di_f_fss_nameds_decrease_by_ +#ifndef _di_f_fss_nameds_destroy_callback_ + extern f_status_t f_fss_nameds_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_fss_nameds_destroy_callback_ /** - * Increase the size of the nameds array, but only if necessary. + * A callback intended to be passed to f_memory_arrays_resize() for an f_namedss_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. * - * If the given length is too large for the buffer, then attempt to set max buffer size (F_number_t_size_unsigned_d). - * If already set to the maximum buffer size, then the resize will fail. + * This does not do parameter checking. * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param nameds - * The nameds array to resize. + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return - * Success from f_memory_array_increase(). + * F_none on success. * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_memory_array_increase(). + * Errors (with error bit) from: f_string_ranges_resize(). + * Errors (with error bit) from: f_string_rangess_resize(). + * Errors (with error bit) from: f_memory_arrays_resize(). * - * @see f_memory_array_increase() + * @see f_string_ranges_resize() + * @see f_string_rangess_resize() + * @see f_memory_arrays_resize() */ -#ifndef _di_f_fss_nameds_increase_ - extern f_status_t f_fss_nameds_increase(const f_number_unsigned_t step, f_fss_nameds_t * const nameds); -#endif // _di_f_fss_nameds_increase_ +#ifndef _di_f_fss_namedss_delete_callback_ + extern f_status_t f_fss_namedss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_fss_namedss_delete_callback_ /** - * Resize the nameds array to a larger size. + * A callback intended to be passed to f_memory_arrays_adjust() for an f_namedss_t structure. * - * This will resize making the array larger based on the given length. - * If the given length is too large for the buffer, then attempt to set max buffer size (F_number_t_size_unsigned_d). - * If already set to the maximum buffer size, then the resize will fail. + * This is only called when shrinking the array and generally should perform deallocations. * - * @param amount - * A positive number representing how much to increase the size by. - * @param nameds - * The nameds array to resize. + * This does not do parameter checking. * - * @return - * Success from f_memory_array_increase_by(). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_fss_nameds_increase_by_ - extern f_status_t f_fss_nameds_increase_by(const f_number_unsigned_t amount, f_fss_nameds_t * const nameds); -#endif // _di_f_fss_nameds_increase_by_ - -/** - * Resize the nameds array. - * - * @param length - * The new size to use. - * @param nameds - * The nameds array to resize. + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return - * Success from f_memory_array_resize(). + * F_none on success. * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_memory_array_resize(). - * Errors (with error bit) from: f_memory_arrays_resize(). - * Errors (with error bit) from: f_string_ranges_resize(). - * Errors (with error bit) from: f_string_rangess_resize(). + * Errors (with error bit) from: f_string_ranges_adjust(). + * Errors (with error bit) from: f_string_rangess_adjust(). + * Errors (with error bit) from: f_memory_arrays_adjust(). * - * @see f_memory_array_resize() - * @see f_memory_arrays_resize() - * @see f_string_ranges_resize() - * @see f_string_rangess_resize() + * @see f_string_ranges_adjust() + * @see f_string_rangess_adjust() + * @see f_memory_arrays_adjust() */ -#ifndef _di_f_fss_nameds_resize_ - extern f_status_t f_fss_nameds_resize(const f_number_unsigned_t length, f_fss_nameds_t * const nameds); -#endif // _di_f_fss_nameds_resize_ +#ifndef _di_f_fss_namedss_destroy_callback_ + extern f_status_t f_fss_namedss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_fss_namedss_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_fss/c/fss/nest.c b/level_0/f_fss/c/fss/nest.c index a6decb2..50b0ef6 100644 --- a/level_0/f_fss/c/fss/nest.c +++ b/level_0/f_fss/c/fss/nest.c @@ -1,190 +1,220 @@ #include "../fss.h" -#include "private-item.h" -#include "private-nest.h" #ifdef __cplusplus extern "C" { #endif -#ifndef _di_f_fss_nest_adjust_ - f_status_t f_fss_nest_adjust(const f_number_unsigned_t length, f_fss_nest_t * const nest) { +#ifndef _di_f_fss_nest_delete_ + f_status_t f_fss_nest_delete(f_fss_nest_t * const nest) { #ifndef _di_level_0_parameter_checking_ if (!nest) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - return private_f_fss_nest_adjust(length, nest); - } -#endif // _di_f_fss_nest_adjust_ + { + f_status_t status = F_none; + f_number_unsigned_t j = 0; -#ifndef _di_f_fss_nest_decimate_by_ - f_status_t f_fss_nest_decimate_by(const f_number_unsigned_t amount, f_fss_nest_t * const nest) { - #ifndef _di_level_0_parameter_checking_ - if (!nest) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + for (f_number_unsigned_t i = 0; i < nest->size; ++i) { - if (!amount) return F_data_not; + for (j = 0; j < nest->depth[i].size; ++j) { - return private_f_fss_nest_adjust((nest->size > amount) ? nest->size - amount : 0, nest); - } -#endif // _di_f_fss_nest_decimate_by_ + status = f_string_ranges_resize(0, &nest->depth[i].array[j].content); + if (F_status_is_error(status)) return status; + } // for -#ifndef _di_f_fss_nest_decrease_by_ - f_status_t f_fss_nest_decrease_by(const f_number_unsigned_t amount, f_fss_nest_t * const nest) { - #ifndef _di_level_0_parameter_checking_ - if (!nest) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!amount) return F_data_not; + if (nest->depth[i].size) { + status = f_memory_array_resize(0, sizeof(f_fss_item_t), (void **) &nest->depth[i].array, &nest->depth[i].used, &nest->depth[i].size); + if (F_status_is_error(status)) return status; + } + } // for + } - return private_f_fss_nest_resize((nest->size > amount) ? nest->size - amount : 0, nest); + return f_memory_array_resize(0, sizeof(f_fss_items_t), (void **) &nest->depth, &nest->used, &nest->size); } -#endif // _di_f_fss_nest_decrease_by_ +#endif // _di_f_fss_nest_delete_ -#ifndef _di_f_fss_nest_increase_ - f_status_t f_fss_nest_increase(const f_number_unsigned_t step, f_fss_nest_t * const nest) { +#ifndef _di_f_fss_nest_destroy_ + f_status_t f_fss_nest_destroy(f_fss_nest_t * const nest) { #ifndef _di_level_0_parameter_checking_ if (!nest) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (step && nest->used + 1 > nest->size) { - if (nest->used >= F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); + { + f_status_t status = F_none; + f_number_unsigned_t j = 0; + + for (f_number_unsigned_t i = 0; i < nest->size; ++i) { - f_number_unsigned_t length = nest->used + step; + for (j = 0; j < nest->depth[i].size; ++j) { - if (length > F_number_t_size_unsigned_d) { - if (nest->used + 1 > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); + nest->depth[i].array[j].object.start = 1; + nest->depth[i].array[j].object.stop = 0; + nest->depth[i].array[j].parent = 0; - length = F_number_t_size_unsigned_d; - } + status = f_string_ranges_adjust(0, &nest->depth[i].array[j].content); + if (F_status_is_error(status)) return status; + } // for - return private_f_fss_nest_resize(length, nest); + if (nest->depth[i].size) { + status = f_memory_array_adjust(0, sizeof(f_fss_item_t), (void **) &nest->depth[i].array, &nest->depth[i].used, &nest->depth[i].size); + if (F_status_is_error(status)) return status; + } + } // for } - return F_data_not; + return f_memory_array_adjust(0, sizeof(f_fss_items_t), (void **) &nest->depth, &nest->used, &nest->size); } -#endif // _di_f_fss_nest_increase_ +#endif // _di_f_fss_nest_destroy_ -#ifndef _di_f_fss_nest_increase_by_ - f_status_t f_fss_nest_increase_by(const f_number_unsigned_t amount, f_fss_nest_t * const nest) { - #ifndef _di_level_0_parameter_checking_ - if (!nest) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ +#ifndef _di_f_fss_nests_delete_callback_ + f_status_t f_fss_nests_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { - if (amount) { - if (nest->used >= F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); + { + f_fss_nest_t * const array = (f_fss_nest_t *) void_array; + f_status_t status = F_none; + f_number_unsigned_t j = 0; + f_number_unsigned_t k = 0; - const f_number_unsigned_t length = nest->used + amount; + for (f_number_unsigned_t i = start; i < stop; ++i) { - if (length > nest->size) { - if (length > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); + for (j = 0; j < array[i].size; ++j) { - return private_f_fss_nest_resize(length, nest); - } + for (k = 0; k < array[i].depth[j].size; ++k) { + + status = f_string_ranges_resize(0, &array[i].depth[j].array[k].content); + if (F_status_is_error(status)) return status; + } // for + + if (array[i].depth[j].size) { + status = f_memory_array_resize(0, sizeof(f_fss_item_t), (void **) &array[i].depth[j].array, &array[i].depth[j].used, &array[i].depth[j].size); + if (F_status_is_error(status)) return status; + } + } // for + } // for } - return F_data_not; + return F_none; } -#endif // _di_f_fss_nest_increase_by_ +#endif // _di_f_fss_nests_delete_callback_ -#ifndef _di_f_fss_nest_resize_ - f_status_t f_fss_nest_resize(const f_number_unsigned_t length, f_fss_nest_t * const nest) { - #ifndef _di_level_0_parameter_checking_ - if (!nest) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ +#ifndef _di_f_fss_nests_destroy_callback_ + f_status_t f_fss_nests_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { - return private_f_fss_nest_resize(length, nest); - } -#endif // _di_f_fss_nest_resize_ + { + f_fss_nest_t * const array = (f_fss_nest_t *) void_array; + f_status_t status = F_none; + f_number_unsigned_t j = 0; + f_number_unsigned_t k = 0; -#ifndef _di_f_fss_nests_adjust_ - f_status_t f_fss_nests_adjust(const f_number_unsigned_t length, f_fss_nests_t * const nests) { - #ifndef _di_level_0_parameter_checking_ - if (!nests) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + for (f_number_unsigned_t i = start; i < stop; ++i) { - return private_f_fss_nests_adjust(length, nests); - } -#endif // _di_f_fss_nests_adjust_ + for (j = 0; j < array[i].size; ++j) { -#ifndef _di_f_fss_nests_decimate_by_ - f_status_t f_fss_nests_decimate_by(const f_number_unsigned_t amount, f_fss_nests_t * const nests) { - #ifndef _di_level_0_parameter_checking_ - if (!nests) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + for (k = 0; k < array[i].depth[j].size; ++k) { - if (!amount) return F_data_not; + array[i].depth[j].array[k].object.start = 1; + array[i].depth[j].array[k].object.stop = 0; + array[i].depth[j].array[k].parent = 0; + + status = f_string_ranges_adjust(0, &array[i].depth[j].array[k].content); + if (F_status_is_error(status)) return status; + } // for + + if (array[i].depth[j].size) { + status = f_memory_array_adjust(0, sizeof(f_fss_item_t), (void **) &array[i].depth[j].array, &array[i].depth[j].used, &array[i].depth[j].size); + if (F_status_is_error(status)) return status; + } + } // for + } // for + } - return private_f_fss_nests_adjust((nests->size > amount) ? nests->size - amount : 0, nests); + return F_none; } -#endif // _di_f_fss_nests_decimate_by_ +#endif // _di_f_fss_nests_destroy_callback_ -#ifndef _di_f_fss_nests_decrease_by_ - f_status_t f_fss_nests_decrease_by(const f_number_unsigned_t amount, f_fss_nests_t * const nests) { - #ifndef _di_level_0_parameter_checking_ - if (!nests) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ +#ifndef _di_f_fss_nestss_delete_callback_ + f_status_t f_fss_nestss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { - if (!amount) return F_data_not; + { + f_fss_nests_t * const array = (f_fss_nests_t *) void_array; + f_status_t status = F_none; + f_number_unsigned_t j = 0; + f_number_unsigned_t k = 0; + f_number_unsigned_t l = 0; - return private_f_fss_nests_resize((nests->size > amount) ? nests->size - amount : 0, nests); - } -#endif // _di_f_fss_nests_decrease_by_ + for (f_number_unsigned_t i = start; i < stop; ++i) { -#ifndef _di_f_fss_nests_increase_ - f_status_t f_fss_nests_increase(const f_number_unsigned_t step, f_fss_nests_t * const nests) { - #ifndef _di_level_0_parameter_checking_ - if (!nests) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + for (j = 0; j < array[i].size; ++j) { - if (step && nests->used + 1 > nests->size) { - if (nests->used >= F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); + for (k = 0; k < array[i].array[j].size; ++k) { - f_number_unsigned_t length = nests->used + step; + for (l = 0; l < array[i].array[j].depth[k].size; ++l) { - if (length > F_number_t_size_unsigned_d) { - if (nests->used + 1 > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); + status = f_string_ranges_resize(0, &array[i].array[j].depth[k].array[l].content); + if (F_status_is_error(status)) return status; + } // for - length = F_number_t_size_unsigned_d; - } + if (array[i].array[j].depth[k].size) { + status = f_memory_array_resize(0, sizeof(f_fss_item_t), (void **) &array[i].array[j].depth[k].array, &array[i].array[j].depth[k].used, &array[i].array[j].depth[k].size); + if (F_status_is_error(status)) return status; + } + } // for + } // for - return private_f_fss_nests_resize(length, nests); + if (array[i].size) { + status = f_memory_array_resize(0, sizeof(f_fss_nest_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } + } // for } - return F_data_not; + return F_none; } -#endif // _di_f_fss_nests_increase_ +#endif // _di_f_fss_nestss_delete_callback_ -#ifndef _di_f_fss_nests_increase_by_ - f_status_t f_fss_nests_increase_by(const f_number_unsigned_t amount, f_fss_nests_t * const nests) { - #ifndef _di_level_0_parameter_checking_ - if (!nests) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ +#ifndef _di_f_fss_nestss_destroy_callback_ + f_status_t f_fss_nestss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { - if (amount) { - if (nests->used >= F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); + { + f_fss_nests_t * const array = (f_fss_nests_t *) void_array; + f_status_t status = F_none; + f_number_unsigned_t j = 0; + f_number_unsigned_t k = 0; + f_number_unsigned_t l = 0; - const f_number_unsigned_t length = nests->used + amount; + for (f_number_unsigned_t i = start; i < stop; ++i) { - if (length > nests->size) { - if (length > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); + for (j = 0; j < array[i].size; ++j) { - return private_f_fss_nests_resize(length, nests); - } - } + for (k = 0; k < array[i].array[j].size; ++k) { - return F_data_not; - } -#endif // _di_f_fss_nests_increase_by_ + for (l = 0; l < array[i].array[j].depth[k].size; ++l) { -#ifndef _di_f_fss_nests_resize_ - f_status_t f_fss_nests_resize(const f_number_unsigned_t length, f_fss_nests_t * const nests) { - #ifndef _di_level_0_parameter_checking_ - if (!nests) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + array[i].array[j].depth[k].array[l].object.start = 1; + array[i].array[j].depth[k].array[l].object.stop = 0; + array[i].array[j].depth[k].array[l].parent = 0; + + status = f_string_ranges_adjust(0, &array[i].array[j].depth[k].array[l].content); + if (F_status_is_error(status)) return status; + } // for + + if (array[i].array[j].depth[k].size) { + status = f_memory_array_adjust(0, sizeof(f_fss_item_t), (void **) &array[i].array[j].depth[k].array, &array[i].array[j].depth[k].used, &array[i].array[j].depth[k].size); + if (F_status_is_error(status)) return status; + } + } // for + } // for + + if (array[i].size) { + status = f_memory_array_adjust(0, sizeof(f_fss_nest_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } + } // for + } - return private_f_fss_nests_resize(length, nests); + return F_none; } -#endif // _di_f_fss_nests_resize_ +#endif // _di_f_fss_nestss_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_fss/c/fss/nest.h b/level_0/f_fss/c/fss/nest.h index 42ba73a..1e5cd0e 100644 --- a/level_0/f_fss/c/fss/nest.h +++ b/level_0/f_fss/c/fss/nest.h @@ -42,17 +42,6 @@ extern "C" { #define macro_f_fss_nest_t_initialize_2(depth, length) { depth, length, length } #define macro_f_fss_nest_t_clear(nest) macro_f_memory_structures_clear(nest) - - #define macro_f_fss_nest_t_resize(status, nest, length) status = f_fss_nest_resize(length, &nest); - #define macro_f_fss_nest_t_adjust(status, nest, length) status = f_fss_nest_adjust(length, &nest); - - #define macro_f_fss_nest_t_delete_simple(nest) f_fss_nest_resize(0, &nest); - #define macro_f_fss_nest_t_destroy_simple(nest) f_fss_nest_adjust(0, &nest); - - #define macro_f_fss_nest_t_increase(status, step, nest) status = f_fss_nest_increase(step, &nest); - #define macro_f_fss_nest_t_increase_by(status, nest, amount) status = f_fss_nest_increase_by(amount, &nest); - #define macro_f_fss_nest_t_decrease_by(status, nest, amount) status = f_fss_nest_decrease_by(amount, &nest); - #define macro_f_fss_nest_t_decimate_by(status, nest, amount) status = f_fss_nest_decimate_by(amount, &nest); #endif // _di_f_fss_nest_t_ /** @@ -77,289 +66,159 @@ extern "C" { #define macro_f_fss_nests_t_initialize_2(array, length) { array, length, length } #define macro_f_fss_nests_t_clear(nests) macro_f_memory_structures_clear(nests) - - #define macro_f_fss_nests_t_resize(status, nests, length) status = f_fss_nests_resize(length, &nests); - #define macro_f_fss_nests_t_adjust(status, nests, length) status = f_fss_nests_adjust(length, &nests); - - #define macro_f_fss_nests_t_delete_simple(nests) f_fss_nests_resize(0, &nests); - #define macro_f_fss_nests_t_destroy_simple(nests) f_fss_nests_adjust(0, &nests); - - #define macro_f_fss_nests_t_increase(status, step, nests) status = f_fss_nests_increase(step, &nests); - #define macro_f_fss_nests_t_increase_by(status, nests, amount) status = f_fss_nests_increase_by(amount, &nests); - #define macro_f_fss_nests_t_decrease_by(status, nests, amount) status = f_fss_nests_decrease_by(amount, &nests); - #define macro_f_fss_nests_t_decimate_by(status, nests, amount) status = f_fss_nests_decimate_by(amount, &nests); #endif // _di_f_fss_nests_t_ /** - * Resize the nest array. + * Delete a nest. * - * @param length - * The new size to use. * @param nest - * The nest array to resize. + * The nest to delete. * * @return * F_none on success. * - * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. - */ -#ifndef _di_f_fss_nest_adjust_ - extern f_status_t f_fss_nest_adjust(const f_number_unsigned_t length, f_fss_nest_t * const nest); -#endif // _di_f_fss_nest_adjust_ - -/** - * Resize the nest array to a smaller size. * - * This will resize making the array smaller based on (size - given length). - * If the given length is too small, then the resize will fail. - * This will not shrink the size to less than 0. + * Errors (with error bit) from: f_string_ranges_resize(). * - * @param amount - * A positive number representing how much to decimate the size by. - * @param nest - * The nest array to resize. - * - * @return - * F_none on success. - * F_data_not if amount is 0. - * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. + * @see f_string_ranges_resize() */ -#ifndef _di_f_fss_nest_decimate_by_ - extern f_status_t f_fss_nest_decimate_by(const f_number_unsigned_t amount, f_fss_nest_t * const nest); -#endif // _di_f_fss_nest_decimate_by_ +#ifndef _di_f_fss_nest_delete_ + extern f_status_t f_fss_nest_delete(f_fss_nest_t * const nest); +#endif // _di_f_fss_nest_delete_ /** - * Resize the nest array to a smaller size. - * - * This will resize making the array smaller based on (size - given length). - * If the given length is too small, then the resize will fail. - * This will not shrink the size to less than 0. + * Destroy a nest. * - * @param amount - * A positive number representing how much to decrease the size by. * @param nest - * The nest array to resize. + * The nest to destroy. * * @return * F_none on success. * - * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. - */ -#ifndef _di_f_fss_nest_decrease_by_ - extern f_status_t f_fss_nest_decrease_by(const f_number_unsigned_t amount, f_fss_nest_t * const nest); -#endif // _di_f_fss_nest_decrease_by_ - -/** - * Increase the size of the nest array, but only if necessary. - * - * If the given length is too large for the buffer, then attempt to set max buffer size (F_number_t_size_unsigned_d). - * If already set to the maximum buffer size, then the resize will fail. * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param nest - * The nest array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). + * Errors (with error bit) from: f_memory_array_resize(). + * Errors (with error bit) from: f_string_ranges_resize(). * - * F_array_too_large (with error bit) if the new array length is too large. - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. + * @see f_memory_array_resize() + * @see f_string_ranges_resize() */ -#ifndef _di_f_fss_nest_increase_ - extern f_status_t f_fss_nest_increase(const f_number_unsigned_t step, f_fss_nest_t * const nest); -#endif // _di_f_fss_nest_increase_ +#ifndef _di_f_fss_nest_destroy_ + extern f_status_t f_fss_nest_destroy(f_fss_nest_t * const nest); +#endif // _di_f_fss_nest_destroy_ /** - * Resize the nest array to a larger size. + * A callback intended to be passed to f_memory_arrays_resize() for an f_nests_t structure. * - * This will resize making the array larger based on the given length. - * If the given length is too large for the buffer, then attempt to set max buffer size (F_number_t_size_unsigned_d). - * If already set to the maximum buffer size, then the resize will fail. + * This is only called when shrinking the array and generally should perform deallocations. * - * @param amount - * A positive number representing how much to increase the size by. - * @param nest - * The nest array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - * F_array_too_large (with error bit) if the new array length is too large. - */ -#ifndef _di_f_fss_nest_increase_by_ - extern f_status_t f_fss_nest_increase_by(const f_number_unsigned_t amount, f_fss_nest_t * const nest); -#endif // _di_f_fss_nest_increase_by_ - -/** - * Resize the nest array. + * This does not do parameter checking. * - * @param length - * The new size to use. - * @param nest - * The nest array to adjust. + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return * F_none on success. * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - */ -#ifndef _di_f_fss_nest_resize_ - extern f_status_t f_fss_nest_resize(const f_number_unsigned_t length, f_fss_nest_t * const nest); -#endif // _di_f_fss_nest_resize_ - -/** - * Resize the nest array. - * - * @param length - * The new size to use. - * @param nests - * The nests array to adjust. - * - * @return - * Success from f_memory_array_adjust(). - * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_memory_array_adjust(). + * Errors (with error bit) from: f_string_dynamics_resize(). * - * @see f_memory_array_adjust() + * @see f_string_dynamics_resize() */ -#ifndef _di_f_fss_nests_adjust_ - extern f_status_t f_fss_nests_adjust(const f_number_unsigned_t length, f_fss_nests_t * const nests); -#endif // _di_f_fss_nests_adjust_ +#ifndef _di_f_fss_nests_delete_callback_ + extern f_status_t f_fss_nests_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_fss_nests_delete_callback_ /** - * Resize the nest array to a smaller size. + * A callback intended to be passed to f_memory_arrays_adjust() for an f_nests_t structure. * - * This will resize making the array smaller based on (size - given length). - * If the given length is too small, then the resize will fail. - * This will not shrink the size to less than 0. - * - * @param amount - * A positive number representing how much to decimate the size by. - * @param nests - * The nests array to resize. - * - * @return - * Success from f_memory_array_adjust(). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_adjust(). - * - * @see f_memory_array_adjust() - */ -#ifndef _di_f_fss_nests_decimate_by_ - extern f_status_t f_fss_nests_decimate_by(const f_number_unsigned_t amount, f_fss_nests_t * const nests); -#endif // _di_f_fss_nests_decimate_by_ - -/** - * Resize the nest array to a smaller size. + * This is only called when shrinking the array and generally should perform deallocations. * - * This will resize making the array smaller based on (size - given length). - * If the given length is too small, then the resize will fail. - * This will not shrink the size to less than 0. + * This does not do parameter checking. * - * @param amount - * A positive number representing how much to decrease the size by. - * @param nests - * The nests array to resize. + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return - * Success from f_memory_array_resize(). + * F_none on success. * * 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_dynamics_adjust(). * - * @see f_memory_array_resize() + * @see f_string_dynamics_adjust() */ -#ifndef _di_f_fss_nests_decrease_by_ - extern f_status_t f_fss_nests_decrease_by(const f_number_unsigned_t amount, f_fss_nests_t * const nests); -#endif // _di_f_fss_nests_decrease_by_ +#ifndef _di_f_fss_nests_destroy_callback_ + extern f_status_t f_fss_nests_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_fss_nests_destroy_callback_ /** - * Increase the size of the nests array, but only if necessary. + * A callback intended to be passed to f_memory_arrays_resize() for an f_nestss_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. * - * If the given length is too large for the buffer, then attempt to set max buffer size (F_number_t_size_unsigned_d). - * If already set to the maximum buffer size, then the resize will fail. + * This does not do parameter checking. * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param nests - * The nests array to resize. + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return - * Success from f_memory_array_increase(). + * F_none on success. * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_memory_array_increase(). + * Errors (with error bit) from: f_string_dynamics_resize(). * - * @see f_memory_array_increase() + * @see f_string_dynamics_resize() */ -#ifndef _di_f_fss_nests_increase_ - extern f_status_t f_fss_nests_increase(const f_number_unsigned_t step, f_fss_nests_t * const nests); -#endif // _di_f_fss_nests_increase_ +#ifndef _di_f_fss_nestss_delete_callback_ + extern f_status_t f_fss_nestss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_fss_nestss_delete_callback_ /** - * Resize the nests array to a larger size. - * - * This will resize making the array larger based on the given length. - * If the given length is too large for the buffer, then attempt to set max buffer size (F_number_t_size_unsigned_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param amount - * A positive number representing how much to increase the size by. - * @param nests - * The nests array to resize. - * - * @return - * Success from f_memory_array_increase_by(). + * A callback intended to be passed to f_memory_arrays_adjust() for an f_nestss_t structure. * - * F_parameter (with error bit) if a parameter is invalid. + * This is only called when shrinking the array and generally should perform deallocations. * - * Errors (with error bit) from: f_memory_array_increase_by(). + * This does not do parameter checking. * - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_fss_nests_increase_by_ - extern f_status_t f_fss_nests_increase_by(const f_number_unsigned_t amount, f_fss_nests_t * const nests); -#endif // _di_f_fss_nests_increase_by_ - -/** - * Resize the nests array. - * - * @param length - * The new size to use. - * @param nests - * The nests array to resize. + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return - * Success from f_memory_array_resize(). + * F_none on success. * * 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_dynamics_adjust(). * - * @see f_memory_array_resize() + * @see f_string_dynamics_adjust() */ -#ifndef _di_f_fss_nests_resize_ - extern f_status_t f_fss_nests_resize(const f_number_unsigned_t length, f_fss_nests_t * const nests); -#endif // _di_f_fss_nests_resize_ +#ifndef _di_f_fss_nestss_destroy_callback_ + extern f_status_t f_fss_nestss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_fss_nestss_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_fss/c/fss/private-named.c b/level_0/f_fss/c/fss/private-named.c index 0380c1b..3f6977d 100644 --- a/level_0/f_fss/c/fss/private-named.c +++ b/level_0/f_fss/c/fss/private-named.c @@ -14,7 +14,7 @@ extern "C" { status = f_string_rangess_adjust(length, &named->contents); if (F_status_is_error(status)) return status; - status = f_memory_arrays_adjust(length, sizeof(f_uint8s_t), (void **) &named->quotess.array, &named->quotess.used, &named->quotess.size, &f_uint8s_resize_callback); + status = f_memory_arrays_adjust(length, sizeof(f_uint8s_t), (void **) &named->quotess.array, &named->quotess.used, &named->quotess.size, &f_uint8s_delete_callback); if (F_status_is_error(status)) return status; return F_none; @@ -30,7 +30,7 @@ extern "C" { status = f_string_rangess_resize(length, &named->contents); if (F_status_is_error(status)) return status; - status = f_memory_arrays_resize(length, sizeof(f_uint8s_t), (void **) &named->quotess.array, &named->quotess.used, &named->quotess.size, &f_uint8s_resize_callback); + status = f_memory_arrays_resize(length, sizeof(f_uint8s_t), (void **) &named->quotess.array, &named->quotess.used, &named->quotess.size, &f_uint8s_delete_callback); if (F_status_is_error(status)) return status; return F_none; diff --git a/level_0/f_fss/c/fss/private-set_quote.c b/level_0/f_fss/c/fss/private-set_quote.c index 3555bf4..1b477db 100644 --- a/level_0/f_fss/c/fss/private-set_quote.c +++ b/level_0/f_fss/c/fss/private-set_quote.c @@ -17,7 +17,7 @@ extern "C" { status = f_memory_array_adjust(length, sizeof(uint8_t), (void **) &set_quote->objects_quote.array, &set_quote->objects_quote.used, &set_quote->objects_quote.size); if (F_status_is_error(status)) return status; - status = f_memory_arrays_adjust(length, sizeof(f_uint8s_t), (void **) &set_quote->contents_quote.array, &set_quote->contents_quote.used, &set_quote->contents_quote.size, &f_uint8s_resize_callback); + status = f_memory_arrays_adjust(length, sizeof(f_uint8s_t), (void **) &set_quote->contents_quote.array, &set_quote->contents_quote.used, &set_quote->contents_quote.size, &f_uint8s_delete_callback); if (F_status_is_error(status)) return status; return F_none; @@ -36,7 +36,7 @@ extern "C" { status = f_memory_array_resize(length, sizeof(uint8_t), (void **) &set_quote->objects_quote.array, &set_quote->objects_quote.used, &set_quote->objects_quote.size); if (F_status_is_error(status)) return status; - status = f_memory_arrays_resize(length, sizeof(f_uint8s_t), (void **) &set_quote->contents_quote.array, &set_quote->contents_quote.used, &set_quote->contents_quote.size, &f_uint8s_resize_callback); + status = f_memory_arrays_resize(length, sizeof(f_uint8s_t), (void **) &set_quote->contents_quote.array, &set_quote->contents_quote.used, &set_quote->contents_quote.size, &f_uint8s_delete_callback); if (F_status_is_error(status)) return status; return F_none; @@ -60,7 +60,7 @@ extern "C" { status = f_memory_array_adjust(0, sizeof(uint8_t), (void **) &set_quotes->array[i].objects_quote.array, &set_quotes->array[i].objects_quote.used, &set_quotes->array[i].objects_quote.size); if (F_status_is_error(status)) return status; - status = f_memory_arrays_adjust(0, sizeof(f_uint8s_t), (void **) &set_quotes->array[i].contents_quote.array, &set_quotes->array[i].contents_quote.used, &set_quotes->array[i].contents_quote.size, &f_uint8s_resize_callback); + status = f_memory_arrays_adjust(0, sizeof(f_uint8s_t), (void **) &set_quotes->array[i].contents_quote.array, &set_quotes->array[i].contents_quote.used, &set_quotes->array[i].contents_quote.size, &f_uint8s_delete_callback); if (F_status_is_error(status)) return status; } // for } @@ -86,7 +86,7 @@ extern "C" { status = f_memory_array_resize(0, sizeof(uint8_t), (void **) &set_quotes->array[i].objects_quote.array, &set_quotes->array[i].objects_quote.used, &set_quotes->array[i].objects_quote.size); if (F_status_is_error(status)) return status; - status = f_memory_arrays_resize(0, sizeof(f_uint8s_t), (void **) &set_quotes->array[i].contents_quote.array, &set_quotes->array[i].contents_quote.used, &set_quotes->array[i].contents_quote.size, &f_uint8s_resize_callback); + status = f_memory_arrays_resize(0, sizeof(f_uint8s_t), (void **) &set_quotes->array[i].contents_quote.array, &set_quotes->array[i].contents_quote.used, &set_quotes->array[i].contents_quote.size, &f_uint8s_delete_callback); if (F_status_is_error(status)) return status; } // for } diff --git a/level_0/f_fss/c/fss/set.c b/level_0/f_fss/c/fss/set.c index 18c4aaf..397ebc8 100644 --- a/level_0/f_fss/c/fss/set.c +++ b/level_0/f_fss/c/fss/set.c @@ -1,163 +1,146 @@ #include "../fss.h" -#include "private-set.h" #ifdef __cplusplus extern "C" { #endif -#ifndef _di_f_fss_set_adjust_ - f_status_t f_fss_set_adjust(const f_number_unsigned_t length, f_fss_set_t * const set) { +#ifndef _di_f_fss_set_delete_ + f_status_t f_fss_set_delete(f_fss_set_t * const set) { #ifndef _di_level_0_parameter_checking_ if (!set) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - return private_f_fss_set_adjust(length, set); - } -#endif // _di_f_fss_set_adjust_ - -#ifndef _di_f_fss_set_decimate_by_ - f_status_t f_fss_set_decimate_by(const f_number_unsigned_t amount, f_fss_set_t * const set) { - #ifndef _di_level_0_parameter_checking_ - if (!set) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + { + f_status_t status = f_string_ranges_resize(0, &set->objects); + if (F_status_is_error(status)) return status; - if (!amount) return F_data_not; + status = f_string_rangess_resize(0, &set->contents); + if (F_status_is_error(status)) return status; + } - return private_f_fss_set_adjust((set->objects.size - amount > 0) ? set->objects.size - amount : 0, set); + return F_none; } -#endif // _di_f_fss_set_decimate_by_ +#endif // _di_f_fss_set_delete_ -#ifndef _di_f_fss_set_decrease_by_ - f_status_t f_fss_set_decrease_by(const f_number_unsigned_t amount, f_fss_set_t * const set) { +#ifndef _di_f_fss_set_destroy_ + f_status_t f_fss_set_destroy(f_fss_set_t * const set) { #ifndef _di_level_0_parameter_checking_ if (!set) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!amount) return F_data_not; + { + f_status_t status = f_string_ranges_adjust(0, &set->objects); + if (F_status_is_error(status)) return status; - return private_f_fss_set_resize((set->objects.size - amount > 0) ? set->objects.size - amount : 0, set); - } -#endif // _di_f_fss_set_decrease_by_ + status = f_string_rangess_adjust(0, &set->contents); + if (F_status_is_error(status)) return status; + } -#ifndef _di_f_fss_set_increase_ - f_status_t f_fss_set_increase(const f_number_unsigned_t step, f_fss_set_t * const set) { - #ifndef _di_level_0_parameter_checking_ - if (!set) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + return F_none; + } +#endif // _di_f_fss_set_destroy_ - if (step && set->objects.used + 1 > set->objects.size) { - if (set->objects.used >= F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); +#ifndef _di_f_fss_sets_delete_callback_ + f_status_t f_fss_sets_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { - f_number_unsigned_t length = set->objects.used + step; + { + f_fss_set_t * const array = (f_fss_set_t *) void_array; + f_status_t status = F_none; - if (length > F_number_t_size_unsigned_d) { - if (set->objects.used + 1 > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); + for (f_number_unsigned_t i = start; i < stop; ++i) { - length = F_number_t_size_unsigned_d; - } + status = f_string_ranges_resize(0, &array[i].objects); + if (F_status_is_error(status)) return status; - return private_f_fss_set_resize(length, set); + status = f_string_rangess_resize(0, &array[i].contents); + if (F_status_is_error(status)) return status; + } // for } - return F_data_not; + return F_none; } -#endif // _di_f_fss_set_increase_ +#endif // _di_f_fss_sets_delete_callback_ -#ifndef _di_f_fss_set_increase_by_ - f_status_t f_fss_set_increase_by(const f_number_unsigned_t amount, f_fss_set_t * const set) { - #ifndef _di_level_0_parameter_checking_ - if (!set) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ +#ifndef _di_f_fss_sets_destroy_callback_ + f_status_t f_fss_sets_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { - if (amount) { - if (set->objects.used >= F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); + { + f_fss_set_t * const array = (f_fss_set_t *) void_array; + f_status_t status = F_none; - const f_number_unsigned_t length = set->objects.used + amount; + for (f_number_unsigned_t i = start; i < stop; ++i) { - if (length > set->objects.size) { - if (length > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); + status = f_string_ranges_adjust(0, &array[i].objects); + if (F_status_is_error(status)) return status; - return private_f_fss_set_resize(length, set); - } + status = f_string_rangess_adjust(0, &array[i].contents); + if (F_status_is_error(status)) return status; + } // for } - return F_data_not; + return F_none; } -#endif // _di_f_fss_set_increase_by_ +#endif // _di_f_fss_sets_destroy_callback_ -#ifndef _di_f_fss_set_resize_ - f_status_t f_fss_set_resize(const f_number_unsigned_t length, f_fss_set_t * const set) { - #ifndef _di_level_0_parameter_checking_ - if (!set) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ +#ifndef _di_f_fss_setss_delete_callback_ + f_status_t f_fss_setss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { - return private_f_fss_set_resize(length, set); - } -#endif // _di_f_fss_set_resize_ + { + f_fss_sets_t * const array = (f_fss_sets_t *) void_array; + f_status_t status = F_none; + f_number_unsigned_t j = 0; -#ifndef _di_f_fss_sets_adjust_ - f_status_t f_fss_sets_adjust(const f_number_unsigned_t length, f_fss_sets_t *sets) { - #ifndef _di_level_0_parameter_checking_ - if (!sets) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + for (f_number_unsigned_t i = start; i < stop; ++i) { - return private_f_fss_sets_adjust(length, sets); - } -#endif // _di_f_fss_sets_adjust_ + for (j = 0; j < array[i].size; ++j) { -#ifndef _di_f_fss_sets_decimate_by_ - f_status_t f_fss_sets_decimate_by(const f_number_unsigned_t amount, f_fss_sets_t * const sets) { - #ifndef _di_level_0_parameter_checking_ - if (!sets) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + status = f_string_ranges_resize(0, &array[i].array[j].objects); + if (F_status_is_error(status)) return status; + + status = f_string_rangess_resize(0, &array[i].array[j].contents); + if (F_status_is_error(status)) return status; + } // for - if (!amount) return F_data_not; + if (array[i].size) { + status = f_memory_array_resize(0, sizeof(f_fss_set_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } + } // for + } - return private_f_fss_sets_adjust((sets->size > amount) ? sets->size - amount : 0, sets); + return F_none; } -#endif // _di_f_fss_sets_decimate_by_ +#endif // _di_f_fss_setss_delete_callback_ -#ifndef _di_f_fss_sets_decrease_by_ - f_status_t f_fss_sets_decrease_by(const f_number_unsigned_t amount, f_fss_sets_t * const sets) { - #ifndef _di_level_0_parameter_checking_ - if (!sets) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ +#ifndef _di_f_fss_setss_destroy_callback_ + f_status_t f_fss_setss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { - if (!amount) return F_data_not; + { + f_fss_sets_t * const array = (f_fss_sets_t *) void_array; + f_status_t status = F_none; + f_number_unsigned_t j = 0; - return private_f_fss_sets_resize((sets->size > amount) ? sets->size - amount : 0, sets); - } -#endif // _di_f_fss_sets_decrease_by_ + for (f_number_unsigned_t i = start; i < stop; ++i) { -#ifndef _di_f_fss_sets_increase_ - f_status_t f_fss_sets_increase(const f_number_unsigned_t step, f_fss_sets_t * const sets) { - #ifndef _di_level_0_parameter_checking_ - if (!sets) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + for (j = 0; j < array[i].size; ++j) { - return f_memory_array_increase(step, sizeof(f_fss_set_t), (void **) &sets->array, &sets->used, &sets->size); - } -#endif // _di_f_fss_sets_increase_ + status = f_string_ranges_adjust(0, &array[i].array[j].objects); + if (F_status_is_error(status)) return status; -#ifndef _di_f_fss_sets_increase_by_ - f_status_t f_fss_sets_increase_by(const f_number_unsigned_t amount, f_fss_sets_t * const sets) { - #ifndef _di_level_0_parameter_checking_ - if (!sets) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + status = f_string_rangess_adjust(0, &array[i].array[j].contents); + if (F_status_is_error(status)) return status; + } // for - return f_memory_array_increase_by(amount, sizeof(f_fss_set_t), (void **) &sets->array, &sets->used, &sets->size); - } -#endif // _di_f_fss_sets_increase_by_ - -#ifndef _di_f_fss_sets_resize_ - f_status_t f_fss_sets_resize(const f_number_unsigned_t length, f_fss_sets_t * const sets) { - #ifndef _di_level_0_parameter_checking_ - if (!sets) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + if (array[i].size) { + status = f_memory_array_adjust(0, sizeof(f_fss_set_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } + } // for + } - return private_f_fss_sets_resize(length, sets); + return F_none; } -#endif // _di_f_fss_sets_resize_ +#endif // _di_f_fss_setss_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_fss/c/fss/set.h b/level_0/f_fss/c/fss/set.h index 394bf17..44af1f7 100644 --- a/level_0/f_fss/c/fss/set.h +++ b/level_0/f_fss/c/fss/set.h @@ -39,17 +39,6 @@ extern "C" { #define macro_f_fss_set_t_clear(set) \ macro_f_string_ranges_t_clear(set.objects) \ macro_f_string_rangess_t_clear(set.contents) - - #define macro_f_fss_set_t_resize(status, set, length) status = f_fss_set_resize(length, &set); - #define macro_f_fss_set_t_adjust(status, set, length) status = f_fss_set_adjust(length, &set); - - #define macro_f_fss_set_t_delete_simple(set) f_fss_set_resize(0, &set); - #define macro_f_fss_set_t_destroy_simple(set) f_fss_set_adjust(0, &set); - - #define macro_f_fss_set_t_increase(status, step, set) status = f_fss_set_increase(step, &set); - #define macro_f_fss_set_t_increase_by(status, set, amount) status = f_fss_set_increase_by(amount, &set); - #define macro_f_fss_set_t_decrease_by(status, set, amount) status = f_fss_set_decrease_by(amount, &set); - #define macro_f_fss_set_t_decimate_by(status, set, amount) status = f_fss_set_decimate_by(amount, &set); #endif // _di_f_fss_set_t_ /** @@ -73,366 +62,162 @@ extern "C" { #define macro_f_fss_sets_t_initialize_1(array, size, used) { array, size, used } #define macro_f_fss_sets_t_initialize_2(array, length) { array, length, length } - #define macro_f_fss_sets_t_resize(status, sets, length) status = f_fss_sets_resize(length, &sets); - #define macro_f_fss_sets_t_adjust(status, sets, length) status = f_fss_sets_adjust(length, &sets); - - #define macro_f_fss_sets_t_delete_simple(sets) f_fss_sets_resize(0, &sets); - #define macro_f_fss_sets_t_destroy_simple(sets) f_fss_sets_adjust(0, &sets); - - #define macro_f_fss_sets_t_increase(status, step, sets) status = f_fss_sets_increase(step, &sets); - #define macro_f_fss_sets_t_increase_by(status, sets, amount) status = f_fss_sets_increase_by(amount, &sets); - #define macro_f_fss_sets_t_decrease_by(status, sets, amount) status = f_fss_sets_decrease_by(amount, &sets); - #define macro_f_fss_sets_t_decimate_by(status, sets, amount) status = f_fss_sets_decimate_by(amount, &sets); + #define macro_f_fss_sets_t_clear(sets) macro_f_memory_structures_clear(sets) #endif // _di_f_fss_sets_t_ /** - * Resize the set array. + * Delete a set. * - * @param length - * The new size to use. * @param set - * The set array to resize. + * The set to delete. * * @return * F_none on success. * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_string_ranges_adjust(). - * Errors (with error bit) from: f_string_rangess_adjust(). - * - * @see f_string_ranges_adjust() - * @see f_string_rangess_adjust() - */ -#ifndef _di_f_fss_set_adjust_ - extern f_status_t f_fss_set_adjust(const f_number_unsigned_t length, f_fss_set_t * const set); -#endif // _di_f_fss_set_adjust_ - -/** - * Resize the set array to a smaller size. - * - * This will resize making the array smaller based on (size - given length). - * If the given length is too small, then the resize will fail. - * This will not shrink the size to less than 0. - * - * @param amount - * A positive number representing how much to decimate the size by. - * @param set - * The set array to resize. - * - * @return - * F_none on success. - * F_data_not if amount is 0. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_string_ranges_adjust(). - * Errors (with error bit) from: f_string_rangess_adjust(). - * - * @see f_string_ranges_adjust() - * @see f_string_rangess_adjust() - */ -#ifndef _di_f_fss_set_decimate_by_ - extern f_status_t f_fss_set_decimate_by(const f_number_unsigned_t amount, f_fss_set_t * const set); -#endif // _di_f_fss_set_decimate_by_ - -/** - * Resize the set array to a smaller size. - * - * This will resize making the array smaller based on (size - given length). - * If the given length is too small, then the resize will fail. - * This will not shrink the size to less than 0. - * - * @param amount - * A positive number representing how much to decrease the size by. - * @param set - * The set array to resize. - * - * @return - * F_none on success. - * F_data_not if amount is 0. - * - * F_parameter (with error bit) if a parameter is invalid. - * * Errors (with error bit) from: f_string_ranges_resize(). * Errors (with error bit) from: f_string_rangess_resize(). * * @see f_string_ranges_resize() * @see f_string_rangess_resize() */ -#ifndef _di_f_fss_set_decrease_by_ - extern f_status_t f_fss_set_decrease_by(const f_number_unsigned_t amount, f_fss_set_t * const set); -#endif // _di_f_fss_set_decrease_by_ +#ifndef _di_f_fss_set_delete_ + extern f_status_t f_fss_set_delete(f_fss_set_t * const set); +#endif // _di_f_fss_set_delete_ /** - * Increase the size of the set array, but only if necessary. - * - * If the given length is too large for the buffer, then attempt to set max buffer size (F_number_t_size_unsigned_d). - * If already set to the maximum buffer size, then the resize will fail. + * Destroy a set. * - * @param step - * The allocation step to use. - * Must be greater than 0. * @param set - * The set array to resize. + * The set to destroy. * * @return * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). * - * F_array_too_large (with error bit) if the new array length is too large. - * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * - * @return - * Success from f_memory_array_resize(). - * - * 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_ranges_adjust(). + * Errors (with error bit) from: f_string_rangess_adjust(). * - * @see f_memory_array_resize() + * @see f_string_ranges_adjust + * @see f_string_rangess_adjust()() */ -#ifndef _di_f_fss_set_increase_ - extern f_status_t f_fss_set_increase(const f_number_unsigned_t step, f_fss_set_t * const set); -#endif // _di_f_fss_set_increase_ +#ifndef _di_f_fss_set_destroy_ + extern f_status_t f_fss_set_destroy(f_fss_set_t * const set); +#endif // _di_f_fss_set_destroy_ /** - * Resize the set array to a larger size. - * - * This will resize making the array larger based on the given length. - * If the given length is too large for the buffer, then attempt to set max buffer size (F_number_t_size_unsigned_d). - * If already set to the maximum buffer size, then the resize will fail. + * A callback intended to be passed to f_memory_arrays_resize() for an f_sets_t structure. * - * @param amount - * A positive number representing how much to increase the size by. - * @param set - * The set array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - * F_array_too_large (with error bit) if the new array length is too large. - * - * @return - * Success from f_memory_array_resize(). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_resize(). + * This is only called when shrinking the array and generally should perform deallocations. * - * @see f_memory_array_resize() - */ -#ifndef _di_f_fss_set_increase_by_ - extern f_status_t f_fss_set_increase_by(const f_number_unsigned_t amount, f_fss_set_t * const set); -#endif // _di_f_fss_set_increase_by_ - -/** - * Resize the set array. + * This does not do parameter checking. * - * @param length - * The new size to use. - * @param set - * The set array to adjust. + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return * F_none on success. * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - * - * @return - * Success from f_memory_array_resize(). - * * 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_dynamics_resize(). * - * @see f_memory_array_resize() + * @see f_string_dynamics_resize() */ -#ifndef _di_f_fss_set_resize_ - extern f_status_t f_fss_set_resize(const f_number_unsigned_t length, f_fss_set_t * const set); -#endif // _di_f_fss_set_resize_ +#ifndef _di_f_fss_sets_delete_callback_ + extern f_status_t f_fss_sets_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_fss_sets_delete_callback_ /** - * Resize the set array. + * A callback intended to be passed to f_memory_arrays_adjust() for an f_sets_t structure. * - * @param length - * The new size to use. - * @param sets - * The sets array to resize. + * This is only called when shrinking the array and generally should perform deallocations. * - * @return - * F_none on success. + * This does not do parameter checking. * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - * - * @return - * Success from f_memory_array_resize(). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - */ -#ifndef _di_f_fss_sets_adjust_ - extern f_status_t f_fss_sets_adjust(const f_number_unsigned_t length, f_fss_sets_t * const sets); -#endif // _di_f_fss_sets_adjust_ - -/** - * Resize the set array to a smaller size. - * - * This will resize making the array smaller based on (size - given length). - * If the given length is too small, then the resize will fail. - * This will not shrink the size to less than 0. - * - * @param amount - * A positive number representing how much to decimate the size by. - * @param sets - * The sets array to resize. + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return * F_none on success. - * F_data_not if amount is 0. - * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - * - * @return - * Success from f_memory_array_resize(). * * 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_dynamics_adjust(). * - * @see f_memory_array_resize() + * @see f_string_dynamics_adjust() */ -#ifndef _di_f_fss_sets_decimate_by_ - extern f_status_t f_fss_sets_decimate_by(const f_number_unsigned_t amount, f_fss_sets_t * const sets); -#endif // _di_f_fss_sets_decimate_by_ +#ifndef _di_f_fss_sets_destroy_callback_ + extern f_status_t f_fss_sets_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_fss_sets_destroy_callback_ /** - * Resize the set array to a smaller size. + * A callback intended to be passed to f_memory_arrays_resize() for an f_setss_t structure. * - * This will resize making the array smaller based on (size - given length). - * If the given length is too small, then the resize will fail. - * This will not shrink the size to less than 0. + * This is only called when shrinking the array and generally should perform deallocations. * - * @param amount - * A positive number representing how much to decrease the size by. - * @param sets - * The sets array to resize. + * This does not do parameter checking. * - * @return - * F_none on success. - * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - * - * @return - * Success from f_memory_array_resize(). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - */ -#ifndef _di_f_fss_sets_decrease_by_ - extern f_status_t f_fss_sets_decrease_by(const f_number_unsigned_t amount, f_fss_sets_t * const sets); -#endif // _di_f_fss_sets_decrease_by_ - -/** - * Increase the size of the sets array, but only if necessary. - * - * If the given length is too large for the buffer, then attempt to set max buffer size (F_number_t_size_unsigned_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param sets - * The sets array to resize. + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). * - * F_array_too_large (with error bit) if the new array length is too large. - * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * - * @return - * Success from f_memory_array_increase(). + * Errors (with error bit) from: f_string_dynamics_resize(). * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase(). - * - * @see f_memory_array_increase() + * @see f_string_dynamics_resize() */ -#ifndef _di_f_fss_sets_increase_ - extern f_status_t f_fss_sets_increase(const f_number_unsigned_t step, f_fss_sets_t * const sets); -#endif // _di_f_fss_sets_increase_ +#ifndef _di_f_fss_setss_delete_callback_ + extern f_status_t f_fss_setss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_fss_setss_delete_callback_ /** - * Resize the sets array to a larger size. - * - * This will resize making the array larger based on the given length. - * If the given length is too large for the buffer, then attempt to set max buffer size (F_number_t_size_unsigned_d). - * If already set to the maximum buffer size, then the resize will fail. + * A callback intended to be passed to f_memory_arrays_adjust() for an f_setss_t structure. * - * @param amount - * A positive number representing how much to increase the size by. - * @param sets - * The sets array to resize. + * This is only called when shrinking the array and generally should perform deallocations. * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - * F_array_too_large (with error bit) if the new array length is too large. - * - * @return - * Success from f_memory_array_increase_by(). - * - * F_parameter (with error bit) if a parameter is invalid. + * This does not do parameter checking. * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_fss_sets_increase_by_ - extern f_status_t f_fss_sets_increase_by(const f_number_unsigned_t amount, f_fss_sets_t * const sets); -#endif // _di_f_fss_sets_increase_by_ - -/** - * Resize the sets array. - * - * @param length - * The new size to use. - * @param sets - * The sets array to resize. + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return - * Success from f_memory_array_resize(). + * F_none on success. * * 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_dynamics_adjust(). * - * @see f_memory_array_resize() + * @see f_string_dynamics_adjust() */ -#ifndef _di_f_fss_sets_resize_ - extern f_status_t f_fss_sets_resize(const f_number_unsigned_t length, f_fss_sets_t * const sets); -#endif // _di_f_fss_sets_resize_ +#ifndef _di_f_fss_setss_destroy_callback_ + extern f_status_t f_fss_setss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_fss_sets_sdestroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_fss/c/fss/set_quote.c b/level_0/f_fss/c/fss/set_quote.c index 655a69d..d3cebc0 100644 --- a/level_0/f_fss/c/fss/set_quote.c +++ b/level_0/f_fss/c/fss/set_quote.c @@ -1,163 +1,182 @@ #include "../fss.h" -#include "private-set_quote.h" #ifdef __cplusplus extern "C" { #endif -#ifndef _di_f_fss_set_quote_adjust_ - f_status_t f_fss_set_quote_adjust(const f_number_unsigned_t length, f_fss_set_quote_t * const set_quote) { +#ifndef _di_f_fss_set_quote_delete_ + f_status_t f_fss_set_quote_delete(f_fss_set_quote_t * const set_quote) { #ifndef _di_level_0_parameter_checking_ if (!set_quote) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - return private_f_fss_set_quote_adjust(length, set_quote); - } -#endif // _di_f_fss_set_quote_adjust_ + { + f_status_t status = f_string_ranges_resize(0, &set_quote->objects); + if (F_status_is_error(status)) return status; -#ifndef _di_f_fss_set_quote_decimate_by_ - f_status_t f_fss_set_quote_decimate_by(const f_number_unsigned_t amount, f_fss_set_quote_t * const set_quote) { - #ifndef _di_level_0_parameter_checking_ - if (!set_quote) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + status = f_string_rangess_resize(0, &set_quote->contents); + if (F_status_is_error(status)) return status; + + status = f_memory_array_resize(0, sizeof(uint8_t), (void **) &set_quote->objects_quote.array, &set_quote->objects_quote.used, &set_quote->objects_quote.size); + if (F_status_is_error(status)) return status; - if (!amount) return F_data_not; + status = f_memory_arrays_resize(0, sizeof(uint8_t), (void **) &set_quote->contents_quote.array, &set_quote->contents_quote.used, &set_quote->contents_quote.size, &f_uint8ss_delete_callback); + if (F_status_is_error(status)) return status; + } - return private_f_fss_set_quote_adjust((set_quote->objects.size - amount > 0) ? set_quote->objects.size - amount : 0, set_quote); + return F_none; } -#endif // _di_f_fss_set_quote_decimate_by_ +#endif // _di_f_fss_set_quote_delete_ -#ifndef _di_f_fss_set_quote_decrease_by_ - f_status_t f_fss_set_quote_decrease_by(const f_number_unsigned_t amount, f_fss_set_quote_t * const set_quote) { +#ifndef _di_f_fss_set_quote_destroy_ + f_status_t f_fss_set_quote_destroy(f_fss_set_quote_t * const set_quote) { #ifndef _di_level_0_parameter_checking_ if (!set_quote) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!amount) return F_data_not; + { + f_status_t status = f_string_ranges_adjust(0, &set_quote->objects); + if (F_status_is_error(status)) return status; - return private_f_fss_set_quote_resize((set_quote->objects.size - amount > 0) ? set_quote->objects.size - amount : 0, set_quote); + status = f_string_rangess_adjust(0, &set_quote->contents); + if (F_status_is_error(status)) return status; + + status = f_memory_array_adjust(0, sizeof(uint8_t), (void **) &set_quote->objects_quote.array, &set_quote->objects_quote.used, &set_quote->objects_quote.size); + if (F_status_is_error(status)) return status; + + status = f_memory_arrays_adjust(0, sizeof(uint8_t), (void **) &set_quote->contents_quote.array, &set_quote->contents_quote.used, &set_quote->contents_quote.size, &f_uint8ss_destroy_callback); + if (F_status_is_error(status)) return status; + } + + return F_none; } -#endif // _di_f_fss_set_quote_decrease_by_ +#endif // _di_f_fss_set_quote_destroy_ -#ifndef _di_f_fss_set_quote_increase_ - f_status_t f_fss_set_quote_increase(const f_number_unsigned_t step, f_fss_set_quote_t * const set_quote) { - #ifndef _di_level_0_parameter_checking_ - if (!set_quote) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ +#ifndef _di_f_fss_set_quotes_delete_callback_ + f_status_t f_fss_set_quotes_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { + + { + f_fss_set_quote_t * const array = (f_fss_set_quote_t *) void_array; + f_status_t status = F_none; - if (step && set_quote->objects.used + 1 > set_quote->objects.size) { - if (set_quote->objects.used >= F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); + for (f_number_unsigned_t i = start; i < stop; ++i) { - f_number_unsigned_t length = set_quote->objects.used + step; + status = f_string_ranges_resize(0, &array[i].objects); + if (F_status_is_error(status)) return status; - if (length > F_number_t_size_unsigned_d) { - if (set_quote->objects.used + 1 > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); + status = f_string_rangess_resize(0, &array[i].contents); + if (F_status_is_error(status)) return status; - length = F_number_t_size_unsigned_d; - } + status = f_memory_array_resize(0, sizeof(uint8_t), (void **) &array[i].objects_quote.array, &array[i].objects_quote.used, &array[i].objects_quote.size); + if (F_status_is_error(status)) return status; - return private_f_fss_set_quote_resize(length, set_quote); + status = f_memory_arrays_resize(0, sizeof(uint8_t), (void **) &array[i].contents_quote.array, &array[i].contents_quote.used, &array[i].contents_quote.size, &f_uint8ss_delete_callback); + if (F_status_is_error(status)) return status; + } // for } - return F_data_not; + return F_none; } -#endif // _di_f_fss_set_quote_increase_ +#endif // _di_f_fss_set_quotes_delete_callback_ -#ifndef _di_f_fss_set_quote_increase_by_ - f_status_t f_fss_set_quote_increase_by(const f_number_unsigned_t amount, f_fss_set_quote_t * const set_quote) { - #ifndef _di_level_0_parameter_checking_ - if (!set_quote) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ +#ifndef _di_f_fss_set_quotes_destroy_callback_ + f_status_t f_fss_set_quotes_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { + + { + f_fss_set_quote_t * const array = (f_fss_set_quote_t *) void_array; + f_status_t status = F_none; - if (amount) { - if (set_quote->objects.used >= F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); + for (f_number_unsigned_t i = start; i < stop; ++i) { - const f_number_unsigned_t length = set_quote->objects.used + amount; + status = f_string_ranges_adjust(0, &array[i].objects); + if (F_status_is_error(status)) return status; - if (length > set_quote->objects.size) { - if (length > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); + status = f_string_rangess_adjust(0, &array[i].contents); + if (F_status_is_error(status)) return status; - return private_f_fss_set_quote_resize(length, set_quote); - } + status = f_memory_array_adjust(0, sizeof(uint8_t), (void **) &array[i].objects_quote.array, &array[i].objects_quote.used, &array[i].objects_quote.size); + if (F_status_is_error(status)) return status; + + status = f_memory_arrays_adjust(0, sizeof(uint8_t), (void **) &array[i].contents_quote.array, &array[i].contents_quote.used, &array[i].contents_quote.size, &f_uint8ss_destroy_callback); + if (F_status_is_error(status)) return status; + } // for } - return F_data_not; + return F_none; } -#endif // _di_f_fss_set_quote_increase_by_ +#endif // _di_f_fss_set_quotes_destroy_callback_ -#ifndef _di_f_fss_set_quote_resize_ - f_status_t f_fss_set_quote_resize(const f_number_unsigned_t length, f_fss_set_quote_t * const set_quote) { - #ifndef _di_level_0_parameter_checking_ - if (!set_quote) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ +#ifndef _di_f_fss_set_quotess_delete_callback_ + f_status_t f_fss_set_quotess_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { - return private_f_fss_set_quote_resize(length, set_quote); - } -#endif // _di_f_fss_set_quote_resize_ + { + f_fss_set_quotes_t * const array = (f_fss_set_quotes_t *) void_array; + f_status_t status = F_none; + f_number_unsigned_t j = 0; -#ifndef _di_f_fss_set_quotes_adjust_ - f_status_t f_fss_set_quotes_adjust(const f_number_unsigned_t length, f_fss_set_quotes_t * const set_quotes) { - #ifndef _di_level_0_parameter_checking_ - if (!set_quotes) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + for (f_number_unsigned_t i = start; i < stop; ++i) { - return private_f_fss_set_quotes_adjust(length, set_quotes); - } -#endif // _di_f_fss_set_quotes_adjust_ + for (j = 0; j < array[i].size; ++j) { -#ifndef _di_f_fss_set_quotes_decimate_by_ - f_status_t f_fss_set_quotes_decimate_by(const f_number_unsigned_t amount, f_fss_set_quotes_t * const set_quotes) { - #ifndef _di_level_0_parameter_checking_ - if (!set_quotes) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + status = f_string_ranges_resize(0, &array[i].array[j].objects); + if (F_status_is_error(status)) return status; - if (!amount) return F_data_not; + status = f_string_rangess_resize(0, &array[i].array[j].contents); + if (F_status_is_error(status)) return status; - return private_f_fss_set_quotes_adjust((set_quotes->size > amount) ? set_quotes->size - amount : 0, set_quotes); - } -#endif // _di_f_fss_set_quotes_decimate_by_ + status = f_memory_array_resize(0, sizeof(uint8_t), (void **) &array[i].array[j].objects_quote.array, &array[i].array[j].objects_quote.used, &array[i].array[j].objects_quote.size); + if (F_status_is_error(status)) return status; -#ifndef _di_f_fss_set_quotes_decrease_by_ - f_status_t f_fss_set_quotes_decrease_by(const f_number_unsigned_t amount, f_fss_set_quotes_t * const set_quotes) { - #ifndef _di_level_0_parameter_checking_ - if (!set_quotes) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + status = f_memory_arrays_resize(0, sizeof(uint8_t), (void **) &array[i].array[j].contents_quote.array, &array[i].array[j].contents_quote.used, &array[i].array[j].contents_quote.size, &f_uint8ss_delete_callback); + if (F_status_is_error(status)) return status; + } // for - if (!amount) return F_data_not; + if (array[i].size) { + status = f_memory_array_resize(0, sizeof(f_fss_set_quote_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } + } // for + } - return private_f_fss_set_quotes_resize((set_quotes->size > amount) ? set_quotes->size - amount : 0, set_quotes); + return F_none; } -#endif // _di_f_fss_set_quotes_decrease_by_ +#endif // _di_f_fss_set_quotess_delete_callback_ -#ifndef _di_f_fss_set_quotes_increase_ - f_status_t f_fss_set_quotes_increase(const f_number_unsigned_t step, f_fss_set_quotes_t * const set_quotes) { - #ifndef _di_level_0_parameter_checking_ - if (!set_quotes) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ +#ifndef _di_f_fss_set_quotess_destroy_callback_ + f_status_t f_fss_set_quotess_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { - return f_memory_array_increase(step, sizeof(f_fss_set_quote_t), (void **) &set_quotes->array, &set_quotes->used, &set_quotes->size); - } -#endif // _di_f_fss_set_quotes_increase_ + { + f_fss_set_quotes_t * const array = (f_fss_set_quotes_t *) void_array; + f_status_t status = F_none; + f_number_unsigned_t j = 0; -#ifndef _di_f_fss_set_quotes_increase_by_ - f_status_t f_fss_set_quotes_increase_by(const f_number_unsigned_t amount, f_fss_set_quotes_t * const set_quotes) { - #ifndef _di_level_0_parameter_checking_ - if (!set_quotes) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + for (f_number_unsigned_t i = start; i < stop; ++i) { - return f_memory_array_increase_by(amount, sizeof(f_fss_set_quote_t), (void **) &set_quotes->array, &set_quotes->used, &set_quotes->size); - } -#endif // _di_f_fss_set_quotes_increase_by_ + for (j = 0; j < array[i].size; ++j) { -#ifndef _di_f_fss_set_quotes_resize_ - f_status_t f_fss_set_quotes_resize(const f_number_unsigned_t length, f_fss_set_quotes_t * const set_quotes) { - #ifndef _di_level_0_parameter_checking_ - if (!set_quotes) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + status = f_string_ranges_adjust(0, &array[i].array[j].objects); + if (F_status_is_error(status)) return status; + + status = f_string_rangess_adjust(0, &array[i].array[j].contents); + if (F_status_is_error(status)) return status; + + status = f_memory_array_adjust(0, sizeof(uint8_t), (void **) &array[i].array[j].objects_quote.array, &array[i].array[j].objects_quote.used, &array[i].array[j].objects_quote.size); + if (F_status_is_error(status)) return status; + + status = f_memory_arrays_adjust(0, sizeof(uint8_t), (void **) &array[i].array[j].contents_quote.array, &array[i].array[j].contents_quote.used, &array[i].array[j].contents_quote.size, &f_uint8ss_destroy_callback); + if (F_status_is_error(status)) return status; + } // for + + if (array[i].size) { + status = f_memory_array_resize(0, sizeof(f_fss_set_quote_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } + } // for + } - return private_f_fss_set_quotes_resize(length, set_quotes); + return F_none; } -#endif // _di_f_fss_set_quotes_resize_ +#endif // _di_f_fss_set_quotess_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_fss/c/fss/set_quote.h b/level_0/f_fss/c/fss/set_quote.h index ca6458c..bc22edd 100644 --- a/level_0/f_fss/c/fss/set_quote.h +++ b/level_0/f_fss/c/fss/set_quote.h @@ -46,17 +46,6 @@ extern "C" { macro_f_string_rangess_t_clear(set.contents) \ macro_f_uint8s_t_clear(set.objects_quote) \ macro_f_uint8ss_t_clear(set.contents_quote) - - #define macro_f_fss_set_quote_t_resize(status, set_quote, length) status = f_fss_set_quote_resize(length, &set_quote); - #define macro_f_fss_set_quote_t_adjust(status, set_quote, length) status = f_fss_set_quote_adjust(length, &set_quote); - - #define macro_f_fss_set_quote_t_delete_simple(set_quote) f_fss_set_quote_resize(0, &set_quote); - #define macro_f_fss_set_quote_t_destroy_simple(set_quote) f_fss_set_quote_adjust(0, &set_quote); - - #define macro_f_fss_set_quote_t_increase(status, step, set_quote) status = f_fss_set_quote_increase(step, &set_quote); - #define macro_f_fss_set_quote_t_increase_by(status, set_quote, amount) status = f_fss_set_quote_increase_by(amount, &set_quote); - #define macro_f_fss_set_quote_t_decrease_by(status, set_quote, amount) status = f_fss_set_quote_decrease_by(amount, &set_quote); - #define macro_f_fss_set_quote_t_decimate_by(status, set_quote, amount) status = f_fss_set_quote_decimate_by(amount, &set_quote); #endif // _di_f_fss_set_quote_t_ /** @@ -80,402 +69,198 @@ extern "C" { #define macro_f_fss_set_quotes_t_initialize_1(array, size, used) { array, size, used } #define macro_f_fss_set_quotes_t_initialize_2(array, length) { array, length, length } - #define macro_f_fss_set_quotes_t_resize(status, set_quotes, length) status = f_fss_set_quotes_resize(length, &set_quotes); - #define macro_f_fss_set_quotes_t_adjust(status, set_quotes, length) status = f_fss_set_quotes_adjust(length, &set_quotes); - - #define macro_f_fss_set_quotes_t_delete_simple(set_quotes) f_fss_set_quotes_resize(0, &set_quotes); - #define macro_f_fss_set_quotes_t_destroy_simple(set_quotes) f_fss_set_quotes_adjust(0, &set_quotes); - - #define macro_f_fss_set_quotes_t_increase(status, step, set_quotes) status = f_fss_set_quotes_increase(step, &set_quotes); - #define macro_f_fss_set_quotes_t_increase_by(status, set_quotes, amount) status = f_fss_set_quotes_increase_by(amount, &set_quotes); - #define macro_f_fss_set_quotes_t_decrease_by(status, set_quotes, amount) status = f_fss_set_quotes_decrease_by(amount, &set_quotes); - #define macro_f_fss_set_quotes_t_decimate_by(status, set_quotes, amount) status = f_fss_set_quotes_decimate_by(amount, &set_quotes); + #define macro_f_fss_set_quotes_t_clear(set_quotes) macro_f_memory_structures_clear(set_quotes) #endif // _di_f_fss_set_quotes_t_ /** - * Resize the set_quote array. + * Delete a quote set. * - * @param length - * The new size to use. * @param set_quote - * The set_quote array to resize. + * The quote set to delete. * * @return * F_none on success. * - * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_memory_array_adjust(). - * Errors (with error bit) from: f_memory_arrays_adjust(). - * Errors (with error bit) from: f_string_ranges_adjust(). - * Errors (with error bit) from: f_string_rangess_adjust(). + * Errors (with error bit) from: f_string_ranges_resize(). + * Errors (with error bit) from: f_string_rangess_resize(). + * Errors (with error bit) from: f_uint8s_resize(). + * Errors (with error bit) from: f_uint8ss_resize(). * - * @see f_memory_array_adjust() - * @see f_memory_arrays_adjust() - * @see f_string_ranges_adjust() - * @see f_string_rangess_adjust() + * @see f_string_ranges_resize() + * @see f_string_rangess_resize() + * @see f_uint8s_resize() + * @see f_uint8ss_resize() */ -#ifndef _di_f_fss_set_quote_adjust_ - extern f_status_t f_fss_set_quote_adjust(const f_number_unsigned_t length, f_fss_set_quote_t * const set_quote); -#endif // _di_f_fss_set_quote_adjust_ +#ifndef _di_f_fss_set_quote_delete_ + extern f_status_t f_fss_set_quote_delete(f_fss_set_quote_t * const set_quote); +#endif // _di_f_fss_set_quote_delete_ /** - * Resize the set_quote array to a smaller size. - * - * This will resize making the array smaller based on (size - given length). - * If the given length is too small, then the resize will fail. - * This will not shrink the size to less than 0. + * Destroy a quote set. * - * @param amount - * A positive number representing how much to decimate the size by. * @param set_quote - * The set_quote array to resize. + * The quote set to destroy. * * @return * F_none on success. - * F_data_not if amount is 0. * - * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_memory_array_adjust(). - * Errors (with error bit) from: f_memory_arrays_adjust(). * Errors (with error bit) from: f_string_ranges_adjust(). * Errors (with error bit) from: f_string_rangess_adjust(). + * Errors (with error bit) from: f_uint8s_adjust(). + * Errors (with error bit) from: f_uint8ss_adjust(). * - * @see f_memory_array_adjust() - * @see f_memory_arrays_adjust() * @see f_string_ranges_adjust() * @see f_string_rangess_adjust() + * @see f_uint8s_adjust() + * @see f_uint8ss_adjust() */ -#ifndef _di_f_fss_set_quote_decimate_by_ - extern f_status_t f_fss_set_quote_decimate_by(const f_number_unsigned_t amount, f_fss_set_quote_t * const set_quote); -#endif // _di_f_fss_set_quote_decimate_by_ +#ifndef _di_f_fss_set_quote_destroy_ + extern f_status_t f_fss_set_quote_destroy(f_fss_set_quote_t * const set_quote); +#endif // _di_f_fss_set_quote_destroy_ /** - * Resize the set_quote array to a smaller size. + * A callback intended to be passed to f_memory_arrays_resize() for an f_set_quotes_t structure. * - * This will resize making the array smaller based on (size - given length). - * If the given length is too small, then the resize will fail. - * This will not shrink the size to less than 0. + * This is only called when shrinking the array and generally should perform deallocations. * - * @param amount - * A positive number representing how much to decrease the size by. - * @param set_quote - * The set_quote array to resize. - * - * @return - * F_none on success. - * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_resize(). - * Errors (with error bit) from: f_memory_arrays_resize(). - * Errors (with error bit) from: f_string_ranges_resize(). - * Errors (with error bit) from: f_string_rangess_resize(). - * - * @see f_memory_array_resize() - * @see f_memory_arrays_resize() - * @see f_string_ranges_resize() - * @see f_string_rangess_resize() - */ -#ifndef _di_f_fss_set_quote_decrease_by_ - extern f_status_t f_fss_set_quote_decrease_by(const f_number_unsigned_t amount, f_fss_set_quote_t * const set_quote); -#endif // _di_f_fss_set_quote_decrease_by_ - -/** - * Increase the size of the set_quote array, but only if necessary. + * This does not do parameter checking. * - * If the given length is too large for the buffer, then attempt to set_quote max buffer size (F_number_t_size_unsigned_d). - * If already set_quote to the maximum buffer size, then the resize will fail. - * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param set_quote - * The set_quote array to resize. + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). * - * F_array_too_large (with error bit) if the new array length is too large. - * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_memory_array_increase(). - * Errors (with error bit) from: f_memory_array_resize(). - * Errors (with error bit) from: f_memory_arrays_resize(). * Errors (with error bit) from: f_string_ranges_resize(). * Errors (with error bit) from: f_string_rangess_resize(). * - * @see f_memory_array_increase() - * @see f_memory_array_resize() - * @see f_memory_arrays_resize() - * @see f_string_ranges_resize() - * @see f_string_rangess_resize() - */ -#ifndef _di_f_fss_set_quote_increase_ - extern f_status_t f_fss_set_quote_increase(const f_number_unsigned_t step, f_fss_set_quote_t * const set_quote); -#endif // _di_f_fss_set_quote_increase_ - -/** - * Resize the set_quote array to a larger size. - * - * This will resize making the array larger based on the given length. - * If the given length is too large for the buffer, then attempt to set_quote max buffer size (F_number_t_size_unsigned_d). - * If already set_quote to the maximum buffer size, then the resize will fail. - * - * @param amount - * A positive number representing how much to increase the size by. - * @param set_quote - * The set_quote array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - * F_array_too_large (with error bit) if the new array length is too large. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * Errors (with error bit) from: f_memory_array_resize(). - * Errors (with error bit) from: f_memory_arrays_resize(). - * Errors (with error bit) from: f_string_ranges_resize(). - * Errors (with error bit) from: f_string_rangess_resize(). + * Errors (with error bit) from: f_uint8s_resize(). + * Errors (with error bit) from: f_uint8ss_resize(). * - * @see f_memory_array_increase_by() - * @see f_memory_array_resize() - * @see f_memory_arrays_resize() * @see f_string_ranges_resize() * @see f_string_rangess_resize() + * @see f_uint8s_resize() + * @see f_uint8ss_resize() */ -#ifndef _di_f_fss_set_quote_increase_by_ - extern f_status_t f_fss_set_quote_increase_by(const f_number_unsigned_t amount, f_fss_set_quote_t * const set_quote); -#endif // _di_f_fss_set_quote_increase_by_ +#ifndef _di_f_fss_set_quotes_delete_callback_ + extern f_status_t f_fss_set_quotes_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_fss_set_quotes_delete_callback_ /** - * Resize the set_quote array. - * - * @param length - * The new size to use. - * @param set_quote - * The set_quote array to adjust. - * - * @return - * F_none on success. + * A callback intended to be passed to f_memory_arrays_adjust() for an f_set_quotes_t structure. * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. + * This is only called when shrinking the array and generally should perform deallocations. * - * Errors (with error bit) from: f_memory_array_resize(). - * Errors (with error bit) from: f_memory_arrays_resize(). - * Errors (with error bit) from: f_string_ranges_resize(). - * Errors (with error bit) from: f_string_rangess_resize(). - * - * @see f_memory_array_resize() - * @see f_memory_arrays_resize() - * @see f_string_ranges_resize() - * @see f_string_rangess_resize() - */ -#ifndef _di_f_fss_set_quote_resize_ - extern f_status_t f_fss_set_quote_resize(const f_number_unsigned_t length, f_fss_set_quote_t * const set_quote); -#endif // _di_f_fss_set_quote_resize_ - -/** - * Resize the set_quote array. + * This does not do parameter checking. * - * @param length - * The new size to use. - * @param set_quotes - * The set_quotes array to resize. + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return * F_none on success. * - * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_memory_array_adjust(). - * Errors (with error bit) from: f_memory_arrays_adjust(). * Errors (with error bit) from: f_string_ranges_adjust(). * Errors (with error bit) from: f_string_rangess_adjust(). * - * @see f_memory_array_adjust() - * @see f_memory_arrays_adjust() - * @see f_string_ranges_adjust() - * @see f_string_rangess_adjust() - */ -#ifndef _di_f_fss_set_quotes_adjust_ - extern f_status_t f_fss_set_quotes_adjust(const f_number_unsigned_t length, f_fss_set_quotes_t * const set_quotes); -#endif // _di_f_fss_set_quotes_adjust_ - -/** - * Resize the set_quote array to a smaller size. - * - * This will resize making the array smaller based on (size - given length). - * If the given length is too small, then the resize will fail. - * This will not shrink the size to less than 0. + * Errors (with error bit) from: f_uint8s_adjust(). + * Errors (with error bit) from: f_uint8ss_adjust(). * - * @param amount - * A positive number representing how much to decimate the size by. - * @param set_quotes - * The set_quotes array to resize. - * - * @return - * F_none on success. - * F_data_not if amount is 0. - * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_adjust(). - * Errors (with error bit) from: f_memory_arrays_adjust(). - * Errors (with error bit) from: f_string_ranges_adjust(). - * Errors (with error bit) from: f_string_rangess_adjust(). - * - * @see f_memory_array_adjust() - * @see f_memory_arrays_adjust() * @see f_string_ranges_adjust() * @see f_string_rangess_adjust() + * @see f_uint8s_adjust() + * @see f_uint8ss_adjust() */ -#ifndef _di_f_fss_set_quotes_decimate_by_ - extern f_status_t f_fss_set_quotes_decimate_by(const f_number_unsigned_t amount, f_fss_set_quotes_t * const set_quotes); -#endif // _di_f_fss_set_quotes_decimate_by_ +#ifndef _di_f_fss_set_quotes_destroy_callback_ + extern f_status_t f_fss_set_quotes_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_fss_set_quotes_destroy_callback_ /** - * Resize the set_quote array to a smaller size. + * A callback intended to be passed to f_memory_arrays_resize() for an f_set_quotess_t structure. * - * This will resize making the array smaller based on (size - given length). - * If the given length is too small, then the resize will fail. - * This will not shrink the size to less than 0. - * - * @param amount - * A positive number representing how much to decrease the size by. - * @param set_quotes - * The set_quotes array to resize. - * - * @return - * F_none on success. + * This is only called when shrinking the array and generally should perform deallocations. * - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. + * This does not do parameter checking. * - * Errors (with error bit) from: f_memory_array_adjust(). - * Errors (with error bit) from: f_memory_arrays_adjust(). - * Errors (with error bit) from: f_string_ranges_resize(). - * Errors (with error bit) from: f_string_rangess_resize(). - * - * @see f_memory_array_adjust() - * @see f_memory_arrays_adjust() - * @see f_string_ranges_resize() - * @see f_string_rangess_resize() - */ -#ifndef _di_f_fss_set_quotes_decrease_by_ - extern f_status_t f_fss_set_quotes_decrease_by(const f_number_unsigned_t amount, f_fss_set_quotes_t * const set_quotes); -#endif // _di_f_fss_set_quotes_decrease_by_ - -/** - * Increase the size of the set_quotes array, but only if necessary. - * - * If the given length is too large for the buffer, then attempt to set max buffer size (F_number_t_size_unsigned_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param set_quotes - * The set_quotes array to resize. + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). * - * F_array_too_large (with error bit) if the new array length is too large. - * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_memory_array_increase(). - * Errors (with error bit) from: f_memory_array_resize(). - * Errors (with error bit) from: f_memory_arrays_resize(). * Errors (with error bit) from: f_string_ranges_resize(). * Errors (with error bit) from: f_string_rangess_resize(). * - * @see f_memory_array_increase() - * @see f_memory_array_resize() - * @see f_memory_arrays_resize() + * Errors (with error bit) from: f_uint8s_resize(). + * Errors (with error bit) from: f_uint8ss_resize(). + * * @see f_string_ranges_resize() * @see f_string_rangess_resize() + * @see f_uint8s_resize() + * @see f_uint8ss_resize() */ -#ifndef _di_f_fss_set_quotes_increase_ - extern f_status_t f_fss_set_quotes_increase(const f_number_unsigned_t step, f_fss_set_quotes_t * const set_quotes); -#endif // _di_f_fss_set_quotes_increase_ +#ifndef _di_f_fss_set_quotess_delete_callback_ + extern f_status_t f_fss_set_quotess_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_fss_set_quotess_delete_callback_ /** - * Resize the set_quotes array to a larger size. + * A callback intended to be passed to f_memory_arrays_adjust() for an f_set_quotess_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. * - * This will resize making the array larger based on the given length. - * If the given length is too large for the buffer, then attempt to set max buffer size (F_number_t_size_unsigned_d). - * If already set to the maximum buffer size, then the resize will fail. + * This does not do parameter checking. * - * @param amount - * A positive number representing how much to increase the size by. - * @param set_quotes - * The set_quotes array to resize. + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). * - * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. - * F_array_too_large (with error bit) if the new array length is too large. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * Errors (with error bit) from: f_memory_array_resize(). - * Errors (with error bit) from: f_memory_arrays_resize(). - * Errors (with error bit) from: f_string_ranges_resize(). - * Errors (with error bit) from: f_string_rangess_resize(). - * - * @see f_memory_array_increase_by() - * @see f_memory_array_resize() - * @see f_memory_arrays_resize() - * @see f_string_ranges_resize() - * @see f_string_rangess_resize() - */ -#ifndef _di_f_fss_set_quotes_increase_by_ - extern f_status_t f_fss_set_quotes_increase_by(const f_number_unsigned_t amount, f_fss_set_quotes_t * const set_quotes); -#endif // _di_f_fss_set_quotes_increase_by_ - -/** - * Resize the set_quotes array. * - * @param length - * The new size to use. - * @param set_quotes - * The set_quotes array to resize. - * - * @return - * Success from f_memory_array_resize(). - * - * F_parameter (with error bit) if a parameter is invalid. + * Errors (with error bit) from: f_string_ranges_adjust(). + * Errors (with error bit) from: f_string_rangess_adjust(). * - * Errors (with error bit) from: f_memory_array_resize(). - * Errors (with error bit) from: f_memory_arrays_resize(). - * Errors (with error bit) from: f_string_ranges_resize(). - * Errors (with error bit) from: f_string_rangess_resize(). + * Errors (with error bit) from: f_uint8s_adjust(). + * Errors (with error bit) from: f_uint8ss_adjust(). * - * @see f_memory_array_resize() - * @see f_memory_arrays_resize() - * @see f_string_ranges_resize() - * @see f_string_rangess_resize() + * @see f_string_ranges_adjust() + * @see f_string_rangess_adjust() + * @see f_uint8s_adjust() + * @see f_uint8ss_adjust() */ -#ifndef _di_f_fss_set_quotes_resize_ - extern f_status_t f_fss_set_quotes_resize(const f_number_unsigned_t length, f_fss_set_quotes_t * const set_quotes); -#endif // _di_f_fss_set_quotes_resize_ +#ifndef _di_f_fss_set_quotess_destroy_callback_ + extern f_status_t f_fss_set_quotess_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_fss_set_quotess_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_fss/c/fss/simple_packet.c b/level_0/f_fss/c/fss/simple_packet.c index 1ac3235..0d016b3 100644 --- a/level_0/f_fss/c/fss/simple_packet.c +++ b/level_0/f_fss/c/fss/simple_packet.c @@ -1,5 +1,4 @@ #include "../fss.h" -#include "private-simple_packet.h" #ifdef __cplusplus extern "C" { @@ -21,6 +20,9 @@ extern "C" { if (!packet) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ + packet->control = 0; + packet->size = 0; + return f_string_dynamic_adjust(0, &packet->payload); } #endif // _di_f_fss_simple_packet_destroy_ @@ -77,387 +79,101 @@ extern "C" { } #endif // _di_f_fss_simple_packet_identify_ -#ifndef _di_f_fss_simple_packet_ranges_adjust_ - f_status_t f_fss_simple_packet_ranges_adjust(const f_number_unsigned_t length, f_fss_simple_packet_ranges_t *ranges) { - #ifndef _di_level_0_parameter_checking_ - if (!ranges) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_adjust(length, sizeof(f_fss_simple_packet_range_t), (void **) &ranges->array, &ranges->used, &ranges->size); - } -#endif // _di_f_fss_simple_packet_ranges_adjust_ - -#ifndef _di_f_fss_simple_packet_ranges_append_ - f_status_t f_fss_simple_packet_ranges_append(const f_fss_simple_packet_range_t source, f_fss_simple_packet_ranges_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_fss_simple_packet_ranges_append(source, destination); - } -#endif // _di_f_fss_simple_packet_ranges_append_ - -#ifndef _di_f_fss_simple_packet_ranges_append_all_ - f_status_t f_fss_simple_packet_ranges_append_all(const f_fss_simple_packet_ranges_t source, f_fss_simple_packet_ranges_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not; - - return private_f_fss_simple_packet_ranges_append_all(source, destination); - } -#endif // _di_f_fss_simple_packet_ranges_append_all_ - -#ifndef _di_f_fss_simple_packet_ranges_decimate_by_ - f_status_t f_fss_simple_packet_ranges_decimate_by(const f_number_unsigned_t amount, f_fss_simple_packet_ranges_t *ranges) { - #ifndef _di_level_0_parameter_checking_ - if (!ranges) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_decimate_by(amount, sizeof(f_fss_simple_packet_range_t), (void **) &ranges->array, &ranges->used, &ranges->size); - } -#endif // _di_f_fss_simple_packet_ranges_decimate_by_ - -#ifndef _di_f_fss_simple_packet_ranges_decrease_by_ - f_status_t f_fss_simple_packet_ranges_decrease_by(const f_number_unsigned_t amount, f_fss_simple_packet_ranges_t *ranges) { - #ifndef _di_level_0_parameter_checking_ - if (!ranges) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ +#ifndef _di_f_fss_simple_packets_delete_callback_ + f_status_t f_fss_simple_packets_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { - return f_memory_array_decrease_by(amount, sizeof(f_fss_simple_packet_range_t), (void **) &ranges->array, &ranges->used, &ranges->size); - } -#endif // _di_f_fss_simple_packet_ranges_decrease_by_ + { + f_fss_simple_packet_t * const array = (f_fss_simple_packet_t *) void_array; + f_status_t status = F_none; -#ifndef _di_f_fss_simple_packet_ranges_increase_ - f_status_t f_fss_simple_packet_ranges_increase(const f_number_unsigned_t step, f_fss_simple_packet_ranges_t *ranges) { - #ifndef _di_level_0_parameter_checking_ - if (!ranges) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_increase(step, sizeof(f_fss_simple_packet_range_t), (void **) &ranges->array, &ranges->used, &ranges->size); - } -#endif // _di_f_fss_simple_packet_ranges_increase_ - -#ifndef _di_f_fss_simple_packet_ranges_increase_by_ - f_status_t f_fss_simple_packet_ranges_increase_by(const f_number_unsigned_t amount, f_fss_simple_packet_ranges_t *ranges) { - #ifndef _di_level_0_parameter_checking_ - if (!ranges) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_increase_by(amount, sizeof(f_fss_simple_packet_range_t), (void **) &ranges->array, &ranges->used, &ranges->size); - } -#endif // _di_f_fss_simple_packet_ranges_increase_by_ - -#ifndef _di_f_fss_simple_packet_ranges_resize_ - f_status_t f_fss_simple_packet_ranges_resize(const f_number_unsigned_t length, f_fss_simple_packet_ranges_t *ranges) { - #ifndef _di_level_0_parameter_checking_ - if (!ranges) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_resize(length, sizeof(f_fss_simple_packet_range_t), (void **) &ranges->array, &ranges->used, &ranges->size); - } -#endif // _di_f_fss_simple_packet_ranges_resize_ - -#ifndef _di_f_fss_simple_packet_rangess_adjust_ - f_status_t f_fss_simple_packet_rangess_adjust(const f_number_unsigned_t length, f_fss_simple_packet_rangess_t *rangess) { - #ifndef _di_level_0_parameter_checking_ - if (!rangess) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + for (f_number_unsigned_t i = start; i < stop; ++i) { - return private_f_fss_simple_packet_rangess_adjust(length, rangess); - } -#endif // _di_f_fss_simple_packet_rangess_adjust_ - -#ifndef _di_f_fss_simple_packet_rangess_append_ - f_status_t f_fss_simple_packet_rangess_append(const f_fss_simple_packet_ranges_t source, f_fss_simple_packet_rangess_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not; - - f_status_t status = f_memory_array_increase(F_memory_default_allocation_small_d, sizeof(f_fss_simple_packet_ranges_t), (void **) &destination->array, &destination->used, &destination->size); - if (F_status_is_error(status)) return status; - - status = private_f_fss_simple_packet_ranges_append_all(source, &destination->array[destination->used]); - if (F_status_is_error(status)) return status; - - ++destination->used; - - return F_none; - } -#endif // _di_f_fss_simple_packet_rangess_append_ - -#ifndef _di_f_fss_simple_packet_rangess_append_all_ - f_status_t f_fss_simple_packet_rangess_append_all(const f_fss_simple_packet_rangess_t source, f_fss_simple_packet_rangess_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not; - - f_status_t status = f_memory_array_increase_by(source.used, sizeof(f_fss_simple_packet_ranges_t), (void **) &destination->array, &destination->used, &destination->size); - if (F_status_is_error(status)) return status; - - for (f_number_unsigned_t i = 0; i < source.used; ++i, ++destination->used) { - - destination->array[destination->used].used = 0; - - if (source.array[i].used) { - status = private_f_fss_simple_packet_ranges_append_all(source.array[i], &destination->array[destination->used]); + status = f_string_dynamic_resize(0, &array[i].payload); if (F_status_is_error(status)) return status; - } - } // for + } // for + } return F_none; } -#endif // _di_f_fss_simple_packet_rangess_append_all_ +#endif // _di_f_fss_simple_packets_delete_callback_ -#ifndef _di_f_fss_simple_packet_rangess_decimate_by_ - f_status_t f_fss_simple_packet_rangess_decimate_by(const f_number_unsigned_t amount, f_fss_simple_packet_rangess_t *rangess) { - #ifndef _di_level_0_parameter_checking_ - if (!rangess) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!amount) return F_data_not; - - return private_f_fss_simple_packet_rangess_adjust((rangess->size > amount) ? rangess->size - amount : 0, rangess); - } -#endif // _di_f_fss_simple_packet_rangess_decimate_by_ - -#ifndef _di_f_fss_simple_packet_rangess_decrease_by_ - f_status_t f_fss_simple_packet_rangess_decrease_by(const f_number_unsigned_t amount, f_fss_simple_packet_rangess_t *rangess) { - #ifndef _di_level_0_parameter_checking_ - if (!rangess) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!amount) return F_data_not; - - return private_f_fss_simple_packet_rangess_resize((rangess->size > amount) ? rangess->size - amount : 0, rangess); - } -#endif // _di_f_fss_simple_packet_rangess_decrease_by_ +#ifndef _di_f_fss_simple_packets_destroy_callback_ + f_status_t f_fss_simple_packets_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { -#ifndef _di_f_fss_simple_packet_rangess_increase_ - f_status_t f_fss_simple_packet_rangess_increase(const f_number_unsigned_t step, f_fss_simple_packet_rangess_t *rangess) { - #ifndef _di_level_0_parameter_checking_ - if (!rangess) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_increase(step, sizeof(f_fss_simple_packet_ranges_t), (void **) &rangess->array, &rangess->used, &rangess->size); - } -#endif // _di_f_fss_simple_packet_rangess_increase_ + { + f_fss_simple_packet_t * const array = (f_fss_simple_packet_t *) void_array; + f_status_t status = F_none; -#ifndef _di_f_fss_simple_packet_rangess_increase_by_ - f_status_t f_fss_simple_packet_rangess_increase_by(const f_number_unsigned_t amount, f_fss_simple_packet_rangess_t *rangess) { - #ifndef _di_level_0_parameter_checking_ - if (!rangess) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + for (f_number_unsigned_t i = start; i < stop; ++i) { - return f_memory_array_increase_by(amount, sizeof(f_fss_simple_packet_ranges_t), (void **) &rangess->array, &rangess->used, &rangess->size); - } -#endif // _di_f_fss_simple_packet_rangess_increase_by_ + array[i].control = 0; + array[i].size = 0; -#ifndef _di_f_fss_simple_packet_rangess_resize_ - f_status_t f_fss_simple_packet_rangess_resize(const f_number_unsigned_t length, f_fss_simple_packet_rangess_t *rangess) { - #ifndef _di_level_0_parameter_checking_ - if (!rangess) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_fss_simple_packet_rangess_resize(length, rangess); - } -#endif // _di_f_fss_simple_packet_rangess_resize_ - -#ifndef _di_f_fss_simple_packets_adjust_ - f_status_t f_fss_simple_packets_adjust(const f_number_unsigned_t length, f_fss_simple_packets_t *packets) { - #ifndef _di_level_0_parameter_checking_ - if (!packets) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_fss_simple_packets_adjust(length, packets); - } -#endif // _di_f_fss_simple_packets_adjust_ - -#ifndef _di_f_fss_simple_packets_append_ - f_status_t f_fss_simple_packets_append(const f_fss_simple_packet_t source, f_fss_simple_packets_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_fss_simple_packets_append(source, destination); - } -#endif // _di_f_fss_simple_packets_append_ - -#ifndef _di_f_fss_simple_packets_append_all_ - f_status_t f_fss_simple_packets_append_all(const f_fss_simple_packets_t source, f_fss_simple_packets_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not; - - return private_f_fss_simple_packets_append_all(source, destination); - } -#endif // _di_f_fss_simple_packets_append_all_ - -#ifndef _di_f_fss_simple_packets_decimate_by_ - f_status_t f_fss_simple_packets_decimate_by(const f_number_unsigned_t amount, f_fss_simple_packets_t *packets) { - #ifndef _di_level_0_parameter_checking_ - if (!packets) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_decimate_by(amount, sizeof(f_fss_simple_packet_t), (void **) &packets->array, &packets->used, &packets->size); - } -#endif // _di_f_fss_simple_packets_decimate_by_ - -#ifndef _di_f_fss_simple_packets_decrease_by_ - f_status_t f_fss_simple_packets_decrease_by(const f_number_unsigned_t amount, f_fss_simple_packets_t *packets) { - #ifndef _di_level_0_parameter_checking_ - if (!packets) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_decrease_by(amount, sizeof(f_fss_simple_packet_t), (void **) &packets->array, &packets->used, &packets->size); - } -#endif // _di_f_fss_simple_packets_decrease_by_ - -#ifndef _di_f_fss_simple_packets_increase_ - f_status_t f_fss_simple_packets_increase(const f_number_unsigned_t step, f_fss_simple_packets_t *packets) { - #ifndef _di_level_0_parameter_checking_ - if (!packets) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_increase(step, sizeof(f_fss_simple_packet_t), (void **) &packets->array, &packets->used, &packets->size); - } -#endif // _di_f_fss_simple_packets_increase_ - -#ifndef _di_f_fss_simple_packets_increase_by_ - f_status_t f_fss_simple_packets_increase_by(const f_number_unsigned_t amount, f_fss_simple_packets_t *packets) { - #ifndef _di_level_0_parameter_checking_ - if (!packets) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_increase_by(amount, sizeof(f_fss_simple_packet_t), (void **) &packets->array, &packets->used, &packets->size); - } -#endif // _di_f_fss_simple_packets_increase_by_ - -#ifndef _di_f_fss_simple_packets_resize_ - f_status_t f_fss_simple_packets_resize(const f_number_unsigned_t length, f_fss_simple_packets_t *packets) { - #ifndef _di_level_0_parameter_checking_ - if (!packets) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_fss_simple_packets_resize(length, packets); - } -#endif // _di_f_fss_simple_packets_resize_ - -#ifndef _di_f_fss_simple_packetss_adjust_ - f_status_t f_fss_simple_packetss_adjust(const f_number_unsigned_t length, f_fss_simple_packetss_t *packetss) { - #ifndef _di_level_0_parameter_checking_ - if (!packetss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_fss_simple_packetss_adjust(length, packetss); - } -#endif // _di_f_fss_simple_packetss_adjust_ - -#ifndef _di_f_fss_simple_packetss_append_ - f_status_t f_fss_simple_packetss_append(const f_fss_simple_packets_t source, f_fss_simple_packetss_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not; - - f_status_t status = f_memory_array_increase(F_memory_default_allocation_small_d, sizeof(f_fss_simple_packets_t), (void **) &destination->array, &destination->used, &destination->size); - if (F_status_is_error(status)) return status; - - status = private_f_fss_simple_packets_append_all(source, &destination->array[destination->used]); - if (F_status_is_error(status)) return status; - - ++destination->used; + status = f_string_dynamic_adjust(0, &array[i].payload); + if (F_status_is_error(status)) return status; + } // for + } return F_none; } -#endif // _di_f_fss_simple_packetss_append_ +#endif // _di_f_fss_simple_packets_destroy_callback_ -#ifndef _di_f_fss_simple_packetss_append_all_ - f_status_t f_fss_simple_packetss_append_all(const f_fss_simple_packetss_t source, f_fss_simple_packetss_t *destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ +#ifndef _di_f_fss_simple_packetss_delete_callback_ + f_status_t f_fss_simple_packetss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { - if (!source.used) return F_data_not; + { + f_fss_simple_packets_t * const array = (f_fss_simple_packets_t *) void_array; + f_status_t status = F_none; + f_number_unsigned_t j = 0; - f_status_t status = f_memory_array_increase_by(source.used, sizeof(f_fss_simple_packets_t), (void **) &destination->array, &destination->used, &destination->size); - if (F_status_is_error(status)) return status; + for (f_number_unsigned_t i = start; i < stop; ++i) { - for (f_number_unsigned_t i = 0; i < source.used; ++i, ++destination->used) { + for (j = 0; j < array[i].size; ++j) { - destination->array[destination->used].used = 0; + status = f_string_dynamic_resize(0, &array[i].array[j].payload); + if (F_status_is_error(status)) return status; + } // for - if (source.array[i].used) { - status = private_f_fss_simple_packets_append_all(source.array[i], &destination->array[destination->used]); - if (F_status_is_error(status)) return status; - } - } // for + if (array[i].size) { + status = f_memory_array_resize(0, sizeof(f_fss_simple_packet_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } + } // for + } return F_none; } -#endif // _di_f_fss_simple_packetss_append_all_ +#endif // _di_f_fss_simple_packetss_delete_callback_ -#ifndef _di_f_fss_simple_packetss_decimate_by_ - f_status_t f_fss_simple_packetss_decimate_by(const f_number_unsigned_t amount, f_fss_simple_packetss_t *packetss) { - #ifndef _di_level_0_parameter_checking_ - if (!packetss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!amount) return F_data_not; - - return private_f_fss_simple_packetss_adjust((packetss->size > amount) ? packetss->size - amount : 0, packetss); - } -#endif // _di_f_fss_simple_packetss_decimate_by_ +#ifndef _di_f_fss_simple_packetss_destroy_callback_ + f_status_t f_fss_simple_packetss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { -#ifndef _di_f_fss_simple_packetss_decrease_by_ - f_status_t f_fss_simple_packetss_decrease_by(const f_number_unsigned_t amount, f_fss_simple_packetss_t *packetss) { - #ifndef _di_level_0_parameter_checking_ - if (!packetss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!amount) return F_data_not; - - return private_f_fss_simple_packetss_resize((packetss->size > amount) ? packetss->size - amount : 0, packetss); - } -#endif // _di_f_fss_simple_packetss_decrease_by_ + { + f_fss_simple_packets_t * const array = (f_fss_simple_packets_t *) void_array; + f_status_t status = F_none; + f_number_unsigned_t j = 0; -#ifndef _di_f_fss_simple_packetss_increase_ - f_status_t f_fss_simple_packetss_increase(const f_number_unsigned_t step, f_fss_simple_packetss_t *packetss) { - #ifndef _di_level_0_parameter_checking_ - if (!packetss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + for (f_number_unsigned_t i = start; i < stop; ++i) { - return f_memory_array_increase(step, sizeof(f_fss_simple_packets_t), (void **) &packetss->array, &packetss->used, &packetss->size); - } -#endif // _di_f_fss_simple_packetss_increase_ + for (j = 0; j < array[i].size; ++j) { -#ifndef _di_f_fss_simple_packetss_increase_by_ - f_status_t f_fss_simple_packetss_increase_by(const f_number_unsigned_t amount, f_fss_simple_packetss_t *packetss) { - #ifndef _di_level_0_parameter_checking_ - if (!packetss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + array[i].array[j].control = 0; + array[i].array[j].size = 0; - return f_memory_array_increase_by(amount, sizeof(f_fss_simple_packets_t), (void **) &packetss->array, &packetss->used, &packetss->size); - } -#endif // _di_f_fss_simple_packetss_increase_by_ + status = f_string_dynamic_adjust(0, &array[i].array[j].payload); + if (F_status_is_error(status)) return status; + } // for -#ifndef _di_f_fss_simple_packetss_resize_ - f_status_t f_fss_simple_packetss_resize(const f_number_unsigned_t length, f_fss_simple_packetss_t *packetss) { - #ifndef _di_level_0_parameter_checking_ - if (!packetss) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + if (array[i].size) { + status = f_memory_array_resize(0, sizeof(f_fss_simple_packet_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } + } // for + } - return private_f_fss_simple_packetss_resize(length, packetss); + return F_none; } -#endif // _di_f_fss_simple_packetss_resize_ +#endif // _di_f_fss_simple_packetss_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_fss/c/fss/simple_packet.h b/level_0/f_fss/c/fss/simple_packet.h index 298635e..0d25a4b 100644 --- a/level_0/f_fss/c/fss/simple_packet.h +++ b/level_0/f_fss/c/fss/simple_packet.h @@ -90,16 +90,7 @@ extern "C" { #define macro_f_fss_simple_packets_t_initialize_1(array, size, used) { array, size, used } #define macro_f_fss_simple_packets_t_initialize_2(array, length) { array, length, length } - #define macro_f_fss_simple_packets_t_resize(status, simple_packets, length) status = f_fss_simple_packets_resize(length, &simple_packets); - #define macro_f_fss_simple_packets_t_adjust(status, simple_packets, length) status = f_fss_simple_packets_adjust(length, &simple_packets); - - #define macro_f_fss_simple_packets_t_delete_simple(simple_packets) f_fss_simple_packets_resize(0, &simple_packets); - #define macro_f_fss_simple_packets_t_destroy_simple(simple_packets) f_fss_simple_packets_adjust(0, &simple_packets); - - #define macro_f_fss_simple_packets_t_increase(status, step, simple_packets) status = f_fss_simple_packets_increase(step, &simple_packets); - #define macro_f_fss_simple_packets_t_increase_by(status, simple_packets, amount) status = f_fss_simple_packets_increase_by(amount, &simple_packets); - #define macro_f_fss_simple_packets_t_decrease_by(status, simple_packets, amount) status = f_fss_simple_packets_decrease_by(amount, &simple_packets); - #define macro_f_fss_simple_packets_t_decimate_by(status, simple_packets, amount) status = f_fss_simple_packets_decimate_by(amount, &simple_packets); + #define macro_f_fss_simple_packets_t_clear(simple_packets) macro_f_memory_structures_clear(simple_packets) #endif // _di_f_fss_simple_packets_t_ /** @@ -123,16 +114,7 @@ extern "C" { #define macro_f_fss_simple_packetss_t_initialize_1(array, size, used) { array, size, used } #define macro_f_fss_simple_packetss_t_initialize_2(array, length) { array, length, length } - #define macro_f_fss_simple_packetss_t_resize(status, simple_packetss, length) status = f_fss_simple_packetss_resize(length, &simple_packetss); - #define macro_f_fss_simple_packetss_t_adjust(status, simple_packetss, length) status = f_fss_simple_packetss_adjust(length, &simple_packetss); - - #define macro_f_fss_simple_packetss_t_delete_simple(simple_packetss) f_fss_simple_packetss_resize(0, &simple_packetss); - #define macro_f_fss_simple_packetss_t_destroy_simple(simple_packetss) f_fss_simple_packetss_adjust(0, &simple_packetss); - - #define macro_f_fss_simple_packetss_t_increase(status, step, simple_packetss) status = f_fss_simple_packetss_increase(step, &simple_packetss); - #define macro_f_fss_simple_packetss_t_increase_by(status, simple_packetss, amount) status = f_fss_simple_packetss_increase_by(amount, &simple_packetss); - #define macro_f_fss_simple_packetss_t_decrease_by(status, simple_packetss, amount) status = f_fss_simple_packetss_decrease_by(amount, &simple_packetss); - #define macro_f_fss_simple_packetss_t_decimate_by(status, simple_packetss, amount) status = f_fss_simple_packetss_decimate_by(amount, &simple_packetss); + #define macro_f_fss_simple_packetss_t_clear(simple_packetss) macro_f_memory_structures_clear(simple_packetss) #endif // _di_f_fss_simple_packetss_t_ /** * A set of string ranges intending to designate the different ranges for a Simple Packet representing each Block. @@ -183,16 +165,7 @@ extern "C" { #define macro_f_fss_simple_packet_ranges_t_initialize_1(array, size, used) { array, size, used } #define macro_f_fss_simple_packet_ranges_t_initialize_2(array, length) { array, length, length } - #define macro_f_fss_simple_packet_ranges_t_resize(status, simple_packet_ranges, length) status = f_fss_simple_packet_ranges_resize(length, &simple_packet_ranges); - #define macro_f_fss_simple_packet_ranges_t_adjust(status, simple_packet_ranges, length) status = f_fss_simple_packet_ranges_adjust(length, &simple_packet_ranges); - - #define macro_f_fss_simple_packet_ranges_t_delete_simple(simple_packet_ranges) f_fss_simple_packet_ranges_resize(0, &simple_packet_ranges); - #define macro_f_fss_simple_packet_ranges_t_destroy_simple(simple_packet_ranges) f_fss_simple_packet_ranges_adjust(0, &simple_packet_ranges); - - #define macro_f_fss_simple_packet_ranges_t_increase(status, step, simple_packet_ranges) status = f_fss_simple_packet_ranges_increase(step, &simple_packet_ranges); - #define macro_f_fss_simple_packet_ranges_t_increase_by(status, simple_packet_ranges, amount) status = f_fss_simple_packet_ranges_increase_by(amount, &simple_packet_ranges); - #define macro_f_fss_simple_packet_ranges_t_decrease_by(status, simple_packet_ranges, amount) status = f_fss_simple_packet_ranges_decrease_by(amount, &simple_packet_ranges); - #define macro_f_fss_simple_packet_ranges_t_decimate_by(status, simple_packet_ranges, amount) status = f_fss_simple_packet_ranges_decimate_by(amount, &simple_packet_ranges); + #define macro_f_fss_simple_packet_ranges_t_clear(simple_packet_ranges) macro_f_memory_structures_clear(simple_packet_ranges) #endif // _di_f_fss_simple_packet_ranges_t_ /** @@ -216,16 +189,7 @@ extern "C" { #define macro_f_fss_simple_packet_rangess_t_initialize_1(array, size, used) { array, size, used } #define macro_f_fss_simple_packet_rangess_t_initialize_2(array, length) { array, length, length } - #define macro_f_fss_simple_packet_rangess_t_resize(status, simple_packet_rangess, length) status = f_fss_simple_packet_rangess_resize(length, &simple_packet_rangess); - #define macro_f_fss_simple_packet_rangess_t_adjust(status, simple_packet_rangess, length) status = f_fss_simple_packet_rangess_adjust(length, &simple_packet_rangess); - - #define macro_f_fss_simple_packet_rangess_t_delete_simple(simple_packet_rangess) f_fss_simple_packet_rangess_resize(0, &simple_packet_rangess); - #define macro_f_fss_simple_packet_rangess_t_destroy_simple(simple_packet_rangess) f_fss_simple_packet_rangess_adjust(0, &simple_packet_rangess); - - #define macro_f_fss_simple_packet_rangess_t_increase(status, step, simple_packet_rangess) status = f_fss_simple_packet_rangess_increase(step, &simple_packet_rangess); - #define macro_f_fss_simple_packet_rangess_t_increase_by(status, simple_packet_rangess, amount) status = f_fss_simple_packet_rangess_increase_by(amount, &simple_packet_rangess); - #define macro_f_fss_simple_packet_rangess_t_decrease_by(status, simple_packet_rangess, amount) status = f_fss_simple_packet_rangess_decrease_by(amount, &simple_packet_rangess); - #define macro_f_fss_simple_packet_rangess_t_decimate_by(status, simple_packet_rangess, amount) status = f_fss_simple_packet_rangess_decimate_by(amount, &simple_packet_rangess); + #define macro_f_fss_simple_packet_rangess_t_clear(simple_packet_rangess) macro_f_memory_structures_clear(simple_packet_rangess) #endif // _di_f_fss_simple_packet_rangess_t_ /** @@ -239,7 +203,7 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. * - * F_failure (with error bit) on any other error. + * Errors (with error bit) from: f_string_dynamic_resize(). * * @see f_string_dynamic_resize() */ @@ -258,7 +222,7 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. * - * F_failure (with error bit) on any other error. + * Errors (with error bit) from: f_string_dynamic_adjust(). * * @see f_string_dynamic_adjust() */ @@ -289,790 +253,116 @@ extern "C" { #endif // _di_f_fss_simple_packet_identify_ /** - * Resize the ranges array. - * - * @param length - * The new size to use. - * @param ranges - * The ranges array to resize. - * - * @return - * Success from f_memory_array_resize(). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - */ -#ifndef _di_f_fss_simple_packet_ranges_adjust_ - extern f_status_t f_fss_simple_packet_ranges_adjust(const f_number_unsigned_t length, f_fss_simple_packet_ranges_t *ranges); -#endif // _di_f_fss_simple_packet_ranges_adjust_ - -/** - * Append the single source range onto the destination. - * - * @param source - * The source range to append. - * @param destination - * The destination ranges the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * Success from f_memory_array_resize(). - * - * F_parameter (with error bit) if a parameter is invalid. + * A callback intended to be passed to f_memory_arrays_resize() for an f_simple_packets_t structure. * - * Errors (with error bit) from: f_memory_array_increase(). - * Errors (with error bit) from: f_memory_array_resize(). + * This is only called when shrinking the array and generally should perform deallocations. * - * @see f_memory_array_increase() - * @see f_memory_array_resize() - */ -#ifndef _di_f_fss_simple_packet_ranges_append_ - extern f_status_t f_fss_simple_packet_ranges_append(const f_fss_simple_packet_range_t source, f_fss_simple_packet_ranges_t *destination); -#endif // _di_f_fss_simple_packet_ranges_append_ - -/** - * Append the source ranges onto the destination. + * This does not do parameter checking. * - * @param source - * The source ranges to append. - * @param destination - * The destination ranges the source is appended onto. + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * Success from f_memory_array_resize(). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_increase_by() - * @see f_memory_array_resize() - */ -#ifndef _di_f_fss_simple_packet_ranges_append_all_ - extern f_status_t f_fss_simple_packet_ranges_append_all(const f_fss_simple_packet_ranges_t source, f_fss_simple_packet_ranges_t *destination); -#endif // _di_f_fss_simple_packet_ranges_append_all_ - -/** - * Resize the ranges array to a smaller size. - * - * This will resize making the array smaller based on (size - given length). - * If the given length is too small, then the resize will fail. - * This will not shrink the size to les than 0. - * - * @param amount - * A positive number representing how much to decimate the size by. - * @param ranges - * The ranges array to resize. - * - * @return - * @return - * Success from f_memory_array_decimate_by(). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_decimate_by(). - * - * @see f_memory_array_decimate_by() - */ -#ifndef _di_f_fss_simple_packet_ranges_decimate_by_ - extern f_status_t f_fss_simple_packet_ranges_decimate_by(const f_number_unsigned_t amount, f_fss_simple_packet_ranges_t *ranges); -#endif // _di_f_fss_simple_packet_ranges_decimate_by_ - -/** - * Resize the ranges array to a smaller size. - * - * This will resize making the array smaller based on (size - given length). - * If the given length is too small, then the resize will fail. - * This will not shrink the size to les than 0. - * - * @param amount - * A positive number representing how much to decrease the size by. - * @param ranges - * The ranges array to resize. - * - * @return - * Success from f_memory_array_decrease_by(). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_decrease_by(). - * - * @see f_memory_array_decrease_by() - */ -#ifndef _di_f_fss_simple_packet_ranges_decrease_by_ - extern f_status_t f_fss_simple_packet_ranges_decrease_by(const f_number_unsigned_t amount, f_fss_simple_packet_ranges_t *ranges); -#endif // _di_f_fss_simple_packet_ranges_decrease_by_ - -/** - * Increase the size of the ranges array, but only if necesary. - * - * If the given length is too large for the buffer, then attempt to range max buffer size (F_number_t_size_unsigned_d). - * If already range to the maximum buffer size, then the resize will fail. - * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param ranges - * The ranges array to resize. - * - * @return - * Success from f_memory_array_increase(). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase(). - * - * @see f_memory_array_increase() - */ -#ifndef _di_f_fss_simple_packet_ranges_increase_ - extern f_status_t f_fss_simple_packet_ranges_increase(const f_number_unsigned_t step, f_fss_simple_packet_ranges_t *ranges); -#endif // _di_f_fss_simple_packet_ranges_increase_ - -/** - * Resize the ranges array to a larger size. - * - * This will resize making the array larger based on the given length. - * If the given length is too large for the buffer, then attempt to range max buffer size (F_number_t_size_unsigned_d). - * If already range to the maximum buffer size, then the resize will fail. - * - * @param amount - * A positive number representing how much to increase the size by. - * @param ranges - * The ranges array to resize. - * - * @return - * Success from f_memory_array_increase_by(). * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_fss_simple_packet_ranges_increase_by_ - extern f_status_t f_fss_simple_packet_ranges_increase_by(const f_number_unsigned_t amount, f_fss_simple_packet_ranges_t *ranges); -#endif // _di_f_fss_simple_packet_ranges_increase_by_ - -/** - * Resize the ranges array. + * Errors (with error bit) from: f_string_dynamic_resize(). * - * @param length - * The new size to use. - * @param ranges - * The ranges array to adjust. - * - * @return - * Success from f_memory_array_resize(). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - */ -#ifndef _di_f_fss_simple_packet_ranges_resize_ - extern f_status_t f_fss_simple_packet_ranges_resize(const f_number_unsigned_t length, f_fss_simple_packet_ranges_t *ranges); -#endif // _di_f_fss_simple_packet_ranges_resize_ - -/** - * Resize the rangess array. - * - * @param length - * The new size to use. - * @param rangess - * The rangess array to resize. - * - * @return - * Success from f_memory_array_adjust(). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_adjust(). - * - * @see f_memory_array_adjust() + * @see f_string_dynamic_resize() */ -#ifndef _di_f_fss_simple_packet_rangess_adjust_ - extern f_status_t f_fss_simple_packet_rangess_adjust(const f_number_unsigned_t length, f_fss_simple_packet_rangess_t *rangess); -#endif // _di_f_fss_simple_packet_rangess_adjust_ +#ifndef _di_f_fss_simple_packets_delete_callback_ + extern f_status_t f_fss_simple_packets_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_fss_simple_packets_delete_callback_ /** - * Append the single source ranges onto the destination. - * - * @param source - * The source ranges to append. - * @param destination - * The destination ranges the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * Success from f_memory_array_resize(). + * A callback intended to be passed to f_memory_arrays_adjust() for an f_simple_packets_t structure. * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * Errors (with error bit) from: f_memory_array_resize(). + * This is only called when shrinking the array and generally should perform deallocations. * - * @see f_memory_array_increase_by() - * @see f_memory_array_resize() - */ -#ifndef _di_f_fss_simple_packet_rangess_append_ - extern f_status_t f_fss_simple_packet_rangess_append(const f_fss_simple_packet_ranges_t source, f_fss_simple_packet_rangess_t *destination); -#endif // _di_f_fss_simple_packet_rangess_append_ - -/** - * Append the source rangess onto the destination. + * This does not do parameter checking. * - * @param source - * The source rangess to append. - * @param destination - * The destination ranges the source is appended onto. + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * Success from f_memory_array_resize(). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_increase_by() - * @see f_memory_array_resize() - */ -#ifndef _di_f_fss_simple_packet_rangess_append_all_ - extern f_status_t f_fss_simple_packet_rangess_append_all(const f_fss_simple_packet_rangess_t source, f_fss_simple_packet_rangess_t *destination); -#endif // _di_f_fss_simple_packet_rangess_append_all_ - -/** - * Resize the rangess array to a smaller size. - * - * This will resize making the array smaller based on (size - given length). - * If the given length is too small, then the resize will fail. - * This will not shrink the size to less than 0. - * - * @param amount - * A positive number representing how much to decimate the size by. - * @param rangess - * The rangess array to resize. - * - * @return - * F_data_not on success, but the amount to decrease by is 0. - * - * Success from f_memory_array_decimate_by(). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_decimate_by(). - * - * @see f_memory_array_decimate_by() - */ -#ifndef _di_f_fss_simple_packet_rangess_decimate_by_ - extern f_status_t f_fss_simple_packet_rangess_decimate_by(const f_number_unsigned_t amount, f_fss_simple_packet_rangess_t *rangess); -#endif // _di_f_fss_simple_packet_rangess_decimate_by_ - -/** - * Resize the rangess array to a smaller size. - * - * This will resize making the array smaller based on (size - given length). - * If the given length is too small, then the resize will fail. - * This will not shrink the size to less than 0. - * - * @param amount - * A positive number representing how much to decrease the size by. - * @param rangess - * The rangess array to resize. - * - * @return - * F_data_not on success, but the amount to decrease by is 0. - * - * Success from f_memory_array_decrease_by(). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_decrease_by(). - * - * @see f_memory_array_decrease_by() - */ -#ifndef _di_f_fss_simple_packet_rangess_decrease_by_ - extern f_status_t f_fss_simple_packet_rangess_decrease_by(const f_number_unsigned_t amount, f_fss_simple_packet_rangess_t *rangess); -#endif // _di_f_fss_simple_packet_rangess_decrease_by_ - -/** - * Increase the size of the rangess array, but only if necessary. - * - * If the given length is too large for the buffer, then attempt to range max buffer size (F_number_t_size_unsigned_d). - * If already range to the maximum buffer size, then the resize will fail. - * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param rangess - * The rangess array to resize. - * - * @return - * Success from f_memory_array_increase(). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase(). - * - * @see f_memory_array_increase() - */ -#ifndef _di_f_fss_simple_packet_rangess_increase_ - extern f_status_t f_fss_simple_packet_rangess_increase(const f_number_unsigned_t step, f_fss_simple_packet_rangess_t *rangess); -#endif // _di_f_fss_simple_packet_rangess_increase_ - -/** - * Resize the rangess array to a larger size. - * - * This will resize making the array larger based on the given length. - * If the given length is too large for the buffer, then attempt to range max buffer size (F_number_t_size_unsigned_d). - * If already range to the maximum buffer size, then the resize will fail. - * - * @param amount - * A positive number representing how much to increase the size by. - * @param rangess - * The rangess array to resize. - * - * @return - * Success from f_memory_array_increase_by(). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_fss_simple_packet_rangess_increase_by_ - extern f_status_t f_fss_simple_packet_rangess_increase_by(const f_number_unsigned_t amount, f_fss_simple_packet_rangess_t *rangess); -#endif // _di_f_fss_simple_packet_rangess_increase_by_ - -/** - * Resize the rangess array. - * - * @param length - * The new size to use. - * @param rangess - * The rangess array to resize. - * - * @return - * Success from f_memory_array_resize(). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - */ -#ifndef _di_f_fss_simple_packet_rangess_resize_ - extern f_status_t f_fss_simple_packet_rangess_resize(const f_number_unsigned_t length, f_fss_simple_packet_rangess_t *rangess); -#endif // _di_f_fss_simple_packet_rangess_resize_ - -/** - * Resize the simple packet array. - * - * @param length - * The new size to use. - * @param packets - * The simple packet array to resize. - * - * @return - * Success from f_memory_array_resize(). * * 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_adjust(). * - * @see f_memory_array_resize() + * @see f_string_dynamic_adjust() */ -#ifndef _di_f_fss_simple_packets_adjust_ - extern f_status_t f_fss_simple_packets_adjust(const f_number_unsigned_t length, f_fss_simple_packets_t *packets); -#endif // _di_f_fss_simple_packets_adjust_ +#ifndef _di_f_fss_simple_packets_destroy_callback_ + extern f_status_t f_fss_simple_packets_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_fss_simple_packets_destroy_callback_ /** - * Append the single source simple packet onto the destination. - * - * @param source - * The source packet to append. - * @param destination - * The destination simple packet the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * Success from f_memory_array_resize(). - * - * F_parameter (with error bit) if a parameter is invalid. + * A callback intended to be passed to f_memory_arrays_resize() for an f_simple_packetss_t structure. * - * Errors (with error bit) from: f_memory_array_increase(). - * Errors (with error bit) from: f_memory_array_resize(). + * This is only called when shrinking the array and generally should perform deallocations. * - * @see f_memory_array_increase() - * @see f_memory_array_resize() - */ -#ifndef _di_f_fss_simple_packets_append_ - extern f_status_t f_fss_simple_packets_append(const f_fss_simple_packet_t source, f_fss_simple_packets_t *destination); -#endif // _di_f_fss_simple_packets_append_ - -/** - * Append the source simple packet onto the destination. + * This does not do parameter checking. * - * @param source - * The source packets to append. - * @param destination - * The destination simple packet the source is appended onto. + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * Success from f_memory_array_resize(). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_increase_by() - * @see f_memory_array_resize() - */ -#ifndef _di_f_fss_simple_packets_append_all_ - extern f_status_t f_fss_simple_packets_append_all(const f_fss_simple_packets_t source, f_fss_simple_packets_t *destination); -#endif // _di_f_fss_simple_packets_append_all_ - -/** - * Resize the simple packet array to a smaller size. - * - * This will resize making the array smaller based on (size - given length). - * If the given length is too small, then the resize will fail. - * This will not shrink the size to les than 0. - * - * @param amount - * A positive number representing how much to decimate the size by. - * @param packets - * The simple packet array to resize. - * - * @return - * @return - * Success from f_memory_array_decimate_by(). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_decimate_by(). - * - * @see f_memory_array_decimate_by() - */ -#ifndef _di_f_fss_simple_packets_decimate_by_ - extern f_status_t f_fss_simple_packets_decimate_by(const f_number_unsigned_t amount, f_fss_simple_packets_t *packets); -#endif // _di_f_fss_simple_packets_decimate_by_ - -/** - * Resize the simple packet array to a smaller size. - * - * This will resize making the array smaller based on (size - given length). - * If the given length is too small, then the resize will fail. - * This will not shrink the size to les than 0. - * - * @param amount - * A positive number representing how much to decrease the size by. - * @param packets - * The simple packet array to resize. - * - * @return - * Success from f_memory_array_decrease_by(). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_decrease_by(). - * - * @see f_memory_array_decrease_by() - */ -#ifndef _di_f_fss_simple_packets_decrease_by_ - extern f_status_t f_fss_simple_packets_decrease_by(const f_number_unsigned_t amount, f_fss_simple_packets_t *packets); -#endif // _di_f_fss_simple_packets_decrease_by_ - -/** - * Increase the size of the simple packet array, but only if necesary. - * - * If the given length is too large for the buffer, then attempt to packet max buffer size (F_number_t_size_unsigned_d). - * If already packet to the maximum buffer size, then the resize will fail. - * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param packets - * The simple packet array to resize. - * - * @return - * Success from f_memory_array_increase(). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase(). - * - * @see f_memory_array_increase() - */ -#ifndef _di_f_fss_simple_packets_increase_ - extern f_status_t f_fss_simple_packets_increase(const f_number_unsigned_t step, f_fss_simple_packets_t *packets); -#endif // _di_f_fss_simple_packets_increase_ - -/** - * Resize the simple packet array to a larger size. - * - * This will resize making the array larger based on the given length. - * If the given length is too large for the buffer, then attempt to packet max buffer size (F_number_t_size_unsigned_d). - * If already packet to the maximum buffer size, then the resize will fail. - * - * @param amount - * A positive number representing how much to increase the size by. - * @param packets - * The simple packet array to resize. - * - * @return - * Success from f_memory_array_increase_by(). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_fss_simple_packets_increase_by_ - extern f_status_t f_fss_simple_packets_increase_by(const f_number_unsigned_t amount, f_fss_simple_packets_t *packets); -#endif // _di_f_fss_simple_packets_increase_by_ - -/** - * Resize the simple packet array. - * - * @param length - * The new size to use. - * @param packets - * The simple packet array to adjust. - * - * @return - * Success from f_memory_array_resize(). * * 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() - */ -#ifndef _di_f_fss_simple_packets_resize_ - extern f_status_t f_fss_simple_packets_resize(const f_number_unsigned_t length, f_fss_simple_packets_t *packets); -#endif // _di_f_fss_simple_packets_resize_ - -/** - * Resize the simple packets array. - * - * @param length - * The new size to use. - * @param packetss - * The simple packets array to resize. - * - * @return - * Success from f_memory_array_adjust(). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_adjust(). - * - * @see f_memory_array_adjust() + * @see f_string_dynamic_resize() */ -#ifndef _di_f_fss_simple_packetss_adjust_ - extern f_status_t f_fss_simple_packetss_adjust(const f_number_unsigned_t length, f_fss_simple_packetss_t *packetss); -#endif // _di_f_fss_simple_packetss_adjust_ +#ifndef _di_f_fss_simple_packetss_delete_callback_ + extern f_status_t f_fss_simple_packetss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_fss_simple_packetss_delete_callback_ /** - * Append the single source simple packets onto the destination. - * - * @param source - * The source simple packets to append. - * @param destination - * The destination simple packets the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). + * A callback intended to be passed to f_memory_arrays_adjust() for an f_simple_packetss_t structure. * - * Success from f_memory_array_resize(). + * This is only called when shrinking the array and generally should perform deallocations. * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_increase_by() - * @see f_memory_array_resize() - */ -#ifndef _di_f_fss_simple_packetss_append_ - extern f_status_t f_fss_simple_packetss_append(const f_fss_simple_packets_t source, f_fss_simple_packetss_t *destination); -#endif // _di_f_fss_simple_packetss_append_ - -/** - * Append the source simple packets onto the destination. + * This does not do parameter checking. * - * @param source - * The source simple packets to append. - * @param destination - * The destination simple packets the source is appended onto. + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * Success from f_memory_array_resize(). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_increase_by() - * @see f_memory_array_resize() - */ -#ifndef _di_f_fss_simple_packetss_append_all_ - extern f_status_t f_fss_simple_packetss_append_all(const f_fss_simple_packetss_t source, f_fss_simple_packetss_t *destination); -#endif // _di_f_fss_simple_packetss_append_all_ - -/** - * Resize the simple packets array to a smaller size. - * - * This will resize making the array smaller based on (size - given length). - * If the given length is too small, then the resize will fail. - * This will not shrink the size to less than 0. - * - * @param amount - * A positive number representing how much to decimate the size by. - * @param packetss - * The simple packets array to resize. - * - * @return - * F_data_not on success, but the amount to decrease by is 0. - * - * Success from f_memory_array_decimate_by(). * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_memory_array_decimate_by(). - * - * @see f_memory_array_decimate_by() - */ -#ifndef _di_f_fss_simple_packetss_decimate_by_ - extern f_status_t f_fss_simple_packetss_decimate_by(const f_number_unsigned_t amount, f_fss_simple_packetss_t *packetss); -#endif // _di_f_fss_simple_packetss_decimate_by_ - -/** - * Resize the simple packets array to a smaller size. - * - * This will resize making the array smaller based on (size - given length). - * If the given length is too small, then the resize will fail. - * This will not shrink the size to less than 0. - * - * @param amount - * A positive number representing how much to decrease the size by. - * @param packetss - * The simple packets array to resize. + * Errors (with error bit) from: f_string_dynamic_adjust(). * - * @return - * F_data_not on success, but the amount to decrease by is 0. - * - * Success from f_memory_array_decrease_by(). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_decrease_by(). - * - * @see f_memory_array_decrease_by() - */ -#ifndef _di_f_fss_simple_packetss_decrease_by_ - extern f_status_t f_fss_simple_packetss_decrease_by(const f_number_unsigned_t amount, f_fss_simple_packetss_t *packetss); -#endif // _di_f_fss_simple_packetss_decrease_by_ - -/** - * Increase the size of the simple packets array, but only if necessary. - * - * If the given length is too large for the buffer, then attempt to packet max buffer size (F_number_t_size_unsigned_d). - * If already packet to the maximum buffer size, then the resize will fail. - * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param packetss - * The simple packets array to resize. - * - * @return - * Success from f_memory_array_increase(). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase(). - * - * @see f_memory_array_increase() - */ -#ifndef _di_f_fss_simple_packetss_increase_ - extern f_status_t f_fss_simple_packetss_increase(const f_number_unsigned_t step, f_fss_simple_packetss_t *packetss); -#endif // _di_f_fss_simple_packetss_increase_ - -/** - * Resize the simple packets array to a larger size. - * - * This will resize making the array larger based on the given length. - * If the given length is too large for the buffer, then attempt to packet max buffer size (F_number_t_size_unsigned_d). - * If already packet to the maximum buffer size, then the resize will fail. - * - * @param amount - * A positive number representing how much to increase the size by. - * @param packetss - * The simple packets array to resize. - * - * @return - * Success from f_memory_array_increase_by(). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_fss_simple_packetss_increase_by_ - extern f_status_t f_fss_simple_packetss_increase_by(const f_number_unsigned_t amount, f_fss_simple_packetss_t *packetss); -#endif // _di_f_fss_simple_packetss_increase_by_ - -/** - * Resize the simple packets array. - * - * @param length - * The new size to use. - * @param packetss - * The simple packets array to resize. - * - * @return - * Success from f_memory_array_resize(). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() + * @see f_string_dynamic_adjust() */ -#ifndef _di_f_fss_simple_packetss_resize_ - extern f_status_t f_fss_simple_packetss_resize(const f_number_unsigned_t length, f_fss_simple_packetss_t *packetss); -#endif // _di_f_fss_simple_packetss_resize_ +#ifndef _di_f_fss_simple_packetss_destroy_callback_ + extern f_status_t f_fss_simple_packetss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_fss_simple_packetss_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_fss/data/build/settings b/level_0/f_fss/data/build/settings index 1ca3d78..64e5be8 100644 --- a/level_0/f_fss/data/build/settings +++ b/level_0/f_fss/data/build/settings @@ -32,7 +32,6 @@ build_libraries -lc build_libraries-individual -lf_memory -lf_string -lf_type_array -lf_utf build_sources_library fss.c fss/common.c fss/item.c fss/named.c fss/nest.c fss/quote.c fss/set.c fss/set_quote.c fss/simple_packet.c -build_sources_library fss/private-item.c fss/private-named.c fss/private-nest.c fss/private-set.c fss/private-set_quote.c fss/private-simple_packet.c build_sources_headers fss.h fss/common.h fss/item.h fss/named.h fss/nest.h fss/quote.h fss/set.h fss/set_quote.h fss/simple_packet.h diff --git a/level_0/f_fss/data/build/settings-mocks b/level_0/f_fss/data/build/settings-mocks index 5ceaed3..d97f4de 100644 --- a/level_0/f_fss/data/build/settings-mocks +++ b/level_0/f_fss/data/build/settings-mocks @@ -31,7 +31,6 @@ build_libraries -lc build_libraries-individual -lf_memory -lf_string -lf_type_array -lf_utf build_sources_library fss.c fss/common.c fss/item.c fss/named.c fss/nest.c fss/quote.c fss/set.c fss/set_quote.c fss/simple_packet.c ../../tests/unit/c/mock-fss.c -build_sources_library fss/private-item.c fss/private-named.c fss/private-nest.c fss/private-set.c fss/private-set_quote.c fss/private-simple_packet.c build_sources_headers fss.h fss/common.h fss/item.h fss/named.h fss/nest.h fss/quote.h fss/set.h fss/set_quote.h fss/simple_packet.h diff --git a/level_0/f_fss/data/build/settings-tests b/level_0/f_fss/data/build/settings-tests index fc55b4d..2ebed50 100644 --- a/level_0/f_fss/data/build/settings-tests +++ b/level_0/f_fss/data/build/settings-tests @@ -27,16 +27,16 @@ build_libraries-individual -lf_memory -lf_string -lf_type_array -lf_utf -lf_fss build_sources_program test-fss-apply_delimit.c test-fss-apply_delimit_range.c test-fss-count_lines.c test-fss-count_lines_range.c test-fss-fail_utf.c test-fss-fail_utf_to_false.c test-fss-is_combining.c test-fss-is_graph.c test-fss-is_space.c test-fss-is_zero_width.c test-fss-seek_to_eol.c test-fss-skip_past_delimit.c test-fss-skip_past_space.c -build_sources_program test-fss-items_adjust.c test-fss-items_decimate_by.c test-fss-items_decrease_by.c test-fss-items_increase.c test-fss-items_increase_by.c test-fss-items_resize.c -build_sources_program test-fss-named_adjust.c test-fss-named_decimate_by.c test-fss-named_decrease_by.c test-fss-named_increase.c test-fss-named_increase_by.c test-fss-named_resize.c -build_sources_program test-fss-nameds_adjust.c test-fss-nameds_decimate_by.c test-fss-nameds_decrease_by.c test-fss-nameds_increase.c test-fss-nameds_increase_by.c test-fss-nameds_resize.c -build_sources_program test-fss-nest_adjust.c test-fss-nest_decimate_by.c test-fss-nest_decrease_by.c test-fss-nest_increase.c test-fss-nest_increase_by.c test-fss-nest_resize.c -build_sources_program test-fss-nests_adjust.c test-fss-nests_decimate_by.c test-fss-nests_decrease_by.c test-fss-nests_increase.c test-fss-nests_increase_by.c test-fss-nests_resize.c -build_sources_program test-fss-set_adjust.c test-fss-set_decimate_by.c test-fss-set_decrease_by.c test-fss-set_increase.c test-fss-set_increase_by.c test-fss-set_resize.c -build_sources_program test-fss-set_quote_adjust.c test-fss-set_quote_decimate_by.c test-fss-set_quote_decrease_by.c test-fss-set_quote_increase.c test-fss-set_quote_increase_by.c test-fss-set_quote_resize.c -build_sources_program test-fss-set_quotes_adjust.c test-fss-set_quotes_decimate_by.c test-fss-set_quotes_decrease_by.c test-fss-set_quotes_increase.c test-fss-set_quotes_increase_by.c test-fss-set_quotes_resize.c -build_sources_program test-fss-sets_adjust.c test-fss-sets_decimate_by.c test-fss-sets_decrease_by.c test-fss-sets_increase.c test-fss-sets_increase_by.c test-fss-sets_resize.c -build_sources_program test-fss-simple_packet_ranges_adjust.c test-fss-simple_packet_ranges_decimate_by.c test-fss-simple_packet_ranges_decrease_by.c test-fss-simple_packet_ranges_increase.c test-fss-simple_packet_ranges_increase_by.c test-fss-simple_packet_ranges_resize.c +#build_sources_program test-fss-items_destroy_callback.c test-fss-items_delete_callback.c +#build_sources_program test-fss-named_destroy_callback.c test-fss-named_delete_callback.c +#build_sources_program test-fss-nameds_destroy_callback.c test-fss-nameds_delete_callback.c +#build_sources_program test-fss-nest_destroy_callback.c test-fss-nest_delete_callback.c +#build_sources_program test-fss-nests_destroy_callback.c test-fss-nests_delete_callback.c +#build_sources_program test-fss-set_destroy_callback.c test-fss-set_delete_callback.c +#build_sources_program test-fss-set_quote_destroy_callback.c test-fss-set_quote_delete_callback.c +#build_sources_program test-fss-set_quotes_destroy_callback.c test-fss-set_quotes_delete_callback.c +#build_sources_program test-fss-sets_destroy_callback.c test-fss-sets_delete_callback.c +#build_sources_program test-fss-simple_packet_ranges_destroy_callback.c test-fss-simple_packet_ranges_delete_callback.c build_sources_program test-fss.c diff --git a/level_0/f_fss/tests/unit/c/test-fss-items_adjust.c b/level_0/f_fss/tests/unit/c/test-fss-items_adjust.c deleted file mode 100644 index eead9b2..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-items_adjust.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-fss.h" -#include "test-fss-items_adjust.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_items_adjust__parameter_checking(void **state) { - - const int length = 5; - f_fss_items_t data = f_fss_items_t_initialize; - - { - const f_status_t status = f_fss_items_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); -} - -void test__f_fss_items_adjust__works(void **state) { - - const int length = 5; - f_fss_items_t data = f_fss_items_t_initialize; - - { - const f_status_t status = f_fss_items_adjust(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-items_adjust.h b/level_0/f_fss/tests/unit/c/test-fss-items_adjust.h deleted file mode 100644 index 96909c4..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-items_adjust.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test items adjust in the fss project. - */ -#ifndef _TEST__F_fss__items_adjust -#define _TEST__F_fss__items_adjust - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_items_adjust() - */ -extern void test__f_fss_items_adjust__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_fss_items_adjust() - */ -extern void test__f_fss_items_adjust__works(void **state); - -#endif // _TEST__F_fss__items_adjust diff --git a/level_0/f_fss/tests/unit/c/test-fss-items_decimate_by.c b/level_0/f_fss/tests/unit/c/test-fss-items_decimate_by.c deleted file mode 100644 index c307ff4..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-items_decimate_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-fss.h" -#include "test-fss-items_decimate_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_items_decimate_by__parameter_checking(void **state) { - - const int length = 5; - f_fss_items_t data = f_fss_items_t_initialize; - - { - const f_status_t status = f_fss_items_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); -} - -void test__f_fss_items_decimate_by__returns_data_not(void **state) { - - const int length = 5; - f_fss_items_t data = f_fss_items_t_initialize; - - { - const f_status_t status = f_fss_items_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_fss_items_decimate_by(0, &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_fss_items_decimate_by__works(void **state) { - - const int length = 5; - f_fss_items_t data = f_fss_items_t_initialize; - - { - const f_status_t status = f_fss_items_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_fss_items_decimate_by(length, &data); - - assert_int_equal(status, F_none); - 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_fss/tests/unit/c/test-fss-items_decimate_by.h b/level_0/f_fss/tests/unit/c/test-fss-items_decimate_by.h deleted file mode 100644 index 69e88cf..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-items_decimate_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test items decimate by in the fss project. - */ -#ifndef _TEST__F_fss__items_decimate_by -#define _TEST__F_fss__items_decimate_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_items_decimate_by() - */ -extern void test__f_fss_items_decimate_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_fss_items_decimate_by() - */ -extern void test__f_fss_items_decimate_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_fss_items_decimate_by() - */ -extern void test__f_fss_items_decimate_by__works(void **state); - -#endif // _TEST__F_fss__items_decimate_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-items_decrease_by.c b/level_0/f_fss/tests/unit/c/test-fss-items_decrease_by.c deleted file mode 100644 index 58e09cd..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-items_decrease_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-fss.h" -#include "test-fss-items_decrease_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_items_decrease_by__parameter_checking(void **state) { - - const int length = 5; - f_fss_items_t data = f_fss_items_t_initialize; - - { - const f_status_t status = f_fss_items_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); -} - -void test__f_fss_items_decrease_by__returns_data_not(void **state) { - - const int length = 5; - f_fss_items_t data = f_fss_items_t_initialize; - - { - const f_status_t status = f_fss_items_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_fss_items_decrease_by(0, &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_fss_items_decrease_by__works(void **state) { - - const int length = 5; - f_fss_items_t data = f_fss_items_t_initialize; - - { - const f_status_t status = f_fss_items_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_fss_items_decrease_by(length, &data); - - assert_int_equal(status, F_none); - 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_fss/tests/unit/c/test-fss-items_decrease_by.h b/level_0/f_fss/tests/unit/c/test-fss-items_decrease_by.h deleted file mode 100644 index c351eab..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-items_decrease_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test items decrease by in the fss project. - */ -#ifndef _TEST__F_fss__items_decrease_by -#define _TEST__F_fss__items_decrease_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_items_decrease_by() - */ -extern void test__f_fss_items_decrease_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_fss_items_decrease_by() - */ -extern void test__f_fss_items_decrease_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_fss_items_decrease_by() - */ -extern void test__f_fss_items_decrease_by__works(void **state); - -#endif // _TEST__F_fss__items_decrease_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-items_delete_callback.c b/level_0/f_fss/tests/unit/c/test-fss-items_delete_callback.c new file mode 100644 index 0000000..7374955 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-items_delete_callback.c @@ -0,0 +1,217 @@ +#include "test-directory.h" +#include "test-directory-listings_delete_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_items_delete_callback__fails(void **state) { + + mock_unwrap = 0; + + f_fss_item_t data = f_fss_item_t_initialize; + f_fss_item_t data_array[] = { data }; + f_fss_items_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_fss_items_t datass_array[] = { datas }; + + { + will_return(__wrap_f_string_dynamics_resize, true); + will_return(__wrap_f_string_dynamics_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_items_delete_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, true); + will_return(__wrap_f_string_dynamics_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_items_delete_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, true); + will_return(__wrap_f_string_dynamics_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_items_delete_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, true); + will_return(__wrap_f_string_dynamics_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_items_delete_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, true); + will_return(__wrap_f_string_dynamics_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_items_delete_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, true); + will_return(__wrap_f_string_dynamics_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_items_delete_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, true); + will_return(__wrap_f_string_dynamics_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_items_delete_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, true); + will_return(__wrap_f_string_dynamics_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_items_delete_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_fss_items_delete_callback__works(void **state) { + + mock_unwrap = 0; + + f_fss_item_t data = f_fss_item_t_initialize; + f_fss_item_t data_array[] = { data }; + f_fss_items_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_fss_items_t datass_array[] = { datas }; + const f_number_unsigned_t length = 1; + + { + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + will_return(__wrap_f_string_dynamics_resize, false); + will_return(__wrap_f_string_dynamics_resize, F_none); + + const f_status_t status = f_fss_items_delete_callback(0, length, (void *) datass_array); + + assert_int_equal(status, F_none); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-items_delete_callback.h b/level_0/f_fss/tests/unit/c/test-fss-items_delete_callback.h new file mode 100644 index 0000000..1972635 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-items_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_fss__listings_delete_callback +#define _TEST__F_fss__listings_delete_callback + +/** + * Test that the function fails. + * + * @see f_fss_items_delete_callback() + */ +extern void test__f_fss_items_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_fss_items_delete_callback() + */ +extern void test__f_fss_items_delete_callback__works(void **state); + +#endif // _TEST__F_fss__listings_delete_callback diff --git a/level_0/f_fss/tests/unit/c/test-fss-items_destroy_callback.c b/level_0/f_fss/tests/unit/c/test-fss-items_destroy_callback.c new file mode 100644 index 0000000..39d03b9 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-items_destroy_callback.c @@ -0,0 +1,217 @@ +#include "test-directory.h" +#include "test-directory-listings_destroy_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_items_destroy_callback__fails(void **state) { + + mock_unwrap = 0; + + f_fss_item_t data = f_fss_item_t_initialize; + f_fss_item_t data_array[] = { data }; + f_fss_items_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_fss_items_t datass_array[] = { datas }; + + { + will_return(__wrap_f_string_dynamics_adjust, true); + will_return(__wrap_f_string_dynamics_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_items_destroy_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, true); + will_return(__wrap_f_string_dynamics_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_items_destroy_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, true); + will_return(__wrap_f_string_dynamics_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_items_destroy_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, true); + will_return(__wrap_f_string_dynamics_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_items_destroy_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, true); + will_return(__wrap_f_string_dynamics_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_items_destroy_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, true); + will_return(__wrap_f_string_dynamics_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_items_destroy_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, true); + will_return(__wrap_f_string_dynamics_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_items_destroy_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } + + { + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, true); + will_return(__wrap_f_string_dynamics_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_fss_items_destroy_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_fss_items_destroy_callback__works(void **state) { + + mock_unwrap = 0; + + f_fss_item_t data = f_fss_item_t_initialize; + f_fss_item_t data_array[] = { data }; + f_fss_items_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_fss_items_t datass_array[] = { datas }; + const f_number_unsigned_t length = 1; + + { + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + will_return(__wrap_f_string_dynamics_adjust, false); + will_return(__wrap_f_string_dynamics_adjust, F_none); + + const f_status_t status = f_fss_items_destroy_callback(0, length, (void *) datass_array); + + assert_int_equal(status, F_none); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-items_destroy_callback.h b/level_0/f_fss/tests/unit/c/test-fss-items_destroy_callback.h new file mode 100644 index 0000000..637dc10 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-items_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_fss__listings_destroy_callback +#define _TEST__F_fss__listings_destroy_callback + +/** + * Test that the function fails. + * + * @see f_fss_items_destroy_callback() + */ +extern void test__f_fss_items_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_fss_items_destroy_callback() + */ +extern void test__f_fss_items_destroy_callback__works(void **state); + +#endif // _TEST__F_fss__listings_destroy_callback diff --git a/level_0/f_fss/tests/unit/c/test-fss-items_increase.c b/level_0/f_fss/tests/unit/c/test-fss-items_increase.c deleted file mode 100644 index 234533f..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-items_increase.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-fss.h" -#include "test-fss-items_increase.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_items_increase__parameter_checking(void **state) { - - const int length = 5; - f_fss_items_t data = f_fss_items_t_initialize; - - { - const f_status_t status = f_fss_items_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); -} - -void test__f_fss_items_increase__returns_data_not(void **state) { - - const int length = 5; - f_fss_items_t data = f_fss_items_t_initialize; - - { - const f_status_t status = f_fss_items_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_fss_items_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_fss_items_increase__works(void **state) { - - const int length = 5; - f_fss_items_t data = f_fss_items_t_initialize; - - { - const f_status_t status = f_fss_items_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_fss_items_increase(length, &data); - - assert_int_equal(status, F_none); - 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); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-items_increase.h b/level_0/f_fss/tests/unit/c/test-fss-items_increase.h deleted file mode 100644 index 4389a2e..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-items_increase.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test items increase in the fss project. - */ -#ifndef _TEST__F_fss__items_increase -#define _TEST__F_fss__items_increase - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_items_increase() - */ -extern void test__f_fss_items_increase__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_fss_items_increase() - */ -extern void test__f_fss_items_increase__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_fss_items_increase() - */ -extern void test__f_fss_items_increase__works(void **state); - -#endif // _TEST__F_fss__items_increase diff --git a/level_0/f_fss/tests/unit/c/test-fss-items_increase_by.c b/level_0/f_fss/tests/unit/c/test-fss-items_increase_by.c deleted file mode 100644 index 4554d9a..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-items_increase_by.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-fss.h" -#include "test-fss-items_increase_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_items_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_fss_items_t data = f_fss_items_t_initialize; - - { - const f_status_t status = f_fss_items_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); -} - -void test__f_fss_items_increase_by__returns_data_not(void **state) { - - const int length = 5; - f_fss_items_t data = f_fss_items_t_initialize; - - { - const f_status_t status = f_fss_items_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_fss_items_increase_by(0, &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_fss_items_increase_by__works(void **state) { - - const int length = 5; - f_fss_items_t data = f_fss_items_t_initialize; - - { - const f_status_t status = f_fss_items_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_fss_items_increase_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-items_increase_by.h b/level_0/f_fss/tests/unit/c/test-fss-items_increase_by.h deleted file mode 100644 index 81c58ad..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-items_increase_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test items increase by in the fss project. - */ -#ifndef _TEST__F_fss__items_increase_by -#define _TEST__F_fss__items_increase_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_items_increase_by() - */ -extern void test__f_fss_items_increase_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_fss_items_increase_by() - */ -extern void test__f_fss_items_increase_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_fss_items_increase_by() - */ -extern void test__f_fss_items_increase_by__works(void **state); - -#endif // _TEST__F_fss__items_increase_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-items_resize.c b/level_0/f_fss/tests/unit/c/test-fss-items_resize.c deleted file mode 100644 index 9a080d4..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-items_resize.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-fss.h" -#include "test-fss-items_resize.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_items_resize__parameter_checking(void **state) { - - const int length = 5; - f_fss_items_t data = f_fss_items_t_initialize; - - { - const f_status_t status = f_fss_items_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); -} - -void test__f_fss_items_resize__works(void **state) { - - const int length = 5; - f_fss_items_t data = f_fss_items_t_initialize; - - { - const f_status_t status = f_fss_items_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-items_resize.h b/level_0/f_fss/tests/unit/c/test-fss-items_resize.h deleted file mode 100644 index 1a070f7..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-items_resize.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test items resize in the fss project. - */ -#ifndef _TEST__F_fss__items_resize -#define _TEST__F_fss__items_resize - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_items_resize() - */ -extern void test__f_fss_items_resize__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_fss_items_resize() - */ -extern void test__f_fss_items_resize__works(void **state); - -#endif // _TEST__F_fss__items_resize diff --git a/level_0/f_fss/tests/unit/c/test-fss-named_adjust.c b/level_0/f_fss/tests/unit/c/test-fss-named_adjust.c deleted file mode 100644 index 9ed2957..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-named_adjust.c +++ /dev/null @@ -1,54 +0,0 @@ -#include "test-fss.h" -#include "test-fss-nameds_adjust.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_named_adjust__parameter_checking(void **state) { - - const int length = 5; - f_fss_named_t data = f_fss_named_t_initialize; - - { - const f_status_t status = f_fss_named_adjust(length, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.objects.size, 0); - assert_int_equal(data.contents.used, 0); - assert_int_equal(data.contents.size, 0); - assert_int_equal(data.quotess.used, 0); - assert_int_equal(data.quotess.size, 0); - } - - assert_null(data.objects.array); - assert_null(data.contents.array); - assert_null(data.quotess.array); -} - -void test__f_fss_named_adjust__works(void **state) { - - const int length = 5; - f_fss_named_t data = f_fss_named_t_initialize; - - { - const f_status_t status = f_fss_named_adjust(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.objects.size, length); - assert_int_equal(data.contents.used, 0); - assert_int_equal(data.contents.size, length); - assert_int_equal(data.quotess.used, 0); - assert_int_equal(data.quotess.size, length); - } - - free((void *) data.objects.array); - free((void *) data.contents.array); - free((void *) data.quotess.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-named_adjust.h b/level_0/f_fss/tests/unit/c/test-fss-named_adjust.h deleted file mode 100644 index 3033e2f..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-named_adjust.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test named adjust in the fss project. - */ -#ifndef _TEST__F_fss__named_adjust -#define _TEST__F_fss__named_adjust - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_named_adjust() - */ -extern void test__f_fss_named_adjust__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_fss_named_adjust() - */ -extern void test__f_fss_named_adjust__works(void **state); - -#endif // _TEST__F_fss__named_adjust diff --git a/level_0/f_fss/tests/unit/c/test-fss-named_decimate_by.c b/level_0/f_fss/tests/unit/c/test-fss-named_decimate_by.c deleted file mode 100644 index 7da3d0e..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-named_decimate_by.c +++ /dev/null @@ -1,100 +0,0 @@ -#include "test-fss.h" -#include "test-fss-nameds_decimate_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_named_decimate_by__parameter_checking(void **state) { - - const int length = 5; - f_fss_named_t data = f_fss_named_t_initialize; - - { - const f_status_t status = f_fss_named_decimate_by(length, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.objects.size, 0); - assert_int_equal(data.contents.used, 0); - assert_int_equal(data.contents.size, 0); - assert_int_equal(data.quotess.used, 0); - assert_int_equal(data.quotess.size, 0); - } - - assert_null(data.objects.array); - assert_null(data.contents.array); - assert_null(data.quotess.array); -} - -void test__f_fss_named_decimate_by__returns_data_not(void **state) { - - const int length = 5; - f_fss_named_t data = f_fss_named_t_initialize; - - { - const f_status_t status = f_fss_named_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.objects.size, length); - assert_int_equal(data.contents.used, 0); - assert_int_equal(data.contents.size, length); - assert_int_equal(data.quotess.used, 0); - assert_int_equal(data.quotess.size, length); - } - - { - const f_status_t status = f_fss_named_decimate_by(0, &data); - - assert_int_equal(status, F_data_not); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.objects.size, length); - assert_int_equal(data.contents.used, 0); - assert_int_equal(data.contents.size, length); - assert_int_equal(data.quotess.used, 0); - assert_int_equal(data.quotess.size, length); - } - - free((void *) data.objects.array); - free((void *) data.contents.array); - free((void *) data.quotess.array); -} - -void test__f_fss_named_decimate_by__works(void **state) { - - const int length = 5; - f_fss_named_t data = f_fss_named_t_initialize; - - { - const f_status_t status = f_fss_named_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.objects.size, length); - assert_int_equal(data.contents.used, 0); - assert_int_equal(data.contents.size, length); - assert_int_equal(data.quotess.used, 0); - assert_int_equal(data.quotess.size, length); - } - - { - const f_status_t status = f_fss_named_decimate_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.objects.size, 0); - assert_int_equal(data.contents.used, 0); - assert_int_equal(data.contents.size, 0); - assert_int_equal(data.quotess.used, 0); - assert_int_equal(data.quotess.size, 0); - } - - assert_null(data.objects.array); - assert_null(data.contents.array); - assert_null(data.quotess.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-named_decimate_by.h b/level_0/f_fss/tests/unit/c/test-fss-named_decimate_by.h deleted file mode 100644 index e5573c3..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-named_decimate_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test named decimate by in the fss project. - */ -#ifndef _TEST__F_fss__named_decimate_by -#define _TEST__F_fss__named_decimate_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_named_decimate_by() - */ -extern void test__f_fss_named_decimate_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_fss_named_decimate_by() - */ -extern void test__f_fss_named_decimate_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_fss_named_decimate_by() - */ -extern void test__f_fss_named_decimate_by__works(void **state); - -#endif // _TEST__F_fss__named_decimate_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-named_decrease_by.c b/level_0/f_fss/tests/unit/c/test-fss-named_decrease_by.c deleted file mode 100644 index 1678c12..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-named_decrease_by.c +++ /dev/null @@ -1,100 +0,0 @@ -#include "test-fss.h" -#include "test-fss-nameds_decrease_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_named_decrease_by__parameter_checking(void **state) { - - const int length = 5; - f_fss_named_t data = f_fss_named_t_initialize; - - { - const f_status_t status = f_fss_named_decrease_by(length, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.objects.size, 0); - assert_int_equal(data.contents.used, 0); - assert_int_equal(data.contents.size, 0); - assert_int_equal(data.quotess.used, 0); - assert_int_equal(data.quotess.size, 0); - } - - assert_null(data.objects.array); - assert_null(data.contents.array); - assert_null(data.quotess.array); -} - -void test__f_fss_named_decrease_by__returns_data_not(void **state) { - - const int length = 5; - f_fss_named_t data = f_fss_named_t_initialize; - - { - const f_status_t status = f_fss_named_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.objects.size, length); - assert_int_equal(data.contents.used, 0); - assert_int_equal(data.contents.size, length); - assert_int_equal(data.quotess.used, 0); - assert_int_equal(data.quotess.size, length); - } - - { - const f_status_t status = f_fss_named_decrease_by(0, &data); - - assert_int_equal(status, F_data_not); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.objects.size, length); - assert_int_equal(data.contents.used, 0); - assert_int_equal(data.contents.size, length); - assert_int_equal(data.quotess.used, 0); - assert_int_equal(data.quotess.size, length); - } - - free((void *) data.objects.array); - free((void *) data.contents.array); - free((void *) data.quotess.array); -} - -void test__f_fss_named_decrease_by__works(void **state) { - - const int length = 5; - f_fss_named_t data = f_fss_named_t_initialize; - - { - const f_status_t status = f_fss_named_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.objects.size, length); - assert_int_equal(data.contents.used, 0); - assert_int_equal(data.contents.size, length); - assert_int_equal(data.quotess.used, 0); - assert_int_equal(data.quotess.size, length); - } - - { - const f_status_t status = f_fss_named_decrease_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.objects.size, 0); - assert_int_equal(data.contents.used, 0); - assert_int_equal(data.contents.size, 0); - assert_int_equal(data.quotess.used, 0); - assert_int_equal(data.quotess.size, 0); - } - - assert_null(data.objects.array); - assert_null(data.contents.array); - assert_null(data.quotess.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-named_decrease_by.h b/level_0/f_fss/tests/unit/c/test-fss-named_decrease_by.h deleted file mode 100644 index 7c87f77..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-named_decrease_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test named decrease by in the fss project. - */ -#ifndef _TEST__F_fss__named_decrease_by -#define _TEST__F_fss__named_decrease_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_named_decrease_by() - */ -extern void test__f_fss_named_decrease_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_fss_named_decrease_by() - */ -extern void test__f_fss_named_decrease_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_fss_named_decrease_by() - */ -extern void test__f_fss_named_decrease_by__works(void **state); - -#endif // _TEST__F_fss__named_decrease_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-named_increase.c b/level_0/f_fss/tests/unit/c/test-fss-named_increase.c deleted file mode 100644 index a018b2d..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-named_increase.c +++ /dev/null @@ -1,104 +0,0 @@ -#include "test-fss.h" -#include "test-fss-nameds_increase.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_named_increase__parameter_checking(void **state) { - - const int length = 5; - f_fss_named_t data = f_fss_named_t_initialize; - - { - const f_status_t status = f_fss_named_increase(length, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.objects.size, 0); - assert_int_equal(data.contents.used, 0); - assert_int_equal(data.contents.size, 0); - assert_int_equal(data.quotess.used, 0); - assert_int_equal(data.quotess.size, 0); - } - - free((void *) data.objects.array); - free((void *) data.contents.array); - free((void *) data.quotess.array); -} - -void test__f_fss_named_increase__returns_data_not(void **state) { - - const int length = 5; - f_fss_named_t data = f_fss_named_t_initialize; - - { - const f_status_t status = f_fss_named_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.objects.size, length); - assert_int_equal(data.contents.used, 0); - assert_int_equal(data.contents.size, length); - assert_int_equal(data.quotess.used, 0); - assert_int_equal(data.quotess.size, length); - } - - { - const f_status_t status = f_fss_named_increase(length, &data); - - assert_int_equal(status, F_data_not); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.objects.size, length); - assert_int_equal(data.contents.used, 0); - assert_int_equal(data.contents.size, length); - assert_int_equal(data.quotess.used, 0); - assert_int_equal(data.quotess.size, length); - } - - free((void *) data.objects.array); - free((void *) data.contents.array); - free((void *) data.quotess.array); -} - -void test__f_fss_named_increase__works(void **state) { - - const int length = 5; - f_fss_named_t data = f_fss_named_t_initialize; - - { - const f_status_t status = f_fss_named_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.objects.size, length); - assert_int_equal(data.contents.used, 0); - assert_int_equal(data.contents.size, length); - assert_int_equal(data.quotess.used, 0); - assert_int_equal(data.quotess.size, length); - } - - { - data.objects.used = length; - data.contents.used = length; - data.quotess.used = length; - - const f_status_t status = f_fss_named_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.objects.used, length); - assert_in_range(data.objects.size, length + 1, length + 1 + F_memory_default_allocation_small_d); - assert_int_equal(data.contents.used, length); - assert_in_range(data.contents.size, length + 1, length + 1 + F_memory_default_allocation_small_d); - assert_int_equal(data.quotess.used, length); - assert_in_range(data.quotess.size, length + 1, length + 1 + F_memory_default_allocation_small_d); - } - - free((void *) data.objects.array); - free((void *) data.contents.array); - free((void *) data.quotess.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-named_increase.h b/level_0/f_fss/tests/unit/c/test-fss-named_increase.h deleted file mode 100644 index c6f6991..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-named_increase.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test named increase in the fss project. - */ -#ifndef _TEST__F_fss__named_increase -#define _TEST__F_fss__named_increase - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_named_increase() - */ -extern void test__f_fss_named_increase__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_fss_named_increase() - */ -extern void test__f_fss_named_increase__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_fss_named_increase() - */ -extern void test__f_fss_named_increase__works(void **state); - -#endif // _TEST__F_fss__named_increase diff --git a/level_0/f_fss/tests/unit/c/test-fss-named_increase_by.c b/level_0/f_fss/tests/unit/c/test-fss-named_increase_by.c deleted file mode 100644 index 1fa48db..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-named_increase_by.c +++ /dev/null @@ -1,104 +0,0 @@ -#include "test-fss.h" -#include "test-fss-nameds_increase_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_named_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_fss_named_t data = f_fss_named_t_initialize; - - { - const f_status_t status = f_fss_named_increase_by(length, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.objects.size, 0); - assert_int_equal(data.contents.used, 0); - assert_int_equal(data.contents.size, 0); - assert_int_equal(data.quotess.used, 0); - assert_int_equal(data.quotess.size, 0); - } - - assert_null(data.objects.array); - assert_null(data.contents.array); - assert_null(data.quotess.array); -} - -void test__f_fss_named_increase_by__returns_data_not(void **state) { - - const int length = 5; - f_fss_named_t data = f_fss_named_t_initialize; - - { - const f_status_t status = f_fss_named_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.objects.size, length); - assert_int_equal(data.contents.used, 0); - assert_int_equal(data.contents.size, length); - assert_int_equal(data.quotess.used, 0); - assert_int_equal(data.quotess.size, length); - } - - { - const f_status_t status = f_fss_named_decimate_by(0, &data); - - assert_int_equal(status, F_data_not); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.objects.size, length); - assert_int_equal(data.contents.used, 0); - assert_int_equal(data.contents.size, length); - assert_int_equal(data.quotess.used, 0); - assert_int_equal(data.quotess.size, length); - } - - free((void *) data.objects.array); - free((void *) data.contents.array); - free((void *) data.quotess.array); -} - -void test__f_fss_named_increase_by__works(void **state) { - - const int length = 5; - f_fss_named_t data = f_fss_named_t_initialize; - - { - const f_status_t status = f_fss_named_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.objects.size, length); - assert_int_equal(data.contents.used, 0); - assert_int_equal(data.contents.size, length); - assert_int_equal(data.quotess.used, 0); - assert_int_equal(data.quotess.size, length); - } - - { - data.objects.used = length; - data.contents.used = length; - data.quotess.used = length; - - const f_status_t status = f_fss_named_increase_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.objects.used, length); - assert_int_equal(data.objects.size, length * 2); - assert_int_equal(data.contents.used, length); - assert_int_equal(data.contents.size, length * 2); - assert_int_equal(data.quotess.used, length); - assert_int_equal(data.quotess.size, length * 2); - } - - free((void *) data.objects.array); - free((void *) data.contents.array); - free((void *) data.quotess.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-named_increase_by.h b/level_0/f_fss/tests/unit/c/test-fss-named_increase_by.h deleted file mode 100644 index 415b052..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-named_increase_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test named increase by in the fss project. - */ -#ifndef _TEST__F_fss__named_increase_by -#define _TEST__F_fss__named_increase_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_named_increase_by() - */ -extern void test__f_fss_named_increase_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_fss_named_increase_by() - */ -extern void test__f_fss_named_increase_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_fss_named_increase_by() - */ -extern void test__f_fss_named_increase_by__works(void **state); - -#endif // _TEST__F_fss__named_increase_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-named_resize.c b/level_0/f_fss/tests/unit/c/test-fss-named_resize.c deleted file mode 100644 index 3ce2f05..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-named_resize.c +++ /dev/null @@ -1,54 +0,0 @@ -#include "test-fss.h" -#include "test-fss-nameds_resize.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_named_resize__parameter_checking(void **state) { - - const int length = 5; - f_fss_named_t data = f_fss_named_t_initialize; - - { - const f_status_t status = f_fss_named_resize(length, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.objects.size, 0); - assert_int_equal(data.contents.used, 0); - assert_int_equal(data.contents.size, 0); - assert_int_equal(data.quotess.used, 0); - assert_int_equal(data.quotess.size, 0); - } - - assert_null(data.objects.array); - assert_null(data.contents.array); - assert_null(data.quotess.array); -} - -void test__f_fss_named_resize__works(void **state) { - - const int length = 5; - f_fss_named_t data = f_fss_named_t_initialize; - - { - const f_status_t status = f_fss_named_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.objects.size, length); - assert_int_equal(data.contents.used, 0); - assert_int_equal(data.contents.size, length); - assert_int_equal(data.quotess.used, 0); - assert_int_equal(data.quotess.size, length); - } - - free((void *) data.objects.array); - free((void *) data.contents.array); - free((void *) data.quotess.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-named_resize.h b/level_0/f_fss/tests/unit/c/test-fss-named_resize.h deleted file mode 100644 index 57d6e8d..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-named_resize.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test named resize in the fss project. - */ -#ifndef _TEST__F_fss__named_resize -#define _TEST__F_fss__named_resize - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_named_resize() - */ -extern void test__f_fss_named_resize__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_fss_named_resize() - */ -extern void test__f_fss_named_resize__works(void **state); - -#endif // _TEST__F_fss__named_resize diff --git a/level_0/f_fss/tests/unit/c/test-fss-nameds_adjust.c b/level_0/f_fss/tests/unit/c/test-fss-nameds_adjust.c deleted file mode 100644 index 38b7cbd..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-nameds_adjust.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-fss.h" -#include "test-fss-nameds_adjust.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_nameds_adjust__parameter_checking(void **state) { - - const int length = 5; - f_fss_nameds_t data = f_fss_nameds_t_initialize; - - { - const f_status_t status = f_fss_nameds_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); -} - -void test__f_fss_nameds_adjust__works(void **state) { - - const int length = 5; - f_fss_nameds_t data = f_fss_nameds_t_initialize; - - { - const f_status_t status = f_fss_nameds_adjust(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-nameds_adjust.h b/level_0/f_fss/tests/unit/c/test-fss-nameds_adjust.h deleted file mode 100644 index 4fd75ad..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-nameds_adjust.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test nameds adjust in the fss project. - */ -#ifndef _TEST__F_fss__nameds_adjust -#define _TEST__F_fss__nameds_adjust - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_nameds_adjust() - */ -extern void test__f_fss_nameds_adjust__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_fss_nameds_adjust() - */ -extern void test__f_fss_nameds_adjust__works(void **state); - -#endif // _TEST__F_fss__nameds_adjust diff --git a/level_0/f_fss/tests/unit/c/test-fss-nameds_decimate_by.c b/level_0/f_fss/tests/unit/c/test-fss-nameds_decimate_by.c deleted file mode 100644 index 08ea159..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-nameds_decimate_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-fss.h" -#include "test-fss-nameds_decimate_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_nameds_decimate_by__parameter_checking(void **state) { - - const int length = 5; - f_fss_nameds_t data = f_fss_nameds_t_initialize; - - { - const f_status_t status = f_fss_nameds_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); -} - -void test__f_fss_nameds_decimate_by__returns_data_not(void **state) { - - const int length = 5; - f_fss_nameds_t data = f_fss_nameds_t_initialize; - - { - const f_status_t status = f_fss_nameds_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_fss_nameds_decimate_by(0, &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_fss_nameds_decimate_by__works(void **state) { - - const int length = 5; - f_fss_nameds_t data = f_fss_nameds_t_initialize; - - { - const f_status_t status = f_fss_nameds_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_fss_nameds_decimate_by(length, &data); - - assert_int_equal(status, F_none); - 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_fss/tests/unit/c/test-fss-nameds_decimate_by.h b/level_0/f_fss/tests/unit/c/test-fss-nameds_decimate_by.h deleted file mode 100644 index 8251be2..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-nameds_decimate_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test nameds decimate by in the fss project. - */ -#ifndef _TEST__F_fss__nameds_decimate_by -#define _TEST__F_fss__nameds_decimate_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_nameds_decimate_by() - */ -extern void test__f_fss_nameds_decimate_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_fss_nameds_decimate_by() - */ -extern void test__f_fss_nameds_decimate_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_fss_nameds_decimate_by() - */ -extern void test__f_fss_nameds_decimate_by__works(void **state); - -#endif // _TEST__F_fss__nameds_decimate_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-nameds_decrease_by.c b/level_0/f_fss/tests/unit/c/test-fss-nameds_decrease_by.c deleted file mode 100644 index d7a70da..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-nameds_decrease_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-fss.h" -#include "test-fss-nameds_decrease_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_nameds_decrease_by__parameter_checking(void **state) { - - const int length = 5; - f_fss_nameds_t data = f_fss_nameds_t_initialize; - - { - const f_status_t status = f_fss_nameds_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); -} - -void test__f_fss_nameds_decrease_by__returns_data_not(void **state) { - - const int length = 5; - f_fss_nameds_t data = f_fss_nameds_t_initialize; - - { - const f_status_t status = f_fss_nameds_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_fss_nameds_decrease_by(0, &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_fss_nameds_decrease_by__works(void **state) { - - const int length = 5; - f_fss_nameds_t data = f_fss_nameds_t_initialize; - - { - const f_status_t status = f_fss_nameds_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_fss_nameds_decrease_by(length, &data); - - assert_int_equal(status, F_none); - 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_fss/tests/unit/c/test-fss-nameds_decrease_by.h b/level_0/f_fss/tests/unit/c/test-fss-nameds_decrease_by.h deleted file mode 100644 index 1e0c4a7..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-nameds_decrease_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test nameds decrease by in the fss project. - */ -#ifndef _TEST__F_fss__nameds_decrease_by -#define _TEST__F_fss__nameds_decrease_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_nameds_decrease_by() - */ -extern void test__f_fss_nameds_decrease_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_fss_nameds_decrease_by() - */ -extern void test__f_fss_nameds_decrease_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_fss_nameds_decrease_by() - */ -extern void test__f_fss_nameds_decrease_by__works(void **state); - -#endif // _TEST__F_fss__nameds_decrease_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-nameds_increase.c b/level_0/f_fss/tests/unit/c/test-fss-nameds_increase.c deleted file mode 100644 index 4884436..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-nameds_increase.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-fss.h" -#include "test-fss-nameds_increase.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_nameds_increase__parameter_checking(void **state) { - - const int length = 5; - f_fss_nameds_t data = f_fss_nameds_t_initialize; - - { - const f_status_t status = f_fss_nameds_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); -} - -void test__f_fss_nameds_increase__returns_data_not(void **state) { - - const int length = 5; - f_fss_nameds_t data = f_fss_nameds_t_initialize; - - { - const f_status_t status = f_fss_nameds_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_fss_nameds_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_fss_nameds_increase__works(void **state) { - - const int length = 5; - f_fss_nameds_t data = f_fss_nameds_t_initialize; - - { - const f_status_t status = f_fss_nameds_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_fss_nameds_increase(length, &data); - - assert_int_equal(status, F_none); - 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); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-nameds_increase.h b/level_0/f_fss/tests/unit/c/test-fss-nameds_increase.h deleted file mode 100644 index ab7791f..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-nameds_increase.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test nameds increase in the fss project. - */ -#ifndef _TEST__F_fss__nameds_increase -#define _TEST__F_fss__nameds_increase - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_nameds_increase() - */ -extern void test__f_fss_nameds_increase__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_fss_nameds_increase() - */ -extern void test__f_fss_nameds_increase__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_fss_nameds_increase() - */ -extern void test__f_fss_nameds_increase__works(void **state); - -#endif // _TEST__F_fss__nameds_increase diff --git a/level_0/f_fss/tests/unit/c/test-fss-nameds_increase_by.c b/level_0/f_fss/tests/unit/c/test-fss-nameds_increase_by.c deleted file mode 100644 index 594f3fe..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-nameds_increase_by.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-fss.h" -#include "test-fss-nameds_increase_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_nameds_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_fss_nameds_t data = f_fss_nameds_t_initialize; - - { - const f_status_t status = f_fss_nameds_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); -} - -void test__f_fss_nameds_increase_by__returns_data_not(void **state) { - - const int length = 5; - f_fss_nameds_t data = f_fss_nameds_t_initialize; - - { - const f_status_t status = f_fss_nameds_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_fss_nameds_increase_by(0, &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_fss_nameds_increase_by__works(void **state) { - - const int length = 5; - f_fss_nameds_t data = f_fss_nameds_t_initialize; - - { - const f_status_t status = f_fss_nameds_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_fss_nameds_increase_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-nameds_increase_by.h b/level_0/f_fss/tests/unit/c/test-fss-nameds_increase_by.h deleted file mode 100644 index c611dac..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-nameds_increase_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test nameds increase by in the fss project. - */ -#ifndef _TEST__F_fss__nameds_increase_by -#define _TEST__F_fss__nameds_increase_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_nameds_increase_by() - */ -extern void test__f_fss_nameds_increase_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_fss_nameds_increase_by() - */ -extern void test__f_fss_nameds_increase_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_fss_nameds_increase_by() - */ -extern void test__f_fss_nameds_increase_by__works(void **state); - -#endif // _TEST__F_fss__nameds_increase_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-nameds_resize.c b/level_0/f_fss/tests/unit/c/test-fss-nameds_resize.c deleted file mode 100644 index cf94465..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-nameds_resize.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-fss.h" -#include "test-fss-nameds_resize.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_nameds_resize__parameter_checking(void **state) { - - const int length = 5; - f_fss_nameds_t data = f_fss_nameds_t_initialize; - - { - const f_status_t status = f_fss_nameds_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); -} - -void test__f_fss_nameds_resize__works(void **state) { - - const int length = 5; - f_fss_nameds_t data = f_fss_nameds_t_initialize; - - { - const f_status_t status = f_fss_nameds_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-nameds_resize.h b/level_0/f_fss/tests/unit/c/test-fss-nameds_resize.h deleted file mode 100644 index 655848b..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-nameds_resize.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test nameds resize in the fss project. - */ -#ifndef _TEST__F_fss__nameds_resize -#define _TEST__F_fss__nameds_resize - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_nameds_resize() - */ -extern void test__f_fss_nameds_resize__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_fss_nameds_resize() - */ -extern void test__f_fss_nameds_resize__works(void **state); - -#endif // _TEST__F_fss__nameds_resize diff --git a/level_0/f_fss/tests/unit/c/test-fss-nest_adjust.c b/level_0/f_fss/tests/unit/c/test-fss-nest_adjust.c deleted file mode 100644 index 72aa9c6..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-nest_adjust.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-fss.h" -#include "test-fss-nests_adjust.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_nest_adjust__parameter_checking(void **state) { - - const int length = 5; - f_fss_nest_t data = f_fss_nest_t_initialize; - - { - const f_status_t status = f_fss_nest_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.depth); -} - -void test__f_fss_nest_adjust__works(void **state) { - - const int length = 5; - f_fss_nest_t data = f_fss_nest_t_initialize; - - { - const f_status_t status = f_fss_nest_adjust(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.depth); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-nest_adjust.h b/level_0/f_fss/tests/unit/c/test-fss-nest_adjust.h deleted file mode 100644 index ca58cb3..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-nest_adjust.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test nest adjust in the fss project. - */ -#ifndef _TEST__F_fss__nest_adjust -#define _TEST__F_fss__nest_adjust - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_nest_adjust() - */ -extern void test__f_fss_nest_adjust__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_fss_nest_adjust() - */ -extern void test__f_fss_nest_adjust__works(void **state); - -#endif // _TEST__F_fss__nest_adjust diff --git a/level_0/f_fss/tests/unit/c/test-fss-nest_decimate_by.c b/level_0/f_fss/tests/unit/c/test-fss-nest_decimate_by.c deleted file mode 100644 index 4cee05b..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-nest_decimate_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-fss.h" -#include "test-fss-nests_decimate_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_nest_decimate_by__parameter_checking(void **state) { - - const int length = 5; - f_fss_nest_t data = f_fss_nest_t_initialize; - - { - const f_status_t status = f_fss_nest_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.depth); -} - -void test__f_fss_nest_decimate_by__returns_data_not(void **state) { - - const int length = 5; - f_fss_nest_t data = f_fss_nest_t_initialize; - - { - const f_status_t status = f_fss_nest_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_fss_nest_decimate_by(0, &data); - - assert_int_equal(status, F_data_not); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.depth); -} - -void test__f_fss_nest_decimate_by__works(void **state) { - - const int length = 5; - f_fss_nest_t data = f_fss_nest_t_initialize; - - { - const f_status_t status = f_fss_nest_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_fss_nest_decimate_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.depth); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-nest_decimate_by.h b/level_0/f_fss/tests/unit/c/test-fss-nest_decimate_by.h deleted file mode 100644 index cd8dec5..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-nest_decimate_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test nest decimate by in the fss project. - */ -#ifndef _TEST__F_fss__nest_decimate_by -#define _TEST__F_fss__nest_decimate_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_nest_decimate_by() - */ -extern void test__f_fss_nest_decimate_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_fss_nest_decimate_by() - */ -extern void test__f_fss_nest_decimate_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_fss_nest_decimate_by() - */ -extern void test__f_fss_nest_decimate_by__works(void **state); - -#endif // _TEST__F_fss__nest_decimate_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-nest_decrease_by.c b/level_0/f_fss/tests/unit/c/test-fss-nest_decrease_by.c deleted file mode 100644 index 716f37b..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-nest_decrease_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-fss.h" -#include "test-fss-nests_decrease_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_nest_decrease_by__parameter_checking(void **state) { - - const int length = 5; - f_fss_nest_t data = f_fss_nest_t_initialize; - - { - const f_status_t status = f_fss_nest_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.depth); -} - -void test__f_fss_nest_decrease_by__returns_data_not(void **state) { - - const int length = 5; - f_fss_nest_t data = f_fss_nest_t_initialize; - - { - const f_status_t status = f_fss_nest_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_fss_nest_decrease_by(0, &data); - - assert_int_equal(status, F_data_not); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.depth); -} - -void test__f_fss_nest_decrease_by__works(void **state) { - - const int length = 5; - f_fss_nest_t data = f_fss_nest_t_initialize; - - { - const f_status_t status = f_fss_nest_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_fss_nest_decrease_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.depth); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-nest_decrease_by.h b/level_0/f_fss/tests/unit/c/test-fss-nest_decrease_by.h deleted file mode 100644 index 0ffc877..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-nest_decrease_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test nest decrease by in the fss project. - */ -#ifndef _TEST__F_fss__nest_decrease_by -#define _TEST__F_fss__nest_decrease_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_nest_decrease_by() - */ -extern void test__f_fss_nest_decrease_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_fss_nest_decrease_by() - */ -extern void test__f_fss_nest_decrease_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_fss_nest_decrease_by() - */ -extern void test__f_fss_nest_decrease_by__works(void **state); - -#endif // _TEST__F_fss__nest_decrease_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-nest_increase.c b/level_0/f_fss/tests/unit/c/test-fss-nest_increase.c deleted file mode 100644 index 5ee8bd9..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-nest_increase.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-fss.h" -#include "test-fss-nests_increase.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_nest_increase__parameter_checking(void **state) { - - const int length = 5; - f_fss_nest_t data = f_fss_nest_t_initialize; - - { - const f_status_t status = f_fss_nest_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.depth); -} - -void test__f_fss_nest_increase__returns_data_not(void **state) { - - const int length = 5; - f_fss_nest_t data = f_fss_nest_t_initialize; - - { - const f_status_t status = f_fss_nest_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_fss_nest_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.depth); -} - -void test__f_fss_nest_increase__works(void **state) { - - const int length = 5; - f_fss_nest_t data = f_fss_nest_t_initialize; - - { - const f_status_t status = f_fss_nest_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_fss_nest_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); - } - - free((void *) data.depth); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-nest_increase.h b/level_0/f_fss/tests/unit/c/test-fss-nest_increase.h deleted file mode 100644 index 635418d..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-nest_increase.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test nest increase in the fss project. - */ -#ifndef _TEST__F_fss__nest_increase -#define _TEST__F_fss__nest_increase - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_nest_increase() - */ -extern void test__f_fss_nest_increase__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_fss_nest_increase() - */ -extern void test__f_fss_nest_increase__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_fss_nest_increase() - */ -extern void test__f_fss_nest_increase__works(void **state); - -#endif // _TEST__F_fss__nest_increase diff --git a/level_0/f_fss/tests/unit/c/test-fss-nest_increase_by.c b/level_0/f_fss/tests/unit/c/test-fss-nest_increase_by.c deleted file mode 100644 index 4d91ea8..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-nest_increase_by.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-fss.h" -#include "test-fss-nests_increase_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_nest_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_fss_nest_t data = f_fss_nest_t_initialize; - - { - const f_status_t status = f_fss_nest_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.depth); -} - -void test__f_fss_nest_increase_by__returns_data_not(void **state) { - - const int length = 5; - f_fss_nest_t data = f_fss_nest_t_initialize; - - { - const f_status_t status = f_fss_nest_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_fss_nest_increase_by(0, &data); - - assert_int_equal(status, F_data_not); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.depth); -} - -void test__f_fss_nest_increase_by__works(void **state) { - - const int length = 5; - f_fss_nest_t data = f_fss_nest_t_initialize; - - { - const f_status_t status = f_fss_nest_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_fss_nest_increase_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); - } - - free((void *) data.depth); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-nest_increase_by.h b/level_0/f_fss/tests/unit/c/test-fss-nest_increase_by.h deleted file mode 100644 index 7d4c81f..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-nest_increase_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test nest increase by in the fss project. - */ -#ifndef _TEST__F_fss__nest_increase_by -#define _TEST__F_fss__nest_increase_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_nest_increase_by() - */ -extern void test__f_fss_nest_increase_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_fss_nest_increase_by() - */ -extern void test__f_fss_nest_increase_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_fss_nest_increase_by() - */ -extern void test__f_fss_nest_increase_by__works(void **state); - -#endif // _TEST__F_fss__nest_increase_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-nest_resize.c b/level_0/f_fss/tests/unit/c/test-fss-nest_resize.c deleted file mode 100644 index 74588e2..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-nest_resize.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-fss.h" -#include "test-fss-nests_resize.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_nest_resize__parameter_checking(void **state) { - - const int length = 5; - f_fss_nest_t data = f_fss_nest_t_initialize; - - { - const f_status_t status = f_fss_nest_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.depth); -} - -void test__f_fss_nest_resize__works(void **state) { - - const int length = 5; - f_fss_nest_t data = f_fss_nest_t_initialize; - - { - const f_status_t status = f_fss_nest_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.depth); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-nest_resize.h b/level_0/f_fss/tests/unit/c/test-fss-nest_resize.h deleted file mode 100644 index be3fef2..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-nest_resize.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test nest resize in the fss project. - */ -#ifndef _TEST__F_fss__nest_resize -#define _TEST__F_fss__nest_resize - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_nest_resize() - */ -extern void test__f_fss_nest_resize__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_fss_nest_resize() - */ -extern void test__f_fss_nest_resize__works(void **state); - -#endif // _TEST__F_fss__nest_resize diff --git a/level_0/f_fss/tests/unit/c/test-fss-nests_adjust.c b/level_0/f_fss/tests/unit/c/test-fss-nests_adjust.c deleted file mode 100644 index 8551b38..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-nests_adjust.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-fss.h" -#include "test-fss-nests_adjust.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_nests_adjust__parameter_checking(void **state) { - - const int length = 5; - f_fss_nests_t data = f_fss_nests_t_initialize; - - { - const f_status_t status = f_fss_nests_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); -} - -void test__f_fss_nests_adjust__works(void **state) { - - const int length = 5; - f_fss_nests_t data = f_fss_nests_t_initialize; - - { - const f_status_t status = f_fss_nests_adjust(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-nests_adjust.h b/level_0/f_fss/tests/unit/c/test-fss-nests_adjust.h deleted file mode 100644 index 46abfd8..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-nests_adjust.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test nests adjust in the fss project. - */ -#ifndef _TEST__F_fss__nests_adjust -#define _TEST__F_fss__nests_adjust - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_nests_adjust() - */ -extern void test__f_fss_nests_adjust__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_fss_nests_adjust() - */ -extern void test__f_fss_nests_adjust__works(void **state); - -#endif // _TEST__F_fss__nests_adjust diff --git a/level_0/f_fss/tests/unit/c/test-fss-nests_decimate_by.c b/level_0/f_fss/tests/unit/c/test-fss-nests_decimate_by.c deleted file mode 100644 index e4373f4..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-nests_decimate_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-fss.h" -#include "test-fss-nests_decimate_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_nests_decimate_by__parameter_checking(void **state) { - - const int length = 5; - f_fss_nests_t data = f_fss_nests_t_initialize; - - { - const f_status_t status = f_fss_nests_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); -} - -void test__f_fss_nests_decimate_by__returns_data_not(void **state) { - - const int length = 5; - f_fss_nests_t data = f_fss_nests_t_initialize; - - { - const f_status_t status = f_fss_nests_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_fss_nests_decimate_by(0, &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_fss_nests_decimate_by__works(void **state) { - - const int length = 5; - f_fss_nests_t data = f_fss_nests_t_initialize; - - { - const f_status_t status = f_fss_nests_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_fss_nests_decimate_by(length, &data); - - assert_int_equal(status, F_none); - 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_fss/tests/unit/c/test-fss-nests_decimate_by.h b/level_0/f_fss/tests/unit/c/test-fss-nests_decimate_by.h deleted file mode 100644 index f207021..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-nests_decimate_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test nests decimate by in the fss project. - */ -#ifndef _TEST__F_fss__nests_decimate_by -#define _TEST__F_fss__nests_decimate_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_nests_decimate_by() - */ -extern void test__f_fss_nests_decimate_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_fss_nests_decimate_by() - */ -extern void test__f_fss_nests_decimate_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_fss_nests_decimate_by() - */ -extern void test__f_fss_nests_decimate_by__works(void **state); - -#endif // _TEST__F_fss__nests_decimate_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-nests_decrease_by.c b/level_0/f_fss/tests/unit/c/test-fss-nests_decrease_by.c deleted file mode 100644 index ac58df9..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-nests_decrease_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-fss.h" -#include "test-fss-nests_decrease_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_nests_decrease_by__parameter_checking(void **state) { - - const int length = 5; - f_fss_nests_t data = f_fss_nests_t_initialize; - - { - const f_status_t status = f_fss_nests_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); -} - -void test__f_fss_nests_decrease_by__returns_data_not(void **state) { - - const int length = 5; - f_fss_nests_t data = f_fss_nests_t_initialize; - - { - const f_status_t status = f_fss_nests_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_fss_nests_decrease_by(0, &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_fss_nests_decrease_by__works(void **state) { - - const int length = 5; - f_fss_nests_t data = f_fss_nests_t_initialize; - - { - const f_status_t status = f_fss_nests_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_fss_nests_decrease_by(length, &data); - - assert_int_equal(status, F_none); - 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_fss/tests/unit/c/test-fss-nests_decrease_by.h b/level_0/f_fss/tests/unit/c/test-fss-nests_decrease_by.h deleted file mode 100644 index 34bf47b..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-nests_decrease_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test nests decrease by in the fss project. - */ -#ifndef _TEST__F_fss__nests_decrease_by -#define _TEST__F_fss__nests_decrease_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_nests_decrease_by() - */ -extern void test__f_fss_nests_decrease_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_fss_nests_decrease_by() - */ -extern void test__f_fss_nests_decrease_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_fss_nests_decrease_by() - */ -extern void test__f_fss_nests_decrease_by__works(void **state); - -#endif // _TEST__F_fss__nests_decrease_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-nests_increase.c b/level_0/f_fss/tests/unit/c/test-fss-nests_increase.c deleted file mode 100644 index 57bc815..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-nests_increase.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-fss.h" -#include "test-fss-nests_increase.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_nests_increase__parameter_checking(void **state) { - - const int length = 5; - f_fss_nests_t data = f_fss_nests_t_initialize; - - { - const f_status_t status = f_fss_nests_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); -} - -void test__f_fss_nests_increase__returns_data_not(void **state) { - - const int length = 5; - f_fss_nests_t data = f_fss_nests_t_initialize; - - { - const f_status_t status = f_fss_nests_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_fss_nests_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_fss_nests_increase__works(void **state) { - - const int length = 5; - f_fss_nests_t data = f_fss_nests_t_initialize; - - { - const f_status_t status = f_fss_nests_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_fss_nests_increase(length, &data); - - assert_int_equal(status, F_none); - 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); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-nests_increase.h b/level_0/f_fss/tests/unit/c/test-fss-nests_increase.h deleted file mode 100644 index 0f8abb7..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-nests_increase.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test nests increase in the fss project. - */ -#ifndef _TEST__F_fss__nests_increase -#define _TEST__F_fss__nests_increase - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_nests_increase() - */ -extern void test__f_fss_nests_increase__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_fss_nests_increase() - */ -extern void test__f_fss_nests_increase__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_fss_nests_increase() - */ -extern void test__f_fss_nests_increase__works(void **state); - -#endif // _TEST__F_fss__nests_increase diff --git a/level_0/f_fss/tests/unit/c/test-fss-nests_increase_by.c b/level_0/f_fss/tests/unit/c/test-fss-nests_increase_by.c deleted file mode 100644 index 22bf2f7..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-nests_increase_by.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-fss.h" -#include "test-fss-nests_increase_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_nests_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_fss_nests_t data = f_fss_nests_t_initialize; - - { - const f_status_t status = f_fss_nests_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); -} - -void test__f_fss_nests_increase_by__returns_data_not(void **state) { - - const int length = 5; - f_fss_nests_t data = f_fss_nests_t_initialize; - - { - const f_status_t status = f_fss_nests_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_fss_nests_increase_by(0, &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_fss_nests_increase_by__works(void **state) { - - const int length = 5; - f_fss_nests_t data = f_fss_nests_t_initialize; - - { - const f_status_t status = f_fss_nests_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_fss_nests_increase_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-nests_increase_by.h b/level_0/f_fss/tests/unit/c/test-fss-nests_increase_by.h deleted file mode 100644 index 5f4a46a..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-nests_increase_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test nests increase by in the fss project. - */ -#ifndef _TEST__F_fss__nests_increase_by -#define _TEST__F_fss__nests_increase_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_nests_increase_by() - */ -extern void test__f_fss_nests_increase_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_fss_nests_increase_by() - */ -extern void test__f_fss_nests_increase_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_fss_nests_increase_by() - */ -extern void test__f_fss_nests_increase_by__works(void **state); - -#endif // _TEST__F_fss__nests_increase_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-nests_resize.c b/level_0/f_fss/tests/unit/c/test-fss-nests_resize.c deleted file mode 100644 index ab8b5a1..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-nests_resize.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-fss.h" -#include "test-fss-nests_resize.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_nests_resize__parameter_checking(void **state) { - - const int length = 5; - f_fss_nests_t data = f_fss_nests_t_initialize; - - { - const f_status_t status = f_fss_nests_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); -} - -void test__f_fss_nests_resize__works(void **state) { - - const int length = 5; - f_fss_nests_t data = f_fss_nests_t_initialize; - - { - const f_status_t status = f_fss_nests_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-nests_resize.h b/level_0/f_fss/tests/unit/c/test-fss-nests_resize.h deleted file mode 100644 index 67151b3..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-nests_resize.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test nests resize in the fss project. - */ -#ifndef _TEST__F_fss__nests_resize -#define _TEST__F_fss__nests_resize - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_nests_resize() - */ -extern void test__f_fss_nests_resize__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_fss_nests_resize() - */ -extern void test__f_fss_nests_resize__works(void **state); - -#endif // _TEST__F_fss__nests_resize diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_adjust.c b/level_0/f_fss/tests/unit/c/test-fss-set_adjust.c deleted file mode 100644 index a151fb2..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-set_adjust.c +++ /dev/null @@ -1,44 +0,0 @@ -#include "test-fss.h" -#include "test-fss-sets_adjust.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_set_adjust__parameter_checking(void **state) { - - const int length = 5; - f_fss_set_t data = f_fss_set_t_initialize; - - { - const f_status_t status = f_fss_set_adjust(length, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.contents.size, 0); - } - - assert_null(data.objects.array); - assert_null(data.contents.array); -} - -void test__f_fss_set_adjust__works(void **state) { - - const int length = 5; - f_fss_set_t data = f_fss_set_t_initialize; - - { - const f_status_t status = f_fss_set_adjust(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.contents.size, length); - } - - free((void *) data.objects.array); - free((void *) data.contents.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_adjust.h b/level_0/f_fss/tests/unit/c/test-fss-set_adjust.h deleted file mode 100644 index 85dde7a..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-set_adjust.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test set adjust in the fss project. - */ -#ifndef _TEST__F_fss__set_adjust -#define _TEST__F_fss__set_adjust - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_set_adjust() - */ -extern void test__f_fss_set_adjust__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_fss_set_adjust() - */ -extern void test__f_fss_set_adjust__works(void **state); - -#endif // _TEST__F_fss__set_adjust diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_decimate_by.c b/level_0/f_fss/tests/unit/c/test-fss-set_decimate_by.c deleted file mode 100644 index 632ce9f..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-set_decimate_by.c +++ /dev/null @@ -1,77 +0,0 @@ -#include "test-fss.h" -#include "test-fss-sets_decimate_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_set_decimate_by__parameter_checking(void **state) { - - const int length = 5; - f_fss_set_t data = f_fss_set_t_initialize; - - { - const f_status_t status = f_fss_set_decimate_by(length, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.contents.size, 0); - } - - assert_null(data.objects.array); - assert_null(data.contents.array); -} - -void test__f_fss_set_decimate_by__returns_data_not(void **state) { - - const int length = 5; - f_fss_set_t data = f_fss_set_t_initialize; - - { - const f_status_t status = f_fss_set_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.contents.size, length); - } - - { - const f_status_t status = f_fss_set_decimate_by(0, &data); - - assert_int_equal(status, F_data_not); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.contents.size, length); - } - - free((void *) data.objects.array); - free((void *) data.contents.array); -} - -void test__f_fss_set_decimate_by__works(void **state) { - - const int length = 5; - f_fss_set_t data = f_fss_set_t_initialize; - - { - const f_status_t status = f_fss_set_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.contents.size, length); - } - - { - const f_status_t status = f_fss_set_decimate_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.contents.size, 0); - } - - assert_null(data.objects.array); - assert_null(data.contents.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_decimate_by.h b/level_0/f_fss/tests/unit/c/test-fss-set_decimate_by.h deleted file mode 100644 index ab25e66..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-set_decimate_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test set decimate by in the fss project. - */ -#ifndef _TEST__F_fss__set_decimate_by -#define _TEST__F_fss__set_decimate_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_set_decimate_by() - */ -extern void test__f_fss_set_decimate_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_fss_set_decimate_by() - */ -extern void test__f_fss_set_decimate_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_fss_set_decimate_by() - */ -extern void test__f_fss_set_decimate_by__works(void **state); - -#endif // _TEST__F_fss__set_decimate_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_decrease_by.c b/level_0/f_fss/tests/unit/c/test-fss-set_decrease_by.c deleted file mode 100644 index b73f58e..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-set_decrease_by.c +++ /dev/null @@ -1,77 +0,0 @@ -#include "test-fss.h" -#include "test-fss-sets_decrease_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_set_decrease_by__parameter_checking(void **state) { - - const int length = 5; - f_fss_set_t data = f_fss_set_t_initialize; - - { - const f_status_t status = f_fss_set_decrease_by(length, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.contents.size, 0); - } - - assert_null(data.objects.array); - assert_null(data.contents.array); -} - -void test__f_fss_set_decrease_by__returns_data_not(void **state) { - - const int length = 5; - f_fss_set_t data = f_fss_set_t_initialize; - - { - const f_status_t status = f_fss_set_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.contents.size, length); - } - - { - const f_status_t status = f_fss_set_decrease_by(0, &data); - - assert_int_equal(status, F_data_not); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.contents.size, length); - } - - free((void *) data.objects.array); - free((void *) data.contents.array); -} - -void test__f_fss_set_decrease_by__works(void **state) { - - const int length = 5; - f_fss_set_t data = f_fss_set_t_initialize; - - { - const f_status_t status = f_fss_set_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.contents.size, length); - } - - { - const f_status_t status = f_fss_set_decrease_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.contents.size, 0); - } - - assert_null(data.objects.array); - assert_null(data.contents.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_decrease_by.h b/level_0/f_fss/tests/unit/c/test-fss-set_decrease_by.h deleted file mode 100644 index a9e10f1..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-set_decrease_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test set decrease by in the fss project. - */ -#ifndef _TEST__F_fss__set_decrease_by -#define _TEST__F_fss__set_decrease_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_set_decrease_by() - */ -extern void test__f_fss_set_decrease_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_fss_set_decrease_by() - */ -extern void test__f_fss_set_decrease_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_fss_set_decrease_by() - */ -extern void test__f_fss_set_decrease_by__works(void **state); - -#endif // _TEST__F_fss__set_decrease_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_increase.c b/level_0/f_fss/tests/unit/c/test-fss-set_increase.c deleted file mode 100644 index ba33119..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-set_increase.c +++ /dev/null @@ -1,80 +0,0 @@ -#include "test-fss.h" -#include "test-fss-sets_increase.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_set_increase__parameter_checking(void **state) { - - const int length = 5; - f_fss_set_t data = f_fss_set_t_initialize; - - { - const f_status_t status = f_fss_set_increase(length, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.contents.size, 0); - } - - free((void *) data.objects.array); - free((void *) data.contents.array); -} - -void test__f_fss_set_increase__returns_data_not(void **state) { - - const int length = 5; - f_fss_set_t data = f_fss_set_t_initialize; - - { - const f_status_t status = f_fss_set_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.contents.size, length); - } - - { - const f_status_t status = f_fss_set_increase(length, &data); - - assert_int_equal(status, F_data_not); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.contents.size, length); - } - - free((void *) data.objects.array); - free((void *) data.contents.array); -} - -void test__f_fss_set_increase__works(void **state) { - - const int length = 5; - f_fss_set_t data = f_fss_set_t_initialize; - - { - const f_status_t status = f_fss_set_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.contents.size, length); - } - - { - data.objects.used = length; - data.contents.used = length; - - const f_status_t status = f_fss_set_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.objects.used, length); - assert_in_range(data.contents.size, length + 1, length + 1 + F_memory_default_allocation_small_d); - } - - free((void *) data.objects.array); - free((void *) data.contents.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_increase.h b/level_0/f_fss/tests/unit/c/test-fss-set_increase.h deleted file mode 100644 index b504d47..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-set_increase.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test set increase in the fss project. - */ -#ifndef _TEST__F_fss__set_increase -#define _TEST__F_fss__set_increase - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_set_increase() - */ -extern void test__f_fss_set_increase__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_fss_set_increase() - */ -extern void test__f_fss_set_increase__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_fss_set_increase() - */ -extern void test__f_fss_set_increase__works(void **state); - -#endif // _TEST__F_fss__set_increase diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_increase_by.c b/level_0/f_fss/tests/unit/c/test-fss-set_increase_by.c deleted file mode 100644 index 18b0d0f..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-set_increase_by.c +++ /dev/null @@ -1,80 +0,0 @@ -#include "test-fss.h" -#include "test-fss-sets_increase_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_set_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_fss_set_t data = f_fss_set_t_initialize; - - { - const f_status_t status = f_fss_set_increase_by(length, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.contents.size, 0); - } - - assert_null(data.objects.array); - assert_null(data.contents.array); -} - -void test__f_fss_set_increase_by__returns_data_not(void **state) { - - const int length = 5; - f_fss_set_t data = f_fss_set_t_initialize; - - { - const f_status_t status = f_fss_set_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.contents.size, length); - } - - { - const f_status_t status = f_fss_set_increase_by(0, &data); - - assert_int_equal(status, F_data_not); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.contents.size, length); - } - - free((void *) data.objects.array); - free((void *) data.contents.array); -} - -void test__f_fss_set_increase_by__works(void **state) { - - const int length = 5; - f_fss_set_t data = f_fss_set_t_initialize; - - { - const f_status_t status = f_fss_set_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.contents.size, length); - } - - { - data.objects.used = length; - data.contents.used = length; - - const f_status_t status = f_fss_set_increase_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.objects.used, length); - assert_int_equal(data.contents.size, length * 2); - } - - free((void *) data.objects.array); - free((void *) data.contents.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_increase_by.h b/level_0/f_fss/tests/unit/c/test-fss-set_increase_by.h deleted file mode 100644 index 5d5bcf2..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-set_increase_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test set increase by in the fss project. - */ -#ifndef _TEST__F_fss__set_increase_by -#define _TEST__F_fss__set_increase_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_set_increase_by() - */ -extern void test__f_fss_set_increase_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_fss_set_increase_by() - */ -extern void test__f_fss_set_increase_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_fss_set_increase_by() - */ -extern void test__f_fss_set_increase_by__works(void **state); - -#endif // _TEST__F_fss__set_increase_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_quote_adjust.c b/level_0/f_fss/tests/unit/c/test-fss-set_quote_adjust.c deleted file mode 100644 index 9fef2d0..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-set_quote_adjust.c +++ /dev/null @@ -1,60 +0,0 @@ -#include "test-fss.h" -#include "test-fss-set_quote_adjust.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_set_quote_adjust__parameter_checking(void **state) { - - const int length = 5; - f_fss_set_quote_t data = f_fss_set_quote_t_initialize; - - { - const f_status_t status = f_fss_set_quote_adjust(length, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.objects.size, 0); - assert_int_equal(data.contents.used, 0); - assert_int_equal(data.contents.size, 0); - assert_int_equal(data.objects_quote.used, 0); - assert_int_equal(data.objects_quote.size, 0); - assert_int_equal(data.contents_quote.used, 0); - assert_int_equal(data.contents_quote.size, 0); - } - - assert_null(data.objects.array); - assert_null(data.contents.array); - assert_null(data.objects_quote.array); - assert_null(data.contents_quote.array); -} - -void test__f_fss_set_quote_adjust__works(void **state) { - - const int length = 5; - f_fss_set_quote_t data = f_fss_set_quote_t_initialize; - - { - const f_status_t status = f_fss_set_quote_adjust(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.objects.size, length); - assert_int_equal(data.contents.used, 0); - assert_int_equal(data.contents.size, length); - assert_int_equal(data.objects_quote.used, 0); - assert_int_equal(data.objects_quote.size, length); - assert_int_equal(data.contents_quote.used, 0); - assert_int_equal(data.contents_quote.size, length); - } - - free((void *) data.objects.array); - free((void *) data.contents.array); - free((void *) data.objects_quote.array); - free((void *) data.contents_quote.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_quote_adjust.h b/level_0/f_fss/tests/unit/c/test-fss-set_quote_adjust.h deleted file mode 100644 index 0c7700f..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-set_quote_adjust.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test set quote adjust in the fss project. - */ -#ifndef _TEST__F_fss__set_quote_adjust -#define _TEST__F_fss__set_quote_adjust - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_set_quote_adjust() - */ -extern void test__f_fss_set_quote_adjust__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_fss_set_quote_adjust() - */ -extern void test__f_fss_set_quote_adjust__works(void **state); - -#endif // _TEST__F_fss__set_quote_adjust diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_quote_decimate_by.c b/level_0/f_fss/tests/unit/c/test-fss-set_quote_decimate_by.c deleted file mode 100644 index 1f863d9..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-set_quote_decimate_by.c +++ /dev/null @@ -1,113 +0,0 @@ -#include "test-fss.h" -#include "test-fss-set_quote_decimate_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_set_quote_decimate_by__parameter_checking(void **state) { - - const int length = 5; - f_fss_set_quote_t data = f_fss_set_quote_t_initialize; - - { - const f_status_t status = f_fss_set_quote_decimate_by(length, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.objects.size, 0); - assert_int_equal(data.contents.used, 0); - assert_int_equal(data.contents.size, 0); - assert_int_equal(data.objects_quote.used, 0); - assert_int_equal(data.objects_quote.size, 0); - assert_int_equal(data.contents_quote.used, 0); - assert_int_equal(data.contents_quote.size, 0); - } - - assert_null(data.objects.array); - assert_null(data.contents.array); - assert_null(data.objects_quote.array); - assert_null(data.contents_quote.array); -} - -void test__f_fss_set_quote_decimate_by__returns_data_not(void **state) { - - const int length = 5; - f_fss_set_quote_t data = f_fss_set_quote_t_initialize; - - { - const f_status_t status = f_fss_set_quote_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.objects.size, length); - assert_int_equal(data.contents.used, 0); - assert_int_equal(data.contents.size, length); - assert_int_equal(data.objects_quote.used, 0); - assert_int_equal(data.objects_quote.size, length); - assert_int_equal(data.contents_quote.used, 0); - assert_int_equal(data.contents_quote.size, length); - } - - { - const f_status_t status = f_fss_set_quote_decimate_by(0, &data); - - assert_int_equal(status, F_data_not); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.objects.size, length); - assert_int_equal(data.contents.used, 0); - assert_int_equal(data.contents.size, length); - assert_int_equal(data.objects_quote.used, 0); - assert_int_equal(data.objects_quote.size, length); - assert_int_equal(data.contents_quote.used, 0); - assert_int_equal(data.contents_quote.size, length); - } - - free((void *) data.objects.array); - free((void *) data.contents.array); - free((void *) data.objects_quote.array); - free((void *) data.contents_quote.array); -} - -void test__f_fss_set_quote_decimate_by__works(void **state) { - - const int length = 5; - f_fss_set_quote_t data = f_fss_set_quote_t_initialize; - - { - const f_status_t status = f_fss_set_quote_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.objects.size, length); - assert_int_equal(data.contents.used, 0); - assert_int_equal(data.contents.size, length); - assert_int_equal(data.objects_quote.used, 0); - assert_int_equal(data.objects_quote.size, length); - assert_int_equal(data.contents_quote.used, 0); - assert_int_equal(data.contents_quote.size, length); - } - - { - const f_status_t status = f_fss_set_quote_decimate_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.objects.size, 0); - assert_int_equal(data.contents.used, 0); - assert_int_equal(data.contents.size, 0); - assert_int_equal(data.objects_quote.used, 0); - assert_int_equal(data.objects_quote.size, 0); - assert_int_equal(data.contents_quote.used, 0); - assert_int_equal(data.contents_quote.size, 0); - } - - assert_null(data.objects.array); - assert_null(data.contents.array); - assert_null(data.objects_quote.array); - assert_null(data.contents_quote.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_quote_decimate_by.h b/level_0/f_fss/tests/unit/c/test-fss-set_quote_decimate_by.h deleted file mode 100644 index c7511e6..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-set_quote_decimate_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test set quote decimate by in the fss project. - */ -#ifndef _TEST__F_fss__set_quote_decimate_by -#define _TEST__F_fss__set_quote_decimate_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_set_quote_decimate_by() - */ -extern void test__f_fss_set_quote_decimate_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_fss_set_quote_decimate_by() - */ -extern void test__f_fss_set_quote_decimate_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_fss_set_quote_decimate_by() - */ -extern void test__f_fss_set_quote_decimate_by__works(void **state); - -#endif // _TEST__F_fss__set_quote_decimate_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_quote_decrease_by.c b/level_0/f_fss/tests/unit/c/test-fss-set_quote_decrease_by.c deleted file mode 100644 index cc5cbb1..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-set_quote_decrease_by.c +++ /dev/null @@ -1,113 +0,0 @@ -#include "test-fss.h" -#include "test-fss-set_quote_decrease_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_set_quote_decrease_by__parameter_checking(void **state) { - - const int length = 5; - f_fss_set_quote_t data = f_fss_set_quote_t_initialize; - - { - const f_status_t status = f_fss_set_quote_decrease_by(length, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.objects.size, 0); - assert_int_equal(data.contents.used, 0); - assert_int_equal(data.contents.size, 0); - assert_int_equal(data.objects_quote.used, 0); - assert_int_equal(data.objects_quote.size, 0); - assert_int_equal(data.contents_quote.used, 0); - assert_int_equal(data.contents_quote.size, 0); - } - - assert_null(data.objects.array); - assert_null(data.contents.array); - assert_null(data.objects_quote.array); - assert_null(data.contents_quote.array); -} - -void test__f_fss_set_quote_decrease_by__returns_data_not(void **state) { - - const int length = 5; - f_fss_set_quote_t data = f_fss_set_quote_t_initialize; - - { - const f_status_t status = f_fss_set_quote_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.objects.size, length); - assert_int_equal(data.contents.used, 0); - assert_int_equal(data.contents.size, length); - assert_int_equal(data.objects_quote.used, 0); - assert_int_equal(data.objects_quote.size, length); - assert_int_equal(data.contents_quote.used, 0); - assert_int_equal(data.contents_quote.size, length); - } - - { - const f_status_t status = f_fss_set_quote_decrease_by(0, &data); - - assert_int_equal(status, F_data_not); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.objects.size, length); - assert_int_equal(data.contents.used, 0); - assert_int_equal(data.contents.size, length); - assert_int_equal(data.objects_quote.used, 0); - assert_int_equal(data.objects_quote.size, length); - assert_int_equal(data.contents_quote.used, 0); - assert_int_equal(data.contents_quote.size, length); - } - - free((void *) data.objects.array); - free((void *) data.contents.array); - free((void *) data.objects_quote.array); - free((void *) data.contents_quote.array); -} - -void test__f_fss_set_quote_decrease_by__works(void **state) { - - const int length = 5; - f_fss_set_quote_t data = f_fss_set_quote_t_initialize; - - { - const f_status_t status = f_fss_set_quote_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.objects.size, length); - assert_int_equal(data.contents.used, 0); - assert_int_equal(data.contents.size, length); - assert_int_equal(data.objects_quote.used, 0); - assert_int_equal(data.objects_quote.size, length); - assert_int_equal(data.contents_quote.used, 0); - assert_int_equal(data.contents_quote.size, length); - } - - { - const f_status_t status = f_fss_set_quote_decrease_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.objects.size, 0); - assert_int_equal(data.contents.used, 0); - assert_int_equal(data.contents.size, 0); - assert_int_equal(data.objects_quote.used, 0); - assert_int_equal(data.objects_quote.size, 0); - assert_int_equal(data.contents_quote.used, 0); - assert_int_equal(data.contents_quote.size, 0); - } - - assert_null(data.objects.array); - assert_null(data.contents.array); - assert_null(data.objects_quote.array); - assert_null(data.contents_quote.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_quote_decrease_by.h b/level_0/f_fss/tests/unit/c/test-fss-set_quote_decrease_by.h deleted file mode 100644 index 7da63fa..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-set_quote_decrease_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test set quote decrease by in the fss project. - */ -#ifndef _TEST__F_fss__set_quote_decrease_by -#define _TEST__F_fss__set_quote_decrease_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_set_quote_decrease_by() - */ -extern void test__f_fss_set_quote_decrease_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_fss_set_quote_decrease_by() - */ -extern void test__f_fss_set_quote_decrease_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_fss_set_quote_decrease_by() - */ -extern void test__f_fss_set_quote_decrease_by__works(void **state); - -#endif // _TEST__F_fss__set_quote_decrease_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_quote_increase.c b/level_0/f_fss/tests/unit/c/test-fss-set_quote_increase.c deleted file mode 100644 index fed0b24..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-set_quote_increase.c +++ /dev/null @@ -1,118 +0,0 @@ -#include "test-fss.h" -#include "test-fss-set_quote_increase.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_set_quote_increase__parameter_checking(void **state) { - - const int length = 5; - f_fss_set_quote_t data = f_fss_set_quote_t_initialize; - - { - const f_status_t status = f_fss_set_quote_increase(length, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.objects.size, 0); - assert_int_equal(data.contents.used, 0); - assert_int_equal(data.contents.size, 0); - assert_int_equal(data.objects_quote.used, 0); - assert_int_equal(data.objects_quote.size, 0); - assert_int_equal(data.contents_quote.used, 0); - assert_int_equal(data.contents_quote.size, 0); - } - - free((void *) data.objects.array); - free((void *) data.contents.array); - free((void *) data.objects_quote.array); - free((void *) data.contents_quote.array); -} - -void test__f_fss_set_quote_increase__returns_data_not(void **state) { - - const int length = 5; - f_fss_set_quote_t data = f_fss_set_quote_t_initialize; - - { - const f_status_t status = f_fss_set_quote_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.objects.size, length); - assert_int_equal(data.contents.used, 0); - assert_int_equal(data.contents.size, length); - assert_int_equal(data.objects_quote.used, 0); - assert_int_equal(data.objects_quote.size, length); - assert_int_equal(data.contents_quote.used, 0); - assert_int_equal(data.contents_quote.size, length); - } - - { - const f_status_t status = f_fss_set_quote_increase(length, &data); - - assert_int_equal(status, F_data_not); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.objects.size, length); - assert_int_equal(data.contents.used, 0); - assert_int_equal(data.contents.size, length); - assert_int_equal(data.objects_quote.used, 0); - assert_int_equal(data.objects_quote.size, length); - assert_int_equal(data.contents_quote.used, 0); - assert_int_equal(data.contents_quote.size, length); - } - - free((void *) data.objects.array); - free((void *) data.contents.array); - free((void *) data.objects_quote.array); - free((void *) data.contents_quote.array); -} - -void test__f_fss_set_quote_increase__works(void **state) { - - const int length = 5; - f_fss_set_quote_t data = f_fss_set_quote_t_initialize; - - { - const f_status_t status = f_fss_set_quote_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.objects.size, length); - assert_int_equal(data.contents.used, 0); - assert_int_equal(data.contents.size, length); - assert_int_equal(data.objects_quote.used, 0); - assert_int_equal(data.objects_quote.size, length); - assert_int_equal(data.contents_quote.used, 0); - assert_int_equal(data.contents_quote.size, length); - } - - { - data.objects.used = length; - data.contents.used = length; - data.objects_quote.used = length; - data.contents_quote.used = length; - - const f_status_t status = f_fss_set_quote_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.objects.used, length); - assert_in_range(data.objects.size, length + 1, length + 1 + F_memory_default_allocation_small_d); - assert_int_equal(data.contents.used, length); - assert_in_range(data.contents.size, length + 1, length + 1 + F_memory_default_allocation_small_d); - assert_int_equal(data.objects_quote.used, length); - assert_in_range(data.objects_quote.size, length + 1, length + 1 + F_memory_default_allocation_small_d); - assert_int_equal(data.contents_quote.used, length); - assert_in_range(data.contents_quote.size, length + 1, length + 1 + F_memory_default_allocation_small_d); - } - - free((void *) data.objects.array); - free((void *) data.contents.array); - free((void *) data.objects_quote.array); - free((void *) data.contents_quote.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_quote_increase.h b/level_0/f_fss/tests/unit/c/test-fss-set_quote_increase.h deleted file mode 100644 index e5d1225..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-set_quote_increase.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test set quote increase in the fss project. - */ -#ifndef _TEST__F_fss__set_quote_increase -#define _TEST__F_fss__set_quote_increase - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_set_quote_increase() - */ -extern void test__f_fss_set_quote_increase__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_fss_set_quote_increase() - */ -extern void test__f_fss_set_quote_increase__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_fss_set_quote_increase() - */ -extern void test__f_fss_set_quote_increase__works(void **state); - -#endif // _TEST__F_fss__set_quote_increase diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_quote_increase_by.c b/level_0/f_fss/tests/unit/c/test-fss-set_quote_increase_by.c deleted file mode 100644 index 4cd5f70..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-set_quote_increase_by.c +++ /dev/null @@ -1,118 +0,0 @@ -#include "test-fss.h" -#include "test-fss-set_quote_increase_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_set_quote_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_fss_set_quote_t data = f_fss_set_quote_t_initialize; - - { - const f_status_t status = f_fss_set_quote_increase_by(length, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.objects.size, 0); - assert_int_equal(data.contents.used, 0); - assert_int_equal(data.contents.size, 0); - assert_int_equal(data.objects_quote.used, 0); - assert_int_equal(data.objects_quote.size, 0); - assert_int_equal(data.contents_quote.used, 0); - assert_int_equal(data.contents_quote.size, 0); - } - - assert_null(data.objects.array); - assert_null(data.contents.array); - assert_null(data.objects_quote.array); - assert_null(data.contents_quote.array); -} - -void test__f_fss_set_quote_increase_by__returns_data_not(void **state) { - - const int length = 5; - f_fss_set_quote_t data = f_fss_set_quote_t_initialize; - - { - const f_status_t status = f_fss_set_quote_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.objects.size, length); - assert_int_equal(data.contents.used, 0); - assert_int_equal(data.contents.size, length); - assert_int_equal(data.objects_quote.used, 0); - assert_int_equal(data.objects_quote.size, length); - assert_int_equal(data.contents_quote.used, 0); - assert_int_equal(data.contents_quote.size, length); - } - - { - const f_status_t status = f_fss_set_quote_increase_by(0, &data); - - assert_int_equal(status, F_data_not); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.objects.size, length); - assert_int_equal(data.contents.used, 0); - assert_int_equal(data.contents.size, length); - assert_int_equal(data.objects_quote.used, 0); - assert_int_equal(data.objects_quote.size, length); - assert_int_equal(data.contents_quote.used, 0); - assert_int_equal(data.contents_quote.size, length); - } - - free((void *) data.objects.array); - free((void *) data.contents.array); - free((void *) data.objects_quote.array); - free((void *) data.contents_quote.array); -} - -void test__f_fss_set_quote_increase_by__works(void **state) { - - const int length = 5; - f_fss_set_quote_t data = f_fss_set_quote_t_initialize; - - { - const f_status_t status = f_fss_set_quote_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.objects.size, length); - assert_int_equal(data.contents.used, 0); - assert_int_equal(data.contents.size, length); - assert_int_equal(data.objects_quote.used, 0); - assert_int_equal(data.objects_quote.size, length); - assert_int_equal(data.contents_quote.used, 0); - assert_int_equal(data.contents_quote.size, length); - } - - { - data.objects.used = length; - data.contents.used = length; - data.objects_quote.used = length; - data.contents_quote.used = length; - - const f_status_t status = f_fss_set_quote_increase_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.objects.used, length); - assert_int_equal(data.objects.size, length * 2); - assert_int_equal(data.contents.used, length); - assert_int_equal(data.contents.size, length * 2); - assert_int_equal(data.objects_quote.used, length); - assert_int_equal(data.objects_quote.size, length * 2); - assert_int_equal(data.contents_quote.used, length); - assert_int_equal(data.contents_quote.size, length * 2); - } - - free((void *) data.objects.array); - free((void *) data.contents.array); - free((void *) data.objects_quote.array); - free((void *) data.contents_quote.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_quote_increase_by.h b/level_0/f_fss/tests/unit/c/test-fss-set_quote_increase_by.h deleted file mode 100644 index e61a9b2..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-set_quote_increase_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test set quote increase by in the fss project. - */ -#ifndef _TEST__F_fss__set_quote_increase_by -#define _TEST__F_fss__set_quote_increase_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_set_quote_increase_by() - */ -extern void test__f_fss_set_quote_increase_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_fss_set_quote_increase_by() - */ -extern void test__f_fss_set_quote_increase_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_fss_set_quote_increase_by() - */ -extern void test__f_fss_set_quote_increase_by__works(void **state); - -#endif // _TEST__F_fss__set_quote_increase_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_quote_resize.c b/level_0/f_fss/tests/unit/c/test-fss-set_quote_resize.c deleted file mode 100644 index 5f99eb3..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-set_quote_resize.c +++ /dev/null @@ -1,60 +0,0 @@ -#include "test-fss.h" -#include "test-fss-set_quote_resize.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_set_quote_resize__parameter_checking(void **state) { - - const int length = 5; - f_fss_set_quote_t data = f_fss_set_quote_t_initialize; - - { - const f_status_t status = f_fss_set_quote_resize(length, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.objects.size, 0); - assert_int_equal(data.contents.used, 0); - assert_int_equal(data.contents.size, 0); - assert_int_equal(data.objects_quote.used, 0); - assert_int_equal(data.objects_quote.size, 0); - assert_int_equal(data.contents_quote.used, 0); - assert_int_equal(data.contents_quote.size, 0); - } - - assert_null(data.objects.array); - assert_null(data.contents.array); - assert_null(data.objects_quote.array); - assert_null(data.contents_quote.array); -} - -void test__f_fss_set_quote_resize__works(void **state) { - - const int length = 5; - f_fss_set_quote_t data = f_fss_set_quote_t_initialize; - - { - const f_status_t status = f_fss_set_quote_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.objects.size, length); - assert_int_equal(data.contents.used, 0); - assert_int_equal(data.contents.size, length); - assert_int_equal(data.objects_quote.used, 0); - assert_int_equal(data.objects_quote.size, length); - assert_int_equal(data.contents_quote.used, 0); - assert_int_equal(data.contents_quote.size, length); - } - - free((void *) data.objects.array); - free((void *) data.contents.array); - free((void *) data.objects_quote.array); - free((void *) data.contents_quote.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_quote_resize.h b/level_0/f_fss/tests/unit/c/test-fss-set_quote_resize.h deleted file mode 100644 index 0b92284..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-set_quote_resize.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test set quote resize in the fss project. - */ -#ifndef _TEST__F_fss__set_quote_resize -#define _TEST__F_fss__set_quote_resize - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_set_quote_resize() - */ -extern void test__f_fss_set_quote_resize__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_fss_set_quote_resize() - */ -extern void test__f_fss_set_quote_resize__works(void **state); - -#endif // _TEST__F_fss__set_quote_resize diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_quotes_adjust.c b/level_0/f_fss/tests/unit/c/test-fss-set_quotes_adjust.c deleted file mode 100644 index eda1ba6..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-set_quotes_adjust.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-fss.h" -#include "test-fss-set_quotes_adjust.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_set_quotes_adjust__parameter_checking(void **state) { - - const int length = 5; - f_fss_set_quotes_t data = f_fss_set_quotes_t_initialize; - - { - const f_status_t status = f_fss_set_quotes_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); -} - -void test__f_fss_set_quotes_adjust__works(void **state) { - - const int length = 5; - f_fss_set_quotes_t data = f_fss_set_quotes_t_initialize; - - { - const f_status_t status = f_fss_set_quotes_adjust(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_quotes_adjust.h b/level_0/f_fss/tests/unit/c/test-fss-set_quotes_adjust.h deleted file mode 100644 index a001fc5..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-set_quotes_adjust.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test set quote adjust in the fss project. - */ -#ifndef _TEST__F_fss__set_quotes_adjust -#define _TEST__F_fss__set_quotes_adjust - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_set_quotes_adjust() - */ -extern void test__f_fss_set_quotes_adjust__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_fss_set_quotes_adjust() - */ -extern void test__f_fss_set_quotes_adjust__works(void **state); - -#endif // _TEST__F_fss__set_quotes_adjust diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_quotes_decimate_by.c b/level_0/f_fss/tests/unit/c/test-fss-set_quotes_decimate_by.c deleted file mode 100644 index 764892a..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-set_quotes_decimate_by.c +++ /dev/null @@ -1,61 +0,0 @@ -#include "test-fss.h" -#include "test-fss-set_quotes_decimate_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_set_quotes_decimate_by__parameter_checking(void **state) { - - const int length = 5; - f_fss_set_quotes_t data = f_fss_set_quotes_t_initialize; - - { - const f_status_t status = f_fss_set_quotes_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); -} - -void test__f_fss_set_quotes_decimate_by__returns_data_not(void **state) { - - f_fss_set_quotes_t data = f_fss_set_quotes_t_initialize; - - { - const f_status_t status = f_fss_set_quotes_decimate_by(0, &data); - - assert_int_equal(status, F_data_not); - } -} - -void test__f_fss_set_quotes_decimate_by__works(void **state) { - - const int length = 5; - f_fss_set_quotes_t data = f_fss_set_quotes_t_initialize; - - { - const f_status_t status = f_fss_set_quotes_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_fss_set_quotes_decimate_by(length, &data); - - assert_int_equal(status, F_none); - 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_fss/tests/unit/c/test-fss-set_quotes_decimate_by.h b/level_0/f_fss/tests/unit/c/test-fss-set_quotes_decimate_by.h deleted file mode 100644 index 676ede6..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-set_quotes_decimate_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test set quote decimate by in the fss project. - */ -#ifndef _TEST__F_fss__set_quotes_decimate_by -#define _TEST__F_fss__set_quotes_decimate_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_set_quotes_decimate_by() - */ -extern void test__f_fss_set_quotes_decimate_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_fss_set_quotes_decimate_by() - */ -extern void test__f_fss_set_quotes_decimate_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_fss_set_quotes_decimate_by() - */ -extern void test__f_fss_set_quotes_decimate_by__works(void **state); - -#endif // _TEST__F_fss__set_quotes_decimate_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_quotes_decrease_by.c b/level_0/f_fss/tests/unit/c/test-fss-set_quotes_decrease_by.c deleted file mode 100644 index 3ba6e94..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-set_quotes_decrease_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-fss.h" -#include "test-fss-set_quotes_decrease_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_set_quotes_decrease_by__parameter_checking(void **state) { - - const int length = 5; - f_fss_set_quotes_t data = f_fss_set_quotes_t_initialize; - - { - const f_status_t status = f_fss_set_quotes_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); -} - -void test__f_fss_set_quotes_decrease_by__returns_data_not(void **state) { - - const int length = 5; - f_fss_set_quotes_t data = f_fss_set_quotes_t_initialize; - - { - const f_status_t status = f_fss_set_quotes_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_fss_set_quotes_decrease_by(0, &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_fss_set_quotes_decrease_by__works(void **state) { - - const int length = 5; - f_fss_set_quotes_t data = f_fss_set_quotes_t_initialize; - - { - const f_status_t status = f_fss_set_quotes_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_fss_set_quotes_decrease_by(length, &data); - - assert_int_equal(status, F_none); - 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_fss/tests/unit/c/test-fss-set_quotes_decrease_by.h b/level_0/f_fss/tests/unit/c/test-fss-set_quotes_decrease_by.h deleted file mode 100644 index 763ca1a..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-set_quotes_decrease_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test set quote decrease by in the fss project. - */ -#ifndef _TEST__F_fss__set_quotes_decrease_by -#define _TEST__F_fss__set_quotes_decrease_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_set_quotes_decrease_by() - */ -extern void test__f_fss_set_quotes_decrease_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_fss_set_quotes_decrease_by() - */ -extern void test__f_fss_set_quotes_decrease_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_fss_set_quotes_decrease_by() - */ -extern void test__f_fss_set_quotes_decrease_by__works(void **state); - -#endif // _TEST__F_fss__set_quotes_decrease_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_quotes_increase.c b/level_0/f_fss/tests/unit/c/test-fss-set_quotes_increase.c deleted file mode 100644 index 7b94503..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-set_quotes_increase.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-fss.h" -#include "test-fss-set_quotes_increase.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_set_quotes_increase__parameter_checking(void **state) { - - const int length = 5; - f_fss_set_quotes_t data = f_fss_set_quotes_t_initialize; - - { - const f_status_t status = f_fss_set_quotes_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); -} - -void test__f_fss_set_quotes_increase__returns_data_not(void **state) { - - const int length = 5; - f_fss_set_quotes_t data = f_fss_set_quotes_t_initialize; - - { - const f_status_t status = f_fss_set_quotes_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_fss_set_quotes_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_fss_set_quotes_increase__works(void **state) { - - const int length = 5; - f_fss_set_quotes_t data = f_fss_set_quotes_t_initialize; - - { - const f_status_t status = f_fss_set_quotes_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_fss_set_quotes_increase(length, &data); - - assert_int_equal(status, F_none); - 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); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_quotes_increase.h b/level_0/f_fss/tests/unit/c/test-fss-set_quotes_increase.h deleted file mode 100644 index b8fa1b5..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-set_quotes_increase.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test set quote increase in the fss project. - */ -#ifndef _TEST__F_fss__set_quotes_increase -#define _TEST__F_fss__set_quotes_increase - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_set_quotes_increase() - */ -extern void test__f_fss_set_quotes_increase__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_fss_set_quotes_increase() - */ -extern void test__f_fss_set_quotes_increase__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_fss_set_quotes_increase() - */ -extern void test__f_fss_set_quotes_increase__works(void **state); - -#endif // _TEST__F_fss__set_quotes_increase diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_quotes_increase_by.c b/level_0/f_fss/tests/unit/c/test-fss-set_quotes_increase_by.c deleted file mode 100644 index 16fd7a9..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-set_quotes_increase_by.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-fss.h" -#include "test-fss-set_quotes_increase_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_set_quotes_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_fss_set_quotes_t data = f_fss_set_quotes_t_initialize; - - { - const f_status_t status = f_fss_set_quotes_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); -} - -void test__f_fss_set_quotes_increase_by__returns_data_not(void **state) { - - const int length = 5; - f_fss_set_quotes_t data = f_fss_set_quotes_t_initialize; - - { - const f_status_t status = f_fss_set_quotes_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_fss_set_quotes_increase_by(0, &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_fss_set_quotes_increase_by__works(void **state) { - - const int length = 5; - f_fss_set_quotes_t data = f_fss_set_quotes_t_initialize; - - { - const f_status_t status = f_fss_set_quotes_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_fss_set_quotes_increase_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_quotes_increase_by.h b/level_0/f_fss/tests/unit/c/test-fss-set_quotes_increase_by.h deleted file mode 100644 index 7081644..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-set_quotes_increase_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test set quote increase by in the fss project. - */ -#ifndef _TEST__F_fss__set_quotes_increase_by -#define _TEST__F_fss__set_quotes_increase_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_set_quotes_increase_by() - */ -extern void test__f_fss_set_quotes_increase_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_fss_set_quotes_increase_by() - */ -extern void test__f_fss_set_quotes_increase_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_fss_set_quotes_increase_by() - */ -extern void test__f_fss_set_quotes_increase_by__works(void **state); - -#endif // _TEST__F_fss__set_quotes_increase_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_quotes_resize.c b/level_0/f_fss/tests/unit/c/test-fss-set_quotes_resize.c deleted file mode 100644 index 327f527..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-set_quotes_resize.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-fss.h" -#include "test-fss-set_quotes_resize.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_set_quotes_resize__parameter_checking(void **state) { - - const int length = 5; - f_fss_set_quotes_t data = f_fss_set_quotes_t_initialize; - - { - const f_status_t status = f_fss_set_quotes_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); -} - -void test__f_fss_set_quotes_resize__works(void **state) { - - const int length = 5; - f_fss_set_quotes_t data = f_fss_set_quotes_t_initialize; - - { - const f_status_t status = f_fss_set_quotes_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_quotes_resize.h b/level_0/f_fss/tests/unit/c/test-fss-set_quotes_resize.h deleted file mode 100644 index 0faaac6..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-set_quotes_resize.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test set quote resize in the fss project. - */ -#ifndef _TEST__F_fss__set_quotes_resize -#define _TEST__F_fss__set_quotes_resize - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_set_quotes_resize() - */ -extern void test__f_fss_set_quotes_resize__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_fss_set_quotes_resize() - */ -extern void test__f_fss_set_quotes_resize__works(void **state); - -#endif // _TEST__F_fss__set_quotes_resize diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_resize.c b/level_0/f_fss/tests/unit/c/test-fss-set_resize.c deleted file mode 100644 index 94fb610..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-set_resize.c +++ /dev/null @@ -1,48 +0,0 @@ -#include "test-fss.h" -#include "test-fss-set_resize.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_set_resize__parameter_checking(void **state) { - - const int length = 5; - f_fss_set_t data = f_fss_set_t_initialize; - - { - const f_status_t status = f_fss_set_resize(length, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.objects.size, 0); - assert_int_equal(data.contents.used, 0); - assert_int_equal(data.contents.size, 0); - } - - assert_null(data.objects.array); - assert_null(data.contents.array); -} - -void test__f_fss_set_resize__works(void **state) { - - const int length = 5; - f_fss_set_t data = f_fss_set_t_initialize; - - { - const f_status_t status = f_fss_set_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.objects.used, 0); - assert_int_equal(data.objects.size, length); - assert_int_equal(data.contents.used, 0); - assert_int_equal(data.contents.size, length); - } - - free((void *) data.objects.array); - free((void *) data.contents.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_resize.h b/level_0/f_fss/tests/unit/c/test-fss-set_resize.h deleted file mode 100644 index 868ae7d..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-set_resize.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test set resize in the fss project. - */ -#ifndef _TEST__F_fss__set_resize -#define _TEST__F_fss__set_resize - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_set_resize() - */ -extern void test__f_fss_set_resize__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_fss_set_resize() - */ -extern void test__f_fss_set_resize__works(void **state); - -#endif // _TEST__F_fss__set_resize diff --git a/level_0/f_fss/tests/unit/c/test-fss-sets_adjust.c b/level_0/f_fss/tests/unit/c/test-fss-sets_adjust.c deleted file mode 100644 index b6cc15b..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-sets_adjust.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-fss.h" -#include "test-fss-sets_adjust.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_sets_adjust__parameter_checking(void **state) { - - const int length = 5; - f_fss_sets_t data = f_fss_sets_t_initialize; - - { - const f_status_t status = f_fss_sets_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); -} - -void test__f_fss_sets_adjust__works(void **state) { - - const int length = 5; - f_fss_sets_t data = f_fss_sets_t_initialize; - - { - const f_status_t status = f_fss_sets_adjust(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-sets_adjust.h b/level_0/f_fss/tests/unit/c/test-fss-sets_adjust.h deleted file mode 100644 index d45562b..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-sets_adjust.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test sets adjust in the fss project. - */ -#ifndef _TEST__F_fss__sets_adjust -#define _TEST__F_fss__sets_adjust - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_sets_adjust() - */ -extern void test__f_fss_sets_adjust__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_fss_sets_adjust() - */ -extern void test__f_fss_sets_adjust__works(void **state); - -#endif // _TEST__F_fss__sets_adjust diff --git a/level_0/f_fss/tests/unit/c/test-fss-sets_decimate_by.c b/level_0/f_fss/tests/unit/c/test-fss-sets_decimate_by.c deleted file mode 100644 index 677df5e..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-sets_decimate_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-fss.h" -#include "test-fss-sets_decimate_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_sets_decimate_by__parameter_checking(void **state) { - - const int length = 5; - f_fss_sets_t data = f_fss_sets_t_initialize; - - { - const f_status_t status = f_fss_sets_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); -} - -void test__f_fss_sets_decimate_by__returns_data_not(void **state) { - - const int length = 5; - f_fss_sets_t data = f_fss_sets_t_initialize; - - { - const f_status_t status = f_fss_sets_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_fss_sets_decimate_by(0, &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_fss_sets_decimate_by__works(void **state) { - - const int length = 5; - f_fss_sets_t data = f_fss_sets_t_initialize; - - { - const f_status_t status = f_fss_sets_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_fss_sets_decimate_by(length, &data); - - assert_int_equal(status, F_none); - 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_fss/tests/unit/c/test-fss-sets_decimate_by.h b/level_0/f_fss/tests/unit/c/test-fss-sets_decimate_by.h deleted file mode 100644 index 9c5f178..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-sets_decimate_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test sets decimate by in the fss project. - */ -#ifndef _TEST__F_fss__sets_decimate_by -#define _TEST__F_fss__sets_decimate_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_sets_decimate_by() - */ -extern void test__f_fss_sets_decimate_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_fss_sets_decimate_by() - */ -extern void test__f_fss_sets_decimate_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_fss_sets_decimate_by() - */ -extern void test__f_fss_sets_decimate_by__works(void **state); - -#endif // _TEST__F_fss__sets_decimate_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-sets_decrease_by.c b/level_0/f_fss/tests/unit/c/test-fss-sets_decrease_by.c deleted file mode 100644 index 42ee4ed..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-sets_decrease_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-fss.h" -#include "test-fss-sets_decrease_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_sets_decrease_by__parameter_checking(void **state) { - - const int length = 5; - f_fss_sets_t data = f_fss_sets_t_initialize; - - { - const f_status_t status = f_fss_sets_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); -} - -void test__f_fss_sets_decrease_by__returns_data_not(void **state) { - - const int length = 5; - f_fss_sets_t data = f_fss_sets_t_initialize; - - { - const f_status_t status = f_fss_sets_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_fss_sets_decrease_by(0, &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_fss_sets_decrease_by__works(void **state) { - - const int length = 5; - f_fss_sets_t data = f_fss_sets_t_initialize; - - { - const f_status_t status = f_fss_sets_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_fss_sets_decrease_by(length, &data); - - assert_int_equal(status, F_none); - 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_fss/tests/unit/c/test-fss-sets_decrease_by.h b/level_0/f_fss/tests/unit/c/test-fss-sets_decrease_by.h deleted file mode 100644 index 276100c..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-sets_decrease_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test sets decrease by in the fss project. - */ -#ifndef _TEST__F_fss__sets_decrease_by -#define _TEST__F_fss__sets_decrease_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_sets_decrease_by() - */ -extern void test__f_fss_sets_decrease_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_fss_sets_decrease_by() - */ -extern void test__f_fss_sets_decrease_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_fss_sets_decrease_by() - */ -extern void test__f_fss_sets_decrease_by__works(void **state); - -#endif // _TEST__F_fss__sets_decrease_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-sets_increase.c b/level_0/f_fss/tests/unit/c/test-fss-sets_increase.c deleted file mode 100644 index 8500388..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-sets_increase.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-fss.h" -#include "test-fss-sets_increase.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_sets_increase__parameter_checking(void **state) { - - const int length = 5; - f_fss_sets_t data = f_fss_sets_t_initialize; - - { - const f_status_t status = f_fss_sets_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); -} - -void test__f_fss_sets_increase__returns_data_not(void **state) { - - const int length = 5; - f_fss_sets_t data = f_fss_sets_t_initialize; - - { - const f_status_t status = f_fss_sets_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_fss_sets_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_fss_sets_increase__works(void **state) { - - const int length = 5; - f_fss_sets_t data = f_fss_sets_t_initialize; - - { - const f_status_t status = f_fss_sets_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_fss_sets_increase(length, &data); - - assert_int_equal(status, F_none); - 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); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-sets_increase.h b/level_0/f_fss/tests/unit/c/test-fss-sets_increase.h deleted file mode 100644 index f7f21d4..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-sets_increase.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test sets increase in the fss project. - */ -#ifndef _TEST__F_fss__sets_increase -#define _TEST__F_fss__sets_increase - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_sets_increase() - */ -extern void test__f_fss_sets_increase__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_fss_sets_increase() - */ -extern void test__f_fss_sets_increase__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_fss_sets_increase() - */ -extern void test__f_fss_sets_increase__works(void **state); - -#endif // _TEST__F_fss__sets_increase diff --git a/level_0/f_fss/tests/unit/c/test-fss-sets_increase_by.c b/level_0/f_fss/tests/unit/c/test-fss-sets_increase_by.c deleted file mode 100644 index e6b8ca7..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-sets_increase_by.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-fss.h" -#include "test-fss-sets_increase_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_sets_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_fss_sets_t data = f_fss_sets_t_initialize; - - { - const f_status_t status = f_fss_sets_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); -} - -void test__f_fss_sets_increase_by__returns_data_not(void **state) { - - const int length = 5; - f_fss_sets_t data = f_fss_sets_t_initialize; - - { - const f_status_t status = f_fss_sets_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_fss_sets_increase_by(0, &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_fss_sets_increase_by__works(void **state) { - - const int length = 5; - f_fss_sets_t data = f_fss_sets_t_initialize; - - { - const f_status_t status = f_fss_sets_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_fss_sets_increase_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-sets_increase_by.h b/level_0/f_fss/tests/unit/c/test-fss-sets_increase_by.h deleted file mode 100644 index 16a0fdd..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-sets_increase_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test sets increase by in the fss project. - */ -#ifndef _TEST__F_fss__sets_increase_by -#define _TEST__F_fss__sets_increase_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_sets_increase_by() - */ -extern void test__f_fss_sets_increase_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_fss_sets_increase_by() - */ -extern void test__f_fss_sets_increase_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_fss_sets_increase_by() - */ -extern void test__f_fss_sets_increase_by__works(void **state); - -#endif // _TEST__F_fss__sets_increase_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-sets_resize.c b/level_0/f_fss/tests/unit/c/test-fss-sets_resize.c deleted file mode 100644 index c0a2351..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-sets_resize.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-fss.h" -#include "test-fss-sets_resize.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_sets_resize__parameter_checking(void **state) { - - const int length = 5; - f_fss_sets_t data = f_fss_sets_t_initialize; - - { - const f_status_t status = f_fss_sets_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); -} - -void test__f_fss_sets_resize__works(void **state) { - - const int length = 5; - f_fss_sets_t data = f_fss_sets_t_initialize; - - { - const f_status_t status = f_fss_sets_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-sets_resize.h b/level_0/f_fss/tests/unit/c/test-fss-sets_resize.h deleted file mode 100644 index c31abe0..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-sets_resize.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test sets resize by in the fss project. - */ -#ifndef _TEST__F_fss__sets_resize -#define _TEST__F_fss__sets_resize - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_sets_resize() - */ -extern void test__f_fss_sets_resize__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_fss_sets_resize() - */ -extern void test__f_fss_sets_resize__works(void **state); - -#endif // _TEST__F_fss__sets_resize diff --git a/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_adjust.c b/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_adjust.c deleted file mode 100644 index 1c6e876..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_adjust.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-fss.h" -#include "test-fss-simple_packet_ranges_adjust.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_simple_packet_ranges_adjust__parameter_checking(void **state) { - - const int length = 5; - f_fss_simple_packet_ranges_t data = f_fss_simple_packet_ranges_t_initialize; - - { - const f_status_t status = f_fss_simple_packet_ranges_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); -} - -void test__f_fss_simple_packet_ranges_adjust__works(void **state) { - - const int length = 5; - f_fss_simple_packet_ranges_t data = f_fss_simple_packet_ranges_t_initialize; - - { - const f_status_t status = f_fss_simple_packet_ranges_adjust(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_adjust.h b/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_adjust.h deleted file mode 100644 index 82c3ee0..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_adjust.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test set quote adjust in the fss project. - */ -#ifndef _TEST__F_fss__simple_packet_range_adjust -#define _TEST__F_fss__simple_packet_range_adjust - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_simple_packet_ranges_adjust() - */ -extern void test__f_fss_simple_packet_ranges_adjust__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_fss_simple_packet_ranges_adjust() - */ -extern void test__f_fss_simple_packet_ranges_adjust__works(void **state); - -#endif // _TEST__F_fss__simple_packet_range_adjust diff --git a/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_decimate_by.c b/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_decimate_by.c deleted file mode 100644 index e057b15..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_decimate_by.c +++ /dev/null @@ -1,73 +0,0 @@ -#include "test-fss.h" -#include "test-fss-simple_packet_ranges_decimate_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_simple_packet_ranges_decimate_by__parameter_checking(void **state) { - - const int length = 5; - f_fss_simple_packet_ranges_t data = f_fss_simple_packet_ranges_t_initialize; - - { - const f_status_t status = f_fss_simple_packet_ranges_decimate_by(length, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -void test__f_fss_simple_packet_ranges_decimate_by__returns_data_not(void **state) { - - const int length = 5; - f_fss_simple_packet_ranges_t data = f_fss_simple_packet_ranges_t_initialize; - - { - const f_status_t status = f_fss_simple_packet_ranges_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_fss_simple_packet_ranges_decimate_by(0, &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_fss_simple_packet_ranges_decimate_by__works(void **state) { - - const int length = 5; - f_fss_simple_packet_ranges_t data = f_fss_simple_packet_ranges_t_initialize; - - { - const f_status_t status = f_fss_simple_packet_ranges_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_fss_simple_packet_ranges_decimate_by(length, &data); - - assert_int_equal(status, F_none); - 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_fss/tests/unit/c/test-fss-simple_packet_ranges_decimate_by.h b/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_decimate_by.h deleted file mode 100644 index adda67e..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_decimate_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test set quote decimate by in the fss project. - */ -#ifndef _TEST__F_fss__simple_packet_range_decimate_by -#define _TEST__F_fss__simple_packet_range_decimate_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_simple_packet_ranges_decimate_by() - */ -extern void test__f_fss_simple_packet_ranges_decimate_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_fss_simple_packet_ranges_decimate_by() - */ -extern void test__f_fss_simple_packet_ranges_decimate_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_fss_simple_packet_ranges_decimate_by() - */ -extern void test__f_fss_simple_packet_ranges_decimate_by__works(void **state); - -#endif // _TEST__F_fss__simple_packet_range_decimate_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_decrease_by.c b/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_decrease_by.c deleted file mode 100644 index 7e64850..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_decrease_by.c +++ /dev/null @@ -1,73 +0,0 @@ -#include "test-fss.h" -#include "test-fss-simple_packet_ranges_decrease_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_simple_packet_ranges_decrease_by__parameter_checking(void **state) { - - const int length = 5; - f_fss_simple_packet_ranges_t data = f_fss_simple_packet_ranges_t_initialize; - - { - const f_status_t status = f_fss_simple_packet_ranges_decrease_by(length, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -void test__f_fss_simple_packet_ranges_decrease_by__returns_data_not(void **state) { - - const int length = 5; - f_fss_simple_packet_ranges_t data = f_fss_simple_packet_ranges_t_initialize; - - { - const f_status_t status = f_fss_simple_packet_ranges_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_fss_simple_packet_ranges_decrease_by(0, &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_fss_simple_packet_ranges_decrease_by__works(void **state) { - - const int length = 5; - f_fss_simple_packet_ranges_t data = f_fss_simple_packet_ranges_t_initialize; - - { - const f_status_t status = f_fss_simple_packet_ranges_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_fss_simple_packet_ranges_decrease_by(length, &data); - - assert_int_equal(status, F_none); - 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_fss/tests/unit/c/test-fss-simple_packet_ranges_decrease_by.h b/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_decrease_by.h deleted file mode 100644 index dcc9acf..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_decrease_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test set quote decrease by in the fss project. - */ -#ifndef _TEST__F_fss__simple_packet_range_decrease_by -#define _TEST__F_fss__simple_packet_range_decrease_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_simple_packet_ranges_decrease_by() - */ -extern void test__f_fss_simple_packet_ranges_decrease_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_fss_simple_packet_ranges_decrease_by() - */ -extern void test__f_fss_simple_packet_ranges_decrease_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_fss_simple_packet_ranges_decrease_by() - */ -extern void test__f_fss_simple_packet_ranges_decrease_by__works(void **state); - -#endif // _TEST__F_fss__simple_packet_range_decrease_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_increase.c b/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_increase.c deleted file mode 100644 index 119f1f8..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_increase.c +++ /dev/null @@ -1,75 +0,0 @@ -#include "test-fss.h" -#include "test-fss-simple_packet_ranges_increase.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_simple_packet_ranges_increase__parameter_checking(void **state) { - - const int length = 5; - f_fss_simple_packet_ranges_t data = f_fss_simple_packet_ranges_t_initialize; - - { - const f_status_t status = f_fss_simple_packet_ranges_increase(length, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -void test__f_fss_simple_packet_ranges_increase__returns_data_not(void **state) { - - const int length = 5; - f_fss_simple_packet_ranges_t data = f_fss_simple_packet_ranges_t_initialize; - - { - const f_status_t status = f_fss_simple_packet_ranges_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_fss_simple_packet_ranges_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_fss_simple_packet_ranges_increase__works(void **state) { - - const int length = 5; - f_fss_simple_packet_ranges_t data = f_fss_simple_packet_ranges_t_initialize; - - { - const f_status_t status = f_fss_simple_packet_ranges_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_fss_simple_packet_ranges_increase(1, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length + 1); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_increase.h b/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_increase.h deleted file mode 100644 index c2f8e03..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_increase.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test set quote increase in the fss project. - */ -#ifndef _TEST__F_fss__simple_packet_range_increase -#define _TEST__F_fss__simple_packet_range_increase - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_simple_packet_ranges_increase() - */ -extern void test__f_fss_simple_packet_ranges_increase__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_fss_simple_packet_ranges_increase() - */ -extern void test__f_fss_simple_packet_ranges_increase__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_fss_simple_packet_ranges_increase() - */ -extern void test__f_fss_simple_packet_ranges_increase__works(void **state); - -#endif // _TEST__F_fss__simple_packet_range_increase diff --git a/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_increase_by.c b/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_increase_by.c deleted file mode 100644 index 82d4da6..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_increase_by.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-fss.h" -#include "test-fss-simple_packet_ranges_increase_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_simple_packet_ranges_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_fss_simple_packet_ranges_t data = f_fss_simple_packet_ranges_t_initialize; - - { - const f_status_t status = f_fss_simple_packet_ranges_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); -} - -void test__f_fss_simple_packet_ranges_increase_by__returns_data_not(void **state) { - - const int length = 5; - f_fss_simple_packet_ranges_t data = f_fss_simple_packet_ranges_t_initialize; - - { - const f_status_t status = f_fss_simple_packet_ranges_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_fss_simple_packet_ranges_increase_by(0, &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_fss_simple_packet_ranges_increase_by__works(void **state) { - - const int length = 5; - f_fss_simple_packet_ranges_t data = f_fss_simple_packet_ranges_t_initialize; - - { - const f_status_t status = f_fss_simple_packet_ranges_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_fss_simple_packet_ranges_increase_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_increase_by.h b/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_increase_by.h deleted file mode 100644 index 0398704..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_increase_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test set quote increase by in the fss project. - */ -#ifndef _TEST__F_fss__simple_packet_range_increase_by -#define _TEST__F_fss__simple_packet_range_increase_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_simple_packet_ranges_increase_by() - */ -extern void test__f_fss_simple_packet_ranges_increase_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_fss_simple_packet_ranges_increase_by() - */ -extern void test__f_fss_simple_packet_ranges_increase_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_fss_simple_packet_ranges_increase_by() - */ -extern void test__f_fss_simple_packet_ranges_increase_by__works(void **state); - -#endif // _TEST__F_fss__simple_packet_range_increase_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_resize.c b/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_resize.c deleted file mode 100644 index 74c7833..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_resize.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-fss.h" -#include "test-fss-simple_packet_ranges_resize.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_fss_simple_packet_ranges_resize__parameter_checking(void **state) { - - const int length = 5; - f_fss_simple_packet_ranges_t data = f_fss_simple_packet_ranges_t_initialize; - - { - const f_status_t status = f_fss_simple_packet_ranges_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); -} - -void test__f_fss_simple_packet_ranges_resize__works(void **state) { - - const int length = 5; - f_fss_simple_packet_ranges_t data = f_fss_simple_packet_ranges_t_initialize; - - { - const f_status_t status = f_fss_simple_packet_ranges_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_resize.h b/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_resize.h deleted file mode 100644 index 9de1e1c..0000000 --- a/level_0/f_fss/tests/unit/c/test-fss-simple_packet_ranges_resize.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: FSS - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test set quote resize in the fss project. - */ -#ifndef _TEST__F_fss__simple_packet_range_resize -#define _TEST__F_fss__simple_packet_range_resize - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fss_simple_packet_ranges_resize() - */ -extern void test__f_fss_simple_packet_ranges_resize__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_fss_simple_packet_ranges_resize() - */ -extern void test__f_fss_simple_packet_ranges_resize__works(void **state); - -#endif // _TEST__F_fss__simple_packet_range_resize diff --git a/level_0/f_fss/tests/unit/c/test-fss.c b/level_0/f_fss/tests/unit/c/test-fss.c index 96f2817..5d71325 100644 --- a/level_0/f_fss/tests/unit/c/test-fss.c +++ b/level_0/f_fss/tests/unit/c/test-fss.c @@ -45,56 +45,6 @@ int main(void) { cmocka_unit_test(test__f_fss_fail_utf__works_for_no_error), cmocka_unit_test(test__f_fss_fail_utf_to_false__works_for_no_error), - cmocka_unit_test(test__f_fss_items_decimate_by__returns_data_not), - cmocka_unit_test(test__f_fss_items_decrease_by__returns_data_not), - cmocka_unit_test(test__f_fss_items_increase__returns_data_not), - cmocka_unit_test(test__f_fss_items_increase_by__returns_data_not), - - cmocka_unit_test(test__f_fss_named_decimate_by__returns_data_not), - cmocka_unit_test(test__f_fss_named_decrease_by__returns_data_not), - cmocka_unit_test(test__f_fss_named_increase__returns_data_not), - cmocka_unit_test(test__f_fss_named_increase_by__returns_data_not), - - cmocka_unit_test(test__f_fss_nameds_decimate_by__returns_data_not), - cmocka_unit_test(test__f_fss_nameds_decrease_by__returns_data_not), - cmocka_unit_test(test__f_fss_nameds_increase__returns_data_not), - cmocka_unit_test(test__f_fss_nameds_increase_by__returns_data_not), - - cmocka_unit_test(test__f_fss_nest_decimate_by__returns_data_not), - cmocka_unit_test(test__f_fss_nest_decrease_by__returns_data_not), - cmocka_unit_test(test__f_fss_nest_increase__returns_data_not), - cmocka_unit_test(test__f_fss_nest_increase_by__returns_data_not), - - cmocka_unit_test(test__f_fss_nests_decimate_by__returns_data_not), - cmocka_unit_test(test__f_fss_nests_decrease_by__returns_data_not), - cmocka_unit_test(test__f_fss_nests_increase__returns_data_not), - cmocka_unit_test(test__f_fss_nests_increase_by__returns_data_not), - - cmocka_unit_test(test__f_fss_set_decimate_by__returns_data_not), - cmocka_unit_test(test__f_fss_set_decrease_by__returns_data_not), - cmocka_unit_test(test__f_fss_set_increase__returns_data_not), - cmocka_unit_test(test__f_fss_set_increase_by__returns_data_not), - - cmocka_unit_test(test__f_fss_set_quote_decimate_by__returns_data_not), - cmocka_unit_test(test__f_fss_set_quote_decrease_by__returns_data_not), - cmocka_unit_test(test__f_fss_set_quote_increase__returns_data_not), - cmocka_unit_test(test__f_fss_set_quote_increase_by__returns_data_not), - - cmocka_unit_test(test__f_fss_set_quotes_decimate_by__returns_data_not), - cmocka_unit_test(test__f_fss_set_quotes_decrease_by__returns_data_not), - cmocka_unit_test(test__f_fss_set_quotes_increase__returns_data_not), - cmocka_unit_test(test__f_fss_set_quotes_increase_by__returns_data_not), - - cmocka_unit_test(test__f_fss_sets_decimate_by__returns_data_not), - cmocka_unit_test(test__f_fss_sets_decrease_by__returns_data_not), - cmocka_unit_test(test__f_fss_sets_increase__returns_data_not), - cmocka_unit_test(test__f_fss_sets_increase_by__returns_data_not), - - cmocka_unit_test(test__f_fss_simple_packet_ranges_decimate_by__returns_data_not), - cmocka_unit_test(test__f_fss_simple_packet_ranges_decrease_by__returns_data_not), - cmocka_unit_test(test__f_fss_simple_packet_ranges_increase__returns_data_not), - cmocka_unit_test(test__f_fss_simple_packet_ranges_increase_by__returns_data_not), - #ifndef _di_level_0_parameter_checking_ cmocka_unit_test(test__f_fss_apply_delimit__parameter_checking), cmocka_unit_test(test__f_fss_apply_delimit_range__parameter_checking), @@ -109,76 +59,6 @@ int main(void) { cmocka_unit_test(test__f_fss_seek_to_eol__parameter_checking), cmocka_unit_test(test__f_fss_skip_past_delimit__parameter_checking), cmocka_unit_test(test__f_fss_skip_past_space__parameter_checking), - - cmocka_unit_test(test__f_fss_items_adjust__parameter_checking), - cmocka_unit_test(test__f_fss_items_decimate_by__parameter_checking), - cmocka_unit_test(test__f_fss_items_decrease_by__parameter_checking), - cmocka_unit_test(test__f_fss_items_increase__parameter_checking), - cmocka_unit_test(test__f_fss_items_increase_by__parameter_checking), - cmocka_unit_test(test__f_fss_items_resize__parameter_checking), - - cmocka_unit_test(test__f_fss_named_adjust__parameter_checking), - cmocka_unit_test(test__f_fss_named_decimate_by__parameter_checking), - cmocka_unit_test(test__f_fss_named_decrease_by__parameter_checking), - cmocka_unit_test(test__f_fss_named_increase__parameter_checking), - cmocka_unit_test(test__f_fss_named_increase_by__parameter_checking), - cmocka_unit_test(test__f_fss_named_resize__parameter_checking), - - cmocka_unit_test(test__f_fss_nameds_adjust__parameter_checking), - cmocka_unit_test(test__f_fss_nameds_decimate_by__parameter_checking), - cmocka_unit_test(test__f_fss_nameds_decrease_by__parameter_checking), - cmocka_unit_test(test__f_fss_nameds_increase__parameter_checking), - cmocka_unit_test(test__f_fss_nameds_increase_by__parameter_checking), - cmocka_unit_test(test__f_fss_nameds_resize__parameter_checking), - - cmocka_unit_test(test__f_fss_nest_adjust__parameter_checking), - cmocka_unit_test(test__f_fss_nest_decimate_by__parameter_checking), - cmocka_unit_test(test__f_fss_nest_decrease_by__parameter_checking), - cmocka_unit_test(test__f_fss_nest_increase__parameter_checking), - cmocka_unit_test(test__f_fss_nest_increase_by__parameter_checking), - cmocka_unit_test(test__f_fss_nest_resize__parameter_checking), - - cmocka_unit_test(test__f_fss_nests_adjust__parameter_checking), - cmocka_unit_test(test__f_fss_nests_decimate_by__parameter_checking), - cmocka_unit_test(test__f_fss_nests_decrease_by__parameter_checking), - cmocka_unit_test(test__f_fss_nests_increase__parameter_checking), - cmocka_unit_test(test__f_fss_nests_increase_by__parameter_checking), - cmocka_unit_test(test__f_fss_nests_resize__parameter_checking), - - cmocka_unit_test(test__f_fss_set_adjust__parameter_checking), - cmocka_unit_test(test__f_fss_set_decimate_by__parameter_checking), - cmocka_unit_test(test__f_fss_set_decrease_by__parameter_checking), - cmocka_unit_test(test__f_fss_set_increase__parameter_checking), - cmocka_unit_test(test__f_fss_set_increase_by__parameter_checking), - cmocka_unit_test(test__f_fss_set_resize__parameter_checking), - - cmocka_unit_test(test__f_fss_set_quote_adjust__parameter_checking), - cmocka_unit_test(test__f_fss_set_quote_decimate_by__parameter_checking), - cmocka_unit_test(test__f_fss_set_quote_decrease_by__parameter_checking), - cmocka_unit_test(test__f_fss_set_quote_increase__parameter_checking), - cmocka_unit_test(test__f_fss_set_quote_increase_by__parameter_checking), - cmocka_unit_test(test__f_fss_set_quote_resize__parameter_checking), - - cmocka_unit_test(test__f_fss_set_quotes_adjust__parameter_checking), - cmocka_unit_test(test__f_fss_set_quotes_decimate_by__parameter_checking), - cmocka_unit_test(test__f_fss_set_quotes_decrease_by__parameter_checking), - cmocka_unit_test(test__f_fss_set_quotes_increase__parameter_checking), - cmocka_unit_test(test__f_fss_set_quotes_increase_by__parameter_checking), - cmocka_unit_test(test__f_fss_set_quotes_resize__parameter_checking), - - cmocka_unit_test(test__f_fss_sets_adjust__parameter_checking), - cmocka_unit_test(test__f_fss_sets_decimate_by__parameter_checking), - cmocka_unit_test(test__f_fss_sets_decrease_by__parameter_checking), - cmocka_unit_test(test__f_fss_sets_increase__parameter_checking), - cmocka_unit_test(test__f_fss_sets_increase_by__parameter_checking), - cmocka_unit_test(test__f_fss_sets_resize__parameter_checking), - - cmocka_unit_test(test__f_fss_simple_packet_ranges_adjust__parameter_checking), - cmocka_unit_test(test__f_fss_simple_packet_ranges_decimate_by__parameter_checking), - cmocka_unit_test(test__f_fss_simple_packet_ranges_decrease_by__parameter_checking), - cmocka_unit_test(test__f_fss_simple_packet_ranges_increase__parameter_checking), - cmocka_unit_test(test__f_fss_simple_packet_ranges_increase_by__parameter_checking), - cmocka_unit_test(test__f_fss_simple_packet_ranges_resize__parameter_checking), #endif // _di_level_0_parameter_checking_ }; diff --git a/level_0/f_fss/tests/unit/c/test-fss.h b/level_0/f_fss/tests/unit/c/test-fss.h index 4943df7..d676ed1 100644 --- a/level_0/f_fss/tests/unit/c/test-fss.h +++ b/level_0/f_fss/tests/unit/c/test-fss.h @@ -36,67 +36,27 @@ #include "test-fss-is_graph.h" #include "test-fss-is_space.h" #include "test-fss-is_zero_width.h" -#include "test-fss-items_adjust.h" -#include "test-fss-items_decimate_by.h" -#include "test-fss-items_decrease_by.h" -#include "test-fss-items_increase.h" -#include "test-fss-items_increase_by.h" -#include "test-fss-items_resize.h" -#include "test-fss-named_adjust.h" -#include "test-fss-named_decimate_by.h" -#include "test-fss-named_decrease_by.h" -#include "test-fss-named_increase.h" -#include "test-fss-named_increase_by.h" -#include "test-fss-named_resize.h" -#include "test-fss-nameds_adjust.h" -#include "test-fss-nameds_decimate_by.h" -#include "test-fss-nameds_decrease_by.h" -#include "test-fss-nameds_increase.h" -#include "test-fss-nameds_increase_by.h" -#include "test-fss-nameds_resize.h" -#include "test-fss-nest_adjust.h" -#include "test-fss-nest_decimate_by.h" -#include "test-fss-nest_decrease_by.h" -#include "test-fss-nest_increase.h" -#include "test-fss-nest_increase_by.h" -#include "test-fss-nest_resize.h" -#include "test-fss-nests_adjust.h" -#include "test-fss-nests_decimate_by.h" -#include "test-fss-nests_decrease_by.h" -#include "test-fss-nests_increase.h" -#include "test-fss-nests_increase_by.h" -#include "test-fss-nests_resize.h" +//#include "test-fss-items_destroy_callback.h" +//#include "test-fss-items_delete_callback.h" +//#include "test-fss-named_destroy_callback.h" +//#include "test-fss-named_delete_callback.h" +//#include "test-fss-nameds_destroy_callback.h" +//#include "test-fss-nameds_delete_callback.h" +//#include "test-fss-nest_destroy_callback.h" +//#include "test-fss-nest_delete_callback.h" +//#include "test-fss-nests_destroy_callback.h" +//#include "test-fss-nests_delete_callback.h" #include "test-fss-seek_to_eol.h" -#include "test-fss-set_adjust.h" -#include "test-fss-set_decimate_by.h" -#include "test-fss-set_decrease_by.h" -#include "test-fss-set_increase.h" -#include "test-fss-set_increase_by.h" -#include "test-fss-set_resize.h" -#include "test-fss-set_quote_adjust.h" -#include "test-fss-set_quote_decimate_by.h" -#include "test-fss-set_quote_decrease_by.h" -#include "test-fss-set_quote_increase.h" -#include "test-fss-set_quote_increase_by.h" -#include "test-fss-set_quote_resize.h" -#include "test-fss-set_quotes_adjust.h" -#include "test-fss-set_quotes_decimate_by.h" -#include "test-fss-set_quotes_decrease_by.h" -#include "test-fss-set_quotes_increase.h" -#include "test-fss-set_quotes_increase_by.h" -#include "test-fss-set_quotes_resize.h" -#include "test-fss-sets_adjust.h" -#include "test-fss-sets_decimate_by.h" -#include "test-fss-sets_decrease_by.h" -#include "test-fss-sets_increase.h" -#include "test-fss-sets_increase_by.h" -#include "test-fss-sets_resize.h" -#include "test-fss-simple_packet_ranges_adjust.h" -#include "test-fss-simple_packet_ranges_decimate_by.h" -#include "test-fss-simple_packet_ranges_decrease_by.h" -#include "test-fss-simple_packet_ranges_increase.h" -#include "test-fss-simple_packet_ranges_increase_by.h" -#include "test-fss-simple_packet_ranges_resize.h" +//#include "test-fss-set_destroy_callback.h" +//#include "test-fss-set_delete_callback.h" +//#include "test-fss-set_quote_destroy_callback.h" +//#include "test-fss-set_quote_delete_callback.h" +//#include "test-fss-set_quotes_destroy_callback.h" +//#include "test-fss-set_quotes_delete_callback.h" +//#include "test-fss-sets_destroy_callback.h" +//#include "test-fss-sets_delete_callback.h" +//#include "test-fss-simple_packet_ranges_destroy_callback.h" +//#include "test-fss-simple_packet_ranges_delete_callback.h" #include "test-fss-skip_past_delimit.h" #include "test-fss-skip_past_space.h" diff --git a/level_0/f_iki/c/iki/data.c b/level_0/f_iki/c/iki/data.c index ee8df0a..d4d98ac 100644 --- a/level_0/f_iki/c/iki/data.c +++ b/level_0/f_iki/c/iki/data.c @@ -12,17 +12,19 @@ extern "C" { if (!data) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - f_status_t status = f_string_ranges_resize(0, &data->content); - if (F_status_is_error(status)) return status; + { + f_status_t status = f_string_ranges_resize(0, &data->content); + if (F_status_is_error(status)) return status; - status = f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &data->delimits.array, &data->delimits.used, &data->delimits.size); - if (F_status_is_error(status)) return status; + status = f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &data->delimits.array, &data->delimits.used, &data->delimits.size); + if (F_status_is_error(status)) return status; - status = f_string_ranges_resize(0, &data->variable); - if (F_status_is_error(status)) return status; + status = f_string_ranges_resize(0, &data->variable); + if (F_status_is_error(status)) return status; - status = f_string_ranges_resize(0, &data->vocabulary); - if (F_status_is_error(status)) return status; + status = f_string_ranges_resize(0, &data->vocabulary); + if (F_status_is_error(status)) return status; + } return F_none; } @@ -34,48 +36,23 @@ extern "C" { if (!data) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - f_status_t status = f_string_ranges_adjust(0, &data->content); - if (F_status_is_error(status)) return status; - - status = f_memory_array_adjust(0, sizeof(f_number_unsigned_t), (void **) &data->delimits.array, &data->delimits.used, &data->delimits.size); - if (F_status_is_error(status)) return status; - - status = f_string_ranges_adjust(0, &data->variable); - if (F_status_is_error(status)) return status; - - status = f_string_ranges_adjust(0, &data->vocabulary); - if (F_status_is_error(status)) return status; - - return F_none; - } -#endif // _di_f_iki_data_destroy_ - -#ifndef _di_f_iki_datas_adjust_callback_ - f_status_t f_iki_datas_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { - { - f_iki_datas_t * const array = (f_iki_datas_t *) void_array; - f_status_t status = F_none; - - for (f_number_unsigned_t i = start; i < stop; ++i) { - - status = f_string_ranges_adjust(0, &array->array[i].content); - if (F_status_is_error(status)) return status; + f_status_t status = f_string_ranges_adjust(0, &data->content); + if (F_status_is_error(status)) return status; - status = f_memory_array_adjust(0, sizeof(f_number_unsigned_t), (void **) &array->array[i].delimits.array, &array->array[i].delimits.used, &array->array[i].delimits.size); - if (F_status_is_error(status)) return status; + status = f_memory_array_adjust(0, sizeof(f_number_unsigned_t), (void **) &data->delimits.array, &data->delimits.used, &data->delimits.size); + if (F_status_is_error(status)) return status; - status = f_string_ranges_adjust(0, &array->array[i].variable); - if (F_status_is_error(status)) return status; + status = f_string_ranges_adjust(0, &data->variable); + if (F_status_is_error(status)) return status; - status = f_string_ranges_adjust(0, &array->array[i].vocabulary); - if (F_status_is_error(status)) return status; - } // for + status = f_string_ranges_adjust(0, &data->vocabulary); + if (F_status_is_error(status)) return status; } return F_none; } -#endif // _di_f_iki_datas_adjust_callback_ +#endif // _di_f_iki_data_destroy_ #ifndef _di_f_iki_datas_append_ f_status_t f_iki_datas_append(const f_iki_data_t source, f_iki_datas_t *destination) { @@ -132,32 +109,59 @@ extern "C" { } #endif // _di_f_iki_datas_append_all_ -#ifndef _di_f_iki_datas_resize_callback_ - f_status_t f_iki_datas_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_iki_datas_delete_callback_ + f_status_t f_iki_datas_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { - f_iki_datas_t * const array = (f_iki_datas_t *) void_array; + f_iki_data_t * const array = (f_iki_data_t *) void_array; + f_status_t status = F_none; + + for (f_number_unsigned_t i = start; i < stop; ++i) { + + status = f_string_ranges_resize(0, &array[i].content); + if (F_status_is_error(status)) return status; + + status = f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &array[i].delimits.array, &array[i].delimits.used, &array[i].delimits.size); + if (F_status_is_error(status)) return status; + + status = f_string_ranges_resize(0, &array[i].variable); + if (F_status_is_error(status)) return status; + + status = f_string_ranges_resize(0, &array[i].vocabulary); + if (F_status_is_error(status)) return status; + } // for + } + + return F_none; + } +#endif // _di_f_iki_datas_delete_callback_ + +#ifndef _di_f_iki_datas_destroy_callback_ + f_status_t f_iki_datas_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { + + { + f_iki_data_t * const array = (f_iki_data_t *) void_array; f_status_t status = F_none; for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_string_ranges_resize(0, &array->array[i].content); + status = f_string_ranges_adjust(0, &array[i].content); if (F_status_is_error(status)) return status; - status = f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &array->array[i].delimits.array, &array->array[i].delimits.used, &array->array[i].delimits.size); + status = f_memory_array_adjust(0, sizeof(f_number_unsigned_t), (void **) &array[i].delimits.array, &array[i].delimits.used, &array[i].delimits.size); if (F_status_is_error(status)) return status; - status = f_string_ranges_resize(0, &array->array[i].variable); + status = f_string_ranges_adjust(0, &array[i].variable); if (F_status_is_error(status)) return status; - status = f_string_ranges_resize(0, &array->array[i].vocabulary); + status = f_string_ranges_adjust(0, &array[i].vocabulary); if (F_status_is_error(status)) return status; } // for } return F_none; } -#endif // _di_f_iki_datas_resize_callback_ +#endif // _di_f_iki_datas_destroy_callback_ #ifndef _di_f_iki_datass_append_ f_status_t f_iki_datass_append(const f_iki_datas_t source, f_iki_datass_t *destination) { @@ -204,6 +208,78 @@ extern "C" { } #endif // _di_f_iki_datass_append_all_ +#ifndef _di_f_iki_datass_delete_callback_ + f_status_t f_iki_datass_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { + + { + f_iki_datas_t * const array = (f_iki_datas_t *) void_array; + f_status_t status = F_none; + f_number_unsigned_t j = 0; + + for (f_number_unsigned_t i = start; i < stop; ++i) { + + for (j = 0; j < array[i].size; ++j) { + + status = f_string_ranges_resize(0, &array[i].array[j].content); + if (F_status_is_error(status)) return status; + + status = f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &array[i].array[j].delimits.array, &array[i].array[j].delimits.used, &array[i].array[j].delimits.size); + if (F_status_is_error(status)) return status; + + status = f_string_ranges_resize(0, &array[i].array[j].variable); + if (F_status_is_error(status)) return status; + + status = f_string_ranges_resize(0, &array[i].array[j].vocabulary); + if (F_status_is_error(status)) return status; + } // for + + if (array[i].size) { + status = f_memory_array_resize(0, sizeof(f_iki_data_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } + } // for + } + + return F_none; + } +#endif // _di_f_iki_datass_delete_callback_ + +#ifndef _di_f_iki_datass_destroy_callback_ + f_status_t f_iki_datass_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { + + { + f_iki_datas_t * const array = (f_iki_datas_t *) void_array; + f_status_t status = F_none; + f_number_unsigned_t j = 0; + + for (f_number_unsigned_t i = start; i < stop; ++i) { + + for (j = 0; j < array[i].size; ++j) { + + status = f_string_ranges_adjust(0, &array[i].array[j].content); + if (F_status_is_error(status)) return status; + + status = f_memory_array_adjust(0, sizeof(f_number_unsigned_t), (void **) &array[i].array[j].delimits.array, &array[i].array[j].delimits.used, &array[i].array[j].delimits.size); + if (F_status_is_error(status)) return status; + + status = f_string_ranges_adjust(0, &array[i].array[j].variable); + if (F_status_is_error(status)) return status; + + status = f_string_ranges_adjust(0, &array[i].array[j].vocabulary); + if (F_status_is_error(status)) return status; + } // for + + if (array[i].size) { + status = f_memory_array_adjust(0, sizeof(f_iki_data_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } + } // for + } + + return F_none; + } +#endif // _di_f_iki_datass_destroy_callback_ + #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_iki/c/iki/data.h b/level_0/f_iki/c/iki/data.h index d99891b..d53cf47 100644 --- a/level_0/f_iki/c/iki/data.h +++ b/level_0/f_iki/c/iki/data.h @@ -59,33 +59,6 @@ extern "C" { #endif // _di_f_iki_data_destroy_ /** - * A callback intended to be passed to f_memory_arrays_adjust() for an f_iki_datass_t structure. - * - * This does not do parameter checking. - * - * @param start - * The inclusive start position in the array to start deleting. - * @param stop - * The exclusive stop position in the array to stop deleting. - * @param array - * The array structure to delete all values of. - * Must not be NULL. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_adjust(). - * - * @see f_memory_array_adjust() - * @see f_memory_arrays_adjust() - */ -#ifndef _di_f_iki_datas_adjust_callback_ - extern f_status_t f_iki_datas_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_iki_datas_adjust_callback_ - -/** * Append the single source iki_data onto the destination. * * @param source @@ -138,7 +111,9 @@ extern "C" { #endif // _di_f_iki_datas_append_all_ /** - * A callback intended to be passed to f_memory_arrays_resize() for an f_iki_datass_t structure. + * A callback intended to be passed to f_memory_arrays_resize() for an f_iki_datas_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. * * This does not do parameter checking. * @@ -160,9 +135,38 @@ extern "C" { * @see f_memory_array_resize() * @see f_memory_arrays_resize() */ -#ifndef _di_f_iki_datas_resize_callback_ - extern f_status_t f_iki_datas_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_iki_datas_resize_callback_ +#ifndef _di_f_iki_datas_delete_callback_ + extern f_status_t f_iki_datas_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_iki_datas_delete_callback_ + +/** + * A callback intended to be passed to f_memory_arrays_adjust() for an f_iki_datas_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. + * + * This does not do parameter checking. + * + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_array_adjust(). + * + * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() + */ +#ifndef _di_f_iki_datas_destroy_callback_ + extern f_status_t f_iki_datas_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_iki_datas_destroy_callback_ /** * Append the single source iki_datas onto the destination. @@ -216,6 +220,64 @@ extern "C" { extern f_status_t f_iki_datass_append_all(const f_iki_datass_t source, f_iki_datass_t *destination); #endif // _di_f_iki_datass_append_all_ +/** + * A callback intended to be passed to f_memory_arrays_resize() for an f_iki_datass_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. + * + * This does not do parameter checking. + * + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_array_resize(). + * + * @see f_memory_array_resize() + * @see f_memory_arrays_resize() + */ +#ifndef _di_f_iki_datass_delete_callback_ + extern f_status_t f_iki_datass_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_iki_datass_delete_callback_ + +/** + * A callback intended to be passed to f_memory_arrays_adjust() for an f_iki_datass_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. + * + * This does not do parameter checking. + * + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_array_adjust(). + * + * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() + */ +#ifndef _di_f_iki_datass_destroy_callback_ + extern f_status_t f_iki_datass_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_iki_datass_destroy_callback_ + #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_iki/data/build/settings-tests b/level_0/f_iki/data/build/settings-tests index ad630d2..b964202 100644 --- a/level_0/f_iki/data/build/settings-tests +++ b/level_0/f_iki/data/build/settings-tests @@ -26,7 +26,7 @@ build_libraries -lc -lcmocka build_libraries-individual -lf_memory -lf_string -lf_type_array -lf_utf -lf_iki build_sources_program test-iki-content_is.c test-iki-content_partial_is.c test-iki-object_is.c test-iki-object_partial_is.c test-iki-read.c -build_sources_program test-iki-datas_adjust_callback.c test-iki-datas_append.c test-iki-datas_append_all.c test-iki-datas_resize_callback.c test-iki-datass_append.c test-iki-datass_append_all.c +build_sources_program test-iki-datas_destroy_callback.c test-iki-datas_append.c test-iki-datas_append_all.c test-iki-datas_delete_callback.c test-iki-datass_append.c test-iki-datass_append_all.c build_sources_program test-iki.c build_script no diff --git a/level_0/f_iki/tests/unit/c/test-iki-datas_adjust_callback.h b/level_0/f_iki/tests/unit/c/test-iki-datas_adjust_callback.h deleted file mode 100644 index ac7c857..0000000 --- a/level_0/f_iki/tests/unit/c/test-iki-datas_adjust_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: IKI - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_iki__datas_adjust_callback -#define _TEST__F_iki__datas_adjust_callback - -/** - * Test that the function fails. - * - * @see f_iki_datas_adjust_callback() - */ -extern void test__f_iki_datas_adjust_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_iki_datas_adjust_callback() - */ -extern void test__f_iki_datas_adjust_callback__works(void **state); - -#endif // _TEST__F_iki__datas_adjust_callback diff --git a/level_0/f_iki/tests/unit/c/test-iki-datas_resize_callback.c b/level_0/f_iki/tests/unit/c/test-iki-datas_delete_callback.c similarity index 84% rename from level_0/f_iki/tests/unit/c/test-iki-datas_resize_callback.c rename to level_0/f_iki/tests/unit/c/test-iki-datas_delete_callback.c index 5cf1459..3b6c6ca 100644 --- a/level_0/f_iki/tests/unit/c/test-iki-datas_resize_callback.c +++ b/level_0/f_iki/tests/unit/c/test-iki-datas_delete_callback.c @@ -1,11 +1,11 @@ #include "test-iki.h" -#include "test-iki-datas_resize_callback.h" +#include "test-iki-datas_delete_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_iki_datas_resize_callback__fails(void **state) { +void test__f_iki_datas_delete_callback__fails(void **state) { mock_unwrap = 0; @@ -18,7 +18,7 @@ void test__f_iki_datas_resize_callback__fails(void **state) { will_return(__wrap_f_string_ranges_resize, true); will_return(__wrap_f_string_ranges_resize, F_status_set_error(F_failure)); - const f_status_t status = f_iki_datas_resize_callback(0, 1, (void *) datass_array); + const f_status_t status = f_iki_datas_delete_callback(0, 1, (void *) datass_array); assert_int_equal(status, F_status_set_error(F_failure)); } @@ -30,7 +30,7 @@ void test__f_iki_datas_resize_callback__fails(void **state) { will_return(__wrap_f_memory_array_resize, true); will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); - const f_status_t status = f_iki_datas_resize_callback(0, 1, (void *) datass_array); + const f_status_t status = f_iki_datas_delete_callback(0, 1, (void *) datass_array); assert_int_equal(status, F_status_set_error(F_failure)); } @@ -45,7 +45,7 @@ void test__f_iki_datas_resize_callback__fails(void **state) { will_return(__wrap_f_string_ranges_resize, true); will_return(__wrap_f_string_ranges_resize, F_status_set_error(F_failure)); - const f_status_t status = f_iki_datas_resize_callback(0, 1, (void *) datass_array); + const f_status_t status = f_iki_datas_delete_callback(0, 1, (void *) datass_array); assert_int_equal(status, F_status_set_error(F_failure)); } @@ -63,13 +63,13 @@ void test__f_iki_datas_resize_callback__fails(void **state) { will_return(__wrap_f_string_ranges_resize, true); will_return(__wrap_f_string_ranges_resize, F_status_set_error(F_failure)); - const f_status_t status = f_iki_datas_resize_callback(0, 1, (void *) datass_array); + const f_status_t status = f_iki_datas_delete_callback(0, 1, (void *) datass_array); assert_int_equal(status, F_status_set_error(F_failure)); } } -void test__f_iki_datas_resize_callback__works(void **state) { +void test__f_iki_datas_delete_callback__works(void **state) { mock_unwrap = 0; @@ -92,7 +92,7 @@ void test__f_iki_datas_resize_callback__works(void **state) { will_return(__wrap_f_string_ranges_resize, false); will_return(__wrap_f_string_ranges_resize, F_none); - const f_status_t status = f_iki_datas_resize_callback(0, length, (void *) datass_array); + const f_status_t status = f_iki_datas_delete_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_iki/tests/unit/c/test-iki-datas_delete_callback.h b/level_0/f_iki/tests/unit/c/test-iki-datas_delete_callback.h new file mode 100644 index 0000000..d32621a --- /dev/null +++ b/level_0/f_iki/tests/unit/c/test-iki-datas_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: IKI + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_iki__datas_delete_callback +#define _TEST__F_iki__datas_delete_callback + +/** + * Test that the function fails. + * + * @see f_iki_datas_delete_callback() + */ +extern void test__f_iki_datas_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_iki_datas_delete_callback() + */ +extern void test__f_iki_datas_delete_callback__works(void **state); + +#endif // _TEST__F_iki__datas_delete_callback diff --git a/level_0/f_iki/tests/unit/c/test-iki-datas_adjust_callback.c b/level_0/f_iki/tests/unit/c/test-iki-datas_destroy_callback.c similarity index 80% rename from level_0/f_iki/tests/unit/c/test-iki-datas_adjust_callback.c rename to level_0/f_iki/tests/unit/c/test-iki-datas_destroy_callback.c index 69bce9b..10a86d8 100644 --- a/level_0/f_iki/tests/unit/c/test-iki-datas_adjust_callback.c +++ b/level_0/f_iki/tests/unit/c/test-iki-datas_destroy_callback.c @@ -1,11 +1,11 @@ #include "test-iki.h" -#include "test-iki-datas_adjust_callback.h" +#include "test-iki-datas_destroy_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_iki_datas_adjust_callback__fails(void **state) { +void test__f_iki_datas_destroy_callback__fails(void **state) { mock_unwrap = 0; @@ -18,7 +18,7 @@ void test__f_iki_datas_adjust_callback__fails(void **state) { will_return(__wrap_f_string_ranges_adjust, true); will_return(__wrap_f_string_ranges_adjust, F_status_set_error(F_failure)); - const f_status_t status = f_iki_datas_adjust_callback(0, 1, (void *) datass_array); + const f_status_t status = f_iki_datas_destroy_callback(0, 1, (void *) datass_array); assert_int_equal(status, F_status_set_error(F_failure)); } @@ -30,7 +30,7 @@ void test__f_iki_datas_adjust_callback__fails(void **state) { will_return(__wrap_f_memory_array_adjust, true); will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); - const f_status_t status = f_iki_datas_adjust_callback(0, 1, (void *) datass_array); + const f_status_t status = f_iki_datas_destroy_callback(0, 1, (void *) datass_array); assert_int_equal(status, F_status_set_error(F_failure)); } @@ -45,7 +45,7 @@ void test__f_iki_datas_adjust_callback__fails(void **state) { will_return(__wrap_f_string_ranges_adjust, true); will_return(__wrap_f_string_ranges_adjust, F_status_set_error(F_failure)); - const f_status_t status = f_iki_datas_adjust_callback(0, 1, (void *) datass_array); + const f_status_t status = f_iki_datas_destroy_callback(0, 1, (void *) datass_array); assert_int_equal(status, F_status_set_error(F_failure)); } @@ -63,13 +63,13 @@ void test__f_iki_datas_adjust_callback__fails(void **state) { will_return(__wrap_f_string_ranges_adjust, true); will_return(__wrap_f_string_ranges_adjust, F_status_set_error(F_failure)); - const f_status_t status = f_iki_datas_adjust_callback(0, 1, (void *) datass_array); + const f_status_t status = f_iki_datas_destroy_callback(0, 1, (void *) datass_array); assert_int_equal(status, F_status_set_error(F_failure)); } } -void test__f_iki_datas_adjust_callback__works(void **state) { +void test__f_iki_datas_destroy_callback__works(void **state) { mock_unwrap = 0; @@ -92,7 +92,7 @@ void test__f_iki_datas_adjust_callback__works(void **state) { will_return(__wrap_f_string_ranges_adjust, false); will_return(__wrap_f_string_ranges_adjust, F_none); - const f_status_t status = f_iki_datas_adjust_callback(0, length, (void *) datass_array); + const f_status_t status = f_iki_datas_destroy_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_iki/tests/unit/c/test-iki-datas_destroy_callback.h b/level_0/f_iki/tests/unit/c/test-iki-datas_destroy_callback.h new file mode 100644 index 0000000..bb5bef5 --- /dev/null +++ b/level_0/f_iki/tests/unit/c/test-iki-datas_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: IKI + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_iki__datas_destroy_callback +#define _TEST__F_iki__datas_destroy_callback + +/** + * Test that the function fails. + * + * @see f_iki_datas_destroy_callback() + */ +extern void test__f_iki_datas_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_iki_datas_destroy_callback() + */ +extern void test__f_iki_datas_destroy_callback__works(void **state); + +#endif // _TEST__F_iki__datas_destroy_callback diff --git a/level_0/f_iki/tests/unit/c/test-iki-datas_resize_callback.h b/level_0/f_iki/tests/unit/c/test-iki-datas_resize_callback.h deleted file mode 100644 index 1d846bb..0000000 --- a/level_0/f_iki/tests/unit/c/test-iki-datas_resize_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: IKI - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_iki__datas_resize_callback -#define _TEST__F_iki__datas_resize_callback - -/** - * Test that the function fails. - * - * @see f_iki_datas_resize_callback() - */ -extern void test__f_iki_datas_resize_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_iki_datas_resize_callback() - */ -extern void test__f_iki_datas_resize_callback__works(void **state); - -#endif // _TEST__F_iki__datas_resize_callback diff --git a/level_0/f_iki/tests/unit/c/test-iki-datass_append_all.c b/level_0/f_iki/tests/unit/c/test-iki-datass_append_all.c index 1dca0c5..c051c8c 100644 --- a/level_0/f_iki/tests/unit/c/test-iki-datass_append_all.c +++ b/level_0/f_iki/tests/unit/c/test-iki-datass_append_all.c @@ -14,7 +14,7 @@ void test__f_iki_datass_append_all__works(void **state) { f_iki_datass_t destination = f_iki_datass_t_initialize; { - f_status_t status = f_memory_arrays_resize(length_outer, sizeof(f_iki_data_t), (void **) &source.array, &source.used, &source.size, &f_iki_datas_resize_callback); + f_status_t status = f_memory_arrays_resize(length_outer, sizeof(f_iki_data_t), (void **) &source.array, &source.used, &source.size, &f_iki_datas_delete_callback); assert_int_equal(status, F_none); assert_int_equal(source.size, length_outer); @@ -147,7 +147,7 @@ void test__f_iki_datass_append_all__returns_data_not(void **state) { f_iki_datass_t destination = f_iki_datass_t_initialize; { - const f_status_t status = f_memory_arrays_resize(length, sizeof(f_iki_data_t), (void **) &source.array, &source.used, &source.size, &f_iki_datas_resize_callback); + const f_status_t status = f_memory_arrays_resize(length, sizeof(f_iki_data_t), (void **) &source.array, &source.used, &source.size, &f_iki_datas_delete_callback); assert_int_equal(status, F_none); assert_int_equal(source.used, 0); diff --git a/level_0/f_iki/tests/unit/c/test-iki.c b/level_0/f_iki/tests/unit/c/test-iki.c index 3c12026..03c0615 100644 --- a/level_0/f_iki/tests/unit/c/test-iki.c +++ b/level_0/f_iki/tests/unit/c/test-iki.c @@ -29,11 +29,11 @@ int main(void) { cmocka_unit_test(test__f_iki_content_partial_is__returns_false), cmocka_unit_test(test__f_iki_content_partial_is__returns_true), - cmocka_unit_test(test__f_iki_datas_adjust_callback__fails), - cmocka_unit_test(test__f_iki_datas_resize_callback__fails), + cmocka_unit_test(test__f_iki_datas_destroy_callback__fails), + cmocka_unit_test(test__f_iki_datas_delete_callback__fails), - cmocka_unit_test(test__f_iki_datas_adjust_callback__works), - cmocka_unit_test(test__f_iki_datas_resize_callback__works), + cmocka_unit_test(test__f_iki_datas_destroy_callback__works), + cmocka_unit_test(test__f_iki_datas_delete_callback__works), cmocka_unit_test(test__f_iki_datas_append__works), cmocka_unit_test(test__f_iki_datas_append_all__works), @@ -63,8 +63,8 @@ int main(void) { cmocka_unit_test(test__f_iki_content_is__parameter_checking), cmocka_unit_test(test__f_iki_content_partial_is__parameter_checking), - // f_iki_datas_adjust_callback() doesn't use parameter checking. - // f_iki_datas_resize_callback() doesn't use parameter checking. + // f_iki_datas_destroy_callback() doesn't use parameter checking. + // f_iki_datas_delete_callback() doesn't use parameter checking. cmocka_unit_test(test__f_iki_datas_append__parameter_checking), cmocka_unit_test(test__f_iki_datas_append_all__parameter_checking), diff --git a/level_0/f_iki/tests/unit/c/test-iki.h b/level_0/f_iki/tests/unit/c/test-iki.h index b1a7267..92827c5 100644 --- a/level_0/f_iki/tests/unit/c/test-iki.h +++ b/level_0/f_iki/tests/unit/c/test-iki.h @@ -28,10 +28,10 @@ // Test includes. #include "test-iki-content_is.h" #include "test-iki-content_partial_is.h" -#include "test-iki-datas_adjust_callback.h" +#include "test-iki-datas_destroy_callback.h" #include "test-iki-datas_append.h" #include "test-iki-datas_append_all.h" -#include "test-iki-datas_resize_callback.h" +#include "test-iki-datas_delete_callback.h" #include "test-iki-datass_append.h" #include "test-iki-datass_append_all.h" #include "test-iki-object_is.h" diff --git a/level_0/f_memory/c/memory/arrays.h b/level_0/f_memory/c/memory/arrays.h index cd4a546..c9c41e9 100644 --- a/level_0/f_memory/c/memory/arrays.h +++ b/level_0/f_memory/c/memory/arrays.h @@ -39,6 +39,7 @@ extern "C" { * @param callback * A callback to call on each array value when reducing the length of the array. * This callback is expected to know the appropriate type and will cast the structure parameter to the appropriate type. + * This callback is intended to be used for deleting data and does not get called when adding new data. * * This is only called when the requested length is less than the given size. * @@ -84,6 +85,7 @@ extern "C" { * @param callback * A callback to call on each array value when reducing the length of the array. * This callback is expected to know the appropriate type and will cast the structure parameter to the appropriate type. + * This callback is intended to be used for deleting data and does not get called when adding new data. * * This is only called when the requested length is less than the given size. * diff --git a/level_0/f_memory/c/memory/arrayss.c b/level_0/f_memory/c/memory/arrayss.c new file mode 100644 index 0000000..3a433d8 --- /dev/null +++ b/level_0/f_memory/c/memory/arrayss.c @@ -0,0 +1,52 @@ +#include "../memory.h" +#include "private-array.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_f_memory_arrayss_adjust_ + f_status_t f_memory_arrayss_adjust(const f_number_unsigned_t length, const size_t width, void ** const array, f_number_unsigned_t * const used, f_number_unsigned_t * const size, f_status_t (*destroy_callback)(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array)) { + #ifndef _di_level_0_parameter_checking_ + if (!width) return F_status_set_error(F_parameter); + if (!array) return F_status_set_error(F_parameter); + if (!used) return F_status_set_error(F_parameter); + if (!size) return F_status_set_error(F_parameter); + if (!destroy_callback) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (length > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); + + if (length < *size) { + const f_status_t status = destroy_callback(length, *size, *array); + if (F_status_is_error(status)) return status; + } + + return private_f_memory_array_adjust(length, width, array, used, size); + } +#endif // _di_f_memory_arrayss_adjust_ + +#ifndef _di_f_memory_arrayss_resize_ + f_status_t f_memory_arrayss_resize(const f_number_unsigned_t length, const size_t width, void ** const array, f_number_unsigned_t * const used, f_number_unsigned_t * const size, f_status_t (*delete_callback)(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array)) { + #ifndef _di_level_0_parameter_checking_ + if (!width) return F_status_set_error(F_parameter); + if (!array) return F_status_set_error(F_parameter); + if (!used) return F_status_set_error(F_parameter); + if (!size) return F_status_set_error(F_parameter); + if (!delete_callback) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (length > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); + + if (length < *size) { + const f_status_t status = delete_callback(length, *size, *array); + if (F_status_is_error(status)) return status; + } + + return private_f_memory_array_resize(length, width, array, used, size); + } +#endif // _di_f_memory_arrayss_resize_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_memory/c/memory/arrayss.h b/level_0/f_memory/c/memory/arrayss.h new file mode 100644 index 0000000..3007929 --- /dev/null +++ b/level_0/f_memory/c/memory/arrayss.h @@ -0,0 +1,115 @@ +/** + * FLL - Level 0 + * + * Project: Memory + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Defines memory array data. + * + * This is auto-included by memory.h and should not need to be explicitly included. + */ +#ifndef _F_memory_arrayss_h +#define _F_memory_arrayss_h + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Resize the memory array of arrays of arrays. + * + * This function is only useful for structures of the form "{ array, used, size }" where the array is a an array of simple types. + * If the simple type that is "array" requires additional memory manipulation on allocation or de-allocation, then do not use this function. + * + * The inner array can be a more complex structure because the callback is expected to know the type. + * + * @param length + * The new size to use. + * @param width + * The size of the structure represented by array. + * The word "width" is used due to conflicts of already using "length" and "size". + * Must not be 0. + * @param array + * The structure.array to resize. + * @param used + * The structure.used. + * @param size + * The structure.size. + * @param destroy_callback + * A callback to call on each array value when reducing the length of the array. + * This callback is expected to know the appropriate type and will cast the structure parameter to the appropriate type. + * This callback is intended to be used for deleting data and does not get called when adding new data. + * + * This is only called when the requested length is less than the given size. + * + * Callback Parameters: + * - start: The start position in the array to start deleting. + * - stop: The stop in the array to stop deleting. + * - array: The array structure to delete all values of. + * + * Callback Returns: + * The standard status codes similar to this function. + * + * @return + * F_none on success. + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + */ +#ifndef _di_f_memory_arrayss_adjust_ + extern f_status_t f_memory_arrayss_adjust(const f_number_unsigned_t length, const size_t width, void ** const array, f_number_unsigned_t * const used, f_number_unsigned_t * const size, f_status_t (*destroy_callback)(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array)); +#endif // _di_f_memory_arrayss_adjust_ + +/** + * Resize the memory array of arrays of arrays. + * + * This function is only useful for structures of the form "{ array, used, size }" where the array is a an array of simple types. + * If the simple type that is "array" requires additional memory manipulation on allocation or de-allocation, then do not use this function. + * + * The inner array can be a more complex structure because the callback is expected to know the type. + * + * @param length + * The new size to use. + * @param width + * The size of the structure represented by array. + * The word "width" is used due to conflicts of already using "length" and "size". + * Must not be 0. + * @param array + * The structure.array to resize. + * @param used + * The structure.used. + * @param size + * The structure.size. + * @param delete_callback + * A callback to call on each array value when reducing the length of the array. + * This callback is expected to know the appropriate type and will cast the structure parameter to the appropriate type. + * This callback is intended to be used for deleting data and does not get called when adding new data. + * + * This is only called when the requested length is less than the given size. + * + * Callback Parameters: + * - start: The start position in the array to start deleting. + * - stop: The stop in the array to stop deleting. + * - array: The array structure to delete all values of. + * + * Callback Returns: + * The standard status codes similar to this function. + * + * @return + * F_none on success. + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + */ +#ifndef _di_f_memory_arrayss_resize_ + extern f_status_t f_memory_arrayss_resize(const f_number_unsigned_t length, const size_t width, void ** const array, f_number_unsigned_t * const used, f_number_unsigned_t * const size, f_status_t (*delete_callback)(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array)); +#endif // _di_f_memory_arrayss_resize_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _F_memory_arrayss_h diff --git a/level_0/f_memory/data/build/settings b/level_0/f_memory/data/build/settings index df7c054..d65c672 100644 --- a/level_0/f_memory/data/build/settings +++ b/level_0/f_memory/data/build/settings @@ -31,10 +31,10 @@ build_language c build_libraries -lc -build_sources_library memory.c memory/array.c memory/arrays.c +build_sources_library memory.c memory/array.c memory/arrays.c memory/arrayss.c build_sources_library private-memory.c memory/private-array.c -build_sources_headers memory.h memory/array.h memory/arrays.h memory/common.h +build_sources_headers memory.h memory/array.h memory/arrays.h memory/arrayss.h memory/common.h build_script yes build_shared yes diff --git a/level_0/f_memory/data/build/settings-tests b/level_0/f_memory/data/build/settings-tests index 21779e5..acc6a10 100644 --- a/level_0/f_memory/data/build/settings-tests +++ b/level_0/f_memory/data/build/settings-tests @@ -26,6 +26,7 @@ build_libraries-individual -lf_memory build_sources_program test-memory-adjust.c test-memory-delete.c test-memory-destroy.c test-memory-new_aligned.c test-memory-new.c test-memory-resize.c test-memory.c build_sources_program test-memory-array_adjust.c test-memory-array_append.c test-memory-array_append_all.c test-memory-array_decimate_by.c test-memory-array_decrease_by.c test-memory-array_increase.c test-memory-array_increase_by.c test-memory-array_resize.c build_sources_program test-memory-arrays_adjust.c test-memory-arrays_resize.c +build_sources_program test-memory-arrayss_adjust.c test-memory-arrayss_resize.c build_script no build_shared yes diff --git a/level_0/f_memory/tests/unit/c/test-memory.c b/level_0/f_memory/tests/unit/c/test-memory.c index 8636a84..5cc8878 100644 --- a/level_0/f_memory/tests/unit/c/test-memory.c +++ b/level_0/f_memory/tests/unit/c/test-memory.c @@ -44,6 +44,9 @@ int main(void) { cmocka_unit_test(test__f_memory_arrays_adjust__returns_array_too_large), cmocka_unit_test(test__f_memory_arrays_resize__returns_array_too_large), + cmocka_unit_test(test__f_memory_arrayss_adjust__returns_array_too_large), + cmocka_unit_test(test__f_memory_arrayss_resize__returns_array_too_large), + cmocka_unit_test(test__f_memory_array_append_all__returns_data_not), cmocka_unit_test(test__f_memory_array_decimate_by__returns_data_not), cmocka_unit_test(test__f_memory_array_decrease_by__returns_data_not), @@ -62,6 +65,9 @@ int main(void) { cmocka_unit_test(test__f_memory_arrays_adjust__works), cmocka_unit_test(test__f_memory_arrays_resize__works), + cmocka_unit_test(test__f_memory_arrayss_adjust__works), + cmocka_unit_test(test__f_memory_arrayss_resize__works), + #ifndef _di_level_0_parameter_checking_ cmocka_unit_test(test__f_memory_adjust__parameter_checking), cmocka_unit_test(test__f_memory_delete__parameter_checking), @@ -80,6 +86,9 @@ int main(void) { cmocka_unit_test(test__f_memory_arrays_adjust__parameter_checking), cmocka_unit_test(test__f_memory_arrays_resize__parameter_checking), + + cmocka_unit_test(test__f_memory_arrayss_adjust__parameter_checking), + cmocka_unit_test(test__f_memory_arrayss_resize__parameter_checking), #endif // _di_level_0_parameter_checking_ }; diff --git a/level_0/f_memory/tests/unit/c/test-memory.h b/level_0/f_memory/tests/unit/c/test-memory.h index 9958b73..443d946 100644 --- a/level_0/f_memory/tests/unit/c/test-memory.h +++ b/level_0/f_memory/tests/unit/c/test-memory.h @@ -34,6 +34,8 @@ #include "test-memory-array_resize.h" #include "test-memory-arrays_adjust.h" #include "test-memory-arrays_resize.h" +#include "test-memory-arrayss_adjust.h" +#include "test-memory-arrayss_resize.h" #include "test-memory-delete.h" #include "test-memory-destroy.h" #include "test-memory-new.h" @@ -67,6 +69,17 @@ typedef struct { #define test_memory_arrays_t_initialize { 0, 0, 0 } /** + * A structure used for testing the memory arrayss functions. + */ +typedef struct { + test_memory_arrays_t *array; + f_number_unsigned_t used; + f_number_unsigned_t size; +} test_memory_arrayss_t; + +#define test_memory_arrayss_t_initialize { 0, 0, 0 } + +/** * Perform any setup operations. * * @param state diff --git a/level_0/f_thread/c/thread/attribute.c b/level_0/f_thread/c/thread/attribute.c index e368a3c..a1d1f33 100644 --- a/level_0/f_thread/c/thread/attribute.c +++ b/level_0/f_thread/c/thread/attribute.c @@ -5,35 +5,83 @@ extern "C" { #endif -#ifndef _di_f_thread_attributes_adjust_callback_ - f_status_t f_thread_attributes_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_thread_attributes_delete_callback_ + f_status_t f_thread_attributes_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { + + { + f_thread_attribute_t * const array = (f_thread_attribute_t *) void_array; + + for (f_number_unsigned_t i = start; i < stop; ++i) { + if (pthread_attr_destroy(&array[i])) return F_status_set_error(F_failure); + } // for + } + + return F_none; + } +#endif // _di_f_thread_attributes_delete_callback_ + +#ifndef _di_f_thread_attributes_destroy_callback_ + f_status_t f_thread_attributes_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { + + { + f_thread_attribute_t * const array = (f_thread_attribute_t *) void_array; + + for (f_number_unsigned_t i = start; i < stop; ++i) { + if (pthread_attr_destroy(&array[i])) return F_status_set_error(F_failure); + } // for + } + + return F_none; + } +#endif // _di_f_thread_attributes_destroy_callback_ + +#ifndef _di_f_thread_attributess_delete_callback_ + f_status_t f_thread_attributess_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { f_thread_attributes_t * const array = (f_thread_attributes_t *) void_array; + f_number_unsigned_t j = 0; for (f_number_unsigned_t i = start; i < stop; ++i) { - if (pthread_attr_destroy(&array->array[i])) return F_status_set_error(F_failure); + + for (j = 0; j < array[i].size; ++j) { + if (pthread_attr_destroy(&array[i].array[j])) return F_status_set_error(F_failure); + } // for + + if (array[i].size) { + const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_attribute_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } } // for } return F_none; } -#endif // _di_f_thread_attributes_adjust_callback_ +#endif // _di_f_thread_attributess_delete_callback_ -#ifndef _di_f_thread_attributes_resize_callback_ - f_status_t f_thread_attributes_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_thread_attributess_destroy_callback_ + f_status_t f_thread_attributess_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { f_thread_attributes_t * const array = (f_thread_attributes_t *) void_array; + f_number_unsigned_t j = 0; for (f_number_unsigned_t i = start; i < stop; ++i) { - if (pthread_attr_destroy(&array->array[i])) return F_status_set_error(F_failure); + + for (j = 0; j < array[i].size; ++j) { + if (pthread_attr_destroy(&array[i].array[j])) return F_status_set_error(F_failure); + } // for + + if (array[i].size) { + const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_attribute_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } } // for } return F_none; } -#endif // _di_f_thread_attributes_resize_callback_ +#endif // _di_f_thread_attributess_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_thread/c/thread/attribute.h b/level_0/f_thread/c/thread/attribute.h index 1bdad17..28169de 100644 --- a/level_0/f_thread/c/thread/attribute.h +++ b/level_0/f_thread/c/thread/attribute.h @@ -53,7 +53,38 @@ extern "C" { #endif // _di_f_thread_attributes_t_ /** - * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_attributess_t structure. + * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_attributes_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. + * + * This does not do parameter checking. + * + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_array_resize(). + * + * @see f_memory_array_resize() + * @see f_memory_arrays_resize() + */ +#ifndef _di_f_thread_attributes_delete_callback_ + extern f_status_t f_thread_attributes_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_thread_attributes_delete_callback_ + +/** + * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_attributes_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. * * This does not do parameter checking. * @@ -75,13 +106,15 @@ extern "C" { * @see f_memory_array_adjust() * @see f_memory_arrays_adjust() */ -#ifndef _di_f_thread_attributes_adjust_callback_ - extern f_status_t f_thread_attributes_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_thread_attributes_adjust_callback_ +#ifndef _di_f_thread_attributes_destroy_callback_ + extern f_status_t f_thread_attributes_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_thread_attributes_destroy_callback_ /** * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_attributess_t structure. * + * This is only called when shrinking the array and generally should perform deallocations. + * * This does not do parameter checking. * * @param start @@ -102,9 +135,38 @@ extern "C" { * @see f_memory_array_resize() * @see f_memory_arrays_resize() */ -#ifndef _di_f_thread_attributes_resize_callback_ - extern f_status_t f_thread_attributes_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_thread_attributes_resize_callback_ +#ifndef _di_f_thread_attributess_delete_callback_ + extern f_status_t f_thread_attributess_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_thread_attributess_delete_callback_ + +/** + * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_attributess_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. + * + * This does not do parameter checking. + * + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_array_adjust(). + * + * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() + */ +#ifndef _di_f_thread_attributess_destroy_callback_ + extern f_status_t f_thread_attributess_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_thread_attributess_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_thread/c/thread/barrier.c b/level_0/f_thread/c/thread/barrier.c index 6c8d462..3e5b3fa 100644 --- a/level_0/f_thread/c/thread/barrier.c +++ b/level_0/f_thread/c/thread/barrier.c @@ -5,16 +5,16 @@ extern "C" { #endif -#ifndef _di_f_thread_barriers_adjust_callback_ - f_status_t f_thread_barriers_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_thread_barriers_delete_callback_ + f_status_t f_thread_barriers_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { - f_thread_barriers_t * const array = (f_thread_barriers_t *) void_array; + f_thread_barrier_t * const array = (f_thread_barrier_t *) void_array; int error = 0; for (f_number_unsigned_t i = start; i < stop; ++i) { - error = pthread_barrier_destroy(&array->array[i]); + error = pthread_barrier_destroy(&array[i]); if (error) { if (error == EBUSY) return F_status_set_error(F_busy); @@ -27,18 +27,18 @@ extern "C" { return F_none; } -#endif // _di_f_thread_barriers_adjust_callback_ +#endif // _di_f_thread_barriers_delete_callback_ -#ifndef _di_f_thread_barriers_resize_callback_ - f_status_t f_thread_barriers_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_thread_barriers_destroy_callback_ + f_status_t f_thread_barriers_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { - f_thread_barriers_t * const array = (f_thread_barriers_t *) void_array; + f_thread_barrier_t * const array = (f_thread_barrier_t *) void_array; int error = 0; for (f_number_unsigned_t i = start; i < stop; ++i) { - error = pthread_barrier_destroy(&array->array[i]); + error = pthread_barrier_destroy(&array[i]); if (error) { if (error == EBUSY) return F_status_set_error(F_busy); @@ -51,7 +51,73 @@ extern "C" { return F_none; } -#endif // _di_f_thread_barriers_resize_callback_ +#endif // _di_f_thread_barriers_destroy_callback_ + +#ifndef _di_f_thread_barrierss_delete_callback_ + f_status_t f_thread_barrierss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { + + { + f_thread_barriers_t * const array = (f_thread_barriers_t *) void_array; + int error = 0; + f_number_unsigned_t j = 0; + + for (f_number_unsigned_t i = start; i < stop; ++i) { + + for (j = 0; j < array[i].size; ++j) { + + error = pthread_barrier_destroy(&array[i].array[j]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + + if (array[i].size) { + const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_barrier_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } + } // for + } + + return F_none; + } +#endif // _di_f_thread_barrierss_delete_callback_ + +#ifndef _di_f_thread_barrierss_destroy_callback_ + f_status_t f_thread_barrierss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { + + { + f_thread_barriers_t * const array = (f_thread_barriers_t *) void_array; + int error = 0; + f_number_unsigned_t j = 0; + + for (f_number_unsigned_t i = start; i < stop; ++i) { + + for (j = 0; j < array[i].size; ++j) { + + error = pthread_barrier_destroy(&array[i].array[j]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + + if (array[i].size) { + const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_barrier_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } + } // for + } + + return F_none; + } +#endif // _di_f_thread_barrierss_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_thread/c/thread/barrier.h b/level_0/f_thread/c/thread/barrier.h index 5db9f56..1968f0e 100644 --- a/level_0/f_thread/c/thread/barrier.h +++ b/level_0/f_thread/c/thread/barrier.h @@ -52,7 +52,38 @@ extern "C" { #endif // _di_f_thread_barriers_t_ /** - * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_barrierss_t structure. + * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_barriers_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. + * + * This does not do parameter checking. + * + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_array_resize(). + * + * @see f_memory_array_resize() + * @see f_memory_arrays_resize() + */ +#ifndef _di_f_thread_barriers_delete_callback_ + extern f_status_t f_thread_barriers_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_thread_barriers_delete_callback_ + +/** + * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_barriers_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. * * This does not do parameter checking. * @@ -74,13 +105,15 @@ extern "C" { * @see f_memory_array_adjust() * @see f_memory_arrays_adjust() */ -#ifndef _di_f_thread_barriers_adjust_callback_ - extern f_status_t f_thread_barriers_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_thread_barriers_adjust_callback_ +#ifndef _di_f_thread_barriers_destroy_callback_ + extern f_status_t f_thread_barriers_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_thread_barriers_destroy_callback_ /** * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_barrierss_t structure. * + * This is only called when shrinking the array and generally should perform deallocations. + * * This does not do parameter checking. * * @param start @@ -101,9 +134,38 @@ extern "C" { * @see f_memory_array_resize() * @see f_memory_arrays_resize() */ -#ifndef _di_f_thread_barriers_resize_callback_ - extern f_status_t f_thread_barriers_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_thread_barriers_resize_callback_ +#ifndef _di_f_thread_barrierss_delete_callback_ + extern f_status_t f_thread_barrierss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_thread_barrierss_delete_callback_ + +/** + * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_barrierss_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. + * + * This does not do parameter checking. + * + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_array_adjust(). + * + * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() + */ +#ifndef _di_f_thread_barrierss_destroy_callback_ + extern f_status_t f_thread_barrierss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_thread_barrierss_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_thread/c/thread/barrier_attribute.c b/level_0/f_thread/c/thread/barrier_attribute.c index d631255..5af0bae 100644 --- a/level_0/f_thread/c/thread/barrier_attribute.c +++ b/level_0/f_thread/c/thread/barrier_attribute.c @@ -5,35 +5,83 @@ extern "C" { #endif -#ifndef _di_f_thread_barrier_attributes_adjust_callback_ - f_status_t f_thread_barrier_attributes_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_thread_barrier_attributes_delete_callback_ + f_status_t f_thread_barrier_attributes_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { + + { + f_thread_barrier_attribute_t * const array = (f_thread_barrier_attribute_t *) void_array; + + for (f_number_unsigned_t i = start; i < stop; ++i) { + if (pthread_barrierattr_destroy(&array[i])) return F_status_set_error(F_failure); + } // for + } + + return F_none; + } +#endif // _di_f_thread_barrier_attributes_delete_callback_ + +#ifndef _di_f_thread_barrier_attributes_destroy_callback_ + f_status_t f_thread_barrier_attributes_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { + + { + f_thread_barrier_attribute_t * const array = (f_thread_barrier_attribute_t *) void_array; + + for (f_number_unsigned_t i = start; i < stop; ++i) { + if (pthread_barrierattr_destroy(&array[i])) return F_status_set_error(F_failure); + } // for + } + + return F_none; + } +#endif // _di_f_thread_barrier_attributes_destroy_callback_ + +#ifndef _di_f_thread_barrier_attributess_delete_callback_ + f_status_t f_thread_barrier_attributess_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { f_thread_barrier_attributes_t * const array = (f_thread_barrier_attributes_t *) void_array; + f_number_unsigned_t j = 0; for (f_number_unsigned_t i = start; i < stop; ++i) { - if (pthread_barrierattr_destroy(&array->array[i])) return F_status_set_error(F_failure); + + for (j = 0; j < array[i].size; ++j) { + if (pthread_barrierattr_destroy(&array[i].array[j])) return F_status_set_error(F_failure); + } // for + + if (array[i].size) { + const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_barrier_attribute_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } } // for } return F_none; } -#endif // _di_f_thread_barrier_attributes_adjust_callback_ +#endif // _di_f_thread_barrier_attributess_delete_callback_ -#ifndef _di_f_thread_barrier_attributes_resize_callback_ - f_status_t f_thread_barrier_attributes_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_thread_barrier_attributess_destroy_callback_ + f_status_t f_thread_barrier_attributess_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { f_thread_barrier_attributes_t * const array = (f_thread_barrier_attributes_t *) void_array; + f_number_unsigned_t j = 0; for (f_number_unsigned_t i = start; i < stop; ++i) { - if (pthread_barrierattr_destroy(&array->array[i])) return F_status_set_error(F_failure); + + for (j = 0; j < array[i].size; ++j) { + if (pthread_barrierattr_destroy(&array[i].array[j])) return F_status_set_error(F_failure); + } // for + + if (array[i].size) { + const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_barrier_attribute_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } } // for } return F_none; } -#endif // _di_f_thread_barrier_attributes_resize_callback_ +#endif // _di_f_thread_barrier_attributess_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_thread/c/thread/barrier_attribute.h b/level_0/f_thread/c/thread/barrier_attribute.h index ae74d7e..c2fb6d9 100644 --- a/level_0/f_thread/c/thread/barrier_attribute.h +++ b/level_0/f_thread/c/thread/barrier_attribute.h @@ -53,7 +53,38 @@ extern "C" { #endif // _di_f_thread_barrier_attributes_t_ /** - * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_barrier_attributess_t structure. + * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_barrier_attributes_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. + * + * This does not do parameter checking. + * + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_array_resize(). + * + * @see f_memory_array_resize() + * @see f_memory_arrays_resize() + */ +#ifndef _di_f_thread_barrier_attributes_delete_callback_ + extern f_status_t f_thread_barrier_attributes_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_thread_barrier_attributes_delete_callback_ + +/** + * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_barrier_attributes_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. * * This does not do parameter checking. * @@ -75,13 +106,15 @@ extern "C" { * @see f_memory_array_adjust() * @see f_memory_arrays_adjust() */ -#ifndef _di_f_thread_barrier_attributes_adjust_callback_ - extern f_status_t f_thread_barrier_attributes_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_thread_barrier_attributes_adjust_callback_ +#ifndef _di_f_thread_barrier_attributes_destroy_callback_ + extern f_status_t f_thread_barrier_attributes_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_thread_barrier_attributes_destroy_callback_ /** * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_barrier_attributess_t structure. * + * This is only called when shrinking the array and generally should perform deallocations. + * * This does not do parameter checking. * * @param start @@ -102,9 +135,38 @@ extern "C" { * @see f_memory_array_resize() * @see f_memory_arrays_resize() */ -#ifndef _di_f_thread_barrier_attributes_resize_callback_ - extern f_status_t f_thread_barrier_attributes_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_thread_barrier_attributes_resize_callback_ +#ifndef _di_f_thread_barrier_attributess_delete_callback_ + extern f_status_t f_thread_barrier_attributess_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_thread_barrier_attributess_delete_callback_ + +/** + * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_barrier_attributess_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. + * + * This does not do parameter checking. + * + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_array_adjust(). + * + * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() + */ +#ifndef _di_f_thread_barrier_attributess_destroy_callback_ + extern f_status_t f_thread_barrier_attributess_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_thread_barrier_attributess_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_thread/c/thread/condition.c b/level_0/f_thread/c/thread/condition.c index fe9da2b..7292b67 100644 --- a/level_0/f_thread/c/thread/condition.c +++ b/level_0/f_thread/c/thread/condition.c @@ -5,16 +5,16 @@ extern "C" { #endif -#ifndef _di_f_thread_conditions_adjust_callback_ - f_status_t f_thread_conditions_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_thread_conditions_delete_callback_ + f_status_t f_thread_conditions_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { - f_thread_conditions_t * const array = (f_thread_conditions_t *) void_array; + f_thread_condition_t * const array = (f_thread_condition_t *) void_array; int error = 0; for (f_number_unsigned_t i = start; i < stop; ++i) { - error = pthread_cond_destroy(&array->array[i]); + error = pthread_cond_destroy(&array[i]); if (error) { if (error == EBUSY) return F_status_set_error(F_busy); @@ -27,18 +27,18 @@ extern "C" { return F_none; } -#endif // _di_f_thread_conditions_adjust_callback_ +#endif // _di_f_thread_conditions_delete_callback_ -#ifndef _di_f_thread_conditions_resize_callback_ - f_status_t f_thread_conditions_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_thread_conditions_destroy_callback_ + f_status_t f_thread_conditions_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { - f_thread_conditions_t * const array = (f_thread_conditions_t *) void_array; + f_thread_condition_t * const array = (f_thread_condition_t *) void_array; int error = 0; for (f_number_unsigned_t i = start; i < stop; ++i) { - error = pthread_cond_destroy(&array->array[i]); + error = pthread_cond_destroy(&array[i]); if (error) { if (error == EBUSY) return F_status_set_error(F_busy); @@ -51,7 +51,73 @@ extern "C" { return F_none; } -#endif // _di_f_thread_conditions_resize_callback_ +#endif // _di_f_thread_conditions_destroy_callback_ + +#ifndef _di_f_thread_conditionss_delete_callback_ + f_status_t f_thread_conditionss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { + + { + f_thread_conditions_t * const array = (f_thread_conditions_t *) void_array; + int error = 0; + f_number_unsigned_t j = 0; + + for (f_number_unsigned_t i = start; i < stop; ++i) { + + for (j = 0; j < array[i].size; ++j) { + + error = pthread_cond_destroy(&array[i].array[j]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + + if (array[i].size) { + const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_condition_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } + } // for + } + + return F_none; + } +#endif // _di_f_thread_conditionss_delete_callback_ + +#ifndef _di_f_thread_conditionss_destroy_callback_ + f_status_t f_thread_conditionss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { + + { + f_thread_conditions_t * const array = (f_thread_conditions_t *) void_array; + int error = 0; + f_number_unsigned_t j = 0; + + for (f_number_unsigned_t i = start; i < stop; ++i) { + + for (j = 0; j < array[i].size; ++j) { + + error = pthread_cond_destroy(&array[i].array[j]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + + if (array[i].size) { + const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_condition_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } + } // for + } + + return F_none; + } +#endif // _di_f_thread_conditionss_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_thread/c/thread/condition.h b/level_0/f_thread/c/thread/condition.h index e90dc45..c9c5b49 100644 --- a/level_0/f_thread/c/thread/condition.h +++ b/level_0/f_thread/c/thread/condition.h @@ -53,7 +53,38 @@ extern "C" { #endif // _di_f_thread_conditions_t_ /** - * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_conditionss_t structure. + * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_conditions_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. + * + * This does not do parameter checking. + * + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_array_resize(). + * + * @see f_memory_array_resize() + * @see f_memory_arrays_resize() + */ +#ifndef _di_f_thread_conditions_delete_callback_ + extern f_status_t f_thread_conditions_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_thread_conditions_delete_callback_ + +/** + * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_conditions_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. * * This does not do parameter checking. * @@ -75,13 +106,15 @@ extern "C" { * @see f_memory_array_adjust() * @see f_memory_arrays_adjust() */ -#ifndef _di_f_thread_conditions_adjust_callback_ - extern f_status_t f_thread_conditions_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_thread_conditions_adjust_callback_ +#ifndef _di_f_thread_conditions_destroy_callback_ + extern f_status_t f_thread_conditions_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_thread_conditions_destroy_callback_ /** * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_conditionss_t structure. * + * This is only called when shrinking the array and generally should perform deallocations. + * * This does not do parameter checking. * * @param start @@ -102,9 +135,38 @@ extern "C" { * @see f_memory_array_resize() * @see f_memory_arrays_resize() */ -#ifndef _di_f_thread_conditions_resize_callback_ - extern f_status_t f_thread_conditions_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_thread_conditions_resize_callback_ +#ifndef _di_f_thread_conditionss_delete_callback_ + extern f_status_t f_thread_conditionss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_thread_conditionss_delete_callback_ + +/** + * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_conditionss_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. + * + * This does not do parameter checking. + * + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_array_adjust(). + * + * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() + */ +#ifndef _di_f_thread_conditionss_destroy_callback_ + extern f_status_t f_thread_conditionss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_thread_conditionss_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_thread/c/thread/condition_attribute.c b/level_0/f_thread/c/thread/condition_attribute.c index 266b2eb..991462f 100644 --- a/level_0/f_thread/c/thread/condition_attribute.c +++ b/level_0/f_thread/c/thread/condition_attribute.c @@ -5,16 +5,16 @@ extern "C" { #endif -#ifndef _di_f_thread_condition_attributes_adjust_callback_ - f_status_t f_thread_condition_attributes_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_thread_condition_attributes_delete_callback_ + f_status_t f_thread_condition_attributes_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { - f_thread_condition_attributes_t * const array = (f_thread_condition_attributes_t *) void_array; + f_thread_condition_attribute_t * const array = (f_thread_condition_attribute_t *) void_array; int error = 0; for (f_number_unsigned_t i = start; i < stop; ++i) { - error = pthread_condattr_destroy(&array->array[i]); + error = pthread_condattr_destroy(&array[i]); if (error) { if (error == EBUSY) return F_status_set_error(F_busy); @@ -27,18 +27,18 @@ extern "C" { return F_none; } -#endif // _di_f_thread_condition_attributes_adjust_callback_ +#endif // _di_f_thread_condition_attributes_delete_callback_ -#ifndef _di_f_thread_condition_attributes_resize_callback_ - f_status_t f_thread_condition_attributes_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_thread_condition_attributes_destroy_callback_ + f_status_t f_thread_condition_attributes_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { - f_thread_condition_attributes_t * const array = (f_thread_condition_attributes_t *) void_array; + f_thread_condition_attribute_t * const array = (f_thread_condition_attribute_t *) void_array; int error = 0; for (f_number_unsigned_t i = start; i < stop; ++i) { - error = pthread_condattr_destroy(&array->array[i]); + error = pthread_condattr_destroy(&array[i]); if (error) { if (error == EBUSY) return F_status_set_error(F_busy); @@ -51,7 +51,73 @@ extern "C" { return F_none; } -#endif // _di_f_thread_condition_attributes_resize_callback_ +#endif // _di_f_thread_condition_attributes_destroy_callback_ + +#ifndef _di_f_thread_condition_attributess_delete_callback_ + f_status_t f_thread_condition_attributess_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { + + { + f_thread_condition_attributes_t * const array = (f_thread_condition_attributes_t *) void_array; + int error = 0; + f_number_unsigned_t j = 0; + + for (f_number_unsigned_t i = start; i < stop; ++i) { + + for (j = 0; j < array[i].size; ++j) { + + error = pthread_condattr_destroy(&array[i].array[j]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + + if (array[i].size) { + const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_condition_attribute_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } + } // for + } + + return F_none; + } +#endif // _di_f_thread_condition_attributess_delete_callback_ + +#ifndef _di_f_thread_condition_attributess_destroy_callback_ + f_status_t f_thread_condition_attributess_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { + + { + f_thread_condition_attributes_t * const array = (f_thread_condition_attributes_t *) void_array; + int error = 0; + f_number_unsigned_t j = 0; + + for (f_number_unsigned_t i = start; i < stop; ++i) { + + for (j = 0; j < array[i].size; ++j) { + + error = pthread_condattr_destroy(&array[i].array[j]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + + if (array[i].size) { + const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_condition_attribute_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } + } // for + } + + return F_none; + } +#endif // _di_f_thread_condition_attributess_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_thread/c/thread/condition_attribute.h b/level_0/f_thread/c/thread/condition_attribute.h index 9b3afcf..8e647e6 100644 --- a/level_0/f_thread/c/thread/condition_attribute.h +++ b/level_0/f_thread/c/thread/condition_attribute.h @@ -53,7 +53,38 @@ extern "C" { #endif // _di_f_thread_condition_attributes_t_ /** - * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_condition_attributess_t structure. + * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_condition_attributes_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. + * + * This does not do parameter checking. + * + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_array_resize(). + * + * @see f_memory_array_resize() + * @see f_memory_arrays_resize() + */ +#ifndef _di_f_thread_condition_attributes_delete_callback_ + extern f_status_t f_thread_condition_attributes_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_thread_condition_attributes_delete_callback_ + +/** + * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_condition_attributes_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. * * This does not do parameter checking. * @@ -75,13 +106,15 @@ extern "C" { * @see f_memory_array_adjust() * @see f_memory_arrays_adjust() */ -#ifndef _di_f_thread_condition_attributes_adjust_callback_ - extern f_status_t f_thread_condition_attributes_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_thread_condition_attributes_adjust_callback_ +#ifndef _di_f_thread_condition_attributes_destroy_callback_ + extern f_status_t f_thread_condition_attributes_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_thread_condition_attributes_destroy_callback_ /** * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_condition_attributess_t structure. * + * This is only called when shrinking the array and generally should perform deallocations. + * * This does not do parameter checking. * * @param start @@ -102,9 +135,38 @@ extern "C" { * @see f_memory_array_resize() * @see f_memory_arrays_resize() */ -#ifndef _di_f_thread_condition_attributes_resize_callback_ - extern f_status_t f_thread_condition_attributes_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_thread_condition_attributes_resize_callback_ +#ifndef _di_f_thread_condition_attributess_delete_callback_ + extern f_status_t f_thread_condition_attributess_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_thread_condition_attributess_delete_callback_ + +/** + * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_condition_attributess_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. + * + * This does not do parameter checking. + * + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_array_adjust(). + * + * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() + */ +#ifndef _di_f_thread_condition_attributess_destroy_callback_ + extern f_status_t f_thread_condition_attributess_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_thread_condition_attributess_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_thread/c/thread/key.c b/level_0/f_thread/c/thread/key.c index 087277a..4451547 100644 --- a/level_0/f_thread/c/thread/key.c +++ b/level_0/f_thread/c/thread/key.c @@ -5,41 +5,95 @@ extern "C" { #endif -#ifndef _di_f_thread_keys_adjust_callback_ - f_status_t f_thread_keys_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_thread_keys_delete_callback_ + f_status_t f_thread_keys_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { + + { + f_thread_key_t * const array = (f_thread_key_t *) void_array; + + for (f_number_unsigned_t i = start; i < stop; ++i) { + + if (pthread_key_delete(array[i])) return F_status_set_error(F_failure); + + array[i] = 0; + } // for + } + + return F_none; + } +#endif // _di_f_thread_keys_delete_callback_ + +#ifndef _di_f_thread_keys_destroy_callback_ + f_status_t f_thread_keys_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { + + { + f_thread_key_t * const array = (f_thread_key_t *) void_array; + + for (f_number_unsigned_t i = start; i < stop; ++i) { + + if (pthread_key_delete(array[i])) return F_status_set_error(F_failure); + + array[i] = 0; + } // for + } + + return F_none; + } +#endif // _di_f_thread_keys_destroy_callback_ + +#ifndef _di_f_thread_keyss_delete_callback_ + f_status_t f_thread_keyss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { f_thread_keys_t * const array = (f_thread_keys_t *) void_array; + f_number_unsigned_t j = 0; for (f_number_unsigned_t i = start; i < stop; ++i) { - if (pthread_key_delete(array->array[i])) return F_status_set_error(F_failure); + for (j = 0; j < array[i].size; ++j) { + + if (pthread_key_delete(array[i].array[j])) return F_status_set_error(F_failure); - array->array[i] = 0; + array[i].array[j] = 0; + } // for + + if (array[i].size) { + const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_key_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } } // for } return F_none; } -#endif // _di_f_thread_keys_adjust_callback_ +#endif // _di_f_thread_keyss_delete_callback_ -#ifndef _di_f_thread_keys_resize_callback_ - f_status_t f_thread_keys_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_thread_keyss_destroy_callback_ + f_status_t f_thread_keyss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { f_thread_keys_t * const array = (f_thread_keys_t *) void_array; + f_number_unsigned_t j = 0; for (f_number_unsigned_t i = start; i < stop; ++i) { - if (pthread_key_delete(array->array[i])) return F_status_set_error(F_failure); + for (j = 0; j < array[i].size; ++j) { + + if (pthread_key_delete(array[i].array[j])) return F_status_set_error(F_failure); + + array[i].array[j] = 0; + } // for - array->array[i] = 0; + if (array[i].size) { + const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_key_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } } // for } return F_none; } -#endif // _di_f_thread_keys_resize_callback_ +#endif // _di_f_thread_keyss_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_thread/c/thread/key.h b/level_0/f_thread/c/thread/key.h index 2f5d41b..6969a2e 100644 --- a/level_0/f_thread/c/thread/key.h +++ b/level_0/f_thread/c/thread/key.h @@ -52,7 +52,38 @@ extern "C" { #endif // _di_f_thread_keys_t_ /** - * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_keyss_t structure. + * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_keys_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. + * + * This does not do parameter checking. + * + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_array_resize(). + * + * @see f_memory_array_resize() + * @see f_memory_arrays_resize() + */ +#ifndef _di_f_thread_keys_delete_callback_ + extern f_status_t f_thread_keys_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_thread_keys_delete_callback_ + +/** + * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_keys_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. * * This does not do parameter checking. * @@ -74,13 +105,15 @@ extern "C" { * @see f_memory_array_adjust() * @see f_memory_arrays_adjust() */ -#ifndef _di_f_thread_keys_adjust_callback_ - extern f_status_t f_thread_keys_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_thread_keys_adjust_callback_ +#ifndef _di_f_thread_keys_destroy_callback_ + extern f_status_t f_thread_keys_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_thread_keys_destroy_callback_ /** * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_keyss_t structure. * + * This is only called when shrinking the array and generally should perform deallocations. + * * This does not do parameter checking. * * @param start @@ -101,9 +134,38 @@ extern "C" { * @see f_memory_array_resize() * @see f_memory_arrays_resize() */ -#ifndef _di_f_thread_keys_resize_callback_ - extern f_status_t f_thread_keys_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_thread_keys_resize_callback_ +#ifndef _di_f_thread_keyss_delete_callback_ + extern f_status_t f_thread_keyss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_thread_keyss_delete_callback_ + +/** + * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_keyss_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. + * + * This does not do parameter checking. + * + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_array_adjust(). + * + * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() + */ +#ifndef _di_f_thread_keyss_destroy_callback_ + extern f_status_t f_thread_keyss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_thread_keyss_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_thread/c/thread/lock.c b/level_0/f_thread/c/thread/lock.c index 84d6fc5..2448f96 100644 --- a/level_0/f_thread/c/thread/lock.c +++ b/level_0/f_thread/c/thread/lock.c @@ -5,16 +5,16 @@ extern "C" { #endif -#ifndef _di_f_thread_locks_adjust_callback_ - f_status_t f_thread_locks_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_thread_locks_delete_callback_ + f_status_t f_thread_locks_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { - f_thread_locks_t * const array = (f_thread_locks_t *) void_array; + f_thread_lock_t * const array = (f_thread_lock_t *) void_array; int error = 0; for (f_number_unsigned_t i = start; i < stop; ++i) { - error = pthread_rwlock_destroy(&array->array[i]); + error = pthread_rwlock_destroy(&array[i]); if (error) { if (error == EBUSY) return F_status_set_error(F_busy); @@ -27,18 +27,18 @@ extern "C" { return F_none; } -#endif // _di_f_thread_locks_adjust_callback_ +#endif // _di_f_thread_locks_delete_callback_ -#ifndef _di_f_thread_locks_resize_callback_ - f_status_t f_thread_locks_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_thread_locks_destroy_callback_ + f_status_t f_thread_locks_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { - f_thread_locks_t * const array = (f_thread_locks_t *) void_array; + f_thread_lock_t * const array = (f_thread_lock_t *) void_array; int error = 0; for (f_number_unsigned_t i = start; i < stop; ++i) { - error = pthread_rwlock_destroy(&array->array[i]); + error = pthread_rwlock_destroy(&array[i]); if (error) { if (error == EBUSY) return F_status_set_error(F_busy); @@ -51,7 +51,73 @@ extern "C" { return F_none; } -#endif // _di_f_thread_locks_resize_callback_ +#endif // _di_f_thread_locks_destroy_callback_ + +#ifndef _di_f_thread_lockss_delete_callback_ + f_status_t f_thread_lockss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { + + { + f_thread_locks_t * const array = (f_thread_locks_t *) void_array; + int error = 0; + f_number_unsigned_t j = 0; + + for (f_number_unsigned_t i = start; i < stop; ++i) { + + for (j = 0; j < array[i].size; ++j) { + + error = pthread_rwlock_destroy(&array[i].array[j]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + + if (array[i].size) { + const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_lock_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } + } // for + } + + return F_none; + } +#endif // _di_f_thread_lockss_delete_callback_ + +#ifndef _di_f_thread_lockss_destroy_callback_ + f_status_t f_thread_lockss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { + + { + f_thread_locks_t * const array = (f_thread_locks_t *) void_array; + int error = 0; + f_number_unsigned_t j = 0; + + for (f_number_unsigned_t i = start; i < stop; ++i) { + + for (j = 0; j < array[i].size; ++j) { + + error = pthread_rwlock_destroy(&array[i].array[j]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + + if (array[i].size) { + const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_lock_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } + } // for + } + + return F_none; + } +#endif // _di_f_thread_lockss_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_thread/c/thread/lock.h b/level_0/f_thread/c/thread/lock.h index 1501904..32fd47f 100644 --- a/level_0/f_thread/c/thread/lock.h +++ b/level_0/f_thread/c/thread/lock.h @@ -53,7 +53,38 @@ extern "C" { #endif // _di_f_thread_locks_t_ /** - * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_lockss_t structure. + * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_locks_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. + * + * This does not do parameter checking. + * + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_array_resize(). + * + * @see f_memory_array_resize() + * @see f_memory_arrays_resize() + */ +#ifndef _di_f_thread_locks_delete_callback_ + extern f_status_t f_thread_locks_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_thread_locks_delete_callback_ + +/** + * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_locks_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. * * This does not do parameter checking. * @@ -75,13 +106,15 @@ extern "C" { * @see f_memory_array_adjust() * @see f_memory_arrays_adjust() */ -#ifndef _di_f_thread_locks_adjust_callback_ - extern f_status_t f_thread_locks_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_thread_locks_adjust_callback_ +#ifndef _di_f_thread_locks_destroy_callback_ + extern f_status_t f_thread_locks_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_thread_locks_destroy_callback_ /** * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_lockss_t structure. * + * This is only called when shrinking the array and generally should perform deallocations. + * * This does not do parameter checking. * * @param start @@ -102,9 +135,38 @@ extern "C" { * @see f_memory_array_resize() * @see f_memory_arrays_resize() */ -#ifndef _di_f_thread_locks_resize_callback_ - extern f_status_t f_thread_locks_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_thread_locks_resize_callback_ +#ifndef _di_f_thread_lockss_delete_callback_ + extern f_status_t f_thread_lockss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_thread_lockss_delete_callback_ + +/** + * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_lockss_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. + * + * This does not do parameter checking. + * + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_array_adjust(). + * + * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() + */ +#ifndef _di_f_thread_lockss_destroy_callback_ + extern f_status_t f_thread_lockss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_thread_lockss_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_thread/c/thread/lock_attribute.c b/level_0/f_thread/c/thread/lock_attribute.c index ddd1e7f..32ec455 100644 --- a/level_0/f_thread/c/thread/lock_attribute.c +++ b/level_0/f_thread/c/thread/lock_attribute.c @@ -5,16 +5,16 @@ extern "C" { #endif -#ifndef _di_f_thread_lock_attributes_adjust_callback_ - f_status_t f_thread_lock_attributes_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_thread_lock_attributes_delete_callback_ + f_status_t f_thread_lock_attributes_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { - f_thread_lock_attributes_t * const array = (f_thread_lock_attributes_t *) void_array; + f_thread_lock_attribute_t * const array = (f_thread_lock_attribute_t *) void_array; int error = 0; for (f_number_unsigned_t i = start; i < stop; ++i) { - error = pthread_rwlockattr_destroy(&array->array[i]); + error = pthread_rwlockattr_destroy(&array[i]); if (error) { if (error == EBUSY) return F_status_set_error(F_busy); @@ -27,18 +27,18 @@ extern "C" { return F_none; } -#endif // _di_f_thread_lock_attributes_adjust_callback_ +#endif // _di_f_thread_lock_attributes_delete_callback_ -#ifndef _di_f_thread_lock_attributes_resize_callback_ - f_status_t f_thread_lock_attributes_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_thread_lock_attributes_destroy_callback_ + f_status_t f_thread_lock_attributes_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { - f_thread_lock_attributes_t * const array = (f_thread_lock_attributes_t *) void_array; + f_thread_lock_attribute_t * const array = (f_thread_lock_attribute_t *) void_array; int error = 0; for (f_number_unsigned_t i = start; i < stop; ++i) { - error = pthread_rwlockattr_destroy(&array->array[i]); + error = pthread_rwlockattr_destroy(&array[i]); if (error) { if (error == EBUSY) return F_status_set_error(F_busy); @@ -51,7 +51,73 @@ extern "C" { return F_none; } -#endif // _di_f_thread_lock_attributes_resize_callback_ +#endif // _di_f_thread_lock_attributes_destroy_callback_ + +#ifndef _di_f_thread_lock_attributess_delete_callback_ + f_status_t f_thread_lock_attributess_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { + + { + f_thread_lock_attributes_t * const array = (f_thread_lock_attributes_t *) void_array; + int error = 0; + f_number_unsigned_t j = 0; + + for (f_number_unsigned_t i = start; i < stop; ++i) { + + for (j = 0; j < array[i].size; ++j) { + + error = pthread_rwlockattr_destroy(&array[i].array[j]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + + if (array[i].size) { + const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_lock_attribute_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } + } // for + } + + return F_none; + } +#endif // _di_f_thread_lock_attributess_delete_callback_ + +#ifndef _di_f_thread_lock_attributess_destroy_callback_ + f_status_t f_thread_lock_attributess_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { + + { + f_thread_lock_attributes_t * const array = (f_thread_lock_attributes_t *) void_array; + int error = 0; + f_number_unsigned_t j = 0; + + for (f_number_unsigned_t i = start; i < stop; ++i) { + + for (j = 0; j < array[i].size; ++j) { + + error = pthread_rwlockattr_destroy(&array[i].array[j]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + + if (array[i].size) { + const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_lock_attribute_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } + } // for + } + + return F_none; + } +#endif // _di_f_thread_lock_attributess_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_thread/c/thread/lock_attribute.h b/level_0/f_thread/c/thread/lock_attribute.h index 3566a3b..1d4ad14 100644 --- a/level_0/f_thread/c/thread/lock_attribute.h +++ b/level_0/f_thread/c/thread/lock_attribute.h @@ -53,7 +53,38 @@ extern "C" { #endif // _di_f_thread_lock_attributes_t_ /** - * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_lock_attributess_t structure. + * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_lock_attributes_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. + * + * This does not do parameter checking. + * + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_array_resize(). + * + * @see f_memory_array_resize() + * @see f_memory_arrays_resize() + */ +#ifndef _di_f_thread_lock_attributes_delete_callback_ + extern f_status_t f_thread_lock_attributes_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_thread_lock_attributes_delete_callback_ + +/** + * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_lock_attributes_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. * * This does not do parameter checking. * @@ -75,13 +106,15 @@ extern "C" { * @see f_memory_array_adjust() * @see f_memory_arrays_adjust() */ -#ifndef _di_f_thread_lock_attributes_adjust_callback_ - extern f_status_t f_thread_lock_attributes_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_thread_lock_attributes_adjust_callback_ +#ifndef _di_f_thread_lock_attributes_destroy_callback_ + extern f_status_t f_thread_lock_attributes_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_thread_lock_attributes_destroy_callback_ /** * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_lock_attributess_t structure. * + * This is only called when shrinking the array and generally should perform deallocations. + * * This does not do parameter checking. * * @param start @@ -102,9 +135,38 @@ extern "C" { * @see f_memory_array_resize() * @see f_memory_arrays_resize() */ -#ifndef _di_f_thread_lock_attributes_resize_callback_ - extern f_status_t f_thread_lock_attributes_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_thread_lock_attributes_resize_callback_ +#ifndef _di_f_thread_lock_attributess_delete_callback_ + extern f_status_t f_thread_lock_attributess_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_thread_lock_attributess_delete_callback_ + +/** + * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_lock_attributess_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. + * + * This does not do parameter checking. + * + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_array_adjust(). + * + * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() + */ +#ifndef _di_f_thread_lock_attributess_destroy_callback_ + extern f_status_t f_thread_lock_attributess_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_thread_lock_attributess_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_thread/c/thread/mutex.c b/level_0/f_thread/c/thread/mutex.c index d3154d0..c8611cd 100644 --- a/level_0/f_thread/c/thread/mutex.c +++ b/level_0/f_thread/c/thread/mutex.c @@ -5,16 +5,16 @@ extern "C" { #endif -#ifndef _di_f_thread_mutexs_adjust_callback_ - f_status_t f_thread_mutexs_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_thread_mutexs_delete_callback_ + f_status_t f_thread_mutexs_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { - f_thread_mutexs_t * const array = (f_thread_mutexs_t *) void_array; + f_thread_mutex_t * const array = (f_thread_mutex_t *) void_array; int error = 0; for (f_number_unsigned_t i = start; i < stop; ++i) { - error = pthread_mutex_destroy(&array->array[i]); + error = pthread_mutex_destroy(&array[i]); if (error) { if (error == EBUSY) return F_status_set_error(F_busy); @@ -27,18 +27,18 @@ extern "C" { return F_none; } -#endif // _di_f_thread_mutexs_adjust_callback_ +#endif // _di_f_thread_mutexs_delete_callback_ -#ifndef _di_f_thread_mutexs_resize_callback_ - f_status_t f_thread_mutexs_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_thread_mutexs_destroy_callback_ + f_status_t f_thread_mutexs_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { - f_thread_mutexs_t * const array = (f_thread_mutexs_t *) void_array; + f_thread_mutex_t * const array = (f_thread_mutex_t *) void_array; int error = 0; for (f_number_unsigned_t i = start; i < stop; ++i) { - error = pthread_mutex_destroy(&array->array[i]); + error = pthread_mutex_destroy(&array[i]); if (error) { if (error == EBUSY) return F_status_set_error(F_busy); @@ -51,7 +51,73 @@ extern "C" { return F_none; } -#endif // _di_f_thread_mutexs_resize_callback_ +#endif // _di_f_thread_mutexs_destroy_callback_ + +#ifndef _di_f_thread_mutexss_delete_callback_ + f_status_t f_thread_mutexss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { + + { + f_thread_mutexs_t * const array = (f_thread_mutexs_t *) void_array; + int error = 0; + f_number_unsigned_t j = 0; + + for (f_number_unsigned_t i = start; i < stop; ++i) { + + for (j = 0; j < array[i].size; ++j) { + + error = pthread_mutex_destroy(&array[i].array[j]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + + if (array[i].size) { + const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_mutex_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } + } // for + } + + return F_none; + } +#endif // _di_f_thread_mutexss_delete_callback_ + +#ifndef _di_f_thread_mutexss_destroy_callback_ + f_status_t f_thread_mutexss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { + + { + f_thread_mutexs_t * const array = (f_thread_mutexs_t *) void_array; + int error = 0; + f_number_unsigned_t j = 0; + + for (f_number_unsigned_t i = start; i < stop; ++i) { + + for (j = 0; j < array[i].size; ++j) { + + error = pthread_mutex_destroy(&array[i].array[j]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + + if (array[i].size) { + const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_mutex_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } + } // for + } + + return F_none; + } +#endif // _di_f_thread_mutexss_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_thread/c/thread/mutex.h b/level_0/f_thread/c/thread/mutex.h index 57d203d..a33747c 100644 --- a/level_0/f_thread/c/thread/mutex.h +++ b/level_0/f_thread/c/thread/mutex.h @@ -55,7 +55,38 @@ extern "C" { #endif // _di_f_thread_mutexs_t_ /** - * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_mutexss_t structure. + * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_mutexs_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. + * + * This does not do parameter checking. + * + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_array_resize(). + * + * @see f_memory_array_resize() + * @see f_memory_arrays_resize() + */ +#ifndef _di_f_thread_mutexs_delete_callback_ + extern f_status_t f_thread_mutexs_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_thread_mutexs_delete_callback_ + +/** + * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_mutexs_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. * * This does not do parameter checking. * @@ -77,13 +108,15 @@ extern "C" { * @see f_memory_array_adjust() * @see f_memory_arrays_adjust() */ -#ifndef _di_f_thread_mutexs_adjust_callback_ - extern f_status_t f_thread_mutexs_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_thread_mutexs_adjust_callback_ +#ifndef _di_f_thread_mutexs_destroy_callback_ + extern f_status_t f_thread_mutexs_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_thread_mutexs_destroy_callback_ /** * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_mutexss_t structure. * + * This is only called when shrinking the array and generally should perform deallocations. + * * This does not do parameter checking. * * @param start @@ -104,9 +137,38 @@ extern "C" { * @see f_memory_array_resize() * @see f_memory_arrays_resize() */ -#ifndef _di_f_thread_mutexs_resize_callback_ - extern f_status_t f_thread_mutexs_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_thread_mutexs_resize_callback_ +#ifndef _di_f_thread_mutexss_delete_callback_ + extern f_status_t f_thread_mutexss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_thread_mutexss_delete_callback_ + +/** + * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_mutexss_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. + * + * This does not do parameter checking. + * + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_array_adjust(). + * + * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() + */ +#ifndef _di_f_thread_mutexss_destroy_callback_ + extern f_status_t f_thread_mutexss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_thread_mutexss_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_thread/c/thread/mutex_attribute.c b/level_0/f_thread/c/thread/mutex_attribute.c index f7dd39f6..4f8be39 100644 --- a/level_0/f_thread/c/thread/mutex_attribute.c +++ b/level_0/f_thread/c/thread/mutex_attribute.c @@ -5,16 +5,16 @@ extern "C" { #endif -#ifndef _di_f_thread_mutex_attributes_adjust_callback_ - f_status_t f_thread_mutex_attributes_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_thread_mutex_attributes_delete_callback_ + f_status_t f_thread_mutex_attributes_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { - f_thread_mutex_attributes_t * const array = (f_thread_mutex_attributes_t *) void_array; + f_thread_mutex_attribute_t * const array = (f_thread_mutex_attribute_t *) void_array; int error = 0; for (f_number_unsigned_t i = start; i < stop; ++i) { - error = pthread_mutexattr_destroy(&array->array[i]); + error = pthread_mutexattr_destroy(&array[i]); if (error) { if (error == EBUSY) return F_status_set_error(F_busy); @@ -27,18 +27,18 @@ extern "C" { return F_none; } -#endif // _di_f_thread_mutex_attributes_adjust_callback_ +#endif // _di_f_thread_mutex_attributes_delete_callback_ -#ifndef _di_f_thread_mutex_attributes_resize_callback_ - f_status_t f_thread_mutex_attributes_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_thread_mutex_attributes_destroy_callback_ + f_status_t f_thread_mutex_attributes_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { - f_thread_mutex_attributes_t * const array = (f_thread_mutex_attributes_t *) void_array; + f_thread_mutex_attribute_t * const array = (f_thread_mutex_attribute_t *) void_array; int error = 0; for (f_number_unsigned_t i = start; i < stop; ++i) { - error = pthread_mutexattr_destroy(&array->array[i]); + error = pthread_mutexattr_destroy(&array[i]); if (error) { if (error == EBUSY) return F_status_set_error(F_busy); @@ -51,7 +51,73 @@ extern "C" { return F_none; } -#endif // _di_f_thread_mutex_attributes_resize_callback_ +#endif // _di_f_thread_mutex_attributes_destroy_callback_ + +#ifndef _di_f_thread_mutex_attributess_delete_callback_ + f_status_t f_thread_mutex_attributess_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { + + { + f_thread_mutex_attributes_t * const array = (f_thread_mutex_attributes_t *) void_array; + int error = 0; + f_number_unsigned_t j = 0; + + for (f_number_unsigned_t i = start; i < stop; ++i) { + + for (j = 0; j < array[i].size; ++j) { + + error = pthread_mutexattr_destroy(&array[i].array[j]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + + if (array[i].size) { + const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_mutex_attribute_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } + } // for + } + + return F_none; + } +#endif // _di_f_thread_mutex_attributess_delete_callback_ + +#ifndef _di_f_thread_mutex_attributess_destroy_callback_ + f_status_t f_thread_mutex_attributess_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { + + { + f_thread_mutex_attributes_t * const array = (f_thread_mutex_attributes_t *) void_array; + int error = 0; + f_number_unsigned_t j = 0; + + for (f_number_unsigned_t i = start; i < stop; ++i) { + + for (j = 0; j < array[i].size; ++j) { + + error = pthread_mutexattr_destroy(&array[i].array[j]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + + if (array[i].size) { + const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_mutex_attribute_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } + } // for + } + + return F_none; + } +#endif // _di_f_thread_mutex_attributess_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_thread/c/thread/mutex_attribute.h b/level_0/f_thread/c/thread/mutex_attribute.h index dd24c04..d977396 100644 --- a/level_0/f_thread/c/thread/mutex_attribute.h +++ b/level_0/f_thread/c/thread/mutex_attribute.h @@ -53,7 +53,38 @@ extern "C" { #endif // _di_f_thread_mutex_attributes_t_ /** - * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_mutex_attributess_t structure. + * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_mutex_attributes_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. + * + * This does not do parameter checking. + * + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_array_resize(). + * + * @see f_memory_array_resize() + * @see f_memory_arrays_resize() + */ +#ifndef _di_f_thread_mutex_attributes_delete_callback_ + extern f_status_t f_thread_mutex_attributes_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_thread_mutex_attributes_delete_callback_ + +/** + * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_mutex_attributes_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. * * This does not do parameter checking. * @@ -75,13 +106,15 @@ extern "C" { * @see f_memory_array_adjust() * @see f_memory_arrays_adjust() */ -#ifndef _di_f_thread_mutex_attributes_adjust_callback_ - extern f_status_t f_thread_mutex_attributes_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_thread_mutex_attributes_adjust_callback_ +#ifndef _di_f_thread_mutex_attributes_destroy_callback_ + extern f_status_t f_thread_mutex_attributes_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_thread_mutex_attributes_destroy_callback_ /** * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_mutex_attributess_t structure. * + * This is only called when shrinking the array and generally should perform deallocations. + * * This does not do parameter checking. * * @param start @@ -102,9 +135,38 @@ extern "C" { * @see f_memory_array_resize() * @see f_memory_arrays_resize() */ -#ifndef _di_f_thread_mutex_attributes_resize_callback_ - extern f_status_t f_thread_mutex_attributes_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_thread_mutex_attributes_resize_callback_ +#ifndef _di_f_thread_mutex_attributess_delete_callback_ + extern f_status_t f_thread_mutex_attributess_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_thread_mutex_attributess_delete_callback_ + +/** + * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_mutex_attributess_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. + * + * This does not do parameter checking. + * + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_array_adjust(). + * + * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() + */ +#ifndef _di_f_thread_mutex_attributess_destroy_callback_ + extern f_status_t f_thread_mutex_attributess_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_thread_mutex_attributess_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_thread/c/thread/semaphore.c b/level_0/f_thread/c/thread/semaphore.c index 9e21eae..4ab2444 100644 --- a/level_0/f_thread/c/thread/semaphore.c +++ b/level_0/f_thread/c/thread/semaphore.c @@ -5,35 +5,84 @@ extern "C" { #endif -#ifndef _di_f_thread_semaphores_adjust_callback_ - f_status_t f_thread_semaphores_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_thread_semaphores_delete_callback_ + f_status_t f_thread_semaphores_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { + + { + f_thread_semaphore_t * const array = (f_thread_semaphore_t *) void_array; + + for (f_number_unsigned_t i = start; i < stop; ++i) { + if (sem_destroy(&array[i]) == -1) return (errno == EINVAL) ? F_status_set_error(F_parameter) : F_status_set_error(F_failure); + } // for + } + + return F_none; + } +#endif // _di_f_thread_semaphores_delete_callback_ + +#ifndef _di_f_thread_semaphores_destroy_callback_ + f_status_t f_thread_semaphores_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { + + { + f_thread_semaphore_t * const array = (f_thread_semaphore_t *) void_array; + + for (f_number_unsigned_t i = start; i < stop; ++i) { + if (sem_destroy(&array[i]) == -1) return (errno == EINVAL) ? F_status_set_error(F_parameter) : F_status_set_error(F_failure); + } // for + } + + return F_none; + } +#endif // _di_f_thread_semaphores_destroy_callback_ + +#ifndef _di_f_thread_semaphoress_delete_callback_ + f_status_t f_thread_semaphoress_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { f_thread_semaphores_t * const array = (f_thread_semaphores_t *) void_array; + f_number_unsigned_t j = 0; for (f_number_unsigned_t i = start; i < stop; ++i) { - if (sem_destroy(&array->array[i]) == -1) return (errno == EINVAL) ? F_status_set_error(F_parameter) : F_status_set_error(F_failure); + + for (j = 0; j < array[i].size; ++j) { + if (sem_destroy(&array[i].array[j]) == -1) return (errno == EINVAL) ? F_status_set_error(F_parameter) : F_status_set_error(F_failure); + } // for + + if (array[i].size) { + const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_semaphore_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } } // for } return F_none; } -#endif // _di_f_thread_semaphores_adjust_callback_ +#endif // _di_f_thread_semaphoress_delete_callback_ -#ifndef _di_f_thread_semaphores_resize_callback_ - f_status_t f_thread_semaphores_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_thread_semaphoress_destroy_callback_ + f_status_t f_thread_semaphoress_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { f_thread_semaphores_t * const array = (f_thread_semaphores_t *) void_array; + f_number_unsigned_t j = 0; for (f_number_unsigned_t i = start; i < stop; ++i) { - if (sem_destroy(&array->array[i]) == -1) return (errno == EINVAL) ? F_status_set_error(F_parameter) : F_status_set_error(F_failure); + + for (j = 0; j < array[i].size; ++j) { + if (sem_destroy(&array[i].array[j]) == -1) return (errno == EINVAL) ? F_status_set_error(F_parameter) : F_status_set_error(F_failure); + } // for + + if (array[i].size) { + const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_semaphore_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } } // for } return F_none; } -#endif // _di_f_thread_semaphores_resize_callback_ +#endif // _di_f_thread_semaphoress_destroy_callback_ + #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_thread/c/thread/semaphore.h b/level_0/f_thread/c/thread/semaphore.h index b439014..6887063 100644 --- a/level_0/f_thread/c/thread/semaphore.h +++ b/level_0/f_thread/c/thread/semaphore.h @@ -54,7 +54,38 @@ extern "C" { #endif // _di_f_thread_semaphores_t_ /** - * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_semaphoress_t structure. + * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_semaphores_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. + * + * This does not do parameter checking. + * + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_array_resize(). + * + * @see f_memory_array_resize() + * @see f_memory_arrays_resize() + */ +#ifndef _di_f_thread_semaphores_delete_callback_ + extern f_status_t f_thread_semaphores_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_thread_semaphores_delete_callback_ + +/** + * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_semaphores_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. * * This does not do parameter checking. * @@ -76,13 +107,15 @@ extern "C" { * @see f_memory_array_adjust() * @see f_memory_arrays_adjust() */ -#ifndef _di_f_thread_semaphores_adjust_callback_ - extern f_status_t f_thread_semaphores_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_thread_semaphores_adjust_callback_ +#ifndef _di_f_thread_semaphores_destroy_callback_ + extern f_status_t f_thread_semaphores_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_thread_semaphores_destroy_callback_ /** * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_semaphoress_t structure. * + * This is only called when shrinking the array and generally should perform deallocations. + * * This does not do parameter checking. * * @param start @@ -103,9 +136,38 @@ extern "C" { * @see f_memory_array_resize() * @see f_memory_arrays_resize() */ -#ifndef _di_f_thread_semaphores_resize_callback_ - extern f_status_t f_thread_semaphores_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_thread_semaphores_resize_callback_ +#ifndef _di_f_thread_semaphoress_delete_callback_ + extern f_status_t f_thread_semaphoress_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_thread_semaphoress_delete_callback_ + +/** + * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_semaphoress_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. + * + * This does not do parameter checking. + * + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_array_adjust(). + * + * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() + */ +#ifndef _di_f_thread_semaphoress_destroy_callback_ + extern f_status_t f_thread_semaphoress_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_thread_semaphoress_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_thread/c/thread/set.c b/level_0/f_thread/c/thread/set.c index 182049b..93d6389 100644 --- a/level_0/f_thread/c/thread/set.c +++ b/level_0/f_thread/c/thread/set.c @@ -5,35 +5,83 @@ extern "C" { #endif -#ifndef _di_f_thread_sets_adjust_callback_ - f_status_t f_thread_sets_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_thread_sets_delete_callback_ + f_status_t f_thread_sets_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { + + { + f_thread_set_t * const array = (f_thread_set_t *) void_array; + + for (f_number_unsigned_t i = start; i < stop; ++i) { + if (pthread_attr_destroy(&array[i].attribute)) return F_status_set_error(F_failure); + } // for + } + + return F_none; + } +#endif // _di_f_thread_sets_delete_callback_ + +#ifndef _di_f_thread_sets_destroy_callback_ + f_status_t f_thread_sets_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { + + { + f_thread_set_t * const array = (f_thread_set_t *) void_array; + + for (f_number_unsigned_t i = start; i < stop; ++i) { + if (pthread_attr_destroy(&array[i].attribute)) return F_status_set_error(F_failure); + } // for + } + + return F_none; + } +#endif // _di_f_thread_sets_destroy_callback_ + +#ifndef _di_f_thread_setss_delete_callback_ + f_status_t f_thread_setss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { f_thread_sets_t * const array = (f_thread_sets_t *) void_array; + f_number_unsigned_t j = 0; for (f_number_unsigned_t i = start; i < stop; ++i) { - if (pthread_attr_destroy(&array->array[i].attribute)) return F_status_set_error(F_failure); + + for (j = 0; j < array[i].size; ++j) { + if (pthread_attr_destroy(&array[i].array[j].attribute)) return F_status_set_error(F_failure); + } // for + + if (array[i].size) { + const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_set_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } } // for } return F_none; } -#endif // _di_f_thread_sets_adjust_callback_ +#endif // _di_f_thread_setss_delete_callback_ -#ifndef _di_f_thread_sets_resize_callback_ - f_status_t f_thread_sets_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_thread_setss_destroy_callback_ + f_status_t f_thread_setss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { f_thread_sets_t * const array = (f_thread_sets_t *) void_array; + f_number_unsigned_t j = 0; for (f_number_unsigned_t i = start; i < stop; ++i) { - if (pthread_attr_destroy(&array->array[i].attribute)) return F_status_set_error(F_failure); + + for (j = 0; j < array[i].size; ++j) { + if (pthread_attr_destroy(&array[i].array[j].attribute)) return F_status_set_error(F_failure); + } // for + + if (array[i].size) { + const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_set_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } } // for } return F_none; } -#endif // _di_f_thread_sets_resize_callback_ +#endif // _di_f_thread_setss_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_thread/c/thread/set.h b/level_0/f_thread/c/thread/set.h index 5eb8fa4..7397ed8 100644 --- a/level_0/f_thread/c/thread/set.h +++ b/level_0/f_thread/c/thread/set.h @@ -64,7 +64,38 @@ extern "C" { #endif // _di_f_thread_sets_t_ /** - * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_setss_t structure. + * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_sets_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. + * + * This does not do parameter checking. + * + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_array_resize(). + * + * @see f_memory_array_resize() + * @see f_memory_arrays_resize() + */ +#ifndef _di_f_thread_sets_delete_callback_ + extern f_status_t f_thread_sets_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_thread_sets_delete_callback_ + +/** + * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_sets_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. * * This does not do parameter checking. * @@ -86,13 +117,15 @@ extern "C" { * @see f_memory_array_adjust() * @see f_memory_arrays_adjust() */ -#ifndef _di_f_thread_sets_adjust_callback_ - extern f_status_t f_thread_sets_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_thread_sets_adjust_callback_ +#ifndef _di_f_thread_sets_destroy_callback_ + extern f_status_t f_thread_sets_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_thread_sets_destroy_callback_ /** * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_setss_t structure. * + * This is only called when shrinking the array and generally should perform deallocations. + * * This does not do parameter checking. * * @param start @@ -113,9 +146,38 @@ extern "C" { * @see f_memory_array_resize() * @see f_memory_arrays_resize() */ -#ifndef _di_f_thread_sets_resize_callback_ - extern f_status_t f_thread_sets_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_thread_sets_resize_callback_ +#ifndef _di_f_thread_setss_delete_callback_ + extern f_status_t f_thread_setss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_thread_setss_delete_callback_ + +/** + * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_setss_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. + * + * This does not do parameter checking. + * + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_array_adjust(). + * + * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() + */ +#ifndef _di_f_thread_setss_destroy_callback_ + extern f_status_t f_thread_setss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_thread_setss_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_thread/c/thread/spin.c b/level_0/f_thread/c/thread/spin.c index 030d1df..e93524b 100644 --- a/level_0/f_thread/c/thread/spin.c +++ b/level_0/f_thread/c/thread/spin.c @@ -5,16 +5,16 @@ extern "C" { #endif -#ifndef _di_f_thread_spins_adjust_callback_ - f_status_t f_thread_spins_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_thread_spins_delete_callback_ + f_status_t f_thread_spins_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { - f_thread_spins_t * const array = (f_thread_spins_t *) void_array; + f_thread_spin_t * const array = (f_thread_spin_t *) void_array; int error = 0; for (f_number_unsigned_t i = start; i < stop; ++i) { - error = pthread_spin_destroy(&array->array[i]); + error = pthread_spin_destroy(&array[i]); if (error) { if (error == EBUSY) return F_status_set_error(F_busy); @@ -27,18 +27,18 @@ extern "C" { return F_none; } -#endif // _di_f_thread_spins_adjust_callback_ +#endif // _di_f_thread_spins_delete_callback_ -#ifndef _di_f_thread_spins_resize_callback_ - f_status_t f_thread_spins_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_thread_spins_destroy_callback_ + f_status_t f_thread_spins_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { - f_thread_spins_t * const array = (f_thread_spins_t *) void_array; + f_thread_spin_t * const array = (f_thread_spin_t *) void_array; int error = 0; for (f_number_unsigned_t i = start; i < stop; ++i) { - error = pthread_spin_destroy(&array->array[i]); + error = pthread_spin_destroy(&array[i]); if (error) { if (error == EBUSY) return F_status_set_error(F_busy); @@ -51,7 +51,73 @@ extern "C" { return F_none; } -#endif // _di_f_thread_spins_resize_callback_ +#endif // _di_f_thread_spins_destroy_callback_ + +#ifndef _di_f_thread_spinss_delete_callback_ + f_status_t f_thread_spinss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { + + { + f_thread_spins_t * const array = (f_thread_spins_t *) void_array; + int error = 0; + f_number_unsigned_t j = 0; + + for (f_number_unsigned_t i = start; i < stop; ++i) { + + for (j = 0; j < array[i].size; ++j) { + + error = pthread_spin_destroy(&array[i].array[j]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + + if (array[i].size) { + const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_spin_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } + } // for + } + + return F_none; + } +#endif // _di_f_thread_spinss_delete_callback_ + +#ifndef _di_f_thread_spinss_destroy_callback_ + f_status_t f_thread_spinss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { + + { + f_thread_spins_t * const array = (f_thread_spins_t *) void_array; + int error = 0; + f_number_unsigned_t j = 0; + + for (f_number_unsigned_t i = start; i < stop; ++i) { + + for (j = 0; j < array[i].size; ++j) { + + error = pthread_spin_destroy(&array[i].array[j]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + + if (array[i].size) { + const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_spin_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } + } // for + } + + return F_none; + } +#endif // _di_f_thread_spinss_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_thread/c/thread/spin.h b/level_0/f_thread/c/thread/spin.h index be235b4..c3aedb9 100644 --- a/level_0/f_thread/c/thread/spin.h +++ b/level_0/f_thread/c/thread/spin.h @@ -52,7 +52,38 @@ extern "C" { #endif // _di_f_thread_spins_t_ /** - * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_spinss_t structure. + * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_spins_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. + * + * This does not do parameter checking. + * + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_array_resize(). + * + * @see f_memory_array_resize() + * @see f_memory_arrays_resize() + */ +#ifndef _di_f_thread_spins_delete_callback_ + extern f_status_t f_thread_spins_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_thread_spins_delete_callback_ + +/** + * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_spins_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. * * This does not do parameter checking. * @@ -74,13 +105,15 @@ extern "C" { * @see f_memory_array_adjust() * @see f_memory_arrays_adjust() */ -#ifndef _di_f_thread_spins_adjust_callback_ - extern f_status_t f_thread_spins_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_thread_spins_adjust_callback_ +#ifndef _di_f_thread_spins_destroy_callback_ + extern f_status_t f_thread_spins_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_thread_spins_destroy_callback_ /** * A callback intended to be passed to f_memory_arrays_resize() for an f_thread_spinss_t structure. * + * This is only called when shrinking the array and generally should perform deallocations. + * * This does not do parameter checking. * * @param start @@ -101,9 +134,38 @@ extern "C" { * @see f_memory_array_resize() * @see f_memory_arrays_resize() */ -#ifndef _di_f_thread_spins_resize_callback_ - extern f_status_t f_thread_spins_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_thread_spins_resize_callback_ +#ifndef _di_f_thread_spinss_delete_callback_ + extern f_status_t f_thread_spinss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_thread_spinss_delete_callback_ + +/** + * A callback intended to be passed to f_memory_arrays_adjust() for an f_thread_spinss_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. + * + * This does not do parameter checking. + * + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_array_adjust(). + * + * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() + */ +#ifndef _di_f_thread_spinss_destroy_callback_ + extern f_status_t f_thread_spinss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_thread_spinss_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_thread/data/build/settings-tests b/level_0/f_thread/data/build/settings-tests index 7d6fe4c..ae8a292 100644 --- a/level_0/f_thread/data/build/settings-tests +++ b/level_0/f_thread/data/build/settings-tests @@ -25,19 +25,19 @@ build_language c build_libraries -lc -lcmocka build_libraries-individual -lf_memory -lf_string -lf_thread -build_sources_program test-thread-attributes_adjust_callback.c test-thread-attributes_resize_callback.c -build_sources_program test-thread-barriers_adjust_callback.c test-thread-barriers_resize_callback.c -build_sources_program test-thread-barrier_attributes_adjust_callback.c test-thread-barrier_attributes_resize_callback.c -build_sources_program test-thread-conditions_adjust_callback.c test-thread-conditions_resize_callback.c -build_sources_program test-thread-condition_attributes_adjust_callback.c test-thread-condition_attributes_resize_callback.c -build_sources_program test-thread-keys_adjust_callback.c test-thread-keys_resize_callback.c -build_sources_program test-thread-locks_adjust_callback.c test-thread-locks_resize_callback.c -build_sources_program test-thread-lock_attributes_adjust_callback.c test-thread-lock_attributes_resize_callback.c -build_sources_program test-thread-mutexs_adjust_callback.c test-thread-mutexs_resize_callback.c -build_sources_program test-thread-mutex_attributes_adjust_callback.c test-thread-mutex_attributes_resize_callback.c -build_sources_program test-thread-semaphores_adjust_callback.c test-thread-semaphores_resize_callback.c -build_sources_program test-thread-sets_adjust_callback.c test-thread-sets_resize_callback.c -build_sources_program test-thread-spins_adjust_callback.c test-thread-spins_resize_callback.c +build_sources_program test-thread-attributes_destroy_callback.c test-thread-attributes_delete_callback.c +build_sources_program test-thread-barriers_destroy_callback.c test-thread-barriers_delete_callback.c +build_sources_program test-thread-barrier_attributes_destroy_callback.c test-thread-barrier_attributes_delete_callback.c +build_sources_program test-thread-conditions_destroy_callback.c test-thread-conditions_delete_callback.c +build_sources_program test-thread-condition_attributes_destroy_callback.c test-thread-condition_attributes_delete_callback.c +build_sources_program test-thread-keys_destroy_callback.c test-thread-keys_delete_callback.c +build_sources_program test-thread-locks_destroy_callback.c test-thread-locks_delete_callback.c +build_sources_program test-thread-lock_attributes_destroy_callback.c test-thread-lock_attributes_delete_callback.c +build_sources_program test-thread-mutexs_destroy_callback.c test-thread-mutexs_delete_callback.c +build_sources_program test-thread-mutex_attributes_destroy_callback.c test-thread-mutex_attributes_delete_callback.c +build_sources_program test-thread-semaphores_destroy_callback.c test-thread-semaphores_delete_callback.c +build_sources_program test-thread-sets_destroy_callback.c test-thread-sets_delete_callback.c +build_sources_program test-thread-spins_destroy_callback.c test-thread-spins_delete_callback.c build_sources_program test-thread-at_fork.c build_sources_program test-thread-attribute_affinity_get.c test-thread-attribute_affinity_set.c diff --git a/level_0/f_thread/tests/unit/c/test-thread-attributes_adjust_callback.h b/level_0/f_thread/tests/unit/c/test-thread-attributes_adjust_callback.h deleted file mode 100644 index ba2b2c9..0000000 --- a/level_0/f_thread/tests/unit/c/test-thread-attributes_adjust_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Thread - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_thread__attributes_adjust_callback -#define _TEST__F_thread__attributes_adjust_callback - -/** - * Test that the function fails. - * - * @see f_thread_attributes_adjust_callback_() - */ -extern void test__f_thread_attributes_adjust_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_thread_attributes_adjust_callback_() - */ -extern void test__f_thread_attributes_adjust_callback__works(void **state); - -#endif // _TEST__F_thread__attributes_adjust_callback diff --git a/level_0/f_thread/tests/unit/c/test-thread-attributes_adjust_callback.c b/level_0/f_thread/tests/unit/c/test-thread-attributes_delete_callback.c similarity index 79% rename from level_0/f_thread/tests/unit/c/test-thread-attributes_adjust_callback.c rename to level_0/f_thread/tests/unit/c/test-thread-attributes_delete_callback.c index 00c6157..f459638 100644 --- a/level_0/f_thread/tests/unit/c/test-thread-attributes_adjust_callback.c +++ b/level_0/f_thread/tests/unit/c/test-thread-attributes_delete_callback.c @@ -1,11 +1,11 @@ #include "test-thread.h" -#include "test-thread-attributes_adjust_callback.h" +#include "test-thread-attributes_delete_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_thread_attributes_adjust_callback__fails(void **state) { +void test__f_thread_attributes_delete_callback__fails(void **state) { f_thread_attribute_t data = f_thread_attribute_t_initialize; f_thread_attribute_t data_array[] = { data }; @@ -27,13 +27,13 @@ void test__f_thread_attributes_adjust_callback__fails(void **state) { will_return(__wrap_pthread_attr_destroy, true); will_return(__wrap_pthread_attr_destroy, errnos[i]); - const f_status_t status = f_thread_attributes_adjust_callback(0, 1, (void *) datass_array); + const f_status_t status = f_thread_attributes_delete_callback(0, 1, (void *) datass_array); assert_int_equal(status, statuss[i]); } // for } -void test__f_thread_attributes_adjust_callback__works(void **state) { +void test__f_thread_attributes_delete_callback__works(void **state) { f_thread_attribute_t data = f_thread_attribute_t_initialize; f_thread_attribute_t data_array[] = { data }; @@ -44,7 +44,7 @@ void test__f_thread_attributes_adjust_callback__works(void **state) { { will_return(__wrap_pthread_attr_destroy, false); - const f_status_t status = f_thread_attributes_adjust_callback(0, length, (void *) datass_array); + const f_status_t status = f_thread_attributes_delete_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_thread/tests/unit/c/test-thread-attributes_delete_callback.h b/level_0/f_thread/tests/unit/c/test-thread-attributes_delete_callback.h new file mode 100644 index 0000000..bf3c8b8 --- /dev/null +++ b/level_0/f_thread/tests/unit/c/test-thread-attributes_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Thread + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_thread__attributes_delete_callback +#define _TEST__F_thread__attributes_delete_callback + +/** + * Test that the function fails. + * + * @see f_thread_attributes_delete_callback_() + */ +extern void test__f_thread_attributes_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_thread_attributes_delete_callback_() + */ +extern void test__f_thread_attributes_delete_callback__works(void **state); + +#endif // _TEST__F_thread__attributes_delete_callback diff --git a/level_0/f_thread/tests/unit/c/test-thread-attributes_resize_callback.c b/level_0/f_thread/tests/unit/c/test-thread-attributes_destroy_callback.c similarity index 73% rename from level_0/f_thread/tests/unit/c/test-thread-attributes_resize_callback.c rename to level_0/f_thread/tests/unit/c/test-thread-attributes_destroy_callback.c index 17c4c59..926936c 100644 --- a/level_0/f_thread/tests/unit/c/test-thread-attributes_resize_callback.c +++ b/level_0/f_thread/tests/unit/c/test-thread-attributes_destroy_callback.c @@ -1,11 +1,11 @@ #include "test-thread.h" -#include "test-thread-attributes_resize_callback.h" +#include "test-thread-attributes_destroy_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_thread_attributes_resize_callback__fails(void **state) { +void test__f_thread_attributes_destroy_callback__fails(void **state) { f_thread_attribute_t data = f_thread_attribute_t_initialize; f_thread_attribute_t data_array[] = { data }; @@ -27,13 +27,13 @@ void test__f_thread_attributes_resize_callback__fails(void **state) { will_return(__wrap_pthread_attr_destroy, true); will_return(__wrap_pthread_attr_destroy, errnos[i]); - const f_status_t status = f_thread_attributes_resize_callback(0, 1, (void *) datass_array); + const f_status_t status = f_thread_attributes_destroy_callback(0, 1, (void *) datass_array); assert_int_equal(status, statuss[i]); } // for } -void test__f_thread_attributes_resize_callback__works(void **state) { +void test__f_thread_attributes_destroy_callback__works(void **state) { f_thread_attribute_t data = f_thread_attribute_t_initialize; f_thread_attribute_t data_array[] = { data }; @@ -44,7 +44,7 @@ void test__f_thread_attributes_resize_callback__works(void **state) { { will_return(__wrap_pthread_attr_destroy, false); - const f_status_t status = f_thread_attributes_resize_callback(0, length, (void *) datass_array); + const f_status_t status = f_thread_attributes_destroy_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_thread/tests/unit/c/test-thread-attributes_destroy_callback.h b/level_0/f_thread/tests/unit/c/test-thread-attributes_destroy_callback.h new file mode 100644 index 0000000..41a3bff --- /dev/null +++ b/level_0/f_thread/tests/unit/c/test-thread-attributes_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Thread + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_thread__attributes_destroy_callback +#define _TEST__F_thread__attributes_destroy_callback + +/** + * Test that the function fails. + * + * @see f_thread_attributes_destroy_callback_() + */ +extern void test__f_thread_attributes_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_thread_attributes_destroy_callback_() + */ +extern void test__f_thread_attributes_destroy_callback__works(void **state); + +#endif // _TEST__F_thread__attributes_destroy_callback diff --git a/level_0/f_thread/tests/unit/c/test-thread-attributes_resize_callback.h b/level_0/f_thread/tests/unit/c/test-thread-attributes_resize_callback.h deleted file mode 100644 index b7e9d73..0000000 --- a/level_0/f_thread/tests/unit/c/test-thread-attributes_resize_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Thread - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_thread__attributes_resize_callback -#define _TEST__F_thread__attributes_resize_callback - -/** - * Test that the function fails. - * - * @see f_thread_attributes_resize_callback_() - */ -extern void test__f_thread_attributes_resize_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_thread_attributes_resize_callback_() - */ -extern void test__f_thread_attributes_resize_callback__works(void **state); - -#endif // _TEST__F_thread__attributes_resize_callback diff --git a/level_0/f_thread/tests/unit/c/test-thread-barrier_attributes_adjust_callback.h b/level_0/f_thread/tests/unit/c/test-thread-barrier_attributes_adjust_callback.h deleted file mode 100644 index b8a7b13..0000000 --- a/level_0/f_thread/tests/unit/c/test-thread-barrier_attributes_adjust_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Thread - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_thread__barrier_attributes_adjust_callback -#define _TEST__F_thread__barrier_attributes_adjust_callback - -/** - * Test that the function fails. - * - * @see f_thread_barrier_attributes_adjust_callback_() - */ -extern void test__f_thread_barrier_attributes_adjust_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_thread_barrier_attributes_adjust_callback_() - */ -extern void test__f_thread_barrier_attributes_adjust_callback__works(void **state); - -#endif // _TEST__F_thread__barrier_attributes_adjust_callback diff --git a/level_0/f_thread/tests/unit/c/test-thread-barrier_attributes_adjust_callback.c b/level_0/f_thread/tests/unit/c/test-thread-barrier_attributes_delete_callback.c similarity index 80% rename from level_0/f_thread/tests/unit/c/test-thread-barrier_attributes_adjust_callback.c rename to level_0/f_thread/tests/unit/c/test-thread-barrier_attributes_delete_callback.c index 1265c66..2a96a15 100644 --- a/level_0/f_thread/tests/unit/c/test-thread-barrier_attributes_adjust_callback.c +++ b/level_0/f_thread/tests/unit/c/test-thread-barrier_attributes_delete_callback.c @@ -1,11 +1,11 @@ #include "test-thread.h" -#include "test-thread-barrier_attributes_adjust_callback.h" +#include "test-thread-barrier_attributes_delete_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_thread_barrier_attributes_adjust_callback__fails(void **state) { +void test__f_thread_barrier_attributes_delete_callback__fails(void **state) { f_thread_barrier_attribute_t data = f_thread_barrier_attribute_t_initialize; f_thread_barrier_attribute_t data_array[] = { data }; @@ -27,13 +27,13 @@ void test__f_thread_barrier_attributes_adjust_callback__fails(void **state) { will_return(__wrap_pthread_barrierattr_destroy, true); will_return(__wrap_pthread_barrierattr_destroy, errnos[i]); - const f_status_t status = f_thread_barrier_attributes_adjust_callback(0, 1, (void *) datass_array); + const f_status_t status = f_thread_barrier_attributes_delete_callback(0, 1, (void *) datass_array); assert_int_equal(status, statuss[i]); } // for } -void test__f_thread_barrier_attributes_adjust_callback__works(void **state) { +void test__f_thread_barrier_attributes_delete_callback__works(void **state) { f_thread_barrier_attribute_t data = f_thread_barrier_attribute_t_initialize; f_thread_barrier_attribute_t data_array[] = { data }; @@ -44,7 +44,7 @@ void test__f_thread_barrier_attributes_adjust_callback__works(void **state) { { will_return(__wrap_pthread_barrierattr_destroy, false); - const f_status_t status = f_thread_barrier_attributes_adjust_callback(0, length, (void *) datass_array); + const f_status_t status = f_thread_barrier_attributes_delete_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_thread/tests/unit/c/test-thread-barrier_attributes_delete_callback.h b/level_0/f_thread/tests/unit/c/test-thread-barrier_attributes_delete_callback.h new file mode 100644 index 0000000..29dc3b0 --- /dev/null +++ b/level_0/f_thread/tests/unit/c/test-thread-barrier_attributes_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Thread + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_thread__barrier_attributes_delete_callback +#define _TEST__F_thread__barrier_attributes_delete_callback + +/** + * Test that the function fails. + * + * @see f_thread_barrier_attributes_delete_callback_() + */ +extern void test__f_thread_barrier_attributes_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_thread_barrier_attributes_delete_callback_() + */ +extern void test__f_thread_barrier_attributes_delete_callback__works(void **state); + +#endif // _TEST__F_thread__barrier_attributes_delete_callback diff --git a/level_0/f_thread/tests/unit/c/test-thread-barrier_attributes_resize_callback.c b/level_0/f_thread/tests/unit/c/test-thread-barrier_attributes_destroy_callback.c similarity index 73% rename from level_0/f_thread/tests/unit/c/test-thread-barrier_attributes_resize_callback.c rename to level_0/f_thread/tests/unit/c/test-thread-barrier_attributes_destroy_callback.c index 8472f8c..6782da8 100644 --- a/level_0/f_thread/tests/unit/c/test-thread-barrier_attributes_resize_callback.c +++ b/level_0/f_thread/tests/unit/c/test-thread-barrier_attributes_destroy_callback.c @@ -1,11 +1,11 @@ #include "test-thread.h" -#include "test-thread-barrier_attributes_resize_callback.h" +#include "test-thread-barrier_attributes_destroy_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_thread_barrier_attributes_resize_callback__fails(void **state) { +void test__f_thread_barrier_attributes_destroy_callback__fails(void **state) { f_thread_barrier_attribute_t data = f_thread_barrier_attribute_t_initialize; f_thread_barrier_attribute_t data_array[] = { data }; @@ -27,13 +27,13 @@ void test__f_thread_barrier_attributes_resize_callback__fails(void **state) { will_return(__wrap_pthread_barrierattr_destroy, true); will_return(__wrap_pthread_barrierattr_destroy, errnos[i]); - const f_status_t status = f_thread_barrier_attributes_resize_callback(0, 1, (void *) datass_array); + const f_status_t status = f_thread_barrier_attributes_destroy_callback(0, 1, (void *) datass_array); assert_int_equal(status, statuss[i]); } // for } -void test__f_thread_barrier_attributes_resize_callback__works(void **state) { +void test__f_thread_barrier_attributes_destroy_callback__works(void **state) { f_thread_barrier_attribute_t data = f_thread_barrier_attribute_t_initialize; f_thread_barrier_attribute_t data_array[] = { data }; @@ -44,7 +44,7 @@ void test__f_thread_barrier_attributes_resize_callback__works(void **state) { { will_return(__wrap_pthread_barrierattr_destroy, false); - const f_status_t status = f_thread_barrier_attributes_resize_callback(0, length, (void *) datass_array); + const f_status_t status = f_thread_barrier_attributes_destroy_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_thread/tests/unit/c/test-thread-barrier_attributes_destroy_callback.h b/level_0/f_thread/tests/unit/c/test-thread-barrier_attributes_destroy_callback.h new file mode 100644 index 0000000..d61d276 --- /dev/null +++ b/level_0/f_thread/tests/unit/c/test-thread-barrier_attributes_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Thread + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_thread__barrier_attributes_destroy_callback +#define _TEST__F_thread__barrier_attributes_destroy_callback + +/** + * Test that the function fails. + * + * @see f_thread_barrier_attributes_destroy_callback_() + */ +extern void test__f_thread_barrier_attributes_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_thread_barrier_attributes_destroy_callback_() + */ +extern void test__f_thread_barrier_attributes_destroy_callback__works(void **state); + +#endif // _TEST__F_thread__barrier_attributes_destroy_callback diff --git a/level_0/f_thread/tests/unit/c/test-thread-barrier_attributes_resize_callback.h b/level_0/f_thread/tests/unit/c/test-thread-barrier_attributes_resize_callback.h deleted file mode 100644 index 5b636f8..0000000 --- a/level_0/f_thread/tests/unit/c/test-thread-barrier_attributes_resize_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Thread - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_thread__barrier_attributes_resize_callback -#define _TEST__F_thread__barrier_attributes_resize_callback - -/** - * Test that the function fails. - * - * @see f_thread_barrier_attributes_resize_callback_() - */ -extern void test__f_thread_barrier_attributes_resize_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_thread_barrier_attributes_resize_callback_() - */ -extern void test__f_thread_barrier_attributes_resize_callback__works(void **state); - -#endif // _TEST__F_thread__barrier_attributes_resize_callback diff --git a/level_0/f_thread/tests/unit/c/test-thread-barriers_adjust_callback.h b/level_0/f_thread/tests/unit/c/test-thread-barriers_adjust_callback.h deleted file mode 100644 index b17f657..0000000 --- a/level_0/f_thread/tests/unit/c/test-thread-barriers_adjust_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Thread - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_thread__barriers_adjust_callback -#define _TEST__F_thread__barriers_adjust_callback - -/** - * Test that the function fails. - * - * @see f_thread_barriers_adjust_callback_() - */ -extern void test__f_thread_barriers_adjust_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_thread_barriers_adjust_callback_() - */ -extern void test__f_thread_barriers_adjust_callback__works(void **state); - -#endif // _TEST__F_thread__barriers_adjust_callback diff --git a/level_0/f_thread/tests/unit/c/test-thread-barriers_resize_callback.c b/level_0/f_thread/tests/unit/c/test-thread-barriers_delete_callback.c similarity index 79% rename from level_0/f_thread/tests/unit/c/test-thread-barriers_resize_callback.c rename to level_0/f_thread/tests/unit/c/test-thread-barriers_delete_callback.c index 1bb278a..90c048d 100644 --- a/level_0/f_thread/tests/unit/c/test-thread-barriers_resize_callback.c +++ b/level_0/f_thread/tests/unit/c/test-thread-barriers_delete_callback.c @@ -1,11 +1,11 @@ #include "test-thread.h" -#include "test-thread-barriers_resize_callback.h" +#include "test-thread-barriers_delete_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_thread_barriers_resize_callback__fails(void **state) { +void test__f_thread_barriers_delete_callback__fails(void **state) { f_thread_barrier_t data = f_thread_barrier_t_initialize; f_thread_barrier_t data_array[] = { data }; @@ -28,13 +28,13 @@ void test__f_thread_barriers_resize_callback__fails(void **state) { will_return(__wrap_pthread_barrier_destroy, true); will_return(__wrap_pthread_barrier_destroy, errnos[i]); - const f_status_t status = f_thread_barriers_resize_callback(0, 1, (void *) datass_array); + const f_status_t status = f_thread_barriers_delete_callback(0, 1, (void *) datass_array); assert_int_equal(status, statuss[i]); } // for } -void test__f_thread_barriers_resize_callback__works(void **state) { +void test__f_thread_barriers_delete_callback__works(void **state) { f_thread_barrier_t data = f_thread_barrier_t_initialize; f_thread_barrier_t data_array[] = { data }; @@ -45,7 +45,7 @@ void test__f_thread_barriers_resize_callback__works(void **state) { { will_return(__wrap_pthread_barrier_destroy, false); - const f_status_t status = f_thread_barriers_resize_callback(0, length, (void *) datass_array); + const f_status_t status = f_thread_barriers_delete_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_thread/tests/unit/c/test-thread-barriers_delete_callback.h b/level_0/f_thread/tests/unit/c/test-thread-barriers_delete_callback.h new file mode 100644 index 0000000..0074342 --- /dev/null +++ b/level_0/f_thread/tests/unit/c/test-thread-barriers_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Thread + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_thread__barriers_delete_callback +#define _TEST__F_thread__barriers_delete_callback + +/** + * Test that the function fails. + * + * @see f_thread_barriers_delete_callback_() + */ +extern void test__f_thread_barriers_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_thread_barriers_delete_callback_() + */ +extern void test__f_thread_barriers_delete_callback__works(void **state); + +#endif // _TEST__F_thread__barriers_delete_callback diff --git a/level_0/f_thread/tests/unit/c/test-thread-barriers_adjust_callback.c b/level_0/f_thread/tests/unit/c/test-thread-barriers_destroy_callback.c similarity index 74% rename from level_0/f_thread/tests/unit/c/test-thread-barriers_adjust_callback.c rename to level_0/f_thread/tests/unit/c/test-thread-barriers_destroy_callback.c index 1712b0d..0a212a5 100644 --- a/level_0/f_thread/tests/unit/c/test-thread-barriers_adjust_callback.c +++ b/level_0/f_thread/tests/unit/c/test-thread-barriers_destroy_callback.c @@ -1,11 +1,11 @@ #include "test-thread.h" -#include "test-thread-barriers_adjust_callback.h" +#include "test-thread-barriers_destroy_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_thread_barriers_adjust_callback__fails(void **state) { +void test__f_thread_barriers_destroy_callback__fails(void **state) { f_thread_barrier_t data = f_thread_barrier_t_initialize; f_thread_barrier_t data_array[] = { data }; @@ -29,13 +29,13 @@ void test__f_thread_barriers_adjust_callback__fails(void **state) { will_return(__wrap_pthread_barrier_destroy, true); will_return(__wrap_pthread_barrier_destroy, errnos[i]); - const f_status_t status = f_thread_barriers_adjust_callback(0, 1, (void *) datass_array); + const f_status_t status = f_thread_barriers_destroy_callback(0, 1, (void *) datass_array); assert_int_equal(status, statuss[i]); } // for } -void test__f_thread_barriers_adjust_callback__works(void **state) { +void test__f_thread_barriers_destroy_callback__works(void **state) { f_thread_barrier_t data = f_thread_barrier_t_initialize; f_thread_barrier_t data_array[] = { data }; @@ -46,7 +46,7 @@ void test__f_thread_barriers_adjust_callback__works(void **state) { { will_return(__wrap_pthread_barrier_destroy, false); - const f_status_t status = f_thread_barriers_adjust_callback(0, length, (void *) datass_array); + const f_status_t status = f_thread_barriers_destroy_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_thread/tests/unit/c/test-thread-barriers_destroy_callback.h b/level_0/f_thread/tests/unit/c/test-thread-barriers_destroy_callback.h new file mode 100644 index 0000000..7806f49 --- /dev/null +++ b/level_0/f_thread/tests/unit/c/test-thread-barriers_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Thread + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_thread__barriers_destroy_callback +#define _TEST__F_thread__barriers_destroy_callback + +/** + * Test that the function fails. + * + * @see f_thread_barriers_destroy_callback_() + */ +extern void test__f_thread_barriers_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_thread_barriers_destroy_callback_() + */ +extern void test__f_thread_barriers_destroy_callback__works(void **state); + +#endif // _TEST__F_thread__barriers_destroy_callback diff --git a/level_0/f_thread/tests/unit/c/test-thread-barriers_resize_callback.h b/level_0/f_thread/tests/unit/c/test-thread-barriers_resize_callback.h deleted file mode 100644 index 3f62b4b..0000000 --- a/level_0/f_thread/tests/unit/c/test-thread-barriers_resize_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Thread - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_thread__barriers_resize_callback -#define _TEST__F_thread__barriers_resize_callback - -/** - * Test that the function fails. - * - * @see f_thread_barriers_resize_callback_() - */ -extern void test__f_thread_barriers_resize_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_thread_barriers_resize_callback_() - */ -extern void test__f_thread_barriers_resize_callback__works(void **state); - -#endif // _TEST__F_thread__barriers_resize_callback diff --git a/level_0/f_thread/tests/unit/c/test-thread-condition_attributes_adjust_callback.h b/level_0/f_thread/tests/unit/c/test-thread-condition_attributes_adjust_callback.h deleted file mode 100644 index 181edfb..0000000 --- a/level_0/f_thread/tests/unit/c/test-thread-condition_attributes_adjust_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Thread - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_thread__condition_attributes_adjust_callback -#define _TEST__F_thread__condition_attributes_adjust_callback - -/** - * Test that the function fails. - * - * @see f_thread_condition_attributes_adjust_callback_() - */ -extern void test__f_thread_condition_attributes_adjust_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_thread_condition_attributes_adjust_callback_() - */ -extern void test__f_thread_condition_attributes_adjust_callback__works(void **state); - -#endif // _TEST__F_thread__condition_attributes_adjust_callback diff --git a/level_0/f_thread/tests/unit/c/test-thread-condition_attributes_adjust_callback.c b/level_0/f_thread/tests/unit/c/test-thread-condition_attributes_delete_callback.c similarity index 76% rename from level_0/f_thread/tests/unit/c/test-thread-condition_attributes_adjust_callback.c rename to level_0/f_thread/tests/unit/c/test-thread-condition_attributes_delete_callback.c index f7c00d5..8c9d260 100644 --- a/level_0/f_thread/tests/unit/c/test-thread-condition_attributes_adjust_callback.c +++ b/level_0/f_thread/tests/unit/c/test-thread-condition_attributes_delete_callback.c @@ -1,11 +1,11 @@ #include "test-thread.h" -#include "test-thread-condition_attributes_adjust_callback.h" +#include "test-thread-condition_attributes_delete_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_thread_condition_attributes_adjust_callback__fails(void **state) { +void test__f_thread_condition_attributes_delete_callback__fails(void **state) { f_thread_condition_attribute_t data = f_thread_condition_attribute_t_initialize; f_thread_condition_attribute_t data_array[] = { data }; @@ -29,13 +29,13 @@ void test__f_thread_condition_attributes_adjust_callback__fails(void **state) { will_return(__wrap_pthread_condattr_destroy, true); will_return(__wrap_pthread_condattr_destroy, errnos[i]); - const f_status_t status = f_thread_condition_attributes_adjust_callback(0, 1, (void *) datass_array); + const f_status_t status = f_thread_condition_attributes_delete_callback(0, 1, (void *) datass_array); assert_int_equal(status, statuss[i]); } // for } -void test__f_thread_condition_attributes_adjust_callback__works(void **state) { +void test__f_thread_condition_attributes_delete_callback__works(void **state) { f_thread_condition_attribute_t data = f_thread_condition_attribute_t_initialize; f_thread_condition_attribute_t data_array[] = { data }; @@ -46,7 +46,7 @@ void test__f_thread_condition_attributes_adjust_callback__works(void **state) { { will_return(__wrap_pthread_condattr_destroy, false); - const f_status_t status = f_thread_condition_attributes_adjust_callback(0, length, (void *) datass_array); + const f_status_t status = f_thread_condition_attributes_delete_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_thread/tests/unit/c/test-thread-condition_attributes_delete_callback.h b/level_0/f_thread/tests/unit/c/test-thread-condition_attributes_delete_callback.h new file mode 100644 index 0000000..0ce22d4 --- /dev/null +++ b/level_0/f_thread/tests/unit/c/test-thread-condition_attributes_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Thread + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_thread__condition_attributes_delete_callback +#define _TEST__F_thread__condition_attributes_delete_callback + +/** + * Test that the function fails. + * + * @see f_thread_condition_attributes_delete_callback_() + */ +extern void test__f_thread_condition_attributes_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_thread_condition_attributes_delete_callback_() + */ +extern void test__f_thread_condition_attributes_delete_callback__works(void **state); + +#endif // _TEST__F_thread__condition_attributes_delete_callback diff --git a/level_0/f_thread/tests/unit/c/test-thread-condition_attributes_resize_callback.c b/level_0/f_thread/tests/unit/c/test-thread-condition_attributes_destroy_callback.c similarity index 74% rename from level_0/f_thread/tests/unit/c/test-thread-condition_attributes_resize_callback.c rename to level_0/f_thread/tests/unit/c/test-thread-condition_attributes_destroy_callback.c index 87e174c..624da17 100644 --- a/level_0/f_thread/tests/unit/c/test-thread-condition_attributes_resize_callback.c +++ b/level_0/f_thread/tests/unit/c/test-thread-condition_attributes_destroy_callback.c @@ -1,11 +1,11 @@ #include "test-thread.h" -#include "test-thread-condition_attributes_resize_callback.h" +#include "test-thread-condition_attributes_destroy_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_thread_condition_attributes_resize_callback__fails(void **state) { +void test__f_thread_condition_attributes_destroy_callback__fails(void **state) { f_thread_condition_attribute_t data = f_thread_condition_attribute_t_initialize; f_thread_condition_attribute_t data_array[] = { data }; @@ -29,13 +29,13 @@ void test__f_thread_condition_attributes_resize_callback__fails(void **state) { will_return(__wrap_pthread_condattr_destroy, true); will_return(__wrap_pthread_condattr_destroy, errnos[i]); - const f_status_t status = f_thread_condition_attributes_resize_callback(0, 1, (void *) datass_array); + const f_status_t status = f_thread_condition_attributes_destroy_callback(0, 1, (void *) datass_array); assert_int_equal(status, statuss[i]); } // for } -void test__f_thread_condition_attributes_resize_callback__works(void **state) { +void test__f_thread_condition_attributes_destroy_callback__works(void **state) { f_thread_condition_attribute_t data = f_thread_condition_attribute_t_initialize; f_thread_condition_attribute_t data_array[] = { data }; @@ -46,7 +46,7 @@ void test__f_thread_condition_attributes_resize_callback__works(void **state) { { will_return(__wrap_pthread_condattr_destroy, false); - const f_status_t status = f_thread_condition_attributes_resize_callback(0, length, (void *) datass_array); + const f_status_t status = f_thread_condition_attributes_destroy_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_thread/tests/unit/c/test-thread-condition_attributes_destroy_callback.h b/level_0/f_thread/tests/unit/c/test-thread-condition_attributes_destroy_callback.h new file mode 100644 index 0000000..5a4369b --- /dev/null +++ b/level_0/f_thread/tests/unit/c/test-thread-condition_attributes_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Thread + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_thread__condition_attributes_destroy_callback +#define _TEST__F_thread__condition_attributes_destroy_callback + +/** + * Test that the function fails. + * + * @see f_thread_condition_attributes_destroy_callback_() + */ +extern void test__f_thread_condition_attributes_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_thread_condition_attributes_destroy_callback_() + */ +extern void test__f_thread_condition_attributes_destroy_callback__works(void **state); + +#endif // _TEST__F_thread__condition_attributes_destroy_callback diff --git a/level_0/f_thread/tests/unit/c/test-thread-condition_attributes_resize_callback.h b/level_0/f_thread/tests/unit/c/test-thread-condition_attributes_resize_callback.h deleted file mode 100644 index dd63a80..0000000 --- a/level_0/f_thread/tests/unit/c/test-thread-condition_attributes_resize_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Thread - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_thread__condition_attributes_resize_callback -#define _TEST__F_thread__condition_attributes_resize_callback - -/** - * Test that the function fails. - * - * @see f_thread_condition_attributes_resize_callback_() - */ -extern void test__f_thread_condition_attributes_resize_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_thread_condition_attributes_resize_callback_() - */ -extern void test__f_thread_condition_attributes_resize_callback__works(void **state); - -#endif // _TEST__F_thread__condition_attributes_resize_callback diff --git a/level_0/f_thread/tests/unit/c/test-thread-conditions_adjust_callback.h b/level_0/f_thread/tests/unit/c/test-thread-conditions_adjust_callback.h deleted file mode 100644 index dfa578e..0000000 --- a/level_0/f_thread/tests/unit/c/test-thread-conditions_adjust_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Thread - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_thread__conditions_adjust_callback -#define _TEST__F_thread__conditions_adjust_callback - -/** - * Test that the function fails. - * - * @see f_thread_conditions_adjust_callback_() - */ -extern void test__f_thread_conditions_adjust_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_thread_conditions_adjust_callback_() - */ -extern void test__f_thread_conditions_adjust_callback__works(void **state); - -#endif // _TEST__F_thread__conditions_adjust_callback diff --git a/level_0/f_thread/tests/unit/c/test-thread-conditions_adjust_callback.c b/level_0/f_thread/tests/unit/c/test-thread-conditions_delete_callback.c similarity index 80% rename from level_0/f_thread/tests/unit/c/test-thread-conditions_adjust_callback.c rename to level_0/f_thread/tests/unit/c/test-thread-conditions_delete_callback.c index 9876422..62a56a1 100644 --- a/level_0/f_thread/tests/unit/c/test-thread-conditions_adjust_callback.c +++ b/level_0/f_thread/tests/unit/c/test-thread-conditions_delete_callback.c @@ -1,11 +1,11 @@ #include "test-thread.h" -#include "test-thread-conditions_adjust_callback.h" +#include "test-thread-conditions_delete_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_thread_conditions_adjust_callback__fails(void **state) { +void test__f_thread_conditions_delete_callback__fails(void **state) { f_thread_condition_t data = f_thread_condition_t_initialize; f_thread_condition_t data_array[] = { data }; @@ -29,13 +29,13 @@ void test__f_thread_conditions_adjust_callback__fails(void **state) { will_return(__wrap_pthread_cond_destroy, true); will_return(__wrap_pthread_cond_destroy, errnos[i]); - const f_status_t status = f_thread_conditions_adjust_callback(0, 1, (void *) datass_array); + const f_status_t status = f_thread_conditions_delete_callback(0, 1, (void *) datass_array); assert_int_equal(status, statuss[i]); } // for } -void test__f_thread_conditions_adjust_callback__works(void **state) { +void test__f_thread_conditions_delete_callback__works(void **state) { f_thread_condition_t data = f_thread_condition_t_initialize; f_thread_condition_t data_array[] = { data }; @@ -46,7 +46,7 @@ void test__f_thread_conditions_adjust_callback__works(void **state) { { will_return(__wrap_pthread_cond_destroy, false); - const f_status_t status = f_thread_conditions_adjust_callback(0, length, (void *) datass_array); + const f_status_t status = f_thread_conditions_delete_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_thread/tests/unit/c/test-thread-conditions_delete_callback.h b/level_0/f_thread/tests/unit/c/test-thread-conditions_delete_callback.h new file mode 100644 index 0000000..e781f52 --- /dev/null +++ b/level_0/f_thread/tests/unit/c/test-thread-conditions_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Thread + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_thread__conditions_delete_callback +#define _TEST__F_thread__conditions_delete_callback + +/** + * Test that the function fails. + * + * @see f_thread_conditions_delete_callback_() + */ +extern void test__f_thread_conditions_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_thread_conditions_delete_callback_() + */ +extern void test__f_thread_conditions_delete_callback__works(void **state); + +#endif // _TEST__F_thread__conditions_delete_callback diff --git a/level_0/f_thread/tests/unit/c/test-thread-conditions_resize_callback.c b/level_0/f_thread/tests/unit/c/test-thread-conditions_destroy_callback.c similarity index 74% rename from level_0/f_thread/tests/unit/c/test-thread-conditions_resize_callback.c rename to level_0/f_thread/tests/unit/c/test-thread-conditions_destroy_callback.c index ad6d92f..6c7a2ad 100644 --- a/level_0/f_thread/tests/unit/c/test-thread-conditions_resize_callback.c +++ b/level_0/f_thread/tests/unit/c/test-thread-conditions_destroy_callback.c @@ -1,11 +1,11 @@ #include "test-thread.h" -#include "test-thread-conditions_resize_callback.h" +#include "test-thread-conditions_destroy_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_thread_conditions_resize_callback__fails(void **state) { +void test__f_thread_conditions_destroy_callback__fails(void **state) { f_thread_condition_t data = f_thread_condition_t_initialize; f_thread_condition_t data_array[] = { data }; @@ -29,13 +29,13 @@ void test__f_thread_conditions_resize_callback__fails(void **state) { will_return(__wrap_pthread_cond_destroy, true); will_return(__wrap_pthread_cond_destroy, errnos[i]); - const f_status_t status = f_thread_conditions_resize_callback(0, 1, (void *) datass_array); + const f_status_t status = f_thread_conditions_destroy_callback(0, 1, (void *) datass_array); assert_int_equal(status, statuss[i]); } // for } -void test__f_thread_conditions_resize_callback__works(void **state) { +void test__f_thread_conditions_destroy_callback__works(void **state) { f_thread_condition_t data = f_thread_condition_t_initialize; f_thread_condition_t data_array[] = { data }; @@ -46,7 +46,7 @@ void test__f_thread_conditions_resize_callback__works(void **state) { { will_return(__wrap_pthread_cond_destroy, false); - const f_status_t status = f_thread_conditions_resize_callback(0, length, (void *) datass_array); + const f_status_t status = f_thread_conditions_destroy_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_thread/tests/unit/c/test-thread-conditions_destroy_callback.h b/level_0/f_thread/tests/unit/c/test-thread-conditions_destroy_callback.h new file mode 100644 index 0000000..c53ba87 --- /dev/null +++ b/level_0/f_thread/tests/unit/c/test-thread-conditions_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Thread + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_thread__conditions_destroy_callback +#define _TEST__F_thread__conditions_destroy_callback + +/** + * Test that the function fails. + * + * @see f_thread_conditions_destroy_callback_() + */ +extern void test__f_thread_conditions_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_thread_conditions_destroy_callback_() + */ +extern void test__f_thread_conditions_destroy_callback__works(void **state); + +#endif // _TEST__F_thread__conditions_destroy_callback diff --git a/level_0/f_thread/tests/unit/c/test-thread-conditions_resize_callback.h b/level_0/f_thread/tests/unit/c/test-thread-conditions_resize_callback.h deleted file mode 100644 index 61b23fa..0000000 --- a/level_0/f_thread/tests/unit/c/test-thread-conditions_resize_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Thread - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_thread__conditions_resize_callback -#define _TEST__F_thread__conditions_resize_callback - -/** - * Test that the function fails. - * - * @see f_thread_conditions_resize_callback_() - */ -extern void test__f_thread_conditions_resize_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_thread_conditions_resize_callback_() - */ -extern void test__f_thread_conditions_resize_callback__works(void **state); - -#endif // _TEST__F_thread__conditions_resize_callback diff --git a/level_0/f_thread/tests/unit/c/test-thread-keys_adjust_callback.h b/level_0/f_thread/tests/unit/c/test-thread-keys_adjust_callback.h deleted file mode 100644 index f9c1984..0000000 --- a/level_0/f_thread/tests/unit/c/test-thread-keys_adjust_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Thread - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_thread__keys_adjust_callback -#define _TEST__F_thread__keys_adjust_callback - -/** - * Test that the function fails. - * - * @see f_thread_keys_adjust_callback_() - */ -extern void test__f_thread_keys_adjust_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_thread_keys_adjust_callback_() - */ -extern void test__f_thread_keys_adjust_callback__works(void **state); - -#endif // _TEST__F_thread__keys_adjust_callback diff --git a/level_0/f_thread/tests/unit/c/test-thread-keys_adjust_callback.c b/level_0/f_thread/tests/unit/c/test-thread-keys_delete_callback.c similarity index 77% rename from level_0/f_thread/tests/unit/c/test-thread-keys_adjust_callback.c rename to level_0/f_thread/tests/unit/c/test-thread-keys_delete_callback.c index d84bf35..f046325 100644 --- a/level_0/f_thread/tests/unit/c/test-thread-keys_adjust_callback.c +++ b/level_0/f_thread/tests/unit/c/test-thread-keys_delete_callback.c @@ -1,11 +1,11 @@ #include "test-thread.h" -#include "test-thread-keys_adjust_callback.h" +#include "test-thread-keys_delete_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_thread_keys_adjust_callback__fails(void **state) { +void test__f_thread_keys_delete_callback__fails(void **state) { f_thread_key_t data = f_thread_key_t_initialize; f_thread_key_t data_array[] = { data }; @@ -26,13 +26,13 @@ void test__f_thread_keys_adjust_callback__fails(void **state) { will_return(__wrap_pthread_key_delete, errnos[i]); - const f_status_t status = f_thread_keys_adjust_callback(0, 1, (void *) datass_array); + const f_status_t status = f_thread_keys_delete_callback(0, 1, (void *) datass_array); assert_int_equal(status, statuss[i]); } // for } -void test__f_thread_keys_adjust_callback__works(void **state) { +void test__f_thread_keys_delete_callback__works(void **state) { f_thread_key_t data = f_thread_key_t_initialize; f_thread_key_t data_array[] = { data }; @@ -43,7 +43,7 @@ void test__f_thread_keys_adjust_callback__works(void **state) { { will_return(__wrap_pthread_key_delete, false); - const f_status_t status = f_thread_keys_adjust_callback(0, length, (void *) datass_array); + const f_status_t status = f_thread_keys_delete_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_thread/tests/unit/c/test-thread-keys_delete_callback.h b/level_0/f_thread/tests/unit/c/test-thread-keys_delete_callback.h new file mode 100644 index 0000000..edc641f --- /dev/null +++ b/level_0/f_thread/tests/unit/c/test-thread-keys_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Thread + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_thread__keys_delete_callback +#define _TEST__F_thread__keys_delete_callback + +/** + * Test that the function fails. + * + * @see f_thread_keys_delete_callback_() + */ +extern void test__f_thread_keys_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_thread_keys_delete_callback_() + */ +extern void test__f_thread_keys_delete_callback__works(void **state); + +#endif // _TEST__F_thread__keys_delete_callback diff --git a/level_0/f_thread/tests/unit/c/test-thread-keys_resize_callback.c b/level_0/f_thread/tests/unit/c/test-thread-keys_destroy_callback.c similarity index 73% rename from level_0/f_thread/tests/unit/c/test-thread-keys_resize_callback.c rename to level_0/f_thread/tests/unit/c/test-thread-keys_destroy_callback.c index 6e84644..b4740b1 100644 --- a/level_0/f_thread/tests/unit/c/test-thread-keys_resize_callback.c +++ b/level_0/f_thread/tests/unit/c/test-thread-keys_destroy_callback.c @@ -1,11 +1,11 @@ #include "test-thread.h" -#include "test-thread-keys_resize_callback.h" +#include "test-thread-keys_destroy_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_thread_keys_resize_callback__fails(void **state) { +void test__f_thread_keys_destroy_callback__fails(void **state) { f_thread_key_t data = f_thread_key_t_initialize; f_thread_key_t data_array[] = { data }; @@ -26,13 +26,13 @@ void test__f_thread_keys_resize_callback__fails(void **state) { will_return(__wrap_pthread_key_delete, errnos[i]); - const f_status_t status = f_thread_keys_resize_callback(0, 1, (void *) datass_array); + const f_status_t status = f_thread_keys_destroy_callback(0, 1, (void *) datass_array); assert_int_equal(status, statuss[i]); } // for } -void test__f_thread_keys_resize_callback__works(void **state) { +void test__f_thread_keys_destroy_callback__works(void **state) { f_thread_key_t data = f_thread_key_t_initialize; f_thread_key_t data_array[] = { data }; @@ -43,7 +43,7 @@ void test__f_thread_keys_resize_callback__works(void **state) { { will_return(__wrap_pthread_key_delete, false); - const f_status_t status = f_thread_keys_resize_callback(0, length, (void *) datass_array); + const f_status_t status = f_thread_keys_destroy_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_thread/tests/unit/c/test-thread-keys_destroy_callback.h b/level_0/f_thread/tests/unit/c/test-thread-keys_destroy_callback.h new file mode 100644 index 0000000..177e906 --- /dev/null +++ b/level_0/f_thread/tests/unit/c/test-thread-keys_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Thread + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_thread__keys_destroy_callback +#define _TEST__F_thread__keys_destroy_callback + +/** + * Test that the function fails. + * + * @see f_thread_keys_destroy_callback_() + */ +extern void test__f_thread_keys_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_thread_keys_destroy_callback_() + */ +extern void test__f_thread_keys_destroy_callback__works(void **state); + +#endif // _TEST__F_thread__keys_destroy_callback diff --git a/level_0/f_thread/tests/unit/c/test-thread-keys_resize_callback.h b/level_0/f_thread/tests/unit/c/test-thread-keys_resize_callback.h deleted file mode 100644 index 142f33b..0000000 --- a/level_0/f_thread/tests/unit/c/test-thread-keys_resize_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Thread - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_thread__keys_resize_callback -#define _TEST__F_thread__keys_resize_callback - -/** - * Test that the function fails. - * - * @see f_thread_keys_resize_callback_() - */ -extern void test__f_thread_keys_resize_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_thread_keys_resize_callback_() - */ -extern void test__f_thread_keys_resize_callback__works(void **state); - -#endif // _TEST__F_thread__keys_resize_callback diff --git a/level_0/f_thread/tests/unit/c/test-thread-lock_attributes_adjust_callback.h b/level_0/f_thread/tests/unit/c/test-thread-lock_attributes_adjust_callback.h deleted file mode 100644 index 40d1b9a..0000000 --- a/level_0/f_thread/tests/unit/c/test-thread-lock_attributes_adjust_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Thread - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_thread__lock_attributes_adjust_callback -#define _TEST__F_thread__lock_attributes_adjust_callback - -/** - * Test that the function fails. - * - * @see f_thread_lock_attributes_adjust_callback_() - */ -extern void test__f_thread_lock_attributes_adjust_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_thread_lock_attributes_adjust_callback_() - */ -extern void test__f_thread_lock_attributes_adjust_callback__works(void **state); - -#endif // _TEST__F_thread__lock_attributes_adjust_callback diff --git a/level_0/f_thread/tests/unit/c/test-thread-lock_attributes_resize_callback.c b/level_0/f_thread/tests/unit/c/test-thread-lock_attributes_delete_callback.c similarity index 80% rename from level_0/f_thread/tests/unit/c/test-thread-lock_attributes_resize_callback.c rename to level_0/f_thread/tests/unit/c/test-thread-lock_attributes_delete_callback.c index 37dc6bd..ddfe6dc 100644 --- a/level_0/f_thread/tests/unit/c/test-thread-lock_attributes_resize_callback.c +++ b/level_0/f_thread/tests/unit/c/test-thread-lock_attributes_delete_callback.c @@ -1,11 +1,11 @@ #include "test-thread.h" -#include "test-thread-lock_attributes_resize_callback.h" +#include "test-thread-lock_attributes_delete_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_thread_lock_attributes_resize_callback__fails(void **state) { +void test__f_thread_lock_attributes_delete_callback__fails(void **state) { f_thread_lock_attribute_t data = f_thread_lock_attribute_t_initialize; f_thread_lock_attribute_t data_array[] = { data }; @@ -29,13 +29,13 @@ void test__f_thread_lock_attributes_resize_callback__fails(void **state) { will_return(__wrap_pthread_rwlockattr_destroy, true); will_return(__wrap_pthread_rwlockattr_destroy, errnos[i]); - const f_status_t status = f_thread_lock_attributes_resize_callback(0, 1, (void *) datass_array); + const f_status_t status = f_thread_lock_attributes_delete_callback(0, 1, (void *) datass_array); assert_int_equal(status, statuss[i]); } // for } -void test__f_thread_lock_attributes_resize_callback__works(void **state) { +void test__f_thread_lock_attributes_delete_callback__works(void **state) { f_thread_lock_attribute_t data = f_thread_lock_attribute_t_initialize; f_thread_lock_attribute_t data_array[] = { data }; @@ -46,7 +46,7 @@ void test__f_thread_lock_attributes_resize_callback__works(void **state) { { will_return(__wrap_pthread_rwlockattr_destroy, false); - const f_status_t status = f_thread_lock_attributes_resize_callback(0, length, (void *) datass_array); + const f_status_t status = f_thread_lock_attributes_delete_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_thread/tests/unit/c/test-thread-lock_attributes_delete_callback.h b/level_0/f_thread/tests/unit/c/test-thread-lock_attributes_delete_callback.h new file mode 100644 index 0000000..74daae5 --- /dev/null +++ b/level_0/f_thread/tests/unit/c/test-thread-lock_attributes_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Thread + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_thread__lock_attributes_delete_callback +#define _TEST__F_thread__lock_attributes_delete_callback + +/** + * Test that the function fails. + * + * @see f_thread_lock_attributes_delete_callback_() + */ +extern void test__f_thread_lock_attributes_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_thread_lock_attributes_delete_callback_() + */ +extern void test__f_thread_lock_attributes_delete_callback__works(void **state); + +#endif // _TEST__F_thread__lock_attributes_delete_callback diff --git a/level_0/f_thread/tests/unit/c/test-thread-lock_attributes_adjust_callback.c b/level_0/f_thread/tests/unit/c/test-thread-lock_attributes_destroy_callback.c similarity index 74% rename from level_0/f_thread/tests/unit/c/test-thread-lock_attributes_adjust_callback.c rename to level_0/f_thread/tests/unit/c/test-thread-lock_attributes_destroy_callback.c index 83be29a..cdfc8a1 100644 --- a/level_0/f_thread/tests/unit/c/test-thread-lock_attributes_adjust_callback.c +++ b/level_0/f_thread/tests/unit/c/test-thread-lock_attributes_destroy_callback.c @@ -1,11 +1,11 @@ #include "test-thread.h" -#include "test-thread-lock_attributes_adjust_callback.h" +#include "test-thread-lock_attributes_destroy_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_thread_lock_attributes_adjust_callback__fails(void **state) { +void test__f_thread_lock_attributes_destroy_callback__fails(void **state) { f_thread_lock_attribute_t data = f_thread_lock_attribute_t_initialize; f_thread_lock_attribute_t data_array[] = { data }; @@ -29,13 +29,13 @@ void test__f_thread_lock_attributes_adjust_callback__fails(void **state) { will_return(__wrap_pthread_rwlockattr_destroy, true); will_return(__wrap_pthread_rwlockattr_destroy, errnos[i]); - const f_status_t status = f_thread_lock_attributes_adjust_callback(0, 1, (void *) datass_array); + const f_status_t status = f_thread_lock_attributes_destroy_callback(0, 1, (void *) datass_array); assert_int_equal(status, statuss[i]); } // for } -void test__f_thread_lock_attributes_adjust_callback__works(void **state) { +void test__f_thread_lock_attributes_destroy_callback__works(void **state) { f_thread_lock_attribute_t data = f_thread_lock_attribute_t_initialize; f_thread_lock_attribute_t data_array[] = { data }; @@ -46,7 +46,7 @@ void test__f_thread_lock_attributes_adjust_callback__works(void **state) { { will_return(__wrap_pthread_rwlockattr_destroy, false); - const f_status_t status = f_thread_lock_attributes_adjust_callback(0, length, (void *) datass_array); + const f_status_t status = f_thread_lock_attributes_destroy_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_thread/tests/unit/c/test-thread-lock_attributes_destroy_callback.h b/level_0/f_thread/tests/unit/c/test-thread-lock_attributes_destroy_callback.h new file mode 100644 index 0000000..84a3036 --- /dev/null +++ b/level_0/f_thread/tests/unit/c/test-thread-lock_attributes_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Thread + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_thread__lock_attributes_destroy_callback +#define _TEST__F_thread__lock_attributes_destroy_callback + +/** + * Test that the function fails. + * + * @see f_thread_lock_attributes_destroy_callback_() + */ +extern void test__f_thread_lock_attributes_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_thread_lock_attributes_destroy_callback_() + */ +extern void test__f_thread_lock_attributes_destroy_callback__works(void **state); + +#endif // _TEST__F_thread__lock_attributes_destroy_callback diff --git a/level_0/f_thread/tests/unit/c/test-thread-lock_attributes_resize_callback.h b/level_0/f_thread/tests/unit/c/test-thread-lock_attributes_resize_callback.h deleted file mode 100644 index 5854895..0000000 --- a/level_0/f_thread/tests/unit/c/test-thread-lock_attributes_resize_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Thread - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_thread__lock_attributes_resize_callback -#define _TEST__F_thread__lock_attributes_resize_callback - -/** - * Test that the function fails. - * - * @see f_thread_lock_attributes_resize_callback_() - */ -extern void test__f_thread_lock_attributes_resize_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_thread_lock_attributes_resize_callback_() - */ -extern void test__f_thread_lock_attributes_resize_callback__works(void **state); - -#endif // _TEST__F_thread__lock_attributes_resize_callback diff --git a/level_0/f_thread/tests/unit/c/test-thread-locks_adjust_callback.h b/level_0/f_thread/tests/unit/c/test-thread-locks_adjust_callback.h deleted file mode 100644 index d3a3e48..0000000 --- a/level_0/f_thread/tests/unit/c/test-thread-locks_adjust_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Thread - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_thread__locks_adjust_callback -#define _TEST__F_thread__locks_adjust_callback - -/** - * Test that the function fails. - * - * @see f_thread_locks_adjust_callback_() - */ -extern void test__f_thread_locks_adjust_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_thread_locks_adjust_callback_() - */ -extern void test__f_thread_locks_adjust_callback__works(void **state); - -#endif // _TEST__F_thread__locks_adjust_callback diff --git a/level_0/f_thread/tests/unit/c/test-thread-locks_adjust_callback.c b/level_0/f_thread/tests/unit/c/test-thread-locks_delete_callback.c similarity index 79% rename from level_0/f_thread/tests/unit/c/test-thread-locks_adjust_callback.c rename to level_0/f_thread/tests/unit/c/test-thread-locks_delete_callback.c index ae1d1cc..7eee359 100644 --- a/level_0/f_thread/tests/unit/c/test-thread-locks_adjust_callback.c +++ b/level_0/f_thread/tests/unit/c/test-thread-locks_delete_callback.c @@ -1,11 +1,11 @@ #include "test-thread.h" -#include "test-thread-locks_adjust_callback.h" +#include "test-thread-locks_delete_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_thread_locks_adjust_callback__fails(void **state) { +void test__f_thread_locks_delete_callback__fails(void **state) { f_thread_lock_t data = f_thread_lock_t_initialize; f_thread_lock_t data_array[] = { data }; @@ -29,13 +29,13 @@ void test__f_thread_locks_adjust_callback__fails(void **state) { will_return(__wrap_pthread_rwlock_destroy, true); will_return(__wrap_pthread_rwlock_destroy, errnos[i]); - const f_status_t status = f_thread_locks_adjust_callback(0, 1, (void *) datass_array); + const f_status_t status = f_thread_locks_delete_callback(0, 1, (void *) datass_array); assert_int_equal(status, statuss[i]); } // for } -void test__f_thread_locks_adjust_callback__works(void **state) { +void test__f_thread_locks_delete_callback__works(void **state) { f_thread_lock_t data = f_thread_lock_t_initialize; f_thread_lock_t data_array[] = { data }; @@ -46,7 +46,7 @@ void test__f_thread_locks_adjust_callback__works(void **state) { { will_return(__wrap_pthread_rwlock_destroy, false); - const f_status_t status = f_thread_locks_adjust_callback(0, length, (void *) datass_array); + const f_status_t status = f_thread_locks_delete_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_thread/tests/unit/c/test-thread-locks_delete_callback.h b/level_0/f_thread/tests/unit/c/test-thread-locks_delete_callback.h new file mode 100644 index 0000000..38691a8 --- /dev/null +++ b/level_0/f_thread/tests/unit/c/test-thread-locks_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Thread + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_thread__locks_delete_callback +#define _TEST__F_thread__locks_delete_callback + +/** + * Test that the function fails. + * + * @see f_thread_locks_delete_callback_() + */ +extern void test__f_thread_locks_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_thread_locks_delete_callback_() + */ +extern void test__f_thread_locks_delete_callback__works(void **state); + +#endif // _TEST__F_thread__locks_delete_callback diff --git a/level_0/f_thread/tests/unit/c/test-thread-locks_resize_callback.c b/level_0/f_thread/tests/unit/c/test-thread-locks_destroy_callback.c similarity index 75% rename from level_0/f_thread/tests/unit/c/test-thread-locks_resize_callback.c rename to level_0/f_thread/tests/unit/c/test-thread-locks_destroy_callback.c index a036c91..f2923b6 100644 --- a/level_0/f_thread/tests/unit/c/test-thread-locks_resize_callback.c +++ b/level_0/f_thread/tests/unit/c/test-thread-locks_destroy_callback.c @@ -1,11 +1,11 @@ #include "test-thread.h" -#include "test-thread-locks_resize_callback.h" +#include "test-thread-locks_destroy_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_thread_locks_resize_callback__fails(void **state) { +void test__f_thread_locks_destroy_callback__fails(void **state) { f_thread_lock_t data = f_thread_lock_t_initialize; f_thread_lock_t data_array[] = { data }; @@ -29,13 +29,13 @@ void test__f_thread_locks_resize_callback__fails(void **state) { will_return(__wrap_pthread_rwlock_destroy, true); will_return(__wrap_pthread_rwlock_destroy, errnos[i]); - const f_status_t status = f_thread_locks_resize_callback(0, 1, (void *) datass_array); + const f_status_t status = f_thread_locks_destroy_callback(0, 1, (void *) datass_array); assert_int_equal(status, statuss[i]); } // for } -void test__f_thread_locks_resize_callback__works(void **state) { +void test__f_thread_locks_destroy_callback__works(void **state) { f_thread_lock_t data = f_thread_lock_t_initialize; f_thread_lock_t data_array[] = { data }; @@ -46,7 +46,7 @@ void test__f_thread_locks_resize_callback__works(void **state) { { will_return(__wrap_pthread_rwlock_destroy, false); - const f_status_t status = f_thread_locks_resize_callback(0, length, (void *) datass_array); + const f_status_t status = f_thread_locks_destroy_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_thread/tests/unit/c/test-thread-locks_destroy_callback.h b/level_0/f_thread/tests/unit/c/test-thread-locks_destroy_callback.h new file mode 100644 index 0000000..479078e --- /dev/null +++ b/level_0/f_thread/tests/unit/c/test-thread-locks_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Thread + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_thread__locks_destroy_callback +#define _TEST__F_thread__locks_destroy_callback + +/** + * Test that the function fails. + * + * @see f_thread_locks_destroy_callback_() + */ +extern void test__f_thread_locks_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_thread_locks_destroy_callback_() + */ +extern void test__f_thread_locks_destroy_callback__works(void **state); + +#endif // _TEST__F_thread__locks_destroy_callback diff --git a/level_0/f_thread/tests/unit/c/test-thread-locks_resize_callback.h b/level_0/f_thread/tests/unit/c/test-thread-locks_resize_callback.h deleted file mode 100644 index bd5bd5f..0000000 --- a/level_0/f_thread/tests/unit/c/test-thread-locks_resize_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Thread - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_thread__locks_resize_callback -#define _TEST__F_thread__locks_resize_callback - -/** - * Test that the function fails. - * - * @see f_thread_locks_resize_callback_() - */ -extern void test__f_thread_locks_resize_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_thread_locks_resize_callback_() - */ -extern void test__f_thread_locks_resize_callback__works(void **state); - -#endif // _TEST__F_thread__locks_resize_callback diff --git a/level_0/f_thread/tests/unit/c/test-thread-mutex_attributes_adjust_callback.h b/level_0/f_thread/tests/unit/c/test-thread-mutex_attributes_adjust_callback.h deleted file mode 100644 index d9f9a2d..0000000 --- a/level_0/f_thread/tests/unit/c/test-thread-mutex_attributes_adjust_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Thread - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_thread__mutex_attributes_adjust_callback -#define _TEST__F_thread__mutex_attributes_adjust_callback - -/** - * Test that the function fails. - * - * @see f_thread_mutex_attributes_adjust_callback_() - */ -extern void test__f_thread_mutex_attributes_adjust_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_thread_mutex_attributes_adjust_callback_() - */ -extern void test__f_thread_mutex_attributes_adjust_callback__works(void **state); - -#endif // _TEST__F_thread__mutex_attributes_adjust_callback diff --git a/level_0/f_thread/tests/unit/c/test-thread-mutex_attributes_adjust_callback.c b/level_0/f_thread/tests/unit/c/test-thread-mutex_attributes_delete_callback.c similarity index 80% rename from level_0/f_thread/tests/unit/c/test-thread-mutex_attributes_adjust_callback.c rename to level_0/f_thread/tests/unit/c/test-thread-mutex_attributes_delete_callback.c index 8600d9b..b0030ee 100644 --- a/level_0/f_thread/tests/unit/c/test-thread-mutex_attributes_adjust_callback.c +++ b/level_0/f_thread/tests/unit/c/test-thread-mutex_attributes_delete_callback.c @@ -1,11 +1,11 @@ #include "test-thread.h" -#include "test-thread-mutex_attributes_adjust_callback.h" +#include "test-thread-mutex_attributes_delete_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_thread_mutex_attributes_adjust_callback__fails(void **state) { +void test__f_thread_mutex_attributes_delete_callback__fails(void **state) { f_thread_mutex_attribute_t data = f_thread_mutex_attribute_t_initialize; f_thread_mutex_attribute_t data_array[] = { data }; @@ -29,13 +29,13 @@ void test__f_thread_mutex_attributes_adjust_callback__fails(void **state) { will_return(__wrap_pthread_mutexattr_destroy, true); will_return(__wrap_pthread_mutexattr_destroy, errnos[i]); - const f_status_t status = f_thread_mutex_attributes_adjust_callback(0, 1, (void *) datass_array); + const f_status_t status = f_thread_mutex_attributes_delete_callback(0, 1, (void *) datass_array); assert_int_equal(status, statuss[i]); } // for } -void test__f_thread_mutex_attributes_adjust_callback__works(void **state) { +void test__f_thread_mutex_attributes_delete_callback__works(void **state) { f_thread_mutex_attribute_t data = f_thread_mutex_attribute_t_initialize; f_thread_mutex_attribute_t data_array[] = { data }; @@ -46,7 +46,7 @@ void test__f_thread_mutex_attributes_adjust_callback__works(void **state) { { will_return(__wrap_pthread_mutexattr_destroy, false); - const f_status_t status = f_thread_mutex_attributes_adjust_callback(0, length, (void *) datass_array); + const f_status_t status = f_thread_mutex_attributes_delete_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_thread/tests/unit/c/test-thread-mutex_attributes_delete_callback.h b/level_0/f_thread/tests/unit/c/test-thread-mutex_attributes_delete_callback.h new file mode 100644 index 0000000..8d5698a --- /dev/null +++ b/level_0/f_thread/tests/unit/c/test-thread-mutex_attributes_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Thread + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_thread__mutex_attributes_delete_callback +#define _TEST__F_thread__mutex_attributes_delete_callback + +/** + * Test that the function fails. + * + * @see f_thread_mutex_attributes_delete_callback_() + */ +extern void test__f_thread_mutex_attributes_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_thread_mutex_attributes_delete_callback_() + */ +extern void test__f_thread_mutex_attributes_delete_callback__works(void **state); + +#endif // _TEST__F_thread__mutex_attributes_delete_callback diff --git a/level_0/f_thread/tests/unit/c/test-thread-mutex_attributes_resize_callback.c b/level_0/f_thread/tests/unit/c/test-thread-mutex_attributes_destroy_callback.c similarity index 74% rename from level_0/f_thread/tests/unit/c/test-thread-mutex_attributes_resize_callback.c rename to level_0/f_thread/tests/unit/c/test-thread-mutex_attributes_destroy_callback.c index 4fe73e8..ea5de10 100644 --- a/level_0/f_thread/tests/unit/c/test-thread-mutex_attributes_resize_callback.c +++ b/level_0/f_thread/tests/unit/c/test-thread-mutex_attributes_destroy_callback.c @@ -1,11 +1,11 @@ #include "test-thread.h" -#include "test-thread-mutex_attributes_resize_callback.h" +#include "test-thread-mutex_attributes_destroy_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_thread_mutex_attributes_resize_callback__fails(void **state) { +void test__f_thread_mutex_attributes_destroy_callback__fails(void **state) { f_thread_mutex_attribute_t data = f_thread_mutex_attribute_t_initialize; f_thread_mutex_attribute_t data_array[] = { data }; @@ -29,13 +29,13 @@ void test__f_thread_mutex_attributes_resize_callback__fails(void **state) { will_return(__wrap_pthread_mutexattr_destroy, true); will_return(__wrap_pthread_mutexattr_destroy, errnos[i]); - const f_status_t status = f_thread_mutex_attributes_resize_callback(0, 1, (void *) datass_array); + const f_status_t status = f_thread_mutex_attributes_destroy_callback(0, 1, (void *) datass_array); assert_int_equal(status, statuss[i]); } // for } -void test__f_thread_mutex_attributes_resize_callback__works(void **state) { +void test__f_thread_mutex_attributes_destroy_callback__works(void **state) { f_thread_mutex_attribute_t data = f_thread_mutex_attribute_t_initialize; f_thread_mutex_attribute_t data_array[] = { data }; @@ -46,7 +46,7 @@ void test__f_thread_mutex_attributes_resize_callback__works(void **state) { { will_return(__wrap_pthread_mutexattr_destroy, false); - const f_status_t status = f_thread_mutex_attributes_resize_callback(0, length, (void *) datass_array); + const f_status_t status = f_thread_mutex_attributes_destroy_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_thread/tests/unit/c/test-thread-mutex_attributes_destroy_callback.h b/level_0/f_thread/tests/unit/c/test-thread-mutex_attributes_destroy_callback.h new file mode 100644 index 0000000..dd4a1a3 --- /dev/null +++ b/level_0/f_thread/tests/unit/c/test-thread-mutex_attributes_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Thread + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_thread__mutex_attributes_destroy_callback +#define _TEST__F_thread__mutex_attributes_destroy_callback + +/** + * Test that the function fails. + * + * @see f_thread_mutex_attributes_destroy_callback_() + */ +extern void test__f_thread_mutex_attributes_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_thread_mutex_attributes_destroy_callback_() + */ +extern void test__f_thread_mutex_attributes_destroy_callback__works(void **state); + +#endif // _TEST__F_thread__mutex_attributes_destroy_callback diff --git a/level_0/f_thread/tests/unit/c/test-thread-mutex_attributes_resize_callback.h b/level_0/f_thread/tests/unit/c/test-thread-mutex_attributes_resize_callback.h deleted file mode 100644 index ac25fd1..0000000 --- a/level_0/f_thread/tests/unit/c/test-thread-mutex_attributes_resize_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Thread - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_thread__mutex_attributes_resize_callback -#define _TEST__F_thread__mutex_attributes_resize_callback - -/** - * Test that the function fails. - * - * @see f_thread_mutex_attributes_resize_callback_() - */ -extern void test__f_thread_mutex_attributes_resize_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_thread_mutex_attributes_resize_callback_() - */ -extern void test__f_thread_mutex_attributes_resize_callback__works(void **state); - -#endif // _TEST__F_thread__mutex_attributes_resize_callback diff --git a/level_0/f_thread/tests/unit/c/test-thread-mutexs_adjust_callback.h b/level_0/f_thread/tests/unit/c/test-thread-mutexs_adjust_callback.h deleted file mode 100644 index fcd4c45..0000000 --- a/level_0/f_thread/tests/unit/c/test-thread-mutexs_adjust_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Thread - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_thread__mutexs_adjust_callback -#define _TEST__F_thread__mutexs_adjust_callback - -/** - * Test that the function fails. - * - * @see f_thread_mutexs_adjust_callback_() - */ -extern void test__f_thread_mutexs_adjust_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_thread_mutexs_adjust_callback_() - */ -extern void test__f_thread_mutexs_adjust_callback__works(void **state); - -#endif // _TEST__F_thread__mutexs_adjust_callback diff --git a/level_0/f_thread/tests/unit/c/test-thread-mutexs_resize_callback.c b/level_0/f_thread/tests/unit/c/test-thread-mutexs_delete_callback.c similarity index 79% rename from level_0/f_thread/tests/unit/c/test-thread-mutexs_resize_callback.c rename to level_0/f_thread/tests/unit/c/test-thread-mutexs_delete_callback.c index 5cf9357..683a308 100644 --- a/level_0/f_thread/tests/unit/c/test-thread-mutexs_resize_callback.c +++ b/level_0/f_thread/tests/unit/c/test-thread-mutexs_delete_callback.c @@ -1,11 +1,11 @@ #include "test-thread.h" -#include "test-thread-mutexs_resize_callback.h" +#include "test-thread-mutexs_delete_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_thread_mutexs_resize_callback__fails(void **state) { +void test__f_thread_mutexs_delete_callback__fails(void **state) { f_thread_mutex_t data = f_thread_mutex_t_initialize; f_thread_mutex_t data_array[] = { data }; @@ -29,13 +29,13 @@ void test__f_thread_mutexs_resize_callback__fails(void **state) { will_return(__wrap_pthread_mutex_destroy, true); will_return(__wrap_pthread_mutex_destroy, errnos[i]); - const f_status_t status = f_thread_mutexs_resize_callback(0, 1, (void *) datass_array); + const f_status_t status = f_thread_mutexs_delete_callback(0, 1, (void *) datass_array); assert_int_equal(status, statuss[i]); } // for } -void test__f_thread_mutexs_resize_callback__works(void **state) { +void test__f_thread_mutexs_delete_callback__works(void **state) { f_thread_mutex_t data = f_thread_mutex_t_initialize; f_thread_mutex_t data_array[] = { data }; @@ -46,7 +46,7 @@ void test__f_thread_mutexs_resize_callback__works(void **state) { { will_return(__wrap_pthread_mutex_destroy, false); - const f_status_t status = f_thread_mutexs_resize_callback(0, length, (void *) datass_array); + const f_status_t status = f_thread_mutexs_delete_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_thread/tests/unit/c/test-thread-mutexs_delete_callback.h b/level_0/f_thread/tests/unit/c/test-thread-mutexs_delete_callback.h new file mode 100644 index 0000000..50d724f --- /dev/null +++ b/level_0/f_thread/tests/unit/c/test-thread-mutexs_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Thread + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_thread__mutexs_delete_callback +#define _TEST__F_thread__mutexs_delete_callback + +/** + * Test that the function fails. + * + * @see f_thread_mutexs_delete_callback_() + */ +extern void test__f_thread_mutexs_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_thread_mutexs_delete_callback_() + */ +extern void test__f_thread_mutexs_delete_callback__works(void **state); + +#endif // _TEST__F_thread__mutexs_delete_callback diff --git a/level_0/f_thread/tests/unit/c/test-thread-mutexs_adjust_callback.c b/level_0/f_thread/tests/unit/c/test-thread-mutexs_destroy_callback.c similarity index 74% rename from level_0/f_thread/tests/unit/c/test-thread-mutexs_adjust_callback.c rename to level_0/f_thread/tests/unit/c/test-thread-mutexs_destroy_callback.c index 4513def..bb688f0 100644 --- a/level_0/f_thread/tests/unit/c/test-thread-mutexs_adjust_callback.c +++ b/level_0/f_thread/tests/unit/c/test-thread-mutexs_destroy_callback.c @@ -1,11 +1,11 @@ #include "test-thread.h" -#include "test-thread-mutexs_adjust_callback.h" +#include "test-thread-mutexs_destroy_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_thread_mutexs_adjust_callback__fails(void **state) { +void test__f_thread_mutexs_destroy_callback__fails(void **state) { f_thread_mutex_t data = f_thread_mutex_t_initialize; f_thread_mutex_t data_array[] = { data }; @@ -29,13 +29,13 @@ void test__f_thread_mutexs_adjust_callback__fails(void **state) { will_return(__wrap_pthread_mutex_destroy, true); will_return(__wrap_pthread_mutex_destroy, errnos[i]); - const f_status_t status = f_thread_mutexs_adjust_callback(0, 1, (void *) datass_array); + const f_status_t status = f_thread_mutexs_destroy_callback(0, 1, (void *) datass_array); assert_int_equal(status, statuss[i]); } // for } -void test__f_thread_mutexs_adjust_callback__works(void **state) { +void test__f_thread_mutexs_destroy_callback__works(void **state) { f_thread_mutex_t data = f_thread_mutex_t_initialize; f_thread_mutex_t data_array[] = { data }; @@ -46,7 +46,7 @@ void test__f_thread_mutexs_adjust_callback__works(void **state) { { will_return(__wrap_pthread_mutex_destroy, false); - const f_status_t status = f_thread_mutexs_adjust_callback(0, length, (void *) datass_array); + const f_status_t status = f_thread_mutexs_destroy_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_thread/tests/unit/c/test-thread-mutexs_destroy_callback.h b/level_0/f_thread/tests/unit/c/test-thread-mutexs_destroy_callback.h new file mode 100644 index 0000000..7d1c3df --- /dev/null +++ b/level_0/f_thread/tests/unit/c/test-thread-mutexs_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Thread + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_thread__mutexs_destroy_callback +#define _TEST__F_thread__mutexs_destroy_callback + +/** + * Test that the function fails. + * + * @see f_thread_mutexs_destroy_callback_() + */ +extern void test__f_thread_mutexs_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_thread_mutexs_destroy_callback_() + */ +extern void test__f_thread_mutexs_destroy_callback__works(void **state); + +#endif // _TEST__F_thread__mutexs_destroy_callback diff --git a/level_0/f_thread/tests/unit/c/test-thread-mutexs_resize_callback.h b/level_0/f_thread/tests/unit/c/test-thread-mutexs_resize_callback.h deleted file mode 100644 index 7a1bb26..0000000 --- a/level_0/f_thread/tests/unit/c/test-thread-mutexs_resize_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Thread - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_thread__mutexs_resize_callback -#define _TEST__F_thread__mutexs_resize_callback - -/** - * Test that the function fails. - * - * @see f_thread_mutexs_resize_callback_() - */ -extern void test__f_thread_mutexs_resize_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_thread_mutexs_resize_callback_() - */ -extern void test__f_thread_mutexs_resize_callback__works(void **state); - -#endif // _TEST__F_thread__mutexs_resize_callback diff --git a/level_0/f_thread/tests/unit/c/test-thread-onces_adjust_callback.h b/level_0/f_thread/tests/unit/c/test-thread-onces_adjust_callback.h deleted file mode 100644 index fe51cd7..0000000 --- a/level_0/f_thread/tests/unit/c/test-thread-onces_adjust_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Thread - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_thread__onces_adjust_callback -#define _TEST__F_thread__onces_adjust_callback - -/** - * Test that the function fails. - * - * @see f_thread_onces_adjust_callback_() - */ -extern void test__f_thread_onces_adjust_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_thread_onces_adjust_callback_() - */ -extern void test__f_thread_onces_adjust_callback__works(void **state); - -#endif // _TEST__F_thread__onces_adjust_callback diff --git a/level_0/f_thread/tests/unit/c/test-thread-onces_adjust_callback.c b/level_0/f_thread/tests/unit/c/test-thread-onces_delete_callback.c similarity index 78% rename from level_0/f_thread/tests/unit/c/test-thread-onces_adjust_callback.c rename to level_0/f_thread/tests/unit/c/test-thread-onces_delete_callback.c index 10e99da..06d1d7e 100644 --- a/level_0/f_thread/tests/unit/c/test-thread-onces_adjust_callback.c +++ b/level_0/f_thread/tests/unit/c/test-thread-onces_delete_callback.c @@ -1,11 +1,11 @@ #include "test-thread.h" -#include "test-thread-onces_adjust_callback.h" +#include "test-thread-onces_delete_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_thread_onces_adjust_callback__fails(void **state) { +void test__f_thread_onces_delete_callback__fails(void **state) { f_thread_once_t data = f_thread_once_t_initialize; f_thread_once_t data_array[] = { data }; @@ -27,13 +27,13 @@ void test__f_thread_onces_adjust_callback__fails(void **state) { will_return(__wrap_pthread_attr_destroy, true); will_return(__wrap_pthread_attr_destroy, errnos[i]); - const f_status_t status = f_thread_onces_adjust_callback(0, 1, (void *) datass_array); + const f_status_t status = f_thread_onces_delete_callback(0, 1, (void *) datass_array); assert_int_equal(status, statuss[i]); } // for } -void test__f_thread_onces_adjust_callback__works(void **state) { +void test__f_thread_onces_delete_callback__works(void **state) { f_thread_once_t data = f_thread_once_t_initialize; f_thread_once_t data_array[] = { data }; @@ -44,7 +44,7 @@ void test__f_thread_onces_adjust_callback__works(void **state) { { will_return(__wrap_pthread_attr_destroy, false); - const f_status_t status = f_thread_onces_adjust_callback(0, length, (void *) datass_array); + const f_status_t status = f_thread_onces_delete_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_thread/tests/unit/c/test-thread-onces_delete_callback.h b/level_0/f_thread/tests/unit/c/test-thread-onces_delete_callback.h new file mode 100644 index 0000000..8f08b0e --- /dev/null +++ b/level_0/f_thread/tests/unit/c/test-thread-onces_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Thread + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_thread__onces_delete_callback +#define _TEST__F_thread__onces_delete_callback + +/** + * Test that the function fails. + * + * @see f_thread_onces_delete_callback_() + */ +extern void test__f_thread_onces_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_thread_onces_delete_callback_() + */ +extern void test__f_thread_onces_delete_callback__works(void **state); + +#endif // _TEST__F_thread__onces_delete_callback diff --git a/level_0/f_thread/tests/unit/c/test-thread-onces_resize_callback.c b/level_0/f_thread/tests/unit/c/test-thread-onces_destroy_callback.c similarity index 74% rename from level_0/f_thread/tests/unit/c/test-thread-onces_resize_callback.c rename to level_0/f_thread/tests/unit/c/test-thread-onces_destroy_callback.c index d2fea77..82cf8db 100644 --- a/level_0/f_thread/tests/unit/c/test-thread-onces_resize_callback.c +++ b/level_0/f_thread/tests/unit/c/test-thread-onces_destroy_callback.c @@ -1,11 +1,11 @@ #include "test-thread.h" -#include "test-thread-onces_resize_callback.h" +#include "test-thread-onces_destroy_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_thread_onces_resize_callback__fails(void **state) { +void test__f_thread_onces_destroy_callback__fails(void **state) { f_thread_once_t data = f_thread_once_t_initialize; f_thread_once_t data_array[] = { data }; @@ -27,13 +27,13 @@ void test__f_thread_onces_resize_callback__fails(void **state) { will_return(__wrap_pthread_attr_destroy, true); will_return(__wrap_pthread_attr_destroy, errnos[i]); - const f_status_t status = f_thread_onces_resize_callback(0, 1, (void *) datass_array); + const f_status_t status = f_thread_onces_destroy_callback(0, 1, (void *) datass_array); assert_int_equal(status, statuss[i]); } // for } -void test__f_thread_onces_resize_callback__works(void **state) { +void test__f_thread_onces_destroy_callback__works(void **state) { f_thread_once_t data = f_thread_once_t_initialize; f_thread_once_t data_array[] = { data }; @@ -44,7 +44,7 @@ void test__f_thread_onces_resize_callback__works(void **state) { { will_return(__wrap_pthread_attr_destroy, false); - const f_status_t status = f_thread_onces_resize_callback(0, length, (void *) datass_array); + const f_status_t status = f_thread_onces_destroy_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_thread/tests/unit/c/test-thread-onces_destroy_callback.h b/level_0/f_thread/tests/unit/c/test-thread-onces_destroy_callback.h new file mode 100644 index 0000000..6976595 --- /dev/null +++ b/level_0/f_thread/tests/unit/c/test-thread-onces_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Thread + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_thread__onces_destroy_callback +#define _TEST__F_thread__onces_destroy_callback + +/** + * Test that the function fails. + * + * @see f_thread_onces_destroy_callback_() + */ +extern void test__f_thread_onces_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_thread_onces_destroy_callback_() + */ +extern void test__f_thread_onces_destroy_callback__works(void **state); + +#endif // _TEST__F_thread__onces_destroy_callback diff --git a/level_0/f_thread/tests/unit/c/test-thread-onces_resize_callback.h b/level_0/f_thread/tests/unit/c/test-thread-onces_resize_callback.h deleted file mode 100644 index a9f7b3b..0000000 --- a/level_0/f_thread/tests/unit/c/test-thread-onces_resize_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Thread - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_thread__onces_resize_callback -#define _TEST__F_thread__onces_resize_callback - -/** - * Test that the function fails. - * - * @see f_thread_onces_resize_callback_() - */ -extern void test__f_thread_onces_resize_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_thread_onces_resize_callback_() - */ -extern void test__f_thread_onces_resize_callback__works(void **state); - -#endif // _TEST__F_thread__onces_resize_callback diff --git a/level_0/f_thread/tests/unit/c/test-thread-semaphores_adjust_callback.h b/level_0/f_thread/tests/unit/c/test-thread-semaphores_adjust_callback.h deleted file mode 100644 index 063653b..0000000 --- a/level_0/f_thread/tests/unit/c/test-thread-semaphores_adjust_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Thread - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_thread__semaphores_adjust_callback -#define _TEST__F_thread__semaphores_adjust_callback - -/** - * Test that the function fails. - * - * @see f_thread_semaphores_adjust_callback_() - */ -extern void test__f_thread_semaphores_adjust_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_thread_semaphores_adjust_callback_() - */ -extern void test__f_thread_semaphores_adjust_callback__works(void **state); - -#endif // _TEST__F_thread__semaphores_adjust_callback diff --git a/level_0/f_thread/tests/unit/c/test-thread-semaphores_adjust_callback.c b/level_0/f_thread/tests/unit/c/test-thread-semaphores_delete_callback.c similarity index 79% rename from level_0/f_thread/tests/unit/c/test-thread-semaphores_adjust_callback.c rename to level_0/f_thread/tests/unit/c/test-thread-semaphores_delete_callback.c index edbd177..4d1929c 100644 --- a/level_0/f_thread/tests/unit/c/test-thread-semaphores_adjust_callback.c +++ b/level_0/f_thread/tests/unit/c/test-thread-semaphores_delete_callback.c @@ -1,11 +1,11 @@ #include "test-thread.h" -#include "test-thread-semaphores_adjust_callback.h" +#include "test-thread-semaphores_delete_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_thread_semaphores_adjust_callback__fails(void **state) { +void test__f_thread_semaphores_delete_callback__fails(void **state) { f_thread_semaphore_t data = f_thread_semaphore_t_initialize; f_thread_semaphore_t data_array[] = { data }; @@ -27,13 +27,13 @@ void test__f_thread_semaphores_adjust_callback__fails(void **state) { will_return(__wrap_sem_destroy, true); will_return(__wrap_sem_destroy, errnos[i]); - const f_status_t status = f_thread_semaphores_adjust_callback(0, 1, (void *) datass_array); + const f_status_t status = f_thread_semaphores_delete_callback(0, 1, (void *) datass_array); assert_int_equal(status, statuss[i]); } // for } -void test__f_thread_semaphores_adjust_callback__works(void **state) { +void test__f_thread_semaphores_delete_callback__works(void **state) { f_thread_semaphore_t data = f_thread_semaphore_t_initialize; f_thread_semaphore_t data_array[] = { data }; @@ -44,7 +44,7 @@ void test__f_thread_semaphores_adjust_callback__works(void **state) { { will_return(__wrap_sem_destroy, false); - const f_status_t status = f_thread_semaphores_adjust_callback(0, length, (void *) datass_array); + const f_status_t status = f_thread_semaphores_delete_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_thread/tests/unit/c/test-thread-semaphores_delete_callback.h b/level_0/f_thread/tests/unit/c/test-thread-semaphores_delete_callback.h new file mode 100644 index 0000000..6022900 --- /dev/null +++ b/level_0/f_thread/tests/unit/c/test-thread-semaphores_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Thread + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_thread__semaphores_delete_callback +#define _TEST__F_thread__semaphores_delete_callback + +/** + * Test that the function fails. + * + * @see f_thread_semaphores_delete_callback_() + */ +extern void test__f_thread_semaphores_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_thread_semaphores_delete_callback_() + */ +extern void test__f_thread_semaphores_delete_callback__works(void **state); + +#endif // _TEST__F_thread__semaphores_delete_callback diff --git a/level_0/f_thread/tests/unit/c/test-thread-semaphores_resize_callback.c b/level_0/f_thread/tests/unit/c/test-thread-semaphores_destroy_callback.c similarity index 73% rename from level_0/f_thread/tests/unit/c/test-thread-semaphores_resize_callback.c rename to level_0/f_thread/tests/unit/c/test-thread-semaphores_destroy_callback.c index 5e32c3e..6f97be3 100644 --- a/level_0/f_thread/tests/unit/c/test-thread-semaphores_resize_callback.c +++ b/level_0/f_thread/tests/unit/c/test-thread-semaphores_destroy_callback.c @@ -1,11 +1,11 @@ #include "test-thread.h" -#include "test-thread-semaphores_resize_callback.h" +#include "test-thread-semaphores_destroy_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_thread_semaphores_resize_callback__fails(void **state) { +void test__f_thread_semaphores_destroy_callback__fails(void **state) { f_thread_semaphore_t data = f_thread_semaphore_t_initialize; f_thread_semaphore_t data_array[] = { data }; @@ -27,13 +27,13 @@ void test__f_thread_semaphores_resize_callback__fails(void **state) { will_return(__wrap_sem_destroy, true); will_return(__wrap_sem_destroy, errnos[i]); - const f_status_t status = f_thread_semaphores_resize_callback(0, 1, (void *) datass_array); + const f_status_t status = f_thread_semaphores_destroy_callback(0, 1, (void *) datass_array); assert_int_equal(status, statuss[i]); } // for } -void test__f_thread_semaphores_resize_callback__works(void **state) { +void test__f_thread_semaphores_destroy_callback__works(void **state) { f_thread_semaphore_t data = f_thread_semaphore_t_initialize; f_thread_semaphore_t data_array[] = { data }; @@ -44,7 +44,7 @@ void test__f_thread_semaphores_resize_callback__works(void **state) { { will_return(__wrap_sem_destroy, false); - const f_status_t status = f_thread_semaphores_resize_callback(0, length, (void *) datass_array); + const f_status_t status = f_thread_semaphores_destroy_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_thread/tests/unit/c/test-thread-semaphores_destroy_callback.h b/level_0/f_thread/tests/unit/c/test-thread-semaphores_destroy_callback.h new file mode 100644 index 0000000..f7fef6f --- /dev/null +++ b/level_0/f_thread/tests/unit/c/test-thread-semaphores_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Thread + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_thread__semaphores_destroy_callback +#define _TEST__F_thread__semaphores_destroy_callback + +/** + * Test that the function fails. + * + * @see f_thread_semaphores_destroy_callback_() + */ +extern void test__f_thread_semaphores_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_thread_semaphores_destroy_callback_() + */ +extern void test__f_thread_semaphores_destroy_callback__works(void **state); + +#endif // _TEST__F_thread__semaphores_destroy_callback diff --git a/level_0/f_thread/tests/unit/c/test-thread-semaphores_resize_callback.h b/level_0/f_thread/tests/unit/c/test-thread-semaphores_resize_callback.h deleted file mode 100644 index d8d12f3..0000000 --- a/level_0/f_thread/tests/unit/c/test-thread-semaphores_resize_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Thread - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_thread__semaphores_resize_callback -#define _TEST__F_thread__semaphores_resize_callback - -/** - * Test that the function fails. - * - * @see f_thread_semaphores_resize_callback_() - */ -extern void test__f_thread_semaphores_resize_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_thread_semaphores_resize_callback_() - */ -extern void test__f_thread_semaphores_resize_callback__works(void **state); - -#endif // _TEST__F_thread__semaphores_resize_callback diff --git a/level_0/f_thread/tests/unit/c/test-thread-sets_adjust_callback.h b/level_0/f_thread/tests/unit/c/test-thread-sets_adjust_callback.h deleted file mode 100644 index 6af7dff..0000000 --- a/level_0/f_thread/tests/unit/c/test-thread-sets_adjust_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Thread - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_thread__sets_adjust_callback -#define _TEST__F_thread__sets_adjust_callback - -/** - * Test that the function fails. - * - * @see f_thread_sets_adjust_callback_() - */ -extern void test__f_thread_sets_adjust_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_thread_sets_adjust_callback_() - */ -extern void test__f_thread_sets_adjust_callback__works(void **state); - -#endif // _TEST__F_thread__sets_adjust_callback diff --git a/level_0/f_thread/tests/unit/c/test-thread-sets_adjust_callback.c b/level_0/f_thread/tests/unit/c/test-thread-sets_delete_callback.c similarity index 78% rename from level_0/f_thread/tests/unit/c/test-thread-sets_adjust_callback.c rename to level_0/f_thread/tests/unit/c/test-thread-sets_delete_callback.c index 7c11734..a3640ce 100644 --- a/level_0/f_thread/tests/unit/c/test-thread-sets_adjust_callback.c +++ b/level_0/f_thread/tests/unit/c/test-thread-sets_delete_callback.c @@ -1,11 +1,11 @@ #include "test-thread.h" -#include "test-thread-sets_adjust_callback.h" +#include "test-thread-sets_delete_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_thread_sets_adjust_callback__fails(void **state) { +void test__f_thread_sets_delete_callback__fails(void **state) { f_thread_set_t data = f_thread_set_t_initialize; f_thread_set_t data_array[] = { data }; @@ -27,13 +27,13 @@ void test__f_thread_sets_adjust_callback__fails(void **state) { will_return(__wrap_pthread_attr_destroy, true); will_return(__wrap_pthread_attr_destroy, errnos[i]); - const f_status_t status = f_thread_sets_adjust_callback(0, 1, (void *) datass_array); + const f_status_t status = f_thread_sets_delete_callback(0, 1, (void *) datass_array); assert_int_equal(status, statuss[i]); } // for } -void test__f_thread_sets_adjust_callback__works(void **state) { +void test__f_thread_sets_delete_callback__works(void **state) { f_thread_set_t data = f_thread_set_t_initialize; f_thread_set_t data_array[] = { data }; @@ -44,7 +44,7 @@ void test__f_thread_sets_adjust_callback__works(void **state) { { will_return(__wrap_pthread_attr_destroy, false); - const f_status_t status = f_thread_sets_adjust_callback(0, length, (void *) datass_array); + const f_status_t status = f_thread_sets_delete_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_thread/tests/unit/c/test-thread-sets_delete_callback.h b/level_0/f_thread/tests/unit/c/test-thread-sets_delete_callback.h new file mode 100644 index 0000000..5281cf7 --- /dev/null +++ b/level_0/f_thread/tests/unit/c/test-thread-sets_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Thread + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_thread__sets_delete_callback +#define _TEST__F_thread__sets_delete_callback + +/** + * Test that the function fails. + * + * @see f_thread_sets_delete_callback_() + */ +extern void test__f_thread_sets_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_thread_sets_delete_callback_() + */ +extern void test__f_thread_sets_delete_callback__works(void **state); + +#endif // _TEST__F_thread__sets_delete_callback diff --git a/level_0/f_thread/tests/unit/c/test-thread-sets_resize_callback.c b/level_0/f_thread/tests/unit/c/test-thread-sets_destroy_callback.c similarity index 74% rename from level_0/f_thread/tests/unit/c/test-thread-sets_resize_callback.c rename to level_0/f_thread/tests/unit/c/test-thread-sets_destroy_callback.c index efe84c1..c4bd582 100644 --- a/level_0/f_thread/tests/unit/c/test-thread-sets_resize_callback.c +++ b/level_0/f_thread/tests/unit/c/test-thread-sets_destroy_callback.c @@ -1,11 +1,11 @@ #include "test-thread.h" -#include "test-thread-sets_resize_callback.h" +#include "test-thread-sets_destroy_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_thread_sets_resize_callback__fails(void **state) { +void test__f_thread_sets_destroy_callback__fails(void **state) { f_thread_set_t data = f_thread_set_t_initialize; f_thread_set_t data_array[] = { data }; @@ -27,13 +27,13 @@ void test__f_thread_sets_resize_callback__fails(void **state) { will_return(__wrap_pthread_attr_destroy, true); will_return(__wrap_pthread_attr_destroy, errnos[i]); - const f_status_t status = f_thread_sets_resize_callback(0, 1, (void *) datass_array); + const f_status_t status = f_thread_sets_destroy_callback(0, 1, (void *) datass_array); assert_int_equal(status, statuss[i]); } // for } -void test__f_thread_sets_resize_callback__works(void **state) { +void test__f_thread_sets_destroy_callback__works(void **state) { f_thread_set_t data = f_thread_set_t_initialize; f_thread_set_t data_array[] = { data }; @@ -44,7 +44,7 @@ void test__f_thread_sets_resize_callback__works(void **state) { { will_return(__wrap_pthread_attr_destroy, false); - const f_status_t status = f_thread_sets_resize_callback(0, length, (void *) datass_array); + const f_status_t status = f_thread_sets_destroy_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_thread/tests/unit/c/test-thread-sets_destroy_callback.h b/level_0/f_thread/tests/unit/c/test-thread-sets_destroy_callback.h new file mode 100644 index 0000000..0277c0a --- /dev/null +++ b/level_0/f_thread/tests/unit/c/test-thread-sets_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Thread + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_thread__sets_destroy_callback +#define _TEST__F_thread__sets_destroy_callback + +/** + * Test that the function fails. + * + * @see f_thread_sets_destroy_callback_() + */ +extern void test__f_thread_sets_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_thread_sets_destroy_callback_() + */ +extern void test__f_thread_sets_destroy_callback__works(void **state); + +#endif // _TEST__F_thread__sets_destroy_callback diff --git a/level_0/f_thread/tests/unit/c/test-thread-sets_resize_callback.h b/level_0/f_thread/tests/unit/c/test-thread-sets_resize_callback.h deleted file mode 100644 index 44f0d39..0000000 --- a/level_0/f_thread/tests/unit/c/test-thread-sets_resize_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Thread - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_thread__sets_resize_callback -#define _TEST__F_thread__sets_resize_callback - -/** - * Test that the function fails. - * - * @see f_thread_sets_resize_callback_() - */ -extern void test__f_thread_sets_resize_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_thread_sets_resize_callback_() - */ -extern void test__f_thread_sets_resize_callback__works(void **state); - -#endif // _TEST__F_thread__sets_resize_callback diff --git a/level_0/f_thread/tests/unit/c/test-thread-spins_adjust_callback.h b/level_0/f_thread/tests/unit/c/test-thread-spins_adjust_callback.h deleted file mode 100644 index 5c41d2b..0000000 --- a/level_0/f_thread/tests/unit/c/test-thread-spins_adjust_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Thread - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_thread__spins_adjust_callback -#define _TEST__F_thread__spins_adjust_callback - -/** - * Test that the function fails. - * - * @see f_thread_spins_adjust_callback_() - */ -extern void test__f_thread_spins_adjust_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_thread_spins_adjust_callback_() - */ -extern void test__f_thread_spins_adjust_callback__works(void **state); - -#endif // _TEST__F_thread__spins_adjust_callback diff --git a/level_0/f_thread/tests/unit/c/test-thread-spins_adjust_callback.c b/level_0/f_thread/tests/unit/c/test-thread-spins_delete_callback.c similarity index 79% rename from level_0/f_thread/tests/unit/c/test-thread-spins_adjust_callback.c rename to level_0/f_thread/tests/unit/c/test-thread-spins_delete_callback.c index aca7456..1cc2272 100644 --- a/level_0/f_thread/tests/unit/c/test-thread-spins_adjust_callback.c +++ b/level_0/f_thread/tests/unit/c/test-thread-spins_delete_callback.c @@ -1,11 +1,11 @@ #include "test-thread.h" -#include "test-thread-spins_adjust_callback.h" +#include "test-thread-spins_delete_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_thread_spins_adjust_callback__fails(void **state) { +void test__f_thread_spins_delete_callback__fails(void **state) { f_thread_spin_t data = f_thread_spin_t_initialize; f_thread_spin_t data_array[] = { data }; @@ -29,13 +29,13 @@ void test__f_thread_spins_adjust_callback__fails(void **state) { will_return(__wrap_pthread_spin_destroy, true); will_return(__wrap_pthread_spin_destroy, errnos[i]); - const f_status_t status = f_thread_spins_adjust_callback(0, 1, (void *) datass_array); + const f_status_t status = f_thread_spins_delete_callback(0, 1, (void *) datass_array); assert_int_equal(status, statuss[i]); } // for } -void test__f_thread_spins_adjust_callback__works(void **state) { +void test__f_thread_spins_delete_callback__works(void **state) { f_thread_spin_t data = f_thread_spin_t_initialize; f_thread_spin_t data_array[] = { data }; @@ -46,7 +46,7 @@ void test__f_thread_spins_adjust_callback__works(void **state) { { will_return(__wrap_pthread_spin_destroy, false); - const f_status_t status = f_thread_spins_adjust_callback(0, length, (void *) datass_array); + const f_status_t status = f_thread_spins_delete_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_thread/tests/unit/c/test-thread-spins_delete_callback.h b/level_0/f_thread/tests/unit/c/test-thread-spins_delete_callback.h new file mode 100644 index 0000000..e3823fb --- /dev/null +++ b/level_0/f_thread/tests/unit/c/test-thread-spins_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Thread + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_thread__spins_delete_callback +#define _TEST__F_thread__spins_delete_callback + +/** + * Test that the function fails. + * + * @see f_thread_spins_delete_callback_() + */ +extern void test__f_thread_spins_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_thread_spins_delete_callback_() + */ +extern void test__f_thread_spins_delete_callback__works(void **state); + +#endif // _TEST__F_thread__spins_delete_callback diff --git a/level_0/f_thread/tests/unit/c/test-thread-spins_resize_callback.c b/level_0/f_thread/tests/unit/c/test-thread-spins_destroy_callback.c similarity index 74% rename from level_0/f_thread/tests/unit/c/test-thread-spins_resize_callback.c rename to level_0/f_thread/tests/unit/c/test-thread-spins_destroy_callback.c index 321515f..54617d2 100644 --- a/level_0/f_thread/tests/unit/c/test-thread-spins_resize_callback.c +++ b/level_0/f_thread/tests/unit/c/test-thread-spins_destroy_callback.c @@ -1,11 +1,11 @@ #include "test-thread.h" -#include "test-thread-spins_resize_callback.h" +#include "test-thread-spins_destroy_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_thread_spins_resize_callback__fails(void **state) { +void test__f_thread_spins_destroy_callback__fails(void **state) { f_thread_spin_t data = f_thread_spin_t_initialize; f_thread_spin_t data_array[] = { data }; @@ -29,13 +29,13 @@ void test__f_thread_spins_resize_callback__fails(void **state) { will_return(__wrap_pthread_spin_destroy, true); will_return(__wrap_pthread_spin_destroy, errnos[i]); - const f_status_t status = f_thread_spins_resize_callback(0, 1, (void *) datass_array); + const f_status_t status = f_thread_spins_destroy_callback(0, 1, (void *) datass_array); assert_int_equal(status, statuss[i]); } // for } -void test__f_thread_spins_resize_callback__works(void **state) { +void test__f_thread_spins_destroy_callback__works(void **state) { f_thread_spin_t data = f_thread_spin_t_initialize; f_thread_spin_t data_array[] = { data }; @@ -46,7 +46,7 @@ void test__f_thread_spins_resize_callback__works(void **state) { { will_return(__wrap_pthread_spin_destroy, false); - const f_status_t status = f_thread_spins_resize_callback(0, length, (void *) datass_array); + const f_status_t status = f_thread_spins_destroy_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_thread/tests/unit/c/test-thread-spins_destroy_callback.h b/level_0/f_thread/tests/unit/c/test-thread-spins_destroy_callback.h new file mode 100644 index 0000000..e4c23d7 --- /dev/null +++ b/level_0/f_thread/tests/unit/c/test-thread-spins_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Thread + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_thread__spins_destroy_callback +#define _TEST__F_thread__spins_destroy_callback + +/** + * Test that the function fails. + * + * @see f_thread_spins_destroy_callback_() + */ +extern void test__f_thread_spins_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_thread_spins_destroy_callback_() + */ +extern void test__f_thread_spins_destroy_callback__works(void **state); + +#endif // _TEST__F_thread__spins_destroy_callback diff --git a/level_0/f_thread/tests/unit/c/test-thread-spins_resize_callback.h b/level_0/f_thread/tests/unit/c/test-thread-spins_resize_callback.h deleted file mode 100644 index 4876ff4..0000000 --- a/level_0/f_thread/tests/unit/c/test-thread-spins_resize_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Thread - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_thread__spins_resize_callback -#define _TEST__F_thread__spins_resize_callback - -/** - * Test that the function fails. - * - * @see f_thread_spins_resize_callback_() - */ -extern void test__f_thread_spins_resize_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_thread_spins_resize_callback_() - */ -extern void test__f_thread_spins_resize_callback__works(void **state); - -#endif // _TEST__F_thread__spins_resize_callback diff --git a/level_0/f_thread/tests/unit/c/test-thread.c b/level_0/f_thread/tests/unit/c/test-thread.c index c7a8519..6b26d53 100644 --- a/level_0/f_thread/tests/unit/c/test-thread.c +++ b/level_0/f_thread/tests/unit/c/test-thread.c @@ -19,70 +19,70 @@ int setdown(void **state) { int main(void) { const struct CMUnitTest tests[] = { - cmocka_unit_test(test__f_thread_attributes_adjust_callback__fails), - cmocka_unit_test(test__f_thread_attributes_resize_callback__fails), - cmocka_unit_test(test__f_thread_attributes_adjust_callback__works), - cmocka_unit_test(test__f_thread_attributes_resize_callback__works), - - cmocka_unit_test(test__f_thread_barriers_adjust_callback__fails), - cmocka_unit_test(test__f_thread_barriers_resize_callback__fails), - cmocka_unit_test(test__f_thread_barriers_adjust_callback__works), - cmocka_unit_test(test__f_thread_barriers_resize_callback__works), - - cmocka_unit_test(test__f_thread_barrier_attributes_adjust_callback__fails), - cmocka_unit_test(test__f_thread_barrier_attributes_resize_callback__fails), - cmocka_unit_test(test__f_thread_barrier_attributes_adjust_callback__works), - cmocka_unit_test(test__f_thread_barrier_attributes_resize_callback__works), - - cmocka_unit_test(test__f_thread_conditions_adjust_callback__fails), - cmocka_unit_test(test__f_thread_conditions_resize_callback__fails), - cmocka_unit_test(test__f_thread_conditions_adjust_callback__works), - cmocka_unit_test(test__f_thread_conditions_resize_callback__works), - - cmocka_unit_test(test__f_thread_condition_attributes_adjust_callback__fails), - cmocka_unit_test(test__f_thread_condition_attributes_resize_callback__fails), - cmocka_unit_test(test__f_thread_condition_attributes_adjust_callback__works), - cmocka_unit_test(test__f_thread_condition_attributes_resize_callback__works), - - cmocka_unit_test(test__f_thread_keys_adjust_callback__fails), - cmocka_unit_test(test__f_thread_keys_resize_callback__fails), - cmocka_unit_test(test__f_thread_keys_adjust_callback__works), - cmocka_unit_test(test__f_thread_keys_resize_callback__works), - - cmocka_unit_test(test__f_thread_locks_adjust_callback__fails), - cmocka_unit_test(test__f_thread_locks_resize_callback__fails), - cmocka_unit_test(test__f_thread_locks_adjust_callback__works), - cmocka_unit_test(test__f_thread_locks_resize_callback__works), - - cmocka_unit_test(test__f_thread_lock_attributes_adjust_callback__fails), - cmocka_unit_test(test__f_thread_lock_attributes_resize_callback__fails), - cmocka_unit_test(test__f_thread_lock_attributes_adjust_callback__works), - cmocka_unit_test(test__f_thread_lock_attributes_resize_callback__works), - - cmocka_unit_test(test__f_thread_mutexs_adjust_callback__fails), - cmocka_unit_test(test__f_thread_mutexs_resize_callback__fails), - cmocka_unit_test(test__f_thread_mutexs_adjust_callback__works), - cmocka_unit_test(test__f_thread_mutexs_resize_callback__works), - - cmocka_unit_test(test__f_thread_mutex_attributes_adjust_callback__fails), - cmocka_unit_test(test__f_thread_mutex_attributes_resize_callback__fails), - cmocka_unit_test(test__f_thread_mutex_attributes_adjust_callback__works), - cmocka_unit_test(test__f_thread_mutex_attributes_resize_callback__works), - - cmocka_unit_test(test__f_thread_semaphores_adjust_callback__fails), - cmocka_unit_test(test__f_thread_semaphores_resize_callback__fails), - cmocka_unit_test(test__f_thread_semaphores_adjust_callback__works), - cmocka_unit_test(test__f_thread_semaphores_resize_callback__works), - - cmocka_unit_test(test__f_thread_sets_adjust_callback__fails), - cmocka_unit_test(test__f_thread_sets_resize_callback__fails), - cmocka_unit_test(test__f_thread_sets_adjust_callback__works), - cmocka_unit_test(test__f_thread_sets_resize_callback__works), - - cmocka_unit_test(test__f_thread_spins_adjust_callback__fails), - cmocka_unit_test(test__f_thread_spins_resize_callback__fails), - cmocka_unit_test(test__f_thread_spins_adjust_callback__works), - cmocka_unit_test(test__f_thread_spins_resize_callback__works), + cmocka_unit_test(test__f_thread_attributes_destroy_callback__fails), + cmocka_unit_test(test__f_thread_attributes_delete_callback__fails), + cmocka_unit_test(test__f_thread_attributes_destroy_callback__works), + cmocka_unit_test(test__f_thread_attributes_delete_callback__works), + + cmocka_unit_test(test__f_thread_barriers_destroy_callback__fails), + cmocka_unit_test(test__f_thread_barriers_delete_callback__fails), + cmocka_unit_test(test__f_thread_barriers_destroy_callback__works), + cmocka_unit_test(test__f_thread_barriers_delete_callback__works), + + cmocka_unit_test(test__f_thread_barrier_attributes_destroy_callback__fails), + cmocka_unit_test(test__f_thread_barrier_attributes_delete_callback__fails), + cmocka_unit_test(test__f_thread_barrier_attributes_destroy_callback__works), + cmocka_unit_test(test__f_thread_barrier_attributes_delete_callback__works), + + cmocka_unit_test(test__f_thread_conditions_destroy_callback__fails), + cmocka_unit_test(test__f_thread_conditions_delete_callback__fails), + cmocka_unit_test(test__f_thread_conditions_destroy_callback__works), + cmocka_unit_test(test__f_thread_conditions_delete_callback__works), + + cmocka_unit_test(test__f_thread_condition_attributes_destroy_callback__fails), + cmocka_unit_test(test__f_thread_condition_attributes_delete_callback__fails), + cmocka_unit_test(test__f_thread_condition_attributes_destroy_callback__works), + cmocka_unit_test(test__f_thread_condition_attributes_delete_callback__works), + + cmocka_unit_test(test__f_thread_keys_destroy_callback__fails), + cmocka_unit_test(test__f_thread_keys_delete_callback__fails), + cmocka_unit_test(test__f_thread_keys_destroy_callback__works), + cmocka_unit_test(test__f_thread_keys_delete_callback__works), + + cmocka_unit_test(test__f_thread_locks_destroy_callback__fails), + cmocka_unit_test(test__f_thread_locks_delete_callback__fails), + cmocka_unit_test(test__f_thread_locks_destroy_callback__works), + cmocka_unit_test(test__f_thread_locks_delete_callback__works), + + cmocka_unit_test(test__f_thread_lock_attributes_destroy_callback__fails), + cmocka_unit_test(test__f_thread_lock_attributes_delete_callback__fails), + cmocka_unit_test(test__f_thread_lock_attributes_destroy_callback__works), + cmocka_unit_test(test__f_thread_lock_attributes_delete_callback__works), + + cmocka_unit_test(test__f_thread_mutexs_destroy_callback__fails), + cmocka_unit_test(test__f_thread_mutexs_delete_callback__fails), + cmocka_unit_test(test__f_thread_mutexs_destroy_callback__works), + cmocka_unit_test(test__f_thread_mutexs_delete_callback__works), + + cmocka_unit_test(test__f_thread_mutex_attributes_destroy_callback__fails), + cmocka_unit_test(test__f_thread_mutex_attributes_delete_callback__fails), + cmocka_unit_test(test__f_thread_mutex_attributes_destroy_callback__works), + cmocka_unit_test(test__f_thread_mutex_attributes_delete_callback__works), + + cmocka_unit_test(test__f_thread_semaphores_destroy_callback__fails), + cmocka_unit_test(test__f_thread_semaphores_delete_callback__fails), + cmocka_unit_test(test__f_thread_semaphores_destroy_callback__works), + cmocka_unit_test(test__f_thread_semaphores_delete_callback__works), + + cmocka_unit_test(test__f_thread_sets_destroy_callback__fails), + cmocka_unit_test(test__f_thread_sets_delete_callback__fails), + cmocka_unit_test(test__f_thread_sets_destroy_callback__works), + cmocka_unit_test(test__f_thread_sets_delete_callback__works), + + cmocka_unit_test(test__f_thread_spins_destroy_callback__fails), + cmocka_unit_test(test__f_thread_spins_delete_callback__fails), + cmocka_unit_test(test__f_thread_spins_destroy_callback__works), + cmocka_unit_test(test__f_thread_spins_delete_callback__works), cmocka_unit_test(test__f_thread_at_fork__fails), cmocka_unit_test(test__f_thread_at_fork__works), @@ -407,44 +407,44 @@ int main(void) { cmocka_unit_test(test__f_thread_spin_unlock__works), #ifndef _di_level_0_parameter_checking_ - // f_thread_attributes_adjust_callback() doesn't use parameter checking. - // f_thread_attributes_resize_callback() doesn't use parameter checking. + // f_thread_attributes_destroy_callback() doesn't use parameter checking. + // f_thread_attributes_delete_callback() doesn't use parameter checking. - // f_thread_barriers_adjust_callback() doesn't use parameter checking. - // f_thread_barriers_resize_callback() doesn't use parameter checking. + // f_thread_barriers_destroy_callback() doesn't use parameter checking. + // f_thread_barriers_delete_callback() doesn't use parameter checking. - // f_thread_barrier_attributes_adjust_callback() doesn't use parameter checking. - // f_thread_barrier_attributes_resize_callback() doesn't use parameter checking. + // f_thread_barrier_attributes_destroy_callback() doesn't use parameter checking. + // f_thread_barrier_attributes_delete_callback() doesn't use parameter checking. - // f_thread_conditions_adjust_callback() doesn't use parameter checking. - // f_thread_conditions_resize_callback() doesn't use parameter checking. + // f_thread_conditions_destroy_callback() doesn't use parameter checking. + // f_thread_conditions_delete_callback() doesn't use parameter checking. - // f_thread_condition_attributes_adjust_callback() doesn't use parameter checking. - // f_thread_condition_attributes_resize_callback() doesn't use parameter checking. + // f_thread_condition_attributes_destroy_callback() doesn't use parameter checking. + // f_thread_condition_attributes_delete_callback() doesn't use parameter checking. - // f_thread_keys_adjust_callback() doesn't use parameter checking. - // f_thread_keys_resize_callback() doesn't use parameter checking. + // f_thread_keys_destroy_callback() doesn't use parameter checking. + // f_thread_keys_delete_callback() doesn't use parameter checking. - // f_thread_locks_adjust_callback() doesn't use parameter checking. - // f_thread_locks_resize_callback() doesn't use parameter checking. + // f_thread_locks_destroy_callback() doesn't use parameter checking. + // f_thread_locks_delete_callback() doesn't use parameter checking. - // f_thread_lock_attributes_adjust_callback() doesn't use parameter checking. - // f_thread_lock_attributes_resize_callback() doesn't use parameter checking. + // f_thread_lock_attributes_destroy_callback() doesn't use parameter checking. + // f_thread_lock_attributes_delete_callback() doesn't use parameter checking. - // f_thread_mutexs_adjust_callback() doesn't use parameter checking. - // f_thread_mutexs_resize_callback() doesn't use parameter checking. + // f_thread_mutexs_destroy_callback() doesn't use parameter checking. + // f_thread_mutexs_delete_callback() doesn't use parameter checking. - // f_thread_mutex_attributes_adjust_callback() doesn't use parameter checking. - // f_thread_mutex_attributes_resize_callback() doesn't use parameter checking. + // f_thread_mutex_attributes_destroy_callback() doesn't use parameter checking. + // f_thread_mutex_attributes_delete_callback() doesn't use parameter checking. - // f_thread_semaphores_adjust_callback() doesn't use parameter checking. - // f_thread_semaphores_resize_callback() doesn't use parameter checking. + // f_thread_semaphores_destroy_callback() doesn't use parameter checking. + // f_thread_semaphores_delete_callback() doesn't use parameter checking. - // f_thread_sets_adjust_callback() doesn't use parameter checking. - // f_thread_sets_resize_callback() doesn't use parameter checking. + // f_thread_sets_destroy_callback() doesn't use parameter checking. + // f_thread_sets_delete_callback() doesn't use parameter checking. - // f_thread_spins_adjust_callback() doesn't use parameter checking. - // f_thread_spins_resize_callback() doesn't use parameter checking. + // f_thread_spins_destroy_callback() doesn't use parameter checking. + // f_thread_spins_delete_callback() doesn't use parameter checking. cmocka_unit_test(test__f_thread_at_fork__parameter_checking), diff --git a/level_0/f_thread/tests/unit/c/test-thread.h b/level_0/f_thread/tests/unit/c/test-thread.h index ed17025..31dfedc 100644 --- a/level_0/f_thread/tests/unit/c/test-thread.h +++ b/level_0/f_thread/tests/unit/c/test-thread.h @@ -27,32 +27,32 @@ #include "mock-thread.h" // Test includes. -#include "test-thread-attributes_adjust_callback.h" -#include "test-thread-attributes_resize_callback.h" -#include "test-thread-barriers_adjust_callback.h" -#include "test-thread-barriers_resize_callback.h" -#include "test-thread-barrier_attributes_adjust_callback.h" -#include "test-thread-barrier_attributes_resize_callback.h" -#include "test-thread-conditions_adjust_callback.h" -#include "test-thread-conditions_resize_callback.h" -#include "test-thread-condition_attributes_adjust_callback.h" -#include "test-thread-condition_attributes_resize_callback.h" -#include "test-thread-keys_adjust_callback.h" -#include "test-thread-keys_resize_callback.h" -#include "test-thread-locks_adjust_callback.h" -#include "test-thread-locks_resize_callback.h" -#include "test-thread-lock_attributes_adjust_callback.h" -#include "test-thread-lock_attributes_resize_callback.h" -#include "test-thread-mutexs_adjust_callback.h" -#include "test-thread-mutexs_resize_callback.h" -#include "test-thread-mutex_attributes_adjust_callback.h" -#include "test-thread-mutex_attributes_resize_callback.h" -#include "test-thread-semaphores_adjust_callback.h" -#include "test-thread-semaphores_resize_callback.h" -#include "test-thread-sets_adjust_callback.h" -#include "test-thread-sets_resize_callback.h" -#include "test-thread-spins_adjust_callback.h" -#include "test-thread-spins_resize_callback.h" +#include "test-thread-attributes_destroy_callback.h" +#include "test-thread-attributes_delete_callback.h" +#include "test-thread-barriers_destroy_callback.h" +#include "test-thread-barriers_delete_callback.h" +#include "test-thread-barrier_attributes_destroy_callback.h" +#include "test-thread-barrier_attributes_delete_callback.h" +#include "test-thread-conditions_destroy_callback.h" +#include "test-thread-conditions_delete_callback.h" +#include "test-thread-condition_attributes_destroy_callback.h" +#include "test-thread-condition_attributes_delete_callback.h" +#include "test-thread-keys_destroy_callback.h" +#include "test-thread-keys_delete_callback.h" +#include "test-thread-locks_destroy_callback.h" +#include "test-thread-locks_delete_callback.h" +#include "test-thread-lock_attributes_destroy_callback.h" +#include "test-thread-lock_attributes_delete_callback.h" +#include "test-thread-mutexs_destroy_callback.h" +#include "test-thread-mutexs_delete_callback.h" +#include "test-thread-mutex_attributes_destroy_callback.h" +#include "test-thread-mutex_attributes_delete_callback.h" +#include "test-thread-semaphores_destroy_callback.h" +#include "test-thread-semaphores_delete_callback.h" +#include "test-thread-sets_destroy_callback.h" +#include "test-thread-sets_delete_callback.h" +#include "test-thread-spins_destroy_callback.h" +#include "test-thread-spins_delete_callback.h" #include "test-thread-at_fork.h" #include "test-thread-attribute_affinity_get.h" diff --git a/level_0/f_type_array/c/type_array/cell.c b/level_0/f_type_array/c/type_array/cell.c index b3752ef..d9e222f 100644 --- a/level_0/f_type_array/c/type_array/cell.c +++ b/level_0/f_type_array/c/type_array/cell.c @@ -5,8 +5,8 @@ extern "C" { #endif -#ifndef _di_f_cells_adjust_callback_ - f_status_t f_cells_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_cellss_delete_callback_ + f_status_t f_cellss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { f_cells_t * const array = (f_cells_t *) void_array; @@ -14,17 +14,19 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_memory_array_adjust(0, sizeof(f_cell_t), (void **) &array[i].array, &array[i].used, &array[i].size); - if (F_status_is_error(status)) return status; + if (array[i].size) { + status = f_memory_array_resize(0, sizeof(f_cell_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } } // for } return F_none; } -#endif // _di_f_cells_adjust_callback_ +#endif // _di_f_cellss_delete_callback_ -#ifndef _di_f_cells_resize_callback_ - f_status_t f_cells_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_cellss_destroy_callback_ + f_status_t f_cellss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { f_cells_t * const array = (f_cells_t *) void_array; @@ -32,14 +34,16 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_memory_array_resize(0, sizeof(f_cell_t), (void **) &array[i].array, &array[i].used, &array[i].size); - if (F_status_is_error(status)) return status; + if (array[i].size) { + status = f_memory_array_adjust(0, sizeof(f_cell_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } } // for } return F_none; } -#endif // _di_f_cells_resize_callback_ +#endif // _di_f_cellss_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/cell.h b/level_0/f_type_array/c/type_array/cell.h index 5c4b5e1..9de564f 100644 --- a/level_0/f_type_array/c/type_array/cell.h +++ b/level_0/f_type_array/c/type_array/cell.h @@ -17,7 +17,9 @@ extern "C" { #endif /** - * A callback intended to be passed to f_memory_arrays_adjust() for an f_cellss_t structure. + * A callback intended to be passed to f_memory_arrays_resize() for an f_cellss_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. * * This does not do parameter checking. * @@ -34,17 +36,19 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_memory_array_adjust(). + * Errors (with error bit) from: f_memory_array_resize(). * - * @see f_memory_array_adjust() - * @see f_memory_arrays_adjust() + * @see f_memory_array_resize() + * @see f_memory_arrays_resize() */ -#ifndef _di_f_cells_adjust_callback_ - extern f_status_t f_cells_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_cells_adjust_callback_ +#ifndef _di_f_cellss_delete_callback_ + extern f_status_t f_cellss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_cellss_delete_callback_ /** - * A callback intended to be passed to f_memory_arrays_resize() for an f_cellss_t structure. + * A callback intended to be passed to f_memory_arrays_adjust() for an f_cellss_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. * * This does not do parameter checking. * @@ -61,14 +65,14 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_memory_array_resize(). + * Errors (with error bit) from: f_memory_array_adjust(). * - * @see f_memory_array_resize() - * @see f_memory_arrays_resize() + * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() */ -#ifndef _di_f_cells_resize_callback_ - extern f_status_t f_cells_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_cells_resize_callback_ +#ifndef _di_f_cellss_destroy_callback_ + extern f_status_t f_cellss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_cellss_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/file.c b/level_0/f_type_array/c/type_array/file.c index 39a1d9e..3fb764a 100644 --- a/level_0/f_type_array/c/type_array/file.c +++ b/level_0/f_type_array/c/type_array/file.c @@ -6,8 +6,8 @@ extern "C" { #endif -#ifndef _di_f_files_adjust_callback_ - f_status_t f_files_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_filess_delete_callback_ + f_status_t f_filess_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { f_files_t * const array = (f_files_t *) void_array; @@ -15,17 +15,19 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_memory_array_adjust(0, sizeof(f_file_t), (void **) &array[i].array, &array[i].used, &array[i].size); - if (F_status_is_error(status)) return status; + if (array[i].size) { + status = f_memory_array_resize(0, sizeof(f_file_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } } // for } return F_none; } -#endif // _di_f_files_adjust_callback_ +#endif // _di_f_filess_delete_callback_ -#ifndef _di_f_files_resize_callback_ - f_status_t f_files_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_filess_destroy_callback_ + f_status_t f_filess_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { f_files_t * const array = (f_files_t *) void_array; @@ -33,14 +35,16 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_memory_array_resize(0, sizeof(f_file_t), (void **) &array[i].array, &array[i].used, &array[i].size); - if (F_status_is_error(status)) return status; + if (array[i].size) { + status = f_memory_array_adjust(0, sizeof(f_file_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } } // for } return F_none; } -#endif // _di_f_files_resize_callback_ +#endif // _di_f_filess_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/file.h b/level_0/f_type_array/c/type_array/file.h index 4c18383..adc23e0 100644 --- a/level_0/f_type_array/c/type_array/file.h +++ b/level_0/f_type_array/c/type_array/file.h @@ -17,7 +17,9 @@ extern "C" { #endif /** - * A callback intended to be passed to f_memory_arrays_adjust() for an f_filess_t structure. + * A callback intended to be passed to f_memory_arrays_resize() for an f_filess_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. * * This does not do parameter checking. * @@ -34,17 +36,19 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_memory_array_adjust(). + * Errors (with error bit) from: f_memory_array_resize(). * - * @see f_memory_array_adjust() - * @see f_memory_arrays_adjust() + * @see f_memory_array_resize() + * @see f_memory_arrays_resize() */ -#ifndef _di_f_files_adjust_callback_ - extern f_status_t f_files_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_files_adjust_callback_ +#ifndef _di_f_filess_delete_callback_ + extern f_status_t f_filess_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_filess_delete_callback_ /** - * A callback intended to be passed to f_memory_arrays_resize() for an f_filess_t structure. + * A callback intended to be passed to f_memory_arrays_adjust() for an f_filess_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. * * This does not do parameter checking. * @@ -61,14 +65,14 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_memory_array_resize(). + * Errors (with error bit) from: f_memory_array_adjust(). * - * @see f_memory_array_resize() - * @see f_memory_arrays_resize() + * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() */ -#ifndef _di_f_files_resize_callback_ - extern f_status_t f_files_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_files_resize_callback_ +#ifndef _di_f_filess_destroy_callback_ + extern f_status_t f_filess_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_filess_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/fll_id.c b/level_0/f_type_array/c/type_array/fll_id.c index d19777a..48cc08d 100644 --- a/level_0/f_type_array/c/type_array/fll_id.c +++ b/level_0/f_type_array/c/type_array/fll_id.c @@ -5,8 +5,8 @@ extern "C" { #endif -#ifndef _di_f_fll_ids_adjust_callback_ - f_status_t f_fll_ids_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_fll_idss_delete_callback_ + f_status_t f_fll_idss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { f_fll_ids_t * const array = (f_fll_ids_t *) void_array; @@ -14,17 +14,19 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_memory_array_adjust(0, sizeof(f_fll_id_t), (void **) &array[i].array, &array[i].used, &array[i].size); - if (F_status_is_error(status)) return status; + if (array[i].size) { + status = f_memory_array_resize(0, sizeof(f_fll_id_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } } // for } return F_none; } -#endif // _di_f_fll_ids_adjust_callback_ +#endif // _di_f_fll_idss_delete_callback_ -#ifndef _di_f_fll_ids_resize_callback_ - f_status_t f_fll_ids_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_fll_idss_destroy_callback_ + f_status_t f_fll_idss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { f_fll_ids_t * const array = (f_fll_ids_t *) void_array; @@ -32,14 +34,16 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_memory_array_resize(0, sizeof(f_fll_id_t), (void **) &array[i].array, &array[i].used, &array[i].size); - if (F_status_is_error(status)) return status; + if (array[i].size) { + status = f_memory_array_adjust(0, sizeof(f_fll_id_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } } // for } return F_none; } -#endif // _di_f_fll_ids_resize_callback_ +#endif // _di_f_fll_idss_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/fll_id.h b/level_0/f_type_array/c/type_array/fll_id.h index 35b85b3..e214836 100644 --- a/level_0/f_type_array/c/type_array/fll_id.h +++ b/level_0/f_type_array/c/type_array/fll_id.h @@ -17,7 +17,38 @@ extern "C" { #endif /** - * A callback intended to be passed to f_memory_arrays_adjust() for an f_fll_idss_t structure. + * A callback intended to be passed to f_memory_arrays_resize() for an f_fll_ids_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. + * + * This does not do parameter checking. + * + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_array_resize(). + * + * @see f_memory_array_resize() + * @see f_memory_arrays_resize() + */ +#ifndef _di_f_fll_ids_delete_callback_ + extern f_status_t f_fll_ids_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_fll_ids_delete_callback_ + +/** + * A callback intended to be passed to f_memory_arrays_adjust() for an f_fll_ids_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. * * This does not do parameter checking. * @@ -39,13 +70,15 @@ extern "C" { * @see f_memory_array_adjust() * @see f_memory_arrays_adjust() */ -#ifndef _di_f_fll_ids_adjust_callback_ - extern f_status_t f_fll_ids_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_fll_ids_adjust_callback_ +#ifndef _di_f_fll_ids_destroy_callback_ + extern f_status_t f_fll_ids_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_fll_ids_destroy_callback_ /** * A callback intended to be passed to f_memory_arrays_resize() for an f_fll_idss_t structure. * + * This is only called when shrinking the array and generally should perform deallocations. + * * This does not do parameter checking. * * @param start @@ -66,9 +99,38 @@ extern "C" { * @see f_memory_array_resize() * @see f_memory_arrays_resize() */ -#ifndef _di_f_fll_ids_resize_callback_ - extern f_status_t f_fll_ids_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_fll_ids_resize_callback_ +#ifndef _di_f_fll_idss_delete_callback_ + extern f_status_t f_fll_idss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_fll_idss_delete_callback_ + +/** + * A callback intended to be passed to f_memory_arrays_adjust() for an f_fll_idss_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. + * + * This does not do parameter checking. + * + * @param start + * The inclusive start position in the array to start deleting. + * @param stop + * The exclusive stop position in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. + * + * @return + * F_none on success. + * + * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_memory_array_adjust(). + * + * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() + */ +#ifndef _di_f_fll_idss_destroy_callback_ + extern f_status_t f_fll_idss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_fll_idss_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/int128.c b/level_0/f_type_array/c/type_array/int128.c index 9dcaa40..8613c17 100644 --- a/level_0/f_type_array/c/type_array/int128.c +++ b/level_0/f_type_array/c/type_array/int128.c @@ -5,8 +5,8 @@ extern "C" { #endif -#ifndef _di_f_int128s_adjust_callback_ - f_status_t f_int128s_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_int128ss_delete_callback_ + f_status_t f_int128ss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { f_int128s_t * const array = (f_int128s_t *) void_array; @@ -14,17 +14,19 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_memory_array_adjust(0, sizeof(f_int128_t), (void **) &array[i].array, &array[i].used, &array[i].size); - if (F_status_is_error(status)) return status; + if (array[i].size) { + status = f_memory_array_resize(0, sizeof(f_int128_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } } // for } return F_none; } -#endif // _di_f_int128s_adjust_callback_ +#endif // _di_f_int128ss_delete_callback_ -#ifndef _di_f_int128s_resize_callback_ - f_status_t f_int128s_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_int128ss_destroy_callback_ + f_status_t f_int128ss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { f_int128s_t * const array = (f_int128s_t *) void_array; @@ -32,14 +34,16 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_memory_array_resize(0, sizeof(f_int128_t), (void **) &array[i].array, &array[i].used, &array[i].size); - if (F_status_is_error(status)) return status; + if (array[i].size) { + status = f_memory_array_adjust(0, sizeof(f_int128_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } } // for } return F_none; } -#endif // _di_f_int128s_resize_callback_ +#endif // _di_f_int128ss_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/int128.h b/level_0/f_type_array/c/type_array/int128.h index a2a714d..16767db 100644 --- a/level_0/f_type_array/c/type_array/int128.h +++ b/level_0/f_type_array/c/type_array/int128.h @@ -17,7 +17,9 @@ extern "C" { #endif /** - * A callback intended to be passed to f_memory_arrays_adjust() for an f_int128ss_t structure. + * A callback intended to be passed to f_memory_arrays_resize() for an f_int128ss_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. * * This does not do parameter checking. * @@ -34,17 +36,19 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_memory_array_adjust(). + * Errors (with error bit) from: f_memory_array_resize(). * - * @see f_memory_array_adjust() - * @see f_memory_arrays_adjust() + * @see f_memory_array_resize() + * @see f_memory_arrays_resize() */ -#ifndef _di_f_int128s_adjust_callback_ - extern f_status_t f_int128s_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_int128s_adjust_callback_ +#ifndef _di_f_int128ss_delete_callback_ + extern f_status_t f_int128ss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_int128ss_delete_callback_ /** - * A callback intended to be passed to f_memory_arrays_resize() for an f_int128ss_t structure. + * A callback intended to be passed to f_memory_arrays_adjust() for an f_int128ss_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. * * This does not do parameter checking. * @@ -61,14 +65,14 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_memory_array_resize(). + * Errors (with error bit) from: f_memory_array_adjust(). * - * @see f_memory_array_resize() - * @see f_memory_arrays_resize() + * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() */ -#ifndef _di_f_int128s_resize_callback_ - extern f_status_t f_int128s_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_int128s_resize_callback_ +#ifndef _di_f_int128ss_destroy_callback_ + extern f_status_t f_int128ss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_int128ss_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/int16.c b/level_0/f_type_array/c/type_array/int16.c index 224c8a0..9f0ba94 100644 --- a/level_0/f_type_array/c/type_array/int16.c +++ b/level_0/f_type_array/c/type_array/int16.c @@ -5,8 +5,8 @@ extern "C" { #endif -#ifndef _di_f_int16s_adjust_callback_ - f_status_t f_int16s_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_int16ss_delete_callback_ + f_status_t f_int16ss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { f_int16s_t * const array = (f_int16s_t *) void_array; @@ -14,17 +14,19 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_memory_array_adjust(0, sizeof(int16_t), (void **) &array[i].array, &array[i].used, &array[i].size); - if (F_status_is_error(status)) return status; + if (array[i].size) { + status = f_memory_array_resize(0, sizeof(int16_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } } // for } return F_none; } -#endif // _di_f_int16s_adjust_callback_ +#endif // _di_f_int16ss_delete_callback_ -#ifndef _di_f_int16s_resize_callback_ - f_status_t f_int16s_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_int16ss_destroy_callback_ + f_status_t f_int16ss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { f_int16s_t * const array = (f_int16s_t *) void_array; @@ -32,14 +34,16 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_memory_array_resize(0, sizeof(int16_t), (void **) &array[i].array, &array[i].used, &array[i].size); - if (F_status_is_error(status)) return status; + if (array[i].size) { + status = f_memory_array_adjust(0, sizeof(int16_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } } // for } return F_none; } -#endif // _di_f_int16s_resize_callback_ +#endif // _di_f_int16ss_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/int16.h b/level_0/f_type_array/c/type_array/int16.h index cb6a90b..9d9c4b8 100644 --- a/level_0/f_type_array/c/type_array/int16.h +++ b/level_0/f_type_array/c/type_array/int16.h @@ -17,7 +17,9 @@ extern "C" { #endif /** - * A callback intended to be passed to f_memory_arrays_adjust() for an f_int16ss_t structure. + * A callback intended to be passed to f_memory_arrays_resize() for an f_int16ss_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. * * This does not do parameter checking. * @@ -34,17 +36,19 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_memory_array_adjust(). + * Errors (with error bit) from: f_memory_array_resize(). * - * @see f_memory_array_adjust() - * @see f_memory_arrays_adjust() + * @see f_memory_array_resize() + * @see f_memory_arrays_resize() */ -#ifndef _di_f_int16s_adjust_callback_ - extern f_status_t f_int16s_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_int16s_adjust_callback_ +#ifndef _di_f_int16ss_delete_callback_ + extern f_status_t f_int16ss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_int16ss_delete_callback_ /** - * A callback intended to be passed to f_memory_arrays_resize() for an f_int16ss_t structure. + * A callback intended to be passed to f_memory_arrays_adjust() for an f_int16ss_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. * * This does not do parameter checking. * @@ -61,14 +65,15 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_memory_array_resize(). + * Errors (with error bit) from: f_memory_array_adjust(). * - * @see f_memory_array_resize() - * @see f_memory_arrays_resize() + * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() */ -#ifndef _di_f_int16s_resize_callback_ - extern f_status_t f_int16s_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_int16s_resize_callback_ +#ifndef _di_f_int16ss_destroy_callback_ + extern f_status_t f_int16ss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_int16ss_destroy_callback_ + #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_type_array/c/type_array/int32.c b/level_0/f_type_array/c/type_array/int32.c index bdbd6ae..a0f4052 100644 --- a/level_0/f_type_array/c/type_array/int32.c +++ b/level_0/f_type_array/c/type_array/int32.c @@ -5,8 +5,8 @@ extern "C" { #endif -#ifndef _di_f_int32s_adjust_callback_ - f_status_t f_int32s_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_int32ss_delete_callback_ + f_status_t f_int32ss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { f_int32s_t * const array = (f_int32s_t *) void_array; @@ -14,17 +14,19 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_memory_array_adjust(0, sizeof(int32_t), (void **) &array[i].array, &array[i].used, &array[i].size); - if (F_status_is_error(status)) return status; + if (array[i].size) { + status = f_memory_array_resize(0, sizeof(int32_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } } // for } return F_none; } -#endif // _di_f_int32s_adjust_callback_ +#endif // _di_f_int32ss_delete_callback_ -#ifndef _di_f_int32s_resize_callback_ - f_status_t f_int32s_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_int32ss_destroy_callback_ + f_status_t f_int32ss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { f_int32s_t * const array = (f_int32s_t *) void_array; @@ -32,14 +34,16 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_memory_array_resize(0, sizeof(int32_t), (void **) &array[i].array, &array[i].used, &array[i].size); - if (F_status_is_error(status)) return status; + if (array[i].size) { + status = f_memory_array_adjust(0, sizeof(int32_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } } // for } return F_none; } -#endif // _di_f_int32s_resize_callback_ +#endif // _di_f_int32ss_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/int32.h b/level_0/f_type_array/c/type_array/int32.h index 0fb6de6..d6cd642 100644 --- a/level_0/f_type_array/c/type_array/int32.h +++ b/level_0/f_type_array/c/type_array/int32.h @@ -17,7 +17,9 @@ extern "C" { #endif /** - * A callback intended to be passed to f_memory_arrays_adjust() for an f_int32ss_t structure. + * A callback intended to be passed to f_memory_arrays_resize() for an f_int32ss_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. * * This does not do parameter checking. * @@ -34,17 +36,19 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_memory_array_adjust(). + * Errors (with error bit) from: f_memory_array_resize(). * - * @see f_memory_array_adjust() - * @see f_memory_arrays_adjust() + * @see f_memory_array_resize() + * @see f_memory_arrays_resize() */ -#ifndef _di_f_int32s_adjust_callback_ - extern f_status_t f_int32s_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_int32s_adjust_callback_ +#ifndef _di_f_int32ss_delete_callback_ + extern f_status_t f_int32ss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_int32ss_delete_callback_ /** - * A callback intended to be passed to f_memory_arrays_resize() for an f_int32ss_t structure. + * A callback intended to be passed to f_memory_arrays_adjust() for an f_int32ss_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. * * This does not do parameter checking. * @@ -61,14 +65,14 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_memory_array_resize(). + * Errors (with error bit) from: f_memory_array_adjust(). * - * @see f_memory_array_resize() - * @see f_memory_arrays_resize() + * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() */ -#ifndef _di_f_int32s_resize_callback_ - extern f_status_t f_int32s_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_int32s_resize_callback_ +#ifndef _di_f_int32ss_destroy_callback_ + extern f_status_t f_int32ss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_int32ss_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/int64.c b/level_0/f_type_array/c/type_array/int64.c index 2cb85dd..dddd46b 100644 --- a/level_0/f_type_array/c/type_array/int64.c +++ b/level_0/f_type_array/c/type_array/int64.c @@ -5,8 +5,8 @@ extern "C" { #endif -#ifndef _di_f_int64s_adjust_callback_ - f_status_t f_int64s_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_int64ss_delete_callback_ + f_status_t f_int64ss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { f_int64s_t * const array = (f_int64s_t *) void_array; @@ -14,17 +14,19 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_memory_array_adjust(0, sizeof(int64_t), (void **) &array[i].array, &array[i].used, &array[i].size); - if (F_status_is_error(status)) return status; + if (array[i].size) { + status = f_memory_array_resize(0, sizeof(int64_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } } // for } return F_none; } -#endif // _di_f_int64s_adjust_callback_ +#endif // _di_f_int64ss_delete_callback_ -#ifndef _di_f_int64s_resize_callback_ - f_status_t f_int64s_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_int64ss_destroy_callback_ + f_status_t f_int64ss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { f_int64s_t * const array = (f_int64s_t *) void_array; @@ -32,14 +34,16 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_memory_array_resize(0, sizeof(int64_t), (void **) &array[i].array, &array[i].used, &array[i].size); - if (F_status_is_error(status)) return status; + if (array[i].size) { + status = f_memory_array_adjust(0, sizeof(int64_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } } // for } return F_none; } -#endif // _di_f_int64s_resize_callback_ +#endif // _di_f_int64ss_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/int64.h b/level_0/f_type_array/c/type_array/int64.h index 6cb81c0..d8ba3c1 100644 --- a/level_0/f_type_array/c/type_array/int64.h +++ b/level_0/f_type_array/c/type_array/int64.h @@ -17,7 +17,9 @@ extern "C" { #endif /** - * A callback intended to be passed to f_memory_arrays_adjust() for an f_int64ss_t structure. + * A callback intended to be passed to f_memory_arrays_resize() for an f_int64ss_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. * * This does not do parameter checking. * @@ -34,17 +36,19 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_memory_array_adjust(). + * Errors (with error bit) from: f_memory_array_resize(). * - * @see f_memory_array_adjust() - * @see f_memory_arrays_adjust() + * @see f_memory_array_resize() + * @see f_memory_arrays_resize() */ -#ifndef _di_f_int64s_adjust_callback_ - extern f_status_t f_int64s_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_int64s_adjust_callback_ +#ifndef _di_f_int64ss_delete_callback_ + extern f_status_t f_int64ss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_int64ss_delete_callback_ /** - * A callback intended to be passed to f_memory_arrays_resize() for an f_int64ss_t structure. + * A callback intended to be passed to f_memory_arrays_adjust() for an f_int64ss_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. * * This does not do parameter checking. * @@ -61,14 +65,14 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_memory_array_resize(). + * Errors (with error bit) from: f_memory_array_adjust(). * - * @see f_memory_array_resize() - * @see f_memory_arrays_resize() + * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() */ -#ifndef _di_f_int64s_resize_callback_ - extern f_status_t f_int64s_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_int64s_resize_callback_ +#ifndef _di_f_int64ss_destroy_callback_ + extern f_status_t f_int64ss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_int64ss_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/int8.c b/level_0/f_type_array/c/type_array/int8.c index 44f1479..ea70902 100644 --- a/level_0/f_type_array/c/type_array/int8.c +++ b/level_0/f_type_array/c/type_array/int8.c @@ -5,8 +5,8 @@ extern "C" { #endif -#ifndef _di_f_int8s_adjust_callback_ - f_status_t f_int8s_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_int8ss_delete_callback_ + f_status_t f_int8ss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { f_int8s_t * const array = (f_int8s_t *) void_array; @@ -14,17 +14,19 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_memory_array_adjust(0, sizeof(int8_t), (void **) &array[i].array, &array[i].used, &array[i].size); - if (F_status_is_error(status)) return status; + if (array[i].size) { + status = f_memory_array_resize(0, sizeof(int8_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } } // for } return F_none; } -#endif // _di_f_int8s_adjust_callback_ +#endif // _di_f_int8ss_delete_callback_ -#ifndef _di_f_int8s_resize_callback_ - f_status_t f_int8s_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_int8ss_destroy_callback_ + f_status_t f_int8ss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { f_int8s_t * const array = (f_int8s_t *) void_array; @@ -32,14 +34,16 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_memory_array_resize(0, sizeof(int8_t), (void **) &array[i].array, &array[i].used, &array[i].size); - if (F_status_is_error(status)) return status; + if (array[i].size) { + status = f_memory_array_adjust(0, sizeof(int8_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } } // for } return F_none; } -#endif // _di_f_int8s_resize_callback_ +#endif // _di_f_int8ss_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/int8.h b/level_0/f_type_array/c/type_array/int8.h index 6478f18..bfffb0f 100644 --- a/level_0/f_type_array/c/type_array/int8.h +++ b/level_0/f_type_array/c/type_array/int8.h @@ -17,7 +17,9 @@ extern "C" { #endif /** - * A callback intended to be passed to f_memory_arrays_adjust() for an f_int8ss_t structure. + * A callback intended to be passed to f_memory_arrays_resize() for an f_int8ss_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. * * This does not do parameter checking. * @@ -34,17 +36,19 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_memory_array_adjust(). + * Errors (with error bit) from: f_memory_array_resize(). * - * @see f_memory_array_adjust() - * @see f_memory_arrays_adjust() + * @see f_memory_array_resize() + * @see f_memory_arrays_resize() */ -#ifndef _di_f_int8s_adjust_callback_ - extern f_status_t f_int8s_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_int8s_adjust_callback_ +#ifndef _di_f_int8ss_delete_callback_ + extern f_status_t f_int8ss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_int8ss_delete_callback_ /** - * A callback intended to be passed to f_memory_arrays_resize() for an f_int8ss_t structure. + * A callback intended to be passed to f_memory_arrays_adjust() for an f_int8ss_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. * * This does not do parameter checking. * @@ -61,14 +65,14 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_memory_array_resize(). + * Errors (with error bit) from: f_memory_array_adjust(). * - * @see f_memory_array_resize() - * @see f_memory_arrays_resize() + * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() */ -#ifndef _di_f_int8s_resize_callback_ - extern f_status_t f_int8s_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_int8s_resize_callback_ +#ifndef _di_f_int8ss_destroy_callback_ + extern f_status_t f_int8ss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_int8ss_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/number_unsigned.c b/level_0/f_type_array/c/type_array/number_unsigned.c index 80207ee..913a6df 100644 --- a/level_0/f_type_array/c/type_array/number_unsigned.c +++ b/level_0/f_type_array/c/type_array/number_unsigned.c @@ -5,8 +5,8 @@ extern "C" { #endif -#ifndef _di_f_number_unsigneds_adjust_callback_ - f_status_t f_number_unsigneds_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_number_unsignedss_delete_callback_ + f_status_t f_number_unsignedss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { f_number_unsigneds_t * const array = (f_number_unsigneds_t *) void_array; @@ -14,17 +14,19 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_memory_array_adjust(0, sizeof(f_number_unsigned_t), (void **) &array[i].array, &array[i].used, &array[i].size); - if (F_status_is_error(status)) return status; + if (array[i].size) { + status = f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } } // for } return F_none; } -#endif // _di_f_number_unsigneds_adjust_callback_ +#endif // _di_f_number_unsignedss_delete_callback_ -#ifndef _di_f_number_unsigneds_resize_callback_ - f_status_t f_number_unsigneds_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_number_unsignedss_destroy_callback_ + f_status_t f_number_unsignedss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { f_number_unsigneds_t * const array = (f_number_unsigneds_t *) void_array; @@ -32,14 +34,16 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &array[i].array, &array[i].used, &array[i].size); - if (F_status_is_error(status)) return status; + if (array[i].size) { + status = f_memory_array_adjust(0, sizeof(f_number_unsigned_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } } // for } return F_none; } -#endif // _di_f_number_unsigneds_resize_callback_ +#endif // _di_f_number_unsignedss_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/number_unsigned.h b/level_0/f_type_array/c/type_array/number_unsigned.h index b480f37..167f1bb 100644 --- a/level_0/f_type_array/c/type_array/number_unsigned.h +++ b/level_0/f_type_array/c/type_array/number_unsigned.h @@ -17,7 +17,9 @@ extern "C" { #endif /** - * A callback intended to be passed to f_memory_arrays_adjust() for an f_number_unsignedss_t structure. + * A callback intended to be passed to f_memory_arrays_resize() for an f_number_unsignedss_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. * * This does not do parameter checking. * @@ -34,17 +36,19 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_memory_array_adjust(). + * Errors (with error bit) from: f_memory_array_resize(). * - * @see f_memory_array_adjust() - * @see f_memory_arrays_adjust() + * @see f_memory_array_resize() + * @see f_memory_arrays_resize() */ -#ifndef _di_f_number_unsigneds_adjust_callback_ - extern f_status_t f_number_unsigneds_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_number_unsigneds_adjust_callback_ +#ifndef _di_f_number_unsignedss_delete_callback_ + extern f_status_t f_number_unsignedss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_number_unsignedss_delete_callback_ /** - * A callback intended to be passed to f_memory_arrays_resize() for an f_number_unsignedss_t structure. + * A callback intended to be passed to f_memory_arrays_adjust() for an f_number_unsignedss_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. * * This does not do parameter checking. * @@ -61,14 +65,14 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_memory_array_resize(). + * Errors (with error bit) from: f_memory_array_adjust(). * - * @see f_memory_array_resize() - * @see f_memory_arrays_resize() + * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() */ -#ifndef _di_f_number_unsigneds_resize_callback_ - extern f_status_t f_number_unsigneds_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_number_unsigneds_resize_callback_ +#ifndef _di_f_number_unsignedss_destroy_callback_ + extern f_status_t f_number_unsignedss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_number_unsignedss_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/poll.c b/level_0/f_type_array/c/type_array/poll.c index 356bdd1..f00ae9b 100644 --- a/level_0/f_type_array/c/type_array/poll.c +++ b/level_0/f_type_array/c/type_array/poll.c @@ -6,8 +6,8 @@ extern "C" { #endif -#ifndef _di_f_polls_adjust_callback_ - f_status_t f_polls_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_pollss_delete_callback_ + f_status_t f_pollss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { f_polls_t * const array = (f_polls_t *) void_array; @@ -15,17 +15,19 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_memory_array_adjust(0, sizeof(f_poll_t), (void **) &array[i].array, &array[i].used, &array[i].size); - if (F_status_is_error(status)) return status; + if (array[i].size) { + status = f_memory_array_resize(0, sizeof(f_poll_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } } // for } return F_none; } -#endif // _di_f_polls_adjust_callback_ +#endif // _di_f_pollss_delete_callback_ -#ifndef _di_f_polls_resize_callback_ - f_status_t f_polls_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_pollss_destroy_callback_ + f_status_t f_pollss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { f_polls_t * const array = (f_polls_t *) void_array; @@ -33,14 +35,16 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_memory_array_resize(0, sizeof(f_poll_t), (void **) &array[i].array, &array[i].used, &array[i].size); - if (F_status_is_error(status)) return status; + if (array[i].size) { + status = f_memory_array_adjust(0, sizeof(f_poll_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } } // for } return F_none; } -#endif // _di_f_polls_resize_callback_ +#endif // _di_f_pollss_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/poll.h b/level_0/f_type_array/c/type_array/poll.h index cf65de3..4a3c315 100644 --- a/level_0/f_type_array/c/type_array/poll.h +++ b/level_0/f_type_array/c/type_array/poll.h @@ -17,7 +17,9 @@ extern "C" { #endif /** - * A callback intended to be passed to f_memory_arrays_adjust() for an f_pollss_t structure. + * A callback intended to be passed to f_memory_arrays_resize() for an f_pollss_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. * * This does not do parameter checking. * @@ -34,17 +36,19 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_memory_array_adjust(). + * Errors (with error bit) from: f_memory_array_resize(). * - * @see f_memory_array_adjust() - * @see f_memory_arrays_adjust() + * @see f_memory_array_resize() + * @see f_memory_arrays_resize() */ -#ifndef _di_f_polls_adjust_callback_ - extern f_status_t f_polls_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_polls_adjust_callback_ +#ifndef _di_f_pollss_delete_callback_ + extern f_status_t f_pollss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_pollss_delete_callback_ /** - * A callback intended to be passed to f_memory_arrays_resize() for an f_pollss_t structure. + * A callback intended to be passed to f_memory_arrays_adjust() for an f_pollss_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. * * This does not do parameter checking. * @@ -61,14 +65,14 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_memory_array_resize(). + * Errors (with error bit) from: f_memory_array_adjust(). * - * @see f_memory_array_resize() - * @see f_memory_arrays_resize() + * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() */ -#ifndef _di_f_polls_resize_callback_ - extern f_status_t f_polls_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_polls_resize_callback_ +#ifndef _di_f_pollss_destroy_callback_ + extern f_status_t f_pollss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_pollss_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/state.c b/level_0/f_type_array/c/type_array/state.c index 238116b..374351e 100644 --- a/level_0/f_type_array/c/type_array/state.c +++ b/level_0/f_type_array/c/type_array/state.c @@ -5,8 +5,8 @@ extern "C" { #endif -#ifndef _di_f_states_adjust_callback_ - f_status_t f_states_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_statess_delete_callback_ + f_status_t f_statess_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { f_states_t * const array = (f_states_t *) void_array; @@ -14,17 +14,19 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_memory_array_adjust(0, sizeof(f_state_t), (void **) &array[i].array, &array[i].used, &array[i].size); - if (F_status_is_error(status)) return status; + if (array[i].size) { + status = f_memory_array_resize(0, sizeof(f_state_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } } // for } return F_none; } -#endif // _di_f_states_adjust_callback_ +#endif // _di_f_statess_delete_callback_ -#ifndef _di_f_states_resize_callback_ - f_status_t f_states_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_statess_destroy_callback_ + f_status_t f_statess_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { f_states_t * const array = (f_states_t *) void_array; @@ -32,14 +34,16 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_memory_array_resize(0, sizeof(f_state_t), (void **) &array[i].array, &array[i].used, &array[i].size); - if (F_status_is_error(status)) return status; + if (array[i].size) { + status = f_memory_array_adjust(0, sizeof(f_state_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } } // for } return F_none; } -#endif // _di_f_states_resize_callback_ +#endif // _di_f_statess_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/state.h b/level_0/f_type_array/c/type_array/state.h index 9bde006..ab30f58 100644 --- a/level_0/f_type_array/c/type_array/state.h +++ b/level_0/f_type_array/c/type_array/state.h @@ -17,7 +17,9 @@ extern "C" { #endif /** - * A callback intended to be passed to f_memory_arrays_adjust() for an f_statess_t structure. + * A callback intended to be passed to f_memory_arrays_resize() for an f_statess_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. * * This does not do parameter checking. * @@ -34,17 +36,19 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_memory_array_adjust(). + * Errors (with error bit) from: f_memory_array_resize(). * - * @see f_memory_array_adjust() - * @see f_memory_arrays_adjust() + * @see f_memory_array_resize() + * @see f_memory_arrays_resize() */ -#ifndef _di_f_states_adjust_callback_ - extern f_status_t f_states_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_states_adjust_callback_ +#ifndef _di_f_statess_delete_callback_ + extern f_status_t f_statess_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_statess_delete_callback_ /** - * A callback intended to be passed to f_memory_arrays_resize() for an f_statess_t structure. + * A callback intended to be passed to f_memory_arrays_adjust() for an f_statess_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. * * This does not do parameter checking. * @@ -61,14 +65,14 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_memory_array_resize(). + * Errors (with error bit) from: f_memory_array_adjust(). * - * @see f_memory_array_resize() - * @see f_memory_arrays_resize() + * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() */ -#ifndef _di_f_states_resize_callback_ - extern f_status_t f_states_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_states_resize_callback_ +#ifndef _di_f_statess_destroy_callback_ + extern f_status_t f_statess_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_statess_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/status.c b/level_0/f_type_array/c/type_array/status.c index eb5ad0d..48415a8 100644 --- a/level_0/f_type_array/c/type_array/status.c +++ b/level_0/f_type_array/c/type_array/status.c @@ -5,8 +5,8 @@ extern "C" { #endif -#ifndef _di_f_statuss_adjust_callback_ - f_status_t f_statuss_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_statusss_delete_callback_ + f_status_t f_statusss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { f_statuss_t * const array = (f_statuss_t *) void_array; @@ -14,17 +14,19 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_memory_array_adjust(0, sizeof(f_status_t), (void **) &array[i].array, &array[i].used, &array[i].size); - if (F_status_is_error(status)) return status; + if (array[i].size) { + status = f_memory_array_resize(0, sizeof(f_status_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } } // for } return F_none; } -#endif // _di_f_statuss_adjust_callback_ +#endif // _di_f_statusss_delete_callback_ -#ifndef _di_f_statuss_resize_callback_ - f_status_t f_statuss_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_statusss_destroy_callback_ + f_status_t f_statusss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { f_statuss_t * const array = (f_statuss_t *) void_array; @@ -32,14 +34,16 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_memory_array_resize(0, sizeof(f_status_t), (void **) &array[i].array, &array[i].used, &array[i].size); - if (F_status_is_error(status)) return status; + if (array[i].size) { + status = f_memory_array_adjust(0, sizeof(f_status_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } } // for } return F_none; } -#endif // _di_f_statuss_resize_callback_ +#endif // _di_f_statusss_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/status.h b/level_0/f_type_array/c/type_array/status.h index 8f4ab6a..b6aa5d7 100644 --- a/level_0/f_type_array/c/type_array/status.h +++ b/level_0/f_type_array/c/type_array/status.h @@ -17,7 +17,9 @@ extern "C" { #endif /** - * A callback intended to be passed to f_memory_arrays_adjust() for an f_statusss_t structure. + * A callback intended to be passed to f_memory_arrays_resize() for an f_statusss_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. * * This does not do parameter checking. * @@ -34,17 +36,19 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_memory_array_adjust(). + * Errors (with error bit) from: f_memory_array_resize(). * - * @see f_memory_array_adjust() - * @see f_memory_arrays_adjust() + * @see f_memory_array_resize() + * @see f_memory_arrays_resize() */ -#ifndef _di_f_statuss_adjust_callback_ - extern f_status_t f_statuss_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_statuss_adjust_callback_ +#ifndef _di_f_statusss_delete_callback_ + extern f_status_t f_statusss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_statusss_delete_callback_ /** - * A callback intended to be passed to f_memory_arrays_resize() for an f_statusss_t structure. + * A callback intended to be passed to f_memory_arrays_adjust() for an f_statusss_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. * * This does not do parameter checking. * @@ -61,14 +65,14 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_memory_array_resize(). + * Errors (with error bit) from: f_memory_array_adjust(). * - * @see f_memory_array_resize() - * @see f_memory_arrays_resize() + * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() */ -#ifndef _di_f_statuss_resize_callback_ - extern f_status_t f_statuss_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_statuss_resize_callback_ +#ifndef _di_f_statusss_destroy_callback_ + extern f_status_t f_statusss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_statusss_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/uint128.c b/level_0/f_type_array/c/type_array/uint128.c index 3aa63bb..01905ed 100644 --- a/level_0/f_type_array/c/type_array/uint128.c +++ b/level_0/f_type_array/c/type_array/uint128.c @@ -5,8 +5,8 @@ extern "C" { #endif -#ifndef _di_f_uint128s_adjust_callback_ - f_status_t f_uint128s_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_uint128ss_delete_callback_ + f_status_t f_uint128ss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { f_uint128s_t * const array = (f_uint128s_t *) void_array; @@ -14,17 +14,19 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_memory_array_adjust(0, sizeof(f_uint128_t), (void **) &array[i].array, &array[i].used, &array[i].size); - if (F_status_is_error(status)) return status; + if (array[i].size) { + status = f_memory_array_resize(0, sizeof(f_uint128_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } } // for } return F_none; } -#endif // _di_f_uint128s_adjust_callback_ +#endif // _di_f_uint128ss_delete_callback_ -#ifndef _di_f_uint128s_resize_callback_ - f_status_t f_uint128s_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_uint128ss_destroy_callback_ + f_status_t f_uint128ss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { f_uint128s_t * const array = (f_uint128s_t *) void_array; @@ -32,14 +34,16 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_memory_array_resize(0, sizeof(f_uint128_t), (void **) &array[i].array, &array[i].used, &array[i].size); - if (F_status_is_error(status)) return status; + if (array[i].size) { + status = f_memory_array_adjust(0, sizeof(f_uint128_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } } // for } return F_none; } -#endif // _di_f_uint128s_resize_callback_ +#endif // _di_f_uint128ss_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/uint128.h b/level_0/f_type_array/c/type_array/uint128.h index f3c9a0d..8fa67d3 100644 --- a/level_0/f_type_array/c/type_array/uint128.h +++ b/level_0/f_type_array/c/type_array/uint128.h @@ -17,7 +17,9 @@ extern "C" { #endif /** - * A callback intended to be passed to f_memory_arrays_adjust() for an f_uint128ss_t structure. + * A callback intended to be passed to f_memory_arrays_resize() for an f_uint128ss_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. * * This does not do parameter checking. * @@ -34,17 +36,19 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_memory_array_adjust(). + * Errors (with error bit) from: f_memory_array_resize(). * - * @see f_memory_array_adjust() - * @see f_memory_arrays_adjust() + * @see f_memory_array_resize() + * @see f_memory_arrays_resize() */ -#ifndef _di_f_uint128s_adjust_callback_ - extern f_status_t f_uint128s_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_uint128s_adjust_callback_ +#ifndef _di_f_uint128ss_delete_callback_ + extern f_status_t f_uint128ss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_uint128ss_delete_callback_ /** - * A callback intended to be passed to f_memory_arrays_resize() for an f_uint128ss_t structure. + * A callback intended to be passed to f_memory_arrays_adjust() for an f_uint128ss_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. * * This does not do parameter checking. * @@ -61,14 +65,14 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_memory_array_resize(). + * Errors (with error bit) from: f_memory_array_adjust(). * - * @see f_memory_array_resize() - * @see f_memory_arrays_resize() + * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() */ -#ifndef _di_f_uint128s_resize_callback_ - extern f_status_t f_uint128s_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_uint128s_resize_callback_ +#ifndef _di_f_uint128ss_destroy_callback_ + extern f_status_t f_uint128ss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_uint128ss_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/uint16.c b/level_0/f_type_array/c/type_array/uint16.c index 4775275..8f16900 100644 --- a/level_0/f_type_array/c/type_array/uint16.c +++ b/level_0/f_type_array/c/type_array/uint16.c @@ -5,8 +5,8 @@ extern "C" { #endif -#ifndef _di_f_uint16s_adjust_callback_ - f_status_t f_uint16s_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_uint16ss_delete_callback_ + f_status_t f_uint16ss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { f_uint16s_t * const array = (f_uint16s_t *) void_array; @@ -14,17 +14,19 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_memory_array_adjust(0, sizeof(uint16_t), (void **) &array[i].array, &array[i].used, &array[i].size); - if (F_status_is_error(status)) return status; + if (array[i].size) { + status = f_memory_array_resize(0, sizeof(uint16_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } } // for } return F_none; } -#endif // _di_f_uint16s_adjust_callback_ +#endif // _di_f_uint16ss_delete_callback_ -#ifndef _di_f_uint16s_resize_callback_ - f_status_t f_uint16s_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_uint16ss_destroy_callback_ + f_status_t f_uint16ss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { f_uint16s_t * const array = (f_uint16s_t *) void_array; @@ -32,14 +34,16 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_memory_array_resize(0, sizeof(uint16_t), (void **) &array[i].array, &array[i].used, &array[i].size); - if (F_status_is_error(status)) return status; + if (array[i].size) { + status = f_memory_array_adjust(0, sizeof(uint16_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } } // for } return F_none; } -#endif // _di_f_uint16s_resize_callback_ +#endif // _di_f_uint16ss_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/uint16.h b/level_0/f_type_array/c/type_array/uint16.h index b8f952e..8b83bd4 100644 --- a/level_0/f_type_array/c/type_array/uint16.h +++ b/level_0/f_type_array/c/type_array/uint16.h @@ -17,7 +17,9 @@ extern "C" { #endif /** - * A callback intended to be passed to f_memory_arrays_adjust() for an f_uint16ss_t structure. + * A callback intended to be passed to f_memory_arrays_resize() for an f_uint16ss_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. * * This does not do parameter checking. * @@ -34,17 +36,19 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_memory_array_adjust(). + * Errors (with error bit) from: f_memory_array_resize(). * - * @see f_memory_array_adjust() - * @see f_memory_arrays_adjust() + * @see f_memory_array_resize() + * @see f_memory_arrays_resize() */ -#ifndef _di_f_uint16s_adjust_callback_ - extern f_status_t f_uint16s_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_uint16s_adjust_callback_ +#ifndef _di_f_uint16ss_delete_callback_ + extern f_status_t f_uint16ss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_uint16ss_delete_callback_ /** - * A callback intended to be passed to f_memory_arrays_resize() for an f_uint16ss_t structure. + * A callback intended to be passed to f_memory_arrays_adjust() for an f_uint16ss_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. * * This does not do parameter checking. * @@ -61,14 +65,14 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_memory_array_resize(). + * Errors (with error bit) from: f_memory_array_adjust(). * - * @see f_memory_array_resize() - * @see f_memory_arrays_resize() + * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() */ -#ifndef _di_f_uint16s_resize_callback_ - extern f_status_t f_uint16s_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_uint16s_resize_callback_ +#ifndef _di_f_uint16ss_destroy_callback_ + extern f_status_t f_uint16ss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_uint16ss_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/uint32.c b/level_0/f_type_array/c/type_array/uint32.c index 4a76c45..1b37494 100644 --- a/level_0/f_type_array/c/type_array/uint32.c +++ b/level_0/f_type_array/c/type_array/uint32.c @@ -5,8 +5,8 @@ extern "C" { #endif -#ifndef _di_f_uint32s_adjust_callback_ - f_status_t f_uint32s_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_uint32ss_delete_callback_ + f_status_t f_uint32ss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { f_uint32s_t * const array = (f_uint32s_t *) void_array; @@ -14,17 +14,19 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_memory_array_adjust(0, sizeof(uint32_t), (void **) &array[i].array, &array[i].used, &array[i].size); - if (F_status_is_error(status)) return status; + if (array[i].size) { + status = f_memory_array_resize(0, sizeof(uint32_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } } // for } return F_none; } -#endif // _di_f_uint32s_adjust_callback_ +#endif // _di_f_uint32ss_delete_callback_ -#ifndef _di_f_uint32s_resize_callback_ - f_status_t f_uint32s_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_uint32ss_destroy_callback_ + f_status_t f_uint32ss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { f_uint32s_t * const array = (f_uint32s_t *) void_array; @@ -32,14 +34,16 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_memory_array_resize(0, sizeof(uint32_t), (void **) &array[i].array, &array[i].used, &array[i].size); - if (F_status_is_error(status)) return status; + if (array[i].size) { + status = f_memory_array_adjust(0, sizeof(uint32_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } } // for } return F_none; } -#endif // _di_f_uint32s_resize_callback_ +#endif // _di_f_uint32ss_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/uint32.h b/level_0/f_type_array/c/type_array/uint32.h index 59f889d..79749e8 100644 --- a/level_0/f_type_array/c/type_array/uint32.h +++ b/level_0/f_type_array/c/type_array/uint32.h @@ -17,7 +17,9 @@ extern "C" { #endif /** - * A callback intended to be passed to f_memory_arrays_adjust() for an f_uint32ss_t structure. + * A callback intended to be passed to f_memory_arrays_resize() for an f_uint32ss_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. * * This does not do parameter checking. * @@ -34,17 +36,19 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_memory_array_adjust(). + * Errors (with error bit) from: f_memory_array_resize(). * - * @see f_memory_array_adjust() - * @see f_memory_arrays_adjust() + * @see f_memory_array_resize() + * @see f_memory_arrays_resize() */ -#ifndef _di_f_uint32s_adjust_callback_ - extern f_status_t f_uint32s_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_uint32s_adjust_callback_ +#ifndef _di_f_uint32ss_delete_callback_ + extern f_status_t f_uint32ss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_uint32ss_delete_callback_ /** - * A callback intended to be passed to f_memory_arrays_resize() for an f_uint32ss_t structure. + * A callback intended to be passed to f_memory_arrays_adjust() for an f_uint32ss_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. * * This does not do parameter checking. * @@ -61,14 +65,14 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_memory_array_resize(). + * Errors (with error bit) from: f_memory_array_adjust(). * - * @see f_memory_array_resize() - * @see f_memory_arrays_resize() + * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() */ -#ifndef _di_f_uint32s_resize_callback_ - extern f_status_t f_uint32s_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_uint32s_resize_callback_ +#ifndef _di_f_uint32ss_destroy_callback_ + extern f_status_t f_uint32ss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_uint32ss_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/uint64.c b/level_0/f_type_array/c/type_array/uint64.c index d3ca294..d0774ed 100644 --- a/level_0/f_type_array/c/type_array/uint64.c +++ b/level_0/f_type_array/c/type_array/uint64.c @@ -5,8 +5,8 @@ extern "C" { #endif -#ifndef _di_f_uint64s_adjust_callback_ - f_status_t f_uint64s_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_uint64ss_delete_callback_ + f_status_t f_uint64ss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { f_uint64s_t * const array = (f_uint64s_t *) void_array; @@ -14,17 +14,19 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_memory_array_adjust(0, sizeof(uint64_t), (void **) &array[i].array, &array[i].used, &array[i].size); - if (F_status_is_error(status)) return status; + if (array[i].size) { + status = f_memory_array_resize(0, sizeof(uint64_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } } // for } return F_none; } -#endif // _di_f_uint64s_adjust_callback_ +#endif // _di_f_uint64ss_delete_callback_ -#ifndef _di_f_uint64s_resize_callback_ - f_status_t f_uint64s_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_uint64ss_destroy_callback_ + f_status_t f_uint64ss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { f_uint64s_t * const array = (f_uint64s_t *) void_array; @@ -32,14 +34,16 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_memory_array_resize(0, sizeof(uint64_t), (void **) &array[i].array, &array[i].used, &array[i].size); - if (F_status_is_error(status)) return status; + if (array[i].size) { + status = f_memory_array_adjust(0, sizeof(uint64_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } } // for } return F_none; } -#endif // _di_f_uint64s_resize_callback_ +#endif // _di_f_uint64ss_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/uint64.h b/level_0/f_type_array/c/type_array/uint64.h index e3fcfeb..0d002c7 100644 --- a/level_0/f_type_array/c/type_array/uint64.h +++ b/level_0/f_type_array/c/type_array/uint64.h @@ -17,7 +17,9 @@ extern "C" { #endif /** - * A callback intended to be passed to f_memory_arrays_adjust() for an f_uint64ss_t structure. + * A callback intended to be passed to f_memory_arrays_resize() for an f_uint64ss_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. * * This does not do parameter checking. * @@ -34,17 +36,19 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_memory_array_adjust(). + * Errors (with error bit) from: f_memory_array_resize(). * - * @see f_memory_array_adjust() - * @see f_memory_arrays_adjust() + * @see f_memory_array_resize() + * @see f_memory_arrays_resize() */ -#ifndef _di_f_uint64s_adjust_callback_ - extern f_status_t f_uint64s_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_uint64s_adjust_callback_ +#ifndef _di_f_uint64ss_delete_callback_ + extern f_status_t f_uint64ss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_uint64ss_delete_callback_ /** - * A callback intended to be passed to f_memory_arrays_resize() for an f_uint64ss_t structure. + * A callback intended to be passed to f_memory_arrays_adjust() for an f_uint64ss_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. * * This does not do parameter checking. * @@ -61,14 +65,14 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_memory_array_resize(). + * Errors (with error bit) from: f_memory_array_adjust(). * - * @see f_memory_array_resize() - * @see f_memory_arrays_resize() + * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() */ -#ifndef _di_f_uint64s_resize_callback_ - extern f_status_t f_uint64s_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_uint64s_resize_callback_ +#ifndef _di_f_uint64ss_destroy_callback_ + extern f_status_t f_uint64ss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_uint64ss_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/uint8.c b/level_0/f_type_array/c/type_array/uint8.c index c10f751..aa62619 100644 --- a/level_0/f_type_array/c/type_array/uint8.c +++ b/level_0/f_type_array/c/type_array/uint8.c @@ -5,8 +5,8 @@ extern "C" { #endif -#ifndef _di_f_uint8s_adjust_callback_ - f_status_t f_uint8s_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_uint8ss_delete_callback_ + f_status_t f_uint8ss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { f_uint8s_t * const array = (f_uint8s_t *) void_array; @@ -14,17 +14,19 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_memory_array_adjust(0, sizeof(uint8_t), (void **) &array[i].array, &array[i].used, &array[i].size); - if (F_status_is_error(status)) return status; + if (array[i].size) { + status = f_memory_array_resize(0, sizeof(uint8_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } } // for } return F_none; } -#endif // _di_f_uint8s_adjust_callback_ +#endif // _di_f_uint8ss_delete_callback_ -#ifndef _di_f_uint8s_resize_callback_ - f_status_t f_uint8s_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { +#ifndef _di_f_uint8ss_destroy_callback_ + f_status_t f_uint8ss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { { f_uint8s_t * const array = (f_uint8s_t *) void_array; @@ -32,14 +34,16 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_memory_array_resize(0, sizeof(uint8_t), (void **) &array[i].array, &array[i].used, &array[i].size); - if (F_status_is_error(status)) return status; + if (array[i].size) { + status = f_memory_array_adjust(0, sizeof(uint8_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } } // for } return F_none; } -#endif // _di_f_uint8s_resize_callback_ +#endif // _di_f_uint8ss_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/uint8.h b/level_0/f_type_array/c/type_array/uint8.h index c786cf7..1bb09d9 100644 --- a/level_0/f_type_array/c/type_array/uint8.h +++ b/level_0/f_type_array/c/type_array/uint8.h @@ -17,7 +17,9 @@ extern "C" { #endif /** - * A callback intended to be passed to f_memory_arrays_adjust() for an f_uint8ss_t structure. + * A callback intended to be passed to f_memory_arrays_resize() for an f_uint8ss_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. * * This does not do parameter checking. * @@ -34,17 +36,19 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_memory_array_adjust(). + * Errors (with error bit) from: f_memory_array_resize(). * - * @see f_memory_array_adjust() - * @see f_memory_arrays_adjust() + * @see f_memory_array_resize() + * @see f_memory_arrays_resize() */ -#ifndef _di_f_uint8s_adjust_callback_ - extern f_status_t f_uint8s_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_uint8s_adjust_callback_ +#ifndef _di_f_uint8ss_delete_callback_ + extern f_status_t f_uint8ss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_uint8ss_delete_callback_ /** - * A callback intended to be passed to f_memory_arrays_resize() for an f_uint8ss_t structure. + * A callback intended to be passed to f_memory_arrays_adjust() for an f_uint8ss_t structure. + * + * This is only called when shrinking the array and generally should perform deallocations. * * This does not do parameter checking. * @@ -61,14 +65,14 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_memory_array_resize(). + * Errors (with error bit) from: f_memory_array_adjust(). * - * @see f_memory_array_resize() - * @see f_memory_arrays_resize() + * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() */ -#ifndef _di_f_uint8s_resize_callback_ - extern f_status_t f_uint8s_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); -#endif // _di_f_uint8s_resize_callback_ +#ifndef _di_f_uint8ss_destroy_callback_ + extern f_status_t f_uint8ss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_uint8ss_destroy_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/data/build/settings-tests b/level_0/f_type_array/data/build/settings-tests index 6fb52f6..0518496 100644 --- a/level_0/f_type_array/data/build/settings-tests +++ b/level_0/f_type_array/data/build/settings-tests @@ -23,23 +23,23 @@ build_language c build_libraries -lc -lcmocka build_libraries-individual -lf_memory -lf_type_array -build_sources_program test-type_array-cells_adjust_callback.c test-type_array-cells_resize_callback.c -build_sources_program test-type_array-files_adjust_callback.c test-type_array-files_resize_callback.c -build_sources_program test-type_array-fll_ids_adjust_callback.c test-type_array-fll_ids_resize_callback.c -build_sources_program test-type_array-int8s_adjust_callback.c test-type_array-int8s_resize_callback.c -build_sources_program test-type_array-int16s_adjust_callback.c test-type_array-int16s_resize_callback.c -build_sources_program test-type_array-int32s_adjust_callback.c test-type_array-int32s_resize_callback.c -build_sources_program test-type_array-int64s_adjust_callback.c test-type_array-int64s_resize_callback.c -build_sources_program test-type_array-int128s_adjust_callback.c test-type_array-int128s_resize_callback.c -build_sources_program test-type_array-number_unsigneds_adjust_callback.c test-type_array-number_unsigneds_resize_callback.c -build_sources_program test-type_array-polls_adjust_callback.c test-type_array-polls_resize_callback.c -build_sources_program test-type_array-states_adjust_callback.c test-type_array-states_resize_callback.c -build_sources_program test-type_array-statuss_adjust_callback.c test-type_array-statuss_resize_callback.c -build_sources_program test-type_array-uint8s_adjust_callback.c test-type_array-uint8s_resize_callback.c -build_sources_program test-type_array-uint16s_adjust_callback.c test-type_array-uint16s_resize_callback.c -build_sources_program test-type_array-uint32s_adjust_callback.c test-type_array-uint32s_resize_callback.c -build_sources_program test-type_array-uint64s_adjust_callback.c test-type_array-uint64s_resize_callback.c -build_sources_program test-type_array-uint128s_adjust_callback.c test-type_array-uint128s_resize_callback.c +build_sources_program test-type_array-cells_destroy_callback.c test-type_array-cells_delete_callback.c +build_sources_program test-type_array-files_destroy_callback.c test-type_array-files_delete_callback.c +build_sources_program test-type_array-fll_ids_destroy_callback.c test-type_array-fll_ids_delete_callback.c +build_sources_program test-type_array-int8s_destroy_callback.c test-type_array-int8s_delete_callback.c +build_sources_program test-type_array-int16s_destroy_callback.c test-type_array-int16s_delete_callback.c +build_sources_program test-type_array-int32s_destroy_callback.c test-type_array-int32s_delete_callback.c +build_sources_program test-type_array-int64s_destroy_callback.c test-type_array-int64s_delete_callback.c +build_sources_program test-type_array-int128s_destroy_callback.c test-type_array-int128s_delete_callback.c +build_sources_program test-type_array-number_unsigneds_destroy_callback.c test-type_array-number_unsigneds_delete_callback.c +build_sources_program test-type_array-polls_destroy_callback.c test-type_array-polls_delete_callback.c +build_sources_program test-type_array-states_destroy_callback.c test-type_array-states_delete_callback.c +build_sources_program test-type_array-statuss_destroy_callback.c test-type_array-statuss_delete_callback.c +build_sources_program test-type_array-uint8s_destroy_callback.c test-type_array-uint8s_delete_callback.c +build_sources_program test-type_array-uint16s_destroy_callback.c test-type_array-uint16s_delete_callback.c +build_sources_program test-type_array-uint32s_destroy_callback.c test-type_array-uint32s_delete_callback.c +build_sources_program test-type_array-uint64s_destroy_callback.c test-type_array-uint64s_delete_callback.c +build_sources_program test-type_array-uint128s_destroy_callback.c test-type_array-uint128s_delete_callback.c build_sources_program test-type_array.c diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cells_adjust_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-cells_adjust_callback.h deleted file mode 100644 index d3dc8c5..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cells_adjust_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__cells_adjust_callback -#define _TEST__F_type_array__cells_adjust_callback - -/** - * Test that the function fails. - * - * @see f_cells_adjust_callback() - */ -extern void test__f_type_array_cells_adjust_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_cells_adjust_callback() - */ -extern void test__f_type_array_cells_adjust_callback__works(void **state); - -#endif // _TEST__F_type_array__cells_adjust_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cells_resize_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-cells_delete_callback.c similarity index 75% rename from level_0/f_type_array/tests/unit/c/test-type_array-cells_resize_callback.c rename to level_0/f_type_array/tests/unit/c/test-type_array-cells_delete_callback.c index 7aec378..46fe109 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cells_resize_callback.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-cells_delete_callback.c @@ -1,11 +1,11 @@ #include "test-type_array.h" -#include "test-type_array-cells_resize_callback.h" +#include "test-type_array-cells_delete_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_type_array_cells_resize_callback__fails(void **state) { +void test__f_type_array_cells_delete_callback__fails(void **state) { f_cell_t data = f_cell_t_initialize; f_cell_t data_array[] = { data }; @@ -16,13 +16,13 @@ void test__f_type_array_cells_resize_callback__fails(void **state) { will_return(__wrap_f_memory_array_resize, true); will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); - const f_status_t status = f_cells_resize_callback(0, 1, (void *) datass_array); + const f_status_t status = f_cells_delete_callback(0, 1, (void *) datass_array); assert_int_equal(status, F_status_set_error(F_failure)); } } -void test__f_type_array_cells_resize_callback__works(void **state) { +void test__f_type_array_cells_delete_callback__works(void **state) { f_cell_t data = f_cell_t_initialize; f_cell_t data_array[] = { data }; @@ -34,7 +34,7 @@ void test__f_type_array_cells_resize_callback__works(void **state) { will_return(__wrap_f_memory_array_resize, false); will_return(__wrap_f_memory_array_resize, F_none); - const f_status_t status = f_cells_resize_callback(0, length, (void *) datass_array); + const f_status_t status = f_cells_delete_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cells_delete_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-cells_delete_callback.h new file mode 100644 index 0000000..e514b54 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-cells_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__cells_delete_callback +#define _TEST__F_type_array__cells_delete_callback + +/** + * Test that the function fails. + * + * @see f_cells_delete_callback() + */ +extern void test__f_type_array_cells_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_cells_delete_callback() + */ +extern void test__f_type_array_cells_delete_callback__works(void **state); + +#endif // _TEST__F_type_array__cells_delete_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cells_adjust_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-cells_destroy_callback.c similarity index 70% rename from level_0/f_type_array/tests/unit/c/test-type_array-cells_adjust_callback.c rename to level_0/f_type_array/tests/unit/c/test-type_array-cells_destroy_callback.c index 31906b2..706d5bd 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cells_adjust_callback.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-cells_destroy_callback.c @@ -1,11 +1,11 @@ #include "test-type_array.h" -#include "test-type_array-cells_adjust_callback.h" +#include "test-type_array-cells_destroy_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_type_array_cells_adjust_callback__fails(void **state) { +void test__f_type_array_cells_destroy_callback__fails(void **state) { f_cell_t data = f_cell_t_initialize; f_cell_t data_array[] = { data }; @@ -16,13 +16,13 @@ void test__f_type_array_cells_adjust_callback__fails(void **state) { will_return(__wrap_f_memory_array_adjust, true); will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); - const f_status_t status = f_cells_adjust_callback(0, 1, (void *) datass_array); + const f_status_t status = f_cells_destroy_callback(0, 1, (void *) datass_array); assert_int_equal(status, F_status_set_error(F_failure)); } } -void test__f_type_array_cells_adjust_callback__works(void **state) { +void test__f_type_array_cells_destroy_callback__works(void **state) { f_cell_t data = f_cell_t_initialize; f_cell_t data_array[] = { data }; @@ -34,7 +34,7 @@ void test__f_type_array_cells_adjust_callback__works(void **state) { will_return(__wrap_f_memory_array_adjust, false); will_return(__wrap_f_memory_array_adjust, F_none); - const f_status_t status = f_cells_adjust_callback(0, length, (void *) datass_array); + const f_status_t status = f_cells_destroy_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cells_destroy_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-cells_destroy_callback.h new file mode 100644 index 0000000..9eb8873 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-cells_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__cells_destroy_callback +#define _TEST__F_type_array__cells_destroy_callback + +/** + * Test that the function fails. + * + * @see f_cells_destroy_callback() + */ +extern void test__f_type_array_cells_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_cells_destroy_callback() + */ +extern void test__f_type_array_cells_destroy_callback__works(void **state); + +#endif // _TEST__F_type_array__cells_destroy_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cells_resize_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-cells_resize_callback.h deleted file mode 100644 index 5af9d45..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cells_resize_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__cells_resize_callback -#define _TEST__F_type_array__cells_resize_callback - -/** - * Test that the function fails. - * - * @see f_cells_resize_callback() - */ -extern void test__f_type_array_cells_resize_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_cells_resize_callback() - */ -extern void test__f_type_array_cells_resize_callback__works(void **state); - -#endif // _TEST__F_type_array__cells_resize_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-files_adjust_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-files_adjust_callback.h deleted file mode 100644 index b24b752..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-files_adjust_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__files_adjust_callback -#define _TEST__F_type_array__files_adjust_callback - -/** - * Test that the function fails. - * - * @see f_files_adjust_callback() - */ -extern void test__f_type_array_files_adjust_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_files_adjust_callback() - */ -extern void test__f_type_array_files_adjust_callback__works(void **state); - -#endif // _TEST__F_type_array__files_adjust_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-files_resize_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-files_delete_callback.c similarity index 75% rename from level_0/f_type_array/tests/unit/c/test-type_array-files_resize_callback.c rename to level_0/f_type_array/tests/unit/c/test-type_array-files_delete_callback.c index 948bb23..6ba1927 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-files_resize_callback.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-files_delete_callback.c @@ -1,11 +1,11 @@ #include "test-type_array.h" -#include "test-type_array-files_resize_callback.h" +#include "test-type_array-files_delete_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_type_array_files_resize_callback__fails(void **state) { +void test__f_type_array_files_delete_callback__fails(void **state) { f_file_t data = f_file_t_initialize; f_file_t data_array[] = { data }; @@ -16,13 +16,13 @@ void test__f_type_array_files_resize_callback__fails(void **state) { will_return(__wrap_f_memory_array_resize, true); will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); - const f_status_t status = f_files_resize_callback(0, 1, (void *) datass_array); + const f_status_t status = f_files_delete_callback(0, 1, (void *) datass_array); assert_int_equal(status, F_status_set_error(F_failure)); } } -void test__f_type_array_files_resize_callback__works(void **state) { +void test__f_type_array_files_delete_callback__works(void **state) { f_file_t data = f_file_t_initialize; f_file_t data_array[] = { data }; @@ -34,7 +34,7 @@ void test__f_type_array_files_resize_callback__works(void **state) { will_return(__wrap_f_memory_array_resize, false); will_return(__wrap_f_memory_array_resize, F_none); - const f_status_t status = f_files_resize_callback(0, length, (void *) datass_array); + const f_status_t status = f_files_delete_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-files_delete_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-files_delete_callback.h new file mode 100644 index 0000000..f9e6903 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-files_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__files_delete_callback +#define _TEST__F_type_array__files_delete_callback + +/** + * Test that the function fails. + * + * @see f_files_delete_callback() + */ +extern void test__f_type_array_files_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_files_delete_callback() + */ +extern void test__f_type_array_files_delete_callback__works(void **state); + +#endif // _TEST__F_type_array__files_delete_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-files_adjust_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-files_destroy_callback.c similarity index 70% rename from level_0/f_type_array/tests/unit/c/test-type_array-files_adjust_callback.c rename to level_0/f_type_array/tests/unit/c/test-type_array-files_destroy_callback.c index 4031df9..3af9fc1 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-files_adjust_callback.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-files_destroy_callback.c @@ -1,11 +1,11 @@ #include "test-type_array.h" -#include "test-type_array-files_adjust_callback.h" +#include "test-type_array-files_destroy_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_type_array_files_adjust_callback__fails(void **state) { +void test__f_type_array_files_destroy_callback__fails(void **state) { f_file_t data = f_file_t_initialize; f_file_t data_array[] = { data }; @@ -16,13 +16,13 @@ void test__f_type_array_files_adjust_callback__fails(void **state) { will_return(__wrap_f_memory_array_adjust, true); will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); - const f_status_t status = f_files_adjust_callback(0, 1, (void *) datass_array); + const f_status_t status = f_files_destroy_callback(0, 1, (void *) datass_array); assert_int_equal(status, F_status_set_error(F_failure)); } } -void test__f_type_array_files_adjust_callback__works(void **state) { +void test__f_type_array_files_destroy_callback__works(void **state) { f_file_t data = f_file_t_initialize; f_file_t data_array[] = { data }; @@ -34,7 +34,7 @@ void test__f_type_array_files_adjust_callback__works(void **state) { will_return(__wrap_f_memory_array_adjust, false); will_return(__wrap_f_memory_array_adjust, F_none); - const f_status_t status = f_files_adjust_callback(0, length, (void *) datass_array); + const f_status_t status = f_files_destroy_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-files_destroy_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-files_destroy_callback.h new file mode 100644 index 0000000..7f74897 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-files_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__files_destroy_callback +#define _TEST__F_type_array__files_destroy_callback + +/** + * Test that the function fails. + * + * @see f_files_destroy_callback() + */ +extern void test__f_type_array_files_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_files_destroy_callback() + */ +extern void test__f_type_array_files_destroy_callback__works(void **state); + +#endif // _TEST__F_type_array__files_destroy_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-files_resize_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-files_resize_callback.h deleted file mode 100644 index 489a774..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-files_resize_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__files_resize_callback -#define _TEST__F_type_array__files_resize_callback - -/** - * Test that the function fails. - * - * @see f_files_resize_callback() - */ -extern void test__f_type_array_files_resize_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_files_resize_callback() - */ -extern void test__f_type_array_files_resize_callback__works(void **state); - -#endif // _TEST__F_type_array__files_resize_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_adjust_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_adjust_callback.h deleted file mode 100644 index 66c6167..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_adjust_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__fll_ids_adjust_callback -#define _TEST__F_type_array__fll_ids_adjust_callback - -/** - * Test that the function fails. - * - * @see f_fll_ids_adjust_callback() - */ -extern void test__f_type_array_fll_ids_adjust_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_fll_ids_adjust_callback() - */ -extern void test__f_type_array_fll_ids_adjust_callback__works(void **state); - -#endif // _TEST__F_type_array__fll_ids_adjust_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_resize_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_delete_callback.c similarity index 75% rename from level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_resize_callback.c rename to level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_delete_callback.c index 6f22b4e..b9dfa83 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_resize_callback.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_delete_callback.c @@ -1,11 +1,11 @@ #include "test-type_array.h" -#include "test-type_array-fll_ids_resize_callback.h" +#include "test-type_array-fll_ids_delete_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_type_array_fll_ids_resize_callback__fails(void **state) { +void test__f_type_array_fll_ids_delete_callback__fails(void **state) { f_fll_id_t data = f_fll_id_t_initialize; f_fll_id_t data_array[] = { data }; @@ -16,13 +16,13 @@ void test__f_type_array_fll_ids_resize_callback__fails(void **state) { will_return(__wrap_f_memory_array_resize, true); will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); - const f_status_t status = f_fll_ids_resize_callback(0, 1, (void *) datass_array); + const f_status_t status = f_fll_ids_delete_callback(0, 1, (void *) datass_array); assert_int_equal(status, F_status_set_error(F_failure)); } } -void test__f_type_array_fll_ids_resize_callback__works(void **state) { +void test__f_type_array_fll_ids_delete_callback__works(void **state) { f_fll_id_t data = f_fll_id_t_initialize; f_fll_id_t data_array[] = { data }; @@ -34,7 +34,7 @@ void test__f_type_array_fll_ids_resize_callback__works(void **state) { will_return(__wrap_f_memory_array_resize, false); will_return(__wrap_f_memory_array_resize, F_none); - const f_status_t status = f_fll_ids_resize_callback(0, length, (void *) datass_array); + const f_status_t status = f_fll_ids_delete_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_delete_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_delete_callback.h new file mode 100644 index 0000000..472a906 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__fll_ids_delete_callback +#define _TEST__F_type_array__fll_ids_delete_callback + +/** + * Test that the function fails. + * + * @see f_fll_ids_delete_callback() + */ +extern void test__f_type_array_fll_ids_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_fll_ids_delete_callback() + */ +extern void test__f_type_array_fll_ids_delete_callback__works(void **state); + +#endif // _TEST__F_type_array__fll_ids_delete_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_adjust_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_destroy_callback.c similarity index 70% rename from level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_adjust_callback.c rename to level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_destroy_callback.c index 1e38a59..2691c79 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_adjust_callback.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_destroy_callback.c @@ -1,11 +1,11 @@ #include "test-type_array.h" -#include "test-type_array-fll_ids_adjust_callback.h" +#include "test-type_array-fll_ids_destroy_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_type_array_fll_ids_adjust_callback__fails(void **state) { +void test__f_type_array_fll_ids_destroy_callback__fails(void **state) { f_fll_id_t data = f_fll_id_t_initialize; f_fll_id_t data_array[] = { data }; @@ -16,13 +16,13 @@ void test__f_type_array_fll_ids_adjust_callback__fails(void **state) { will_return(__wrap_f_memory_array_adjust, true); will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); - const f_status_t status = f_fll_ids_adjust_callback(0, 1, (void *) datass_array); + const f_status_t status = f_fll_ids_destroy_callback(0, 1, (void *) datass_array); assert_int_equal(status, F_status_set_error(F_failure)); } } -void test__f_type_array_fll_ids_adjust_callback__works(void **state) { +void test__f_type_array_fll_ids_destroy_callback__works(void **state) { f_fll_id_t data = f_fll_id_t_initialize; f_fll_id_t data_array[] = { data }; @@ -34,7 +34,7 @@ void test__f_type_array_fll_ids_adjust_callback__works(void **state) { will_return(__wrap_f_memory_array_adjust, false); will_return(__wrap_f_memory_array_adjust, F_none); - const f_status_t status = f_fll_ids_adjust_callback(0, length, (void *) datass_array); + const f_status_t status = f_fll_ids_destroy_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_destroy_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_destroy_callback.h new file mode 100644 index 0000000..cd90c41 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__fll_ids_destroy_callback +#define _TEST__F_type_array__fll_ids_destroy_callback + +/** + * Test that the function fails. + * + * @see f_fll_ids_destroy_callback() + */ +extern void test__f_type_array_fll_ids_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_fll_ids_destroy_callback() + */ +extern void test__f_type_array_fll_ids_destroy_callback__works(void **state); + +#endif // _TEST__F_type_array__fll_ids_destroy_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_resize_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_resize_callback.h deleted file mode 100644 index 3495e97..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_resize_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__fll_ids_resize_callback -#define _TEST__F_type_array__fll_ids_resize_callback - -/** - * Test that the function fails. - * - * @see f_fll_ids_resize_callback() - */ -extern void test__f_type_array_fll_ids_resize_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_fll_ids_resize_callback() - */ -extern void test__f_type_array_fll_ids_resize_callback__works(void **state); - -#endif // _TEST__F_type_array__fll_ids_resize_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_adjust_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_adjust_callback.h deleted file mode 100644 index 97145c8..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_adjust_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int128s_adjust_callback -#define _TEST__F_type_array__int128s_adjust_callback - -/** - * Test that the function fails. - * - * @see f_int128s_adjust_callback() - */ -extern void test__f_type_array_int128s_adjust_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_int128s_adjust_callback() - */ -extern void test__f_type_array_int128s_adjust_callback__works(void **state); - -#endif // _TEST__F_type_array__int128s_adjust_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_resize_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_delete_callback.c similarity index 75% rename from level_0/f_type_array/tests/unit/c/test-type_array-int128s_resize_callback.c rename to level_0/f_type_array/tests/unit/c/test-type_array-int128s_delete_callback.c index 12d2f3f..94f141f 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_resize_callback.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_delete_callback.c @@ -1,11 +1,11 @@ #include "test-type_array.h" -#include "test-type_array-int128s_resize_callback.h" +#include "test-type_array-int128s_delete_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_type_array_int128s_resize_callback__fails(void **state) { +void test__f_type_array_int128s_delete_callback__fails(void **state) { f_int128_t data = 0; f_int128_t data_array[] = { data }; @@ -16,13 +16,13 @@ void test__f_type_array_int128s_resize_callback__fails(void **state) { will_return(__wrap_f_memory_array_resize, true); will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); - const f_status_t status = f_int128s_resize_callback(0, 1, (void *) datass_array); + const f_status_t status = f_int128s_delete_callback(0, 1, (void *) datass_array); assert_int_equal(status, F_status_set_error(F_failure)); } } -void test__f_type_array_int128s_resize_callback__works(void **state) { +void test__f_type_array_int128s_delete_callback__works(void **state) { f_int128_t data = 0; f_int128_t data_array[] = { data }; @@ -34,7 +34,7 @@ void test__f_type_array_int128s_resize_callback__works(void **state) { will_return(__wrap_f_memory_array_resize, false); will_return(__wrap_f_memory_array_resize, F_none); - const f_status_t status = f_int128s_resize_callback(0, length, (void *) datass_array); + const f_status_t status = f_int128s_delete_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_delete_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_delete_callback.h new file mode 100644 index 0000000..3273acb --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int128s_delete_callback +#define _TEST__F_type_array__int128s_delete_callback + +/** + * Test that the function fails. + * + * @see f_int128s_delete_callback() + */ +extern void test__f_type_array_int128s_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_int128s_delete_callback() + */ +extern void test__f_type_array_int128s_delete_callback__works(void **state); + +#endif // _TEST__F_type_array__int128s_delete_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_adjust_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_destroy_callback.c similarity index 69% rename from level_0/f_type_array/tests/unit/c/test-type_array-int128s_adjust_callback.c rename to level_0/f_type_array/tests/unit/c/test-type_array-int128s_destroy_callback.c index efb1bc2..474a889 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_adjust_callback.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_destroy_callback.c @@ -1,11 +1,11 @@ #include "test-type_array.h" -#include "test-type_array-int128s_adjust_callback.h" +#include "test-type_array-int128s_destroy_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_type_array_int128s_adjust_callback__fails(void **state) { +void test__f_type_array_int128s_destroy_callback__fails(void **state) { f_int128_t data = 0; f_int128_t data_array[] = { data }; @@ -16,13 +16,13 @@ void test__f_type_array_int128s_adjust_callback__fails(void **state) { will_return(__wrap_f_memory_array_adjust, true); will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); - const f_status_t status = f_int128s_adjust_callback(0, 1, (void *) datass_array); + const f_status_t status = f_int128s_destroy_callback(0, 1, (void *) datass_array); assert_int_equal(status, F_status_set_error(F_failure)); } } -void test__f_type_array_int128s_adjust_callback__works(void **state) { +void test__f_type_array_int128s_destroy_callback__works(void **state) { f_int128_t data = 0; f_int128_t data_array[] = { data }; @@ -34,7 +34,7 @@ void test__f_type_array_int128s_adjust_callback__works(void **state) { will_return(__wrap_f_memory_array_adjust, false); will_return(__wrap_f_memory_array_adjust, F_none); - const f_status_t status = f_int128s_adjust_callback(0, length, (void *) datass_array); + const f_status_t status = f_int128s_destroy_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_destroy_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_destroy_callback.h new file mode 100644 index 0000000..4db2028 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int128s_destroy_callback +#define _TEST__F_type_array__int128s_destroy_callback + +/** + * Test that the function fails. + * + * @see f_int128s_destroy_callback() + */ +extern void test__f_type_array_int128s_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_int128s_destroy_callback() + */ +extern void test__f_type_array_int128s_destroy_callback__works(void **state); + +#endif // _TEST__F_type_array__int128s_destroy_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_resize_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_resize_callback.h deleted file mode 100644 index 7c82197..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_resize_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int128s_resize_callback -#define _TEST__F_type_array__int128s_resize_callback - -/** - * Test that the function fails. - * - * @see f_int128s_resize_callback() - */ -extern void test__f_type_array_int128s_resize_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_int128s_resize_callback() - */ -extern void test__f_type_array_int128s_resize_callback__works(void **state); - -#endif // _TEST__F_type_array__int128s_resize_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_adjust_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_adjust_callback.h deleted file mode 100644 index 6cb44f1..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_adjust_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int16s_adjust_callback -#define _TEST__F_type_array__int16s_adjust_callback - -/** - * Test that the function fails. - * - * @see f_int16s_adjust_callback() - */ -extern void test__f_type_array_int16s_adjust_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_int16s_adjust_callback() - */ -extern void test__f_type_array_int16s_adjust_callback__works(void **state); - -#endif // _TEST__F_type_array__int16s_adjust_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_resize_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_delete_callback.c similarity index 74% rename from level_0/f_type_array/tests/unit/c/test-type_array-int16s_resize_callback.c rename to level_0/f_type_array/tests/unit/c/test-type_array-int16s_delete_callback.c index 691fa64..7a70378 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_resize_callback.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_delete_callback.c @@ -1,11 +1,11 @@ #include "test-type_array.h" -#include "test-type_array-int16s_resize_callback.h" +#include "test-type_array-int16s_delete_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_type_array_int16s_resize_callback__fails(void **state) { +void test__f_type_array_int16s_delete_callback__fails(void **state) { int16_t data = 0; int16_t data_array[] = { data }; @@ -16,13 +16,13 @@ void test__f_type_array_int16s_resize_callback__fails(void **state) { will_return(__wrap_f_memory_array_resize, true); will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); - const f_status_t status = f_int16s_resize_callback(0, 1, (void *) datass_array); + const f_status_t status = f_int16s_delete_callback(0, 1, (void *) datass_array); assert_int_equal(status, F_status_set_error(F_failure)); } } -void test__f_type_array_int16s_resize_callback__works(void **state) { +void test__f_type_array_int16s_delete_callback__works(void **state) { int16_t data = 0; int16_t data_array[] = { data }; @@ -34,7 +34,7 @@ void test__f_type_array_int16s_resize_callback__works(void **state) { will_return(__wrap_f_memory_array_resize, false); will_return(__wrap_f_memory_array_resize, F_none); - const f_status_t status = f_int16s_resize_callback(0, length, (void *) datass_array); + const f_status_t status = f_int16s_delete_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_delete_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_delete_callback.h new file mode 100644 index 0000000..91ccdaf --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int16s_delete_callback +#define _TEST__F_type_array__int16s_delete_callback + +/** + * Test that the function fails. + * + * @see f_int16s_delete_callback() + */ +extern void test__f_type_array_int16s_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_int16s_delete_callback() + */ +extern void test__f_type_array_int16s_delete_callback__works(void **state); + +#endif // _TEST__F_type_array__int16s_delete_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_adjust_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_destroy_callback.c similarity index 69% rename from level_0/f_type_array/tests/unit/c/test-type_array-int16s_adjust_callback.c rename to level_0/f_type_array/tests/unit/c/test-type_array-int16s_destroy_callback.c index f881270..8016baf 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_adjust_callback.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_destroy_callback.c @@ -1,11 +1,11 @@ #include "test-type_array.h" -#include "test-type_array-int16s_adjust_callback.h" +#include "test-type_array-int16s_destroy_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_type_array_int16s_adjust_callback__fails(void **state) { +void test__f_type_array_int16s_destroy_callback__fails(void **state) { int16_t data = 0; int16_t data_array[] = { data }; @@ -16,13 +16,13 @@ void test__f_type_array_int16s_adjust_callback__fails(void **state) { will_return(__wrap_f_memory_array_adjust, true); will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); - const f_status_t status = f_int16s_adjust_callback(0, 1, (void *) datass_array); + const f_status_t status = f_int16s_destroy_callback(0, 1, (void *) datass_array); assert_int_equal(status, F_status_set_error(F_failure)); } } -void test__f_type_array_int16s_adjust_callback__works(void **state) { +void test__f_type_array_int16s_destroy_callback__works(void **state) { int16_t data = 0; int16_t data_array[] = { data }; @@ -34,7 +34,7 @@ void test__f_type_array_int16s_adjust_callback__works(void **state) { will_return(__wrap_f_memory_array_adjust, false); will_return(__wrap_f_memory_array_adjust, F_none); - const f_status_t status = f_int16s_adjust_callback(0, length, (void *) datass_array); + const f_status_t status = f_int16s_destroy_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_destroy_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_destroy_callback.h new file mode 100644 index 0000000..068ccd7 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int16s_destroy_callback +#define _TEST__F_type_array__int16s_destroy_callback + +/** + * Test that the function fails. + * + * @see f_int16s_destroy_callback() + */ +extern void test__f_type_array_int16s_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_int16s_destroy_callback() + */ +extern void test__f_type_array_int16s_destroy_callback__works(void **state); + +#endif // _TEST__F_type_array__int16s_destroy_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_resize_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_resize_callback.h deleted file mode 100644 index 680e5cd..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_resize_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int16s_resize_callback -#define _TEST__F_type_array__int16s_resize_callback - -/** - * Test that the function fails. - * - * @see f_int16s_resize_callback() - */ -extern void test__f_type_array_int16s_resize_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_int16s_resize_callback() - */ -extern void test__f_type_array_int16s_resize_callback__works(void **state); - -#endif // _TEST__F_type_array__int16s_resize_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_adjust_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_adjust_callback.h deleted file mode 100644 index c865057..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_adjust_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int32s_adjust_callback -#define _TEST__F_type_array__int32s_adjust_callback - -/** - * Test that the function fails. - * - * @see f_int32s_adjust_callback() - */ -extern void test__f_type_array_int32s_adjust_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_int32s_adjust_callback() - */ -extern void test__f_type_array_int32s_adjust_callback__works(void **state); - -#endif // _TEST__F_type_array__int32s_adjust_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_resize_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_delete_callback.c similarity index 74% rename from level_0/f_type_array/tests/unit/c/test-type_array-int32s_resize_callback.c rename to level_0/f_type_array/tests/unit/c/test-type_array-int32s_delete_callback.c index 914ffdd..37e627f 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_resize_callback.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_delete_callback.c @@ -1,11 +1,11 @@ #include "test-type_array.h" -#include "test-type_array-int32s_resize_callback.h" +#include "test-type_array-int32s_delete_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_type_array_int32s_resize_callback__fails(void **state) { +void test__f_type_array_int32s_delete_callback__fails(void **state) { int32_t data = 0; int32_t data_array[] = { data }; @@ -16,13 +16,13 @@ void test__f_type_array_int32s_resize_callback__fails(void **state) { will_return(__wrap_f_memory_array_resize, true); will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); - const f_status_t status = f_int32s_resize_callback(0, 1, (void *) datass_array); + const f_status_t status = f_int32s_delete_callback(0, 1, (void *) datass_array); assert_int_equal(status, F_status_set_error(F_failure)); } } -void test__f_type_array_int32s_resize_callback__works(void **state) { +void test__f_type_array_int32s_delete_callback__works(void **state) { int32_t data = 0; int32_t data_array[] = { data }; @@ -34,7 +34,7 @@ void test__f_type_array_int32s_resize_callback__works(void **state) { will_return(__wrap_f_memory_array_resize, false); will_return(__wrap_f_memory_array_resize, F_none); - const f_status_t status = f_int32s_resize_callback(0, length, (void *) datass_array); + const f_status_t status = f_int32s_delete_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_delete_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_delete_callback.h new file mode 100644 index 0000000..ac1c8de --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int32s_delete_callback +#define _TEST__F_type_array__int32s_delete_callback + +/** + * Test that the function fails. + * + * @see f_int32s_delete_callback() + */ +extern void test__f_type_array_int32s_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_int32s_delete_callback() + */ +extern void test__f_type_array_int32s_delete_callback__works(void **state); + +#endif // _TEST__F_type_array__int32s_delete_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_adjust_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_destroy_callback.c similarity index 69% rename from level_0/f_type_array/tests/unit/c/test-type_array-int32s_adjust_callback.c rename to level_0/f_type_array/tests/unit/c/test-type_array-int32s_destroy_callback.c index 884fcb4..fa08145 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_adjust_callback.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_destroy_callback.c @@ -1,11 +1,11 @@ #include "test-type_array.h" -#include "test-type_array-int32s_adjust_callback.h" +#include "test-type_array-int32s_destroy_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_type_array_int32s_adjust_callback__fails(void **state) { +void test__f_type_array_int32s_destroy_callback__fails(void **state) { int32_t data = 0; int32_t data_array[] = { data }; @@ -16,13 +16,13 @@ void test__f_type_array_int32s_adjust_callback__fails(void **state) { will_return(__wrap_f_memory_array_adjust, true); will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); - const f_status_t status = f_int32s_adjust_callback(0, 1, (void *) datass_array); + const f_status_t status = f_int32s_destroy_callback(0, 1, (void *) datass_array); assert_int_equal(status, F_status_set_error(F_failure)); } } -void test__f_type_array_int32s_adjust_callback__works(void **state) { +void test__f_type_array_int32s_destroy_callback__works(void **state) { int32_t data = 0; int32_t data_array[] = { data }; @@ -34,7 +34,7 @@ void test__f_type_array_int32s_adjust_callback__works(void **state) { will_return(__wrap_f_memory_array_adjust, false); will_return(__wrap_f_memory_array_adjust, F_none); - const f_status_t status = f_int32s_adjust_callback(0, length, (void *) datass_array); + const f_status_t status = f_int32s_destroy_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_destroy_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_destroy_callback.h new file mode 100644 index 0000000..212ae69 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int32s_destroy_callback +#define _TEST__F_type_array__int32s_destroy_callback + +/** + * Test that the function fails. + * + * @see f_int32s_destroy_callback() + */ +extern void test__f_type_array_int32s_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_int32s_destroy_callback() + */ +extern void test__f_type_array_int32s_destroy_callback__works(void **state); + +#endif // _TEST__F_type_array__int32s_destroy_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_resize_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_resize_callback.h deleted file mode 100644 index bc3d95b..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_resize_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int32s_resize_callback -#define _TEST__F_type_array__int32s_resize_callback - -/** - * Test that the function fails. - * - * @see f_int32s_resize_callback() - */ -extern void test__f_type_array_int32s_resize_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_int32s_resize_callback() - */ -extern void test__f_type_array_int32s_resize_callback__works(void **state); - -#endif // _TEST__F_type_array__int32s_resize_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_adjust_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_adjust_callback.h deleted file mode 100644 index ee70802..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_adjust_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int64s_adjust_callback -#define _TEST__F_type_array__int64s_adjust_callback - -/** - * Test that the function fails. - * - * @see f_int64s_adjust_callback() - */ -extern void test__f_type_array_int64s_adjust_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_int64s_adjust_callback() - */ -extern void test__f_type_array_int64s_adjust_callback__works(void **state); - -#endif // _TEST__F_type_array__int64s_adjust_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_resize_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_delete_callback.c similarity index 74% rename from level_0/f_type_array/tests/unit/c/test-type_array-int64s_resize_callback.c rename to level_0/f_type_array/tests/unit/c/test-type_array-int64s_delete_callback.c index 3d78bee..312aff3 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_resize_callback.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_delete_callback.c @@ -1,11 +1,11 @@ #include "test-type_array.h" -#include "test-type_array-int64s_resize_callback.h" +#include "test-type_array-int64s_delete_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_type_array_int64s_resize_callback__fails(void **state) { +void test__f_type_array_int64s_delete_callback__fails(void **state) { int64_t data = 0; int64_t data_array[] = { data }; @@ -16,13 +16,13 @@ void test__f_type_array_int64s_resize_callback__fails(void **state) { will_return(__wrap_f_memory_array_resize, true); will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); - const f_status_t status = f_int64s_resize_callback(0, 1, (void *) datass_array); + const f_status_t status = f_int64s_delete_callback(0, 1, (void *) datass_array); assert_int_equal(status, F_status_set_error(F_failure)); } } -void test__f_type_array_int64s_resize_callback__works(void **state) { +void test__f_type_array_int64s_delete_callback__works(void **state) { int64_t data = 0; int64_t data_array[] = { data }; @@ -34,7 +34,7 @@ void test__f_type_array_int64s_resize_callback__works(void **state) { will_return(__wrap_f_memory_array_resize, false); will_return(__wrap_f_memory_array_resize, F_none); - const f_status_t status = f_int64s_resize_callback(0, length, (void *) datass_array); + const f_status_t status = f_int64s_delete_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_delete_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_delete_callback.h new file mode 100644 index 0000000..4f06ff8 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int64s_delete_callback +#define _TEST__F_type_array__int64s_delete_callback + +/** + * Test that the function fails. + * + * @see f_int64s_delete_callback() + */ +extern void test__f_type_array_int64s_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_int64s_delete_callback() + */ +extern void test__f_type_array_int64s_delete_callback__works(void **state); + +#endif // _TEST__F_type_array__int64s_delete_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_adjust_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_destroy_callback.c similarity index 69% rename from level_0/f_type_array/tests/unit/c/test-type_array-int64s_adjust_callback.c rename to level_0/f_type_array/tests/unit/c/test-type_array-int64s_destroy_callback.c index 4506963..631ea63 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_adjust_callback.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_destroy_callback.c @@ -1,11 +1,11 @@ #include "test-type_array.h" -#include "test-type_array-int64s_adjust_callback.h" +#include "test-type_array-int64s_destroy_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_type_array_int64s_adjust_callback__fails(void **state) { +void test__f_type_array_int64s_destroy_callback__fails(void **state) { int64_t data = 0; int64_t data_array[] = { data }; @@ -16,13 +16,13 @@ void test__f_type_array_int64s_adjust_callback__fails(void **state) { will_return(__wrap_f_memory_array_adjust, true); will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); - const f_status_t status = f_int64s_adjust_callback(0, 1, (void *) datass_array); + const f_status_t status = f_int64s_destroy_callback(0, 1, (void *) datass_array); assert_int_equal(status, F_status_set_error(F_failure)); } } -void test__f_type_array_int64s_adjust_callback__works(void **state) { +void test__f_type_array_int64s_destroy_callback__works(void **state) { int64_t data = 0; int64_t data_array[] = { data }; @@ -34,7 +34,7 @@ void test__f_type_array_int64s_adjust_callback__works(void **state) { will_return(__wrap_f_memory_array_adjust, false); will_return(__wrap_f_memory_array_adjust, F_none); - const f_status_t status = f_int64s_adjust_callback(0, length, (void *) datass_array); + const f_status_t status = f_int64s_destroy_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_destroy_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_destroy_callback.h new file mode 100644 index 0000000..998e037 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int64s_destroy_callback +#define _TEST__F_type_array__int64s_destroy_callback + +/** + * Test that the function fails. + * + * @see f_int64s_destroy_callback() + */ +extern void test__f_type_array_int64s_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_int64s_destroy_callback() + */ +extern void test__f_type_array_int64s_destroy_callback__works(void **state); + +#endif // _TEST__F_type_array__int64s_destroy_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_resize_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_resize_callback.h deleted file mode 100644 index cbc99f3..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_resize_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int64s_resize_callback -#define _TEST__F_type_array__int64s_resize_callback - -/** - * Test that the function fails. - * - * @see f_int64s_resize_callback() - */ -extern void test__f_type_array_int64s_resize_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_int64s_resize_callback() - */ -extern void test__f_type_array_int64s_resize_callback__works(void **state); - -#endif // _TEST__F_type_array__int64s_resize_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_adjust_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_adjust_callback.h deleted file mode 100644 index 50e09dc..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_adjust_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int8s_adjust_callback -#define _TEST__F_type_array__int8s_adjust_callback - -/** - * Test that the function fails. - * - * @see f_int8s_adjust_callback() - */ -extern void test__f_type_array_int8s_adjust_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_int8s_adjust_callback() - */ -extern void test__f_type_array_int8s_adjust_callback__works(void **state); - -#endif // _TEST__F_type_array__int8s_adjust_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_resize_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_delete_callback.c similarity index 74% rename from level_0/f_type_array/tests/unit/c/test-type_array-int8s_resize_callback.c rename to level_0/f_type_array/tests/unit/c/test-type_array-int8s_delete_callback.c index 9428475..cd1e85b 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_resize_callback.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_delete_callback.c @@ -1,11 +1,11 @@ #include "test-type_array.h" -#include "test-type_array-int8s_resize_callback.h" +#include "test-type_array-int8s_delete_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_type_array_int8s_resize_callback__fails(void **state) { +void test__f_type_array_int8s_delete_callback__fails(void **state) { int8_t data = 0; int8_t data_array[] = { data }; @@ -16,13 +16,13 @@ void test__f_type_array_int8s_resize_callback__fails(void **state) { will_return(__wrap_f_memory_array_resize, true); will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); - const f_status_t status = f_int8s_resize_callback(0, 1, (void *) datass_array); + const f_status_t status = f_int8s_delete_callback(0, 1, (void *) datass_array); assert_int_equal(status, F_status_set_error(F_failure)); } } -void test__f_type_array_int8s_resize_callback__works(void **state) { +void test__f_type_array_int8s_delete_callback__works(void **state) { int8_t data = 0; int8_t data_array[] = { data }; @@ -34,7 +34,7 @@ void test__f_type_array_int8s_resize_callback__works(void **state) { will_return(__wrap_f_memory_array_resize, false); will_return(__wrap_f_memory_array_resize, F_none); - const f_status_t status = f_int8s_resize_callback(0, length, (void *) datass_array); + const f_status_t status = f_int8s_delete_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_delete_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_delete_callback.h new file mode 100644 index 0000000..30adf90 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int8s_delete_callback +#define _TEST__F_type_array__int8s_delete_callback + +/** + * Test that the function fails. + * + * @see f_int8s_delete_callback() + */ +extern void test__f_type_array_int8s_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_int8s_delete_callback() + */ +extern void test__f_type_array_int8s_delete_callback__works(void **state); + +#endif // _TEST__F_type_array__int8s_delete_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_adjust_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_destroy_callback.c similarity index 69% rename from level_0/f_type_array/tests/unit/c/test-type_array-int8s_adjust_callback.c rename to level_0/f_type_array/tests/unit/c/test-type_array-int8s_destroy_callback.c index 4192482..8339593 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_adjust_callback.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_destroy_callback.c @@ -1,11 +1,11 @@ #include "test-type_array.h" -#include "test-type_array-int8s_adjust_callback.h" +#include "test-type_array-int8s_destroy_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_type_array_int8s_adjust_callback__fails(void **state) { +void test__f_type_array_int8s_destroy_callback__fails(void **state) { int8_t data = 0; int8_t data_array[] = { data }; @@ -16,13 +16,13 @@ void test__f_type_array_int8s_adjust_callback__fails(void **state) { will_return(__wrap_f_memory_array_adjust, true); will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); - const f_status_t status = f_int8s_adjust_callback(0, 1, (void *) datass_array); + const f_status_t status = f_int8s_destroy_callback(0, 1, (void *) datass_array); assert_int_equal(status, F_status_set_error(F_failure)); } } -void test__f_type_array_int8s_adjust_callback__works(void **state) { +void test__f_type_array_int8s_destroy_callback__works(void **state) { int8_t data = 0; int8_t data_array[] = { data }; @@ -34,7 +34,7 @@ void test__f_type_array_int8s_adjust_callback__works(void **state) { will_return(__wrap_f_memory_array_adjust, false); will_return(__wrap_f_memory_array_adjust, F_none); - const f_status_t status = f_int8s_adjust_callback(0, length, (void *) datass_array); + const f_status_t status = f_int8s_destroy_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_destroy_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_destroy_callback.h new file mode 100644 index 0000000..2074caa --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int8s_destroy_callback +#define _TEST__F_type_array__int8s_destroy_callback + +/** + * Test that the function fails. + * + * @see f_int8s_destroy_callback() + */ +extern void test__f_type_array_int8s_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_int8s_destroy_callback() + */ +extern void test__f_type_array_int8s_destroy_callback__works(void **state); + +#endif // _TEST__F_type_array__int8s_destroy_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_resize_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_resize_callback.h deleted file mode 100644 index 509e951..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_resize_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int8s_resize_callback -#define _TEST__F_type_array__int8s_resize_callback - -/** - * Test that the function fails. - * - * @see f_int8s_resize_callback() - */ -extern void test__f_type_array_int8s_resize_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_int8s_resize_callback() - */ -extern void test__f_type_array_int8s_resize_callback__works(void **state); - -#endif // _TEST__F_type_array__int8s_resize_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_adjust_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_adjust_callback.h deleted file mode 100644 index f6bb187..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_adjust_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__number_unsigneds_adjust_callback -#define _TEST__F_type_array__number_unsigneds_adjust_callback - -/** - * Test that the function fails. - * - * @see f_number_unsigneds_adjust_callback() - */ -extern void test__f_type_array_number_unsigneds_adjust_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_number_unsigneds_adjust_callback() - */ -extern void test__f_type_array_number_unsigneds_adjust_callback__works(void **state); - -#endif // _TEST__F_type_array__number_unsigneds_adjust_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_resize_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_delete_callback.c similarity index 77% rename from level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_resize_callback.c rename to level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_delete_callback.c index edf3164..cf55a24 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_resize_callback.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_delete_callback.c @@ -1,11 +1,11 @@ #include "test-type_array.h" -#include "test-type_array-number_unsigneds_resize_callback.h" +#include "test-type_array-number_unsigneds_delete_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_type_array_number_unsigneds_resize_callback__fails(void **state) { +void test__f_type_array_number_unsigneds_delete_callback__fails(void **state) { f_number_unsigned_t data = f_number_unsigned_t_initialize; f_number_unsigned_t data_array[] = { data }; @@ -16,13 +16,13 @@ void test__f_type_array_number_unsigneds_resize_callback__fails(void **state) { will_return(__wrap_f_memory_array_resize, true); will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); - const f_status_t status = f_number_unsigneds_resize_callback(0, 1, (void *) datass_array); + const f_status_t status = f_number_unsigneds_delete_callback(0, 1, (void *) datass_array); assert_int_equal(status, F_status_set_error(F_failure)); } } -void test__f_type_array_number_unsigneds_resize_callback__works(void **state) { +void test__f_type_array_number_unsigneds_delete_callback__works(void **state) { f_number_unsigned_t data = f_number_unsigned_t_initialize; f_number_unsigned_t data_array[] = { data }; @@ -34,7 +34,7 @@ void test__f_type_array_number_unsigneds_resize_callback__works(void **state) { will_return(__wrap_f_memory_array_resize, false); will_return(__wrap_f_memory_array_resize, F_none); - const f_status_t status = f_number_unsigneds_resize_callback(0, length, (void *) datass_array); + const f_status_t status = f_number_unsigneds_delete_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_delete_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_delete_callback.h new file mode 100644 index 0000000..0e6c3b5 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__number_unsigneds_delete_callback +#define _TEST__F_type_array__number_unsigneds_delete_callback + +/** + * Test that the function fails. + * + * @see f_number_unsigneds_delete_callback() + */ +extern void test__f_type_array_number_unsigneds_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_number_unsigneds_delete_callback() + */ +extern void test__f_type_array_number_unsigneds_delete_callback__works(void **state); + +#endif // _TEST__F_type_array__number_unsigneds_delete_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_adjust_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_destroy_callback.c similarity index 70% rename from level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_adjust_callback.c rename to level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_destroy_callback.c index d0ae02e..ad54770 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_adjust_callback.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_destroy_callback.c @@ -1,11 +1,11 @@ #include "test-type_array.h" -#include "test-type_array-number_unsigneds_adjust_callback.h" +#include "test-type_array-number_unsigneds_destroy_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_type_array_number_unsigneds_adjust_callback__fails(void **state) { +void test__f_type_array_number_unsigneds_destroy_callback__fails(void **state) { f_number_unsigned_t data = f_number_unsigned_t_initialize; f_number_unsigned_t data_array[] = { data }; @@ -16,13 +16,13 @@ void test__f_type_array_number_unsigneds_adjust_callback__fails(void **state) { will_return(__wrap_f_memory_array_adjust, true); will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); - const f_status_t status = f_number_unsigneds_adjust_callback(0, 1, (void *) datass_array); + const f_status_t status = f_number_unsigneds_destroy_callback(0, 1, (void *) datass_array); assert_int_equal(status, F_status_set_error(F_failure)); } } -void test__f_type_array_number_unsigneds_adjust_callback__works(void **state) { +void test__f_type_array_number_unsigneds_destroy_callback__works(void **state) { f_number_unsigned_t data = f_number_unsigned_t_initialize; f_number_unsigned_t data_array[] = { data }; @@ -34,7 +34,7 @@ void test__f_type_array_number_unsigneds_adjust_callback__works(void **state) { will_return(__wrap_f_memory_array_adjust, false); will_return(__wrap_f_memory_array_adjust, F_none); - const f_status_t status = f_number_unsigneds_adjust_callback(0, length, (void *) datass_array); + const f_status_t status = f_number_unsigneds_destroy_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_destroy_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_destroy_callback.h new file mode 100644 index 0000000..ae6810b --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__number_unsigneds_destroy_callback +#define _TEST__F_type_array__number_unsigneds_destroy_callback + +/** + * Test that the function fails. + * + * @see f_number_unsigneds_destroy_callback() + */ +extern void test__f_type_array_number_unsigneds_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_number_unsigneds_destroy_callback() + */ +extern void test__f_type_array_number_unsigneds_destroy_callback__works(void **state); + +#endif // _TEST__F_type_array__number_unsigneds_destroy_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_resize_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_resize_callback.h deleted file mode 100644 index 49bda45..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_resize_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__number_unsigneds_resize_callback -#define _TEST__F_type_array__number_unsigneds_resize_callback - -/** - * Test that the function fails. - * - * @see f_number_unsigneds_resize_callback() - */ -extern void test__f_type_array_number_unsigneds_resize_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_number_unsigneds_resize_callback() - */ -extern void test__f_type_array_number_unsigneds_resize_callback__works(void **state); - -#endif // _TEST__F_type_array__number_unsigneds_resize_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-polls_adjust_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-polls_adjust_callback.h deleted file mode 100644 index 998643a..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-polls_adjust_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__polls_adjust_callback -#define _TEST__F_type_array__polls_adjust_callback - -/** - * Test that the function fails. - * - * @see f_polls_adjust_callback() - */ -extern void test__f_type_array_polls_adjust_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_polls_adjust_callback() - */ -extern void test__f_type_array_polls_adjust_callback__works(void **state); - -#endif // _TEST__F_type_array__polls_adjust_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-polls_resize_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-polls_delete_callback.c similarity index 75% rename from level_0/f_type_array/tests/unit/c/test-type_array-polls_resize_callback.c rename to level_0/f_type_array/tests/unit/c/test-type_array-polls_delete_callback.c index 8962386..ed6b410 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-polls_resize_callback.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-polls_delete_callback.c @@ -1,11 +1,11 @@ #include "test-type_array.h" -#include "test-type_array-polls_resize_callback.h" +#include "test-type_array-polls_delete_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_type_array_polls_resize_callback__fails(void **state) { +void test__f_type_array_polls_delete_callback__fails(void **state) { f_poll_t data = f_poll_t_initialize; f_poll_t data_array[] = { data }; @@ -16,13 +16,13 @@ void test__f_type_array_polls_resize_callback__fails(void **state) { will_return(__wrap_f_memory_array_resize, true); will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); - const f_status_t status = f_polls_resize_callback(0, 1, (void *) datass_array); + const f_status_t status = f_polls_delete_callback(0, 1, (void *) datass_array); assert_int_equal(status, F_status_set_error(F_failure)); } } -void test__f_type_array_polls_resize_callback__works(void **state) { +void test__f_type_array_polls_delete_callback__works(void **state) { f_poll_t data = f_poll_t_initialize; f_poll_t data_array[] = { data }; @@ -34,7 +34,7 @@ void test__f_type_array_polls_resize_callback__works(void **state) { will_return(__wrap_f_memory_array_resize, false); will_return(__wrap_f_memory_array_resize, F_none); - const f_status_t status = f_polls_resize_callback(0, length, (void *) datass_array); + const f_status_t status = f_polls_delete_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-polls_delete_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-polls_delete_callback.h new file mode 100644 index 0000000..d6b9562 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-polls_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__polls_delete_callback +#define _TEST__F_type_array__polls_delete_callback + +/** + * Test that the function fails. + * + * @see f_polls_delete_callback() + */ +extern void test__f_type_array_polls_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_polls_delete_callback() + */ +extern void test__f_type_array_polls_delete_callback__works(void **state); + +#endif // _TEST__F_type_array__polls_delete_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-polls_adjust_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-polls_destroy_callback.c similarity index 70% rename from level_0/f_type_array/tests/unit/c/test-type_array-polls_adjust_callback.c rename to level_0/f_type_array/tests/unit/c/test-type_array-polls_destroy_callback.c index 7147391..1241c67 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-polls_adjust_callback.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-polls_destroy_callback.c @@ -1,11 +1,11 @@ #include "test-type_array.h" -#include "test-type_array-polls_adjust_callback.h" +#include "test-type_array-polls_destroy_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_type_array_polls_adjust_callback__fails(void **state) { +void test__f_type_array_polls_destroy_callback__fails(void **state) { f_poll_t data = f_poll_t_initialize; f_poll_t data_array[] = { data }; @@ -16,13 +16,13 @@ void test__f_type_array_polls_adjust_callback__fails(void **state) { will_return(__wrap_f_memory_array_adjust, true); will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); - const f_status_t status = f_polls_adjust_callback(0, 1, (void *) datass_array); + const f_status_t status = f_polls_destroy_callback(0, 1, (void *) datass_array); assert_int_equal(status, F_status_set_error(F_failure)); } } -void test__f_type_array_polls_adjust_callback__works(void **state) { +void test__f_type_array_polls_destroy_callback__works(void **state) { f_poll_t data = f_poll_t_initialize; f_poll_t data_array[] = { data }; @@ -34,7 +34,7 @@ void test__f_type_array_polls_adjust_callback__works(void **state) { will_return(__wrap_f_memory_array_adjust, false); will_return(__wrap_f_memory_array_adjust, F_none); - const f_status_t status = f_polls_adjust_callback(0, length, (void *) datass_array); + const f_status_t status = f_polls_destroy_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-polls_destroy_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-polls_destroy_callback.h new file mode 100644 index 0000000..4a25b2f --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-polls_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__polls_destroy_callback +#define _TEST__F_type_array__polls_destroy_callback + +/** + * Test that the function fails. + * + * @see f_polls_destroy_callback() + */ +extern void test__f_type_array_polls_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_polls_destroy_callback() + */ +extern void test__f_type_array_polls_destroy_callback__works(void **state); + +#endif // _TEST__F_type_array__polls_destroy_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-polls_resize_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-polls_resize_callback.h deleted file mode 100644 index 92d064b..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-polls_resize_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__polls_resize_callback -#define _TEST__F_type_array__polls_resize_callback - -/** - * Test that the function fails. - * - * @see f_polls_resize_callback() - */ -extern void test__f_type_array_polls_resize_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_polls_resize_callback() - */ -extern void test__f_type_array_polls_resize_callback__works(void **state); - -#endif // _TEST__F_type_array__polls_resize_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-states_adjust_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-states_adjust_callback.h deleted file mode 100644 index 2b77be3..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-states_adjust_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__states_adjust_callback -#define _TEST__F_type_array__states_adjust_callback - -/** - * Test that the function fails. - * - * @see f_states_adjust_callback() - */ -extern void test__f_type_array_states_adjust_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_states_adjust_callback() - */ -extern void test__f_type_array_states_adjust_callback__works(void **state); - -#endif // _TEST__F_type_array__states_adjust_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-states_resize_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-states_delete_callback.c similarity index 75% rename from level_0/f_type_array/tests/unit/c/test-type_array-states_resize_callback.c rename to level_0/f_type_array/tests/unit/c/test-type_array-states_delete_callback.c index 5e8ff10..9aa63db 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-states_resize_callback.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-states_delete_callback.c @@ -1,11 +1,11 @@ #include "test-type_array.h" -#include "test-type_array-states_resize_callback.h" +#include "test-type_array-states_delete_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_type_array_states_resize_callback__fails(void **state) { +void test__f_type_array_states_delete_callback__fails(void **state) { f_state_t data = f_state_t_initialize; f_state_t data_array[] = { data }; @@ -16,13 +16,13 @@ void test__f_type_array_states_resize_callback__fails(void **state) { will_return(__wrap_f_memory_array_resize, true); will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); - const f_status_t status = f_states_resize_callback(0, 1, (void *) datass_array); + const f_status_t status = f_states_delete_callback(0, 1, (void *) datass_array); assert_int_equal(status, F_status_set_error(F_failure)); } } -void test__f_type_array_states_resize_callback__works(void **state) { +void test__f_type_array_states_delete_callback__works(void **state) { f_state_t data = f_state_t_initialize; f_state_t data_array[] = { data }; @@ -34,7 +34,7 @@ void test__f_type_array_states_resize_callback__works(void **state) { will_return(__wrap_f_memory_array_resize, false); will_return(__wrap_f_memory_array_resize, F_none); - const f_status_t status = f_states_resize_callback(0, length, (void *) datass_array); + const f_status_t status = f_states_delete_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-states_delete_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-states_delete_callback.h new file mode 100644 index 0000000..24855a6 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-states_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__states_delete_callback +#define _TEST__F_type_array__states_delete_callback + +/** + * Test that the function fails. + * + * @see f_states_delete_callback() + */ +extern void test__f_type_array_states_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_states_delete_callback() + */ +extern void test__f_type_array_states_delete_callback__works(void **state); + +#endif // _TEST__F_type_array__states_delete_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-states_adjust_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-states_destroy_callback.c similarity index 70% rename from level_0/f_type_array/tests/unit/c/test-type_array-states_adjust_callback.c rename to level_0/f_type_array/tests/unit/c/test-type_array-states_destroy_callback.c index d58efaa..ca8a1b7 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-states_adjust_callback.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-states_destroy_callback.c @@ -1,11 +1,11 @@ #include "test-type_array.h" -#include "test-type_array-states_adjust_callback.h" +#include "test-type_array-states_destroy_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_type_array_states_adjust_callback__fails(void **state) { +void test__f_type_array_states_destroy_callback__fails(void **state) { f_state_t data = f_state_t_initialize; f_state_t data_array[] = { data }; @@ -16,13 +16,13 @@ void test__f_type_array_states_adjust_callback__fails(void **state) { will_return(__wrap_f_memory_array_adjust, true); will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); - const f_status_t status = f_states_adjust_callback(0, 1, (void *) datass_array); + const f_status_t status = f_states_destroy_callback(0, 1, (void *) datass_array); assert_int_equal(status, F_status_set_error(F_failure)); } } -void test__f_type_array_states_adjust_callback__works(void **state) { +void test__f_type_array_states_destroy_callback__works(void **state) { f_state_t data = f_state_t_initialize; f_state_t data_array[] = { data }; @@ -34,7 +34,7 @@ void test__f_type_array_states_adjust_callback__works(void **state) { will_return(__wrap_f_memory_array_adjust, false); will_return(__wrap_f_memory_array_adjust, F_none); - const f_status_t status = f_states_adjust_callback(0, length, (void *) datass_array); + const f_status_t status = f_states_destroy_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-states_destroy_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-states_destroy_callback.h new file mode 100644 index 0000000..1533ebe --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-states_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__states_destroy_callback +#define _TEST__F_type_array__states_destroy_callback + +/** + * Test that the function fails. + * + * @see f_states_destroy_callback() + */ +extern void test__f_type_array_states_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_states_destroy_callback() + */ +extern void test__f_type_array_states_destroy_callback__works(void **state); + +#endif // _TEST__F_type_array__states_destroy_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-states_resize_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-states_resize_callback.h deleted file mode 100644 index 7bead77..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-states_resize_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__states_resize_callback -#define _TEST__F_type_array__states_resize_callback - -/** - * Test that the function fails. - * - * @see f_states_resize_callback() - */ -extern void test__f_type_array_states_resize_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_states_resize_callback() - */ -extern void test__f_type_array_states_resize_callback__works(void **state); - -#endif // _TEST__F_type_array__states_resize_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_adjust_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_adjust_callback.h deleted file mode 100644 index 8f00dc9..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_adjust_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__statuss_adjust_callback -#define _TEST__F_type_array__statuss_adjust_callback - -/** - * Test that the function fails. - * - * @see f_statuss_adjust_callback() - */ -extern void test__f_type_array_statuss_adjust_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_statuss_adjust_callback() - */ -extern void test__f_type_array_statuss_adjust_callback__works(void **state); - -#endif // _TEST__F_type_array__statuss_adjust_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_resize_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_delete_callback.c similarity index 75% rename from level_0/f_type_array/tests/unit/c/test-type_array-statuss_resize_callback.c rename to level_0/f_type_array/tests/unit/c/test-type_array-statuss_delete_callback.c index e7de32f..6f943d0 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_resize_callback.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_delete_callback.c @@ -1,11 +1,11 @@ #include "test-type_array.h" -#include "test-type_array-statuss_resize_callback.h" +#include "test-type_array-statuss_delete_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_type_array_statuss_resize_callback__fails(void **state) { +void test__f_type_array_statuss_delete_callback__fails(void **state) { f_status_t data = f_status_t_initialize; f_status_t data_array[] = { data }; @@ -16,13 +16,13 @@ void test__f_type_array_statuss_resize_callback__fails(void **state) { will_return(__wrap_f_memory_array_resize, true); will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); - const f_status_t status = f_statuss_resize_callback(0, 1, (void *) datass_array); + const f_status_t status = f_statuss_delete_callback(0, 1, (void *) datass_array); assert_int_equal(status, F_status_set_error(F_failure)); } } -void test__f_type_array_statuss_resize_callback__works(void **state) { +void test__f_type_array_statuss_delete_callback__works(void **state) { f_status_t data = f_status_t_initialize; f_status_t data_array[] = { data }; @@ -34,7 +34,7 @@ void test__f_type_array_statuss_resize_callback__works(void **state) { will_return(__wrap_f_memory_array_resize, false); will_return(__wrap_f_memory_array_resize, F_none); - const f_status_t status = f_statuss_resize_callback(0, length, (void *) datass_array); + const f_status_t status = f_statuss_delete_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_delete_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_delete_callback.h new file mode 100644 index 0000000..4ba1f6e --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__statuss_delete_callback +#define _TEST__F_type_array__statuss_delete_callback + +/** + * Test that the function fails. + * + * @see f_statuss_delete_callback() + */ +extern void test__f_type_array_statuss_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_statuss_delete_callback() + */ +extern void test__f_type_array_statuss_delete_callback__works(void **state); + +#endif // _TEST__F_type_array__statuss_delete_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_adjust_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_destroy_callback.c similarity index 70% rename from level_0/f_type_array/tests/unit/c/test-type_array-statuss_adjust_callback.c rename to level_0/f_type_array/tests/unit/c/test-type_array-statuss_destroy_callback.c index 535d842..5696778 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_adjust_callback.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_destroy_callback.c @@ -1,11 +1,11 @@ #include "test-type_array.h" -#include "test-type_array-statuss_adjust_callback.h" +#include "test-type_array-statuss_destroy_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_type_array_statuss_adjust_callback__fails(void **state) { +void test__f_type_array_statuss_destroy_callback__fails(void **state) { f_status_t data = f_status_t_initialize; f_status_t data_array[] = { data }; @@ -16,13 +16,13 @@ void test__f_type_array_statuss_adjust_callback__fails(void **state) { will_return(__wrap_f_memory_array_adjust, true); will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); - const f_status_t status = f_statuss_adjust_callback(0, 1, (void *) datass_array); + const f_status_t status = f_statuss_destroy_callback(0, 1, (void *) datass_array); assert_int_equal(status, F_status_set_error(F_failure)); } } -void test__f_type_array_statuss_adjust_callback__works(void **state) { +void test__f_type_array_statuss_destroy_callback__works(void **state) { f_status_t data = f_status_t_initialize; f_status_t data_array[] = { data }; @@ -34,7 +34,7 @@ void test__f_type_array_statuss_adjust_callback__works(void **state) { will_return(__wrap_f_memory_array_adjust, false); will_return(__wrap_f_memory_array_adjust, F_none); - const f_status_t status = f_statuss_adjust_callback(0, length, (void *) datass_array); + const f_status_t status = f_statuss_destroy_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_destroy_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_destroy_callback.h new file mode 100644 index 0000000..26cb0ac --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__statuss_destroy_callback +#define _TEST__F_type_array__statuss_destroy_callback + +/** + * Test that the function fails. + * + * @see f_statuss_destroy_callback() + */ +extern void test__f_type_array_statuss_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_statuss_destroy_callback() + */ +extern void test__f_type_array_statuss_destroy_callback__works(void **state); + +#endif // _TEST__F_type_array__statuss_destroy_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_resize_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_resize_callback.h deleted file mode 100644 index 52ae5fc..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_resize_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__statuss_resize_callback -#define _TEST__F_type_array__statuss_resize_callback - -/** - * Test that the function fails. - * - * @see f_statuss_resize_callback() - */ -extern void test__f_type_array_statuss_resize_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_statuss_resize_callback() - */ -extern void test__f_type_array_statuss_resize_callback__works(void **state); - -#endif // _TEST__F_type_array__statuss_resize_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_adjust_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_adjust_callback.h deleted file mode 100644 index c1e04c3..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_adjust_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint128s_adjust_callback -#define _TEST__F_type_array__uint128s_adjust_callback - -/** - * Test that the function fails. - * - * @see f_uint128s_adjust_callback() - */ -extern void test__f_type_array_uint128s_adjust_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_uint128s_adjust_callback() - */ -extern void test__f_type_array_uint128s_adjust_callback__works(void **state); - -#endif // _TEST__F_type_array__uint128s_adjust_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_resize_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_delete_callback.c similarity index 75% rename from level_0/f_type_array/tests/unit/c/test-type_array-uint128s_resize_callback.c rename to level_0/f_type_array/tests/unit/c/test-type_array-uint128s_delete_callback.c index 15c3b01..233f3e5 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_resize_callback.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_delete_callback.c @@ -1,11 +1,11 @@ #include "test-type_array.h" -#include "test-type_array-uint128s_resize_callback.h" +#include "test-type_array-uint128s_delete_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_type_array_uint128s_resize_callback__fails(void **state) { +void test__f_type_array_uint128s_delete_callback__fails(void **state) { f_uint128_t data = 0; f_uint128_t data_array[] = { data }; @@ -16,13 +16,13 @@ void test__f_type_array_uint128s_resize_callback__fails(void **state) { will_return(__wrap_f_memory_array_resize, true); will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); - const f_status_t status = f_uint128s_resize_callback(0, 1, (void *) datass_array); + const f_status_t status = f_uint128s_delete_callback(0, 1, (void *) datass_array); assert_int_equal(status, F_status_set_error(F_failure)); } } -void test__f_type_array_uint128s_resize_callback__works(void **state) { +void test__f_type_array_uint128s_delete_callback__works(void **state) { f_uint128_t data = 0; f_uint128_t data_array[] = { data }; @@ -34,7 +34,7 @@ void test__f_type_array_uint128s_resize_callback__works(void **state) { will_return(__wrap_f_memory_array_resize, false); will_return(__wrap_f_memory_array_resize, F_none); - const f_status_t status = f_uint128s_resize_callback(0, length, (void *) datass_array); + const f_status_t status = f_uint128s_delete_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_delete_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_delete_callback.h new file mode 100644 index 0000000..ae8a66d --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint128s_delete_callback +#define _TEST__F_type_array__uint128s_delete_callback + +/** + * Test that the function fails. + * + * @see f_uint128s_delete_callback() + */ +extern void test__f_type_array_uint128s_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_uint128s_delete_callback() + */ +extern void test__f_type_array_uint128s_delete_callback__works(void **state); + +#endif // _TEST__F_type_array__uint128s_delete_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_adjust_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_destroy_callback.c similarity index 69% rename from level_0/f_type_array/tests/unit/c/test-type_array-uint128s_adjust_callback.c rename to level_0/f_type_array/tests/unit/c/test-type_array-uint128s_destroy_callback.c index 005f732..e88b599 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_adjust_callback.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_destroy_callback.c @@ -1,11 +1,11 @@ #include "test-type_array.h" -#include "test-type_array-uint128s_adjust_callback.h" +#include "test-type_array-uint128s_destroy_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_type_array_uint128s_adjust_callback__fails(void **state) { +void test__f_type_array_uint128s_destroy_callback__fails(void **state) { f_uint128_t data = 0; f_uint128_t data_array[] = { data }; @@ -16,13 +16,13 @@ void test__f_type_array_uint128s_adjust_callback__fails(void **state) { will_return(__wrap_f_memory_array_adjust, true); will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); - const f_status_t status = f_uint128s_adjust_callback(0, 1, (void *) datass_array); + const f_status_t status = f_uint128s_destroy_callback(0, 1, (void *) datass_array); assert_int_equal(status, F_status_set_error(F_failure)); } } -void test__f_type_array_uint128s_adjust_callback__works(void **state) { +void test__f_type_array_uint128s_destroy_callback__works(void **state) { f_uint128_t data = 0; f_uint128_t data_array[] = { data }; @@ -34,7 +34,7 @@ void test__f_type_array_uint128s_adjust_callback__works(void **state) { will_return(__wrap_f_memory_array_adjust, false); will_return(__wrap_f_memory_array_adjust, F_none); - const f_status_t status = f_uint128s_adjust_callback(0, length, (void *) datass_array); + const f_status_t status = f_uint128s_destroy_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_destroy_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_destroy_callback.h new file mode 100644 index 0000000..6176824 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint128s_destroy_callback +#define _TEST__F_type_array__uint128s_destroy_callback + +/** + * Test that the function fails. + * + * @see f_uint128s_destroy_callback() + */ +extern void test__f_type_array_uint128s_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_uint128s_destroy_callback() + */ +extern void test__f_type_array_uint128s_destroy_callback__works(void **state); + +#endif // _TEST__F_type_array__uint128s_destroy_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_resize_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_resize_callback.h deleted file mode 100644 index 84e6dac..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_resize_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint128s_resize_callback -#define _TEST__F_type_array__uint128s_resize_callback - -/** - * Test that the function fails. - * - * @see f_uint128s_resize_callback() - */ -extern void test__f_type_array_uint128s_resize_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_uint128s_resize_callback() - */ -extern void test__f_type_array_uint128s_resize_callback__works(void **state); - -#endif // _TEST__F_type_array__uint128s_resize_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_adjust_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_adjust_callback.h deleted file mode 100644 index 322b477..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_adjust_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint16s_adjust_callback -#define _TEST__F_type_array__uint16s_adjust_callback - -/** - * Test that the function fails. - * - * @see f_uint16s_adjust_callback() - */ -extern void test__f_type_array_uint16s_adjust_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_uint16s_adjust_callback() - */ -extern void test__f_type_array_uint16s_adjust_callback__works(void **state); - -#endif // _TEST__F_type_array__uint16s_adjust_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_resize_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_delete_callback.c similarity index 74% rename from level_0/f_type_array/tests/unit/c/test-type_array-uint16s_resize_callback.c rename to level_0/f_type_array/tests/unit/c/test-type_array-uint16s_delete_callback.c index f8d3f0c..89d2db5 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_resize_callback.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_delete_callback.c @@ -1,11 +1,11 @@ #include "test-type_array.h" -#include "test-type_array-uint16s_resize_callback.h" +#include "test-type_array-uint16s_delete_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_type_array_uint16s_resize_callback__fails(void **state) { +void test__f_type_array_uint16s_delete_callback__fails(void **state) { uint16_t data = 0; uint16_t data_array[] = { data }; @@ -16,13 +16,13 @@ void test__f_type_array_uint16s_resize_callback__fails(void **state) { will_return(__wrap_f_memory_array_resize, true); will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); - const f_status_t status = f_uint16s_resize_callback(0, 1, (void *) datass_array); + const f_status_t status = f_uint16s_delete_callback(0, 1, (void *) datass_array); assert_int_equal(status, F_status_set_error(F_failure)); } } -void test__f_type_array_uint16s_resize_callback__works(void **state) { +void test__f_type_array_uint16s_delete_callback__works(void **state) { uint16_t data = 0; uint16_t data_array[] = { data }; @@ -34,7 +34,7 @@ void test__f_type_array_uint16s_resize_callback__works(void **state) { will_return(__wrap_f_memory_array_resize, false); will_return(__wrap_f_memory_array_resize, F_none); - const f_status_t status = f_uint16s_resize_callback(0, length, (void *) datass_array); + const f_status_t status = f_uint16s_delete_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_delete_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_delete_callback.h new file mode 100644 index 0000000..48bc3f6 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint16s_delete_callback +#define _TEST__F_type_array__uint16s_delete_callback + +/** + * Test that the function fails. + * + * @see f_uint16s_delete_callback() + */ +extern void test__f_type_array_uint16s_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_uint16s_delete_callback() + */ +extern void test__f_type_array_uint16s_delete_callback__works(void **state); + +#endif // _TEST__F_type_array__uint16s_delete_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_adjust_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_destroy_callback.c similarity index 69% rename from level_0/f_type_array/tests/unit/c/test-type_array-uint16s_adjust_callback.c rename to level_0/f_type_array/tests/unit/c/test-type_array-uint16s_destroy_callback.c index c4f9ef3..34853f7 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_adjust_callback.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_destroy_callback.c @@ -1,11 +1,11 @@ #include "test-type_array.h" -#include "test-type_array-uint16s_adjust_callback.h" +#include "test-type_array-uint16s_destroy_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_type_array_uint16s_adjust_callback__fails(void **state) { +void test__f_type_array_uint16s_destroy_callback__fails(void **state) { uint16_t data = 0; uint16_t data_array[] = { data }; @@ -16,13 +16,13 @@ void test__f_type_array_uint16s_adjust_callback__fails(void **state) { will_return(__wrap_f_memory_array_adjust, true); will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); - const f_status_t status = f_uint16s_adjust_callback(0, 1, (void *) datass_array); + const f_status_t status = f_uint16s_destroy_callback(0, 1, (void *) datass_array); assert_int_equal(status, F_status_set_error(F_failure)); } } -void test__f_type_array_uint16s_adjust_callback__works(void **state) { +void test__f_type_array_uint16s_destroy_callback__works(void **state) { uint16_t data = 0; uint16_t data_array[] = { data }; @@ -34,7 +34,7 @@ void test__f_type_array_uint16s_adjust_callback__works(void **state) { will_return(__wrap_f_memory_array_adjust, false); will_return(__wrap_f_memory_array_adjust, F_none); - const f_status_t status = f_uint16s_adjust_callback(0, length, (void *) datass_array); + const f_status_t status = f_uint16s_destroy_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_destroy_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_destroy_callback.h new file mode 100644 index 0000000..bfac51f --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint16s_destroy_callback +#define _TEST__F_type_array__uint16s_destroy_callback + +/** + * Test that the function fails. + * + * @see f_uint16s_destroy_callback() + */ +extern void test__f_type_array_uint16s_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_uint16s_destroy_callback() + */ +extern void test__f_type_array_uint16s_destroy_callback__works(void **state); + +#endif // _TEST__F_type_array__uint16s_destroy_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_resize_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_resize_callback.h deleted file mode 100644 index 7b6c332..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_resize_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint16s_resize_callback -#define _TEST__F_type_array__uint16s_resize_callback - -/** - * Test that the function fails. - * - * @see f_uint16s_resize_callback() - */ -extern void test__f_type_array_uint16s_resize_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_uint16s_resize_callback() - */ -extern void test__f_type_array_uint16s_resize_callback__works(void **state); - -#endif // _TEST__F_type_array__uint16s_resize_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_adjust_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_adjust_callback.h deleted file mode 100644 index 17a024c..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_adjust_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint32s_adjust_callback -#define _TEST__F_type_array__uint32s_adjust_callback - -/** - * Test that the function fails. - * - * @see f_uint32s_adjust_callback() - */ -extern void test__f_type_array_uint32s_adjust_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_uint32s_adjust_callback() - */ -extern void test__f_type_array_uint32s_adjust_callback__works(void **state); - -#endif // _TEST__F_type_array__uint32s_adjust_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_resize_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_delete_callback.c similarity index 74% rename from level_0/f_type_array/tests/unit/c/test-type_array-uint32s_resize_callback.c rename to level_0/f_type_array/tests/unit/c/test-type_array-uint32s_delete_callback.c index 02f0a67..034f1eb 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_resize_callback.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_delete_callback.c @@ -1,11 +1,11 @@ #include "test-type_array.h" -#include "test-type_array-uint32s_resize_callback.h" +#include "test-type_array-uint32s_delete_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_type_array_uint32s_resize_callback__fails(void **state) { +void test__f_type_array_uint32s_delete_callback__fails(void **state) { uint32_t data = 0; uint32_t data_array[] = { data }; @@ -16,13 +16,13 @@ void test__f_type_array_uint32s_resize_callback__fails(void **state) { will_return(__wrap_f_memory_array_resize, true); will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); - const f_status_t status = f_uint32s_resize_callback(0, 1, (void *) datass_array); + const f_status_t status = f_uint32s_delete_callback(0, 1, (void *) datass_array); assert_int_equal(status, F_status_set_error(F_failure)); } } -void test__f_type_array_uint32s_resize_callback__works(void **state) { +void test__f_type_array_uint32s_delete_callback__works(void **state) { uint32_t data = 0; uint32_t data_array[] = { data }; @@ -34,7 +34,7 @@ void test__f_type_array_uint32s_resize_callback__works(void **state) { will_return(__wrap_f_memory_array_resize, false); will_return(__wrap_f_memory_array_resize, F_none); - const f_status_t status = f_uint32s_resize_callback(0, length, (void *) datass_array); + const f_status_t status = f_uint32s_delete_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_delete_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_delete_callback.h new file mode 100644 index 0000000..045dd27 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint32s_delete_callback +#define _TEST__F_type_array__uint32s_delete_callback + +/** + * Test that the function fails. + * + * @see f_uint32s_delete_callback() + */ +extern void test__f_type_array_uint32s_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_uint32s_delete_callback() + */ +extern void test__f_type_array_uint32s_delete_callback__works(void **state); + +#endif // _TEST__F_type_array__uint32s_delete_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_adjust_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_destroy_callback.c similarity index 69% rename from level_0/f_type_array/tests/unit/c/test-type_array-uint32s_adjust_callback.c rename to level_0/f_type_array/tests/unit/c/test-type_array-uint32s_destroy_callback.c index 466a726..d11bd91 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_adjust_callback.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_destroy_callback.c @@ -1,11 +1,11 @@ #include "test-type_array.h" -#include "test-type_array-uint32s_adjust_callback.h" +#include "test-type_array-uint32s_destroy_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_type_array_uint32s_adjust_callback__fails(void **state) { +void test__f_type_array_uint32s_destroy_callback__fails(void **state) { uint32_t data = 0; uint32_t data_array[] = { data }; @@ -16,13 +16,13 @@ void test__f_type_array_uint32s_adjust_callback__fails(void **state) { will_return(__wrap_f_memory_array_adjust, true); will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); - const f_status_t status = f_uint32s_adjust_callback(0, 1, (void *) datass_array); + const f_status_t status = f_uint32s_destroy_callback(0, 1, (void *) datass_array); assert_int_equal(status, F_status_set_error(F_failure)); } } -void test__f_type_array_uint32s_adjust_callback__works(void **state) { +void test__f_type_array_uint32s_destroy_callback__works(void **state) { uint32_t data = 0; uint32_t data_array[] = { data }; @@ -34,7 +34,7 @@ void test__f_type_array_uint32s_adjust_callback__works(void **state) { will_return(__wrap_f_memory_array_adjust, false); will_return(__wrap_f_memory_array_adjust, F_none); - const f_status_t status = f_uint32s_adjust_callback(0, length, (void *) datass_array); + const f_status_t status = f_uint32s_destroy_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_destroy_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_destroy_callback.h new file mode 100644 index 0000000..764f231 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint32s_destroy_callback +#define _TEST__F_type_array__uint32s_destroy_callback + +/** + * Test that the function fails. + * + * @see f_uint32s_destroy_callback() + */ +extern void test__f_type_array_uint32s_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_uint32s_destroy_callback() + */ +extern void test__f_type_array_uint32s_destroy_callback__works(void **state); + +#endif // _TEST__F_type_array__uint32s_destroy_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_resize_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_resize_callback.h deleted file mode 100644 index 45782c0..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_resize_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint32s_resize_callback -#define _TEST__F_type_array__uint32s_resize_callback - -/** - * Test that the function fails. - * - * @see f_uint32s_resize_callback() - */ -extern void test__f_type_array_uint32s_resize_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_uint32s_resize_callback() - */ -extern void test__f_type_array_uint32s_resize_callback__works(void **state); - -#endif // _TEST__F_type_array__uint32s_resize_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_adjust_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_adjust_callback.h deleted file mode 100644 index ddde900..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_adjust_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint64s_adjust_callback -#define _TEST__F_type_array__uint64s_adjust_callback - -/** - * Test that the function fails. - * - * @see f_uint64s_adjust_callback() - */ -extern void test__f_type_array_uint64s_adjust_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_uint64s_adjust_callback() - */ -extern void test__f_type_array_uint64s_adjust_callback__works(void **state); - -#endif // _TEST__F_type_array__uint64s_adjust_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_resize_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_delete_callback.c similarity index 74% rename from level_0/f_type_array/tests/unit/c/test-type_array-uint64s_resize_callback.c rename to level_0/f_type_array/tests/unit/c/test-type_array-uint64s_delete_callback.c index 9adaeb4..ee0f5eb 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_resize_callback.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_delete_callback.c @@ -1,11 +1,11 @@ #include "test-type_array.h" -#include "test-type_array-uint64s_resize_callback.h" +#include "test-type_array-uint64s_delete_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_type_array_uint64s_resize_callback__fails(void **state) { +void test__f_type_array_uint64s_delete_callback__fails(void **state) { uint64_t data = 0; uint64_t data_array[] = { data }; @@ -16,13 +16,13 @@ void test__f_type_array_uint64s_resize_callback__fails(void **state) { will_return(__wrap_f_memory_array_resize, true); will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); - const f_status_t status = f_uint64s_resize_callback(0, 1, (void *) datass_array); + const f_status_t status = f_uint64s_delete_callback(0, 1, (void *) datass_array); assert_int_equal(status, F_status_set_error(F_failure)); } } -void test__f_type_array_uint64s_resize_callback__works(void **state) { +void test__f_type_array_uint64s_delete_callback__works(void **state) { uint64_t data = 0; uint64_t data_array[] = { data }; @@ -34,7 +34,7 @@ void test__f_type_array_uint64s_resize_callback__works(void **state) { will_return(__wrap_f_memory_array_resize, false); will_return(__wrap_f_memory_array_resize, F_none); - const f_status_t status = f_uint64s_resize_callback(0, length, (void *) datass_array); + const f_status_t status = f_uint64s_delete_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_delete_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_delete_callback.h new file mode 100644 index 0000000..d5570bb --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint64s_delete_callback +#define _TEST__F_type_array__uint64s_delete_callback + +/** + * Test that the function fails. + * + * @see f_uint64s_delete_callback() + */ +extern void test__f_type_array_uint64s_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_uint64s_delete_callback() + */ +extern void test__f_type_array_uint64s_delete_callback__works(void **state); + +#endif // _TEST__F_type_array__uint64s_delete_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_adjust_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_destroy_callback.c similarity index 69% rename from level_0/f_type_array/tests/unit/c/test-type_array-uint64s_adjust_callback.c rename to level_0/f_type_array/tests/unit/c/test-type_array-uint64s_destroy_callback.c index c40b2a3..9f80d3f 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_adjust_callback.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_destroy_callback.c @@ -1,11 +1,11 @@ #include "test-type_array.h" -#include "test-type_array-uint64s_adjust_callback.h" +#include "test-type_array-uint64s_destroy_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_type_array_uint64s_adjust_callback__fails(void **state) { +void test__f_type_array_uint64s_destroy_callback__fails(void **state) { uint64_t data = 0; uint64_t data_array[] = { data }; @@ -16,13 +16,13 @@ void test__f_type_array_uint64s_adjust_callback__fails(void **state) { will_return(__wrap_f_memory_array_adjust, true); will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); - const f_status_t status = f_uint64s_adjust_callback(0, 1, (void *) datass_array); + const f_status_t status = f_uint64s_destroy_callback(0, 1, (void *) datass_array); assert_int_equal(status, F_status_set_error(F_failure)); } } -void test__f_type_array_uint64s_adjust_callback__works(void **state) { +void test__f_type_array_uint64s_destroy_callback__works(void **state) { uint64_t data = 0; uint64_t data_array[] = { data }; @@ -34,7 +34,7 @@ void test__f_type_array_uint64s_adjust_callback__works(void **state) { will_return(__wrap_f_memory_array_adjust, false); will_return(__wrap_f_memory_array_adjust, F_none); - const f_status_t status = f_uint64s_adjust_callback(0, length, (void *) datass_array); + const f_status_t status = f_uint64s_destroy_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_destroy_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_destroy_callback.h new file mode 100644 index 0000000..856868a --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint64s_destroy_callback +#define _TEST__F_type_array__uint64s_destroy_callback + +/** + * Test that the function fails. + * + * @see f_uint64s_destroy_callback() + */ +extern void test__f_type_array_uint64s_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_uint64s_destroy_callback() + */ +extern void test__f_type_array_uint64s_destroy_callback__works(void **state); + +#endif // _TEST__F_type_array__uint64s_destroy_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_resize_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_resize_callback.h deleted file mode 100644 index c4487db..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_resize_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint64s_resize_callback -#define _TEST__F_type_array__uint64s_resize_callback - -/** - * Test that the function fails. - * - * @see f_uint64s_resize_callback() - */ -extern void test__f_type_array_uint64s_resize_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_uint64s_resize_callback() - */ -extern void test__f_type_array_uint64s_resize_callback__works(void **state); - -#endif // _TEST__F_type_array__uint64s_resize_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_adjust_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_adjust_callback.h deleted file mode 100644 index e04c034..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_adjust_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint8s_adjust_callback -#define _TEST__F_type_array__uint8s_adjust_callback - -/** - * Test that the function fails. - * - * @see f_uint8s_adjust_callback() - */ -extern void test__f_type_array_uint8s_adjust_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_uint8s_adjust_callback() - */ -extern void test__f_type_array_uint8s_adjust_callback__works(void **state); - -#endif // _TEST__F_type_array__uint8s_adjust_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_resize_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_delete_callback.c similarity index 74% rename from level_0/f_type_array/tests/unit/c/test-type_array-uint8s_resize_callback.c rename to level_0/f_type_array/tests/unit/c/test-type_array-uint8s_delete_callback.c index 747c8df..597ee24 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_resize_callback.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_delete_callback.c @@ -1,11 +1,11 @@ #include "test-type_array.h" -#include "test-type_array-uint8s_resize_callback.h" +#include "test-type_array-uint8s_delete_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_type_array_uint8s_resize_callback__fails(void **state) { +void test__f_type_array_uint8s_delete_callback__fails(void **state) { uint8_t data = 0; uint8_t data_array[] = { data }; @@ -16,13 +16,13 @@ void test__f_type_array_uint8s_resize_callback__fails(void **state) { will_return(__wrap_f_memory_array_resize, true); will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); - const f_status_t status = f_uint8s_resize_callback(0, 1, (void *) datass_array); + const f_status_t status = f_uint8s_delete_callback(0, 1, (void *) datass_array); assert_int_equal(status, F_status_set_error(F_failure)); } } -void test__f_type_array_uint8s_resize_callback__works(void **state) { +void test__f_type_array_uint8s_delete_callback__works(void **state) { uint8_t data = 0; uint8_t data_array[] = { data }; @@ -34,7 +34,7 @@ void test__f_type_array_uint8s_resize_callback__works(void **state) { will_return(__wrap_f_memory_array_resize, false); will_return(__wrap_f_memory_array_resize, F_none); - const f_status_t status = f_uint8s_resize_callback(0, length, (void *) datass_array); + const f_status_t status = f_uint8s_delete_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_delete_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_delete_callback.h new file mode 100644 index 0000000..8105795 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint8s_delete_callback +#define _TEST__F_type_array__uint8s_delete_callback + +/** + * Test that the function fails. + * + * @see f_uint8s_delete_callback() + */ +extern void test__f_type_array_uint8s_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_uint8s_delete_callback() + */ +extern void test__f_type_array_uint8s_delete_callback__works(void **state); + +#endif // _TEST__F_type_array__uint8s_delete_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_adjust_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_destroy_callback.c similarity index 69% rename from level_0/f_type_array/tests/unit/c/test-type_array-uint8s_adjust_callback.c rename to level_0/f_type_array/tests/unit/c/test-type_array-uint8s_destroy_callback.c index 8485915..49b4cf7 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_adjust_callback.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_destroy_callback.c @@ -1,11 +1,11 @@ #include "test-type_array.h" -#include "test-type_array-uint8s_adjust_callback.h" +#include "test-type_array-uint8s_destroy_callback.h" #ifdef __cplusplus extern "C" { #endif -void test__f_type_array_uint8s_adjust_callback__fails(void **state) { +void test__f_type_array_uint8s_destroy_callback__fails(void **state) { uint8_t data = 0; uint8_t data_array[] = { data }; @@ -16,13 +16,13 @@ void test__f_type_array_uint8s_adjust_callback__fails(void **state) { will_return(__wrap_f_memory_array_adjust, true); will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); - const f_status_t status = f_uint8s_adjust_callback(0, 1, (void *) datass_array); + const f_status_t status = f_uint8s_destroy_callback(0, 1, (void *) datass_array); assert_int_equal(status, F_status_set_error(F_failure)); } } -void test__f_type_array_uint8s_adjust_callback__works(void **state) { +void test__f_type_array_uint8s_destroy_callback__works(void **state) { uint8_t data = 0; uint8_t data_array[] = { data }; @@ -34,7 +34,7 @@ void test__f_type_array_uint8s_adjust_callback__works(void **state) { will_return(__wrap_f_memory_array_adjust, false); will_return(__wrap_f_memory_array_adjust, F_none); - const f_status_t status = f_uint8s_adjust_callback(0, length, (void *) datass_array); + const f_status_t status = f_uint8s_destroy_callback(0, length, (void *) datass_array); assert_int_equal(status, F_none); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_destroy_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_destroy_callback.h new file mode 100644 index 0000000..5478875 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint8s_destroy_callback +#define _TEST__F_type_array__uint8s_destroy_callback + +/** + * Test that the function fails. + * + * @see f_uint8s_destroy_callback() + */ +extern void test__f_type_array_uint8s_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_uint8s_destroy_callback() + */ +extern void test__f_type_array_uint8s_destroy_callback__works(void **state); + +#endif // _TEST__F_type_array__uint8s_destroy_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_resize_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_resize_callback.h deleted file mode 100644 index e53c13e..0000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_resize_callback.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint8s_resize_callback -#define _TEST__F_type_array__uint8s_resize_callback - -/** - * Test that the function fails. - * - * @see f_uint8s_resize_callback() - */ -extern void test__f_type_array_uint8s_resize_callback__fails(void **state); - -/** - * Test that the function works. - * - * @see f_uint8s_resize_callback() - */ -extern void test__f_type_array_uint8s_resize_callback__works(void **state); - -#endif // _TEST__F_type_array__uint8s_resize_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array.c b/level_0/f_type_array/tests/unit/c/test-type_array.c index 2d357ff..7d973c9 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array.c @@ -17,159 +17,159 @@ int setdown(void **state) { int main(void) { const struct CMUnitTest tests[] = { - cmocka_unit_test(test__f_type_array_cells_adjust_callback__fails), - cmocka_unit_test(test__f_type_array_cells_resize_callback__fails), + cmocka_unit_test(test__f_type_array_cells_destroy_callback__fails), + cmocka_unit_test(test__f_type_array_cells_delete_callback__fails), - cmocka_unit_test(test__f_type_array_files_adjust_callback__fails), - cmocka_unit_test(test__f_type_array_files_resize_callback__fails), + cmocka_unit_test(test__f_type_array_files_destroy_callback__fails), + cmocka_unit_test(test__f_type_array_files_delete_callback__fails), - cmocka_unit_test(test__f_type_array_fll_ids_adjust_callback__fails), - cmocka_unit_test(test__f_type_array_fll_ids_resize_callback__fails), + cmocka_unit_test(test__f_type_array_fll_ids_destroy_callback__fails), + cmocka_unit_test(test__f_type_array_fll_ids_delete_callback__fails), - cmocka_unit_test(test__f_type_array_int8s_adjust_callback__fails), - cmocka_unit_test(test__f_type_array_int8s_resize_callback__fails), + cmocka_unit_test(test__f_type_array_int8s_destroy_callback__fails), + cmocka_unit_test(test__f_type_array_int8s_delete_callback__fails), - cmocka_unit_test(test__f_type_array_int16s_adjust_callback__fails), - cmocka_unit_test(test__f_type_array_int16s_resize_callback__fails), + cmocka_unit_test(test__f_type_array_int16s_destroy_callback__fails), + cmocka_unit_test(test__f_type_array_int16s_delete_callback__fails), - cmocka_unit_test(test__f_type_array_int32s_adjust_callback__fails), - cmocka_unit_test(test__f_type_array_int32s_resize_callback__fails), + cmocka_unit_test(test__f_type_array_int32s_destroy_callback__fails), + cmocka_unit_test(test__f_type_array_int32s_delete_callback__fails), - cmocka_unit_test(test__f_type_array_int64s_adjust_callback__fails), - cmocka_unit_test(test__f_type_array_int64s_resize_callback__fails), + cmocka_unit_test(test__f_type_array_int64s_destroy_callback__fails), + cmocka_unit_test(test__f_type_array_int64s_delete_callback__fails), - cmocka_unit_test(test__f_type_array_int128s_adjust_callback__fails), - cmocka_unit_test(test__f_type_array_int128s_resize_callback__fails), + cmocka_unit_test(test__f_type_array_int128s_destroy_callback__fails), + cmocka_unit_test(test__f_type_array_int128s_delete_callback__fails), - cmocka_unit_test(test__f_type_array_number_unsigneds_adjust_callback__fails), - cmocka_unit_test(test__f_type_array_number_unsigneds_resize_callback__fails), + cmocka_unit_test(test__f_type_array_number_unsigneds_destroy_callback__fails), + cmocka_unit_test(test__f_type_array_number_unsigneds_delete_callback__fails), - cmocka_unit_test(test__f_type_array_polls_adjust_callback__fails), - cmocka_unit_test(test__f_type_array_polls_resize_callback__fails), + cmocka_unit_test(test__f_type_array_polls_destroy_callback__fails), + cmocka_unit_test(test__f_type_array_polls_delete_callback__fails), - cmocka_unit_test(test__f_type_array_states_adjust_callback__fails), - cmocka_unit_test(test__f_type_array_states_resize_callback__fails), + cmocka_unit_test(test__f_type_array_states_destroy_callback__fails), + cmocka_unit_test(test__f_type_array_states_delete_callback__fails), - cmocka_unit_test(test__f_type_array_statuss_adjust_callback__fails), - cmocka_unit_test(test__f_type_array_statuss_resize_callback__fails), + cmocka_unit_test(test__f_type_array_statuss_destroy_callback__fails), + cmocka_unit_test(test__f_type_array_statuss_delete_callback__fails), - cmocka_unit_test(test__f_type_array_uint8s_adjust_callback__fails), - cmocka_unit_test(test__f_type_array_uint8s_resize_callback__fails), + cmocka_unit_test(test__f_type_array_uint8s_destroy_callback__fails), + cmocka_unit_test(test__f_type_array_uint8s_delete_callback__fails), - cmocka_unit_test(test__f_type_array_uint16s_adjust_callback__fails), - cmocka_unit_test(test__f_type_array_uint16s_resize_callback__fails), + cmocka_unit_test(test__f_type_array_uint16s_destroy_callback__fails), + cmocka_unit_test(test__f_type_array_uint16s_delete_callback__fails), - cmocka_unit_test(test__f_type_array_uint32s_adjust_callback__fails), - cmocka_unit_test(test__f_type_array_uint32s_resize_callback__fails), + cmocka_unit_test(test__f_type_array_uint32s_destroy_callback__fails), + cmocka_unit_test(test__f_type_array_uint32s_delete_callback__fails), - cmocka_unit_test(test__f_type_array_uint64s_adjust_callback__fails), - cmocka_unit_test(test__f_type_array_uint64s_resize_callback__fails), + cmocka_unit_test(test__f_type_array_uint64s_destroy_callback__fails), + cmocka_unit_test(test__f_type_array_uint64s_delete_callback__fails), - cmocka_unit_test(test__f_type_array_uint128s_adjust_callback__fails), - cmocka_unit_test(test__f_type_array_uint128s_resize_callback__fails), + cmocka_unit_test(test__f_type_array_uint128s_destroy_callback__fails), + cmocka_unit_test(test__f_type_array_uint128s_delete_callback__fails), - cmocka_unit_test(test__f_type_array_cells_adjust_callback__works), - cmocka_unit_test(test__f_type_array_cells_resize_callback__works), + cmocka_unit_test(test__f_type_array_cells_destroy_callback__works), + cmocka_unit_test(test__f_type_array_cells_delete_callback__works), - cmocka_unit_test(test__f_type_array_files_adjust_callback__works), - cmocka_unit_test(test__f_type_array_files_resize_callback__works), + cmocka_unit_test(test__f_type_array_files_destroy_callback__works), + cmocka_unit_test(test__f_type_array_files_delete_callback__works), - cmocka_unit_test(test__f_type_array_fll_ids_adjust_callback__works), - cmocka_unit_test(test__f_type_array_fll_ids_resize_callback__works), + cmocka_unit_test(test__f_type_array_fll_ids_destroy_callback__works), + cmocka_unit_test(test__f_type_array_fll_ids_delete_callback__works), - cmocka_unit_test(test__f_type_array_int8s_adjust_callback__works), - cmocka_unit_test(test__f_type_array_int8s_resize_callback__works), + cmocka_unit_test(test__f_type_array_int8s_destroy_callback__works), + cmocka_unit_test(test__f_type_array_int8s_delete_callback__works), - cmocka_unit_test(test__f_type_array_int16s_adjust_callback__works), - cmocka_unit_test(test__f_type_array_int16s_resize_callback__works), + cmocka_unit_test(test__f_type_array_int16s_destroy_callback__works), + cmocka_unit_test(test__f_type_array_int16s_delete_callback__works), - cmocka_unit_test(test__f_type_array_int32s_adjust_callback__works), - cmocka_unit_test(test__f_type_array_int32s_resize_callback__works), + cmocka_unit_test(test__f_type_array_int32s_destroy_callback__works), + cmocka_unit_test(test__f_type_array_int32s_delete_callback__works), - cmocka_unit_test(test__f_type_array_int64s_adjust_callback__works), - cmocka_unit_test(test__f_type_array_int64s_resize_callback__works), + cmocka_unit_test(test__f_type_array_int64s_destroy_callback__works), + cmocka_unit_test(test__f_type_array_int64s_delete_callback__works), - cmocka_unit_test(test__f_type_array_int128s_adjust_callback__works), - cmocka_unit_test(test__f_type_array_int128s_resize_callback__works), + cmocka_unit_test(test__f_type_array_int128s_destroy_callback__works), + cmocka_unit_test(test__f_type_array_int128s_delete_callback__works), - cmocka_unit_test(test__f_type_array_number_unsigneds_adjust_callback__works), - cmocka_unit_test(test__f_type_array_number_unsigneds_resize_callback__works), + cmocka_unit_test(test__f_type_array_number_unsigneds_destroy_callback__works), + cmocka_unit_test(test__f_type_array_number_unsigneds_delete_callback__works), - cmocka_unit_test(test__f_type_array_polls_adjust_callback__works), - cmocka_unit_test(test__f_type_array_polls_resize_callback__works), + cmocka_unit_test(test__f_type_array_polls_destroy_callback__works), + cmocka_unit_test(test__f_type_array_polls_delete_callback__works), - cmocka_unit_test(test__f_type_array_states_adjust_callback__works), - cmocka_unit_test(test__f_type_array_states_resize_callback__works), + cmocka_unit_test(test__f_type_array_states_destroy_callback__works), + cmocka_unit_test(test__f_type_array_states_delete_callback__works), - cmocka_unit_test(test__f_type_array_statuss_adjust_callback__works), - cmocka_unit_test(test__f_type_array_statuss_resize_callback__works), + cmocka_unit_test(test__f_type_array_statuss_destroy_callback__works), + cmocka_unit_test(test__f_type_array_statuss_delete_callback__works), - cmocka_unit_test(test__f_type_array_uint8s_adjust_callback__works), - cmocka_unit_test(test__f_type_array_uint8s_resize_callback__works), + cmocka_unit_test(test__f_type_array_uint8s_destroy_callback__works), + cmocka_unit_test(test__f_type_array_uint8s_delete_callback__works), - cmocka_unit_test(test__f_type_array_uint16s_adjust_callback__works), - cmocka_unit_test(test__f_type_array_uint16s_resize_callback__works), + cmocka_unit_test(test__f_type_array_uint16s_destroy_callback__works), + cmocka_unit_test(test__f_type_array_uint16s_delete_callback__works), - cmocka_unit_test(test__f_type_array_uint32s_adjust_callback__works), - cmocka_unit_test(test__f_type_array_uint32s_resize_callback__works), + cmocka_unit_test(test__f_type_array_uint32s_destroy_callback__works), + cmocka_unit_test(test__f_type_array_uint32s_delete_callback__works), - cmocka_unit_test(test__f_type_array_uint64s_adjust_callback__works), - cmocka_unit_test(test__f_type_array_uint64s_resize_callback__works), + cmocka_unit_test(test__f_type_array_uint64s_destroy_callback__works), + cmocka_unit_test(test__f_type_array_uint64s_delete_callback__works), - cmocka_unit_test(test__f_type_array_uint128s_adjust_callback__works), - cmocka_unit_test(test__f_type_array_uint128s_resize_callback__works), + cmocka_unit_test(test__f_type_array_uint128s_destroy_callback__works), + cmocka_unit_test(test__f_type_array_uint128s_delete_callback__works), #ifndef _di_level_0_parameter_checking_ - // f_cells_adjust_callback() doesn't use parameter checking. - // f_cells_resize_callback() doesn't use parameter checking. + // f_cells_destroy_callback() doesn't use parameter checking. + // f_cells_delete_callback() doesn't use parameter checking. - // f_files_adjust_callback() doesn't use parameter checking. - // f_files_resize_callback() doesn't use parameter checking. + // f_files_destroy_callback() doesn't use parameter checking. + // f_files_delete_callback() doesn't use parameter checking. - // f_fll_ids_adjust_callback() doesn't use parameter checking. - // f_fll_ids_resize_callback() doesn't use parameter checking. + // f_fll_ids_destroy_callback() doesn't use parameter checking. + // f_fll_ids_delete_callback() doesn't use parameter checking. - // f_int8s_adjust_callback() doesn't use parameter checking. - // f_int8s_resize_callback() doesn't use parameter checking. + // f_int8s_destroy_callback() doesn't use parameter checking. + // f_int8s_delete_callback() doesn't use parameter checking. - // f_int16s_adjust_callback() doesn't use parameter checking. - // f_int16s_resize_callback() doesn't use parameter checking. + // f_int16s_destroy_callback() doesn't use parameter checking. + // f_int16s_delete_callback() doesn't use parameter checking. - // f_int32s_adjust_callback() doesn't use parameter checking. - // f_int32s_resize_callback() doesn't use parameter checking. + // f_int32s_destroy_callback() doesn't use parameter checking. + // f_int32s_delete_callback() doesn't use parameter checking. - // f_int64s_adjust_callback() doesn't use parameter checking. - // f_int64s_resize_callback() doesn't use parameter checking. + // f_int64s_destroy_callback() doesn't use parameter checking. + // f_int64s_delete_callback() doesn't use parameter checking. - // f_int128s_adjust_callback() doesn't use parameter checking. - // f_int128s_resize_callback() doesn't use parameter checking. + // f_int128s_destroy_callback() doesn't use parameter checking. + // f_int128s_delete_callback() doesn't use parameter checking. - // f_number_unsigneds_adjust_callback() doesn't use parameter checking. - // f_number_unsigneds_resize_callback() doesn't use parameter checking. + // f_number_unsigneds_destroy_callback() doesn't use parameter checking. + // f_number_unsigneds_delete_callback() doesn't use parameter checking. - // f_polls_adjust_callback() doesn't use parameter checking. - // f_polls_resize_callback() doesn't use parameter checking. + // f_polls_destroy_callback() doesn't use parameter checking. + // f_polls_delete_callback() doesn't use parameter checking. - // f_states_adjust_callback() doesn't use parameter checking. - // f_states_resize_callback() doesn't use parameter checking. + // f_states_destroy_callback() doesn't use parameter checking. + // f_states_delete_callback() doesn't use parameter checking. - // f_statuss_adjust_callback() doesn't use parameter checking. - // f_statuss_resize_callback() doesn't use parameter checking. + // f_statuss_destroy_callback() doesn't use parameter checking. + // f_statuss_delete_callback() doesn't use parameter checking. - // f_uint8s_adjust_callback() doesn't use parameter checking. - // f_uint8s_resize_callback() doesn't use parameter checking. + // f_uint8s_destroy_callback() doesn't use parameter checking. + // f_uint8s_delete_callback() doesn't use parameter checking. - // f_uint16s_adjust_callback() doesn't use parameter checking. - // f_uint16s_resize_callback() doesn't use parameter checking. + // f_uint16s_destroy_callback() doesn't use parameter checking. + // f_uint16s_delete_callback() doesn't use parameter checking. - // f_uint32s_adjust_callback() doesn't use parameter checking. - // f_uint32s_resize_callback() doesn't use parameter checking. + // f_uint32s_destroy_callback() doesn't use parameter checking. + // f_uint32s_delete_callback() doesn't use parameter checking. - // f_uint64s_adjust_callback() doesn't use parameter checking. - // f_uint64s_resize_callback() doesn't use parameter checking. + // f_uint64s_destroy_callback() doesn't use parameter checking. + // f_uint64s_delete_callback() doesn't use parameter checking. - // f_uint128s_adjust_callback() doesn't use parameter checking. - // f_uint128s_resize_callback() doesn't use parameter checking. + // f_uint128s_destroy_callback() doesn't use parameter checking. + // f_uint128s_delete_callback() doesn't use parameter checking. #endif // _di_level_0_parameter_checking_ }; diff --git a/level_0/f_type_array/tests/unit/c/test-type_array.h b/level_0/f_type_array/tests/unit/c/test-type_array.h index c39bec7..9acc4dd 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array.h @@ -27,40 +27,40 @@ #include // Test includes. -#include "test-type_array-cells_adjust_callback.h" -#include "test-type_array-cells_resize_callback.h" -#include "test-type_array-files_adjust_callback.h" -#include "test-type_array-files_resize_callback.h" -#include "test-type_array-fll_ids_adjust_callback.h" -#include "test-type_array-fll_ids_resize_callback.h" -#include "test-type_array-int8s_adjust_callback.h" -#include "test-type_array-int8s_resize_callback.h" -#include "test-type_array-int16s_adjust_callback.h" -#include "test-type_array-int16s_resize_callback.h" -#include "test-type_array-int32s_adjust_callback.h" -#include "test-type_array-int32s_resize_callback.h" -#include "test-type_array-int64s_adjust_callback.h" -#include "test-type_array-int64s_resize_callback.h" -#include "test-type_array-int128s_adjust_callback.h" -#include "test-type_array-int128s_resize_callback.h" -#include "test-type_array-number_unsigneds_adjust_callback.h" -#include "test-type_array-number_unsigneds_resize_callback.h" -#include "test-type_array-polls_adjust_callback.h" -#include "test-type_array-polls_resize_callback.h" -#include "test-type_array-states_adjust_callback.h" -#include "test-type_array-states_resize_callback.h" -#include "test-type_array-statuss_adjust_callback.h" -#include "test-type_array-statuss_resize_callback.h" -#include "test-type_array-uint8s_adjust_callback.h" -#include "test-type_array-uint8s_resize_callback.h" -#include "test-type_array-uint16s_adjust_callback.h" -#include "test-type_array-uint16s_resize_callback.h" -#include "test-type_array-uint32s_adjust_callback.h" -#include "test-type_array-uint32s_resize_callback.h" -#include "test-type_array-uint64s_adjust_callback.h" -#include "test-type_array-uint64s_resize_callback.h" -#include "test-type_array-uint128s_adjust_callback.h" -#include "test-type_array-uint128s_resize_callback.h" +#include "test-type_array-cells_destroy_callback.h" +#include "test-type_array-cells_delete_callback.h" +#include "test-type_array-files_destroy_callback.h" +#include "test-type_array-files_delete_callback.h" +#include "test-type_array-fll_ids_destroy_callback.h" +#include "test-type_array-fll_ids_delete_callback.h" +#include "test-type_array-int8s_destroy_callback.h" +#include "test-type_array-int8s_delete_callback.h" +#include "test-type_array-int16s_destroy_callback.h" +#include "test-type_array-int16s_delete_callback.h" +#include "test-type_array-int32s_destroy_callback.h" +#include "test-type_array-int32s_delete_callback.h" +#include "test-type_array-int64s_destroy_callback.h" +#include "test-type_array-int64s_delete_callback.h" +#include "test-type_array-int128s_destroy_callback.h" +#include "test-type_array-int128s_delete_callback.h" +#include "test-type_array-number_unsigneds_destroy_callback.h" +#include "test-type_array-number_unsigneds_delete_callback.h" +#include "test-type_array-polls_destroy_callback.h" +#include "test-type_array-polls_delete_callback.h" +#include "test-type_array-states_destroy_callback.h" +#include "test-type_array-states_delete_callback.h" +#include "test-type_array-statuss_destroy_callback.h" +#include "test-type_array-statuss_delete_callback.h" +#include "test-type_array-uint8s_destroy_callback.h" +#include "test-type_array-uint8s_delete_callback.h" +#include "test-type_array-uint16s_destroy_callback.h" +#include "test-type_array-uint16s_delete_callback.h" +#include "test-type_array-uint32s_destroy_callback.h" +#include "test-type_array-uint32s_delete_callback.h" +#include "test-type_array-uint64s_destroy_callback.h" +#include "test-type_array-uint64s_delete_callback.h" +#include "test-type_array-uint128s_destroy_callback.h" +#include "test-type_array-uint128s_delete_callback.h" #ifdef __cplusplus extern "C" { diff --git a/level_1/fl_fss/c/fss/embedded_list.c b/level_1/fl_fss/c/fss/embedded_list.c index 114cf9c..228e2f5 100644 --- a/level_1/fl_fss/c/fss/embedded_list.c +++ b/level_1/fl_fss/c/fss/embedded_list.c @@ -22,7 +22,7 @@ extern "C" { if (state->status == F_data_not) return; if (state->status == F_none_eos || state->status == F_none_stop) return; - state->status = f_fss_nest_increase(state->step_small, found); + state->status = f_memory_array_increase(state->step_small, sizeof(f_fss_nest_t), (void **) &found->depth, &found->used, &found->size); if (F_status_is_error(state->status)) return; f_number_unsigneds_t positions_start = f_number_unsigneds_t_initialize; @@ -588,11 +588,11 @@ extern "C" { } if (buffer.string[range->start] == f_fss_eol_s.string[0]) { - state->status = f_fss_nest_increase(state->step_small, found); + state->status = f_memory_array_increase(state->step_small, sizeof(f_fss_nest_t), (void **) &found->depth, &found->used, &found->size); if (F_status_is_error(state->status)) break; if (found->depth[depth].used == found->depth[depth].size) { - state->status = f_fss_items_increase(state->step_small, &found->depth[depth]); + state->status = f_memory_array_increase(state->step_small, sizeof(f_fss_item_t), (void **) &found->depth[depth].array, &found->depth[depth].used, &found->depth[depth].size); if (F_status_is_error(state->status)) break; } diff --git a/level_1/fl_fss/c/fss/embedded_list.h b/level_1/fl_fss/c/fss/embedded_list.h index 4303258..09d711f 100644 --- a/level_1/fl_fss/c/fss/embedded_list.h +++ b/level_1/fl_fss/c/fss/embedded_list.h @@ -81,7 +81,6 @@ extern "C" { * Errors (with error bit) from: f_memory_array_increase(). * Errors (with error bit) from: f_memory_array_increase_by(). * Errors (with error bit) from: f_fss_is_space(). - * Errors (with error bit) from: f_fss_nest_increase(). * Errors (with error bit) from: f_fss_seek_to_eol(). * Errors (with error bit) from: f_fss_skip_past_delimit(). * Errors (with error bit) from: f_string_ranges_increase(). @@ -90,7 +89,6 @@ extern "C" { * @see f_memory_array_increase() * @see f_memory_array_increase_by() * @see f_fss_is_space() - * @see f_fss_nest_increase() * @see f_fss_seek_to_eol() * @see f_fss_skip_past_delimit() * @see f_string_ranges_increase() diff --git a/level_2/fll_fss/c/fss/embedded_list.c b/level_2/fll_fss/c/fss/embedded_list.c index b956751..109df41 100644 --- a/level_2/fll_fss/c/fss/embedded_list.c +++ b/level_2/fll_fss/c/fss/embedded_list.c @@ -21,7 +21,7 @@ extern "C" { bool found_data = F_false; if (!nest->used) { - state->status = f_fss_nest_resize(state->step_small, nest); + state->status = f_memory_array_increase(state->step_small, sizeof(f_fss_nest_t), (void **) &nest->depth, &nest->used, &nest->size); if (F_status_is_error(state->status)) return; } else { @@ -30,7 +30,7 @@ extern "C" { do { do { - state->status = f_fss_items_resize(state->step_small, &nest->depth[0]); + state->status = f_memory_array_increase(state->step_small, sizeof(f_fss_item_t), (void **) &nest->depth[0].array, &nest->depth[0].used, &nest->depth[0].size); if (F_status_is_error(state->status)) return; nest->depth[nest->used].used = 0; diff --git a/level_3/fake/c/main/common/print.c b/level_3/fake/c/main/common/print.c index 1556a05..8c0c913 100644 --- a/level_3/fake/c/main/common/print.c +++ b/level_3/fake/c/main/common/print.c @@ -47,9 +47,9 @@ extern "C" { "f_file_touch", "f_file_write", "f_fss_apply_delimit", - "f_fss_nameds_resize", "f_memory_array_increase", "f_memory_array_increase_by", + "f_memory_array_resize", "f_path_change", "f_path_current", "f_path_directory_cleanup", diff --git a/level_3/fake/c/main/common/print.h b/level_3/fake/c/main/common/print.h index 5b7565b..2002323 100644 --- a/level_3/fake/c/main/common/print.h +++ b/level_3/fake/c/main/common/print.h @@ -80,9 +80,9 @@ extern "C" { fake_f_f_file_touch_e, fake_f_f_file_write_e, fake_f_f_fss_apply_delimit_e, - fake_f_f_fss_nameds_resize_e, fake_f_f_memory_array_increase_e, fake_f_f_memory_array_increase_by_e, + fake_f_f_memory_array_resize_e, fake_f_f_path_change_e, fake_f_f_path_current_e, fake_f_f_path_directory_cleanup_e, diff --git a/level_3/fake/c/main/common/type.c b/level_3/fake/c/main/common/type.c index c7114c9..bfad29f 100644 --- a/level_3/fake/c/main/common/type.c +++ b/level_3/fake/c/main/common/type.c @@ -256,7 +256,7 @@ extern "C" { f_string_dynamics_resize(0, &data_make->path.stack); - f_fss_nameds_resize(0, &data_make->fakefile); + f_memory_arrays_resize(0, sizeof(f_fss_named_t), (void **) &data_make->fakefile.array, &data_make->fakefile.used, &data_make->fakefile.size, &f_fss_nameds_delete_callback); } #endif // _di_fake_make_data_delete_ diff --git a/level_3/fake/c/main/make/load_fakefile.c b/level_3/fake/c/main/make/load_fakefile.c index b6f36e1..3d86559 100644 --- a/level_3/fake/c/main/make/load_fakefile.c +++ b/level_3/fake/c/main/make/load_fakefile.c @@ -76,14 +76,14 @@ extern "C" { f_fss_set_t settings = f_fss_set_t_initialize; - if (list_objects.used > data_make->fakefile.size) { - data_make->main->setting.state.status = f_fss_nameds_resize(list_objects.used, &data_make->fakefile); - } + data_make->fakefile.used = 0; + + data_make->main->setting.state.status = f_memory_array_increase_by(list_objects.used, sizeof(f_fss_named_t), (void **) &data_make->fakefile.array, &data_make->fakefile.used, &data_make->fakefile.size); if (F_status_is_error(data_make->main->setting.state.status)) { - fake_print_error(&data_make->main->program.error, macro_fake_f(f_fss_nameds_resize)); + fake_print_error(&data_make->main->program.error, macro_fake_f(f_memory_array_resize)); - f_fss_set_resize(0, &settings); + f_fss_set_delete(&settings); f_string_ranges_resize(0, &list_objects); f_string_rangess_resize(0, &list_contents); f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &delimits.array, &delimits.used, &delimits.size); @@ -175,7 +175,7 @@ extern "C" { f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &delimits.array, &delimits.used, &delimits.size); if (F_status_is_error(data_make->main->setting.state.status)) { - f_fss_set_resize(0, &settings); + f_fss_set_delete(&settings); return; } @@ -206,7 +206,7 @@ extern "C" { if (F_status_is_error(data_make->main->setting.state.status)) { fake_print_error(&data_make->main->program.error, function_name); - f_fss_set_resize(0, &settings); + f_fss_set_delete(&settings); return; } @@ -245,7 +245,7 @@ extern "C" { } // for if (F_status_is_error(data_make->main->setting.state.status)) { - f_fss_set_resize(0, &settings); + f_fss_set_delete(&settings); return; } @@ -260,7 +260,7 @@ extern "C" { } if (F_status_is_error(data_make->main->setting.state.status)) { - f_fss_set_resize(0, &settings); + f_fss_set_delete(&settings); return; } @@ -283,14 +283,14 @@ extern "C" { fake_print_error(&data_make->main->program.error, macro_fake_f(f_string_dynamic_partial_append)); } - f_fss_set_resize(0, &settings); + f_fss_set_delete(&settings); return; } fake_make_load_fakefile_setting_define_and_parameter(data_make, &settings); - f_fss_set_resize(0, &settings); + f_fss_set_delete(&settings); } data_make->main->setting.state.status = F_none; @@ -345,7 +345,7 @@ extern "C" { void fake_make_load_fakefile_setting_define_and_parameter(fake_make_data_t * const data_make, f_fss_set_t * const settings) { if (!data_make || !data_make->data || !data_make->data || !data_make->main || !settings) return; -; + f_string_map_multis_t define = f_string_map_multis_t_initialize; // Load the fakefile "settings" as if they are build "settings". diff --git a/level_3/fss_read/c/main/common.c b/level_3/fss_read/c/main/common.c index 3bc5669..560b2fb 100644 --- a/level_3/fss_read/c/main/common.c +++ b/level_3/fss_read/c/main/common.c @@ -20,7 +20,7 @@ extern "C" { } if (main->setting.quotes_content.used < main->setting.contents.used) { - f_memory_arrays_resize(main->setting.contents.used, sizeof(f_uint8s_t), (void **) &main->setting.quotes_content.array, &main->setting.quotes_content.used, &main->setting.quotes_content.size, &f_uint8s_resize_callback); + f_memory_arrays_resize(main->setting.contents.used, sizeof(f_uint8s_t), (void **) &main->setting.quotes_content.array, &main->setting.quotes_content.used, &main->setting.quotes_content.size, &f_uint8ss_delete_callback); if (F_status_is_error(main->setting.state.status)) return; for (i = main->setting.quotes_content.used; i < main->setting.contents.used; ++i) { diff --git a/level_3/fss_read/c/main/common/type.c b/level_3/fss_read/c/main/common/type.c index fbe4cea..df851a1 100644 --- a/level_3/fss_read/c/main/common/type.c +++ b/level_3/fss_read/c/main/common/type.c @@ -81,13 +81,13 @@ extern "C" { f_string_ranges_resize(0, &setting->comments); f_string_rangess_resize(0, &setting->contents); - f_fss_nest_resize(0, &setting->nest); + f_fss_nest_delete(&setting->nest); f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &setting->delimits_object.array, &setting->delimits_object.used, &setting->delimits_object.size); f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &setting->delimits_content.array, &setting->delimits_content.used, &setting->delimits_content.size); f_memory_array_resize(0, sizeof(uint8_t), (void **) &setting->quotes_object.array, &setting->quotes_object.used, &setting->quotes_object.size); - f_memory_arrays_resize(0, sizeof(f_uint8s_t), (void **) &setting->quotes_content.array, &setting->quotes_content.used, &setting->quotes_content.size, &f_uint8s_resize_callback); + f_memory_arrays_resize(0, sizeof(f_uint8s_t), (void **) &setting->quotes_content.array, &setting->quotes_content.used, &setting->quotes_content.size, &f_uint8ss_delete_callback); return F_none; }