From: Kevin Day Date: Sun, 21 Apr 2024 03:58:03 +0000 (-0500) Subject: Feature: Add pid_t array types, adding appropriate unit tests. X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=ef3355d0288dd99be2dddf45869fd64b40643cef;p=fll Feature: Add pid_t array types, adding appropriate unit tests. --- diff --git a/build/level_0/settings b/build/level_0/settings index c204b55..4e8c2d5 100644 --- a/build/level_0/settings +++ b/build/level_0/settings @@ -72,7 +72,7 @@ build_sources_library string/map_multi.c string/map_multis.c string/map_multiss. build_sources_library string/static.c string/statics.c string/staticss.c build_sources_library string/triple.c string/triples.c string/tripless.c build_sources_library time.c -build_sources_library type_array/cell.c type_array/file.c type_array/fll_id.c type_array/int8.c type_array/int16.c type_array/int32.c type_array/int64.c type_array/int128.c type_array/number_signed.c type_array/number_unsigned.c type_array/poll.c type_array/quantity.c type_array/quantitys.c type_array/quantityss.c type_array/range.c type_array/ranges.c type_array/rangess.c type_array/range_double.c type_array/range_doubles.c type_array/range_doubless.c type_array/state.c type_array/status.c type_array/uint8.c type_array/uint16.c type_array/uint32.c type_array/uint64.c type_array/uint128.c +build_sources_library type_array/cell.c type_array/file.c type_array/fll_id.c type_array/int8.c type_array/int16.c type_array/int32.c type_array/int64.c type_array/int128.c type_array/number_signed.c type_array/number_unsigned.c type_array/pid.c type_array/poll.c type_array/quantity.c type_array/quantitys.c type_array/quantityss.c type_array/range.c type_array/ranges.c type_array/rangess.c type_array/range_double.c type_array/range_doubles.c type_array/range_doubless.c type_array/state.c type_array/status.c type_array/uint8.c type_array/uint16.c type_array/uint32.c type_array/uint64.c type_array/uint128.c build_sources_library utf.c private-utf.c private-utf_alphabetic.c private-utf_combining.c private-utf_control.c private-utf_digit.c private-utf_emoji.c private-utf_numeric.c private-utf_phonetic.c private-utf_private.c private-utf_punctuation.c private-utf_subscript.c private-utf_superscript.c private-utf_symbol.c private-utf_unassigned.c private-utf_valid.c private-utf_whitespace.c private-utf_wide.c private-utf_word.c private-utf_zero_width.c build_sources_library utf/common.c utf/convert.c build_sources_library utf/dynamic.c utf/dynamics.c utf/dynamicss.c @@ -120,8 +120,8 @@ build_sources_headers string/map_multi.h string/map_multis.h string/map_multiss. build_sources_headers string/static.h string/statics.h string/staticss.h build_sources_headers string/triple.h string/triples.h string/tripless.h build_sources_headers time.h time/common.h -build_sources_headers type.h type/cell.h type/file.h type/fll.h type/mode.h type/number.h type/quantity.h type/range.h type/range_double.h type/state.h type/status.h type/time.h -build_sources_headers type_array.h type_array_file.h type_array/common.h type_array/cell.h type_array/file.h type_array/fll_id.h type_array/int8.h type_array/int16.h type_array/int32.h type_array/int64.h type_array/int128.h type_array/number_signed.h type_array/number_unsigned.h type_array/poll.h type_array/quantity.h type_array/quantitys.h type_array/quantityss.h type_array/range.h type_array/ranges.h type_array/rangess.h type_array/range_double.h type_array/range_doubles.h type_array/range_doubless.h type_array/state.h type_array/status.h type_array/uint8.h type_array/uint16.h type_array/uint32.h type_array/uint64.h type_array/uint128.h +build_sources_headers type.h type/cell.h type/file.h type/fll.h type/mode.h type/number.h type/pid.h type/quantity.h type/range.h type/range_double.h type/state.h type/status.h type/time.h +build_sources_headers type_array.h type_array_file.h type_array/common.h type_array/cell.h type_array/file.h type_array/fll_id.h type_array/int8.h type_array/int16.h type_array/int32.h type_array/int64.h type_array/int128.h type_array/number_signed.h type_array/number_unsigned.h type_array/pid.h type_array/poll.h type_array/quantity.h type_array/quantitys.h type_array/quantityss.h type_array/range.h type_array/ranges.h type_array/rangess.h type_array/range_double.h type_array/range_doubles.h type_array/range_doubless.h type_array/state.h type_array/status.h type_array/uint8.h type_array/uint16.h type_array/uint32.h type_array/uint64.h type_array/uint128.h build_sources_headers utf.h utf/common.h utf/convert.h utf/dynamic.h utf/dynamics.h utf/dynamicss.h utf/is.h utf/is_character.h utf/map.h utf/maps.h utf/mapss.h utf/map_multi.h utf/map_multis.h utf/map_multiss.h utf/static.h utf/statics.h utf/staticss.h utf/string.h utf/triple.h utf/triples.h utf/tripless.h build_sources_headers-thread thread.h thread/attribute.h thread/barrier.h thread/barrier_attribute.h thread/condition.h thread/condition_attribute.h thread/id.h thread/key.h thread/lock.h thread/lock_attribute.h thread/mutex.h thread/mutex_attribute.h thread/once.h thread/semaphore.h thread/set.h thread/spin.h diff --git a/build/monolithic/settings b/build/monolithic/settings index da446e5..6ec3c6a 100644 --- a/build/monolithic/settings +++ b/build/monolithic/settings @@ -72,7 +72,7 @@ build_sources_library level_0/string/map_multi.c level_0/string/map_multis.c lev build_sources_library level_0/string/static.c level_0/string/statics.c level_0/string/staticss.c build_sources_library level_0/string/triple.c level_0/string/triples.c level_0/string/tripless.c build_sources_library level_0/time.c -build_sources_library level_0/type_array/cell.c level_0/type_array/file.c level_0/type_array/fll_id.c level_0/type_array/int8.c level_0/type_array/int16.c level_0/type_array/int32.c level_0/type_array/int64.c level_0/type_array/int128.c level_0/type_array/number_signed.c level_0/type_array/number_unsigned.c level_0/type_array/poll.c level_0/type_array/quantity.c level_0/type_array/quantitys.c level_0/type_array/quantityss.c level_0/type_array/range.c level_0/type_array/ranges.c level_0/type_array/rangess.c level_0/type_array/range_double.c level_0/type_array/range_doubles.c level_0/type_array/range_doubless.c level_0/type_array/state.c level_0/type_array/status.c level_0/type_array/uint8.c level_0/type_array/uint16.c level_0/type_array/uint32.c level_0/type_array/uint64.c level_0/type_array/uint128.c +build_sources_library level_0/type_array/cell.c level_0/type_array/file.c level_0/type_array/fll_id.c level_0/type_array/int8.c level_0/type_array/int16.c level_0/type_array/int32.c level_0/type_array/int64.c level_0/type_array/int128.c level_0/type_array/number_signed.c level_0/type_array/number_unsigned.c level_0/type_array/pid.c level_0/type_array/poll.c level_0/type_array/quantity.c level_0/type_array/quantitys.c level_0/type_array/quantityss.c level_0/type_array/range.c level_0/type_array/ranges.c level_0/type_array/rangess.c level_0/type_array/range_double.c level_0/type_array/range_doubles.c level_0/type_array/range_doubless.c level_0/type_array/state.c level_0/type_array/status.c level_0/type_array/uint8.c level_0/type_array/uint16.c level_0/type_array/uint32.c level_0/type_array/uint64.c level_0/type_array/uint128.c build_sources_library level_0/utf.c level_0/private-utf.c level_0/private-utf_alphabetic.c level_0/private-utf_combining.c level_0/private-utf_control.c level_0/private-utf_digit.c level_0/private-utf_emoji.c level_0/private-utf_numeric.c level_0/private-utf_phonetic.c level_0/private-utf_private.c level_0/private-utf_punctuation.c level_0/private-utf_subscript.c level_0/private-utf_superscript.c level_0/private-utf_symbol.c level_0/private-utf_unassigned.c level_0/private-utf_valid.c level_0/private-utf_whitespace.c level_0/private-utf_wide.c level_0/private-utf_word.c level_0/private-utf_zero_width.c build_sources_library level_0/utf/common.c level_0/utf/convert.c build_sources_library level_0/utf/dynamic.c level_0/utf/dynamics.c level_0/utf/dynamicss.c @@ -141,8 +141,8 @@ build_sources_headers level_0/string/map_multi.h level_0/string/map_multis.h lev build_sources_headers level_0/string/static.h level_0/string/statics.h level_0/string/staticss.h build_sources_headers level_0/string/triple.h level_0/string/triples.h level_0/string/tripless.h build_sources_headers level_0/time.h level_0/time/common.h -build_sources_headers level_0/type.h level_0/type/cell.h level_0/type/file.h level_0/type/fll.h level_0/type/mode.h level_0/type/number.h level_0/type/quantity.h level_0/type/range.h level_0/type/range_double.h level_0/type/state.h level_0/type/status.h level_0/type/time.h -build_sources_headers level_0/type_array.h level_0/type_array_file.h level_0/type_array/common.h level_0/type_array/cell.h level_0/type_array/file.h level_0/type_array/fll_id.h level_0/type_array/int8.h level_0/type_array/int16.h level_0/type_array/int32.h level_0/type_array/int64.h level_0/type_array/int128.h level_0/type_array/number_signed.h level_0/type_array/number_unsigned.h level_0/type_array/poll.h level_0/type_array/quantity.h level_0/type_array/quantitys.h level_0/type_array/quantityss.h level_0/type_array/range.h level_0/type_array/ranges.h level_0/type_array/rangess.h level_0/type_array/range_double.h level_0/type_array/range_doubles.h level_0/type_array/range_doubless.h level_0/type_array/state.h level_0/type_array/status.h level_0/type_array/uint8.h level_0/type_array/uint16.h level_0/type_array/uint32.h level_0/type_array/uint64.h level_0/type_array/uint128.h +build_sources_headers level_0/type.h level_0/type/cell.h level_0/type/file.h level_0/type/fll.h level_0/type/mode.h level_0/type/number.h level_0/type/pid.h level_0/type/quantity.h level_0/type/range.h level_0/type/range_double.h level_0/type/state.h level_0/type/status.h level_0/type/time.h +build_sources_headers level_0/type_array.h level_0/type_array_file.h level_0/type_array/common.h level_0/type_array/cell.h level_0/type_array/file.h level_0/type_array/fll_id.h level_0/type_array/int8.h level_0/type_array/int16.h level_0/type_array/int32.h level_0/type_array/int64.h level_0/type_array/int128.h level_0/type_array/number_signed.h level_0/type_array/number_unsigned.h level_0/type_array/pid.h level_0/type_array/poll.h level_0/type_array/quantity.h level_0/type_array/quantitys.h level_0/type_array/quantityss.h level_0/type_array/range.h level_0/type_array/ranges.h level_0/type_array/rangess.h level_0/type_array/range_double.h level_0/type_array/range_doubles.h level_0/type_array/range_doubless.h level_0/type_array/state.h level_0/type_array/status.h level_0/type_array/uint8.h level_0/type_array/uint16.h level_0/type_array/uint32.h level_0/type_array/uint64.h level_0/type_array/uint128.h build_sources_headers level_0/utf.h level_0/utf/common.h level_0/utf/convert.h level_0/utf/dynamic.h level_0/utf/dynamics.h level_0/utf/dynamicss.h level_0/utf/is.h level_0/utf/is_character.h level_0/utf/map.h level_0/utf/maps.h level_0/utf/mapss.h level_0/utf/map_multi.h level_0/utf/map_multis.h level_0/utf/map_multiss.h level_0/utf/static.h level_0/utf/statics.h level_0/utf/staticss.h level_0/utf/string.h level_0/utf/triple.h level_0/utf/triples.h level_0/utf/tripless.h build_sources_headers level_1/control_group.h diff --git a/level_0/f_type/c/type.h b/level_0/f_type/c/type.h index ba4ee3a..2ae24ae 100644 --- a/level_0/f_type/c/type.h +++ b/level_0/f_type/c/type.h @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -31,6 +32,7 @@ #include #include #include +#include #include #include #include diff --git a/level_0/f_type/c/type/cell.h b/level_0/f_type/c/type/cell.h index 9897347..9cb54a0 100644 --- a/level_0/f_type/c/type/cell.h +++ b/level_0/f_type/c/type/cell.h @@ -32,10 +32,6 @@ extern "C" { #define f_cell_t_initialize { 0, 0 } #define macro_f_cell_t_initialize_1(row, column) { row, column } - - #define macro_f_cell_t_clear(cell) \ - cell.row = 0; \ - cell.column = 0; #endif // _di_f_cell_t_ /** diff --git a/level_0/f_type/c/type/fll.h b/level_0/f_type/c/type/fll.h index e1315aa..0fe0b8d 100644 --- a/level_0/f_type/c/type/fll.h +++ b/level_0/f_type/c/type/fll.h @@ -62,11 +62,6 @@ extern "C" { } #define macro_f_fll_id_t_initialize_1(name, type, used) { name, type, used } - - #define macro_f_fll_id_t_clear(id) \ - id.name[0] = 0; \ - id.type = 0; \ - id.used = 0; #endif // _di_f_fll_id_t_ /** diff --git a/level_0/f_type/c/type/pid.h b/level_0/f_type/c/type/pid.h new file mode 100644 index 0000000..977e412 --- /dev/null +++ b/level_0/f_type/c/type/pid.h @@ -0,0 +1,67 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Defines pid type data. + * + * This is auto-included by type.h and should not need to be explicitly included. + */ +#ifndef _F_pid_h +#define _F_pid_h + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * An array of pids. + * + * Properties: + * - array: The array of pids. + * - size: Total amount of allocated space. + * - used: Total number of allocated spaces used. + */ +#ifndef _di_f_pids_t_ + typedef struct { + pid_t *array; + + f_number_unsigned_t size; + f_number_unsigned_t used; + } f_pids_t; + + #define f_pids_t_initialize { 0, 0, 0 } + + #define macro_f_pids_t_initialize_1(array, size, used) { array, size, used } + #define macro_f_pids_t_initialize_2(array, length) { array, length, length } +#endif // _di_f_pids_t_ + +/** + * This holds an array of f_pids_t. + * + * Properties: + * - array: The array of pids arrays. + * - size: Total amount of allocated space. + * - used: Total number of allocated spaces used. + */ +#ifndef _di_f_pidss_t_ + typedef struct { + f_pids_t *array; + + f_number_unsigned_t size; + f_number_unsigned_t used; + } f_pidss_t; + + #define f_pidss_t_initialize { 0, 0, 0 } + + #define macro_f_pidss_t_initialize_1(array, size, used) { array, size, used } + #define macro_f_pidss_t_initialize_2(array, length) { array, length, length } +#endif // _di_f_pidss_t_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _F_pid_h diff --git a/level_0/f_type/c/type/quantity.h b/level_0/f_type/c/type/quantity.h index 7ca7613..88bc290 100644 --- a/level_0/f_type/c/type/quantity.h +++ b/level_0/f_type/c/type/quantity.h @@ -38,10 +38,6 @@ extern "C" { #define f_quantity_t_initialize { 0, 0 } #define macro_f_quantity_t_initialize_1(start, total) { start, total } - - #define macro_f_quantity_t_clear(quantity) \ - quantity.start = 0; \ - quantity.total = 0; #endif // _di_f_quantity_t_ /** @@ -64,11 +60,6 @@ extern "C" { #define macro_f_quantitys_t_initialize_1(array, size, used) { array, size, used } #define macro_f_quantitys_t_initialize_2(array, length) { array, length, length } - - #define macro_f_quantitys_t_clear(quantitys) \ - quantitys.array = 0; \ - quantitys.size = 0; \ - quantitys.used = 0; #endif // _di_f_quantitys_t_ /** @@ -91,11 +82,6 @@ extern "C" { #define macro_f_quantityss_t_initialize_1(array, size, used) { array, size, used } #define macro_f_quantityss_t_initialize_2(array, length) { array, length, length } - - #define macro_f_quantityss_t_clear(quantityss) \ - quantityss.array = 0; \ - quantityss.size = 0; \ - quantityss.used = 0; #endif // _di_f_quantityss_t_ #ifdef __cplusplus diff --git a/level_0/f_type/c/type/range.h b/level_0/f_type/c/type/range.h index 1db8085..801ac9c 100644 --- a/level_0/f_type/c/type/range.h +++ b/level_0/f_type/c/type/range.h @@ -37,10 +37,6 @@ extern "C" { #define macro_f_range_t_initialize_1(start, stop) { start, stop } #define macro_f_range_t_initialize_2(length) { length ? 0 : 1, length ? length - 1 : 0 } - - #define macro_f_range_t_clear(range) \ - range.start = 1; \ - range.stop = 0; #endif // _di_f_range_t_ /** @@ -63,11 +59,6 @@ extern "C" { #define macro_f_ranges_t_initialize_1(array, size, used) { array, size, used } #define macro_f_ranges_t_initialize_2(array, length) { array, length, length } - - #define macro_f_ranges_t_clear(ranges) \ - ranges.array = 0; \ - ranges.size = 0; \ - ranges.used = 0; #endif // _di_f_ranges_t_ /** @@ -90,11 +81,6 @@ extern "C" { #define macro_f_rangess_t_initialize_1(array, size, used) { array, size, used } #define macro_f_rangess_t_initialize_2(array, length) { array, length, length } - - #define macro_f_rangess_t_clear(rangess) \ - rangess.array = 0; \ - rangess.size = 0; \ - rangess.used = 0; #endif // _di_f_rangess_t_ #ifdef __cplusplus diff --git a/level_0/f_type/c/type/range_double.h b/level_0/f_type/c/type/range_double.h index 5206266..fe6b369 100644 --- a/level_0/f_type/c/type/range_double.h +++ b/level_0/f_type/c/type/range_double.h @@ -41,12 +41,6 @@ extern "C" { #define macro_f_range_double_t_initialize_1(start_1, stop_1, start_2, stop_2) { start_1, stop_1, start_2, stop_2 } #define macro_f_range_double_t_initialize_2(length_1, length_2) { length_1 ? 0 : 1, length_1 ? length_1 - 1 : 0, length_2 ? 0 : 1, length_2 ? length_2 - 1 : 0 } - - #define macro_f_range_double_t_clear(range_1, range_2) \ - range_1.start = 1; \ - range_1.stop = 0 \ - range_2.start = 1; \ - range_2.stop = 0; #endif // _di_f_range_double_t_ /** @@ -69,11 +63,6 @@ extern "C" { #define macro_f_range_doubles_t_initialize_1(array, size, used) { array, size, used } #define macro_f_range_doubles_t_initialize_2(array, length) { array, length, length } - - #define macro_f_range_doubles_t_clear(ranges) \ - ranges.array = 0; \ - ranges.size = 0; \ - ranges.used = 0; #endif // _di_f_range_doubles_t_ /** @@ -96,11 +85,6 @@ extern "C" { #define macro_f_range_doubless_t_initialize_1(array, size, used) { array, size, used } #define macro_f_range_doubless_t_initialize_2(array, length) { array, length, length } - - #define macro_f_range_doubless_t_clear(rangess) \ - rangess.array = 0; \ - rangess.size = 0; \ - rangess.used = 0; #endif // _di_f_range_doubless_t_ #ifdef __cplusplus diff --git a/level_0/f_type/c/type/state.h b/level_0/f_type/c/type/state.h index 5c5b236..1f17126 100644 --- a/level_0/f_type/c/type/state.h +++ b/level_0/f_type/c/type/state.h @@ -106,18 +106,6 @@ extern "C" { custom, \ data, \ } - - #define macro_f_state_t_clear(state) \ - state.step_large = 0; \ - state.step_small = 0; \ - state.status = F_okay; \ - state.flag = 0; \ - state.code = 0; \ - state.handle = 0; \ - state.interrupt = 0; \ - state.callbacks = 0; \ - state.custom = 0; \ - state.data = 0; #endif // _di_f_state_t_ /** diff --git a/level_0/f_type/c/type/time.h b/level_0/f_type/c/type/time.h index a0938d5..ede21c1 100644 --- a/level_0/f_type/c/type/time.h +++ b/level_0/f_type/c/type/time.h @@ -44,9 +44,6 @@ extern "C" { typedef uint64_t f_time_t; #define f_time_t_initialize 0 - - #define macro_f_time_t_clear(time) \ - time = 0; #endif // _di_f_time_t_ /** @@ -93,10 +90,6 @@ extern "C" { } f_time_simple_t; #define f_time_simple_t_initialize { f_time_t_initialize, f_time_t_initialize } - - #define macro_f_time_simple_t_clear(simple) \ - macro_f_time_t_clear(simple.seconds); \ - macro_f_time_t_clear(simple.seconds_nano); #endif // _di_f_time_simple_t_ /** @@ -123,10 +116,6 @@ extern "C" { } f_date_t; #define f_date_t_initialize { f_time_t_initialize, f_time_t_initialize } - - #define macro_f_date_t_clear(date) \ - date.year = 0; \ - macro_f_time_t_clear(date.time); #endif // _di_f_date_t_ /** @@ -147,10 +136,6 @@ extern "C" { } f_date_simple_t; #define f_date_simple_t_initialize { f_time_t_initialize, macro_f_time_simple_t_clear } - - #define macro_f_date_simple_t_clear(date) \ - macro_f_time_t_clear(date.year); \ - macro_f_time_simple_t_clear(date.time); #endif // _di_f_date_simple_t_ #ifdef __cplusplus diff --git a/level_0/f_type/data/build/settings b/level_0/f_type/data/build/settings index d406982..c9a3442 100644 --- a/level_0/f_type/data/build/settings +++ b/level_0/f_type/data/build/settings @@ -33,7 +33,7 @@ build_language c build_libraries -lc -build_sources_headers type.h type/cell.h type/file.h type/fll.h type/mode.h type/number.h type/quantity.h type/range.h type/range_double.h type/state.h type/status.h type/time.h +build_sources_headers type.h type/cell.h type/file.h type/fll.h type/mode.h type/number.h type/pid.h type/quantity.h type/range.h type/range_double.h type/state.h type/status.h type/time.h build_script yes build_shared yes diff --git a/level_0/f_type_array/c/type_array.h b/level_0/f_type_array/c/type_array.h index c409392..baecd4a 100644 --- a/level_0/f_type_array/c/type_array.h +++ b/level_0/f_type_array/c/type_array.h @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include diff --git a/level_0/f_type_array/c/type_array/cell.c b/level_0/f_type_array/c/type_array/cell.c index d32981d..485ac8a 100644 --- a/level_0/f_type_array/c/type_array/cell.c +++ b/level_0/f_type_array/c/type_array/cell.c @@ -1,5 +1,4 @@ #include "../type_array.h" -#include "cell.h" #ifdef __cplusplus extern "C" { diff --git a/level_0/f_type_array/c/type_array/file.c b/level_0/f_type_array/c/type_array/file.c index 0bb362e..8af4137 100644 --- a/level_0/f_type_array/c/type_array/file.c +++ b/level_0/f_type_array/c/type_array/file.c @@ -1,6 +1,5 @@ #include "../type_array.h" #include "../type_array_file.h" -#include "file.h" #ifdef __cplusplus extern "C" { diff --git a/level_0/f_type_array/c/type_array/fll_id.c b/level_0/f_type_array/c/type_array/fll_id.c index c7add6a..898c304 100644 --- a/level_0/f_type_array/c/type_array/fll_id.c +++ b/level_0/f_type_array/c/type_array/fll_id.c @@ -1,5 +1,4 @@ #include "../type_array.h" -#include "fll_id.h" #ifdef __cplusplus extern "C" { diff --git a/level_0/f_type_array/c/type_array/int128.c b/level_0/f_type_array/c/type_array/int128.c index 918b086..9ab7824 100644 --- a/level_0/f_type_array/c/type_array/int128.c +++ b/level_0/f_type_array/c/type_array/int128.c @@ -1,5 +1,4 @@ #include "../type_array.h" -#include "int128.h" #ifdef __cplusplus extern "C" { diff --git a/level_0/f_type_array/c/type_array/int16.c b/level_0/f_type_array/c/type_array/int16.c index 31f1346..b8fce7d 100644 --- a/level_0/f_type_array/c/type_array/int16.c +++ b/level_0/f_type_array/c/type_array/int16.c @@ -1,5 +1,4 @@ #include "../type_array.h" -#include "int16.h" #ifdef __cplusplus extern "C" { diff --git a/level_0/f_type_array/c/type_array/int32.c b/level_0/f_type_array/c/type_array/int32.c index 57be98a..2030867 100644 --- a/level_0/f_type_array/c/type_array/int32.c +++ b/level_0/f_type_array/c/type_array/int32.c @@ -1,5 +1,4 @@ #include "../type_array.h" -#include "int32.h" #ifdef __cplusplus extern "C" { diff --git a/level_0/f_type_array/c/type_array/int64.c b/level_0/f_type_array/c/type_array/int64.c index 68de331..a369835 100644 --- a/level_0/f_type_array/c/type_array/int64.c +++ b/level_0/f_type_array/c/type_array/int64.c @@ -1,5 +1,4 @@ #include "../type_array.h" -#include "int64.h" #ifdef __cplusplus extern "C" { diff --git a/level_0/f_type_array/c/type_array/int8.c b/level_0/f_type_array/c/type_array/int8.c index e02fc17..324fc19 100644 --- a/level_0/f_type_array/c/type_array/int8.c +++ b/level_0/f_type_array/c/type_array/int8.c @@ -1,5 +1,4 @@ #include "../type_array.h" -#include "int8.h" #ifdef __cplusplus extern "C" { diff --git a/level_0/f_type_array/c/type_array/number_signed.c b/level_0/f_type_array/c/type_array/number_signed.c index d09ac6b..77c4f46 100644 --- a/level_0/f_type_array/c/type_array/number_signed.c +++ b/level_0/f_type_array/c/type_array/number_signed.c @@ -1,5 +1,4 @@ #include "../type_array.h" -#include "number_signed.h" #ifdef __cplusplus extern "C" { diff --git a/level_0/f_type_array/c/type_array/number_unsigned.c b/level_0/f_type_array/c/type_array/number_unsigned.c index 86148b8..2457436 100644 --- a/level_0/f_type_array/c/type_array/number_unsigned.c +++ b/level_0/f_type_array/c/type_array/number_unsigned.c @@ -1,5 +1,4 @@ #include "../type_array.h" -#include "number_unsigned.h" #ifdef __cplusplus extern "C" { diff --git a/level_0/f_type_array/c/type_array/pid.c b/level_0/f_type_array/c/type_array/pid.c new file mode 100644 index 0000000..cb61dc2 --- /dev/null +++ b/level_0/f_type_array/c/type_array/pid.c @@ -0,0 +1,49 @@ +#include "../type_array.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_f_pidss_delete_callback_ + f_status_t f_pidss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { + + { + f_pids_t * const array = (f_pids_t *) void_array; + f_status_t status = F_okay; + + for (f_number_unsigned_t i = start; i < stop; ++i) { + + if (array[i].size && array[i].array) { + status = f_memory_array_resize(0, sizeof(pid_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_pidss_delete_callback_ + +#ifndef _di_f_pidss_destroy_callback_ + f_status_t f_pidss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { + + { + f_pids_t * const array = (f_pids_t *) void_array; + f_status_t status = F_okay; + + for (f_number_unsigned_t i = start; i < stop; ++i) { + + if (array[i].size && array[i].array) { + status = f_memory_array_adjust(0, sizeof(pid_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_pidss_destroy_callback_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/c/type_array/pid.h b/level_0/f_type_array/c/type_array/pid.h new file mode 100644 index 0000000..09d3c0c --- /dev/null +++ b/level_0/f_type_array/c/type_array/pid.h @@ -0,0 +1,81 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Defines data to be used for/by type (array) related functionality. + * + * This is auto-included by type_array.h and should not need to be explicitly included. + */ +#ifndef _F_type_array_pid_h +#define _F_type_array_pid_h + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * A callback intended to be passed to f_memory_arrays_resize() for an f_pidss_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_resize(). + * + * @see f_memory_array_resize() + * @see f_memory_arrays_resize() + */ +#ifndef _di_f_pidss_delete_callback_ + extern f_status_t f_pidss_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_pidss_delete_callback_ + +/** + * A callback intended to be passed to f_memory_arrays_adjust() for an f_pidss_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(). + * + * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() + */ +#ifndef _di_f_pidss_destroy_callback_ + extern f_status_t f_pidss_destroy_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const array); +#endif // _di_f_pidss_destroy_callback_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _F_type_array_pid_h diff --git a/level_0/f_type_array/c/type_array/poll.c b/level_0/f_type_array/c/type_array/poll.c index c4bb80d..06f2819 100644 --- a/level_0/f_type_array/c/type_array/poll.c +++ b/level_0/f_type_array/c/type_array/poll.c @@ -1,6 +1,5 @@ #include "../type_array.h" #include "../type_array_file.h" -#include "poll.h" #ifdef __cplusplus extern "C" { diff --git a/level_0/f_type_array/c/type_array/quantity.c b/level_0/f_type_array/c/type_array/quantity.c index f569d9f..6cee77b 100644 --- a/level_0/f_type_array/c/type_array/quantity.c +++ b/level_0/f_type_array/c/type_array/quantity.c @@ -1,5 +1,4 @@ #include "../type_array.h" -#include "quantity.h" #ifdef __cplusplus extern "C" { diff --git a/level_0/f_type_array/c/type_array/quantitys.c b/level_0/f_type_array/c/type_array/quantitys.c index 28f0a0d..f6f1a71 100644 --- a/level_0/f_type_array/c/type_array/quantitys.c +++ b/level_0/f_type_array/c/type_array/quantitys.c @@ -1,5 +1,4 @@ #include "../type_array.h" -#include "quantitys.h" #ifdef __cplusplus extern "C" { diff --git a/level_0/f_type_array/c/type_array/quantityss.c b/level_0/f_type_array/c/type_array/quantityss.c index 7148b16..4ac42c9 100644 --- a/level_0/f_type_array/c/type_array/quantityss.c +++ b/level_0/f_type_array/c/type_array/quantityss.c @@ -1,5 +1,4 @@ #include "../type_array.h" -#include "quantityss.h" #ifdef __cplusplus extern "C" { diff --git a/level_0/f_type_array/c/type_array/range.c b/level_0/f_type_array/c/type_array/range.c index b857990..6710353 100644 --- a/level_0/f_type_array/c/type_array/range.c +++ b/level_0/f_type_array/c/type_array/range.c @@ -1,5 +1,4 @@ #include "../type_array.h" -#include "range.h" #ifdef __cplusplus extern "C" { diff --git a/level_0/f_type_array/c/type_array/range_double.c b/level_0/f_type_array/c/type_array/range_double.c index 43bbc32..291c143 100644 --- a/level_0/f_type_array/c/type_array/range_double.c +++ b/level_0/f_type_array/c/type_array/range_double.c @@ -1,5 +1,4 @@ #include "../type_array.h" -#include "range_double.h" #ifdef __cplusplus extern "C" { diff --git a/level_0/f_type_array/c/type_array/range_doubles.c b/level_0/f_type_array/c/type_array/range_doubles.c index 7177423..03c8c3e 100644 --- a/level_0/f_type_array/c/type_array/range_doubles.c +++ b/level_0/f_type_array/c/type_array/range_doubles.c @@ -1,5 +1,4 @@ #include "../type_array.h" -#include "range_doubles.h" #ifdef __cplusplus extern "C" { diff --git a/level_0/f_type_array/c/type_array/range_doubless.c b/level_0/f_type_array/c/type_array/range_doubless.c index 60c10c3..665dd1f 100644 --- a/level_0/f_type_array/c/type_array/range_doubless.c +++ b/level_0/f_type_array/c/type_array/range_doubless.c @@ -1,5 +1,4 @@ #include "../type_array.h" -#include "range_doubless.h" #ifdef __cplusplus extern "C" { diff --git a/level_0/f_type_array/c/type_array/ranges.c b/level_0/f_type_array/c/type_array/ranges.c index d8cc08d..7091137 100644 --- a/level_0/f_type_array/c/type_array/ranges.c +++ b/level_0/f_type_array/c/type_array/ranges.c @@ -1,5 +1,4 @@ #include "../type_array.h" -#include "ranges.h" #ifdef __cplusplus extern "C" { diff --git a/level_0/f_type_array/c/type_array/rangess.c b/level_0/f_type_array/c/type_array/rangess.c index 89bd170..1dba949 100644 --- a/level_0/f_type_array/c/type_array/rangess.c +++ b/level_0/f_type_array/c/type_array/rangess.c @@ -1,5 +1,4 @@ #include "../type_array.h" -#include "rangess.h" #ifdef __cplusplus extern "C" { diff --git a/level_0/f_type_array/c/type_array/state.c b/level_0/f_type_array/c/type_array/state.c index 8f2f67f..d32a4cb 100644 --- a/level_0/f_type_array/c/type_array/state.c +++ b/level_0/f_type_array/c/type_array/state.c @@ -1,5 +1,4 @@ #include "../type_array.h" -#include "state.h" #ifdef __cplusplus extern "C" { diff --git a/level_0/f_type_array/c/type_array/status.c b/level_0/f_type_array/c/type_array/status.c index b2b0fa3..7498326 100644 --- a/level_0/f_type_array/c/type_array/status.c +++ b/level_0/f_type_array/c/type_array/status.c @@ -1,5 +1,4 @@ #include "../type_array.h" -#include "status.h" #ifdef __cplusplus extern "C" { diff --git a/level_0/f_type_array/c/type_array/uint128.c b/level_0/f_type_array/c/type_array/uint128.c index 1f50133..1088d21 100644 --- a/level_0/f_type_array/c/type_array/uint128.c +++ b/level_0/f_type_array/c/type_array/uint128.c @@ -1,5 +1,4 @@ #include "../type_array.h" -#include "uint128.h" #ifdef __cplusplus extern "C" { diff --git a/level_0/f_type_array/c/type_array/uint16.c b/level_0/f_type_array/c/type_array/uint16.c index fdcf230..0f03a04 100644 --- a/level_0/f_type_array/c/type_array/uint16.c +++ b/level_0/f_type_array/c/type_array/uint16.c @@ -1,5 +1,4 @@ #include "../type_array.h" -#include "uint16.h" #ifdef __cplusplus extern "C" { diff --git a/level_0/f_type_array/c/type_array/uint32.c b/level_0/f_type_array/c/type_array/uint32.c index c35226c..8ed43f3 100644 --- a/level_0/f_type_array/c/type_array/uint32.c +++ b/level_0/f_type_array/c/type_array/uint32.c @@ -1,5 +1,4 @@ #include "../type_array.h" -#include "uint32.h" #ifdef __cplusplus extern "C" { diff --git a/level_0/f_type_array/c/type_array/uint64.c b/level_0/f_type_array/c/type_array/uint64.c index bdb427f..2f0ce7b 100644 --- a/level_0/f_type_array/c/type_array/uint64.c +++ b/level_0/f_type_array/c/type_array/uint64.c @@ -1,5 +1,4 @@ #include "../type_array.h" -#include "uint64.h" #ifdef __cplusplus extern "C" { diff --git a/level_0/f_type_array/c/type_array/uint8.c b/level_0/f_type_array/c/type_array/uint8.c index c1bba0e..0de1ab3 100644 --- a/level_0/f_type_array/c/type_array/uint8.c +++ b/level_0/f_type_array/c/type_array/uint8.c @@ -1,5 +1,4 @@ #include "../type_array.h" -#include "uint8.h" #ifdef __cplusplus extern "C" { diff --git a/level_0/f_type_array/data/build/settings b/level_0/f_type_array/data/build/settings index 678cbfc..7313f34 100644 --- a/level_0/f_type_array/data/build/settings +++ b/level_0/f_type_array/data/build/settings @@ -34,9 +34,9 @@ build_language c build_libraries -lc build_libraries-individual -lf_memory -build_sources_library type_array/cell.c type_array/file.c type_array/fll_id.c type_array/int8.c type_array/int16.c type_array/int32.c type_array/int64.c type_array/int128.c type_array/number_signed.c type_array/number_unsigned.c type_array/poll.c type_array/quantity.c type_array/quantitys.c type_array/quantityss.c type_array/range.c type_array/ranges.c type_array/rangess.c type_array/range_double.c type_array/range_doubles.c type_array/range_doubless.c type_array/state.c type_array/status.c type_array/uint8.c type_array/uint16.c type_array/uint32.c type_array/uint64.c type_array/uint128.c +build_sources_library type_array/cell.c type_array/file.c type_array/fll_id.c type_array/int8.c type_array/int16.c type_array/int32.c type_array/int64.c type_array/int128.c type_array/number_signed.c type_array/number_unsigned.c type_array/pid.c type_array/poll.c type_array/quantity.c type_array/quantitys.c type_array/quantityss.c type_array/range.c type_array/ranges.c type_array/rangess.c type_array/range_double.c type_array/range_doubles.c type_array/range_doubless.c type_array/state.c type_array/status.c type_array/uint8.c type_array/uint16.c type_array/uint32.c type_array/uint64.c type_array/uint128.c -build_sources_headers type_array.h type_array_file.h type_array/common.h type_array/cell.h type_array/file.h type_array/fll_id.h type_array/int8.h type_array/int16.h type_array/int32.h type_array/int64.h type_array/int128.h type_array/number_signed.h type_array/number_unsigned.h type_array/poll.h type_array/quantity.h type_array/quantitys.h type_array/quantityss.h type_array/range.h type_array/ranges.h type_array/rangess.h type_array/range_double.h type_array/range_doubles.h type_array/range_doubless.h type_array/state.h type_array/status.h type_array/uint8.h type_array/uint16.h type_array/uint32.h type_array/uint64.h type_array/uint128.h +build_sources_headers type_array.h type_array_file.h type_array/common.h type_array/cell.h type_array/file.h type_array/fll_id.h type_array/int8.h type_array/int16.h type_array/int32.h type_array/int64.h type_array/int128.h type_array/number_signed.h type_array/number_unsigned.h type_array/pid.h type_array/poll.h type_array/quantity.h type_array/quantitys.h type_array/quantityss.h type_array/range.h type_array/ranges.h type_array/rangess.h type_array/range_double.h type_array/range_doubles.h type_array/range_doubless.h type_array/state.h type_array/status.h type_array/uint8.h type_array/uint16.h type_array/uint32.h type_array/uint64.h type_array/uint128.h build_script yes build_shared yes diff --git a/level_0/f_type_array/data/build/settings-mocks b/level_0/f_type_array/data/build/settings-mocks index 1b2fd5d..81b00ce 100644 --- a/level_0/f_type_array/data/build/settings-mocks +++ b/level_0/f_type_array/data/build/settings-mocks @@ -30,10 +30,10 @@ build_language c build_libraries -lc build_libraries-individual -lf_memory -build_sources_library type_array/cell.c type_array/file.c type_array/fll_id.c type_array/int8.c type_array/int16.c type_array/int32.c type_array/int64.c type_array/int128.c type_array/number_signed.c type_array/number_unsigned.c type_array/poll.c type_array/quantity.c type_array/quantitys.c type_array/quantityss.c type_array/range.c type_array/ranges.c type_array/rangess.c type_array/range_double.c type_array/range_doubles.c type_array/range_doubless.c type_array/state.c type_array/status.c type_array/uint8.c type_array/uint16.c type_array/uint32.c type_array/uint64.c type_array/uint128.c +build_sources_library type_array/cell.c type_array/file.c type_array/fll_id.c type_array/int8.c type_array/int16.c type_array/int32.c type_array/int64.c type_array/int128.c type_array/number_signed.c type_array/number_unsigned.c type_array/pid.c type_array/poll.c type_array/quantity.c type_array/quantitys.c type_array/quantityss.c type_array/range.c type_array/ranges.c type_array/rangess.c type_array/range_double.c type_array/range_doubles.c type_array/range_doubless.c type_array/state.c type_array/status.c type_array/uint8.c type_array/uint16.c type_array/uint32.c type_array/uint64.c type_array/uint128.c build_sources_library ../../tests/unit/c/mock-type_array.c -build_sources_headers type_array.h type_array_file.h type_array/common.h type_array/cell.h type_array/file.h type_array/fll_id.h type_array/int8.h type_array/int16.h type_array/int32.h type_array/int64.h type_array/int128.h type_array/number_signed.h type_array/number_unsigned.h type_array/poll.h type_array/quantity.h type_array/quantitys.h type_array/quantityss.h type_array/range.h type_array/ranges.h type_array/rangess.h type_array/range_double.h type_array/range_doubles.h type_array/range_doubless.h type_array/state.h type_array/status.h type_array/uint8.h type_array/uint16.h type_array/uint32.h type_array/uint64.h type_array/uint128.h +build_sources_headers type_array.h type_array_file.h type_array/common.h type_array/cell.h type_array/file.h type_array/fll_id.h type_array/int8.h type_array/int16.h type_array/int32.h type_array/int64.h type_array/int128.h type_array/number_signed.h type_array/number_unsigned.h type_array/pid.h type_array/poll.h type_array/quantity.h type_array/quantitys.h type_array/quantityss.h type_array/range.h type_array/ranges.h type_array/rangess.h type_array/range_double.h type_array/range_doubles.h type_array/range_doubless.h type_array/state.h type_array/status.h type_array/uint8.h type_array/uint16.h type_array/uint32.h type_array/uint64.h type_array/uint128.h build_script yes build_shared yes diff --git a/level_0/f_type_array/data/build/settings-tests b/level_0/f_type_array/data/build/settings-tests index bb251e5..34e94d4 100644 --- a/level_0/f_type_array/data/build/settings-tests +++ b/level_0/f_type_array/data/build/settings-tests @@ -33,6 +33,7 @@ build_sources_program test-type_array-int64ss_delete_callback.c test-type_array- build_sources_program test-type_array-int128ss_delete_callback.c test-type_array-int128ss_destroy_callback.c build_sources_program test-type_array-number_signedss_delete_callback.c test-type_array-number_signedss_destroy_callback.c build_sources_program test-type_array-number_unsignedss_delete_callback.c test-type_array-number_unsignedss_destroy_callback.c +build_sources_program test-type_array-pidss_delete_callback.c test-type_array-pidss_destroy_callback.c build_sources_program test-type_array-pollss_delete_callback.c test-type_array-pollss_destroy_callback.c build_sources_program test-type_array-quantitys_append.c test-type_array-quantitys_append_all.c test-type_array-quantityss_append.c test-type_array-quantityss_append_all.c build_sources_program test-type_array-quantityss_delete_callback.c test-type_array-quantityss_destroy_callback.c diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-pidss_delete_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-pidss_delete_callback.c new file mode 100644 index 0000000..d3dcffd --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-pidss_delete_callback.c @@ -0,0 +1,57 @@ +#include "test-type_array.h" +#include "test-type_array-pidss_delete_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_pidss_delete_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + pid_t data = 0; + pid_t data_array[] = { data }; + f_pids_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_pids_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_pidss_delete_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_pidss_delete_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_pidss_t datass = f_pidss_t_initialize; + + { + f_status_t status = f_memory_array_resize(length, sizeof(f_pids_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_okay); + + status = f_memory_array_resize(1, sizeof(pid_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_pidss_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 diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-pidss_delete_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-pidss_delete_callback.h new file mode 100644 index 0000000..59f2433 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-pidss_delete_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__pidss_delete_callback +#define _TEST__F_type_array__pidss_delete_callback + +/** + * Test that the function fails. + * + * @see f_pidss_delete_callback() + */ +extern void test__f_type_array_pidss_delete_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_pidss_delete_callback() + */ +extern void test__f_type_array_pidss_delete_callback__works(void **state); + +#endif // _TEST__F_type_array__pidss_delete_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-pidss_destroy_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-pidss_destroy_callback.c new file mode 100644 index 0000000..ee1d076 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-pidss_destroy_callback.c @@ -0,0 +1,57 @@ +#include "test-type_array.h" +#include "test-type_array-pidss_destroy_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_pidss_destroy_callback__fails(void **state) { + + mock_unwrap = 0; + mock_unwrap_f_memory = 0; + + pid_t data = 0; + pid_t data_array[] = { data }; + f_pids_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_pids_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_pidss_destroy_callback(0, 1, (void *) datas_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_pidss_destroy_callback__works(void **state) { + + mock_unwrap = 1; + mock_unwrap_f_memory = 1; + + const f_number_unsigned_t length = 1; + + f_pidss_t datass = f_pidss_t_initialize; + + { + f_status_t status = f_memory_array_adjust(length, sizeof(f_pids_t), (void **) &datass.array, &datass.used, &datass.size); + assert_int_equal(status, F_okay); + + status = f_memory_array_adjust(1, sizeof(pid_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_pidss_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 diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-pidss_destroy_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-pidss_destroy_callback.h new file mode 100644 index 0000000..38b47a9 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-pidss_destroy_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__pidss_destroy_callback +#define _TEST__F_type_array__pidss_destroy_callback + +/** + * Test that the function fails. + * + * @see f_pidss_destroy_callback() + */ +extern void test__f_type_array_pidss_destroy_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_pidss_destroy_callback() + */ +extern void test__f_type_array_pidss_destroy_callback__works(void **state); + +#endif // _TEST__F_type_array__pidss_destroy_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array.c b/level_0/f_type_array/tests/unit/c/test-type_array.c index 67d18e5..e1b0ebc 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array.c @@ -77,6 +77,9 @@ int main(void) { cmocka_unit_test(test__f_type_array_number_unsignedss_destroy_callback__fails), cmocka_unit_test(test__f_type_array_number_unsignedss_destroy_callback__works), + cmocka_unit_test(test__f_type_array_pidss_delete_callback__fails), + cmocka_unit_test(test__f_type_array_pidss_delete_callback__works), + cmocka_unit_test(test__f_type_array_pollss_delete_callback__fails), cmocka_unit_test(test__f_type_array_pollss_delete_callback__works), @@ -184,6 +187,9 @@ int main(void) { // f_number_unsignedss_destroy_callback() doesn't use parameter checking. // f_number_unsignedss_delete_callback() doesn't use parameter checking. + // f_pidss_destroy_callback() doesn't use parameter checking. + // f_pidss_delete_callback() doesn't use parameter checking. + // f_pollss_destroy_callback() doesn't use parameter checking. // f_pollss_delete_callback() doesn't use parameter checking. diff --git a/level_0/f_type_array/tests/unit/c/test-type_array.h b/level_0/f_type_array/tests/unit/c/test-type_array.h index 9c46ac9..4ad3707 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array.h @@ -50,6 +50,8 @@ #include "test-type_array-number_signedss_destroy_callback.h" #include "test-type_array-number_unsignedss_delete_callback.h" #include "test-type_array-number_unsignedss_destroy_callback.h" +#include "test-type_array-pidss_delete_callback.h" +#include "test-type_array-pidss_destroy_callback.h" #include "test-type_array-pollss_delete_callback.h" #include "test-type_array-pollss_destroy_callback.h" #include "test-type_array-quantitys_append.h" diff --git a/level_3/controller/c/rule/private-rule.c b/level_3/controller/c/rule/private-rule.c index ca5b169..d3355f1 100644 --- a/level_3/controller/c/rule/private-rule.c +++ b/level_3/controller/c/rule/private-rule.c @@ -3208,7 +3208,6 @@ extern "C" { process->type = type; macro_f_time_simple_t_clear(process->cache.timestamp) - macro_f_range_t_clear(process->cache.range_action) process->cache.ats.used = 0; process->cache.stack.used = 0; @@ -3229,6 +3228,8 @@ extern "C" { process->cache.action.name_file.used = 0; process->cache.action.name_item.used = 0; process->cache.action.generic.used = 0; + process->cache.range_action.start = 1; + process->cache.range_action.stop = 0; process->stack.used = 0;