I would note that I am leaving the append() and append_all() for the IKI structures because they are complex.
In the long term I may end up adding back the append() and append_all() functions for each type.
At this time it is more advantageous for me to not have that consistency for easier maintainability while the project is evolving and refactoring.
I still need to look over the string and UTF string memory related functionality.
This will be more delicate and given the size of these two projects will be a bit time consuming.
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 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 limit.c limit/set.c limit/value.c
build_sources_library memory.c memory/array.c memory/arrays.c
build_sources_library private-memory.c memory/private-array.c
build_sources_library network.c
build_sources_library rip.c rip/utf.c private-rip.c rip/private-utf.c
build_sources_library serialize.c private-serialize.c serialize/common.c
build_sources_library signal.c
-build_sources_library socket.c socket/socket.c socket/private-socket.c
+build_sources_library socket.c socket/address.c socket/socket.c
build_sources_library status_string.c
build_sources_library string.c
build_sources_library private-string.c string/common.c
build_sources_headers rip.h rip/utf.h
build_sources_headers serialize.h serialize/common.h
build_sources_headers signal.h signal/common.h
-build_sources_headers socket.h socket/socket.h socket/common.h
+build_sources_headers socket.h socket/address.h socket/socket.h socket/common.h
build_sources_headers status.h
build_sources_headers status_string.h
build_sources_headers string.h string/common.h
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/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/limit.c level_0/limit/set.c level_0/limit/value.c
build_sources_library level_0/memory.c level_0/memory/array.c level_0/memory/arrays.c
build_sources_library level_0/private-memory.c level_0/memory/private-array.c
build_sources_library level_0/network.c
build_sources_library level_0/rip.c level_0/rip/utf.c level_0/private-rip.c level_0/rip/private-utf.c
build_sources_library level_0/serialize.c level_0/private-serialize.c level_0/serialize/common.c
build_sources_library level_0/signal.c
-build_sources_library level_0/socket.c level_0/socket/socket.c level_0/socket/private-socket.c
+build_sources_library level_0/socket.c level_0/socket/address.c level_0/socket/socket.c
build_sources_library level_0/status_string.c
build_sources_library level_0/string.c
build_sources_library level_0/private-string.c level_0/string/common.c
build_sources_headers level_0/rip.h level_0/rip/utf.h
build_sources_headers level_0/serialize.h level_0/serialize/common.h
build_sources_headers level_0/signal.h level_0/signal/common.h
-build_sources_headers level_0/socket.h level_0/socket/socket.h level_0/socket/common.h
+build_sources_headers level_0/socket.h level_0/socket/address.h level_0/socket/socket.h level_0/socket/common.h
build_sources_headers level_0/status.h
build_sources_headers level_0/status_string.h
build_sources_headers level_0/string.h level_0/string/common.h
#define _di_f_fss_sets_destroy_callback_
#define _di_f_fss_sets_resize_
#define _di_f_fss_setss_delete_callback_
-#define _di_f_fss_sets_sdestroy_callback_
+#define _di_f_fss_setss_destroy_callback_
#define _di_f_fss_setss_destroy_callback_
#define _di_f_fss_setss_t_
#define _di_f_fss_sets_t_
#define _di_fl_fss_extended_object_write_
//#define _di_fl_iki_read_
//#define _di_f_limit_process_
-#define _di_f_limit_sets_adjust_
-#define _di_f_limit_sets_append_
-#define _di_f_limit_sets_append_all_
-#define _di_f_limit_sets_decimate_by_
-#define _di_f_limit_sets_decrease_by_
-#define _di_f_limit_sets_increase_
-#define _di_f_limit_sets_increase_by_
-#define _di_f_limit_sets_resize_
-#define _di_f_limit_setss_adjust_
-#define _di_f_limit_setss_append_
-#define _di_f_limit_setss_append_all_
-#define _di_f_limit_setss_decimate_by_
-#define _di_f_limit_setss_decrease_by_
-#define _di_f_limit_setss_increase_
-#define _di_f_limit_setss_increase_by_
-#define _di_f_limit_setss_resize_
+#define _di_f_limit_setss_delete_callback_
+#define _di_f_limit_setss_destroy_callback_
+#define _di_f_limit_setss_destroy_callback_
#define _di_f_limit_setss_t_
//#define _di_f_limit_sets_t_
//#define _di_f_limit_set_t_
-#define _di_f_limit_values_adjust_
-#define _di_f_limit_values_append_
-#define _di_f_limit_values_append_all_
-#define _di_f_limit_values_decimate_by_
-#define _di_f_limit_values_decrease_by_
-#define _di_f_limit_values_increase_
-#define _di_f_limit_values_increase_by_
-#define _di_f_limit_values_resize_
-#define _di_f_limit_valuess_adjust_
-#define _di_f_limit_valuess_append_
-#define _di_f_limit_valuess_append_all_
-#define _di_f_limit_valuess_decimate_by_
-#define _di_f_limit_valuess_decrease_by_
-#define _di_f_limit_valuess_increase_
-#define _di_f_limit_valuess_increase_by_
-#define _di_f_limit_valuess_resize_
+#define _di_f_limit_valuess_delete_callback_
+#define _di_f_limit_valuess_destroy_callback_
+#define _di_f_limit_valuess_destroy_callback_
#define _di_f_limit_valuess_t_
#define _di_f_limit_values_t_
//#define _di_f_limit_value_t_
#define _di_f_signal_wait_until_
#define _di_f_socket_accept_
#define _di_f_socket_address_family_e_
+#define _di_f_socket_addressss_delete_callback_
+#define _di_f_socket_addressss_destroy_callback_
+#define _di_f_socket_addressss_destroy_callback_
+#define _di_f_socket_addressss_t_
+#define _di_f_socket_addresss_t_
#define _di_f_socket_address_t_
#define _di_f_socket_bind_
#define _di_f_socket_bind_inet4_
#define _di_f_socket_read_
#define _di_f_socket_read_message_
#define _di_f_socket_read_stream_
-#define _di_f_sockets_adjust_
-#define _di_f_sockets_append_
-#define _di_f_sockets_append_all_
-#define _di_f_sockets_decimate_by_
-#define _di_f_sockets_decrease_by_
-#define _di_f_sockets_increase_
-#define _di_f_sockets_increase_by_
-#define _di_f_sockets_resize_
-#define _di_f_socketss_adjust_
-#define _di_f_socketss_append_
-#define _di_f_socketss_append_all_
-#define _di_f_socketss_decimate_by_
-#define _di_f_socketss_decrease_by_
-#define _di_f_socketss_increase_
-#define _di_f_socketss_increase_by_
-#define _di_f_socketss_resize_
+#define _di_f_socketss_delete_callback_
+#define _di_f_socketss_destroy_callback_
+#define _di_f_socketss_destroy_callback_
#define _di_f_socketss_t_
#define _di_f_sockets_t_
#define _di_f_socket_t_
#define _di_f_states_t_
//#define _di_f_state_t_
//#define _di_f_status_e_
+//#define _di_f_status_mask_d_
#define _di_f_statusss_delete_callback_
#define _di_f_statusss_destroy_callback_
#define _di_f_statusss_t_
#define _di_f_statuss_t_
//#define _di_f_status_t_
-//#define _di_f_status_terminal_e_
//#define _di_f_string_append_
#define _di_f_string_append_assure_
#define _di_f_string_append_assure_nulless_
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/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/limit.c fll/level_0/limit/set.c fll/level_0/limit/value.c
build_sources_program fll/level_0/memory.c fll/level_0/memory/array.c fll/level_0/memory/arrays.c
build_sources_program fll/level_0/private-memory.c fll/level_0/memory/private-array.c
build_sources_program fll/level_0/parse.c fll/level_0/parse/utf.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
build_sources_program fll/level_0/fss.c fll/level_0/private-fss.c fll/level_0/fss/common.c fll/level_0/fss/named.c fll/level_0/fss/nest.c fll/level_0/fss/set.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/limit.c fll/level_0/limit/set.c fll/level_0/limit/value.c
build_sources_program fll/level_0/memory.c fll/level_0/private-memory.c fll/level_0/memory/structure.c
build_sources_program fll/level_0/path.c fll/level_0/private-path.c fll/level_0/path/common.c
build_sources_program fll/level_0/pipe.c
for (f_number_unsigned_t i = start; i < stop; ++i) {
- array[i].id_user = 0;
- array[i].id_group = 0;
-
status = f_string_dynamic_adjust(0, &array[i].home);
if (F_status_is_error(status)) return status;
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;
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;
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;
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;
for (f_number_unsigned_t i = start; i < stop; ++i) {
- array[i].status = F_okay;
-
status = f_string_dynamic_adjust(0, &array[i].path);
if (F_status_is_error(status)) return status;
} // for
for (j = 0; j < array[i].size; ++j) {
- array[i].array[j].status = F_okay;
-
status = f_string_dynamic_adjust(0, &array[i].array[j].path);
if (F_status_is_error(status)) return status;
} // for
if (!item) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- item->object.start = 1;
- item->object.stop = 0;
- item->parent = 0;
-
return f_string_ranges_adjust(0, &item->content);
}
#endif // _di_f_fss_item_destroy_
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
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
#endif // _di_f_fss_item_destroy_
/**
- * A callback intended to be passed to f_memory_arrays_resize() for an f_items_t structure.
+ * A callback intended to be passed to f_memory_arrays_resize() for an f_fss_items_t structure.
*
* This is only called when shrinking the array and generally should perform deallocations.
*
#endif // _di_f_fss_items_delete_callback_
/**
- * A callback intended to be passed to f_memory_arrays_adjust() for an f_items_t structure.
+ * A callback intended to be passed to f_memory_arrays_adjust() for an f_fss_items_t structure.
*
* This is only called when shrinking the array and generally should perform deallocations.
*
#endif // _di_f_fss_items_destroy_callback_
/**
- * A callback intended to be passed to f_memory_arrays_resize() for an f_itemss_t structure.
+ * A callback intended to be passed to f_memory_arrays_resize() for an f_fss_itemss_t structure.
*
* This is only called when shrinking the array and generally should perform deallocations.
*
#endif // _di_f_fss_itemss_delete_callback_
/**
- * A callback intended to be passed to f_memory_arrays_adjust() for an f_itemss_t structure.
+ * A callback intended to be passed to f_memory_arrays_adjust() for an f_fss_itemss_t structure.
*
* This is only called when shrinking the array and generally should perform deallocations.
*
if (!named) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- 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;
for (f_number_unsigned_t i = start; i < stop; ++i) {
- array[i].name.start = 1;
- array[i].name.stop = 0;
-
status = f_string_ranges_adjust(0, &array[i].objects);
if (F_status_is_error(status)) return status;
for (j = 0; j < array[i].size; ++j) {
- array[i].array[j].name.start = 1;
- array[i].array[j].name.stop = 0;
-
status = f_string_ranges_adjust(0, &array[i].array[j].objects);
if (F_status_is_error(status)) return status;
#endif // _di_f_fss_named_destroy_
/**
- * A callback intended to be passed to f_memory_arrays_resize() for an f_nameds_t structure.
+ * A callback intended to be passed to f_memory_arrays_resize() for an f_fss_nameds_t structure.
*
* This is only called when shrinking the array and generally should perform deallocations.
*
#endif // _di_f_fss_nameds_delete_callback_
/**
- * A callback intended to be passed to f_memory_arrays_adjust() for an f_nameds_t structure.
+ * A callback intended to be passed to f_memory_arrays_adjust() for an f_fss_nameds_t structure.
*
* This is only called when shrinking the array and generally should perform deallocations.
*
#endif // _di_f_fss_nameds_destroy_callback_
/**
- * A callback intended to be passed to f_memory_arrays_resize() for an f_namedss_t structure.
+ * A callback intended to be passed to f_memory_arrays_resize() for an f_fss_namedss_t structure.
*
* This is only called when shrinking the array and generally should perform deallocations.
*
#endif // _di_f_fss_namedss_delete_callback_
/**
- * A callback intended to be passed to f_memory_arrays_adjust() for an f_namedss_t structure.
+ * A callback intended to be passed to f_memory_arrays_adjust() for an f_fss_namedss_t structure.
*
* This is only called when shrinking the array and generally should perform deallocations.
*
for (j = 0; j < nest->depth[i].size; ++j) {
- nest->depth[i].array[j].object.start = 1;
- nest->depth[i].array[j].object.stop = 0;
- nest->depth[i].array[j].parent = 0;
-
status = f_string_ranges_adjust(0, &nest->depth[i].array[j].content);
if (F_status_is_error(status)) return status;
} // for
for (k = 0; k < array[i].depth[j].size; ++k) {
- 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
for (l = 0; l < array[i].array[j].depth[k].size; ++l) {
- 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
#endif // _di_f_fss_nest_destroy_
/**
- * A callback intended to be passed to f_memory_arrays_resize() for an f_nests_t structure.
+ * A callback intended to be passed to f_memory_arrays_resize() for an f_fss_nests_t structure.
*
* This is only called when shrinking the array and generally should perform deallocations.
*
#endif // _di_f_fss_nests_delete_callback_
/**
- * A callback intended to be passed to f_memory_arrays_adjust() for an f_nests_t structure.
+ * A callback intended to be passed to f_memory_arrays_adjust() for an f_fss_nests_t structure.
*
* This is only called when shrinking the array and generally should perform deallocations.
*
#endif // _di_f_fss_nests_destroy_callback_
/**
- * A callback intended to be passed to f_memory_arrays_resize() for an f_nestss_t structure.
+ * A callback intended to be passed to f_memory_arrays_resize() for an f_fss_nestss_t structure.
*
* This is only called when shrinking the array and generally should perform deallocations.
*
#endif // _di_f_fss_nestss_delete_callback_
/**
- * A callback intended to be passed to f_memory_arrays_adjust() for an f_nestss_t structure.
+ * A callback intended to be passed to f_memory_arrays_adjust() for an f_fss_nestss_t structure.
*
* This is only called when shrinking the array and generally should perform deallocations.
*
#endif // _di_f_fss_set_destroy_
/**
- * A callback intended to be passed to f_memory_arrays_resize() for an f_sets_t structure.
+ * A callback intended to be passed to f_memory_arrays_resize() for an f_fss_sets_t structure.
*
* This is only called when shrinking the array and generally should perform deallocations.
*
#endif // _di_f_fss_sets_delete_callback_
/**
- * A callback intended to be passed to f_memory_arrays_adjust() for an f_sets_t structure.
+ * A callback intended to be passed to f_memory_arrays_adjust() for an f_fss_sets_t structure.
*
* This is only called when shrinking the array and generally should perform deallocations.
*
#endif // _di_f_fss_sets_destroy_callback_
/**
- * A callback intended to be passed to f_memory_arrays_resize() for an f_setss_t structure.
+ * A callback intended to be passed to f_memory_arrays_resize() for an f_fss_setss_t structure.
*
* This is only called when shrinking the array and generally should perform deallocations.
*
#endif // _di_f_fss_setss_delete_callback_
/**
- * A callback intended to be passed to f_memory_arrays_adjust() for an f_setss_t structure.
+ * A callback intended to be passed to f_memory_arrays_adjust() for an f_fss_setss_t structure.
*
* This is only called when shrinking the array and generally should perform deallocations.
*
*/
#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_
+#endif // _di_f_fss_setss_destroy_callback_
#ifdef __cplusplus
} // extern "C"
#endif // _di_f_fss_set_quote_destroy_
/**
- * A callback intended to be passed to f_memory_arrays_resize() for an f_set_quotes_t structure.
+ * A callback intended to be passed to f_memory_arrays_resize() for an f_fss_set_quotes_t structure.
*
* This is only called when shrinking the array and generally should perform deallocations.
*
#endif // _di_f_fss_set_quotes_delete_callback_
/**
- * A callback intended to be passed to f_memory_arrays_adjust() for an f_set_quotes_t structure.
+ * A callback intended to be passed to f_memory_arrays_adjust() for an f_fss_set_quotes_t structure.
*
* This is only called when shrinking the array and generally should perform deallocations.
*
#endif // _di_f_fss_set_quotes_destroy_callback_
/**
- * A callback intended to be passed to f_memory_arrays_resize() for an f_set_quotess_t structure.
+ * A callback intended to be passed to f_memory_arrays_resize() for an f_fss_set_quotess_t structure.
*
* This is only called when shrinking the array and generally should perform deallocations.
*
#endif // _di_f_fss_set_quotess_delete_callback_
/**
- * A callback intended to be passed to f_memory_arrays_adjust() for an f_set_quotess_t structure.
+ * A callback intended to be passed to f_memory_arrays_adjust() for an f_fss_set_quotess_t structure.
*
* This is only called when shrinking the array and generally should perform deallocations.
*
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_
for (f_number_unsigned_t i = start; i < stop; ++i) {
- array[i].control = 0;
- array[i].size = 0;
-
status = f_string_dynamic_adjust(0, &array[i].payload);
if (F_status_is_error(status)) return status;
} // for
for (j = 0; j < array[i].size; ++j) {
- array[i].array[j].control = 0;
- array[i].array[j].size = 0;
-
status = f_string_dynamic_adjust(0, &array[i].array[j].payload);
if (F_status_is_error(status)) return status;
} // for
#endif // _di_f_fss_simple_packet_identify_
/**
- * A callback intended to be passed to f_memory_arrays_resize() for an f_simple_packets_t structure.
+ * A callback intended to be passed to f_memory_arrays_resize() for an f_fss_simple_packets_t structure.
*
* This is only called when shrinking the array and generally should perform deallocations.
*
#endif // _di_f_fss_simple_packets_delete_callback_
/**
- * A callback intended to be passed to f_memory_arrays_adjust() for an f_simple_packets_t structure.
+ * A callback intended to be passed to f_memory_arrays_adjust() for an f_fss_simple_packets_t structure.
*
* This is only called when shrinking the array and generally should perform deallocations.
*
#endif // _di_f_fss_simple_packets_destroy_callback_
/**
- * A callback intended to be passed to f_memory_arrays_resize() for an f_simple_packetss_t structure.
+ * A callback intended to be passed to f_memory_arrays_resize() for an f_fss_simple_packetss_t structure.
*
* This is only called when shrinking the array and generally should perform deallocations.
*
#endif // _di_f_fss_simple_packetss_delete_callback_
/**
- * A callback intended to be passed to f_memory_arrays_adjust() for an f_simple_packetss_t structure.
+ * A callback intended to be passed to f_memory_arrays_adjust() for an f_fss_simple_packetss_t structure.
*
* This is only called when shrinking the array and generally should perform deallocations.
*
#endif
#ifndef _di_f_iki_data_delete_
- f_status_t f_iki_data_delete(f_iki_data_t *data) {
+ f_status_t f_iki_data_delete(f_iki_data_t * const data) {
#ifndef _di_level_0_parameter_checking_
if (!data) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
#endif // _di_f_iki_data_delete_
#ifndef _di_f_iki_data_destroy_
- f_status_t f_iki_data_destroy(f_iki_data_t *data) {
+ f_status_t f_iki_data_destroy(f_iki_data_t * const data) {
#ifndef _di_level_0_parameter_checking_
if (!data) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
#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) {
+ f_status_t f_iki_datas_append(const f_iki_data_t source, f_iki_datas_t * const destination) {
#ifndef _di_level_0_parameter_checking_
if (!destination) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
#endif // _di_f_iki_datas_append_
#ifndef _di_f_iki_datas_append_all_
- f_status_t f_iki_datas_append_all(const f_iki_datas_t source, f_iki_datas_t *destination) {
+ f_status_t f_iki_datas_append_all(const f_iki_datas_t source, f_iki_datas_t * const destination) {
#ifndef _di_level_0_parameter_checking_
if (!destination) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
#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) {
+ f_status_t f_iki_datass_append(const f_iki_datas_t source, f_iki_datass_t * const destination) {
#ifndef _di_level_0_parameter_checking_
if (!destination) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
#endif // _di_f_iki_datass_append_
#ifndef _di_f_iki_datass_append_all_
- f_status_t f_iki_datass_append_all(const f_iki_datass_t source, f_iki_datass_t *destination) {
+ f_status_t f_iki_datass_append_all(const f_iki_datass_t source, f_iki_datass_t * const destination) {
#ifndef _di_level_0_parameter_checking_
if (!destination) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
* @see f_string_ranges_resize()
*/
#ifndef _di_f_iki_data_delete_
- extern f_status_t f_iki_data_delete(f_iki_data_t *data);
+ extern f_status_t f_iki_data_delete(f_iki_data_t * const data);
#endif // _di_f_iki_data_delete_
/**
* @see f_string_ranges_adjust()
*/
#ifndef _di_f_iki_data_destroy_
- extern f_status_t f_iki_data_destroy(f_iki_data_t *data);
+ extern f_status_t f_iki_data_destroy(f_iki_data_t * const data);
#endif // _di_f_iki_data_destroy_
/**
* @see f_string_ranges_append_all()
*/
#ifndef _di_f_iki_datas_append_
- extern f_status_t f_iki_datas_append(const f_iki_data_t source, f_iki_datas_t *destination);
+ extern f_status_t f_iki_datas_append(const f_iki_data_t source, f_iki_datas_t * const destination);
#endif // _di_f_iki_datas_append_
/**
* @see f_string_ranges_append_all()
*/
#ifndef _di_f_iki_datas_append_all_
- extern f_status_t f_iki_datas_append_all(const f_iki_datas_t source, f_iki_datas_t *destination);
+ extern f_status_t f_iki_datas_append_all(const f_iki_datas_t source, f_iki_datas_t * const destination);
#endif // _di_f_iki_datas_append_all_
/**
* @see f_string_ranges_resize()
*/
#ifndef _di_f_iki_datass_append_
- extern f_status_t f_iki_datass_append(const f_iki_datas_t source, f_iki_datass_t *destination);
+ extern f_status_t f_iki_datass_append(const f_iki_datas_t source, f_iki_datass_t * const destination);
#endif // _di_f_iki_datass_append_
/**
* @see f_string_ranges_resize()
*/
#ifndef _di_f_iki_datass_append_all_
- extern f_status_t f_iki_datass_append_all(const f_iki_datass_t source, f_iki_datass_t *destination);
+ extern f_status_t f_iki_datass_append_all(const f_iki_datass_t source, f_iki_datass_t * const destination);
#endif // _di_f_iki_datass_append_all_
/**
#endif
#if !defined(_di_f_iki_datas_append_) || !defined(_di_f_iki_datas_append_all_) || !defined(_di_f_iki_datass_append_all_)
- extern f_status_t private_f_iki_datas_append_all(const f_iki_datas_t source, f_iki_datas_t *destination) {
+ extern f_status_t private_f_iki_datas_append_all(const f_iki_datas_t source, f_iki_datas_t * const destination) {
f_status_t status = f_memory_array_increase_by(source.used, sizeof(f_iki_data_t), (void **) &destination->array, &destination->used, &destination->size);
if (F_status_is_error(status)) return status;
* @see f_iki_datass_append_all()
*/
#if !defined(_di_f_iki_datas_append_) || !defined(_di_f_iki_datas_append_all_) || !defined(_di_f_iki_datass_append_all_)
- extern f_status_t private_f_iki_datas_append_all(const f_iki_datas_t source, f_iki_datas_t *destination) F_attribute_visibility_internal_d;
+ extern f_status_t private_f_iki_datas_append_all(const f_iki_datas_t source, f_iki_datas_t * const destination) F_attribute_visibility_internal_d;
#endif // !defined(_di_f_iki_datas_append_) || !defined(_di_f_iki_datas_append_all_) || !defined(_di_f_iki_datass_append_all_)
#ifdef __cplusplus
+++ /dev/null
-#include "../limit.h"
-#include "set.h"
-#include "private-set.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if !defined(_di_f_limit_sets_append_) || !defined(_di_f_limit_setss_append_)
- extern f_status_t private_f_limit_sets_append(const f_limit_set_t source, f_limit_sets_t *destination) {
-
- const f_status_t status = f_memory_array_increase(F_memory_default_allocation_small_d, sizeof(f_limit_set_t), (void **) &destination->array, &destination->used, &destination->size);
- if (F_status_is_error(status)) return status;
-
- destination->array[destination->used++] = source;
-
- return F_okay;
- }
-#endif // !defined(_di_f_limit_sets_append_) || !defined(_di_f_limit_setss_append_)
-
-#if !defined(_di_f_limit_sets_append_) || !defined(_di_f_limit_sets_append_all_) || !defined(_di_f_limit_setss_append_all_)
- extern f_status_t private_f_limit_sets_append_all(const f_limit_sets_t source, f_limit_sets_t *destination) {
-
- const f_status_t status = f_memory_array_increase_by(source.used, sizeof(f_limit_set_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->array[destination->used++] = source.array[i];
- } // for
-
- return F_okay;
- }
-#endif // !defined(_di_f_limit_sets_append_) || !defined(_di_f_limit_sets_append_all_) || !defined(_di_f_limit_setss_append_all_)
-
-#if !defined(_di_f_limit_setss_adjust_) || !defined(_di_f_limit_setss_decimate_by_)
- f_status_t private_f_limit_setss_adjust(const f_number_unsigned_t length, f_limit_setss_t *setss) {
-
- f_status_t status = F_okay;
-
- for (f_number_unsigned_t i = length; i < setss->size; ++i) {
-
- status = f_memory_array_adjust(0, sizeof(f_limit_set_t), (void **) &setss->array[i].array, &setss->array[i].used, &setss->array[i].size);
- if (F_status_is_error(status)) return status;
- } // for
-
- return f_memory_array_adjust(length, sizeof(f_limit_sets_t), (void **) &setss->array, &setss->used, &setss->size);
- }
-#endif // !defined(_di_f_limit_setss_adjust_) || !defined(_di_f_limit_setss_decimate_by_)
-
-#if !defined(_di_f_limit_setss_decrease_by_) || !defined(_di_f_limit_setss_increase_) || !defined(_di_f_limit_setss_increase_by_) || !defined(_di_f_limit_setss_resize_)
- f_status_t private_f_limit_setss_resize(const f_number_unsigned_t length, f_limit_setss_t *setss) {
-
- f_status_t status = F_okay;
-
- for (f_number_unsigned_t i = length; i < setss->size; ++i) {
-
- status = f_memory_array_resize(0, sizeof(f_limit_set_t), (void **) &setss->array[i].array, &setss->array[i].used, &setss->array[i].size);
- if (F_status_is_error(status)) return status;
- } // for
-
- return f_memory_array_resize(length, sizeof(f_limit_sets_t), (void **) &setss->array, &setss->used, &setss->size);
- }
-#endif // !defined(_di_f_limit_setss_decrease_by_) || !defined(_di_f_limit_setss_increase_) || !defined(_di_f_limit_setss_increase_by_) || !defined(_di_f_limit_setss_resize_)
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
+++ /dev/null
-/**
- * FLL - Level 0
- *
- * Project: Limit
- * 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_limit_set_h
-#define _PRIVATE_F_limit_set_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * Private implementation for appending the set array.
- *
- * Intended to be shared to each of the different implementation variations.
- *
- * @param source
- * The source set to append.
- * @param destination
- * The destination lengths the source is appended onto.
- *
- * @return
- * F_okay on success.
- *
- * Errors (with error bit) from: f_memory_array_increase().
- *
- * @see f_memory_array_increase()
- *
- * @see f_limit_sets_append()
- * @see f_limit_setss_append()
- */
-#if !defined(_di_f_limit_sets_append_) || !defined(_di_f_limit_setss_append_)
- extern f_status_t private_f_limit_sets_append(const f_limit_set_t source, f_limit_sets_t *destination) F_attribute_visibility_internal_d;
-#endif // !defined(_di_f_limit_sets_append_) || !defined(_di_f_limit_setss_append_)
-
-/**
- * Private implementation for appending the set array.
- *
- * Intended to be shared to each of the different implementation variations.
- *
- * @param source
- * The source sets to append.
- * @param destination
- * The destination lengths the source is appended onto.
- *
- * @return
- * F_okay on success.
- *
- * Errors (with error bit) from: f_memory_array_increase_by().
- *
- * @see f_memory_array_increase_by()
- *
- * @see f_limit_sets_append_all()
- * @see f_limit_setss_append()
- * @see f_limit_setss_append_all()
- */
-#if !defined(_di_f_limit_sets_append_) || !defined(_di_f_limit_sets_append_all_) || !defined(_di_f_limit_setss_append_all_)
- extern f_status_t private_f_limit_sets_append_all(const f_limit_sets_t source, f_limit_sets_t *destination) F_attribute_visibility_internal_d;
-#endif // !defined(_di_f_limit_sets_append_) || !defined(_di_f_limit_sets_append_all_) || !defined(_di_f_limit_setss_append_all_)
-
-/**
- * Private implementation for resizing the setss array.
- *
- * Intended to be shared to each of the different implementation variations.
- *
- * @param length
- * The length to adjust to.
- * @param setss
- * The setss array to adjust.
- *
- * @return
- * F_okay 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 new length is larger than max array length.
- * 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().
- *
- * @see f_memory_array_adjust()
- *
- * @see f_limit_setss_adjust()
- * @see f_limit_setss_decimate_by()
- */
-#if !defined(_di_f_limit_setss_adjust_) || !defined(_di_f_limit_setss_decimate_by_)
- extern f_status_t private_f_limit_setss_adjust(const f_number_unsigned_t length, f_limit_setss_t *setss) F_attribute_visibility_internal_d;
-#endif // !defined(_di_f_limit_setss_adjust_) || !defined(_di_f_limit_setss_decimate_by_)
-
-/**
- * Private implementation for resizing the setss array.
- *
- * Intended to be shared to each of the different implementation variations.
- *
- * @param length
- * The length to resize to.
- * @param setss
- * The setss array to resize.
- *
- * @return
- * F_okay 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 new length is larger than max array length.
- * 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().
- *
- * @see f_memory_array_resize()
- *
- * @see f_limit_setss_decrease_by()
- * @see f_limit_setss_increase()
- * @see f_limit_setss_increase_by()
- * @see f_limit_setss_resize()
- */
-#if !defined(_di_f_limit_setss_decrease_by_) || !defined(_di_f_limit_setss_increase_) || !defined(_di_f_limit_setss_increase_by_) || !defined(_di_f_limit_setss_resize_)
- extern f_status_t private_f_limit_setss_resize(const f_number_unsigned_t length, f_limit_setss_t *setss) F_attribute_visibility_internal_d;
-#endif // !defined(_di_f_limit_setss_decrease_by_) || !defined(_di_f_limit_setss_increase_) || !defined(_di_f_limit_setss_increase_by_) || !defined(_di_f_limit_setss_resize_)
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // _PRIVATE_F_limit_set_h
+++ /dev/null
-#include "../limit.h"
-#include "value.h"
-#include "private-value.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if !defined(_di_f_limit_values_append_) || !defined(_di_f_limit_valuess_append_)
- extern f_status_t private_f_limit_values_append(const f_limit_value_t source, f_limit_values_t *destination) {
-
- const f_status_t status = f_memory_array_increase(F_memory_default_allocation_small_d, sizeof(f_limit_value_t), (void **) &destination->array, &destination->used, &destination->size);
- if (F_status_is_error(status)) return status;
-
- destination->array[destination->used++] = source;
-
- return F_okay;
- }
-#endif // !defined(_di_f_limit_values_append_) || !defined(_di_f_limit_valuess_append_)
-
-#if !defined(_di_f_limit_values_append_) || !defined(_di_f_limit_values_append_all_) || !defined(_di_f_limit_valuess_append_all_)
- extern f_status_t private_f_limit_values_append_all(const f_limit_values_t source, f_limit_values_t *destination) {
-
- const f_status_t status = f_memory_array_increase_by(source.used, sizeof(f_limit_value_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->array[destination->used++] = source.array[i];
- } // for
-
- return F_okay;
- }
-#endif // !defined(_di_f_limit_values_append_) || !defined(_di_f_limit_values_append_all_) || !defined(_di_f_limit_valuess_append_all_)
-
-#if !defined(_di_f_limit_valuess_adjust_) || !defined(_di_f_limit_valuess_decimate_by_)
- f_status_t private_f_limit_valuess_adjust(const f_number_unsigned_t length, f_limit_valuess_t *valuess) {
-
- f_status_t status = F_okay;
-
- for (f_number_unsigned_t i = length; i < valuess->size; ++i) {
-
- status = f_memory_array_adjust(0, sizeof(f_limit_value_t), (void **) &valuess->array[i].array, &valuess->array[i].used, &valuess->array[i].size);
- if (F_status_is_error(status)) return status;
- } // for
-
- return f_memory_array_adjust(length, sizeof(f_limit_values_t), (void **) &valuess->array, &valuess->used, &valuess->size);
- }
-#endif // !defined(_di_f_limit_valuess_adjust_) || !defined(_di_f_limit_valuess_decimate_by_)
-
-#if !defined(_di_f_limit_valuess_decrease_by_) || !defined(_di_f_limit_valuess_increase_) || !defined(_di_f_limit_valuess_increase_by_) || !defined(_di_f_limit_valuess_resize_)
- f_status_t private_f_limit_valuess_resize(const f_number_unsigned_t length, f_limit_valuess_t *valuess) {
-
- f_status_t status = F_okay;
-
- for (f_number_unsigned_t i = length; i < valuess->size; ++i) {
-
- status = f_memory_array_resize(0, sizeof(f_limit_value_t), (void **) &valuess->array[i].array, &valuess->array[i].used, &valuess->array[i].size);
- if (F_status_is_error(status)) return status;
- } // for
-
- return f_memory_array_resize(length, sizeof(f_limit_values_t), (void **) &valuess->array, &valuess->used, &valuess->size);
- }
-#endif // !defined(_di_f_limit_valuess_decrease_by_) || !defined(_di_f_limit_valuess_increase_) || !defined(_di_f_limit_valuess_increase_by_) || !defined(_di_f_limit_valuess_resize_)
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
+++ /dev/null
-/**
- * FLL - Level 0
- *
- * Project: Limit
- * 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_limit_value_h
-#define _PRIVATE_F_limit_value_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * Private implementation for appending the value array.
- *
- * Intended to be shared to each of the different implementation variations.
- *
- * @param source
- * The source value to append.
- * @param destination
- * The destination lengths the source is appended onto.
- *
- * @return
- * F_okay on success.
- *
- * Errors (with error bit) from: f_memory_array_increase().
- *
- * @see f_memory_array_increase()
- *
- * @see f_limit_values_append()
- * @see f_limit_valuess_append()
- */
-#if !defined(_di_f_limit_values_append_) || !defined(_di_f_limit_valuess_append_)
- extern f_status_t private_f_limit_values_append(const f_limit_value_t source, f_limit_values_t *destination) F_attribute_visibility_internal_d;
-#endif // !defined(_di_f_limit_values_append_) || !defined(_di_f_limit_valuess_append_)
-
-/**
- * Private implementation for appending the value array.
- *
- * Intended to be shared to each of the different implementation variations.
- *
- * @param source
- * The source values to append.
- * @param destination
- * The destination lengths the source is appended onto.
- *
- * @return
- * F_okay on success.
- *
- * Errors (with error bit) from: f_memory_array_increase_by().
- *
- * @see f_memory_array_increase_by()
- *
- * @see f_limit_values_append_all()
- * @see f_limit_valuess_append()
- * @see f_limit_valuess_append_all()
- */
-#if !defined(_di_f_limit_values_append_) || !defined(_di_f_limit_values_append_all_) || !defined(_di_f_limit_valuess_append_all_)
- extern f_status_t private_f_limit_values_append_all(const f_limit_values_t source, f_limit_values_t *destination) F_attribute_visibility_internal_d;
-#endif // !defined(_di_f_limit_values_append_) || !defined(_di_f_limit_values_append_all_) || !defined(_di_f_limit_valuess_append_all_)
-
-/**
- * Private implementation for resizing the valuess array.
- *
- * Intended to be shared to each of the different implementation variations.
- *
- * @param length
- * The length to adjust to.
- * @param valuess
- * The valuess array to adjust.
- *
- * @return
- * F_okay 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 new length is larger than max array length.
- * 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().
- *
- * @see f_memory_array_adjust()
- *
- * @see f_limit_valuess_adjust()
- * @see f_limit_valuess_decimate_by()
- */
-#if !defined(_di_f_limit_valuess_adjust_) || !defined(_di_f_limit_valuess_decimate_by_)
- extern f_status_t private_f_limit_valuess_adjust(const f_number_unsigned_t length, f_limit_valuess_t *valuess) F_attribute_visibility_internal_d;
-#endif // !defined(_di_f_limit_valuess_adjust_) || !defined(_di_f_limit_valuess_decimate_by_)
-
-/**
- * Private implementation for resizing the valuess array.
- *
- * Intended to be shared to each of the different implementation variations.
- *
- * @param length
- * The length to resize to.
- * @param valuess
- * The valuess array to resize.
- *
- * @return
- * F_okay 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 new length is larger than max array length.
- * 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().
- *
- * @see f_memory_array_resize()
- *
- * @see f_limit_valuess_decrease_by()
- * @see f_limit_valuess_increase()
- * @see f_limit_valuess_increase_by()
- * @see f_limit_valuess_resize()
- */
-#if !defined(_di_f_limit_valuess_decrease_by_) || !defined(_di_f_limit_valuess_increase_) || !defined(_di_f_limit_valuess_increase_by_) || !defined(_di_f_limit_valuess_resize_)
- extern f_status_t private_f_limit_valuess_resize(const f_number_unsigned_t length, f_limit_valuess_t *valuess) F_attribute_visibility_internal_d;
-#endif // !defined(_di_f_limit_valuess_decrease_by_) || !defined(_di_f_limit_valuess_increase_) || !defined(_di_f_limit_valuess_increase_by_) || !defined(_di_f_limit_valuess_resize_)
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // _PRIVATE_F_limit_value_h
#include "../limit.h"
#include "set.h"
-#include "private-set.h"
#ifdef __cplusplus
extern "C" {
#endif
-#ifndef _di_f_limit_sets_adjust_
- f_status_t f_limit_sets_adjust(const f_number_unsigned_t length, f_limit_sets_t *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_limit_setss_delete_callback_
+ f_status_t f_limit_setss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
- return f_memory_array_adjust(length, sizeof(f_limit_set_t), (void **) &sets->array, &sets->used, &sets->size);
- }
-#endif // _di_f_limit_sets_adjust_
-
-#ifndef _di_f_limit_sets_append_
- f_status_t f_limit_sets_append(const f_limit_set_t source, f_limit_sets_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_limit_sets_append(source, destination);
- }
-#endif // _di_f_limit_sets_append_
-
-#ifndef _di_f_limit_sets_append_all_
- f_status_t f_limit_sets_append_all(const f_limit_sets_t source, f_limit_sets_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_limit_sets_append_all(source, destination);
- }
-#endif // _di_f_limit_sets_append_all_
-
-#ifndef _di_f_limit_sets_decimate_by_
- f_status_t f_limit_sets_decimate_by(const f_number_unsigned_t amount, f_limit_sets_t *sets) {
- #ifndef _di_level_0_parameter_checking_
- if (!sets) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- return f_memory_array_decimate_by(amount, sizeof(f_limit_set_t), (void **) &sets->array, &sets->used, &sets->size);
- }
-#endif // _di_f_limit_sets_decimate_by_
-
-#ifndef _di_f_limit_sets_decrease_by_
- f_status_t f_limit_sets_decrease_by(const f_number_unsigned_t amount, f_limit_sets_t *sets) {
- #ifndef _di_level_0_parameter_checking_
- if (!sets) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- return f_memory_array_decrease_by(amount, sizeof(f_limit_set_t), (void **) &sets->array, &sets->used, &sets->size);
- }
-#endif // _di_f_limit_sets_decrease_by_
-
-#ifndef _di_f_limit_sets_increase_
- f_status_t f_limit_sets_increase(const f_number_unsigned_t step, f_limit_sets_t *sets) {
- #ifndef _di_level_0_parameter_checking_
- if (!sets) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- return f_memory_array_increase(step, sizeof(f_limit_set_t), (void **) &sets->array, &sets->used, &sets->size);
- }
-#endif // _di_f_limit_sets_increase_
-
-#ifndef _di_f_limit_sets_increase_by_
- f_status_t f_limit_sets_increase_by(const f_number_unsigned_t amount, f_limit_sets_t *sets) {
- #ifndef _di_level_0_parameter_checking_
- if (!sets) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- return f_memory_array_increase_by(amount, sizeof(f_limit_set_t), (void **) &sets->array, &sets->used, &sets->size);
- }
-#endif // _di_f_limit_sets_increase_by_
-
-#ifndef _di_f_limit_sets_resize_
- f_status_t f_limit_sets_resize(const f_number_unsigned_t length, f_limit_sets_t *sets) {
- #ifndef _di_level_0_parameter_checking_
- if (!sets) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- return f_memory_array_resize(length, sizeof(f_limit_set_t), (void **) &sets->array, &sets->used, &sets->size);
- }
-#endif // _di_f_limit_sets_resize_
-
-#ifndef _di_f_limit_setss_adjust_
- f_status_t f_limit_setss_adjust(const f_number_unsigned_t length, f_limit_setss_t *setss) {
- #ifndef _di_level_0_parameter_checking_
- if (!setss) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
+ {
+ f_limit_sets_t * const array = (f_limit_sets_t *) void_array;
+ f_status_t status = F_okay;
- return private_f_limit_setss_adjust(length, setss);
- }
-#endif // _di_f_limit_setss_adjust_
-
-#ifndef _di_f_limit_setss_append_
- f_status_t f_limit_setss_append(const f_limit_sets_t source, f_limit_setss_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;
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
- f_status_t status = f_memory_array_increase(F_memory_default_allocation_small_d, sizeof(f_limit_sets_t), (void **) &destination->array, &destination->used, &destination->size);
- if (F_status_is_error(status)) return status;
-
- status = private_f_limit_sets_append_all(source, &destination->array[destination->used]);
- if (F_status_is_error(status)) return status;
-
- ++destination->used;
+ if (array[i].size) {
+ status = f_memory_array_resize(0, sizeof(f_limit_set_t), (void **) &array[i].array, &array[i].used, &array[i].size);
+ if (F_status_is_error(status)) return status;
+ }
+ } // for
+ }
return F_okay;
}
-#endif // _di_f_limit_setss_append_
-
-#ifndef _di_f_limit_setss_append_all_
- f_status_t f_limit_setss_append_all(const f_limit_setss_t source, f_limit_setss_t *destination) {
- #ifndef _di_level_0_parameter_checking_
- if (!destination) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
+#endif // _di_f_limit_setss_delete_callback_
- if (!source.used) return F_data_not;
+#ifndef _di_f_limit_setss_destroy_callback_
+ f_status_t f_limit_setss_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_by(source.used, sizeof(f_limit_sets_t), (void **) &destination->array, &destination->used, &destination->size);
- if (F_status_is_error(status)) return status;
+ {
+ f_limit_sets_t * const array = (f_limit_sets_t *) void_array;
+ f_status_t status = F_okay;
- for (f_number_unsigned_t i = 0; i < source.used; ++i, ++destination->used) {
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
- destination->array[destination->used].used = 0;
-
- if (source.array[i].used) {
- status = private_f_limit_sets_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_limit_set_t), (void **) &array[i].array, &array[i].used, &array[i].size);
+ if (F_status_is_error(status)) return status;
+ }
+ } // for
+ }
return F_okay;
}
-#endif // _di_f_limit_setss_append_all_
-
-#ifndef _di_f_limit_setss_decimate_by_
- f_status_t f_limit_setss_decimate_by(const f_number_unsigned_t amount, f_limit_setss_t *setss) {
- #ifndef _di_level_0_parameter_checking_
- if (!setss) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- if (!amount) return F_data_not;
-
- return private_f_limit_setss_adjust((setss->size > amount) ? setss->size - amount : 0, setss);
- }
-#endif // _di_f_limit_setss_decimate_by_
-
-#ifndef _di_f_limit_setss_decrease_by_
- f_status_t f_limit_setss_decrease_by(const f_number_unsigned_t amount, f_limit_setss_t *setss) {
- #ifndef _di_level_0_parameter_checking_
- if (!setss) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- if (!amount) return F_data_not;
-
- return private_f_limit_setss_resize((setss->size > amount) ? setss->size - amount : 0, setss);
- }
-#endif // _di_f_limit_setss_decrease_by_
-
-#ifndef _di_f_limit_setss_increase_
- f_status_t f_limit_setss_increase(const f_number_unsigned_t step, f_limit_setss_t *setss) {
- #ifndef _di_level_0_parameter_checking_
- if (!setss) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- return f_memory_array_increase(step, sizeof(f_limit_sets_t), (void **) &setss->array, &setss->used, &setss->size);
- }
-#endif // _di_f_limit_setss_increase_
-
-#ifndef _di_f_limit_setss_increase_by_
- f_status_t f_limit_setss_increase_by(const f_number_unsigned_t amount, f_limit_setss_t *setss) {
- #ifndef _di_level_0_parameter_checking_
- if (!setss) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- return f_memory_array_increase_by(amount, sizeof(f_limit_sets_t), (void **) &setss->array, &setss->used, &setss->size);
- }
-#endif // _di_f_limit_setss_increase_by_
-
-#ifndef _di_f_limit_setss_resize_
- f_status_t f_limit_setss_resize(const f_number_unsigned_t length, f_limit_setss_t *setss) {
- #ifndef _di_level_0_parameter_checking_
- if (!setss) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- return private_f_limit_setss_resize(length, setss);
- }
-#endif // _di_f_limit_setss_resize_
+#endif // _di_f_limit_setss_destroy_callback_
#ifdef __cplusplus
} // extern "C"
#define macro_f_limit_sets_t_initialize_1(array, size, used) { array, size, used }
#define macro_f_limit_sets_t_initialize_2(array, length) { array, length, length }
-
- #define macro_f_limit_sets_t_resize(status, sets, length) status = f_limit_sets_resize(length, &sets);
- #define macro_f_limit_sets_t_adjust(status, sets, length) status = f_limit_sets_adjust(length, &sets);
-
- #define macro_f_limit_sets_t_delete_simple(sets) f_limit_sets_resize(0, &sets);
- #define macro_f_limit_sets_t_destroy_simple(sets) f_limit_sets_adjust(0, &sets);
-
- #define macro_f_limit_sets_t_increase(status, step, sets) status = f_limit_sets_increase(step, &sets);
- #define macro_f_limit_sets_t_increase_by(status, sets, amount) status = f_limit_sets_increase_by(amount, &sets);
- #define macro_f_limit_sets_t_decrease_by(status, sets, amount) status = f_limit_sets_decrease_by(amount, &sets);
- #define macro_f_limit_sets_t_decimate_by(status, sets, amount) status = f_limit_sets_decimate_by(amount, &sets);
#endif // _di_f_limit_sets_t_
/**
#define macro_f_limit_setss_t_initialize_1(array, size, used) { array, size, used }
#define macro_f_limit_setss_t_initialize_2(array, length) { array, length, length }
-
- #define macro_f_limit_setss_t_resize(status, setss, length) status = f_limit_setss_resize(length, &setss);
- #define macro_f_limit_setss_t_adjust(status, setss, length) status = f_limit_setss_adjust(length, &setss);
-
- #define macro_f_limit_setss_t_delete_simple(setss) f_limit_setss_resize(0, &setss);
- #define macro_f_limit_setss_t_destroy_simple(setss) f_limit_setss_adjust(0, &setss);
-
- #define macro_f_limit_setss_t_increase(status, step, setss) status = f_limit_setss_increase(step, &setss);
- #define macro_f_limit_setss_t_increase_by(status, setss, amount) status = f_limit_setss_increase_by(amount, &setss);
- #define macro_f_limit_setss_t_decrease_by(status, setss, amount) status = f_limit_setss_decrease_by(amount, &setss);
- #define macro_f_limit_setss_t_decimate_by(status, setss, amount) status = f_limit_setss_decimate_by(amount, &setss);
#endif // _di_f_limit_setss_t_
/**
- * Resize the sets array.
- *
- * @param length
- * The new size to use.
- * @param sets
- * The sets 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_adjust().
- *
- * @see f_memory_array_adjust()
- */
-#ifndef _di_f_limit_sets_adjust_
- extern f_status_t f_limit_sets_adjust(const f_number_unsigned_t length, f_limit_sets_t *sets);
-#endif // _di_f_limit_sets_adjust_
-
-/**
- * Append the single source set onto the destination.
- *
- * @param source
- * The source set to append.
- * @param destination
- * The destination sets the source is appended onto.
- *
- * @return
- * F_okay 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_resize() for an f_limit_setss_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().
- *
- * @see f_memory_array_increase()
- */
-#ifndef _di_f_limit_sets_append_
- extern f_status_t f_limit_sets_append(const f_limit_set_t source, f_limit_sets_t *destination);
-#endif // _di_f_limit_sets_append_
-
-/**
- * Append the source sets onto the destination.
+ * This does not do parameter checking.
*
- * @param source
- * The source sets to append.
- * @param destination
- * The destination sets 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_okay 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().
- *
- * @see f_memory_array_increase_by()
- */
-#ifndef _di_f_limit_sets_append_all_
- extern f_status_t f_limit_sets_append_all(const f_limit_sets_t source, f_limit_sets_t *destination);
-#endif // _di_f_limit_sets_append_all_
-
-/**
- * Resize the sets 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 sets
- * The sets 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_limit_sets_decimate_by_
- extern f_status_t f_limit_sets_decimate_by(const f_number_unsigned_t amount, f_limit_sets_t *sets);
-#endif // _di_f_limit_sets_decimate_by_
-
-/**
- * Resize the sets 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 sets
- * The sets 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_limit_sets_decrease_by_
- extern f_status_t f_limit_sets_decrease_by(const f_number_unsigned_t amount, f_limit_sets_t *sets);
-#endif // _di_f_limit_sets_decrease_by_
-
-/**
- * Increase the size of the sets array, but only if necesary.
- *
- * 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.
- *
- * @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_limit_sets_increase_
- extern f_status_t f_limit_sets_increase(const f_number_unsigned_t step, f_limit_sets_t *sets);
-#endif // _di_f_limit_sets_increase_
-
-/**
- * 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.
- *
- * @param amount
- * A positive number representing how much to increase the size by.
- * @param sets
- * The sets 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().
+ * Errors (with error bit) from: f_string_dynamics_resize().
*
- * @see f_memory_array_increase_by()
+ * @see f_string_dynamics_resize()
*/
-#ifndef _di_f_limit_sets_increase_by_
- extern f_status_t f_limit_sets_increase_by(const f_number_unsigned_t amount, f_limit_sets_t *sets);
-#endif // _di_f_limit_sets_increase_by_
+#ifndef _di_f_limit_setss_delete_callback_
+ extern f_status_t f_limit_setss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_limit_setss_delete_callback_
/**
- * Resize the sets array.
- *
- * @param length
- * The new size to use.
- * @param sets
- * The sets array to adjust.
- *
- * @return
- * Success from f_memory_array_resize().
+ * A callback intended to be passed to f_memory_arrays_adjust() for an f_limit_setss_t structure.
*
- * 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_limit_sets_resize_
- extern f_status_t f_limit_sets_resize(const f_number_unsigned_t length, f_limit_sets_t *sets);
-#endif // _di_f_limit_sets_resize_
-
-/**
- * Resize the setss array.
+ * This does not do parameter checking.
*
- * @param length
- * The new size to use.
- * @param setss
- * The setss 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_limit_setss_adjust_
- extern f_status_t f_limit_setss_adjust(const f_number_unsigned_t length, f_limit_setss_t *setss);
-#endif // _di_f_limit_setss_adjust_
-
-/**
- * Append the single source sets onto the destination.
- *
- * @param source
- * The source sets to append.
- * @param destination
- * The destination ranges the source is appended onto.
- *
- * @return
- * F_okay 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().
- * Errors (with error bit) from: f_memory_array_resize().
- *
- * @see f_memory_array_increase()
- * @see f_memory_array_resize()
- */
-#ifndef _di_f_limit_setss_append_
- extern f_status_t f_limit_setss_append(const f_limit_sets_t source, f_limit_setss_t *destination);
-#endif // _di_f_limit_setss_append_
-
-/**
- * Append the source setss onto the destination.
- *
- * @param source
- * The source setss 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_okay 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_limit_setss_append_all_
- extern f_status_t f_limit_setss_append_all(const f_limit_setss_t source, f_limit_setss_t *destination);
-#endif // _di_f_limit_setss_append_all_
-
-/**
- * Resize the setss 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 setss
- * The setss 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_limit_setss_decimate_by_
- extern f_status_t f_limit_setss_decimate_by(const f_number_unsigned_t amount, f_limit_setss_t *setss);
-#endif // _di_f_limit_setss_decimate_by_
-
-/**
- * Resize the setss 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 setss
- * The setss 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_limit_setss_decrease_by_
- extern f_status_t f_limit_setss_decrease_by(const f_number_unsigned_t amount, f_limit_setss_t *setss);
-#endif // _di_f_limit_setss_decrease_by_
-
-/**
- * Increase the size of the setss 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 setss
- * The setss 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_limit_setss_increase_
- extern f_status_t f_limit_setss_increase(const f_number_unsigned_t step, f_limit_setss_t *setss);
-#endif // _di_f_limit_setss_increase_
-
-/**
- * Resize the setss 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 setss
- * The setss 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_limit_setss_increase_by_
- extern f_status_t f_limit_setss_increase_by(const f_number_unsigned_t amount, f_limit_setss_t *setss);
-#endif // _di_f_limit_setss_increase_by_
-
-/**
- * Resize the setss array.
- *
- * @param length
- * The new size to use.
- * @param setss
- * The setss 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_dynamics_adjust().
*
- * @see f_memory_array_resize()
+ * @see f_string_dynamics_adjust()
*/
-#ifndef _di_f_limit_setss_resize_
- extern f_status_t f_limit_setss_resize(const f_number_unsigned_t length, f_limit_setss_t *setss);
-#endif // _di_f_limit_setss_resize_
+#ifndef _di_f_limit_setss_destroy_callback_
+ extern f_status_t f_limit_setss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_limit_setss_destroy_callback_
#ifdef __cplusplus
} // extern "C"
#include "../limit.h"
#include "value.h"
-#include "private-value.h"
#ifdef __cplusplus
extern "C" {
#endif
-#ifndef _di_f_limit_values_adjust_
- f_status_t f_limit_values_adjust(const f_number_unsigned_t length, f_limit_values_t *values) {
- #ifndef _di_level_0_parameter_checking_
- if (!values) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
+#ifndef _di_f_limit_valuess_delete_callback_
+ f_status_t f_limit_valuess_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
- return f_memory_array_adjust(length, sizeof(f_limit_value_t), (void **) &values->array, &values->used, &values->size);
- }
-#endif // _di_f_limit_values_adjust_
-
-#ifndef _di_f_limit_values_append_
- f_status_t f_limit_values_append(const f_limit_value_t source, f_limit_values_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_limit_values_append(source, destination);
- }
-#endif // _di_f_limit_values_append_
-
-#ifndef _di_f_limit_values_append_all_
- f_status_t f_limit_values_append_all(const f_limit_values_t source, f_limit_values_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_limit_values_append_all(source, destination);
- }
-#endif // _di_f_limit_values_append_all_
-
-#ifndef _di_f_limit_values_decimate_by_
- f_status_t f_limit_values_decimate_by(const f_number_unsigned_t amount, f_limit_values_t *values) {
- #ifndef _di_level_0_parameter_checking_
- if (!values) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- return f_memory_array_decimate_by(amount, sizeof(f_limit_value_t), (void **) &values->array, &values->used, &values->size);
- }
-#endif // _di_f_limit_values_decimate_by_
-
-#ifndef _di_f_limit_values_decrease_by_
- f_status_t f_limit_values_decrease_by(const f_number_unsigned_t amount, f_limit_values_t *values) {
- #ifndef _di_level_0_parameter_checking_
- if (!values) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- return f_memory_array_decrease_by(amount, sizeof(f_limit_value_t), (void **) &values->array, &values->used, &values->size);
- }
-#endif // _di_f_limit_values_decrease_by_
-
-#ifndef _di_f_limit_values_increase_
- f_status_t f_limit_values_increase(const f_number_unsigned_t step, f_limit_values_t *values) {
- #ifndef _di_level_0_parameter_checking_
- if (!values) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- return f_memory_array_increase(step, sizeof(f_limit_value_t), (void **) &values->array, &values->used, &values->size);
- }
-#endif // _di_f_limit_values_increase_
-
-#ifndef _di_f_limit_values_increase_by_
- f_status_t f_limit_values_increase_by(const f_number_unsigned_t amount, f_limit_values_t *values) {
- #ifndef _di_level_0_parameter_checking_
- if (!values) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- return f_memory_array_increase_by(amount, sizeof(f_limit_value_t), (void **) &values->array, &values->used, &values->size);
- }
-#endif // _di_f_limit_values_increase_by_
-
-#ifndef _di_f_limit_values_resize_
- f_status_t f_limit_values_resize(const f_number_unsigned_t length, f_limit_values_t *values) {
- #ifndef _di_level_0_parameter_checking_
- if (!values) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- return f_memory_array_resize(length, sizeof(f_limit_value_t), (void **) &values->array, &values->used, &values->size);
- }
-#endif // _di_f_limit_values_resize_
-
-#ifndef _di_f_limit_valuess_adjust_
- f_status_t f_limit_valuess_adjust(const f_number_unsigned_t length, f_limit_valuess_t *valuess) {
- #ifndef _di_level_0_parameter_checking_
- if (!valuess) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
+ {
+ f_limit_values_t * const array = (f_limit_values_t *) void_array;
+ f_status_t status = F_okay;
- return private_f_limit_valuess_adjust(length, valuess);
- }
-#endif // _di_f_limit_valuess_adjust_
-
-#ifndef _di_f_limit_valuess_append_
- f_status_t f_limit_valuess_append(const f_limit_values_t source, f_limit_valuess_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;
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
- f_status_t status = f_memory_array_increase(F_memory_default_allocation_small_d, sizeof(f_limit_values_t), (void **) &destination->array, &destination->used, &destination->size);
- if (F_status_is_error(status)) return status;
-
- status = private_f_limit_values_append_all(source, &destination->array[destination->used]);
- if (F_status_is_error(status)) return status;
-
- ++destination->used;
+ if (array[i].size) {
+ status = f_memory_array_resize(0, sizeof(f_limit_value_t), (void **) &array[i].array, &array[i].used, &array[i].size);
+ if (F_status_is_error(status)) return status;
+ }
+ } // for
+ }
return F_okay;
}
-#endif // _di_f_limit_valuess_append_
-
-#ifndef _di_f_limit_valuess_append_all_
- f_status_t f_limit_valuess_append_all(const f_limit_valuess_t source, f_limit_valuess_t *destination) {
- #ifndef _di_level_0_parameter_checking_
- if (!destination) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
+#endif // _di_f_limit_valuess_delete_callback_
- if (!source.used) return F_data_not;
+#ifndef _di_f_limit_valuess_destroy_callback_
+ f_status_t f_limit_valuess_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_by(source.used, sizeof(f_limit_values_t), (void **) &destination->array, &destination->used, &destination->size);
- if (F_status_is_error(status)) return status;
+ {
+ f_limit_values_t * const array = (f_limit_values_t *) void_array;
+ f_status_t status = F_okay;
- for (f_number_unsigned_t i = 0; i < source.used; ++i, ++destination->used) {
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
- destination->array[destination->used].used = 0;
-
- if (source.array[i].used) {
- status = private_f_limit_values_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_limit_value_t), (void **) &array[i].array, &array[i].used, &array[i].size);
+ if (F_status_is_error(status)) return status;
+ }
+ } // for
+ }
return F_okay;
}
-#endif // _di_f_limit_valuess_append_all_
-
-#ifndef _di_f_limit_valuess_decimate_by_
- f_status_t f_limit_valuess_decimate_by(const f_number_unsigned_t amount, f_limit_valuess_t *valuess) {
- #ifndef _di_level_0_parameter_checking_
- if (!valuess) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- if (!amount) return F_data_not;
-
- return private_f_limit_valuess_adjust((valuess->size > amount) ? valuess->size - amount : 0, valuess);
- }
-#endif // _di_f_limit_valuess_decimate_by_
-
-#ifndef _di_f_limit_valuess_decrease_by_
- f_status_t f_limit_valuess_decrease_by(const f_number_unsigned_t amount, f_limit_valuess_t *valuess) {
- #ifndef _di_level_0_parameter_checking_
- if (!valuess) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- if (!amount) return F_data_not;
-
- return private_f_limit_valuess_resize((valuess->size > amount) ? valuess->size - amount : 0, valuess);
- }
-#endif // _di_f_limit_valuess_decrease_by_
-
-#ifndef _di_f_limit_valuess_increase_
- f_status_t f_limit_valuess_increase(const f_number_unsigned_t step, f_limit_valuess_t *valuess) {
- #ifndef _di_level_0_parameter_checking_
- if (!valuess) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- return f_memory_array_increase(step, sizeof(f_limit_values_t), (void **) &valuess->array, &valuess->used, &valuess->size);
- }
-#endif // _di_f_limit_valuess_increase_
-
-#ifndef _di_f_limit_valuess_increase_by_
- f_status_t f_limit_valuess_increase_by(const f_number_unsigned_t amount, f_limit_valuess_t *valuess) {
- #ifndef _di_level_0_parameter_checking_
- if (!valuess) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- return f_memory_array_increase_by(amount, sizeof(f_limit_values_t), (void **) &valuess->array, &valuess->used, &valuess->size);
- }
-#endif // _di_f_limit_valuess_increase_by_
-
-#ifndef _di_f_limit_valuess_resize_
- f_status_t f_limit_valuess_resize(const f_number_unsigned_t length, f_limit_valuess_t *valuess) {
- #ifndef _di_level_0_parameter_checking_
- if (!valuess) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- return private_f_limit_valuess_resize(length, valuess);
- }
-#endif // _di_f_limit_valuess_resize_
+#endif // _di_f_limit_valuess_destroy_callback_
#ifdef __cplusplus
} // extern "C"
#define macro_f_limit_values_t_initialize_1(content, size, used) { array, size, used }
#define macro_f_limit_values_t_initialize_2(array, length) { array, length, length }
-
- #define macro_f_limit_values_t_resize(status, values, length) status = f_limit_values_resize(length, &values);
- #define macro_f_limit_values_t_adjust(status, values, length) status = f_limit_values_adjust(length, &values);
-
- #define macro_f_limit_values_t_delete_simple(values) f_limit_values_resize(0, &values);
- #define macro_f_limit_values_t_destroy_simple(values) f_limit_values_adjust(0, &values);
-
- #define macro_f_limit_values_t_increase(status, step, values) status = f_limit_values_increase(step, &values);
- #define macro_f_limit_values_t_increase_by(status, values, amount) status = f_limit_values_increase_by(amount, &values);
- #define macro_f_limit_values_t_decrease_by(status, values, amount) status = f_limit_values_decrease_by(amount, &values);
- #define macro_f_limit_values_t_decimate_by(status, values, amount) status = f_limit_values_decimate_by(amount, &values);
#endif // _di_f_limit_values_t_
/**
- * This holds an array of f_limit_values_t.
+ * An array of an array of limit values.
*
* Properties:
- * - array: An array of f_limit_values_t.
+ * - array: An array of an array of limit values.
* - size: Total amount of allocated space.
* - used: Total number of allocated spaces used.
*/
#define f_limit_valuess_t_initialize { 0, 0, 0 }
- #define macro_f_limit_valuess_t_initialize_1(array, size, used) { array, size, used }
+ #define macro_f_limit_valuess_t_initialize_1(content, size, used) { array, size, used }
#define macro_f_limit_valuess_t_initialize_2(array, length) { array, length, length }
-
- #define macro_f_limit_valuess_t_resize(status, valuess, length) status = f_limit_valuess_resize(length, &valuess);
- #define macro_f_limit_valuess_t_adjust(status, valuess, length) status = f_limit_valuess_adjust(length, &valuess);
-
- #define macro_f_limit_valuess_t_delete_simple(valuess) f_limit_valuess_resize(0, &valuess);
- #define macro_f_limit_valuess_t_destroy_simple(valuess) f_limit_valuess_adjust(0, &valuess);
-
- #define macro_f_limit_valuess_t_increase(status, step, valuess) status = f_limit_valuess_increase(step, &valuess);
- #define macro_f_limit_valuess_t_increase_by(status, valuess, amount) status = f_limit_valuess_increase_by(amount, &valuess);
- #define macro_f_limit_valuess_t_decrease_by(status, valuess, amount) status = f_limit_valuess_decrease_by(amount, &valuess);
- #define macro_f_limit_valuess_t_decimate_by(status, valuess, amount) status = f_limit_valuess_decimate_by(amount, &valuess);
#endif // _di_f_limit_valuess_t_
/**
- * Resize the values array.
- *
- * @param length
- * The new size to use.
- * @param values
- * The values 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_limit_values_adjust_
- extern f_status_t f_limit_values_adjust(const f_number_unsigned_t length, f_limit_values_t *values);
-#endif // _di_f_limit_values_adjust_
-
-/**
- * Append the single source value onto the destination.
- *
- * @param source
- * The source value to append.
- * @param destination
- * The destination values the source is appended onto.
- *
- * @return
- * F_okay 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_resize() for an f_limit_valuess_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().
- *
- * @see f_memory_array_increase()
- */
-#ifndef _di_f_limit_values_append_
- extern f_status_t f_limit_values_append(const f_limit_value_t source, f_limit_values_t *destination);
-#endif // _di_f_limit_values_append_
-
-/**
- * Append the source values onto the destination.
+ * This does not do parameter checking.
*
- * @param source
- * The source values to append.
- * @param destination
- * The destination values 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_okay 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().
- *
- * @see f_memory_array_increase_by()
- */
-#ifndef _di_f_limit_values_append_all_
- extern f_status_t f_limit_values_append_all(const f_limit_values_t source, f_limit_values_t *destination);
-#endif // _di_f_limit_values_append_all_
-
-/**
- * Resize the values 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 values
- * The values array to resize.
- *
- * @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_limit_values_decimate_by_
- extern f_status_t f_limit_values_decimate_by(const f_number_unsigned_t amount, f_limit_values_t *values);
-#endif // _di_f_limit_values_decimate_by_
-
-/**
- * Resize the values 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 values
- * The values 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_limit_values_decrease_by_
- extern f_status_t f_limit_values_decrease_by(const f_number_unsigned_t amount, f_limit_values_t *values);
-#endif // _di_f_limit_values_decrease_by_
-
-/**
- * Increase the size of the values array, but only if necesary.
- *
- * 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 values
- * The values 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_limit_values_increase_
- extern f_status_t f_limit_values_increase(const f_number_unsigned_t step, f_limit_values_t *values);
-#endif // _di_f_limit_values_increase_
-
-/**
- * Resize the values 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 values
- * The values 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_limit_values_increase_by_
- extern f_status_t f_limit_values_increase_by(const f_number_unsigned_t amount, f_limit_values_t *values);
-#endif // _di_f_limit_values_increase_by_
-
-/**
- * Resize the values array.
- *
- * @param length
- * The new size to use.
- * @param values
- * The values 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_limit_values_resize_
- extern f_status_t f_limit_values_resize(const f_number_unsigned_t length, f_limit_values_t *values);
-#endif // _di_f_limit_values_resize_
-
-/**
- * Resize the valuess array.
- *
- * @param length
- * The new size to use.
- * @param valuess
- * The valuess 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_dynamics_resize().
*
- * @see f_memory_array_adjust()
+ * @see f_string_dynamics_resize()
*/
-#ifndef _di_f_limit_valuess_adjust_
- extern f_status_t f_limit_valuess_adjust(const f_number_unsigned_t length, f_limit_valuess_t *valuess);
-#endif // _di_f_limit_valuess_adjust_
+#ifndef _di_f_limit_valuess_delete_callback_
+ extern f_status_t f_limit_valuess_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_limit_valuess_delete_callback_
/**
- * Append the single source values onto the destination.
- *
- * @param source
- * The source values to append.
- * @param destination
- * The destination ranges the source is appended onto.
- *
- * @return
- * F_okay 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_limit_valuess_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().
- * Errors (with error bit) from: f_memory_array_resize().
- *
- * @see f_memory_array_increase()
- * @see f_memory_array_resize()
- */
-#ifndef _di_f_limit_valuess_append_
- extern f_status_t f_limit_valuess_append(const f_limit_values_t source, f_limit_valuess_t *destination);
-#endif // _di_f_limit_valuess_append_
-
-/**
- * Append the source valuess onto the destination.
+ * This does not do parameter checking.
*
- * @param source
- * The source valuess 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_okay 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_limit_valuess_append_all_
- extern f_status_t f_limit_valuess_append_all(const f_limit_valuess_t source, f_limit_valuess_t *destination);
-#endif // _di_f_limit_valuess_append_all_
-
-/**
- * Resize the valuess 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 valuess
- * The valuess 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_limit_valuess_decimate_by_
- extern f_status_t f_limit_valuess_decimate_by(const f_number_unsigned_t amount, f_limit_valuess_t *valuess);
-#endif // _di_f_limit_valuess_decimate_by_
-
-/**
- * Resize the valuess 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 valuess
- * The valuess 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_limit_valuess_decrease_by_
- extern f_status_t f_limit_valuess_decrease_by(const f_number_unsigned_t amount, f_limit_valuess_t *valuess);
-#endif // _di_f_limit_valuess_decrease_by_
-
-/**
- * Increase the size of the valuess 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 valuess
- * The valuess 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_limit_valuess_increase_
- extern f_status_t f_limit_valuess_increase(const f_number_unsigned_t step, f_limit_valuess_t *valuess);
-#endif // _di_f_limit_valuess_increase_
-
-/**
- * Resize the valuess 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 valuess
- * The valuess 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_limit_valuess_increase_by_
- extern f_status_t f_limit_valuess_increase_by(const f_number_unsigned_t amount, f_limit_valuess_t *valuess);
-#endif // _di_f_limit_valuess_increase_by_
-
-/**
- * Resize the valuess array.
- *
- * @param length
- * The new size to use.
- * @param valuess
- * The valuess 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_dynamics_adjust().
*
- * @see f_memory_array_resize()
+ * @see f_string_dynamics_adjust()
*/
-#ifndef _di_f_limit_valuess_resize_
- extern f_status_t f_limit_valuess_resize(const f_number_unsigned_t length, f_limit_valuess_t *valuess);
-#endif // _di_f_limit_valuess_resize_
+#ifndef _di_f_limit_valuess_destroy_callback_
+ extern f_status_t f_limit_valuess_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_limit_valuess_destroy_callback_
#ifdef __cplusplus
} // extern "C"
build_libraries -lc
build_libraries-individual -lf_memory
-build_sources_library limit.c limit/set.c limit/value.c limit/private-set.c limit/private-value.c
+build_sources_library limit.c limit/set.c limit/value.c
build_sources_headers limit.h limit/set.h limit/value.h
build_libraries -lc
build_libraries-individual -lf_memory
-build_sources_library limit.c limit/set.c limit/value.c limit/private-set.c limit/private-value.c ../../tests/unit/c/mock-limit.c
+build_sources_library limit.c limit/set.c limit/value.c
+build_sources_library ../../tests/unit/c/mock-limit.c
build_sources_headers limit.h limit/set.h limit/value.h
flags_library -fPIC
# Inject mocks.
+flags -Wl,--wrap=f_memory_array_adjust
+flags -Wl,--wrap=f_memory_array_resize
flags -Wl,--wrap=prlimit
build_libraries-individual -lf_memory -lf_string -lf_type_array -lf_utf -lf_limit
build_sources_program test-limit-process.c
-build_sources_program test-limit-sets_adjust.c test-limit-sets_append.c test-limit-sets_append_all.c test-limit-sets_decimate_by.c test-limit-sets_decrease_by.c test-limit-sets_increase.c test-limit-sets_increase_by.c test-limit-sets_resize.c
-build_sources_program test-limit-setss_adjust.c test-limit-setss_append.c test-limit-setss_append_all.c test-limit-setss_decimate_by.c test-limit-setss_decrease_by.c test-limit-setss_increase.c test-limit-setss_increase_by.c test-limit-setss_resize.c
-build_sources_program test-limit-values_adjust.c test-limit-values_append.c test-limit-values_append_all.c test-limit-values_decimate_by.c test-limit-values_decrease_by.c test-limit-values_increase.c test-limit-values_increase_by.c test-limit-values_resize.c
-build_sources_program test-limit-valuess_adjust.c test-limit-valuess_append.c test-limit-valuess_append_all.c test-limit-valuess_decimate_by.c test-limit-valuess_decrease_by.c test-limit-valuess_increase.c test-limit-valuess_increase_by.c test-limit-valuess_resize.c
+build_sources_program test-limit-setss_delete_callback.c test-limit-setss_destroy_callback.c
+build_sources_program test-limit-valuess_delete_callback.c test-limit-valuess_destroy_callback.c
build_sources_program test-limit.c
build_script no
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);
+}
+
int __wrap_prlimit(pid_t pid, int resource, const struct rlimit *new_limit, struct rlimit *old_limit) {
const bool failure = mock_type(bool);
const static int mock_errno_generic = 32767;
+extern int mock_unwrap;
+extern int mock_unwrap_f_memory;
+
+extern f_status_t __real_f_memory_array_adjust(const f_number_unsigned_t length, const size_t width, void ** array, f_number_unsigned_t * const used, f_number_unsigned_t * const size);
+extern f_status_t __real_f_memory_array_resize(const f_number_unsigned_t length, const size_t width, void ** array, f_number_unsigned_t * const used, f_number_unsigned_t * const size);
+
+extern f_status_t __wrap_f_memory_array_adjust(const f_number_unsigned_t length, const size_t width, void ** array, f_number_unsigned_t * const used, f_number_unsigned_t * const size);
+extern f_status_t __wrap_f_memory_array_resize(const f_number_unsigned_t length, const size_t width, void ** array, f_number_unsigned_t * const used, f_number_unsigned_t * const size);
+
extern int __wrap_prlimit(pid_t pid, int resource, const struct rlimit *new_limit, struct rlimit *old_limit);
#ifdef __cplusplus
+++ /dev/null
-#include "test-limit.h"
-#include "test-limit-sets_adjust.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_limit_sets_adjust__parameter_checking(void **state) {
-
- const int length = 5;
- f_limit_sets_t data = f_limit_sets_t_initialize;
-
- {
- const f_status_t status = f_limit_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_limit_sets_adjust__works(void **state) {
-
- const int length = 5;
- f_limit_sets_t data = f_limit_sets_t_initialize;
-
- {
- const f_status_t status = f_limit_sets_adjust(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- free((void *) data.array);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
+++ /dev/null
-/**
- * FLL - Level 0
- *
- * Project: Limit
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the limit project.
- */
-#ifndef _TEST__F_limit__sets_adjust
-#define _TEST__F_limit__sets_adjust
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_limit_sets_adjust()
- */
-extern void test__f_limit_sets_adjust__parameter_checking(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_limit_sets_adjust()
- */
-extern void test__f_limit_sets_adjust__works(void **state);
-
-#endif // _TEST__F_limit__sets_adjust
+++ /dev/null
-#include "test-limit.h"
-#include "test-limit-sets_append.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_limit_sets_append__parameter_checking(void **state) {
-
- const f_limit_set_t data = f_limit_set_t_initialize;
-
- {
- const f_status_t status = f_limit_sets_append(data, 0);
-
- assert_int_equal(status, F_status_set_error(F_parameter));
- }
-}
-
-void test__f_limit_sets_append__works(void **state) {
-
- const f_limit_set_t source = macro_f_limit_set_t_initialize_1(1, macro_f_limit_value_t_initialize_1(2, 3));
- f_limit_sets_t destination = f_limit_sets_t_initialize;
-
- {
- const f_status_t status = f_limit_sets_append(source, &destination);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(destination.used, 1);
- assert_int_equal(destination.array[0].type, source.type);
- assert_int_equal(destination.array[0].value.rlim_cur, source.value.rlim_cur);
- assert_int_equal(destination.array[0].value.rlim_max, source.value.rlim_max);
- }
-
- free((void *) destination.array);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
+++ /dev/null
-/**
- * FLL - Level 0
- *
- * Project: Limit
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the limit project.
- */
-#ifndef _TEST__F_limit__sets_append
-#define _TEST__F_limit__sets_append
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_limit_sets_append()
- */
-extern void test__f_limit_sets_append__parameter_checking(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_limit_sets_append()
- */
-extern void test__f_limit_sets_append__works(void **state);
-
-#endif // _TEST__F_limit__sets_append
+++ /dev/null
-#include "test-limit.h"
-#include "test-limit-sets_append_all.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_limit_sets_append_all__parameter_checking(void **state) {
-
- const f_limit_sets_t data = f_limit_sets_t_initialize;
-
- {
- const f_status_t status = f_limit_sets_append_all(data, 0);
-
- assert_int_equal(status, F_status_set_error(F_parameter));
- }
-}
-
-void test__f_limit_sets_append_all__returns_data_not(void **state) {
-
- const int length = 5;
- f_limit_sets_t source = f_limit_sets_t_initialize;
- f_limit_sets_t destination = f_limit_sets_t_initialize;
-
- {
- const f_status_t status = f_limit_sets_resize(length, &source);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(source.used, 0);
- assert_int_equal(source.size, length);
- }
-
- {
- const f_status_t status = f_limit_sets_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_limit_sets_append_all__works(void **state) {
-
- const int length = 5;
- const int length_used = 2;
- f_limit_sets_t source = f_limit_sets_t_initialize;
- f_limit_sets_t destination = f_limit_sets_t_initialize;
-
- {
- const f_status_t status = f_limit_sets_resize(length, &source);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(source.used, 0);
- assert_int_equal(source.size, length);
- }
-
- for (; source.used < length_used; ++source.used) {
-
- source.array[source.used].type = source.used + 1;
- source.array[source.used].value.rlim_cur = source.used + 2;
- source.array[source.used].value.rlim_max = source.used + 3;
- } // for
- {
- const f_status_t status = f_limit_sets_append_all(source, &destination);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(destination.used, source.used);
- assert_int_equal(destination.size, source.used);
-
- for (f_number_unsigned_t i = 0; i < source.used; ++i) {
-
- assert_int_equal(destination.array[i].type, i + 1);
- assert_int_equal(destination.array[i].value.rlim_cur, i + 2);
- assert_int_equal(destination.array[i].value.rlim_max, i + 3);
- } // for
- }
-
- free((void *) source.array);
- free((void *) destination.array);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
+++ /dev/null
-/**
- * FLL - Level 0
- *
- * Project: Limit
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the limit project.
- */
-#ifndef _TEST__F_limit__sets_append_all
-#define _TEST__F_limit__sets_append_all
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_limit_sets_append_all()
- */
-extern void test__f_limit_sets_append_all__parameter_checking(void **state);
-
-/**
- * Test that the function returns F_data_not.
- *
- * @see f_limit_sets_append_all()
- */
-extern void test__f_limit_sets_append_all__returns_data_not(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_limit_sets_append_all()
- */
-extern void test__f_limit_sets_append_all__works(void **state);
-
-#endif // _TEST__F_limit__sets_append_all
+++ /dev/null
-#include "test-limit.h"
-#include "test-limit-sets_decimate_by.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_limit_sets_decimate_by__parameter_checking(void **state) {
-
- const int length = 5;
- f_limit_sets_t data = f_limit_sets_t_initialize;
-
- {
- const f_status_t status = f_limit_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_limit_sets_decimate_by__works(void **state) {
-
- const int length = 5;
- f_limit_sets_t data = f_limit_sets_t_initialize;
-
- {
- const f_status_t status = f_limit_sets_resize(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- {
- const f_status_t status = f_limit_sets_decimate_by(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, 0);
- }
-
- assert_null(data.array);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
+++ /dev/null
-/**
- * FLL - Level 0
- *
- * Project: Limit
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the limit project.
- */
-#ifndef _TEST__F_limit__sets_decimate_by
-#define _TEST__F_limit__sets_decimate_by
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_limit_sets_decimate_by()
- */
-extern void test__f_limit_sets_decimate_by__parameter_checking(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_limit_sets_decimate_by()
- */
-extern void test__f_limit_sets_decimate_by__works(void **state);
-
-#endif // _TEST__F_limit__sets_decimate_by
+++ /dev/null
-#include "test-limit.h"
-#include "test-limit-sets_decrease_by.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_limit_sets_decrease_by__parameter_checking(void **state) {
-
- const int length = 5;
- f_limit_sets_t data = f_limit_sets_t_initialize;
-
- {
- const f_status_t status = f_limit_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_limit_sets_decrease_by__works(void **state) {
-
- const int length = 5;
- f_limit_sets_t data = f_limit_sets_t_initialize;
-
- {
- const f_status_t status = f_limit_sets_resize(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- {
- const f_status_t status = f_limit_sets_decrease_by(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, 0);
- }
-
- assert_null(data.array);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
+++ /dev/null
-/**
- * FLL - Level 0
- *
- * Project: Limit
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the limit project.
- */
-#ifndef _TEST__F_limit__sets_decrease_by
-#define _TEST__F_limit__sets_decrease_by
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_limit_sets_decrease_by()
- */
-extern void test__f_limit_sets_decrease_by__parameter_checking(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_limit_sets_decrease_by()
- */
-extern void test__f_limit_sets_decrease_by__works(void **state);
-
-#endif // _TEST__F_limit__sets_decrease_by
+++ /dev/null
-#include "test-limit.h"
-#include "test-limit-sets_increase.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_limit_sets_increase__parameter_checking(void **state) {
-
- const int length = 5;
- f_limit_sets_t data = f_limit_sets_t_initialize;
-
- {
- const f_status_t status = f_limit_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_limit_sets_increase__returns_data_not(void **state) {
-
- const int length = 5;
- f_limit_sets_t data = f_limit_sets_t_initialize;
-
- {
- const f_status_t status = f_limit_sets_resize(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- {
- const f_status_t status = f_limit_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_limit_sets_increase__works(void **state) {
-
- const int length = 5;
- f_limit_sets_t data = f_limit_sets_t_initialize;
-
- {
- const f_status_t status = f_limit_sets_resize(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- {
- data.used = length;
-
- const f_status_t status = f_limit_sets_increase(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, length);
- assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d);
- }
-
- free((void *) data.array);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
+++ /dev/null
-/**
- * FLL - Level 0
- *
- * Project: Limit
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the limit project.
- */
-#ifndef _TEST__F_limit__sets_increase
-#define _TEST__F_limit__sets_increase
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_limit_sets_increase()
- */
-extern void test__f_limit_sets_increase__parameter_checking(void **state);
-
-/**
- * Test that the function returns F_data_not.
- *
- * @see f_limit_sets_increase()
- */
-extern void test__f_limit_sets_increase__returns_data_not(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_limit_sets_increase()
- */
-extern void test__f_limit_sets_increase__works(void **state);
-
-#endif // _TEST__F_limit__sets_increase
+++ /dev/null
-#include "test-limit.h"
-#include "test-limit-sets_increase_by.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_limit_sets_increase_by__parameter_checking(void **state) {
-
- const int length = 5;
- f_limit_sets_t data = f_limit_sets_t_initialize;
-
- {
- const f_status_t status = f_limit_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_limit_sets_increase_by__works(void **state) {
-
- const int length = 5;
- f_limit_sets_t data = f_limit_sets_t_initialize;
-
- {
- const f_status_t status = f_limit_sets_resize(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- {
- data.used = length;
-
- const f_status_t status = f_limit_sets_increase_by(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, length);
- assert_int_equal(data.size, length * 2);
- }
-
- free((void *) data.array);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
+++ /dev/null
-/**
- * FLL - Level 0
- *
- * Project: Limit
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the limit project.
- */
-#ifndef _TEST__F_limit__sets_increase_by
-#define _TEST__F_limit__sets_increase_by
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_limit_sets_increase_by()
- */
-extern void test__f_limit_sets_increase_by__parameter_checking(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_limit_sets_increase_by()
- */
-extern void test__f_limit_sets_increase_by__works(void **state);
-
-#endif // _TEST__F_limit__sets_increase_by
+++ /dev/null
-#include "test-limit.h"
-#include "test-limit-sets_resize.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_limit_sets_resize__parameter_checking(void **state) {
-
- const int length = 5;
- f_limit_sets_t data = f_limit_sets_t_initialize;
-
- {
- const f_status_t status = f_limit_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_limit_sets_resize__works(void **state) {
-
- const int length = 5;
- f_limit_sets_t data = f_limit_sets_t_initialize;
-
- {
- const f_status_t status = f_limit_sets_resize(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- free((void *) data.array);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
+++ /dev/null
-/**
- * FLL - Level 0
- *
- * Project: Limit
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the limit project.
- */
-#ifndef _TEST__F_limit__sets_resize
-#define _TEST__F_limit__sets_resize
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_limit_sets_resize()
- */
-extern void test__f_limit_sets_resize__parameter_checking(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_limit_sets_resize()
- */
-extern void test__f_limit_sets_resize__works(void **state);
-
-#endif // _TEST__F_limit__sets_resize
+++ /dev/null
-#include "test-limit.h"
-#include "test-limit-setss_adjust.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_limit_setss_adjust__parameter_checking(void **state) {
-
- const int length = 5;
- f_limit_setss_t data = f_limit_setss_t_initialize;
-
- {
- const f_status_t status = f_limit_setss_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_limit_setss_adjust__works(void **state) {
-
- const int length = 5;
- f_limit_setss_t data = f_limit_setss_t_initialize;
-
- {
- const f_status_t status = f_limit_setss_adjust(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- free((void *) data.array);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
+++ /dev/null
-/**
- * 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_limit__setss_adjust
-#define _TEST__F_limit__setss_adjust
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_limit_setss_adjust()
- */
-extern void test__f_limit_setss_adjust__parameter_checking(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_limit_setss_adjust()
- */
-extern void test__f_limit_setss_adjust__works(void **state);
-
-#endif // _TEST__F_limit__setss_adjust
+++ /dev/null
-#include "test-limit.h"
-#include "test-limit-setss_append.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_limit_setss_append__parameter_checking(void **state) {
-
- f_limit_sets_t data = f_limit_setss_t_initialize;
-
- {
- const f_status_t status = f_limit_setss_append(data, 0);
-
- assert_int_equal(status, F_status_set_error(F_parameter));
- }
-}
-
-void test__f_limit_setss_append__returns_data_not(void **state) {
-
- const int length = 5;
- f_limit_sets_t source = f_limit_setss_t_initialize;
- f_limit_setss_t destination = f_limit_setss_t_initialize;
-
- {
- const f_status_t status = f_limit_sets_resize(length, &source);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(source.used, 0);
- assert_int_equal(source.size, length);
- }
-
- {
- const f_status_t status = f_limit_setss_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_limit_setss_append__works(void **state) {
-
- const int length = 5;
- f_limit_sets_t source = f_limit_setss_t_initialize;
- f_limit_setss_t destination = f_limit_setss_t_initialize;
-
- {
- const f_status_t status = f_limit_sets_resize(length, &source);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(source.used, 0);
- assert_int_equal(source.size, length);
- }
-
- for (; source.used < length; ++source.used) {
-
- source.array[source.used].type = source.used + 1;
- source.array[source.used].value.rlim_cur = source.used + 2;
- source.array[source.used].value.rlim_max = source.used + 3;
- } // for
-
- {
- const f_status_t status = f_limit_setss_append(source, &destination);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(destination.used, 1);
- assert_int_equal(destination.array[0].used, source.used);
- assert_int_equal(destination.array[0].size, source.used);
-
- for (f_number_unsigned_t i = 0; i < destination.array[0].used; ++i) {
-
- assert_int_equal(destination.array[0].array[i].type, i + 1);
- assert_int_equal(destination.array[0].array[i].value.rlim_cur, i + 2);
- assert_int_equal(destination.array[0].array[i].value.rlim_max, i + 3);
- } // for
- }
-
- for (f_number_unsigned_t i = 0; i < destination.used; ++i) {
- free((void *) destination.array[i].array);
- } // for
-
- free((void *) source.array);
- free((void *) destination.array);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
+++ /dev/null
-/**
- * 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_limit__setss_append
-#define _TEST__F_limit__setss_append
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_limit_setss_append()
- */
-extern void test__f_limit_setss_append__parameter_checking(void **state);
-
-/**
- * Test that the function returns F_data_not.
- *
- * @see f_limit_setss_append()
- */
-extern void test__f_limit_setss_append__returns_data_not(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_limit_setss_append()
- */
-extern void test__f_limit_setss_append__works(void **state);
-
-#endif // _TEST__F_limit__setss_append
+++ /dev/null
-#include "test-limit.h"
-#include "test-limit-setss_append_all.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_limit_setss_append_all__parameter_checking(void **state) {
-
- const f_limit_setss_t data = f_limit_setss_t_initialize;
-
- {
- const f_status_t status = f_limit_setss_append_all(data, 0);
-
- assert_int_equal(status, F_status_set_error(F_parameter));
- }
-}
-
-void test__f_limit_setss_append_all__returns_data_not(void **state) {
-
- const int length = 5;
- f_limit_setss_t source = f_limit_setss_t_initialize;
- f_limit_setss_t destination = f_limit_setss_t_initialize;
-
- {
- const f_status_t status = f_limit_setss_resize(length, &source);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(source.used, 0);
- assert_int_equal(source.size, length);
- }
-
- {
- const f_status_t status = f_limit_setss_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_limit_setss_append_all__works(void **state) {
-
- const int length = 5;
- const int length_inner = 2;
- f_limit_setss_t source = f_limit_setss_t_initialize;
- f_limit_setss_t destination = f_limit_setss_t_initialize;
-
- {
- const f_status_t status = f_limit_setss_resize(length, &source);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(source.used, 0);
- assert_int_equal(source.size, length);
- }
-
- {
- for (; source.used < length; ++source.used) {
-
- const f_status_t status = f_limit_sets_resize(length_inner, &source.array[source.used]);
-
- assert_int_equal(status, F_okay);
-
- for (f_number_unsigned_t i = 0; i < length_inner; ++i) {
-
- source.array[source.used].array[i].type = i + 1;
- source.array[source.used].array[i].value.rlim_cur = i + 2;
- source.array[source.used].array[i].value.rlim_max = i + 3;
- } // for
-
- source.array[source.used].used = length_inner;
- } // for
- }
-
- {
- const f_status_t status = f_limit_setss_append_all(source, &destination);
-
- assert_int_equal(status, F_okay);
- 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);
-
- for (f_number_unsigned_t j = 0; j < length_inner; ++j) {
-
- assert_int_equal(destination.array[i].array[j].type, j + 1);
- assert_int_equal(destination.array[i].array[j].value.rlim_cur, j + 2);
- assert_int_equal(destination.array[i].array[j].value.rlim_max, j + 3);
- } // for
- } // 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) {
- free((void *) destination.array[i].array);
- } // for
-
- free((void *) source.array);
- free((void *) destination.array);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
+++ /dev/null
-/**
- * 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_limit__setss_append_all
-#define _TEST__F_limit__setss_append_all
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_limit_setss_append_all()
- */
-extern void test__f_limit_setss_append_all__parameter_checking(void **state);
-
-/**
- * Test that the function returns F_data_not.
- *
- * @see f_limit_setss_append_all()
- */
-extern void test__f_limit_setss_append_all__returns_data_not(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_limit_setss_append_all()
- */
-extern void test__f_limit_setss_append_all__works(void **state);
-
-#endif // _TEST__F_limit__setss_append_all
+++ /dev/null
-#include "test-limit.h"
-#include "test-limit-setss_decimate_by.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_limit_setss_decimate_by__parameter_checking(void **state) {
-
- const int length = 5;
- f_limit_setss_t data = f_limit_setss_t_initialize;
-
- {
- const f_status_t status = f_limit_setss_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_limit_setss_decimate_by__returns_data_not(void **state) {
-
- const int length = 5;
- f_limit_setss_t data = f_limit_setss_t_initialize;
-
- {
- const f_status_t status = f_limit_setss_resize(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- {
- const f_status_t status = f_limit_setss_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_limit_setss_decimate_by__works(void **state) {
-
- const int length = 5;
- f_limit_setss_t data = f_limit_setss_t_initialize;
-
- {
- const f_status_t status = f_limit_setss_resize(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- {
- const f_status_t status = f_limit_setss_decimate_by(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, 0);
- }
-
- assert_null(data.array);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
+++ /dev/null
-/**
- * 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_limit__setss_decimate_by
-#define _TEST__F_limit__setss_decimate_by
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_limit_setss_decimate_by()
- */
-extern void test__f_limit_setss_decimate_by__parameter_checking(void **state);
-
-/**
- * Test that the function returns F_data_not.
- *
- * @see f_limit_setss_decimate_by()
- */
-extern void test__f_limit_setss_decimate_by__returns_data_not(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_limit_setss_decimate_by()
- */
-extern void test__f_limit_setss_decimate_by__works(void **state);
-
-#endif // _TEST__F_limit__setss_decimate_by
+++ /dev/null
-#include "test-limit.h"
-#include "test-limit-setss_decrease_by.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_limit_setss_decrease_by__parameter_checking(void **state) {
-
- const int length = 5;
- f_limit_setss_t data = f_limit_setss_t_initialize;
-
- {
- const f_status_t status = f_limit_setss_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_limit_setss_decrease_by__returns_data_not(void **state) {
-
- const int length = 5;
- f_limit_setss_t data = f_limit_setss_t_initialize;
-
- {
- const f_status_t status = f_limit_setss_resize(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- {
- const f_status_t status = f_limit_setss_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_limit_setss_decrease_by__works(void **state) {
-
- const int length = 5;
- f_limit_setss_t data = f_limit_setss_t_initialize;
-
- {
- const f_status_t status = f_limit_setss_resize(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- {
- const f_status_t status = f_limit_setss_decrease_by(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, 0);
- }
-
- assert_null(data.array);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
+++ /dev/null
-/**
- * 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_limit__setss_decrease_by
-#define _TEST__F_limit__setss_decrease_by
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_limit_setss_decrease_by()
- */
-extern void test__f_limit_setss_decrease_by__parameter_checking(void **state);
-
-/**
- * Test that the function returns F_data_not.
- *
- * @see f_limit_setss_decrease_by()
- */
-extern void test__f_limit_setss_decrease_by__returns_data_not(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_limit_setss_decrease_by()
- */
-extern void test__f_limit_setss_decrease_by__works(void **state);
-
-#endif // _TEST__F_limit__setss_decrease_by
--- /dev/null
+#include "test-limit.h"
+#include "test-limit-setss_delete_callback.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_limit_setss_delete_callback__fails(void **state) {
+
+ mock_unwrap = 0;
+ mock_unwrap_f_memory = 0;
+
+ f_limit_set_t data = f_limit_set_t_initialize;
+ f_limit_set_t data_array[] = { data };
+ f_limit_sets_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_limit_sets_t datas_array[] = { datas };
+
+ {
+ will_return(__wrap_f_memory_array_resize, true);
+ will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure));
+
+ const f_status_t status = f_limit_setss_delete_callback(0, 1, (void *) datas_array);
+
+ assert_int_equal(status, F_status_set_error(F_failure));
+ }
+}
+
+void test__f_limit_setss_delete_callback__works(void **state) {
+
+ mock_unwrap = 1;
+ mock_unwrap_f_memory = 1;
+
+ const f_number_unsigned_t length = 1;
+
+ f_limit_setss_t datass = f_limit_setss_t_initialize;
+
+ {
+ f_status_t status = f_memory_array_resize(length, sizeof(f_limit_sets_t), (void **) &datass.array, &datass.used, &datass.size);
+ assert_int_equal(status, F_okay);
+
+ status = f_memory_array_resize(1, sizeof(f_limit_set_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size);
+ assert_int_equal(status, F_okay);
+ }
+
+ {
+ const f_status_t status = f_limit_setss_delete_callback(0, length, (void *) datass.array);
+
+ assert_int_equal(status, F_okay);
+ assert_int_equal(datass.array[0].size, 0);
+ }
+
+ free((void *) datass.array);
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Limit
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the type project.
+ */
+#ifndef _TEST__F_limit__setss_delete_callback
+#define _TEST__F_limit__setss_delete_callback
+
+/**
+ * Test that the function fails.
+ *
+ * @see f_limit_setss_delete_callback()
+ */
+extern void test__f_limit_setss_delete_callback__fails(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_limit_setss_delete_callback()
+ */
+extern void test__f_limit_setss_delete_callback__works(void **state);
+
+#endif // _TEST__F_limit__setss_delete_callback
--- /dev/null
+#include "test-limit.h"
+#include "test-limit-setss_destroy_callback.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_limit_setss_destroy_callback__fails(void **state) {
+
+ mock_unwrap = 0;
+ mock_unwrap_f_memory = 0;
+
+ f_limit_set_t data = f_limit_set_t_initialize;
+ f_limit_set_t data_array[] = { data };
+ f_limit_sets_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_limit_sets_t datas_array[] = { datas };
+
+ {
+ will_return(__wrap_f_memory_array_adjust, true);
+ will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure));
+
+ const f_status_t status = f_limit_setss_destroy_callback(0, 1, (void *) datas_array);
+
+ assert_int_equal(status, F_status_set_error(F_failure));
+ }
+}
+
+void test__f_limit_setss_destroy_callback__works(void **state) {
+
+ mock_unwrap = 1;
+ mock_unwrap_f_memory = 1;
+
+ const f_number_unsigned_t length = 1;
+
+ f_limit_setss_t datass = f_limit_setss_t_initialize;
+
+ {
+ f_status_t status = f_memory_array_adjust(length, sizeof(f_limit_sets_t), (void **) &datass.array, &datass.used, &datass.size);
+ assert_int_equal(status, F_okay);
+
+ status = f_memory_array_adjust(1, sizeof(f_limit_set_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size);
+ assert_int_equal(status, F_okay);
+ }
+
+ {
+ const f_status_t status = f_limit_setss_destroy_callback(0, length, (void *) datass.array);
+
+ assert_int_equal(status, F_okay);
+ assert_int_equal(datass.array[0].size, 0);
+ }
+
+ free((void *) datass.array);
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Limit
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the type project.
+ */
+#ifndef _TEST__F_limit__setss_destroy_callback
+#define _TEST__F_limit__setss_destroy_callback
+
+/**
+ * Test that the function fails.
+ *
+ * @see f_limit_setss_destroy_callback()
+ */
+extern void test__f_limit_setss_destroy_callback__fails(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_limit_setss_destroy_callback()
+ */
+extern void test__f_limit_setss_destroy_callback__works(void **state);
+
+#endif // _TEST__F_limit__setss_destroy_callback
+++ /dev/null
-#include "test-limit.h"
-#include "test-limit-setss_increase.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_limit_setss_increase__parameter_checking(void **state) {
-
- const int length = 5;
- f_limit_setss_t data = f_limit_setss_t_initialize;
-
- {
- const f_status_t status = f_limit_setss_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_limit_setss_increase__returns_data_not(void **state) {
-
- const int length = 5;
- f_limit_setss_t data = f_limit_setss_t_initialize;
-
- {
- const f_status_t status = f_limit_setss_resize(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- {
- const f_status_t status = f_limit_setss_increase(0, &data);
-
- assert_int_equal(status, F_data_not);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- {
- const f_status_t status = f_limit_setss_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_limit_setss_increase__works(void **state) {
-
- const int length = 5;
- f_limit_setss_t data = f_limit_setss_t_initialize;
-
- {
- const f_status_t status = f_limit_setss_resize(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- {
- data.used = length;
-
- const f_status_t status = f_limit_setss_increase(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, length);
- assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d);
- }
-
- free((void *) data.array);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
+++ /dev/null
-/**
- * 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_limit__setss_increase
-#define _TEST__F_limit__setss_increase
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_limit_setss_increase()
- */
-extern void test__f_limit_setss_increase__parameter_checking(void **state);
-
-/**
- * Test that the function returns F_data_not.
- *
- * @see f_limit_setss_increase()
- */
-extern void test__f_limit_setss_increase__returns_data_not(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_limit_setss_increase()
- */
-extern void test__f_limit_setss_increase__works(void **state);
-
-#endif // _TEST__F_limit__setss_increase
+++ /dev/null
-#include "test-limit.h"
-#include "test-limit-setss_increase_by.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_limit_setss_increase_by__parameter_checking(void **state) {
-
- const int length = 5;
- f_limit_setss_t data = f_limit_sets_t_initialize;
-
- {
- const f_status_t status = f_limit_setss_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_limit_setss_increase_by__returns_data_not(void **state) {
-
- const int length = 5;
- f_limit_setss_t data = f_limit_setss_t_initialize;
-
- {
- const f_status_t status = f_limit_setss_resize(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- {
- const f_status_t status = f_limit_setss_increase_by(0, &data);
-
- assert_int_equal(status, F_data_not);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- {
- const f_status_t status = f_limit_setss_increase_by(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_limit_setss_increase_by__works(void **state) {
-
- const int length = 5;
- f_limit_setss_t data = f_limit_sets_t_initialize;
-
- {
- const f_status_t status = f_limit_setss_resize(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- {
- data.used = length;
-
- const f_status_t status = f_limit_setss_increase_by(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, length);
- assert_int_equal(data.size, length * 2);
- }
-
- free((void *) data.array);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
+++ /dev/null
-/**
- * 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_limit__setss_increase_by
-#define _TEST__F_limit__setss_increase_by
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_limit_setss_increase_by()
- */
-extern void test__f_limit_setss_increase_by__parameter_checking(void **state);
-
-/**
- * Test that the function returns F_data_not.
- *
- * @see f_limit_setss_increase_by()
- */
-extern void test__f_limit_setss_increase_by__returns_data_not(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_limit_setss_increase_by()
- */
-extern void test__f_limit_setss_increase_by__works(void **state);
-
-#endif // _TEST__F_limit__setss_increase_by
+++ /dev/null
-#include "test-limit.h"
-#include "test-limit-setss_resize.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_limit_setss_resize__parameter_checking(void **state) {
-
- const int length = 5;
- f_limit_setss_t data = f_limit_setss_t_initialize;
-
- {
- const f_status_t status = f_limit_setss_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_limit_setss_resize__works(void **state) {
-
- const int length = 5;
- f_limit_setss_t data = f_limit_setss_t_initialize;
-
- {
- const f_status_t status = f_limit_setss_resize(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- free((void *) data.array);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
+++ /dev/null
-/**
- * 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_limit__setss_resize
-#define _TEST__F_limit__setss_resize
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_limit_setss_resize()
- */
-extern void test__f_limit_setss_resize__parameter_checking(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_limit_setss_resize()
- */
-extern void test__f_limit_setss_resize__works(void **state);
-
-#endif // _TEST__F_limit__setss_resize
+++ /dev/null
-#include "test-limit.h"
-#include "test-limit-values_adjust.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_limit_values_adjust__parameter_checking(void **state) {
-
- const int length = 5;
- f_limit_values_t data = f_limit_values_t_initialize;
-
- {
- const f_status_t status = f_limit_values_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_limit_values_adjust__works(void **state) {
-
- const int length = 5;
- f_limit_values_t data = f_limit_values_t_initialize;
-
- {
- const f_status_t status = f_limit_values_adjust(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- free((void *) data.array);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
+++ /dev/null
-/**
- * FLL - Level 0
- *
- * Project: Limit
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the limit project.
- */
-#ifndef _TEST__F_limit__values_adjust
-#define _TEST__F_limit__values_adjust
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_limit_values_adjust()
- */
-extern void test__f_limit_values_adjust__parameter_checking(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_limit_values_adjust()
- */
-extern void test__f_limit_values_adjust__works(void **state);
-
-#endif // _TEST__F_limit__values_adjust
+++ /dev/null
-#include "test-limit.h"
-#include "test-limit-values_append.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_limit_values_append__parameter_checking(void **state) {
-
- const f_limit_value_t data = f_limit_value_t_initialize;
-
- {
- const f_status_t status = f_limit_values_append(data, 0);
-
- assert_int_equal(status, F_status_set_error(F_parameter));
- }
-}
-
-void test__f_limit_values_append__works(void **state) {
-
- const f_limit_value_t source = macro_f_limit_value_t_initialize_1(1, 2);
- f_limit_values_t destination = f_limit_values_t_initialize;
-
- {
- const f_status_t status = f_limit_values_append(source, &destination);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(destination.used, 1);
- assert_int_equal(destination.array[0].rlim_cur, source.rlim_cur);
- assert_int_equal(destination.array[0].rlim_max, source.rlim_max);
- }
-
- free((void *) destination.array);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
+++ /dev/null
-/**
- * FLL - Level 0
- *
- * Project: Limit
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the limit project.
- */
-#ifndef _TEST__F_limit__values_append
-#define _TEST__F_limit__values_append
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_limit_values_append()
- */
-extern void test__f_limit_values_append__parameter_checking(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_limit_values_append()
- */
-extern void test__f_limit_values_append__works(void **state);
-
-#endif // _TEST__F_limit__values_append
+++ /dev/null
-#include "test-limit.h"
-#include "test-limit-values_append_all.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_limit_values_append_all__parameter_checking(void **state) {
-
- const f_limit_values_t data = f_limit_values_t_initialize;
-
- {
- const f_status_t status = f_limit_values_append_all(data, 0);
-
- assert_int_equal(status, F_status_set_error(F_parameter));
- }
-}
-
-void test__f_limit_values_append_all__returns_data_not(void **state) {
-
- const int length = 5;
- f_limit_values_t source = f_limit_values_t_initialize;
- f_limit_values_t destination = f_limit_values_t_initialize;
-
- {
- const f_status_t status = f_limit_values_resize(length, &source);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(source.used, 0);
- assert_int_equal(source.size, length);
- }
-
- {
- const f_status_t status = f_limit_values_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_limit_values_append_all__works(void **state) {
-
- const int length = 5;
- const int length_used = 2;
- f_limit_values_t source = f_limit_values_t_initialize;
- f_limit_values_t destination = f_limit_values_t_initialize;
-
- {
- const f_status_t status = f_limit_values_resize(length, &source);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(source.used, 0);
- assert_int_equal(source.size, length);
- }
-
- for (; source.used < length_used; ++source.used) {
-
- source.array[source.used].rlim_cur = source.used + 1;
- source.array[source.used].rlim_max = source.used + 2;
- } // for
- {
- const f_status_t status = f_limit_values_append_all(source, &destination);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(destination.used, source.used);
- assert_int_equal(destination.size, source.used);
-
- for (f_number_unsigned_t i = 0; i < source.used; ++i) {
-
- assert_int_equal(destination.array[i].rlim_cur, i + 1);
- assert_int_equal(destination.array[i].rlim_max, i + 2);
- } // for
- }
-
- free((void *) source.array);
- free((void *) destination.array);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
+++ /dev/null
-/**
- * FLL - Level 0
- *
- * Project: Limit
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the limit project.
- */
-#ifndef _TEST__F_limit__values_append_all
-#define _TEST__F_limit__values_append_all
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_limit_values_append_all()
- */
-extern void test__f_limit_values_append_all__parameter_checking(void **state);
-
-/**
- * Test that the function returns F_data_not.
- *
- * @see f_limit_values_append_all()
- */
-extern void test__f_limit_values_append_all__returns_data_not(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_limit_values_append_all()
- */
-extern void test__f_limit_values_append_all__works(void **state);
-
-#endif // _TEST__F_limit__values_append_all
+++ /dev/null
-#include "test-limit.h"
-#include "test-limit-values_decimate_by.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_limit_values_decimate_by__parameter_checking(void **state) {
-
- const int length = 5;
- f_limit_values_t data = f_limit_values_t_initialize;
-
- {
- const f_status_t status = f_limit_values_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_limit_values_decimate_by__works(void **state) {
-
- const int length = 5;
- f_limit_values_t data = f_limit_values_t_initialize;
-
- {
- const f_status_t status = f_limit_values_resize(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- {
- const f_status_t status = f_limit_values_decimate_by(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, 0);
- }
-
- assert_null(data.array);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
+++ /dev/null
-/**
- * FLL - Level 0
- *
- * Project: Limit
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the limit project.
- */
-#ifndef _TEST__F_limit__values_decimate_by
-#define _TEST__F_limit__values_decimate_by
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_limit_values_decimate_by()
- */
-extern void test__f_limit_values_decimate_by__parameter_checking(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_limit_values_decimate_by()
- */
-extern void test__f_limit_values_decimate_by__works(void **state);
-
-#endif // _TEST__F_limit__values_decimate_by
+++ /dev/null
-#include "test-limit.h"
-#include "test-limit-values_decrease_by.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_limit_values_decrease_by__parameter_checking(void **state) {
-
- const int length = 5;
- f_limit_values_t data = f_limit_values_t_initialize;
-
- {
- const f_status_t status = f_limit_values_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_limit_values_decrease_by__works(void **state) {
-
- const int length = 5;
- f_limit_values_t data = f_limit_values_t_initialize;
-
- {
- const f_status_t status = f_limit_values_resize(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- {
- const f_status_t status = f_limit_values_decrease_by(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, 0);
- }
-
- assert_null(data.array);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
+++ /dev/null
-/**
- * FLL - Level 0
- *
- * Project: Limit
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the limit project.
- */
-#ifndef _TEST__F_limit__values_decrease_by
-#define _TEST__F_limit__values_decrease_by
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_limit_values_decrease_by()
- */
-extern void test__f_limit_values_decrease_by__parameter_checking(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_limit_values_decrease_by()
- */
-extern void test__f_limit_values_decrease_by__works(void **state);
-
-#endif // _TEST__F_limit__values_decrease_by
+++ /dev/null
-#include "test-limit.h"
-#include "test-limit-values_increase.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_limit_values_increase__parameter_checking(void **state) {
-
- const int length = 5;
- f_limit_values_t data = f_limit_values_t_initialize;
-
- {
- const f_status_t status = f_limit_values_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_limit_values_increase__returns_data_not(void **state) {
-
- const int length = 5;
- f_limit_values_t data = f_limit_values_t_initialize;
-
- {
- const f_status_t status = f_limit_values_resize(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- {
- const f_status_t status = f_limit_values_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_limit_values_increase__works(void **state) {
-
- const int length = 5;
- f_limit_values_t data = f_limit_values_t_initialize;
-
- {
- const f_status_t status = f_limit_values_resize(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- {
- data.used = length;
-
- const f_status_t status = f_limit_values_increase(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, length);
- assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d);
- }
-
- free((void *) data.array);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
+++ /dev/null
-/**
- * FLL - Level 0
- *
- * Project: Limit
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the limit project.
- */
-#ifndef _TEST__F_limit__values_increase
-#define _TEST__F_limit__values_increase
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_limit_values_increase()
- */
-extern void test__f_limit_values_increase__parameter_checking(void **state);
-
-/**
- * Test that the function returns F_data_not.
- *
- * @see f_limit_values_increase()
- */
-extern void test__f_limit_values_increase__returns_data_not(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_limit_values_increase()
- */
-extern void test__f_limit_values_increase__works(void **state);
-
-#endif // _TEST__F_limit__values_increase
+++ /dev/null
-#include "test-limit.h"
-#include "test-limit-values_increase_by.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_limit_values_increase_by__parameter_checking(void **state) {
-
- const int length = 5;
- f_limit_values_t data = f_limit_values_t_initialize;
-
- {
- const f_status_t status = f_limit_values_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_limit_values_increase_by__works(void **state) {
-
- const int length = 5;
- f_limit_values_t data = f_limit_values_t_initialize;
-
- {
- const f_status_t status = f_limit_values_resize(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- {
- data.used = length;
-
- const f_status_t status = f_limit_values_increase_by(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, length);
- assert_int_equal(data.size, length * 2);
- }
-
- free((void *) data.array);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
+++ /dev/null
-/**
- * FLL - Level 0
- *
- * Project: Limit
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the limit project.
- */
-#ifndef _TEST__F_limit__values_increase_by
-#define _TEST__F_limit__values_increase_by
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_limit_values_increase_by()
- */
-extern void test__f_limit_values_increase_by__parameter_checking(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_limit_values_increase_by()
- */
-extern void test__f_limit_values_increase_by__works(void **state);
-
-#endif // _TEST__F_limit__values_increase_by
+++ /dev/null
-#include "test-limit.h"
-#include "test-limit-values_resize.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_limit_values_resize__parameter_checking(void **state) {
-
- const int length = 5;
- f_limit_values_t data = f_limit_values_t_initialize;
-
- {
- const f_status_t status = f_limit_values_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_limit_values_resize__works(void **state) {
-
- const int length = 5;
- f_limit_values_t data = f_limit_values_t_initialize;
-
- {
- const f_status_t status = f_limit_values_resize(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- free((void *) data.array);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
+++ /dev/null
-/**
- * FLL - Level 0
- *
- * Project: Limit
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the limit project.
- */
-#ifndef _TEST__F_limit__values_resize
-#define _TEST__F_limit__values_resize
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_limit_values_resize()
- */
-extern void test__f_limit_values_resize__parameter_checking(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_limit_values_resize()
- */
-extern void test__f_limit_values_resize__works(void **state);
-
-#endif // _TEST__F_limit__values_resize
+++ /dev/null
-#include "test-limit.h"
-#include "test-limit-valuess_adjust.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_limit_valuess_adjust__parameter_checking(void **state) {
-
- const int length = 5;
- f_limit_valuess_t data = f_limit_valuess_t_initialize;
-
- {
- const f_status_t status = f_limit_valuess_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_limit_valuess_adjust__works(void **state) {
-
- const int length = 5;
- f_limit_valuess_t data = f_limit_valuess_t_initialize;
-
- {
- const f_status_t status = f_limit_valuess_adjust(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- free((void *) data.array);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
+++ /dev/null
-/**
- * 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_limit__valuess_adjust
-#define _TEST__F_limit__valuess_adjust
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_limit_valuess_adjust()
- */
-extern void test__f_limit_valuess_adjust__parameter_checking(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_limit_valuess_adjust()
- */
-extern void test__f_limit_valuess_adjust__works(void **state);
-
-#endif // _TEST__F_limit__valuess_adjust
+++ /dev/null
-#include "test-limit.h"
-#include "test-limit-valuess_append.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_limit_valuess_append__parameter_checking(void **state) {
-
- f_limit_values_t data = f_limit_valuess_t_initialize;
-
- {
- const f_status_t status = f_limit_valuess_append(data, 0);
-
- assert_int_equal(status, F_status_set_error(F_parameter));
- }
-}
-
-void test__f_limit_valuess_append__returns_data_not(void **state) {
-
- const int length = 5;
- f_limit_values_t source = f_limit_valuess_t_initialize;
- f_limit_valuess_t destination = f_limit_valuess_t_initialize;
-
- {
- const f_status_t status = f_limit_values_resize(length, &source);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(source.used, 0);
- assert_int_equal(source.size, length);
- }
-
- {
- const f_status_t status = f_limit_valuess_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_limit_valuess_append__works(void **state) {
-
- const int length = 5;
- f_limit_values_t source = f_limit_valuess_t_initialize;
- f_limit_valuess_t destination = f_limit_valuess_t_initialize;
-
- {
- const f_status_t status = f_limit_values_resize(length, &source);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(source.used, 0);
- assert_int_equal(source.size, length);
- }
-
- for (; source.used < length; ++source.used) {
-
- source.array[source.used].rlim_cur = source.used + 1;
- source.array[source.used].rlim_max = source.used + 2;
- } // for
-
- {
- const f_status_t status = f_limit_valuess_append(source, &destination);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(destination.used, 1);
- assert_int_equal(destination.array[0].used, source.used);
- assert_int_equal(destination.array[0].size, source.used);
-
- for (f_number_unsigned_t i = 0; i < destination.array[0].used; ++i) {
-
- assert_int_equal(destination.array[0].array[i].rlim_cur, i + 1);
- assert_int_equal(destination.array[0].array[i].rlim_max, i + 2);
- } // for
- }
-
- for (f_number_unsigned_t i = 0; i < destination.used; ++i) {
- free((void *) destination.array[i].array);
- } // for
-
- free((void *) source.array);
- free((void *) destination.array);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
+++ /dev/null
-/**
- * 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_limit__valuess_append
-#define _TEST__F_limit__valuess_append
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_limit_valuess_append()
- */
-extern void test__f_limit_valuess_append__parameter_checking(void **state);
-
-/**
- * Test that the function returns F_data_not.
- *
- * @see f_limit_valuess_append()
- */
-extern void test__f_limit_valuess_append__returns_data_not(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_limit_valuess_append()
- */
-extern void test__f_limit_valuess_append__works(void **state);
-
-#endif // _TEST__F_limit__valuess_append
+++ /dev/null
-#include "test-limit.h"
-#include "test-limit-valuess_append_all.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_limit_valuess_append_all__parameter_checking(void **state) {
-
- const f_limit_valuess_t data = f_limit_valuess_t_initialize;
-
- {
- const f_status_t status = f_limit_valuess_append_all(data, 0);
-
- assert_int_equal(status, F_status_set_error(F_parameter));
- }
-}
-
-void test__f_limit_valuess_append_all__returns_data_not(void **state) {
-
- const int length = 5;
- f_limit_valuess_t source = f_limit_valuess_t_initialize;
- f_limit_valuess_t destination = f_limit_valuess_t_initialize;
-
- {
- const f_status_t status = f_limit_valuess_resize(length, &source);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(source.used, 0);
- assert_int_equal(source.size, length);
- }
-
- {
- const f_status_t status = f_limit_valuess_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_limit_valuess_append_all__works(void **state) {
-
- const int length = 5;
- const int length_inner = 2;
- f_limit_valuess_t source = f_limit_valuess_t_initialize;
- f_limit_valuess_t destination = f_limit_valuess_t_initialize;
-
- {
- const f_status_t status = f_limit_valuess_resize(length, &source);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(source.used, 0);
- assert_int_equal(source.size, length);
- }
-
- {
- for (; source.used < length; ++source.used) {
-
- const f_status_t status = f_limit_values_resize(length_inner, &source.array[source.used]);
-
- assert_int_equal(status, F_okay);
-
- for (f_number_unsigned_t i = 0; i < length_inner; ++i) {
-
- source.array[source.used].array[i].rlim_cur = i + 1;
- source.array[source.used].array[i].rlim_max = i + 2;
- } // for
-
- source.array[source.used].used = length_inner;
- } // for
- }
-
- {
- const f_status_t status = f_limit_valuess_append_all(source, &destination);
-
- assert_int_equal(status, F_okay);
- 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);
-
- for (f_number_unsigned_t j = 0; j < length_inner; ++j) {
-
- assert_int_equal(destination.array[i].array[j].rlim_cur, j + 1);
- assert_int_equal(destination.array[i].array[j].rlim_max, j + 2);
- } // for
- } // 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) {
- free((void *) destination.array[i].array);
- } // for
-
- free((void *) source.array);
- free((void *) destination.array);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
+++ /dev/null
-/**
- * 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_limit__valuess_append_all
-#define _TEST__F_limit__valuess_append_all
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_limit_valuess_append_all()
- */
-extern void test__f_limit_valuess_append_all__parameter_checking(void **state);
-
-/**
- * Test that the function returns F_data_not.
- *
- * @see f_limit_valuess_append_all()
- */
-extern void test__f_limit_valuess_append_all__returns_data_not(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_limit_valuess_append_all()
- */
-extern void test__f_limit_valuess_append_all__works(void **state);
-
-#endif // _TEST__F_limit__valuess_append_all
+++ /dev/null
-#include "test-limit.h"
-#include "test-limit-valuess_decimate_by.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_limit_valuess_decimate_by__parameter_checking(void **state) {
-
- const int length = 5;
- f_limit_valuess_t data = f_limit_valuess_t_initialize;
-
- {
- const f_status_t status = f_limit_valuess_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_limit_valuess_decimate_by__returns_data_not(void **state) {
-
- const int length = 5;
- f_limit_valuess_t data = f_limit_valuess_t_initialize;
-
- {
- const f_status_t status = f_limit_valuess_resize(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- {
- const f_status_t status = f_limit_valuess_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_limit_valuess_decimate_by__works(void **state) {
-
- const int length = 5;
- f_limit_valuess_t data = f_limit_valuess_t_initialize;
-
- {
- const f_status_t status = f_limit_valuess_resize(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- {
- const f_status_t status = f_limit_valuess_decimate_by(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, 0);
- }
-
- assert_null(data.array);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
+++ /dev/null
-/**
- * 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_limit__valuess_decimate_by
-#define _TEST__F_limit__valuess_decimate_by
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_limit_valuess_decimate_by()
- */
-extern void test__f_limit_valuess_decimate_by__parameter_checking(void **state);
-
-/**
- * Test that the function returns F_data_not.
- *
- * @see f_limit_valuess_decimate_by()
- */
-extern void test__f_limit_valuess_decimate_by__returns_data_not(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_limit_valuess_decimate_by()
- */
-extern void test__f_limit_valuess_decimate_by__works(void **state);
-
-#endif // _TEST__F_limit__valuess_decimate_by
+++ /dev/null
-#include "test-limit.h"
-#include "test-limit-valuess_decrease_by.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_limit_valuess_decrease_by__parameter_checking(void **state) {
-
- const int length = 5;
- f_limit_valuess_t data = f_limit_valuess_t_initialize;
-
- {
- const f_status_t status = f_limit_valuess_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_limit_valuess_decrease_by__returns_data_not(void **state) {
-
- const int length = 5;
- f_limit_valuess_t data = f_limit_valuess_t_initialize;
-
- {
- const f_status_t status = f_limit_valuess_resize(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- {
- const f_status_t status = f_limit_valuess_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_limit_valuess_decrease_by__works(void **state) {
-
- const int length = 5;
- f_limit_valuess_t data = f_limit_valuess_t_initialize;
-
- {
- const f_status_t status = f_limit_valuess_resize(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- {
- const f_status_t status = f_limit_valuess_decrease_by(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, 0);
- }
-
- assert_null(data.array);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
+++ /dev/null
-/**
- * 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_limit__valuess_decrease_by
-#define _TEST__F_limit__valuess_decrease_by
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_limit_valuess_decrease_by()
- */
-extern void test__f_limit_valuess_decrease_by__parameter_checking(void **state);
-
-/**
- * Test that the function returns F_data_not.
- *
- * @see f_limit_valuess_decrease_by()
- */
-extern void test__f_limit_valuess_decrease_by__returns_data_not(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_limit_valuess_decrease_by()
- */
-extern void test__f_limit_valuess_decrease_by__works(void **state);
-
-#endif // _TEST__F_limit__valuess_decrease_by
--- /dev/null
+#include "test-limit.h"
+#include "test-limit-valuess_delete_callback.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_limit_valuess_delete_callback__fails(void **state) {
+
+ mock_unwrap = 0;
+ mock_unwrap_f_memory = 0;
+
+ f_limit_value_t data = f_limit_value_t_initialize;
+ f_limit_value_t data_array[] = { data };
+ f_limit_values_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_limit_values_t datas_array[] = { datas };
+
+ {
+ will_return(__wrap_f_memory_array_resize, true);
+ will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure));
+
+ const f_status_t status = f_limit_valuess_delete_callback(0, 1, (void *) datas_array);
+
+ assert_int_equal(status, F_status_set_error(F_failure));
+ }
+}
+
+void test__f_limit_valuess_delete_callback__works(void **state) {
+
+ mock_unwrap = 1;
+ mock_unwrap_f_memory = 1;
+
+ const f_number_unsigned_t length = 1;
+
+ f_limit_valuess_t datass = f_limit_valuess_t_initialize;
+
+ {
+ f_status_t status = f_memory_array_resize(length, sizeof(f_limit_values_t), (void **) &datass.array, &datass.used, &datass.size);
+ assert_int_equal(status, F_okay);
+
+ status = f_memory_array_resize(1, sizeof(f_limit_value_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size);
+ assert_int_equal(status, F_okay);
+ }
+
+ {
+ const f_status_t status = f_limit_valuess_delete_callback(0, length, (void *) datass.array);
+
+ assert_int_equal(status, F_okay);
+ assert_int_equal(datass.array[0].size, 0);
+ }
+
+ free((void *) datass.array);
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Limit
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the type project.
+ */
+#ifndef _TEST__F_limit__valuess_delete_callback
+#define _TEST__F_limit__valuess_delete_callback
+
+/**
+ * Test that the function fails.
+ *
+ * @see f_limit_valuess_delete_callback()
+ */
+extern void test__f_limit_valuess_delete_callback__fails(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_limit_valuess_delete_callback()
+ */
+extern void test__f_limit_valuess_delete_callback__works(void **state);
+
+#endif // _TEST__F_limit__valuess_delete_callback
--- /dev/null
+#include "test-limit.h"
+#include "test-limit-valuess_destroy_callback.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_limit_valuess_destroy_callback__fails(void **state) {
+
+ mock_unwrap = 0;
+ mock_unwrap_f_memory = 0;
+
+ f_limit_value_t data = f_limit_value_t_initialize;
+ f_limit_value_t data_array[] = { data };
+ f_limit_values_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_limit_values_t datas_array[] = { datas };
+
+ {
+ will_return(__wrap_f_memory_array_adjust, true);
+ will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure));
+
+ const f_status_t status = f_limit_valuess_destroy_callback(0, 1, (void *) datas_array);
+
+ assert_int_equal(status, F_status_set_error(F_failure));
+ }
+}
+
+void test__f_limit_valuess_destroy_callback__works(void **state) {
+
+ mock_unwrap = 1;
+ mock_unwrap_f_memory = 1;
+
+ const f_number_unsigned_t length = 1;
+
+ f_limit_valuess_t datass = f_limit_valuess_t_initialize;
+
+ {
+ f_status_t status = f_memory_array_adjust(length, sizeof(f_limit_values_t), (void **) &datass.array, &datass.used, &datass.size);
+ assert_int_equal(status, F_okay);
+
+ status = f_memory_array_adjust(1, sizeof(f_limit_value_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size);
+ assert_int_equal(status, F_okay);
+ }
+
+ {
+ const f_status_t status = f_limit_valuess_destroy_callback(0, length, (void *) datass.array);
+
+ assert_int_equal(status, F_okay);
+ assert_int_equal(datass.array[0].size, 0);
+ }
+
+ free((void *) datass.array);
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Limit
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the type project.
+ */
+#ifndef _TEST__F_limit__valuess_destroy_callback
+#define _TEST__F_limit__valuess_destroy_callback
+
+/**
+ * Test that the function fails.
+ *
+ * @see f_limit_valuess_destroy_callback()
+ */
+extern void test__f_limit_valuess_destroy_callback__fails(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_limit_valuess_destroy_callback()
+ */
+extern void test__f_limit_valuess_destroy_callback__works(void **state);
+
+#endif // _TEST__F_limit__valuess_destroy_callback
+++ /dev/null
-#include "test-limit.h"
-#include "test-limit-valuess_increase.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_limit_valuess_increase__parameter_checking(void **state) {
-
- const int length = 5;
- f_limit_valuess_t data = f_limit_valuess_t_initialize;
-
- {
- const f_status_t status = f_limit_valuess_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_limit_valuess_increase__returns_data_not(void **state) {
-
- const int length = 5;
- f_limit_valuess_t data = f_limit_valuess_t_initialize;
-
- {
- const f_status_t status = f_limit_valuess_resize(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- {
- const f_status_t status = f_limit_valuess_increase(0, &data);
-
- assert_int_equal(status, F_data_not);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- {
- const f_status_t status = f_limit_valuess_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_limit_valuess_increase__works(void **state) {
-
- const int length = 5;
- f_limit_valuess_t data = f_limit_valuess_t_initialize;
-
- {
- const f_status_t status = f_limit_valuess_resize(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- {
- data.used = length;
-
- const f_status_t status = f_limit_valuess_increase(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, length);
- assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d);
- }
-
- free((void *) data.array);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
+++ /dev/null
-/**
- * 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_limit__valuess_increase
-#define _TEST__F_limit__valuess_increase
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_limit_valuess_increase()
- */
-extern void test__f_limit_valuess_increase__parameter_checking(void **state);
-
-/**
- * Test that the function returns F_data_not.
- *
- * @see f_limit_valuess_increase()
- */
-extern void test__f_limit_valuess_increase__returns_data_not(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_limit_valuess_increase()
- */
-extern void test__f_limit_valuess_increase__works(void **state);
-
-#endif // _TEST__F_limit__valuess_increase
+++ /dev/null
-#include "test-limit.h"
-#include "test-limit-valuess_increase_by.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_limit_valuess_increase_by__parameter_checking(void **state) {
-
- const int length = 5;
- f_limit_valuess_t data = f_limit_values_t_initialize;
-
- {
- const f_status_t status = f_limit_valuess_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_limit_valuess_increase_by__returns_data_not(void **state) {
-
- const int length = 5;
- f_limit_valuess_t data = f_limit_valuess_t_initialize;
-
- {
- const f_status_t status = f_limit_valuess_resize(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- {
- const f_status_t status = f_limit_valuess_increase_by(0, &data);
-
- assert_int_equal(status, F_data_not);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- {
- const f_status_t status = f_limit_valuess_increase_by(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_limit_valuess_increase_by__works(void **state) {
-
- const int length = 5;
- f_limit_valuess_t data = f_limit_values_t_initialize;
-
- {
- const f_status_t status = f_limit_valuess_resize(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- {
- data.used = length;
-
- const f_status_t status = f_limit_valuess_increase_by(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, length);
- assert_int_equal(data.size, length * 2);
- }
-
- free((void *) data.array);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
+++ /dev/null
-/**
- * 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_limit__valuess_increase_by
-#define _TEST__F_limit__valuess_increase_by
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_limit_valuess_increase_by()
- */
-extern void test__f_limit_valuess_increase_by__parameter_checking(void **state);
-
-/**
- * Test that the function returns F_data_not.
- *
- * @see f_limit_valuess_increase_by()
- */
-extern void test__f_limit_valuess_increase_by__returns_data_not(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_limit_valuess_increase_by()
- */
-extern void test__f_limit_valuess_increase_by__works(void **state);
-
-#endif // _TEST__F_limit__valuess_increase_by
+++ /dev/null
-#include "test-limit.h"
-#include "test-limit-valuess_resize.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_limit_valuess_resize__parameter_checking(void **state) {
-
- const int length = 5;
- f_limit_valuess_t data = f_limit_valuess_t_initialize;
-
- {
- const f_status_t status = f_limit_valuess_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_limit_valuess_resize__works(void **state) {
-
- const int length = 5;
- f_limit_valuess_t data = f_limit_valuess_t_initialize;
-
- {
- const f_status_t status = f_limit_valuess_resize(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- free((void *) data.array);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
+++ /dev/null
-/**
- * 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_limit__valuess_resize
-#define _TEST__F_limit__valuess_resize
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_limit_valuess_resize()
- */
-extern void test__f_limit_valuess_resize__parameter_checking(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_limit_valuess_resize()
- */
-extern void test__f_limit_valuess_resize__works(void **state);
-
-#endif // _TEST__F_limit__valuess_resize
cmocka_unit_test(test__f_limit_process__fails),
cmocka_unit_test(test__f_limit_process__works),
- cmocka_unit_test(test__f_limit_sets_adjust__works),
- cmocka_unit_test(test__f_limit_sets_append__works),
- cmocka_unit_test(test__f_limit_sets_append_all__works),
- cmocka_unit_test(test__f_limit_sets_decimate_by__works),
- cmocka_unit_test(test__f_limit_sets_decrease_by__works),
- cmocka_unit_test(test__f_limit_sets_increase__works),
- cmocka_unit_test(test__f_limit_sets_increase_by__works),
- cmocka_unit_test(test__f_limit_sets_resize__works),
-
- cmocka_unit_test(test__f_limit_setss_append__returns_data_not),
- cmocka_unit_test(test__f_limit_setss_append_all__returns_data_not),
- cmocka_unit_test(test__f_limit_setss_decimate_by__returns_data_not),
- cmocka_unit_test(test__f_limit_setss_decrease_by__returns_data_not),
- cmocka_unit_test(test__f_limit_setss_increase__returns_data_not),
- cmocka_unit_test(test__f_limit_setss_increase_by__returns_data_not),
-
- cmocka_unit_test(test__f_limit_setss_adjust__works),
- cmocka_unit_test(test__f_limit_setss_append__works),
- cmocka_unit_test(test__f_limit_setss_append_all__works),
- cmocka_unit_test(test__f_limit_setss_decimate_by__works),
- cmocka_unit_test(test__f_limit_setss_decrease_by__works),
- cmocka_unit_test(test__f_limit_setss_increase__works),
- cmocka_unit_test(test__f_limit_setss_increase_by__works),
- cmocka_unit_test(test__f_limit_setss_resize__works),
-
- cmocka_unit_test(test__f_limit_values_adjust__works),
- cmocka_unit_test(test__f_limit_values_append__works),
- cmocka_unit_test(test__f_limit_values_append_all__works),
- cmocka_unit_test(test__f_limit_values_decimate_by__works),
- cmocka_unit_test(test__f_limit_values_decrease_by__works),
- cmocka_unit_test(test__f_limit_values_increase__works),
- cmocka_unit_test(test__f_limit_values_increase_by__works),
- cmocka_unit_test(test__f_limit_values_resize__works),
-
- cmocka_unit_test(test__f_limit_valuess_append__returns_data_not),
- cmocka_unit_test(test__f_limit_valuess_append_all__returns_data_not),
- cmocka_unit_test(test__f_limit_valuess_decimate_by__returns_data_not),
- cmocka_unit_test(test__f_limit_valuess_decrease_by__returns_data_not),
- cmocka_unit_test(test__f_limit_valuess_increase__returns_data_not),
- cmocka_unit_test(test__f_limit_valuess_increase_by__returns_data_not),
-
- cmocka_unit_test(test__f_limit_valuess_adjust__works),
- cmocka_unit_test(test__f_limit_valuess_append__works),
- cmocka_unit_test(test__f_limit_valuess_append_all__works),
- cmocka_unit_test(test__f_limit_valuess_decimate_by__works),
- cmocka_unit_test(test__f_limit_valuess_decrease_by__works),
- cmocka_unit_test(test__f_limit_valuess_increase__works),
- cmocka_unit_test(test__f_limit_valuess_increase_by__works),
- cmocka_unit_test(test__f_limit_valuess_resize__works),
+ cmocka_unit_test(test__f_limit_setss_destroy_callback__fails),
+ cmocka_unit_test(test__f_limit_setss_delete_callback__fails),
+
+ cmocka_unit_test(test__f_limit_setss_delete_callback__works),
+ cmocka_unit_test(test__f_limit_setss_destroy_callback__works),
+
+ cmocka_unit_test(test__f_limit_valuess_destroy_callback__fails),
+ cmocka_unit_test(test__f_limit_valuess_delete_callback__fails),
+
+ cmocka_unit_test(test__f_limit_valuess_delete_callback__works),
+ cmocka_unit_test(test__f_limit_valuess_destroy_callback__works),
#ifndef _di_level_0_parameter_checking_
cmocka_unit_test(test__f_limit_process__parameter_checking),
- cmocka_unit_test(test__f_limit_sets_adjust__parameter_checking),
- cmocka_unit_test(test__f_limit_sets_append__parameter_checking),
- cmocka_unit_test(test__f_limit_sets_append_all__parameter_checking),
- cmocka_unit_test(test__f_limit_sets_decimate_by__parameter_checking),
- cmocka_unit_test(test__f_limit_sets_decrease_by__parameter_checking),
- cmocka_unit_test(test__f_limit_sets_increase__parameter_checking),
- cmocka_unit_test(test__f_limit_sets_increase_by__parameter_checking),
- cmocka_unit_test(test__f_limit_sets_resize__parameter_checking),
-
- cmocka_unit_test(test__f_limit_setss_adjust__parameter_checking),
- cmocka_unit_test(test__f_limit_setss_append__parameter_checking),
- cmocka_unit_test(test__f_limit_setss_append_all__parameter_checking),
- cmocka_unit_test(test__f_limit_setss_decimate_by__parameter_checking),
- cmocka_unit_test(test__f_limit_setss_decrease_by__parameter_checking),
- cmocka_unit_test(test__f_limit_setss_increase__parameter_checking),
- cmocka_unit_test(test__f_limit_setss_increase_by__parameter_checking),
- cmocka_unit_test(test__f_limit_setss_resize__parameter_checking),
-
- cmocka_unit_test(test__f_limit_values_adjust__parameter_checking),
- cmocka_unit_test(test__f_limit_values_append__parameter_checking),
- cmocka_unit_test(test__f_limit_values_append_all__parameter_checking),
- cmocka_unit_test(test__f_limit_values_decimate_by__parameter_checking),
- cmocka_unit_test(test__f_limit_values_decrease_by__parameter_checking),
- cmocka_unit_test(test__f_limit_values_increase__parameter_checking),
- cmocka_unit_test(test__f_limit_values_increase_by__parameter_checking),
- cmocka_unit_test(test__f_limit_values_resize__parameter_checking),
-
- cmocka_unit_test(test__f_limit_valuess_adjust__parameter_checking),
- cmocka_unit_test(test__f_limit_valuess_append__parameter_checking),
- cmocka_unit_test(test__f_limit_valuess_append_all__parameter_checking),
- cmocka_unit_test(test__f_limit_valuess_decimate_by__parameter_checking),
- cmocka_unit_test(test__f_limit_valuess_decrease_by__parameter_checking),
- cmocka_unit_test(test__f_limit_valuess_increase__parameter_checking),
- cmocka_unit_test(test__f_limit_valuess_increase_by__parameter_checking),
- cmocka_unit_test(test__f_limit_valuess_resize__parameter_checking),
+ // f_limit_setss_destroy_callback() doesn't use parameter checking.
+ // f_limit_setss_delete_callback() doesn't use parameter checking.
+
+ // f_limit_valuess_destroy_callback() doesn't use parameter checking.
+ // f_limit_valuess_delete_callback() doesn't use parameter checking.
#endif // _di_level_0_parameter_checking_
};
// Test includes.
#include "test-limit-process.h"
-#include "test-limit-sets_adjust.h"
-#include "test-limit-sets_append.h"
-#include "test-limit-sets_append_all.h"
-#include "test-limit-sets_decimate_by.h"
-#include "test-limit-sets_decrease_by.h"
-#include "test-limit-sets_increase.h"
-#include "test-limit-sets_increase_by.h"
-#include "test-limit-sets_resize.h"
-#include "test-limit-setss_adjust.h"
-#include "test-limit-setss_append.h"
-#include "test-limit-setss_append_all.h"
-#include "test-limit-setss_decimate_by.h"
-#include "test-limit-setss_decrease_by.h"
-#include "test-limit-setss_increase.h"
-#include "test-limit-setss_increase_by.h"
-#include "test-limit-setss_resize.h"
-#include "test-limit-values_adjust.h"
-#include "test-limit-values_append.h"
-#include "test-limit-values_append_all.h"
-#include "test-limit-values_decimate_by.h"
-#include "test-limit-values_decrease_by.h"
-#include "test-limit-values_increase.h"
-#include "test-limit-values_increase_by.h"
-#include "test-limit-values_resize.h"
-#include "test-limit-valuess_adjust.h"
-#include "test-limit-valuess_append.h"
-#include "test-limit-valuess_append_all.h"
-#include "test-limit-valuess_decimate_by.h"
-#include "test-limit-valuess_decrease_by.h"
-#include "test-limit-valuess_increase.h"
-#include "test-limit-valuess_increase_by.h"
-#include "test-limit-valuess_resize.h"
+#include "test-limit-setss_delete_callback.h"
+#include "test-limit-setss_destroy_callback.h"
+#include "test-limit-valuess_delete_callback.h"
+#include "test-limit-valuess_destroy_callback.h"
#ifdef __cplusplus
extern "C" {
*
* The inner array can be a more complex structure because the callback is expected to know the type.
*
+ * Use f_memory_array_adjust() instead if a callback is not needed.
+ *
* @param length
* The new size to use.
* @param width
*
* The inner array can be a more complex structure because the callback is expected to know the type.
*
+ * Use f_memory_array_resize() instead if a callback is not needed.
+ *
* @param length
* The new size to use.
* @param width
// FLL-0 socket includes.
#include <fll/level_0/socket/common.h>
+#include <fll/level_0/socket/address.h>
#include <fll/level_0/socket/socket.h>
#ifdef __cplusplus
--- /dev/null
+#include "../socket.h"
+#include "address.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_f_socket_addressss_delete_callback_
+ f_status_t f_socket_addressss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ {
+ f_socket_addresss_t * const array = (f_socket_addresss_t *) void_array;
+ f_status_t status = F_okay;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ if (array[i].size) {
+ status = f_memory_array_resize(0, sizeof(f_socket_address_t), (void **) &array[i].array, &array[i].used, &array[i].size);
+ if (F_status_is_error(status)) return status;
+ }
+ } // for
+ }
+
+ return F_okay;
+ }
+#endif // _di_f_socket_addressss_delete_callback_
+
+#ifndef _di_f_socket_addressss_destroy_callback_
+ f_status_t f_socket_addressss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
+
+ {
+ f_socket_addresss_t * const array = (f_socket_addresss_t *) void_array;
+ f_status_t status = F_okay;
+
+ for (f_number_unsigned_t i = start; i < stop; ++i) {
+
+ if (array[i].size) {
+ status = f_memory_array_adjust(0, sizeof(f_socket_address_t), (void **) &array[i].array, &array[i].used, &array[i].size);
+ if (F_status_is_error(status)) return status;
+ }
+ } // for
+ }
+
+ return F_okay;
+ }
+#endif // _di_f_socket_addressss_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Socket
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Defines socket type related functionality.
+ *
+ * This is auto-included by socket.h and should not need to be explicitly included.
+ */
+#ifndef _F_socket_address_h
+#define _F_socket_address_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Provide a union to simplify using struct sockaddr in arrays.
+ *
+ * Managing different structures is not as practical.
+ * At the cost of resources, use the same space for all of these.
+ * This can then easily be used in a generic array that has a mixture of these.
+ *
+ * All of the properties may or may not be present, but inet4, inet6, and local are generally assumed to exist.
+ *
+ * Properties:
+ * - arp: Arp.
+ * - at: At.
+ * - ax25: Ax25.
+ * - dl: Dl.
+ * - eon: Eon.
+ * - inet4: Ipv4 internet network socket.
+ * - inet6: Ipv6 internet network socket..
+ * - ipx: Ipx.
+ * - iso: Iso.
+ * - local: Local (aka: Unix) socket (socket file or localhost).
+ * - ns: Ns.
+ * - x25: X25.
+ */
+#ifndef _di_f_socket_address_t_
+ typedef union {
+ struct sockaddr_in inet4;
+ struct sockaddr_in6 inet6;
+ struct sockaddr_un local;
+
+ #ifdef _en_support_socket_address_arp_
+ struct sockaddr_inarp arp;
+ #endif // _en_support_socket_address_arp_
+
+ #ifdef _en_support_socket_address_at_
+ struct sockaddr_at at;
+ #endif // _en_support_socket_address_at_
+
+ #ifdef _en_support_socket_address_ax25_
+ struct sockaddr_ax25 ax25;
+ #endif // _en_support_socket_address_ax25_
+
+ #ifdef _en_support_socket_address_dl_
+ struct sockaddr_dl dl;
+ #endif // _en_support_socket_address_dl_
+
+ #ifdef _en_support_socket_address_eon_
+ struct sockaddr_eon eon;
+ #endif // _en_support_socket_address_eon_
+
+ #ifdef _en_support_socket_address_ipx_
+ struct sockaddr_ipx ipx;
+ #endif // _en_support_socket_address_ipx_
+
+ #ifdef _en_support_socket_address_iso_
+ struct sockaddr_iso iso;
+ #endif // _en_support_socket_address_iso_
+
+ #ifdef _en_support_socket_address_ns_
+ struct sockaddr_ns ns;
+ #endif // _en_support_socket_address_ns_
+
+ #ifdef _en_support_socket_address_x25_
+ struct sockaddr_x25 x25;
+ #endif // _en_support_socket_address_x25_
+ } f_socket_address_t;
+
+ #define f_socket_address_t_initialize { 0 }
+
+ #define f_socket_address_initialize_inet4(value_inet4) { .inet4 = value_inet4 }
+ #define f_socket_address_initialize_inet6(value_inet6) { .inet6 = value_inet6 }
+ #define f_socket_address_initialize_local(value_local) { .local = value_local }
+ #define f_socket_address_initialize_arp(value_arp) { .arp = value_arp }
+ #define f_socket_address_initialize_at(value_at) { .at = value_at }
+ #define f_socket_address_initialize_ax25(value_ax25) { .ax25 = value_ax25 }
+ #define f_socket_address_initialize_dl(value_dl) { .dl = value_dl }
+ #define f_socket_address_initialize_eon(value_eon) { .local = value_eon }
+ #define f_socket_address_initialize_ipx(value_ipx) { .ipx = value_ipx }
+ #define f_socket_address_initialize_iso(value_iso) { .iso = value_iso }
+ #define f_socket_address_initialize_ns(value_ns) { .ns = value_ns }
+ #define f_socket_address_initialize_x25(value_x25) { .x25 = value_x25 }
+#endif // _di_f_socket_address_t_
+
+/**
+ * An array of f_socket_address_t.
+ *
+ * Properties:
+ * - array: The array of f_socket_address_t.
+ * - size: Total amount of allocated space.
+ * - used: Total number of allocated spaces used.
+ */
+#ifndef _di_f_socket_addresss_t_
+ typedef struct {
+ f_socket_address_t *array;
+
+ f_number_unsigned_t size;
+ f_number_unsigned_t used;
+ } f_socket_addresss_t;
+
+ #define f_socket_addresss_t_initialize { 0, 0, 0 }
+
+ #define macro_f_socket_addresss_t_initialize_1(array, size, used) { array, size, used }
+ #define macro_f_socket_addresss_t_initialize_2(array, length) { array, length, length }
+#endif // _di_f_socket_addresss_t_
+
+/**
+ * This holds an array of an array of f_socket_address_t.
+ *
+ * Properties:
+ * - array: The array of an array of f_socket_address_t.
+ * - size: Total amount of allocated space.
+ * - used: Total number of allocated spaces used.
+ */
+#ifndef _di_f_socket_addressss_t_
+ typedef struct {
+ f_socket_addresss_t *array;
+
+ f_number_unsigned_t size;
+ f_number_unsigned_t used;
+ } f_socket_addressss_t;
+
+ #define f_socket_addressss_t_initialize { 0, 0, 0 }
+
+ #define macro_f_socket_addressss_t_initialize_1(array, size, used) { array, size, used }
+ #define macro_f_socket_addressss_t_initialize_2(array, length) { array, length, length }
+#endif // _di_f_socket_addressss_t_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_resize() for an f_socket_addressss_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_okay 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_socket_addressss_delete_callback_
+ extern f_status_t f_socket_addressss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_socket_addressss_delete_callback_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_adjust() for an f_socket_addressss_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_okay 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_socket_addressss_destroy_callback_
+ extern f_status_t f_socket_addressss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_socket_addressss_destroy_callback_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _F_socket_address_h
};
#endif // _di_f_socket_type_e_
-/**
- * Provide a union to simplify using struct sockaddr in arrays.
- *
- * Managing different structures is not as practical.
- * At the cost of resources, use the same space for all of these.
- * This can then easily be used in a generic array that has a mixture of these.
- *
- * All of the properties may or may not be present, but inet4, inet6, and local are generally assumed to exist.
- *
- * Properties:
- * - arp: Arp.
- * - at: At.
- * - ax25: Ax25.
- * - dl: Dl.
- * - eon: Eon.
- * - inet4: Ipv4 internet network socket.
- * - inet6: Ipv6 internet network socket..
- * - ipx: Ipx.
- * - iso: Iso.
- * - local: Local (aka: Unix) socket (socket file or localhost).
- * - ns: Ns.
- * - x25: X25.
- */
-#ifndef _di_f_socket_address_t_
- typedef union {
- struct sockaddr_in inet4;
- struct sockaddr_in6 inet6;
- struct sockaddr_un local;
-
- #ifdef _en_support_socket_address_arp_
- struct sockaddr_inarp arp;
- #endif // _en_support_socket_address_arp_
-
- #ifdef _en_support_socket_address_at_
- struct sockaddr_at at;
- #endif // _en_support_socket_address_at_
-
- #ifdef _en_support_socket_address_ax25_
- struct sockaddr_ax25 ax25;
- #endif // _en_support_socket_address_ax25_
-
- #ifdef _en_support_socket_address_dl_
- struct sockaddr_dl dl;
- #endif // _en_support_socket_address_dl_
-
- #ifdef _en_support_socket_address_eon_
- struct sockaddr_eon eon;
- #endif // _en_support_socket_address_eon_
-
- #ifdef _en_support_socket_address_ipx_
- struct sockaddr_ipx ipx;
- #endif // _en_support_socket_address_ipx_
-
- #ifdef _en_support_socket_address_iso_
- struct sockaddr_iso iso;
- #endif // _en_support_socket_address_iso_
-
- #ifdef _en_support_socket_address_ns_
- struct sockaddr_ns ns;
- #endif // _en_support_socket_address_ns_
-
- #ifdef _en_support_socket_address_x25_
- struct sockaddr_x25 x25;
- #endif // _en_support_socket_address_x25_
- } f_socket_address_t;
-
- #define f_socket_address_t_initialize { 0 }
-
- #define f_socket_address_initialize_inet4(value_inet4) { .inet4 = value_inet4 }
- #define f_socket_address_initialize_inet6(value_inet6) { .inet6 = value_inet6 }
- #define f_socket_address_initialize_local(value_local) { .local = value_local }
- #define f_socket_address_initialize_arp(value_arp) { .arp = value_arp }
- #define f_socket_address_initialize_at(value_at) { .at = value_at }
- #define f_socket_address_initialize_ax25(value_ax25) { .ax25 = value_ax25 }
- #define f_socket_address_initialize_dl(value_dl) { .dl = value_dl }
- #define f_socket_address_initialize_eon(value_eon) { .local = value_eon }
- #define f_socket_address_initialize_ipx(value_ipx) { .ipx = value_ipx }
- #define f_socket_address_initialize_iso(value_iso) { .iso = value_iso }
- #define f_socket_address_initialize_ns(value_ns) { .ns = value_ns }
- #define f_socket_address_initialize_x25(value_x25) { .x25 = value_x25 }
-#endif // _di_f_socket_address_t_
-
-/**
- * Commonly used socket related properties, loosely based off of f_file_t.
- *
- * Properties:
- * - id: Socket file descriptor, used for binding and listening.
- * - id_data: Data file descriptor, used for reading and writing data from or to the socket.
- * - domain: The socket domain (protocol family, such as f_socket_protocol_family_local_e).
- * - protocol: The socket protocol (such as f_socket_protocol_tcp_e).
- * - type: The socket type (address family, such as f_socket_address_family_local_e).
- *
- * - size_read: The default number of 1-byte characters to read at a time and is often used for the read buffer size.
- * - size_write: The default number of 1-byte characters to read at a time and is often used for the write buffer size.
- *
- * - address: The socket address.
- * - length: The length of the socket.
- *
- * - name: The name of the socket, if a name is given (for UNIX sockets this represents the path) (Must be a NULL terminated string).
- *
- * The clear and reset macros do not clear or reset the address (type f_socket_address_t) because the struct sockaddr is defined outside of the FLL project.
- */
-#ifndef _di_f_socket_t_
- typedef struct {
- int id;
- int id_data;
- int domain;
- int protocol;
- int type;
-
- size_t size_read;
- size_t size_write;
-
- f_socket_address_t address;
- socklen_t length;
-
- f_string_static_t name;
- } f_socket_t;
-
- #define f_socket_t_initialize { -1, -1, 0, 0, 0, F_socket_default_read_size_d, F_socket_default_write_size_d, f_socket_address_t_initialize, 0, f_string_static_t_initialize }
-
- #define macro_f_socket_t_initialize_1(address, length) { \
- -1, \
- -1, \
- 0, \
- 0, \
- 0, \
- F_socket_default_read_size_d, \
- F_socket_default_write_size_d, \
- address, \
- length, \
- f_string_empty_s \
- }
-
- #define macro_f_socket_t_initialize_2(address, length, name) { \
- -1, \
- -1, \
- 0, \
- 0, \
- 0, \
- F_socket_default_read_size_d, \
- F_socket_default_write_size_d, \
- address, \
- length, \
- name \
- }
-
- #define macro_f_socket_t_initialize_3(id, domain, protocol, type, address, length, name) { \
- id, \
- -1, \
- domain, \
- protocol, \
- type, \
- F_socket_default_read_size_d, \
- F_socket_default_write_size_d, \
- address, \
- length, \
- name \
- }
-
- #define macro_f_socket_t_initialize_4(id, domain, protocol, type, size_read, size_write, address, length, name) { \
- id, \
- -1, \
- domain, \
- protocol, \
- type, \
- size_read, \
- size_write, \
- address, \
- length, \
- name \
- }
-
- #define macro_f_socket_t_initialize_5(id, id_data, domain, protocol, type, size_read, size_write, address, length, name) { \
- id, \
- id_data, \
- domain, \
- protocol, \
- type, \
- size_read, \
- size_write, \
- address, \
- length, \
- name \
- }
-
- #define macro_f_socket_t_clear(file) \
- file.id = -1; \
- file.id_data = -1; \
- file.domain = 0; \
- file.protocol = 0; \
- file.type = 0; \
- file.size_read = 0; \
- file.size_write = 0; \
- file.length = 0; \
- macro_f_string_static_t_clear(file);
-
- #define macro_f_socket_t_reset(file) \
- file.id = -1; \
- file.id_data = -1; \
- file.domain = 0; \
- file.protocol = 0; \
- file.type = 0; \
- file.size_read = F_socket_default_read_size_d; \
- file.size_write = F_socket_default_write_size_d; \
- file.length = 0; \
- macro_f_string_static_t_clear(file);
-#endif // _di_f_socket_t_
-
-/**
- * An array of f_socket_t.
- *
- * Properties:
- * - array: The array of f_socket_t.
- * - size: Total amount of allocated space.
- * - used: Total number of allocated spaces used.
- */
-#ifndef _di_f_sockets_t_
- typedef struct {
- f_socket_t *array;
-
- f_number_unsigned_t size;
- f_number_unsigned_t used;
- } f_sockets_t;
-
- #define f_sockets_t_initialize { 0, 0, 0 }
-
- #define macro_f_sockets_t_initialize_1(array, size, used) { array, size, used }
- #define macro_f_sockets_t_initialize_2(array, length) { array, length, length }
-#endif // _di_f_sockets_t_
-
-/**
- * This holds an array of f_sockets_t.
- *
- * Properties:
- * - array: The array of f_socket_t arrays.
- * - size: Total amount of allocated space.
- * - used: Total number of allocated spaces used.
- */
-#ifndef _di_f_socketss_t_
- typedef struct {
- f_sockets_t *array;
-
- f_number_unsigned_t size;
- f_number_unsigned_t used;
- } f_socketss_t;
-
- #define f_socketss_t_initialize { 0, 0, 0 }
-
- #define macro_f_socketss_t_initialize_1(array, size, used) { array, size, used }
- #define macro_f_socketss_t_initialize_2(array, length) { array, length, length }
-#endif // _di_f_socketss_t_
-
#ifdef __cplusplus
} // extern "C"
#endif
+++ /dev/null
-#include "../socket.h"
-#include "private-socket.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if !defined(_di_f_sockets_append_all_) || !defined(_di_f_socketss_append_) || !defined(_di_f_socketss_append_all_)
- extern f_status_t private_f_sockets_append_all(const f_sockets_t source, f_sockets_t * const destination) {
-
- const f_status_t status = f_memory_array_increase_by(source.used, sizeof(f_socket_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->array[destination->used++] = source.array[i];
- } // for
-
- return F_okay;
- }
-#endif // !defined(_di_f_sockets_append_all_) || !defined(_di_f_socketss_append_) || !defined(_di_f_socketss_append_all_)
-
-#if !defined(_di_f_socketss_adjust_) || !defined(_di_f_socketss_decimate_by_)
- f_status_t private_f_socketss_adjust(const f_number_unsigned_t length, f_socketss_t * const socketss) {
-
- f_status_t status = F_okay;
-
- for (f_number_unsigned_t i = length; i < socketss->size; ++i) {
-
- status = f_memory_array_adjust(0, sizeof(f_socket_t), (void **) &socketss->array[i].array, &socketss->array[i].used, &socketss->array[i].size);
- if (F_status_is_error(status)) return status;
- } // for
-
- return f_memory_array_adjust(length, sizeof(f_sockets_t), (void **) &socketss->array, &socketss->used, &socketss->size);
- }
-#endif // !defined(_di_f_socketss_adjust_) || !defined(_di_f_socketss_decimate_by_)
-
-#if !defined(_di_f_socketss_decrease_by_) || !defined(_di_f_socketss_increase_) || !defined(_di_f_socketss_increase_by_) || !defined(_di_f_socketss_resize_)
- f_status_t private_f_socketss_resize(const f_number_unsigned_t length, f_socketss_t * const socketss) {
-
- f_status_t status = F_okay;
-
- for (f_number_unsigned_t i = length; i < socketss->size; ++i) {
-
- status = f_memory_array_resize(0, sizeof(f_socket_t), (void **) &socketss->array[i].array, &socketss->array[i].used, &socketss->array[i].size);
- if (F_status_is_error(status)) return status;
- } // for
-
- return f_memory_array_resize(length, sizeof(f_sockets_t), (void **) &socketss->array, &socketss->used, &socketss->size);
- }
-#endif // !defined(_di_f_socketss_decrease_by_) || !defined(_di_f_socketss_increase_) || !defined(_di_f_socketss_increase_by_) || !defined(_di_f_socketss_resize_)
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
+++ /dev/null
-/**
- * FLL - Level 0
- *
- * Project: Socket
- * 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_socket_socket_h
-#define _PRIVATE_F_socket_socket_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * Private implementation for appending the socket array.
- *
- * Intended to be shared to each of the different implementation variations.
- *
- * @param source
- * The source sockets to append.
- * @param destination
- * The destination lengths the source is appended onto.
- *
- * @return
- * F_okay on success.
- *
- * Errors (with error bit) from: f_memory_array_increase_by().
- *
- * @see f_memory_array_increase_by()
- *
- * @see f_sockets_append_all()
- * @see f_socketss_append()
- * @see f_socketss_append_all()
- */
-#if !defined(_di_f_sockets_append_all_) || !defined(_di_f_socketss_append_) || !defined(_di_f_socketss_append_all_)
- extern f_status_t private_f_sockets_append_all(const f_sockets_t source, f_sockets_t * const destination) F_attribute_visibility_internal_d;
-#endif // !defined(_di_f_sockets_append_all_) || !defined(_di_f_socketss_append_) || !defined(_di_f_socketss_append_all_)
-
-/**
- * Private implementation for resizing the socketss array.
- *
- * Intended to be shared to each of the different implementation variations.
- *
- * @param length
- * The length to adjust to.
- * @param socketss
- * The socketss array to adjust.
- *
- * @return
- * F_okay 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 new length is larger than max array length.
- * 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().
- *
- * @see f_memory_array_adjust()
- *
- * @see f_socketss_adjust()
- * @see f_socketss_decimate_by()
- */
-#if !defined(_di_f_socketss_adjust_) || !defined(_di_f_socketss_decimate_by_)
- extern f_status_t private_f_socketss_adjust(const f_number_unsigned_t length, f_socketss_t * const socketss) F_attribute_visibility_internal_d;
-#endif // !defined(_di_f_socketss_adjust_) || !defined(_di_f_socketss_decimate_by_)
-
-/**
- * Private implementation for resizing the socketss array.
- *
- * Intended to be shared to each of the different implementation variations.
- *
- * @param length
- * The length to resize to.
- * @param socketss
- * The socketss array to resize.
- *
- * @return
- * F_okay 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 new length is larger than max array length.
- * 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().
- *
- * @see f_memory_array_resize()
- *
- * @see f_socketss_decrease_by()
- * @see f_socketss_increase()
- * @see f_socketss_increase_by()
- * @see f_socketss_resize()
- */
-#if !defined(_di_f_socketss_decrease_by_) || !defined(_di_f_socketss_increase_) || !defined(_di_f_socketss_increase_by_) || !defined(_di_f_socketss_resize_)
- extern f_status_t private_f_socketss_resize(const f_number_unsigned_t length, f_socketss_t * const socketss) F_attribute_visibility_internal_d;
-#endif // !defined(_di_f_socketss_decrease_by_) || !defined(_di_f_socketss_increase_) || !defined(_di_f_socketss_increase_by_) || !defined(_di_f_socketss_resize_)
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // _PRIVATE_F_socket_socket_h
#include "../socket.h"
#include "socket.h"
-#include "private-socket.h"
#ifdef __cplusplus
extern "C" {
#endif
-#ifndef _di_f_sockets_adjust_
- f_status_t f_sockets_adjust(const f_number_unsigned_t length, f_sockets_t * const sockets) {
- #ifndef _di_level_0_parameter_checking_
- if (!sockets) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
+#ifndef _di_f_socketss_delete_callback_
+ f_status_t f_socketss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
- return f_memory_array_adjust(length, sizeof(f_socket_t), (void **) &sockets->array, &sockets->used, &sockets->size);
- }
-#endif // _di_f_sockets_adjust_
-
-#ifndef _di_f_sockets_append_
- f_status_t f_sockets_append(const f_socket_t source, f_sockets_t * const destination) {
- #ifndef _di_level_0_parameter_checking_
- if (!destination) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
+ {
+ f_sockets_t * const array = (f_sockets_t *) void_array;
+ f_status_t status = F_okay;
- const f_status_t status = f_memory_array_increase(F_memory_default_allocation_small_d, sizeof(f_socket_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) {
- destination->array[destination->used++] = source;
+ if (array[i].size) {
+ status = f_memory_array_resize(0, sizeof(f_socket_t), (void **) &array[i].array, &array[i].used, &array[i].size);
+ if (F_status_is_error(status)) return status;
+ }
+ } // for
+ }
return F_okay;
}
-#endif // _di_f_sockets_append_
-
-#ifndef _di_f_sockets_append_all_
- f_status_t f_sockets_append_all(const f_sockets_t source, f_sockets_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_sockets_append_all(source, destination);
- }
-#endif // _di_f_sockets_append_all_
-
-#ifndef _di_f_sockets_decimate_by_
- f_status_t f_sockets_decimate_by(const f_number_unsigned_t amount, f_sockets_t * const sockets) {
- #ifndef _di_level_0_parameter_checking_
- if (!sockets) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- return f_memory_array_decimate_by(amount, sizeof(f_socket_t), (void **) &sockets->array, &sockets->used, &sockets->size);
- }
-#endif // _di_f_sockets_decimate_by_
-
-#ifndef _di_f_sockets_decrease_by_
- f_status_t f_sockets_decrease_by(const f_number_unsigned_t amount, f_sockets_t * const sockets) {
- #ifndef _di_level_0_parameter_checking_
- if (!sockets) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- return f_memory_array_decrease_by(amount, sizeof(f_socket_t), (void **) &sockets->array, &sockets->used, &sockets->size);
- }
-#endif // _di_f_sockets_decrease_by_
-
-#ifndef _di_f_sockets_increase_
- f_status_t f_sockets_increase(const f_number_unsigned_t step, f_sockets_t * const sockets) {
- #ifndef _di_level_0_parameter_checking_
- if (!sockets) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- return f_memory_array_increase(step, sizeof(f_socket_t), (void **) &sockets->array, &sockets->used, &sockets->size);
- }
-#endif // _di_f_sockets_increase_
+#endif // _di_f_socketss_delete_callback_
-#ifndef _di_f_sockets_increase_by_
- f_status_t f_sockets_increase_by(const f_number_unsigned_t amount, f_sockets_t * const sockets) {
- #ifndef _di_level_0_parameter_checking_
- if (!sockets) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
+#ifndef _di_f_socketss_destroy_callback_
+ f_status_t f_socketss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) {
- return f_memory_array_increase_by(amount, sizeof(f_socket_t), (void **) &sockets->array, &sockets->used, &sockets->size);
- }
-#endif // _di_f_sockets_increase_by_
+ {
+ f_sockets_t * const array = (f_sockets_t *) void_array;
+ f_status_t status = F_okay;
-#ifndef _di_f_sockets_resize_
- f_status_t f_sockets_resize(const f_number_unsigned_t length, f_sockets_t * const sockets) {
- #ifndef _di_level_0_parameter_checking_
- if (!sockets) 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_resize(length, sizeof(f_socket_t), (void **) &sockets->array, &sockets->used, &sockets->size);
- }
-#endif // _di_f_sockets_resize_
-
-#ifndef _di_f_socketss_adjust_
- f_status_t f_socketss_adjust(const f_number_unsigned_t length, f_socketss_t * const socketss) {
- #ifndef _di_level_0_parameter_checking_
- if (!socketss) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- return private_f_socketss_adjust(length, socketss);
- }
-#endif // _di_f_socketss_adjust_
-
-#ifndef _di_f_socketss_append_
- f_status_t f_socketss_append(const f_sockets_t source, f_socketss_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;
-
- f_status_t status = f_memory_array_increase(F_memory_default_allocation_small_d, sizeof(f_sockets_t), (void **) &destination->array, &destination->used, &destination->size);
- if (F_status_is_error(status)) return status;
-
- status = private_f_sockets_append_all(source, &destination->array[destination->used]);
- if (F_status_is_error(status)) return status;
-
- ++destination->used;
+ if (array[i].size) {
+ status = f_memory_array_adjust(0, sizeof(f_socket_t), (void **) &array[i].array, &array[i].used, &array[i].size);
+ if (F_status_is_error(status)) return status;
+ }
+ } // for
+ }
return F_okay;
}
-#endif // _di_f_socketss_append_
-
-#ifndef _di_f_socketss_append_all_
- f_status_t f_socketss_append_all(const f_socketss_t source, f_socketss_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;
-
- f_status_t status = f_memory_array_increase_by(source.used, sizeof(f_sockets_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_sockets_append_all(source.array[i], &destination->array[destination->used]);
- if (F_status_is_error(status)) return status;
- }
- } // for
-
- return F_okay;
- }
-#endif // _di_f_socketss_append_all_
-
-#ifndef _di_f_socketss_decimate_by_
- f_status_t f_socketss_decimate_by(const f_number_unsigned_t amount, f_socketss_t * const socketss) {
- #ifndef _di_level_0_parameter_checking_
- if (!socketss) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- if (!amount) return F_data_not;
-
- return private_f_socketss_adjust((socketss->size - amount > 0) ? socketss->size - amount : 0, socketss);
- }
-#endif // _di_f_socketss_decimate_by_
-
-#ifndef _di_f_socketss_decrease_by_
- f_status_t f_socketss_decrease_by(const f_number_unsigned_t amount, f_socketss_t * const socketss) {
- #ifndef _di_level_0_parameter_checking_
- if (!socketss) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- if (!amount) return F_data_not;
-
- return private_f_socketss_resize((socketss->size - amount > 0) ? socketss->size - amount : 0, socketss);
- }
-#endif // _di_f_socketss_decrease_by_
-
-#ifndef _di_f_socketss_increase_
- f_status_t f_socketss_increase(const f_number_unsigned_t step, f_socketss_t * const socketss) {
- #ifndef _di_level_0_parameter_checking_
- if (!socketss) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- return f_memory_array_increase(step, sizeof(f_sockets_t), (void **) &socketss->array, &socketss->used, &socketss->size);
- }
-#endif // _di_f_socketss_increase_
-
-#ifndef _di_f_socketss_increase_by_
- f_status_t f_socketss_increase_by(const f_number_unsigned_t amount, f_socketss_t * const socketss) {
- #ifndef _di_level_0_parameter_checking_
- if (!socketss) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- return f_memory_array_increase_by(amount, sizeof(f_sockets_t), (void **) &socketss->array, &socketss->used, &socketss->size);
- }
-#endif // _di_f_socketss_increase_by_
-
-#ifndef _di_f_socketss_resize_
- f_status_t f_socketss_resize(const f_number_unsigned_t length, f_socketss_t * const socketss) {
- #ifndef _di_level_0_parameter_checking_
- if (!socketss) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
-
- return private_f_socketss_resize(length, socketss);
- }
-#endif // _di_f_socketss_resize_
+#endif // _di_f_socketss_destroy_callback_
#ifdef __cplusplus
} // extern "C"
#endif
/**
- * Resize the string sockets array.
- *
- * @param length
- * The new size to use.
- * @param sockets
- * The string sockets 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_sockets_adjust_
- extern f_status_t f_sockets_adjust(const f_number_unsigned_t length, f_sockets_t * const sockets);
-#endif // _di_f_sockets_adjust_
-
-/**
- * Append the single source socket onto the destination.
- *
- * @param source
- * The source socket to append.
- * @param destination
- * The destination sockets the source is appended onto.
- *
- * @return
- * F_okay 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().
- *
- * @see f_memory_array_increase()
- */
-#ifndef _di_f_sockets_append_
- extern f_status_t f_sockets_append(const f_socket_t source, f_sockets_t * const destination);
-#endif // _di_f_sockets_append_
-
-/**
- * Append the source sockets onto the destination.
- *
- * @param source
- * The source sockets to append.
- * @param destination
- * The destination sockets the source is appended onto.
- *
- * @return
- * F_okay 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().
- *
- * @see f_memory_array_increase_by()
- */
-#ifndef _di_f_sockets_append_all_
- extern f_status_t f_sockets_append_all(const f_sockets_t source, f_sockets_t * const destination);
-#endif // _di_f_sockets_append_all_
-
-/**
- * Resize the string sockets 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 sockets
- * The string sockets array to resize.
- *
- * @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_sockets_decimate_by_
- extern f_status_t f_sockets_decimate_by(const f_number_unsigned_t amount, f_sockets_t * const sockets);
-#endif // _di_f_sockets_decimate_by_
-
-/**
- * Resize the string sockets 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 sockets
- * The string sockets 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_sockets_decrease_by_
- extern f_status_t f_sockets_decrease_by(const f_number_unsigned_t amount, f_sockets_t * const sockets);
-#endif // _di_f_sockets_decrease_by_
-
-/**
- * Increase the size of the string sockets array, but only if necesary.
- *
- * 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 sockets
- * The string sockets 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_sockets_increase_
- extern f_status_t f_sockets_increase(const f_number_unsigned_t step, f_sockets_t * const sockets);
-#endif // _di_f_sockets_increase_
-
-/**
- * Resize the string sockets 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 sockets
- * The string sockets 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_sockets_increase_by_
- extern f_status_t f_sockets_increase_by(const f_number_unsigned_t amount, f_sockets_t * const sockets);
-#endif // _di_f_sockets_increase_by_
-
-/**
- * Resize the string sockets array.
- *
- * @param length
- * The new size to use.
- * @param sockets
- * The string sockets 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_sockets_resize_
- extern f_status_t f_sockets_resize(const f_number_unsigned_t length, f_sockets_t * const sockets);
-#endif // _di_f_sockets_resize_
-
-/**
- * Resize the string socketss array.
- *
- * @param length
- * The new size to use.
- * @param socketss
- * The string socketss array to resize.
+ * Commonly used socket related properties, loosely based off of f_file_t.
+ *
+ * Properties:
+ * - id: Socket file descriptor, used for binding and listening.
+ * - id_data: Data file descriptor, used for reading and writing data from or to the socket.
+ * - domain: The socket domain (protocol family, such as f_socket_protocol_family_local_e).
+ * - protocol: The socket protocol (such as f_socket_protocol_tcp_e).
+ * - type: The socket type (address family, such as f_socket_address_family_local_e).
+ *
+ * - size_read: The default number of 1-byte characters to read at a time and is often used for the read buffer size.
+ * - size_write: The default number of 1-byte characters to read at a time and is often used for the write buffer size.
+ *
+ * - address: The socket address.
+ * - length: The length of the socket.
+ *
+ * - name: The name of the socket, if a name is given (for UNIX sockets this represents the path) (Must be a NULL terminated string).
+ *
+ * The clear and reset macros do not clear or reset the address (type f_socket_address_t) because the struct sockaddr is defined outside of the FLL project.
+ */
+#ifndef _di_f_socket_t_
+ typedef struct {
+ int id;
+ int id_data;
+ int domain;
+ int protocol;
+ int type;
+
+ size_t size_read;
+ size_t size_write;
+
+ f_socket_address_t address;
+ socklen_t length;
+
+ f_string_static_t name;
+ } f_socket_t;
+
+ #define f_socket_t_initialize { -1, -1, 0, 0, 0, F_socket_default_read_size_d, F_socket_default_write_size_d, f_socket_address_t_initialize, 0, f_string_static_t_initialize }
+
+ #define macro_f_socket_t_initialize_1(address, length) { \
+ -1, \
+ -1, \
+ 0, \
+ 0, \
+ 0, \
+ F_socket_default_read_size_d, \
+ F_socket_default_write_size_d, \
+ address, \
+ length, \
+ f_string_empty_s \
+ }
+
+ #define macro_f_socket_t_initialize_2(address, length, name) { \
+ -1, \
+ -1, \
+ 0, \
+ 0, \
+ 0, \
+ F_socket_default_read_size_d, \
+ F_socket_default_write_size_d, \
+ address, \
+ length, \
+ name \
+ }
+
+ #define macro_f_socket_t_initialize_3(id, domain, protocol, type, address, length, name) { \
+ id, \
+ -1, \
+ domain, \
+ protocol, \
+ type, \
+ F_socket_default_read_size_d, \
+ F_socket_default_write_size_d, \
+ address, \
+ length, \
+ name \
+ }
+
+ #define macro_f_socket_t_initialize_4(id, domain, protocol, type, size_read, size_write, address, length, name) { \
+ id, \
+ -1, \
+ domain, \
+ protocol, \
+ type, \
+ size_read, \
+ size_write, \
+ address, \
+ length, \
+ name \
+ }
+
+ #define macro_f_socket_t_initialize_5(id, id_data, domain, protocol, type, size_read, size_write, address, length, name) { \
+ id, \
+ id_data, \
+ domain, \
+ protocol, \
+ type, \
+ size_read, \
+ size_write, \
+ address, \
+ length, \
+ name \
+ }
+
+ #define macro_f_socket_t_clear(file) \
+ file.id = -1; \
+ file.id_data = -1; \
+ file.domain = 0; \
+ file.protocol = 0; \
+ file.type = 0; \
+ file.size_read = 0; \
+ file.size_write = 0; \
+ file.length = 0; \
+ macro_f_string_static_t_clear(file);
+
+ #define macro_f_socket_t_reset(file) \
+ file.id = -1; \
+ file.id_data = -1; \
+ file.domain = 0; \
+ file.protocol = 0; \
+ file.type = 0; \
+ file.size_read = F_socket_default_read_size_d; \
+ file.size_write = F_socket_default_write_size_d; \
+ file.length = 0; \
+ macro_f_string_static_t_clear(file);
+#endif // _di_f_socket_t_
+
+/**
+ * An array of f_socket_t.
+ *
+ * Properties:
+ * - array: The array of f_socket_t.
+ * - size: Total amount of allocated space.
+ * - used: Total number of allocated spaces used.
+ */
+#ifndef _di_f_sockets_t_
+ typedef struct {
+ f_socket_t *array;
+
+ f_number_unsigned_t size;
+ f_number_unsigned_t used;
+ } f_sockets_t;
+
+ #define f_sockets_t_initialize { 0, 0, 0 }
+
+ #define macro_f_sockets_t_initialize_1(array, size, used) { array, size, used }
+ #define macro_f_sockets_t_initialize_2(array, length) { array, length, length }
+#endif // _di_f_sockets_t_
+
+/**
+ * This holds an array of f_sockets_t.
+ *
+ * Properties:
+ * - array: The array of f_socket_t arrays.
+ * - size: Total amount of allocated space.
+ * - used: Total number of allocated spaces used.
+ */
+#ifndef _di_f_socketss_t_
+ typedef struct {
+ f_sockets_t *array;
+
+ f_number_unsigned_t size;
+ f_number_unsigned_t used;
+ } f_socketss_t;
+
+ #define f_socketss_t_initialize { 0, 0, 0 }
+
+ #define macro_f_socketss_t_initialize_1(array, size, used) { array, size, used }
+ #define macro_f_socketss_t_initialize_2(array, length) { array, length, length }
+#endif // _di_f_socketss_t_
+
+/**
+ * A callback intended to be passed to f_memory_arrays_resize() for an f_socketss_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_okay 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_dynamics_resize().
*
- * @see f_memory_array_adjust()
+ * @see f_string_dynamics_resize()
*/
-#ifndef _di_f_socketss_adjust_
- extern f_status_t f_socketss_adjust(const f_number_unsigned_t length, f_socketss_t * const socketss);
-#endif // _di_f_socketss_adjust_
+#ifndef _di_f_socketss_delete_callback_
+ extern f_status_t f_socketss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_socketss_delete_callback_
/**
- * Append the single source sockets onto the destination.
- *
- * @param source
- * The source sockets to append.
- * @param destination
- * The destination ranges the source is appended onto.
- *
- * @return
- * F_okay 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_socketss_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().
- * Errors (with error bit) from: f_memory_array_increase_by().
+ * This does not do parameter checking.
*
- * @see f_memory_array_increase()
- * @see f_memory_array_increase_by()
- */
-#ifndef _di_f_socketss_append_
- extern f_status_t f_socketss_append(const f_sockets_t source, f_socketss_t * const destination);
-#endif // _di_f_socketss_append_
-
-/**
- * Append the source socketss onto the destination.
- *
- * @param source
- * The source socketss 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_okay 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().
- *
- * @see f_memory_array_increase_by()
- */
-#ifndef _di_f_socketss_append_all_
- extern f_status_t f_socketss_append_all(const f_socketss_t source, f_socketss_t * const destination);
-#endif // _di_f_socketss_append_all_
-
-/**
- * Resize the string socketss 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 socketss
- * The string socketss 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_socketss_decimate_by_
- extern f_status_t f_socketss_decimate_by(const f_number_unsigned_t amount, f_socketss_t * const socketss);
-#endif // _di_f_socketss_decimate_by_
-
-/**
- * Resize the string socketss 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 socketss
- * The string socketss 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_socketss_decrease_by_
- extern f_status_t f_socketss_decrease_by(const f_number_unsigned_t amount, f_socketss_t * const socketss);
-#endif // _di_f_socketss_decrease_by_
-
-/**
- * Increase the size of the string socketss 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 socketss
- * The string socketss 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_socketss_increase_
- extern f_status_t f_socketss_increase(const f_number_unsigned_t step, f_socketss_t * const socketss);
-#endif // _di_f_socketss_increase_
-
-/**
- * Resize the string socketss 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 socketss
- * The string socketss 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_socketss_increase_by_
- extern f_status_t f_socketss_increase_by(const f_number_unsigned_t amount, f_socketss_t * const socketss);
-#endif // _di_f_socketss_increase_by_
-
-/**
- * Resize the string socketss array.
- *
- * @param length
- * The new size to use.
- * @param socketss
- * The string socketss 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_dynamics_adjust().
*
- * @see f_memory_array_resize()
+ * @see f_string_dynamics_adjust()
*/
-#ifndef _di_f_socketss_resize_
- extern f_status_t f_socketss_resize(const f_number_unsigned_t length, f_socketss_t * const socketss);
-#endif // _di_f_socketss_resize_
+#ifndef _di_f_socketss_destroy_callback_
+ extern f_status_t f_socketss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array);
+#endif // _di_f_socketss_destroy_callback_
#ifdef __cplusplus
} // extern "C"
build_libraries -lc
build_libraries-individual -lf_memory -lf_string
-build_sources_library socket.c socket/socket.c socket/private-socket.c
+build_sources_library socket.c socket/address.c socket/socket.c
-build_sources_headers socket.h socket/socket.h socket/common.h
+build_sources_headers socket.h socket/address.h socket/socket.h socket/common.h
build_script yes
build_shared yes
build_libraries -lc
build_libraries-individual -lf_memory -lf_string
-build_sources_library socket.c socket/socket.c socket/private-socket.c ../../tests/unit/c/mock-socket.c
+build_sources_library socket.c socket/address.c socket/socket.c
+build_sources_library ../../tests/unit/c/mock-socket.c
-build_sources_headers socket.h socket/socket.h socket/common.h
+build_sources_headers socket.h socket/address.h socket/socket.h socket/common.h
build_script yes
build_shared yes
flags_library -fPIC
# Inject mocks.
+flags -Wl,--wrap=f_memory_array_adjust
+flags -Wl,--wrap=f_memory_array_resize
flags -Wl,--wrap=accept
flags -Wl,--wrap=bind
flags -Wl,--wrap=close
build_libraries-individual -lf_memory -lf_string -lf_type_array -lf_socket
build_sources_program test-socket-accept.c test-socket-bind.c test-socket-bind_inet4.c test-socket-bind_inet6.c test-socket-bind_local.c test-socket-connect.c test-socket-create.c test-socket-create_pair.c test-socket-disconnect.c test-socket-listen.c test-socket-name_host.c test-socket-name_peer.c test-socket-option_get.c test-socket-option_set.c test-socket-read.c test-socket-read_message.c test-socket-read_stream.c test-socket-write.c test-socket-write_message.c test-socket-write_stream.c
-build_sources_program test-socket-sockets_adjust.c test-socket-sockets_append.c test-socket-sockets_append_all.c test-socket-sockets_decimate_by.c test-socket-sockets_decrease_by.c test-socket-sockets_increase.c test-socket-sockets_increase_by.c test-socket-sockets_resize.c
-build_sources_program test-socket-socketss_adjust.c test-socket-socketss_append.c test-socket-socketss_append_all.c test-socket-socketss_decimate_by.c test-socket-socketss_decrease_by.c test-socket-socketss_increase.c test-socket-socketss_increase_by.c test-socket-socketss_resize.c
+build_sources_program test-socket-addressss_delete_callback.c test-socket-addressss_destroy_callback.c
+build_sources_program test-socket-ss_delete_callback.c test-socket-ss_destroy_callback.c
build_sources_program test-socket.c
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);
+}
+
int __wrap_accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen) {
const bool failure = mock_type(bool);
const static int mock_errno_generic = 32767;
-int __wrap_accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen);
-int __wrap_bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
-int __wrap_close(int fd);
-int __wrap_connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
-int __wrap_gethostname(char *name, size_t len);
-int __wrap_getpeername(int sockfd, struct sockaddr *addr, socklen_t *addrlen);
-int __wrap_getsockopt(int sockfd, int level, int optname, void *optval, socklen_t *optlen);
-int __wrap_listen(int sockfd, int backlog);
-ssize_t __wrap_recv(int sockfd, void *buf, size_t len, int flags);
-ssize_t __wrap_recvfrom(int sockfd, void *buf, size_t len, int flags, struct sockaddr *src_addr, socklen_t *addrlen);
-ssize_t __wrap_recvmsg(int sockfd, struct msghdr *msg, int flags);
-ssize_t __wrap_send(int sockfd, const void *buf, size_t len, int flags);
-ssize_t __wrap_sendmsg(int sockfd, const struct msghdr *msg, int flags);
-ssize_t __wrap_sendto(int sockfd, const void *buf, size_t len, int flags, const struct sockaddr *dest_addr, socklen_t addrlen);
-int __wrap_setsockopt(int sockfd, int level, int optname, const void *optval, socklen_t optlen);
-int __wrap_shutdown(int sockfd, int how);
-int __wrap_socket(int domain, int type, int protocol);
-int __wrap_socketpair(int domain, int type, int protocol, int sv[2]);
+extern int mock_unwrap;
+extern int mock_unwrap_f_memory;
+
+extern f_status_t __real_f_memory_array_adjust(const f_number_unsigned_t length, const size_t width, void ** array, f_number_unsigned_t * const used, f_number_unsigned_t * const size);
+extern f_status_t __real_f_memory_array_resize(const f_number_unsigned_t length, const size_t width, void ** array, f_number_unsigned_t * const used, f_number_unsigned_t * const size);
+
+extern f_status_t __wrap_f_memory_array_adjust(const f_number_unsigned_t length, const size_t width, void ** array, f_number_unsigned_t * const used, f_number_unsigned_t * const size);
+extern f_status_t __wrap_f_memory_array_resize(const f_number_unsigned_t length, const size_t width, void ** array, f_number_unsigned_t * const used, f_number_unsigned_t * const size);
+
+extern int __wrap_accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen);
+extern int __wrap_bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
+extern int __wrap_close(int fd);
+extern int __wrap_connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
+extern int __wrap_gethostname(char *name, size_t len);
+extern int __wrap_getpeername(int sockfd, struct sockaddr *addr, socklen_t *addrlen);
+extern int __wrap_getsockopt(int sockfd, int level, int optname, void *optval, socklen_t *optlen);
+extern int __wrap_listen(int sockfd, int backlog);
+extern ssize_t __wrap_recv(int sockfd, void *buf, size_t len, int flags);
+extern ssize_t __wrap_recvfrom(int sockfd, void *buf, size_t len, int flags, struct sockaddr *src_addr, socklen_t *addrlen);
+extern ssize_t __wrap_recvmsg(int sockfd, struct msghdr *msg, int flags);
+extern ssize_t __wrap_send(int sockfd, const void *buf, size_t len, int flags);
+extern ssize_t __wrap_sendmsg(int sockfd, const struct msghdr *msg, int flags);
+extern ssize_t __wrap_sendto(int sockfd, const void *buf, size_t len, int flags, const struct sockaddr *dest_addr, socklen_t addrlen);
+extern int __wrap_setsockopt(int sockfd, int level, int optname, const void *optval, socklen_t optlen);
+extern int __wrap_shutdown(int sockfd, int how);
+extern int __wrap_socket(int domain, int type, int protocol);
+extern int __wrap_socketpair(int domain, int type, int protocol, int sv[2]);
#ifdef __cplusplus
} // extern "C"
--- /dev/null
+#include "test-socket.h"
+#include "test-socket-addressss_delete_callback.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_socket_addressss_delete_callback__fails(void **state) {
+
+ mock_unwrap = 0;
+ mock_unwrap_f_memory = 0;
+
+ f_socket_address_t data = f_socket_address_t_initialize;
+ f_socket_address_t data_array[] = { data };
+ f_socket_addresss_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_socket_addresss_t datas_array[] = { datas };
+
+ {
+ will_return(__wrap_f_memory_array_resize, true);
+ will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure));
+
+ const f_status_t status = f_socket_addressss_delete_callback(0, 1, (void *) datas_array);
+
+ assert_int_equal(status, F_status_set_error(F_failure));
+ }
+}
+
+void test__f_socket_addressss_delete_callback__works(void **state) {
+
+ mock_unwrap = 1;
+ mock_unwrap_f_memory = 1;
+
+ const f_number_unsigned_t length = 1;
+
+ f_socket_addressss_t datass = f_socket_addressss_t_initialize;
+
+ {
+ f_status_t status = f_memory_array_resize(length, sizeof(f_socket_addresss_t), (void **) &datass.array, &datass.used, &datass.size);
+ assert_int_equal(status, F_okay);
+
+ status = f_memory_array_resize(1, sizeof(f_socket_address_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size);
+ assert_int_equal(status, F_okay);
+ }
+
+ {
+ const f_status_t status = f_socket_addressss_delete_callback(0, length, (void *) datass.array);
+
+ assert_int_equal(status, F_okay);
+ assert_int_equal(datass.array[0].size, 0);
+ }
+
+ free((void *) datass.array);
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Socket
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the type project.
+ */
+#ifndef _TEST__F_socket__addressss_delete_callback
+#define _TEST__F_socket__addressss_delete_callback
+
+/**
+ * Test that the function fails.
+ *
+ * @see f_socket_addressss_delete_callback()
+ */
+extern void test__f_socket_addressss_delete_callback__fails(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_socket_addressss_delete_callback()
+ */
+extern void test__f_socket_addressss_delete_callback__works(void **state);
+
+#endif // _TEST__F_socket__addressss_delete_callback
--- /dev/null
+#include "test-socket.h"
+#include "test-socket-addressss_destroy_callback.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_socket_addressss_destroy_callback__fails(void **state) {
+
+ mock_unwrap = 0;
+ mock_unwrap_f_memory = 0;
+
+ f_socket_address_t data = f_socket_address_t_initialize;
+ f_socket_address_t data_array[] = { data };
+ f_socket_addresss_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_socket_addresss_t datas_array[] = { datas };
+
+ {
+ will_return(__wrap_f_memory_array_adjust, true);
+ will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure));
+
+ const f_status_t status = f_socket_addressss_destroy_callback(0, 1, (void *) datas_array);
+
+ assert_int_equal(status, F_status_set_error(F_failure));
+ }
+}
+
+void test__f_socket_addressss_destroy_callback__works(void **state) {
+
+ mock_unwrap = 1;
+ mock_unwrap_f_memory = 1;
+
+ const f_number_unsigned_t length = 1;
+
+ f_socket_addressss_t datass = f_socket_addressss_t_initialize;
+
+ {
+ f_status_t status = f_memory_array_adjust(length, sizeof(f_socket_addresss_t), (void **) &datass.array, &datass.used, &datass.size);
+ assert_int_equal(status, F_okay);
+
+ status = f_memory_array_adjust(1, sizeof(f_socket_address_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size);
+ assert_int_equal(status, F_okay);
+ }
+
+ {
+ const f_status_t status = f_socket_addressss_destroy_callback(0, length, (void *) datass.array);
+
+ assert_int_equal(status, F_okay);
+ assert_int_equal(datass.array[0].size, 0);
+ }
+
+ free((void *) datass.array);
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Socket
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the type project.
+ */
+#ifndef _TEST__F_socket__addressss_destroy_callback
+#define _TEST__F_socket__addressss_destroy_callback
+
+/**
+ * Test that the function fails.
+ *
+ * @see f_socket_addressss_destroy_callback()
+ */
+extern void test__f_socket_addressss_destroy_callback__fails(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_socket_addressss_destroy_callback()
+ */
+extern void test__f_socket_addressss_destroy_callback__works(void **state);
+
+#endif // _TEST__F_socket__addressss_destroy_callback
+++ /dev/null
-#include "test-socket.h"
-#include "test-socket-sockets_adjust.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_socket_sockets_adjust__parameter_checking(void **state) {
-
- const int length = 5;
- f_sockets_t data = f_sockets_t_initialize;
-
- {
- const f_status_t status = f_sockets_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_socket_sockets_adjust__works(void **state) {
-
- const int length = 5;
- f_sockets_t data = f_sockets_t_initialize;
-
- {
- const f_status_t status = f_sockets_adjust(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- free((void *) data.array);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
+++ /dev/null
-/**
- * FLL - Level 0
- *
- * Project: Socket
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the type project.
- */
-#ifndef _TEST__F_socket__sockets_adjust
-#define _TEST__F_socket__sockets_adjust
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_sockets_adjust()
- */
-extern void test__f_socket_sockets_adjust__parameter_checking(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_sockets_adjust()
- */
-extern void test__f_socket_sockets_adjust__works(void **state);
-
-#endif // _TEST__F_socket__sockets_adjust
+++ /dev/null
-#include "test-socket.h"
-#include "test-socket-sockets_append.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_socket_sockets_append__parameter_checking(void **state) {
-
- const f_socket_t data = f_socket_t_initialize;
-
- {
- const f_status_t status = f_sockets_append(data, 0);
-
- assert_int_equal(status, F_status_set_error(F_parameter));
- }
-}
-
-void test__f_socket_sockets_append__works(void **state) {
-
- f_string_static_t test = macro_f_string_static_t_initialize_1("test", 0, 4);
- const f_socket_t source = macro_f_socket_t_initialize_3(1, 2, 3, 4, f_socket_address_t_initialize, 0, test);
- f_sockets_t destination = f_sockets_t_initialize;
-
- {
- const f_status_t status = f_sockets_append(source, &destination);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(destination.used, 1);
- assert_int_equal(destination.array[0].id, source.id);
- assert_int_equal(destination.array[0].domain, source.domain);
- assert_int_equal(destination.array[0].protocol, source.protocol);
- assert_int_equal(destination.array[0].type, source.type);
- assert_int_equal(destination.array[0].name.used, source.name.used);
-
- assert_string_equal(destination.array[0].name.string, source.name.string);
- }
-
- free((void *) destination.array);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
+++ /dev/null
-/**
- * FLL - Level 0
- *
- * Project: Socket
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the type project.
- */
-#ifndef _TEST__F_socket__sockets_append
-#define _TEST__F_socket__sockets_append
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_sockets_append()
- */
-extern void test__f_socket_sockets_append__parameter_checking(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_sockets_append()
- */
-extern void test__f_socket_sockets_append__works(void **state);
-
-#endif // _TEST__F_socket__sockets_append
+++ /dev/null
-#include "test-socket.h"
-#include "test-socket-sockets_append_all.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_socket_sockets_append_all__parameter_checking(void **state) {
-
- const f_sockets_t data = f_sockets_t_initialize;
-
- {
- const f_status_t status = f_sockets_append_all(data, 0);
-
- assert_int_equal(status, F_status_set_error(F_parameter));
- }
-}
-
-void test__f_socket_sockets_append_all__returns_data_not(void **state) {
-
- const int length = 5;
- f_sockets_t source = f_sockets_t_initialize;
- f_sockets_t destination = f_sockets_t_initialize;
-
- {
- const f_status_t status = f_sockets_resize(length, &source);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(source.used, 0);
- assert_int_equal(source.size, length);
- }
-
- {
- const f_status_t status = f_sockets_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_socket_sockets_append_all__works(void **state) {
-
- const int length = 5;
- const int length_used = 2;
-
- f_string_static_t tests[] = {
- macro_f_string_static_t_initialize_1("test_1", 0, 6),
- macro_f_string_static_t_initialize_1("test_2", 0, 6),
- };
-
- f_socket_t sources[] = {
- macro_f_socket_t_initialize_3(1, 2, 3, 4, f_socket_address_t_initialize, 0, tests[0]),
- macro_f_socket_t_initialize_3(5, 6, 7, 8, f_socket_address_t_initialize, 0, tests[1]),
- };
-
- f_sockets_t source = f_sockets_t_initialize;
- f_sockets_t destination = f_sockets_t_initialize;
-
- {
- const f_status_t status = f_sockets_resize(length, &source);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(source.used, 0);
- assert_int_equal(source.size, length);
- }
-
- for (; source.used < length_used; ++source.used) {
- source.array[source.used] = sources[source.used];
- //memcpy((void *) &source.array[source.used], (void *) &sources[source.used], sizeof(f_sockets_t));
- } // for
-
- {
- const f_status_t status = f_sockets_append_all(source, &destination);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(destination.used, source.used);
- assert_int_equal(destination.size, source.used);
-
- for (f_number_unsigned_t i = 0; i < source.used; ++i) {
-
- assert_int_equal(destination.array[i].id, sources[i].id);
- assert_int_equal(destination.array[i].domain, sources[i].domain);
- assert_int_equal(destination.array[i].protocol, sources[i].protocol);
- assert_int_equal(destination.array[i].type, sources[i].type);
- assert_int_equal(destination.array[i].name.used, sources[i].name.used);
-
- assert_string_equal(destination.array[i].name.string, sources[i].name.string);
- } // for
- }
-
- free((void *) source.array);
- free((void *) destination.array);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
+++ /dev/null
-/**
- * FLL - Level 0
- *
- * Project: Socket
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the type project.
- */
-#ifndef _TEST__F_socket__sockets_append_all
-#define _TEST__F_socket__sockets_append_all
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_sockets_append_all()
- */
-extern void test__f_socket_sockets_append_all__parameter_checking(void **state);
-
-/**
- * Test that the function returns F_data_not.
- *
- * @see f_sockets_append_all()
- */
-extern void test__f_socket_sockets_append_all__returns_data_not(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_sockets_append_all()
- */
-extern void test__f_socket_sockets_append_all__works(void **state);
-
-#endif // _TEST__F_socket__sockets_append_all
+++ /dev/null
-#include "test-socket.h"
-#include "test-socket-sockets_decimate_by.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_socket_sockets_decimate_by__parameter_checking(void **state) {
-
- const int length = 5;
- f_sockets_t data = f_sockets_t_initialize;
-
- {
- const f_status_t status = f_sockets_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_socket_sockets_decimate_by__returns_data_not(void **state) {
-
- const int length = 5;
- f_sockets_t data = f_sockets_t_initialize;
-
- {
- const f_status_t status = f_sockets_resize(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- {
- const f_status_t status = f_sockets_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_socket_sockets_decimate_by__works(void **state) {
-
- const int length = 5;
- f_sockets_t data = f_sockets_t_initialize;
-
- {
- const f_status_t status = f_sockets_resize(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- {
- const f_status_t status = f_sockets_decimate_by(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, 0);
- }
-
- assert_null(data.array);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
+++ /dev/null
-/**
- * FLL - Level 0
- *
- * Project: Socket
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the type project.
- */
-#ifndef _TEST__F_socket__sockets_decimate_by
-#define _TEST__F_socket__sockets_decimate_by
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_sockets_decimate_by()
- */
-extern void test__f_socket_sockets_decimate_by__parameter_checking(void **state);
-
-/**
- * Test that the function returns F_data_not.
- *
- * @see f_sockets_decimate_by()
- */
-extern void test__f_socket_sockets_decimate_by__returns_data_not(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_sockets_decimate_by()
- */
-extern void test__f_socket_sockets_decimate_by__works(void **state);
-
-#endif // _TEST__F_socket__sockets_decimate_by
+++ /dev/null
-#include "test-socket.h"
-#include "test-socket-sockets_decrease_by.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_socket_sockets_decrease_by__parameter_checking(void **state) {
-
- const int length = 5;
- f_sockets_t data = f_sockets_t_initialize;
-
- {
- const f_status_t status = f_sockets_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_socket_sockets_decrease_by__returns_data_not(void **state) {
-
- const int length = 5;
- f_sockets_t data = f_sockets_t_initialize;
-
- {
- const f_status_t status = f_sockets_resize(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- {
- const f_status_t status = f_sockets_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_socket_sockets_decrease_by__works(void **state) {
-
- const int length = 5;
- f_sockets_t data = f_sockets_t_initialize;
-
- {
- const f_status_t status = f_sockets_resize(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- {
- const f_status_t status = f_sockets_decrease_by(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, 0);
- }
-
- assert_null(data.array);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
+++ /dev/null
-/**
- * FLL - Level 0
- *
- * Project: Socket
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the type project.
- */
-#ifndef _TEST__F_socket__sockets_decrease_by
-#define _TEST__F_socket__sockets_decrease_by
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_sockets_decrease_by()
- */
-extern void test__f_socket_sockets_decrease_by__parameter_checking(void **state);
-
-/**
- * Test that the function returns F_data_not.
- *
- * @see f_sockets_decrease_by()
- */
-extern void test__f_socket_sockets_decrease_by__returns_data_not(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_sockets_decrease_by()
- */
-extern void test__f_socket_sockets_decrease_by__works(void **state);
-
-#endif // _TEST__F_socket__sockets_decrease_by
+++ /dev/null
-#include "test-socket.h"
-#include "test-socket-sockets_increase.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_socket_sockets_increase__parameter_checking(void **state) {
-
- const int length = 5;
- f_sockets_t data = f_sockets_t_initialize;
-
- {
- const f_status_t status = f_sockets_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_socket_sockets_increase__returns_data_not(void **state) {
-
- const int length = 5;
- f_sockets_t data = f_sockets_t_initialize;
-
- {
- const f_status_t status = f_sockets_resize(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- {
- const f_status_t status = f_sockets_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_socket_sockets_increase__works(void **state) {
-
- const int length = 5;
- f_sockets_t data = f_sockets_t_initialize;
-
- {
- const f_status_t status = f_sockets_resize(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- {
- data.used = length;
-
- const f_status_t status = f_sockets_increase(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, length);
- assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d);
- }
-
- free((void *) data.array);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
+++ /dev/null
-/**
- * FLL - Level 0
- *
- * Project: Socket
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the type project.
- */
-#ifndef _TEST__F_socket__sockets_increase
-#define _TEST__F_socket__sockets_increase
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_sockets_increase()
- */
-extern void test__f_socket_sockets_increase__parameter_checking(void **state);
-
-/**
- * Test that the function returns F_data_not.
- *
- * @see f_sockets_increase()
- */
-extern void test__f_socket_sockets_increase__returns_data_not(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_sockets_increase()
- */
-extern void test__f_socket_sockets_increase__works(void **state);
-
-#endif // _TEST__F_socket__sockets_increase
+++ /dev/null
-#include "test-socket.h"
-#include "test-socket-sockets_increase_by.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_socket_sockets_increase_by__parameter_checking(void **state) {
-
- const int length = 5;
- f_sockets_t data = f_sockets_t_initialize;
-
- {
- const f_status_t status = f_sockets_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_socket_sockets_increase_by__returns_data_not(void **state) {
-
- const int length = 5;
- f_sockets_t data = f_sockets_t_initialize;
-
- {
- const f_status_t status = f_sockets_resize(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- {
- const f_status_t status = f_sockets_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_socket_sockets_increase_by__works(void **state) {
-
- const int length = 5;
- f_sockets_t data = f_sockets_t_initialize;
-
- {
- const f_status_t status = f_sockets_resize(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- {
- data.used = length;
-
- const f_status_t status = f_sockets_increase_by(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, length);
- assert_int_equal(data.size, length * 2);
- }
-
- free((void *) data.array);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
+++ /dev/null
-/**
- * FLL - Level 0
- *
- * Project: Socket
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the type project.
- */
-#ifndef _TEST__F_socket__sockets_increase_by
-#define _TEST__F_socket__sockets_increase_by
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_sockets_increase_by()
- */
-extern void test__f_socket_sockets_increase_by__parameter_checking(void **state);
-
-/**
- * Test that the function returns F_data_not.
- *
- * @see f_sockets_increase_by()
- */
-extern void test__f_socket_sockets_increase_by__returns_data_not(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_sockets_increase_by()
- */
-extern void test__f_socket_sockets_increase_by__works(void **state);
-
-#endif // _TEST__F_socket__sockets_increase_by
+++ /dev/null
-#include "test-socket.h"
-#include "test-socket-sockets_resize.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_socket_sockets_resize__parameter_checking(void **state) {
-
- const int length = 5;
- f_sockets_t data = f_sockets_t_initialize;
-
- {
- const f_status_t status = f_sockets_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_socket_sockets_resize__works(void **state) {
-
- const int length = 5;
- f_sockets_t data = f_sockets_t_initialize;
-
- {
- const f_status_t status = f_sockets_resize(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- free((void *) data.array);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
+++ /dev/null
-/**
- * FLL - Level 0
- *
- * Project: Socket
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the type project.
- */
-#ifndef _TEST__F_socket__sockets_resize
-#define _TEST__F_socket__sockets_resize
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_sockets_resize()
- */
-extern void test__f_socket_sockets_resize__parameter_checking(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_sockets_resize()
- */
-extern void test__f_socket_sockets_resize__works(void **state);
-
-#endif // _TEST__F_socket__sockets_resize
+++ /dev/null
-#include "test-socket.h"
-#include "test-socket-socketss_adjust.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_socket_socketss_adjust__parameter_checking(void **state) {
-
- const int length = 5;
- f_socketss_t data = f_socketss_t_initialize;
-
- {
- const f_status_t status = f_socketss_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_socket_socketss_adjust__works(void **state) {
-
- const int length = 5;
- f_socketss_t data = f_socketss_t_initialize;
-
- {
- const f_status_t status = f_socketss_adjust(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- free((void *) data.array);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
+++ /dev/null
-/**
- * FLL - Level 0
- *
- * Project: Socket
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the type project.
- */
-#ifndef _TEST__F_socket__socketss_adjust
-#define _TEST__F_socket__socketss_adjust
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_socketss_adjust()
- */
-extern void test__f_socket_socketss_adjust__parameter_checking(void **state);
-
-/**
- * Test that the function returns F_data_not.
- *
- * @see f_socketss_increase_by()
- */
-extern void test__f_socket_socketss_increase_by__returns_data_not(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_socketss_adjust()
- */
-extern void test__f_socket_socketss_adjust__works(void **state);
-
-#endif // _TEST__F_socket__socketss_adjust
+++ /dev/null
-#include "test-socket.h"
-#include "test-socket-socketss_append.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_socket_socketss_append__parameter_checking(void **state) {
-
- f_sockets_t data = f_sockets_t_initialize;
-
- {
- const f_status_t status = f_socketss_append(data, 0);
-
- assert_int_equal(status, F_status_set_error(F_parameter));
- }
-}
-
-void test__f_socket_socketss_append__returns_data_not(void **state) {
-
- const int length = 5;
- f_sockets_t source = f_sockets_t_initialize;
- f_socketss_t destination = f_socketss_t_initialize;
-
- {
- const f_status_t status = f_sockets_resize(length, &source);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(source.used, 0);
- assert_int_equal(source.size, length);
- }
-
- {
- const f_status_t status = f_socketss_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_socket_socketss_append__works(void **state) {
-
- const int length = 5;
-
- f_string_static_t tests[] = {
- macro_f_string_static_t_initialize_1("test_1", 0, 6),
- macro_f_string_static_t_initialize_1("test_2", 0, 6),
- macro_f_string_static_t_initialize_1("test_3", 0, 6),
- macro_f_string_static_t_initialize_1("test_4", 0, 6),
- macro_f_string_static_t_initialize_1("test_5", 0, 6),
- };
-
- f_socket_t sources[] = {
- macro_f_socket_t_initialize_3(1, 2, 3, 4, f_socket_address_t_initialize, 0, tests[0]),
- macro_f_socket_t_initialize_3(5, 6, 7, 8, f_socket_address_t_initialize, 0, tests[1]),
- macro_f_socket_t_initialize_3(9, 10, 11, 12, f_socket_address_t_initialize, 0, tests[2]),
- macro_f_socket_t_initialize_3(13, 14, 15, 16, f_socket_address_t_initialize, 0, tests[3]),
- macro_f_socket_t_initialize_3(17, 18, 19, 20, f_socket_address_t_initialize, 0, tests[4]),
- };
-
- f_sockets_t source = f_sockets_t_initialize;
- f_socketss_t destination = f_socketss_t_initialize;
-
- {
- const f_status_t status = f_sockets_resize(length, &source);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(source.used, 0);
- assert_int_equal(source.size, length);
- }
-
- for (; source.used < length; ++source.used) {
- source.array[source.used] = sources[source.used];
- } // for
-
- {
- const f_status_t status = f_socketss_append(source, &destination);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(destination.used, 1);
- assert_int_equal(destination.array[0].used, source.used);
- assert_int_equal(destination.array[0].size, source.used);
-
- for (f_number_unsigned_t i = 0; i < destination.array[0].used; ++i) {
-
- assert_int_equal(destination.array[0].array[i].id, sources[i].id);
- assert_int_equal(destination.array[0].array[i].domain, sources[i].domain);
- assert_int_equal(destination.array[0].array[i].protocol, sources[i].protocol);
- assert_int_equal(destination.array[0].array[i].type, sources[i].type);
- assert_int_equal(destination.array[0].array[i].name.used, sources[i].name.used);
-
- assert_string_equal(destination.array[0].array[i].name.string, sources[i].name.string);
- } // for
- }
-
- for (f_number_unsigned_t i = 0; i < destination.used; ++i) {
- free((void *) destination.array[i].array);
- } // for
-
- free((void *) source.array);
- free((void *) destination.array);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
+++ /dev/null
-/**
- * FLL - Level 0
- *
- * Project: Socket
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the type project.
- */
-#ifndef _TEST__F_socket__socketss_append
-#define _TEST__F_socket__socketss_append
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_socketss_append()
- */
-extern void test__f_socket_socketss_append__parameter_checking(void **state);
-
-/**
- * Test that the function returns F_data_not.
- *
- * @see f_socketss_append()
- */
-extern void test__f_socket_socketss_append__returns_data_not(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_socketss_append()
- */
-extern void test__f_socket_socketss_append__works(void **state);
-
-#endif // _TEST__F_socket__socketss_append
+++ /dev/null
-#include "test-socket.h"
-#include "test-socket-socketss_append_all.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_socket_socketss_append_all__parameter_checking(void **state) {
-
- const f_socketss_t data = f_socketss_t_initialize;
-
- {
- const f_status_t status = f_socketss_append_all(data, 0);
-
- assert_int_equal(status, F_status_set_error(F_parameter));
- }
-}
-
-void test__f_socket_socketss_append_all__returns_data_not(void **state) {
-
- const int length = 5;
- f_socketss_t source = f_socketss_t_initialize;
- f_socketss_t destination = f_socketss_t_initialize;
-
- {
- const f_status_t status = f_socketss_resize(length, &source);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(source.used, 0);
- assert_int_equal(source.size, length);
- }
-
- {
- const f_status_t status = f_socketss_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_socket_socketss_append_all__works(void **state) {
-
- const int length = 5;
- const int length_inner = 2;
-
- f_string_static_t tests[] = {
- macro_f_string_static_t_initialize_1("test_1", 0, 6),
- macro_f_string_static_t_initialize_1("test_2", 0, 6),
- };
-
- f_socket_t sources[] = {
- macro_f_socket_t_initialize_3(1, 2, 3, 4, f_socket_address_t_initialize, 0, tests[0]),
- macro_f_socket_t_initialize_3(5, 6, 7, 8, f_socket_address_t_initialize, 0, tests[1]),
- };
-
- f_socketss_t source = f_socketss_t_initialize;
- f_socketss_t destination = f_socketss_t_initialize;
-
- {
- const f_status_t status = f_socketss_resize(length, &source);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(source.used, 0);
- assert_int_equal(source.size, length);
- }
-
- {
- for (; source.used < length; ++source.used) {
-
- const f_status_t status = f_sockets_resize(length_inner, &source.array[source.used]);
-
- assert_int_equal(status, F_okay);
-
- for (f_number_unsigned_t i = 0; i < length_inner; ++i) {
- source.array[source.used].array[source.array[source.used].used++] = sources[i];
- } // for
- } // for
- }
-
- {
- const f_status_t status = f_socketss_append_all(source, &destination);
-
- assert_int_equal(status, F_okay);
- 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);
-
- for (f_number_unsigned_t j = 0; j < length_inner; ++j) {
-
- assert_int_equal(destination.array[i].array[j].id, sources[j].id);
- assert_int_equal(destination.array[i].array[j].domain, sources[j].domain);
- assert_int_equal(destination.array[i].array[j].protocol, sources[j].protocol);
- assert_int_equal(destination.array[i].array[j].type, sources[j].type);
- assert_int_equal(destination.array[i].array[j].name.used, sources[j].name.used);
-
- assert_string_equal(destination.array[i].array[j].name.string, sources[j].name.string);
- } // for
- } // 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) {
- free((void *) destination.array[i].array);
- } // for
-
- free((void *) source.array);
- free((void *) destination.array);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
+++ /dev/null
-/**
- * FLL - Level 0
- *
- * Project: Socket
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the type project.
- */
-#ifndef _TEST__F_socket__socketss_append_all
-#define _TEST__F_socket__socketss_append_all
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_socketss_append_all()
- */
-extern void test__f_socket_socketss_append_all__parameter_checking(void **state);
-
-/**
- * Test that the function returns F_data_not.
- *
- * @see f_socketss_append_all()
- */
-extern void test__f_socket_socketss_append_all__returns_data_not(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_socketss_append_all()
- */
-extern void test__f_socket_socketss_append_all__works(void **state);
-
-#endif // _TEST__F_socket__socketss_append_all
+++ /dev/null
-#include "test-socket.h"
-#include "test-socket-socketss_decimate_by.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_socket_socketss_decimate_by__parameter_checking(void **state) {
-
- const int length = 5;
- f_socketss_t data = f_sockets_t_initialize;
-
- {
- const f_status_t status = f_socketss_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_socket_socketss_decimate_by__returns_data_not(void **state) {
-
- const int length = 5;
- f_socketss_t data = f_socketss_t_initialize;
-
- {
- const f_status_t status = f_socketss_resize(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- {
- const f_status_t status = f_socketss_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_socket_socketss_decimate_by__works(void **state) {
-
- const int length = 5;
- f_socketss_t data = f_sockets_t_initialize;
-
- {
- const f_status_t status = f_socketss_resize(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- {
- const f_status_t status = f_socketss_decimate_by(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, 0);
- }
-
- assert_null(data.array);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
+++ /dev/null
-/**
- * FLL - Level 0
- *
- * Project: Socket
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the type project.
- */
-#ifndef _TEST__F_socket__socketss_decimate_by
-#define _TEST__F_socket__socketss_decimate_by
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_socketss_decimate_by()
- */
-extern void test__f_socket_socketss_decimate_by__parameter_checking(void **state);
-
-/**
- * Test that the function returns F_data_not.
- *
- * @see f_socket_socketss_decimate_by()
- */
-extern void test__f_socket_socketss_decimate_by__returns_data_not(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_socketss_decimate_by()
- */
-extern void test__f_socket_socketss_decimate_by__works(void **state);
-
-#endif // _TEST__F_socket__socketss_decimate_by
+++ /dev/null
-#include "test-socket.h"
-#include "test-socket-socketss_decrease_by.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_socket_socketss_decrease_by__parameter_checking(void **state) {
-
- const int length = 5;
- f_socketss_t data = f_sockets_t_initialize;
-
- {
- const f_status_t status = f_socketss_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_socket_socketss_decrease_by__returns_data_not(void **state) {
-
- const int length = 5;
- f_socketss_t data = f_socketss_t_initialize;
-
- {
- const f_status_t status = f_socketss_resize(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- {
- const f_status_t status = f_socketss_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_socket_socketss_decrease_by__works(void **state) {
-
- const int length = 5;
- f_socketss_t data = f_sockets_t_initialize;
-
- {
- const f_status_t status = f_socketss_resize(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- {
- const f_status_t status = f_socketss_decrease_by(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, 0);
- }
-
- assert_null(data.array);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
+++ /dev/null
-/**
- * FLL - Level 0
- *
- * Project: Socket
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the type project.
- */
-#ifndef _TEST__F_socket__socketss_decrease_by
-#define _TEST__F_socket__socketss_decrease_by
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_socketss_decrease_by()
- */
-extern void test__f_socket_socketss_decrease_by__parameter_checking(void **state);
-
-/**
- * Test that the function returns F_data_not.
- *
- * @see f_socketss_decrease_by()
- */
-extern void test__f_socket_socketss_decrease_by__returns_data_not(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_socketss_decrease_by()
- */
-extern void test__f_socket_socketss_decrease_by__works(void **state);
-
-#endif // _TEST__F_socket__socketss_decrease_by
+++ /dev/null
-#include "test-socket.h"
-#include "test-socket-socketss_increase.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_socket_socketss_increase__parameter_checking(void **state) {
-
- const int length = 5;
- f_socketss_t data = f_sockets_t_initialize;
-
- {
- const f_status_t status = f_socketss_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_socket_socketss_increase__returns_data_not(void **state) {
-
- const int length = 5;
- f_socketss_t data = f_sockets_t_initialize;
-
- {
- const f_status_t status = f_socketss_resize(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- {
- const f_status_t status = f_socketss_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_socket_socketss_increase__works(void **state) {
-
- const int length = 5;
- f_socketss_t data = f_sockets_t_initialize;
-
- {
- const f_status_t status = f_socketss_resize(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- {
- data.used = length;
-
- const f_status_t status = f_socketss_increase(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, length);
- assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d);
- }
-
- free((void *) data.array);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
+++ /dev/null
-/**
- * FLL - Level 0
- *
- * Project: Socket
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the type project.
- */
-#ifndef _TEST__F_socket__socketss_increase
-#define _TEST__F_socket__socketss_increase
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_socketss_increase()
- */
-extern void test__f_socket_socketss_increase__parameter_checking(void **state);
-
-/**
- * Test that the function returns F_data_not.
- *
- * @see f_socketss_increase()
- */
-extern void test__f_socket_socketss_increase__returns_data_not(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_socketss_increase()
- */
-extern void test__f_socket_socketss_increase__works(void **state);
-
-#endif // _TEST__F_socket__socketss_increase
+++ /dev/null
-#include "test-socket.h"
-#include "test-socket-socketss_increase_by.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_socket_socketss_increase_by__parameter_checking(void **state) {
-
- const int length = 5;
- f_socketss_t data = f_sockets_t_initialize;
-
- {
- const f_status_t status = f_socketss_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_socket_socketss_increase_by__returns_data_not(void **state) {
-
- const int length = 5;
- f_socketss_t data = f_socketss_t_initialize;
-
- {
- const f_status_t status = f_socketss_resize(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- {
- const f_status_t status = f_socketss_increase_by(0, &data);
-
- assert_int_equal(status, F_data_not);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- {
- const f_status_t status = f_socketss_increase_by(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_socket_socketss_increase_by__works(void **state) {
-
- const int length = 5;
- f_socketss_t data = f_sockets_t_initialize;
-
- {
- const f_status_t status = f_socketss_resize(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- {
- data.used = length;
-
- const f_status_t status = f_socketss_increase_by(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, length);
- assert_int_equal(data.size, length * 2);
- }
-
- free((void *) data.array);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
+++ /dev/null
-/**
- * FLL - Level 0
- *
- * Project: Socket
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the type project.
- */
-#ifndef _TEST__F_socket__socketss_increase_by
-#define _TEST__F_socket__socketss_increase_by
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_socketss_increase_by()
- */
-extern void test__f_socket_socketss_increase_by__parameter_checking(void **state);
-
-/**
- * Test that the function returns F_data_not.
- *
- * @see f_socketss_increase_by()
- */
-extern void test__f_socket_socketss_increase_by__returns_data_not(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_socketss_increase_by()
- */
-extern void test__f_socket_socketss_increase_by__works(void **state);
-
-#endif // _TEST__F_socket__socketss_increase_by
+++ /dev/null
-#include "test-socket.h"
-#include "test-socket-socketss_resize.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test__f_socket_socketss_resize__parameter_checking(void **state) {
-
- const int length = 5;
- f_socketss_t data = f_socketss_t_initialize;
-
- {
- const f_status_t status = f_socketss_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_socket_socketss_resize__works(void **state) {
-
- const int length = 5;
- f_socketss_t data = f_socketss_t_initialize;
-
- {
- const f_status_t status = f_socketss_resize(length, &data);
-
- assert_int_equal(status, F_okay);
- assert_int_equal(data.used, 0);
- assert_int_equal(data.size, length);
- }
-
- free((void *) data.array);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
+++ /dev/null
-/**
- * FLL - Level 0
- *
- * Project: Socket
- * API Version: 0.7
- * Licenses: lgpl-2.1-or-later
- *
- * Test the array types in the type project.
- */
-#ifndef _TEST__F_socket__socketss_resize
-#define _TEST__F_socket__socketss_resize
-
-/**
- * Test that the function correctly fails on invalid parameter.
- *
- * @see f_socketss_resize()
- */
-extern void test__f_socket_socketss_resize__parameter_checking(void **state);
-
-/**
- * Test that the function works.
- *
- * @see f_socketss_resize()
- */
-extern void test__f_socket_socketss_resize__works(void **state);
-
-#endif // _TEST__F_socket__socketss_resize
--- /dev/null
+#include "test-socket.h"
+#include "test-socket-ss_delete_callback.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_socket_ss_delete_callback__fails(void **state) {
+
+ mock_unwrap = 0;
+ mock_unwrap_f_memory = 0;
+
+ f_socket_t data = f_socket_t_initialize;
+ f_socket_t data_array[] = { data };
+ f_sockets_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_sockets_t datas_array[] = { datas };
+
+ {
+ will_return(__wrap_f_memory_array_resize, true);
+ will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure));
+
+ const f_status_t status = f_socketss_delete_callback(0, 1, (void *) datas_array);
+
+ assert_int_equal(status, F_status_set_error(F_failure));
+ }
+}
+
+void test__f_socket_ss_delete_callback__works(void **state) {
+
+ mock_unwrap = 1;
+ mock_unwrap_f_memory = 1;
+
+ const f_number_unsigned_t length = 1;
+
+ f_socketss_t datass = f_socketss_t_initialize;
+
+ {
+ f_status_t status = f_memory_array_resize(length, sizeof(f_sockets_t), (void **) &datass.array, &datass.used, &datass.size);
+ assert_int_equal(status, F_okay);
+
+ status = f_memory_array_resize(1, sizeof(f_socket_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size);
+ assert_int_equal(status, F_okay);
+ }
+
+ {
+ const f_status_t status = f_socketss_delete_callback(0, length, (void *) datass.array);
+
+ assert_int_equal(status, F_okay);
+ assert_int_equal(datass.array[0].size, 0);
+ }
+
+ free((void *) datass.array);
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Socket
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the type project.
+ */
+#ifndef _TEST__F_socket__ss_delete_callback
+#define _TEST__F_socket__ss_delete_callback
+
+/**
+ * Test that the function fails.
+ *
+ * @see f_socketss_delete_callback()
+ */
+extern void test__f_socket_ss_delete_callback__fails(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_socketss_delete_callback()
+ */
+extern void test__f_socket_ss_delete_callback__works(void **state);
+
+#endif // _TEST__F_socket__ss_delete_callback
--- /dev/null
+#include "test-socket.h"
+#include "test-socket-ss_destroy_callback.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_socket_ss_destroy_callback__fails(void **state) {
+
+ mock_unwrap = 0;
+ mock_unwrap_f_memory = 0;
+
+ f_socket_t data = f_socket_t_initialize;
+ f_socket_t data_array[] = { data };
+ f_sockets_t datas = { .array = data_array, .used = 1, .size = 1 };
+ f_sockets_t datas_array[] = { datas };
+
+ {
+ will_return(__wrap_f_memory_array_adjust, true);
+ will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure));
+
+ const f_status_t status = f_socketss_destroy_callback(0, 1, (void *) datas_array);
+
+ assert_int_equal(status, F_status_set_error(F_failure));
+ }
+}
+
+void test__f_socket_ss_destroy_callback__works(void **state) {
+
+ mock_unwrap = 1;
+ mock_unwrap_f_memory = 1;
+
+ const f_number_unsigned_t length = 1;
+
+ f_socketss_t datass = f_socketss_t_initialize;
+
+ {
+ f_status_t status = f_memory_array_adjust(length, sizeof(f_sockets_t), (void **) &datass.array, &datass.used, &datass.size);
+ assert_int_equal(status, F_okay);
+
+ status = f_memory_array_adjust(1, sizeof(f_socket_t), (void **) &datass.array[0].array, &datass.array[0].used, &datass.array[0].size);
+ assert_int_equal(status, F_okay);
+ }
+
+ {
+ const f_status_t status = f_socketss_destroy_callback(0, length, (void *) datass.array);
+
+ assert_int_equal(status, F_okay);
+ assert_int_equal(datass.array[0].size, 0);
+ }
+
+ free((void *) datass.array);
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: Socket
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the array types in the type project.
+ */
+#ifndef _TEST__F_socket__ss_destroy_callback
+#define _TEST__F_socket__ss_destroy_callback
+
+/**
+ * Test that the function fails.
+ *
+ * @see f_socketss_destroy_callback()
+ */
+extern void test__f_socket_ss_destroy_callback__fails(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_socketss_destroy_callback()
+ */
+extern void test__f_socket_ss_destroy_callback__works(void **state);
+
+#endif // _TEST__F_socket__ss_destroy_callback
cmocka_unit_test(test__f_socket_write_stream__fails),
cmocka_unit_test(test__f_socket_write_stream__works),
- cmocka_unit_test(test__f_socket_sockets_append_all__returns_data_not),
- cmocka_unit_test(test__f_socket_sockets_decimate_by__returns_data_not),
- cmocka_unit_test(test__f_socket_sockets_decrease_by__returns_data_not),
- cmocka_unit_test(test__f_socket_sockets_increase__returns_data_not),
- cmocka_unit_test(test__f_socket_sockets_increase_by__returns_data_not),
-
- cmocka_unit_test(test__f_socket_sockets_adjust__works),
- cmocka_unit_test(test__f_socket_sockets_append__works),
- cmocka_unit_test(test__f_socket_sockets_append_all__works),
- cmocka_unit_test(test__f_socket_sockets_decimate_by__works),
- cmocka_unit_test(test__f_socket_sockets_decrease_by__works),
- cmocka_unit_test(test__f_socket_sockets_increase__works),
- cmocka_unit_test(test__f_socket_sockets_increase_by__works),
- cmocka_unit_test(test__f_socket_sockets_resize__works),
-
- cmocka_unit_test(test__f_socket_socketss_append__returns_data_not),
- cmocka_unit_test(test__f_socket_socketss_append_all__returns_data_not),
- cmocka_unit_test(test__f_socket_socketss_decimate_by__returns_data_not),
- cmocka_unit_test(test__f_socket_socketss_decrease_by__returns_data_not),
- cmocka_unit_test(test__f_socket_socketss_increase__returns_data_not),
- cmocka_unit_test(test__f_socket_socketss_increase_by__returns_data_not),
-
- cmocka_unit_test(test__f_socket_socketss_adjust__works),
- cmocka_unit_test(test__f_socket_socketss_append__works),
- cmocka_unit_test(test__f_socket_socketss_append_all__works),
- cmocka_unit_test(test__f_socket_socketss_decimate_by__works),
- cmocka_unit_test(test__f_socket_socketss_decrease_by__works),
- cmocka_unit_test(test__f_socket_socketss_increase__works),
- cmocka_unit_test(test__f_socket_socketss_increase_by__works),
- cmocka_unit_test(test__f_socket_socketss_resize__works),
+ cmocka_unit_test(test__f_socket_addressss_destroy_callback__fails),
+ cmocka_unit_test(test__f_socket_addressss_delete_callback__fails),
+
+ cmocka_unit_test(test__f_socket_addressss_delete_callback__works),
+ cmocka_unit_test(test__f_socket_addressss_destroy_callback__works),
+
+ cmocka_unit_test(test__f_socket_ss_destroy_callback__fails),
+ cmocka_unit_test(test__f_socket_ss_delete_callback__fails),
+
+ cmocka_unit_test(test__f_socket_ss_delete_callback__works),
+ cmocka_unit_test(test__f_socket_ss_destroy_callback__works),
#ifndef _di_level_0_parameter_checking_
cmocka_unit_test(test__f_socket_accept__parameter_checking),
cmocka_unit_test(test__f_socket_write_message__parameter_checking),
cmocka_unit_test(test__f_socket_write_stream__parameter_checking),
- cmocka_unit_test(test__f_socket_sockets_adjust__parameter_checking),
- cmocka_unit_test(test__f_socket_sockets_append__parameter_checking),
- cmocka_unit_test(test__f_socket_sockets_append_all__parameter_checking),
- cmocka_unit_test(test__f_socket_sockets_decimate_by__parameter_checking),
- cmocka_unit_test(test__f_socket_sockets_decrease_by__parameter_checking),
- cmocka_unit_test(test__f_socket_sockets_increase__parameter_checking),
- cmocka_unit_test(test__f_socket_sockets_increase_by__parameter_checking),
- cmocka_unit_test(test__f_socket_sockets_resize__parameter_checking),
-
- cmocka_unit_test(test__f_socket_socketss_adjust__parameter_checking),
- cmocka_unit_test(test__f_socket_socketss_append__parameter_checking),
- cmocka_unit_test(test__f_socket_socketss_append_all__parameter_checking),
- cmocka_unit_test(test__f_socket_socketss_decimate_by__parameter_checking),
- cmocka_unit_test(test__f_socket_socketss_decrease_by__parameter_checking),
- cmocka_unit_test(test__f_socket_socketss_increase__parameter_checking),
- cmocka_unit_test(test__f_socket_socketss_increase_by__parameter_checking),
- cmocka_unit_test(test__f_socket_socketss_resize__parameter_checking),
+ // f_socket_addressss_destroy_callback() doesn't use parameter checking.
+ // f_socket_addressss_delete_callback() doesn't use parameter checking.
+
+ // f_socket_ss_destroy_callback() doesn't use parameter checking.
+ // f_socket_ss_delete_callback() doesn't use parameter checking.
#endif // _di_level_0_parameter_checking_
};
// Test includes.
#include "test-socket-accept.h"
+#include "test-socket-addressss_delete_callback.h"
+#include "test-socket-addressss_destroy_callback.h"
#include "test-socket-bind.h"
#include "test-socket-bind_inet4.h"
#include "test-socket-bind_inet6.h"
#include "test-socket-read.h"
#include "test-socket-read_message.h"
#include "test-socket-read_stream.h"
-#include "test-socket-sockets_adjust.h"
-#include "test-socket-sockets_append.h"
-#include "test-socket-sockets_append_all.h"
-#include "test-socket-sockets_decimate_by.h"
-#include "test-socket-sockets_decrease_by.h"
-#include "test-socket-sockets_increase.h"
-#include "test-socket-sockets_increase_by.h"
-#include "test-socket-sockets_resize.h"
-#include "test-socket-socketss_adjust.h"
-#include "test-socket-socketss_append.h"
-#include "test-socket-socketss_append_all.h"
-#include "test-socket-socketss_decimate_by.h"
-#include "test-socket-socketss_decrease_by.h"
-#include "test-socket-socketss_increase.h"
-#include "test-socket-socketss_increase_by.h"
-#include "test-socket-socketss_resize.h"
+#include "test-socket-ss_delete_callback.h"
+#include "test-socket-ss_destroy_callback.h"
#include "test-socket-write.h"
#include "test-socket-write_message.h"
#include "test-socket-write_stream.h"