From: Kevin Day Date: Sun, 6 Aug 2023 21:44:56 +0000 (-0500) Subject: Progress: Continue re-designing of the memory logic. X-Git-Tag: 0.7.0~386 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=0dda50d25ee1fd477b495451c8e8b55b428a85a3;p=fll Progress: Continue re-designing of the memory logic. This wraps up the simple memory append all functions with added unit tests. I anticipate that I need to do the more complex ones as well. This adds the adjust and resize callbacks for use in more complex memory functions. The more complex memory functions for adjust and resize are implemented with unit tests. The unit tests for the type array callbacks are incomplete because I did not get time to finish writing them. Those unit tests are written but are incomplete and do not yet work. --- diff --git a/build/level_0/settings b/build/level_0/settings index 420086114..fed5c006b 100644 --- a/build/level_0/settings +++ b/build/level_0/settings @@ -48,7 +48,7 @@ build_sources_library fss.c fss/common.c fss/item.c fss/named.c fss/nest.c fss/q build_sources_library fss/private-item.c fss/private-named.c fss/private-nest.c fss/private-set.c fss/private-set_quote.c fss/private-simple_packet.c build_sources_library iki.c iki/common.c iki/data.c private-iki.c iki/private-data.c build_sources_library limit.c limit/set.c limit/value.c limit/private-set.c limit/private-value.c -build_sources_library memory.c memory/array.c +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 parse.c parse/utf.c @@ -62,7 +62,7 @@ build_sources_library socket.c socket/socket.c socket/private-socket.c build_sources_library status_string.c build_sources_library string.c build_sources_library private-string.c string/common.c -build_sources_library string/private-dynamic.c string/private-dynamics.c string/private-dynamicss.c +build_sources_library string/private-dynamics.c string/private-dynamicss.c build_sources_library string/private-maps.c string/private-mapss.c build_sources_library string/private-map_multis.c string/private-map_multiss.c build_sources_library string/private-quantitys.c string/private-quantityss.c @@ -77,7 +77,7 @@ 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_unsigned.c type_array/poll.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/private-cell.c type_array/private-file.c type_array/private-fll_id.c type_array/private-int8.c type_array/private-int16.c type_array/private-int32.c type_array/private-int64.c type_array/private-int128.c type_array/private-poll.c type_array/private-state.c type_array/private-status.c type_array/private-uint8.c type_array/private-uint16.c type_array/private-uint32.c type_array/private-uint64.c type_array/private-uint128.c +build_sources_library type_array/private-poll.c type_array/private-state.c type_array/private-status.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 @@ -109,7 +109,7 @@ build_sources_headers file.h file/common.h file/stream.h build_sources_headers fss.h fss/common.h fss/item.h fss/named.h fss/nest.h fss/quote.h fss/set.h fss/set_quote.h fss/simple_packet.h build_sources_headers iki.h iki/common.h iki/data.h build_sources_headers limit.h limit/set.h limit/value.h -build_sources_headers memory.h memory/array.h memory/common.h +build_sources_headers memory.h memory/array.h memory/arrays.h memory/common.h build_sources_headers network.h network/common.h build_sources_headers parse.h parse/utf.h build_sources_headers path.h path/common.h diff --git a/build/monolithic/settings b/build/monolithic/settings index 4c2e7d00f..28fe3a3d9 100644 --- a/build/monolithic/settings +++ b/build/monolithic/settings @@ -48,7 +48,7 @@ build_sources_library level_0/fss.c level_0/fss/common.c level_0/fss/item.c leve build_sources_library level_0/fss/private-item.c level_0/fss/private-named.c level_0/fss/private-nest.c level_0/fss/private-set.c level_0/fss/private-set_quote.c level_0/fss/private-simple_packet.c build_sources_library level_0/iki.c level_0/iki/common.c level_0/iki/data.c level_0/private-iki.c level_0/iki/private-data.c build_sources_library level_0/limit.c level_0/limit/set.c level_0/limit/value.c level_0/limit/private-set.c level_0/limit/private-value.c -build_sources_library level_0/memory.c level_0/memory/array.c +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/parse.c level_0/parse/utf.c @@ -62,7 +62,7 @@ build_sources_library level_0/socket.c level_0/socket/socket.c level_0/socket/pr 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_library level_0/string/private-dynamic.c level_0/string/private-dynamics.c level_0/string/private-dynamicss.c +build_sources_library level_0/string/private-dynamics.c level_0/string/private-dynamicss.c build_sources_library level_0/string/private-maps.c level_0/string/private-mapss.c build_sources_library level_0/string/private-map_multis.c level_0/string/private-map_multiss.c build_sources_library level_0/string/private-quantitys.c level_0/string/private-quantityss.c @@ -77,7 +77,7 @@ build_sources_library level_0/string/static.c level_0/string/statics.c level_0/s 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_unsigned.c level_0/type_array/poll.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/private-cell.c level_0/type_array/private-file.c level_0/type_array/private-fll_id.c level_0/type_array/private-int8.c level_0/type_array/private-int16.c level_0/type_array/private-int32.c level_0/type_array/private-int64.c level_0/type_array/private-int128.c level_0/type_array/private-poll.c level_0/type_array/private-state.c level_0/type_array/private-status.c level_0/type_array/private-uint8.c level_0/type_array/private-uint16.c level_0/type_array/private-uint32.c level_0/type_array/private-uint64.c level_0/type_array/private-uint128.c +build_sources_library level_0/type_array/private-poll.c level_0/type_array/private-state.c level_0/type_array/private-status.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 @@ -130,7 +130,7 @@ build_sources_headers level_0/file.h level_0/file/common.h level_0/file/stream.h build_sources_headers level_0/fss.h level_0/fss/common.h level_0/fss/item.h level_0/fss/named.h level_0/fss/nest.h level_0/fss/quote.h level_0/fss/set.h level_0/fss/set_quote.h level_0/fss/simple_packet.h build_sources_headers level_0/iki.h level_0/iki/common.h level_0/iki/data.h build_sources_headers level_0/limit.h level_0/limit/set.h level_0/limit/value.h -build_sources_headers level_0/memory.h level_0/memory/array.h level_0/memory/common.h +build_sources_headers level_0/memory.h level_0/memory/array.h level_0/memory/arrays.h level_0/memory/common.h build_sources_headers level_0/network.h level_0/network/common.h build_sources_headers level_0/parse.h level_0/parse/utf.h build_sources_headers level_0/path.h level_0/path/common.h diff --git a/build/stand_alone/byte_dump.settings b/build/stand_alone/byte_dump.settings index 83e59831a..94ad185f9 100644 --- a/build/stand_alone/byte_dump.settings +++ b/build/stand_alone/byte_dump.settings @@ -31,9 +31,9 @@ build_sources_program fll/level_0/memory.c fll/level_0/private-memory.c fll/leve build_sources_program fll/level_0/pipe.c build_sources_program fll/level_0/print.c fll/level_0/private-print.c fll/level_0/print/common.c fll/level_0/print/to.c fll/level_0/print/private-to.c build_sources_program fll/level_0/signal.c -build_sources_program fll/level_0/string.c fll/level_0/private-string.c fll/level_0/string/common.c fll/level_0/string/dynamic.c fll/level_0/string/map.c fll/level_0/string/map_multi.c fll/level_0/string/private-dynamic.c fll/level_0/string/private-map.c fll/level_0/string/private-map_multi.c fll/level_0/string/private-quantity.c fll/level_0/string/private-range.c fll/level_0/string/private-triple.c fll/level_0/string/quantity.c fll/level_0/string/range.c fll/level_0/string/static.c fll/level_0/string/triple.c +build_sources_program fll/level_0/string.c fll/level_0/private-string.c fll/level_0/string/common.c fll/level_0/string/dynamic.c fll/level_0/string/map.c fll/level_0/string/map_multi.c fll/level_0/string/private-map.c fll/level_0/string/private-map_multi.c fll/level_0/string/private-quantity.c fll/level_0/string/private-range.c fll/level_0/string/private-triple.c fll/level_0/string/quantity.c fll/level_0/string/range.c fll/level_0/string/static.c fll/level_0/string/triple.c build_sources_program fll/level_0/type_array/cell.c fll/level_0/type_array/fll_id.c fll/level_0/type_array/int8.c fll/level_0/type_array/int16.c fll/level_0/type_array/int32.c fll/level_0/type_array/int64.c fll/level_0/type_array/int128.c fll/level_0/type_array/number_unsigned.c fll/level_0/type_array/state.c fll/level_0/type_array/status.c fll/level_0/type_array/uint8.c fll/level_0/type_array/uint16.c fll/level_0/type_array/uint32.c fll/level_0/type_array/uint64.c fll/level_0/type_array/uint128.c -build_sources_program fll/level_0/type_array/private-cell.c fll/level_0/type_array/private-fll_id.c fll/level_0/type_array/private-int8.c fll/level_0/type_array/private-int16.c fll/level_0/type_array/private-int32.c fll/level_0/type_array/private-int64.c fll/level_0/type_array/private-int128.c fll/level_0/type_array/private-state.c fll/level_0/type_array/private-status.c fll/level_0/type_array/private-uint8.c fll/level_0/type_array/private-uint16.c fll/level_0/type_array/private-uint32.c fll/level_0/type_array/private-uint64.c fll/level_0/type_array/private-uint128.c +build_sources_program fll/level_0/type_array/private-state.c fll/level_0/type_array/private-status.c build_sources_program fll/level_0/utf.c fll/level_0/private-utf.c fll/level_0/private-utf_alphabetic.c fll/level_0/private-utf_combining.c fll/level_0/private-utf_control.c fll/level_0/private-utf_digit.c fll/level_0/private-utf_emoji.c fll/level_0/private-utf_numeric.c fll/level_0/private-utf_phonetic.c fll/level_0/private-utf_private.c fll/level_0/private-utf_punctuation.c fll/level_0/private-utf_subscript.c fll/level_0/private-utf_superscript.c fll/level_0/private-utf_symbol.c fll/level_0/private-utf_unassigned.c fll/level_0/private-utf_valid.c fll/level_0/private-utf_whitespace.c fll/level_0/private-utf_wide.c fll/level_0/private-utf_word.c fll/level_0/private-utf_zero_width.c build_sources_program fll/level_0/utf/common.c fll/level_0/utf/convert.c fll/level_0/utf/dynamic.c fll/level_0/utf/is.c fll/level_0/utf/is_character.c fll/level_0/utf/map.c fll/level_0/utf/map_multi.c fll/level_0/utf/static.c fll/level_0/utf/string.c fll/level_0/utf/triple.c fll/level_0/utf/private-dynamic.c fll/level_0/utf/private-map.c fll/level_0/utf/private-map_multi.c fll/level_0/utf/private-triple.c fll/level_0/utf/private-string.c diff --git a/build/stand_alone/fake.settings b/build/stand_alone/fake.settings index b66de7146..c2ee6513e 100644 --- a/build/stand_alone/fake.settings +++ b/build/stand_alone/fake.settings @@ -54,10 +54,10 @@ build_sources_program fll/level_0/pipe.c build_sources_program fll/level_0/print.c fll/level_0/private-print.c fll/level_0/print/common.c fll/level_0/print/to.c fll/level_0/print/private-to.c build_sources_program fll/level_0/rip.c fll/level_0/rip/utf.c fll/level_0/private-rip.c fll/level_0/rip/private-utf.c build_sources_program fll/level_0/signal.c -build_sources_program fll/level_0/string.c fll/level_0/private-string.c fll/level_0/string/common.c fll/level_0/string/private-dynamic.c fll/level_0/string/private-dynamics.c fll/level_0/string/private-dynamicss.c fll/level_0/string/private-maps.c fll/level_0/string/private-mapss.c fll/level_0/string/private-map_multis.c fll/level_0/string/private-map_multiss.c fll/level_0/string/private-quantitys.c fll/level_0/string/private-quantityss.c fll/level_0/string/private-ranges.c fll/level_0/string/private-rangess.c fll/level_0/string/private-triples.c fll/level_0/string/private-tripless.c +build_sources_program fll/level_0/string.c fll/level_0/private-string.c fll/level_0/string/common.c fll/level_0/string/private-dynamics.c fll/level_0/string/private-dynamicss.c fll/level_0/string/private-maps.c fll/level_0/string/private-mapss.c fll/level_0/string/private-map_multis.c fll/level_0/string/private-map_multiss.c fll/level_0/string/private-quantitys.c fll/level_0/string/private-quantityss.c fll/level_0/string/private-ranges.c fll/level_0/string/private-rangess.c fll/level_0/string/private-triples.c fll/level_0/string/private-tripless.c build_sources_program fll/level_0/string/dynamic.c fll/level_0/string/dynamics.c fll/level_0/string/dynamicss.c fll/level_0/string/map.c fll/level_0/string/maps.c fll/level_0/string/mapss.c fll/level_0/string/map_multi.c fll/level_0/string/map_multis.c fll/level_0/string/map_multiss.c fll/level_0/string/quantity.c fll/level_0/string/quantitys.c fll/level_0/string/quantityss.c fll/level_0/string/range.c fll/level_0/string/ranges.c fll/level_0/string/rangess.c fll/level_0/string/static.c fll/level_0/string/statics.c fll/level_0/string/staticss.c fll/level_0/string/triple.c fll/level_0/string/triples.c fll/level_0/string/tripless.c build_sources_program fll/level_0/type_array/cell.c fll/level_0/type_array/fll_id.c fll/level_0/type_array/int8.c fll/level_0/type_array/int16.c fll/level_0/type_array/int32.c fll/level_0/type_array/int64.c fll/level_0/type_array/int128.c fll/level_0/type_array/number_unsigned.c fll/level_0/type_array/state.c fll/level_0/type_array/status.c fll/level_0/type_array/uint8.c fll/level_0/type_array/uint16.c fll/level_0/type_array/uint32.c fll/level_0/type_array/uint64.c fll/level_0/type_array/uint128.c -build_sources_program fll/level_0/type_array/private-cell.c fll/level_0/type_array/private-fll_id.c fll/level_0/type_array/private-int8.c fll/level_0/type_array/private-int16.c fll/level_0/type_array/private-int32.c fll/level_0/type_array/private-int64.c fll/level_0/type_array/private-int128.c fll/level_0/type_array/private-state.c fll/level_0/type_array/private-status.c fll/level_0/type_array/private-uint8.c fll/level_0/type_array/private-uint16.c fll/level_0/type_array/private-uint32.c fll/level_0/type_array/private-uint64.c fll/level_0/type_array/private-uint128.c +build_sources_program fll/level_0/type_array/private-state.c fll/level_0/type_array/private-status.c build_sources_program fll/level_0/utf.c fll/level_0/private-utf.c fll/level_0/private-utf_alphabetic.c fll/level_0/private-utf_combining.c fll/level_0/private-utf_control.c fll/level_0/private-utf_digit.c fll/level_0/private-utf_emoji.c fll/level_0/private-utf_numeric.c fll/level_0/private-utf_phonetic.c fll/level_0/private-utf_private.c fll/level_0/private-utf_punctuation.c fll/level_0/private-utf_subscript.c fll/level_0/private-utf_superscript.c fll/level_0/private-utf_symbol.c fll/level_0/private-utf_unassigned.c fll/level_0/private-utf_valid.c fll/level_0/private-utf_whitespace.c fll/level_0/private-utf_wide.c fll/level_0/private-utf_word.c fll/level_0/private-utf_zero_width.c build_sources_program fll/level_0/utf/common.c fll/level_0/utf/convert.c fll/level_0/utf/dynamic.c fll/level_0/utf/dynamics.c fll/level_0/utf/dynamicss.c fll/level_0/utf/is.c fll/level_0/utf/is_character.c fll/level_0/utf/map.c fll/level_0/utf/maps.c fll/level_0/utf/mapss.c fll/level_0/utf/map_multi.c fll/level_0/utf/map_multis.c fll/level_0/utf/map_multiss.c fll/level_0/utf/static.c fll/level_0/utf/statics.c fll/level_0/utf/staticss.c fll/level_0/utf/string.c fll/level_0/utf/triple.c fll/level_0/utf/triples.c fll/level_0/utf/tripless.c build_sources_program fll/level_0/utf/private-dynamic.c fll/level_0/utf/private-dynamics.c fll/level_0/utf/private-dynamicss.c fll/level_0/utf/private-maps.c fll/level_0/utf/private-mapss.c fll/level_0/utf/private-map_multis.c fll/level_0/utf/private-map_multiss.c fll/level_0/utf/private-string.c fll/level_0/utf/private-triples.c fll/level_0/utf/private-tripless.c diff --git a/build/stand_alone/firewall.settings b/build/stand_alone/firewall.settings index 83238f963..d1f28a379 100644 --- a/build/stand_alone/firewall.settings +++ b/build/stand_alone/firewall.settings @@ -40,10 +40,10 @@ build_sources_program fll/level_0/path.c fll/level_0/private-path.c fll/level_0/ build_sources_program fll/level_0/pipe.c build_sources_program fll/level_0/print.c fll/level_0/private-print.c fll/level_0/print/common.c fll/level_0/print/to.c fll/level_0/print/private-to.c build_sources_program fll/level_0/signal.c -build_sources_program fll/level_0/string.c fll/level_0/private-string.c fll/level_0/string/common.c fll/level_0/string/dynamic.c fll/level_0/string/map.c fll/level_0/string/map_multi.c fll/level_0/string/private-dynamic.c fll/level_0/string/private-map.c fll/level_0/string/private-map_multi.c fll/level_0/string/private-quantity.c fll/level_0/string/private-range.c fll/level_0/string/private-triple.c fll/level_0/string/quantity.c fll/level_0/string/range.c fll/level_0/string/static.c fll/level_0/string/triple.c +build_sources_program fll/level_0/string.c fll/level_0/private-string.c fll/level_0/string/common.c fll/level_0/string/dynamic.c fll/level_0/string/map.c fll/level_0/string/map_multi.c fll/level_0/string/private-map.c fll/level_0/string/private-map_multi.c fll/level_0/string/private-quantity.c fll/level_0/string/private-range.c fll/level_0/string/private-triple.c fll/level_0/string/quantity.c fll/level_0/string/range.c fll/level_0/string/static.c fll/level_0/string/triple.c build_sources_program fll/level_0/thread.c fll/level_0/private-thread.c fll/level_0/thread/attribute.c fll/level_0/thread/barrier.c fll/level_0/thread/barrier_attribute.c fll/level_0/thread/condition.c fll/level_0/thread/condition_attribute.c fll/level_0/thread/id.c fll/level_0/thread/key.c fll/level_0/thread/lock.c fll/level_0/thread/lock_attribute.c fll/level_0/thread/mutex.c fll/level_0/thread/mutex_attribute.c fll/level_0/thread/once.c fll/level_0/thread/semaphore.c fll/level_0/thread/set.c fll/level_0/thread/spin.c build_sources_program fll/level_0/type_array/cell.c fll/level_0/type_array/fll_id.c fll/level_0/type_array/int8.c fll/level_0/type_array/int16.c fll/level_0/type_array/int32.c fll/level_0/type_array/int64.c fll/level_0/type_array/int128.c fll/level_0/type_array/number_unsigned.c fll/level_0/type_array/state.c fll/level_0/type_array/status.c fll/level_0/type_array/uint8.c fll/level_0/type_array/uint16.c fll/level_0/type_array/uint32.c fll/level_0/type_array/uint64.c fll/level_0/type_array/uint128.c -build_sources_program fll/level_0/type_array/private-cell.c fll/level_0/type_array/private-fll_id.c fll/level_0/type_array/private-int8.c fll/level_0/type_array/private-int16.c fll/level_0/type_array/private-int32.c fll/level_0/type_array/private-int64.c fll/level_0/type_array/private-int128.c fll/level_0/type_array/private-state.c fll/level_0/type_array/private-status.c fll/level_0/type_array/private-uint8.c fll/level_0/type_array/private-uint16.c fll/level_0/type_array/private-uint32.c fll/level_0/type_array/private-uint64.c fll/level_0/type_array/private-uint128.c +build_sources_program fll/level_0/type_array/private-state.c fll/level_0/type_array/private-status.c build_sources_program fll/level_0/utf.c fll/level_0/private-utf.c fll/level_0/private-utf_alphabetic.c fll/level_0/private-utf_combining.c fll/level_0/private-utf_control.c fll/level_0/private-utf_digit.c fll/level_0/private-utf_emoji.c fll/level_0/private-utf_numeric.c fll/level_0/private-utf_phonetic.c fll/level_0/private-utf_private.c fll/level_0/private-utf_punctuation.c fll/level_0/private-utf_subscript.c fll/level_0/private-utf_superscript.c fll/level_0/private-utf_symbol.c fll/level_0/private-utf_unassigned.c fll/level_0/private-utf_valid.c fll/level_0/private-utf_whitespace.c fll/level_0/private-utf_wide.c fll/level_0/private-utf_word.c fll/level_0/private-utf_zero_width.c build_sources_program fll/level_0/utf/common.c fll/level_0/utf/convert.c fll/level_0/utf/dynamic.c fll/level_0/utf/is.c fll/level_0/utf/is_character.c fll/level_0/utf/map.c fll/level_0/utf/map_multi.c fll/level_0/utf/static.c fll/level_0/utf/string.c fll/level_0/utf/triple.c fll/level_0/utf/private-dynamic.c fll/level_0/utf/private-map.c fll/level_0/utf/private-map_multi.c fll/level_0/utf/private-triple.c fll/level_0/utf/private-string.c diff --git a/build/stand_alone/utf8.settings b/build/stand_alone/utf8.settings index dec666735..a6375758b 100644 --- a/build/stand_alone/utf8.settings +++ b/build/stand_alone/utf8.settings @@ -31,10 +31,10 @@ build_sources_program fll/level_0/memory.c fll/level_0/private-memory.c fll/leve build_sources_program fll/level_0/pipe.c build_sources_program fll/level_0/print.c fll/level_0/private-print.c fll/level_0/print/common.c fll/level_0/print/to.c fll/level_0/print/private-to.c build_sources_program fll/level_0/signal.c -build_sources_program fll/level_0/string.c fll/level_0/private-string.c fll/level_0/string/common.c fll/level_0/string/private-dynamic.c fll/level_0/string/private-dynamics.c fll/level_0/string/private-dynamicss.c fll/level_0/string/private-maps.c fll/level_0/string/private-mapss.c fll/level_0/string/private-map_multis.c fll/level_0/string/private-map_multiss.c fll/level_0/string/private-quantitys.c fll/level_0/string/private-quantityss.c fll/level_0/string/private-ranges.c fll/level_0/string/private-rangess.c fll/level_0/string/private-triples.c fll/level_0/string/private-tripless.c +build_sources_program fll/level_0/string.c fll/level_0/private-string.c fll/level_0/string/common.c fll/level_0/string/private-dynamics.c fll/level_0/string/private-dynamicss.c fll/level_0/string/private-maps.c fll/level_0/string/private-mapss.c fll/level_0/string/private-map_multis.c fll/level_0/string/private-map_multiss.c fll/level_0/string/private-quantitys.c fll/level_0/string/private-quantityss.c fll/level_0/string/private-ranges.c fll/level_0/string/private-rangess.c fll/level_0/string/private-triples.c fll/level_0/string/private-tripless.c build_sources_program fll/level_0/string/dynamic.c fll/level_0/string/dynamics.c fll/level_0/string/dynamicss.c fll/level_0/string/map.c fll/level_0/string/maps.c fll/level_0/string/mapss.c fll/level_0/string/map_multi.c fll/level_0/string/map_multis.c fll/level_0/string/map_multiss.c fll/level_0/string/quantity.c fll/level_0/string/quantitys.c fll/level_0/string/quantityss.c fll/level_0/string/range.c fll/level_0/string/ranges.c fll/level_0/string/rangess.c fll/level_0/string/static.c fll/level_0/string/statics.c fll/level_0/string/staticss.c fll/level_0/string/triple.c fll/level_0/string/triples.c fll/level_0/string/tripless.c build_sources_program fll/level_0/type_array/cell.c fll/level_0/type_array/fll_id.c fll/level_0/type_array/int8.c fll/level_0/type_array/int16.c fll/level_0/type_array/int32.c fll/level_0/type_array/int64.c fll/level_0/type_array/int128.c fll/level_0/type_array/number_unsigned.c fll/level_0/type_array/state.c fll/level_0/type_array/status.c fll/level_0/type_array/uint8.c fll/level_0/type_array/uint16.c fll/level_0/type_array/uint32.c fll/level_0/type_array/uint64.c fll/level_0/type_array/uint128.c -build_sources_program fll/level_0/type_array/private-cell.c fll/level_0/type_array/private-fll_id.c fll/level_0/type_array/private-int8.c fll/level_0/type_array/private-int16.c fll/level_0/type_array/private-int32.c fll/level_0/type_array/private-int64.c fll/level_0/type_array/private-int128.c fll/level_0/type_array/private-state.c fll/level_0/type_array/private-status.c fll/level_0/type_array/private-uint8.c fll/level_0/type_array/private-uint16.c fll/level_0/type_array/private-uint32.c fll/level_0/type_array/private-uint64.c fll/level_0/type_array/private-uint128.c +build_sources_program fll/level_0/type_array/private-state.c fll/level_0/type_array/private-status.c build_sources_program fll/level_0/utf.c fll/level_0/private-utf.c fll/level_0/private-utf_alphabetic.c fll/level_0/private-utf_combining.c fll/level_0/private-utf_control.c fll/level_0/private-utf_digit.c fll/level_0/private-utf_emoji.c fll/level_0/private-utf_numeric.c fll/level_0/private-utf_phonetic.c fll/level_0/private-utf_private.c fll/level_0/private-utf_punctuation.c fll/level_0/private-utf_subscript.c fll/level_0/private-utf_superscript.c fll/level_0/private-utf_symbol.c fll/level_0/private-utf_unassigned.c fll/level_0/private-utf_valid.c fll/level_0/private-utf_whitespace.c fll/level_0/private-utf_wide.c fll/level_0/private-utf_word.c fll/level_0/private-utf_zero_width.c build_sources_program fll/level_0/utf/common.c fll/level_0/utf/convert.c fll/level_0/utf/dynamic.c fll/level_0/utf/dynamics.c fll/level_0/utf/dynamicss.c fll/level_0/utf/is.c fll/level_0/utf/is_character.c fll/level_0/utf/map.c fll/level_0/utf/maps.c fll/level_0/utf/mapss.c fll/level_0/utf/map_multi.c fll/level_0/utf/map_multis.c fll/level_0/utf/map_multiss.c fll/level_0/utf/static.c fll/level_0/utf/statics.c fll/level_0/utf/staticss.c fll/level_0/utf/string.c fll/level_0/utf/triple.c fll/level_0/utf/triples.c fll/level_0/utf/tripless.c build_sources_program fll/level_0/utf/private-dynamic.c fll/level_0/utf/private-dynamics.c fll/level_0/utf/private-dynamicss.c fll/level_0/utf/private-maps.c fll/level_0/utf/private-mapss.c fll/level_0/utf/private-map_multis.c fll/level_0/utf/private-map_multiss.c fll/level_0/utf/private-string.c fll/level_0/utf/private-triples.c fll/level_0/utf/private-tripless.c diff --git a/level_0/f_console/c/console.c b/level_0/f_console/c/console.c index 97db647d9..29fb36c6a 100644 --- a/level_0/f_console/c/console.c +++ b/level_0/f_console/c/console.c @@ -174,7 +174,7 @@ extern "C" { state->status = f_string_dynamics_increase_by(arguments.argc, ¶meters->arguments); if (F_status_is_error(state->status)) return; - state->status = f_number_unsigneds_increase(state->step_small, &process.needs); + state->status = f_memory_array_increase(state->step_small, sizeof(f_number_unsigned_t), (void **) &process.needs.array, &process.needs.used, &process.needs.size); if (F_status_is_error(state->status)) return; // Append the program name parameter as a static string. @@ -359,7 +359,7 @@ extern "C" { process.location_sub = 1; process.needs.used = 0; - state->status = f_number_unsigneds_increase_by(parameters->arguments.array[process.location].used, &process.needs); + state->status = f_memory_array_increase_by(parameters->arguments.array[process.location].used, sizeof(f_number_unsigned_t), (void **) &process.needs.array, &process.needs.used, &process.needs.size); if (F_status_is_error(state->status)) break; // The process.location_sub is used on a per-increment basis (such as 'tar -xcf', the '-' would have an increment of 1, therefore x, c, and f would all be three separate parameters). @@ -423,10 +423,10 @@ extern "C" { } if (state->status == F_process) { - state->status = f_number_unsigneds_increase(state->step_small, ¶meters->array[i].locations); + state->status = f_memory_array_increase(state->step_small, sizeof(f_number_unsigned_t), (void **) ¶meters->array[i].locations.array, ¶meters->array[i].locations.used, ¶meters->array[i].locations.size); if (F_status_is_error(state->status)) break; - state->status = f_number_unsigneds_increase(state->step_small, ¶meters->array[i].locations_sub); + state->status = f_memory_array_increase(state->step_small, sizeof(f_number_unsigned_t), (void **) ¶meters->array[i].locations_sub.array, ¶meters->array[i].locations_sub.used, ¶meters->array[i].locations_sub.size); if (F_status_is_error(state->status)) break; if (parameters->array[i].location != process.location) { @@ -442,7 +442,7 @@ extern "C" { process.needs.array[process.needs.used++] = i; } // for - state->status = f_number_unsigneds_increase_by(process.needs.used, ¶meters->array[i].values); + state->status = f_memory_array_increase_by(process.needs.used, sizeof(f_number_unsigned_t), (void **) ¶meters->array[i].values.array, ¶meters->array[i].values.used, ¶meters->array[i].values.size); if (F_status_is_error(state->status)) break; } @@ -585,10 +585,10 @@ extern "C" { } if (state->status == F_process && process.found && i < parameters->used) { - state->status = f_number_unsigneds_increase(state->step_small, ¶meters->array[i].locations); + state->status = f_memory_array_increase(state->step_small, sizeof(f_number_unsigned_t), (void **) ¶meters->array[i].locations.array, ¶meters->array[i].locations.used, ¶meters->array[i].locations.size); if (F_status_is_error(state->status)) break; - state->status = f_number_unsigneds_increase(state->step_small, ¶meters->array[i].locations_sub); + state->status = f_memory_array_increase(state->step_small, sizeof(f_number_unsigned_t), (void **) ¶meters->array[i].locations_sub.array, ¶meters->array[i].locations_sub.used, ¶meters->array[i].locations_sub.size); if (F_status_is_error(state->status)) break; parameters->array[i].result |= process.result | f_console_result_found_e; @@ -601,7 +601,7 @@ extern "C" { process.needs.array[process.needs.used++] = i; } // for - state->status = f_number_unsigneds_increase_by(process.needs.used, ¶meters->array[i].values); + state->status = f_memory_array_increase_by(process.needs.used, sizeof(f_number_unsigned_t), (void **) ¶meters->array[i].values.array, ¶meters->array[i].values.used, ¶meters->array[i].values.size); if (F_status_is_error(state->status)) break; } @@ -626,7 +626,7 @@ extern "C" { } if (state->status == F_process) { - state->status = f_number_unsigneds_increase(state->step_small, ¶meters->remaining); + state->status = f_memory_array_increase(state->step_small, sizeof(f_number_unsigned_t), (void **) ¶meters->remaining.array, ¶meters->remaining.used, ¶meters->remaining.size); if (F_status_is_error(state->status)) break; parameters->remaining.array[parameters->remaining.used++] = process.location; diff --git a/level_0/f_console/c/console.h b/level_0/f_console/c/console.h index 899b74503..9e749215b 100644 --- a/level_0/f_console/c/console.h +++ b/level_0/f_console/c/console.h @@ -175,13 +175,11 @@ extern "C" { * (optional) A variable passed to the callback, if provided. * Set to NULL to not use. * - * Errors (with error bit) from: f_number_unsigneds_increase(). - * Errors (with error bit) from: f_number_unsigneds_increase_by(). + * Errors (with error bit) from: f_memory_array_increase_by(). * Errors (with error bit) from: f_string_dynamics_increase_by(). * Errors (with error bit) from: f_utf_char_to_character(). * - * @see f_number_unsigneds_increase() - * @see f_number_unsigneds_increase_by() + * @see f_memory_array_increase_by() * @see f_string_dynamics_increase_by() * @see f_utf_char_to_character() */ diff --git a/level_0/f_fss/c/fss/named.h b/level_0/f_fss/c/fss/named.h index 248c9a6df..3fedc2b21 100644 --- a/level_0/f_fss/c/fss/named.h +++ b/level_0/f_fss/c/fss/named.h @@ -236,14 +236,14 @@ extern "C" { * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_memory_array_resize(). + * Errors (with error bit) from: f_memory_arrays_resize(). * Errors (with error bit) from: f_string_ranges_resize(). * Errors (with error bit) from: f_string_rangess_resize(). - * Errors (with error bit) from: f_uint8ss_resize(). * * @see f_memory_array_resize() + * @see f_memory_arrays_resize() * @see f_string_ranges_resize() * @see f_string_rangess_resize() - * @see f_uint8ss_resize() */ #ifndef _di_f_fss_nameds_adjust_ extern f_status_t f_fss_nameds_adjust(const f_number_unsigned_t length, f_fss_nameds_t * const nameds); @@ -357,14 +357,14 @@ extern "C" { * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_memory_array_resize(). + * Errors (with error bit) from: f_memory_arrays_resize(). * Errors (with error bit) from: f_string_ranges_resize(). * Errors (with error bit) from: f_string_rangess_resize(). - * Errors (with error bit) from: f_uint8ss_resize(). * * @see f_memory_array_resize() + * @see f_memory_arrays_resize() * @see f_string_ranges_resize() * @see f_string_rangess_resize() - * @see f_uint8ss_resize() */ #ifndef _di_f_fss_nameds_resize_ extern f_status_t f_fss_nameds_resize(const f_number_unsigned_t length, f_fss_nameds_t * const nameds); diff --git a/level_0/f_fss/c/fss/private-named.c b/level_0/f_fss/c/fss/private-named.c index 2f2042253..0380c1b84 100644 --- a/level_0/f_fss/c/fss/private-named.c +++ b/level_0/f_fss/c/fss/private-named.c @@ -14,7 +14,7 @@ extern "C" { status = f_string_rangess_adjust(length, &named->contents); if (F_status_is_error(status)) return status; - status = f_uint8ss_adjust(length, &named->quotess); + status = f_memory_arrays_adjust(length, sizeof(f_uint8s_t), (void **) &named->quotess.array, &named->quotess.used, &named->quotess.size, &f_uint8s_resize_callback); if (F_status_is_error(status)) return status; return F_none; @@ -30,7 +30,7 @@ extern "C" { status = f_string_rangess_resize(length, &named->contents); if (F_status_is_error(status)) return status; - status = f_uint8ss_resize(length, &named->quotess); + status = f_memory_arrays_resize(length, sizeof(f_uint8s_t), (void **) &named->quotess.array, &named->quotess.used, &named->quotess.size, &f_uint8s_resize_callback); if (F_status_is_error(status)) return status; return F_none; diff --git a/level_0/f_fss/c/fss/private-named.h b/level_0/f_fss/c/fss/private-named.h index ee29923ff..d2625dd92 100644 --- a/level_0/f_fss/c/fss/private-named.h +++ b/level_0/f_fss/c/fss/private-named.h @@ -28,13 +28,13 @@ extern "C" { * @return * F_none on success. * + * Errors (with error bit) from: f_memory_arrays_adjust(). * Errors (with error bit) from: macro_f_string_ranges_t_adjust(). * Errors (with error bit) from: macro_f_string_rangess_t_adjust(). - * Errors (with error bit) from: macro_f_uint8ss_t_adjust(). * + * @see f_memory_arrays_adjust() * @see macro_f_string_ranges_t_adjust() * @see macro_f_string_rangess_t_adjust() - * @see macro_f_uint8ss_t_adjust() * * @see f_fss_nameds_adjust() * @see f_fss_nameds_decimate_by() @@ -56,13 +56,13 @@ extern "C" { * @return * F_none on success. * + * Errors (with error bit) from: f_memory_arrays_resize(). * Errors (with error bit) from: f_string_ranges_resize(). * Errors (with error bit) from: f_string_rangess_resize(). - * Errors (with error bit) from: f_uint8ss_resize(). * + * @see f_memory_arrays_resize() * @see f_string_ranges_resize() * @see f_string_rangess_resize() - * @see f_uint8ss_resize() * * @see f_fss_nameds_decrease_by() * @see f_fss_nameds_resize() @@ -87,14 +87,14 @@ extern "C" { * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_memory_array_adjust(). + * Errors (with error bit) from: f_memory_arrays_resize(). * Errors (with error bit) from: f_string_ranges_resize(). * Errors (with error bit) from: f_string_rangess_resize(). - * Errors (with error bit) from: f_uint8ss_resize(). * + * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() * @see f_string_ranges_resize() * @see f_string_rangess_resize() - * @see f_uint8ss_resize() - * @see f_memory_array_adjust() * * @see f_fss_nameds_adjust() * @see f_fss_nameds_decimate_by() @@ -119,14 +119,14 @@ extern "C" { * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_memory_array_resize(). + * Errors (with error bit) from: f_memory_arrays_resize(). * Errors (with error bit) from: f_string_ranges_resize(). * Errors (with error bit) from: f_string_rangess_resize(). - * Errors (with error bit) from: f_uint8ss_resize(). * * @see f_memory_array_resize() + * @see f_memory_arrays_resize() * @see f_string_ranges_resize() * @see f_string_rangess_resize() - * @see f_uint8ss_resize() * * @see f_fss_nameds_decrease_by() * @see f_fss_nameds_increase() diff --git a/level_0/f_fss/c/fss/private-set_quote.c b/level_0/f_fss/c/fss/private-set_quote.c index d955e8794..3555bf471 100644 --- a/level_0/f_fss/c/fss/private-set_quote.c +++ b/level_0/f_fss/c/fss/private-set_quote.c @@ -14,10 +14,10 @@ extern "C" { status = f_string_rangess_adjust(length, &set_quote->contents); if (F_status_is_error(status)) return status; - status = f_uint8s_adjust(length, &set_quote->objects_quote); + status = f_memory_array_adjust(length, sizeof(uint8_t), (void **) &set_quote->objects_quote.array, &set_quote->objects_quote.used, &set_quote->objects_quote.size); if (F_status_is_error(status)) return status; - status = f_uint8ss_adjust(length, &set_quote->contents_quote); + status = f_memory_arrays_adjust(length, sizeof(f_uint8s_t), (void **) &set_quote->contents_quote.array, &set_quote->contents_quote.used, &set_quote->contents_quote.size, &f_uint8s_resize_callback); if (F_status_is_error(status)) return status; return F_none; @@ -33,10 +33,10 @@ extern "C" { status = f_string_rangess_resize(length, &set_quote->contents); if (F_status_is_error(status)) return status; - status = f_uint8s_resize(length, &set_quote->objects_quote); + status = f_memory_array_resize(length, sizeof(uint8_t), (void **) &set_quote->objects_quote.array, &set_quote->objects_quote.used, &set_quote->objects_quote.size); if (F_status_is_error(status)) return status; - status = f_uint8ss_resize(length, &set_quote->contents_quote); + status = f_memory_arrays_resize(length, sizeof(f_uint8s_t), (void **) &set_quote->contents_quote.array, &set_quote->contents_quote.used, &set_quote->contents_quote.size, &f_uint8s_resize_callback); if (F_status_is_error(status)) return status; return F_none; @@ -57,10 +57,10 @@ extern "C" { status = f_string_rangess_adjust(0, &set_quotes->array[i].contents); if (F_status_is_error(status)) return status; - status = f_uint8s_adjust(0, &set_quotes->array[i].objects_quote); + status = f_memory_array_adjust(0, sizeof(uint8_t), (void **) &set_quotes->array[i].objects_quote.array, &set_quotes->array[i].objects_quote.used, &set_quotes->array[i].objects_quote.size); if (F_status_is_error(status)) return status; - status = f_uint8ss_adjust(0, &set_quotes->array[i].contents_quote); + status = f_memory_arrays_adjust(0, sizeof(f_uint8s_t), (void **) &set_quotes->array[i].contents_quote.array, &set_quotes->array[i].contents_quote.used, &set_quotes->array[i].contents_quote.size, &f_uint8s_resize_callback); if (F_status_is_error(status)) return status; } // for } @@ -83,10 +83,10 @@ extern "C" { status = f_string_rangess_resize(0, &set_quotes->array[i].contents); if (F_status_is_error(status)) return status; - status = f_uint8s_resize(0, &set_quotes->array[i].objects_quote); + status = f_memory_array_resize(0, sizeof(uint8_t), (void **) &set_quotes->array[i].objects_quote.array, &set_quotes->array[i].objects_quote.used, &set_quotes->array[i].objects_quote.size); if (F_status_is_error(status)) return status; - status = f_uint8ss_resize(0, &set_quotes->array[i].contents_quote); + status = f_memory_arrays_resize(0, sizeof(f_uint8s_t), (void **) &set_quotes->array[i].contents_quote.array, &set_quotes->array[i].contents_quote.used, &set_quotes->array[i].contents_quote.size, &f_uint8s_resize_callback); if (F_status_is_error(status)) return status; } // for } diff --git a/level_0/f_fss/c/fss/private-set_quote.h b/level_0/f_fss/c/fss/private-set_quote.h index 0c9bec68b..7b9c381d4 100644 --- a/level_0/f_fss/c/fss/private-set_quote.h +++ b/level_0/f_fss/c/fss/private-set_quote.h @@ -28,15 +28,15 @@ extern "C" { * @return * F_none on success. * + * Errors (with error bit) from: f_memory_array_resize(). + * Errors (with error bit) from: f_memory_arrays_resize(). * Errors (with error bit) from: f_string_ranges_adjust(). * Errors (with error bit) from: f_string_rangess_adjust(). - * Errors (with error bit) from: f_uint8s_adjust(). - * Errors (with error bit) from: f_uint8ss_adjust(). * + * @see f_memory_array_resize() + * @see f_memory_arrays_resize() * @see f_string_ranges_adjust() * @see f_string_rangess_adjust() - * @see f_uint8s_adjust() - * @see f_uint8ss_adjust() * * @see f_fss_set_quote_adjust() * @see f_fss_set_quote_decimate_by() @@ -58,15 +58,15 @@ extern "C" { * @return * F_none on success. * + * Errors (with error bit) from: f_memory_array_resize(). + * Errors (with error bit) from: f_memory_arrays_resize(). * Errors (with error bit) from: f_string_ranges_resize(). * Errors (with error bit) from: f_string_rangess_resize(). - * Errors (with error bit) from: f_uint8s_resize(). - * Errors (with error bit) from: f_uint8ss_resize(). * + * @see f_memory_array_resize() + * @see f_memory_arrays_resize() * @see f_string_ranges_resize() * @see f_string_rangess_resize() - * @see f_uint8s_resize() - * @see f_uint8ss_resize() * * @see f_fss_set_quote_decrease_by() * @see f_fss_set_quote_resize() @@ -91,16 +91,14 @@ extern "C" { * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_memory_array_adjust(). + * Errors (with error bit) from: f_memory_arrays_adjust(). * Errors (with error bit) from: f_string_ranges_adjust(). * Errors (with error bit) from: f_string_rangess_adjust(). - * Errors (with error bit) from: f_uint8s_adjust(). - * Errors (with error bit) from: f_uint8ss_adjust(). * * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() * @see f_string_ranges_adjust() * @see f_string_rangess_adjust() - * @see f_uint8s_adjust() - * @see f_uint8ss_adjust() * * @see f_fss_set_quotes_decrease_by() * @see f_fss_set_quotes_adjust() @@ -125,17 +123,15 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_memory_array_resize(). + * Errors (with error bit) from: f_memory_array_adjust(). + * Errors (with error bit) from: f_memory_arrays_adjust(). * Errors (with error bit) from: f_string_ranges_adjust(). * Errors (with error bit) from: f_string_rangess_adjust(). - * Errors (with error bit) from: f_uint8s_adjust(). - * Errors (with error bit) from: f_uint8ss_adjust(). * - * @see f_memory_array_resize() + * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() * @see f_string_ranges_adjust() * @see f_string_rangess_adjust() - * @see f_uint8s_adjust() - * @see f_uint8ss_adjust() * * @see f_fss_set_quotes_decrease_by() * @see f_fss_set_quotes_increase() diff --git a/level_0/f_fss/c/fss/set_quote.h b/level_0/f_fss/c/fss/set_quote.h index 968b9b153..ca6458cd2 100644 --- a/level_0/f_fss/c/fss/set_quote.h +++ b/level_0/f_fss/c/fss/set_quote.h @@ -106,15 +106,15 @@ extern "C" { * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * + * Errors (with error bit) from: f_memory_array_adjust(). + * Errors (with error bit) from: f_memory_arrays_adjust(). * Errors (with error bit) from: f_string_ranges_adjust(). * Errors (with error bit) from: f_string_rangess_adjust(). - * Errors (with error bit) from: f_uint8s_adjust(). - * Errors (with error bit) from: f_uint8ss_adjust(). * + * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() * @see f_string_ranges_adjust() * @see f_string_rangess_adjust() - * @see f_uint8s_adjust() - * @see f_uint8ss_adjust() */ #ifndef _di_f_fss_set_quote_adjust_ extern f_status_t f_fss_set_quote_adjust(const f_number_unsigned_t length, f_fss_set_quote_t * const set_quote); @@ -139,15 +139,15 @@ extern "C" { * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * + * Errors (with error bit) from: f_memory_array_adjust(). + * Errors (with error bit) from: f_memory_arrays_adjust(). * Errors (with error bit) from: f_string_ranges_adjust(). * Errors (with error bit) from: f_string_rangess_adjust(). - * Errors (with error bit) from: f_uint8s_adjust(). - * Errors (with error bit) from: f_uint8ss_adjust(). * + * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() * @see f_string_ranges_adjust() * @see f_string_rangess_adjust() - * @see f_uint8s_adjust() - * @see f_uint8ss_adjust() */ #ifndef _di_f_fss_set_quote_decimate_by_ extern f_status_t f_fss_set_quote_decimate_by(const f_number_unsigned_t amount, f_fss_set_quote_t * const set_quote); @@ -171,15 +171,15 @@ extern "C" { * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * + * Errors (with error bit) from: f_memory_array_resize(). + * Errors (with error bit) from: f_memory_arrays_resize(). * Errors (with error bit) from: f_string_ranges_resize(). * Errors (with error bit) from: f_string_rangess_resize(). - * Errors (with error bit) from: f_uint8s_resize(). - * Errors (with error bit) from: f_uint8ss_resize(). * + * @see f_memory_array_resize() + * @see f_memory_arrays_resize() * @see f_string_ranges_resize() * @see f_string_rangess_resize() - * @see f_uint8s_resize() - * @see f_uint8ss_resize() */ #ifndef _di_f_fss_set_quote_decrease_by_ extern f_status_t f_fss_set_quote_decrease_by(const f_number_unsigned_t amount, f_fss_set_quote_t * const set_quote); @@ -206,16 +206,16 @@ extern "C" { * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_memory_array_increase(). + * Errors (with error bit) from: f_memory_array_resize(). + * Errors (with error bit) from: f_memory_arrays_resize(). * Errors (with error bit) from: f_string_ranges_resize(). * Errors (with error bit) from: f_string_rangess_resize(). - * Errors (with error bit) from: f_uint8s_resize(). - * Errors (with error bit) from: f_uint8ss_resize(). * * @see f_memory_array_increase() + * @see f_memory_array_resize() + * @see f_memory_arrays_resize() * @see f_string_ranges_resize() * @see f_string_rangess_resize() - * @see f_uint8s_resize() - * @see f_uint8ss_resize() */ #ifndef _di_f_fss_set_quote_increase_ extern f_status_t f_fss_set_quote_increase(const f_number_unsigned_t step, f_fss_set_quote_t * const set_quote); @@ -242,16 +242,16 @@ extern "C" { * F_array_too_large (with error bit) if the new array length is too large. * * Errors (with error bit) from: f_memory_array_increase_by(). + * Errors (with error bit) from: f_memory_array_resize(). + * Errors (with error bit) from: f_memory_arrays_resize(). * Errors (with error bit) from: f_string_ranges_resize(). * Errors (with error bit) from: f_string_rangess_resize(). - * Errors (with error bit) from: f_uint8s_resize(). - * Errors (with error bit) from: f_uint8ss_resize(). * * @see f_memory_array_increase_by() + * @see f_memory_array_resize() + * @see f_memory_arrays_resize() * @see f_string_ranges_resize() * @see f_string_rangess_resize() - * @see f_uint8s_resize() - * @see f_uint8ss_resize() */ #ifndef _di_f_fss_set_quote_increase_by_ extern f_status_t f_fss_set_quote_increase_by(const f_number_unsigned_t amount, f_fss_set_quote_t * const set_quote); @@ -271,15 +271,15 @@ extern "C" { * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * + * Errors (with error bit) from: f_memory_array_resize(). + * Errors (with error bit) from: f_memory_arrays_resize(). * Errors (with error bit) from: f_string_ranges_resize(). * Errors (with error bit) from: f_string_rangess_resize(). - * Errors (with error bit) from: f_uint8s_resize(). - * Errors (with error bit) from: f_uint8ss_resize(). * + * @see f_memory_array_resize() + * @see f_memory_arrays_resize() * @see f_string_ranges_resize() * @see f_string_rangess_resize() - * @see f_uint8s_resize() - * @see f_uint8ss_resize() */ #ifndef _di_f_fss_set_quote_resize_ extern f_status_t f_fss_set_quote_resize(const f_number_unsigned_t length, f_fss_set_quote_t * const set_quote); @@ -299,15 +299,15 @@ extern "C" { * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * + * Errors (with error bit) from: f_memory_array_adjust(). + * Errors (with error bit) from: f_memory_arrays_adjust(). * Errors (with error bit) from: f_string_ranges_adjust(). * Errors (with error bit) from: f_string_rangess_adjust(). - * Errors (with error bit) from: f_uint8s_adjust(). - * Errors (with error bit) from: f_uint8ss_adjust(). * + * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() * @see f_string_ranges_adjust() * @see f_string_rangess_adjust() - * @see f_uint8s_adjust() - * @see f_uint8ss_adjust() */ #ifndef _di_f_fss_set_quotes_adjust_ extern f_status_t f_fss_set_quotes_adjust(const f_number_unsigned_t length, f_fss_set_quotes_t * const set_quotes); @@ -332,15 +332,15 @@ extern "C" { * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * + * Errors (with error bit) from: f_memory_array_adjust(). + * Errors (with error bit) from: f_memory_arrays_adjust(). * Errors (with error bit) from: f_string_ranges_adjust(). * Errors (with error bit) from: f_string_rangess_adjust(). - * Errors (with error bit) from: f_uint8s_adjust(). - * Errors (with error bit) from: f_uint8ss_adjust(). * + * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() * @see f_string_ranges_adjust() * @see f_string_rangess_adjust() - * @see f_uint8s_adjust() - * @see f_uint8ss_adjust() */ #ifndef _di_f_fss_set_quotes_decimate_by_ extern f_status_t f_fss_set_quotes_decimate_by(const f_number_unsigned_t amount, f_fss_set_quotes_t * const set_quotes); @@ -364,15 +364,15 @@ extern "C" { * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * + * Errors (with error bit) from: f_memory_array_adjust(). + * Errors (with error bit) from: f_memory_arrays_adjust(). * Errors (with error bit) from: f_string_ranges_resize(). * Errors (with error bit) from: f_string_rangess_resize(). - * Errors (with error bit) from: f_uint8s_resize(). - * Errors (with error bit) from: f_uint8ss_resize(). * + * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() * @see f_string_ranges_resize() * @see f_string_rangess_resize() - * @see f_uint8s_resize() - * @see f_uint8ss_resize() */ #ifndef _di_f_fss_set_quotes_decrease_by_ extern f_status_t f_fss_set_quotes_decrease_by(const f_number_unsigned_t amount, f_fss_set_quotes_t * const set_quotes); @@ -399,16 +399,16 @@ extern "C" { * F_parameter (with error bit) if a parameter is invalid. * * Errors (with error bit) from: f_memory_array_increase(). + * Errors (with error bit) from: f_memory_array_resize(). + * Errors (with error bit) from: f_memory_arrays_resize(). * Errors (with error bit) from: f_string_ranges_resize(). * Errors (with error bit) from: f_string_rangess_resize(). - * Errors (with error bit) from: f_uint8s_resize(). - * Errors (with error bit) from: f_uint8ss_resize(). * * @see f_memory_array_increase() + * @see f_memory_array_resize() + * @see f_memory_arrays_resize() * @see f_string_ranges_resize() * @see f_string_rangess_resize() - * @see f_uint8s_resize() - * @see f_uint8ss_resize() */ #ifndef _di_f_fss_set_quotes_increase_ extern f_status_t f_fss_set_quotes_increase(const f_number_unsigned_t step, f_fss_set_quotes_t * const set_quotes); @@ -435,16 +435,16 @@ extern "C" { * F_array_too_large (with error bit) if the new array length is too large. * * Errors (with error bit) from: f_memory_array_increase_by(). + * Errors (with error bit) from: f_memory_array_resize(). + * Errors (with error bit) from: f_memory_arrays_resize(). * Errors (with error bit) from: f_string_ranges_resize(). * Errors (with error bit) from: f_string_rangess_resize(). - * Errors (with error bit) from: f_uint8s_resize(). - * Errors (with error bit) from: f_uint8ss_resize(). * * @see f_memory_array_increase_by() + * @see f_memory_array_resize() + * @see f_memory_arrays_resize() * @see f_string_ranges_resize() * @see f_string_rangess_resize() - * @see f_uint8s_resize() - * @see f_uint8ss_resize() */ #ifndef _di_f_fss_set_quotes_increase_by_ extern f_status_t f_fss_set_quotes_increase_by(const f_number_unsigned_t amount, f_fss_set_quotes_t * const set_quotes); @@ -463,15 +463,15 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. * + * Errors (with error bit) from: f_memory_array_resize(). + * Errors (with error bit) from: f_memory_arrays_resize(). * Errors (with error bit) from: f_string_ranges_resize(). * Errors (with error bit) from: f_string_rangess_resize(). - * Errors (with error bit) from: f_uint8s_resize(). - * Errors (with error bit) from: f_uint8ss_resize(). * + * @see f_memory_array_resize() + * @see f_memory_arrays_resize() * @see f_string_ranges_resize() * @see f_string_rangess_resize() - * @see f_uint8s_resize() - * @see f_uint8ss_resize() */ #ifndef _di_f_fss_set_quotes_resize_ extern f_status_t f_fss_set_quotes_resize(const f_number_unsigned_t length, f_fss_set_quotes_t * const set_quotes); diff --git a/level_0/f_iki/c/iki.c b/level_0/f_iki/c/iki.c index 1ac4181cf..368a0b98f 100644 --- a/level_0/f_iki/c/iki.c +++ b/level_0/f_iki/c/iki.c @@ -215,7 +215,7 @@ extern "C" { // Save delimit for a would-be valid IKI that is now delimited. if (buffer->string[range->start] == f_iki_syntax_quote_single_s.string[0] || buffer->string[range->start] == f_iki_syntax_quote_double_s.string[0] || buffer->string[range->start] == f_iki_syntax_quote_backtick_s.string[0]) { - state->status = f_number_unsigneds_increase(state->step_small, &data->delimits); + state->status = f_memory_array_increase(state->step_small, sizeof(f_number_unsigned_t), (void **) &data->delimits.array, &data->delimits.used, &data->delimits.size); if (F_status_is_error(state->status)) break; data->delimits.array[data->delimits.used++] = vocabulary_slash_first; @@ -374,7 +374,7 @@ extern "C" { ++content_slash_delimits; } - state->status = f_number_unsigneds_increase_by(content_slash_delimits, &data->delimits); + state->status = f_memory_array_increase_by(content_slash_delimits, sizeof(f_number_unsigned_t), (void **) &data->delimits.array, &data->delimits.used, &data->delimits.size); if (F_status_is_error(state->status)) break; content_range.start = content_slash_first; diff --git a/level_0/f_iki/c/iki.h b/level_0/f_iki/c/iki.h index ae7b9f392..2cb3508b6 100644 --- a/level_0/f_iki/c/iki.h +++ b/level_0/f_iki/c/iki.h @@ -170,6 +170,8 @@ extern "C" { * F_memory_not (with error bit) on out of memory. * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if a string length is too large to store in the buffer. + * + * @see f_memory_array_increase_by() */ #ifndef _di_f_iki_read_ extern void f_iki_read(f_string_static_t * const buffer, f_string_range_t * const range, f_iki_data_t * const data, f_state_t * const state); diff --git a/level_0/f_iki/c/iki/data.h b/level_0/f_iki/c/iki/data.h index 939d50997..36388a61f 100644 --- a/level_0/f_iki/c/iki/data.h +++ b/level_0/f_iki/c/iki/data.h @@ -95,12 +95,12 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. * + * Errors (with error bit) from: f_memory_array_append_all(). * Errors (with error bit) from: f_memory_array_increase(). - * Errors (with error bit) from: f_number_unsigneds_append_all(). * Errors (with error bit) from: f_string_ranges_append_all(). * + * @see f_memory_array_append_all() * @see f_memory_array_increase() - * @see f_number_unsigneds_append_all() * @see f_string_ranges_append_all() */ #ifndef _di_f_iki_datas_append_ @@ -121,12 +121,12 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. * + * Errors (with error bit) from: f_memory_array_append_all(). * Errors (with error bit) from: f_memory_array_increase_by(). - * Errors (with error bit) from: f_number_unsigneds_append_all(). * Errors (with error bit) from: f_string_ranges_append_all(). * + * @see f_memory_array_append_all() * @see f_memory_array_increase_by() - * @see f_number_unsigneds_append_all() * @see f_string_ranges_append_all() */ #ifndef _di_f_iki_datas_append_all_ diff --git a/level_0/f_iki/c/iki/private-data.c b/level_0/f_iki/c/iki/private-data.c index a30d430bd..d24edb40e 100644 --- a/level_0/f_iki/c/iki/private-data.c +++ b/level_0/f_iki/c/iki/private-data.c @@ -46,7 +46,7 @@ extern "C" { } if (source.delimits.used) { - status = f_number_unsigneds_append_all(source.delimits, &destination->array[destination->used].delimits); + status = f_memory_array_append_all((const void *) &source.delimits.array, source.delimits.used, sizeof(f_number_unsigned_t), (void **) &destination->array[destination->used].delimits.array, &destination->array[destination->used].delimits.used, &destination->array[destination->used].delimits.size); if (F_status_is_error(status)) return status; } @@ -85,7 +85,7 @@ extern "C" { } if (source.array[i].delimits.used) { - status = f_number_unsigneds_append_all(source.array[i].delimits, &destination->array[destination->used].delimits); + status = f_memory_array_append_all((const void *) &source.array[i].delimits.array, source.array[i].delimits.used, sizeof(f_number_unsigned_t), (void **) &destination->array[destination->used].delimits.array, &destination->array[destination->used].delimits.used, &destination->array[destination->used].delimits.size); if (F_status_is_error(status)) return status; } diff --git a/level_0/f_iki/c/iki/private-data.h b/level_0/f_iki/c/iki/private-data.h index b11ed4b6c..236518d6d 100644 --- a/level_0/f_iki/c/iki/private-data.h +++ b/level_0/f_iki/c/iki/private-data.h @@ -55,12 +55,12 @@ extern "C" { * @return * F_none on success. * + * Errors (with error bit) from: f_memory_array_append_all(). * Errors (with error bit) from: f_memory_array_increase(). - * Errors (with error bit) from: f_number_unsigneds_append_all(). * Errors (with error bit) from: f_string_ranges_append_all(). * + * @see f_memory_array_append_all() * @see f_memory_array_increase() - * @see f_number_unsigneds_append_all() * @see f_string_ranges_append_all() * * @see f_iki_datas_append() @@ -83,12 +83,12 @@ extern "C" { * @return * F_none on success. * + * Errors (with error bit) from: f_memory_array_append_all(). * Errors (with error bit) from: f_memory_array_increase_by(). - * Errors (with error bit) from: f_number_unsigneds_append_all(). * Errors (with error bit) from: f_string_ranges_append_all(). * + * @see f_memory_array_append_all() * @see f_memory_array_increase_by() - * @see f_number_unsigneds_append_all() * @see f_string_ranges_append_all() * * @see f_iki_datass_append() diff --git a/level_0/f_iki/c/private-iki.h b/level_0/f_iki/c/private-iki.h index 378e28c13..7db3acc76 100644 --- a/level_0/f_iki/c/private-iki.h +++ b/level_0/f_iki/c/private-iki.h @@ -57,12 +57,12 @@ extern "C" { * F_none on success. * F_data_not on success, but there is no reason to increase size (used + 1 <= size). * - * Errors (with error bit) from: f_number_unsigneds_resize(). * Errors (with error bit) from: f_memory_adjust(). + * Errors (with error bit) from: f_memory_array_resize(). * Errors (with error bit) from: f_string_ranges_adjust(). * - * @see f_number_unsigneds_resize() * @see f_memory_adjust() + * @see f_memory_array_resize() * @see f_string_ranges_adjust() */ #if !defined(_di_f_iki_datas_adjust_) || !defined(_di_f_iki_datas_decimate_by_) @@ -107,11 +107,11 @@ extern "C" { * F_none on success. * F_data_not on success, but there is no reason to increase size (used + 1 <= size). * - * Errors (with error bit) from: f_number_unsigneds_resize(). + * Errors (with error bit) from: f_memory_array_resize(). * Errors (with error bit) from: f_memory_resize(). * Errors (with error bit) from: f_string_ranges_resize(). * - * @see f_number_unsigneds_resize() + * @see f_memory_array_resize() * @see f_memory_resize() * @see f_string_ranges_resize() */ diff --git a/level_0/f_memory/c/memory.h b/level_0/f_memory/c/memory.h index 9f1ea8e70..3577916f7 100644 --- a/level_0/f_memory/c/memory.h +++ b/level_0/f_memory/c/memory.h @@ -22,6 +22,7 @@ // FLL-0 memory includes. #include #include +#include #ifdef __cplusplus extern "C" { diff --git a/level_0/f_memory/c/memory/array.c b/level_0/f_memory/c/memory/array.c index cfc134157..c73fbca9b 100644 --- a/level_0/f_memory/c/memory/array.c +++ b/level_0/f_memory/c/memory/array.c @@ -23,6 +23,7 @@ extern "C" { #ifndef _di_f_memory_array_append_ f_status_t f_memory_array_append(const void * const source, const size_t width, void ** array, f_number_unsigned_t * const used, f_number_unsigned_t * const size) { #ifndef _di_level_0_parameter_checking_ + if (!source) return F_status_set_error(F_parameter); if (!width) return F_status_set_error(F_parameter); if (!array) return F_status_set_error(F_parameter); if (!used) return F_status_set_error(F_parameter); @@ -42,7 +43,11 @@ extern "C" { } } - memcpy((*array) + (*used)++, source, width); + // uint8_t * is of a data size size of 1, casting it to bool should result in a single-length increment. + // This is done to avoid problems with (void *) having arithmetic issues. + memcpy((void *) (((uint8_t *) (*array)) + (*used * width)), source, width); + + ++(*used); return F_none; } @@ -51,6 +56,7 @@ extern "C" { #ifndef _di_f_memory_array_append_all_ f_status_t f_memory_array_append_all(const void * const sources, const f_number_unsigned_t amount, const size_t width, void ** array, f_number_unsigned_t * const used, f_number_unsigned_t * const size) { #ifndef _di_level_0_parameter_checking_ + if (!sources) return F_status_set_error(F_parameter); if (!width) return F_status_set_error(F_parameter); if (!array) return F_status_set_error(F_parameter); if (!used) return F_status_set_error(F_parameter); @@ -71,7 +77,9 @@ extern "C" { } } - memcpy(*array + *used, sources, width * amount); + // uint8_t * is of a data size size of 1, casting it to bool should result in a single-length increment. + // This is done to avoid problems with (void *) having arithmetic issues. + memcpy((void *) (((uint8_t *) (*array)) + (*used * width)), sources, width * amount); *used += amount; diff --git a/level_0/f_memory/c/memory/array.h b/level_0/f_memory/c/memory/array.h index d5baae224..f581a0c5c 100644 --- a/level_0/f_memory/c/memory/array.h +++ b/level_0/f_memory/c/memory/array.h @@ -60,6 +60,21 @@ extern "C" { * Must not be 0. * @param array * The structure.array destination. + * + * A literal array structure cannot be directly passed or this may segfault. + * Bad: + * { + * int arr[5] = { 0 }; + * ... + * f_memory_array_append(source, width, (void **) &arr, used, size); + * } + * Better: + * { + * int arr[5] = { 0 }; + * int *arr_pounter = arr; + * ... + * f_memory_array_append(source, width, (void **) &arr_pounter, used, size); + * } * @param used * The structure.used destination. * @param size @@ -97,6 +112,21 @@ extern "C" { * Must not be 0. * @param array * The structure.array destination. + * + * A literal array structure cannot be directly passed or this may segfault. + * Bad: + * { + * int arr[5] = { 0 }; + * ... + * f_memory_array_append_all(sources, amount, width, (void **) &arr, used, size); + * } + * Better: + * { + * int arr[5] = { 0 }; + * int *arr_pounter = arr; + * ... + * f_memory_array_append_all(sources, amount, width, (void **) &arr_pounter, used, size); + * } * @param used * The structure.used destination. * @param size diff --git a/level_0/f_memory/c/memory/arrays.c b/level_0/f_memory/c/memory/arrays.c new file mode 100644 index 000000000..2d168067d --- /dev/null +++ b/level_0/f_memory/c/memory/arrays.c @@ -0,0 +1,52 @@ +#include "../memory.h" +#include "private-array.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _di_f_memory_arrays_adjust_ + f_status_t f_memory_arrays_adjust(const f_number_unsigned_t length, const size_t width, void ** array, f_number_unsigned_t * const used, f_number_unsigned_t * const size, f_status_t (*callback)(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array)) { + #ifndef _di_level_0_parameter_checking_ + if (!width) return F_status_set_error(F_parameter); + if (!array) return F_status_set_error(F_parameter); + if (!used) return F_status_set_error(F_parameter); + if (!size) return F_status_set_error(F_parameter); + if (!callback) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (length > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); + + if (length < *size) { + const f_status_t status = callback(length, *size, *array); + if (F_status_is_error(status)) return status; + } + + return private_f_memory_array_adjust(length, width, array, used, size); + } +#endif // _di_f_memory_arrays_adjust_ + +#ifndef _di_f_memory_arrays_resize_ + f_status_t f_memory_arrays_resize(const f_number_unsigned_t length, const size_t width, void ** array, f_number_unsigned_t * const used, f_number_unsigned_t * const size, f_status_t (*callback)(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array)) { + #ifndef _di_level_0_parameter_checking_ + if (!width) return F_status_set_error(F_parameter); + if (!array) return F_status_set_error(F_parameter); + if (!used) return F_status_set_error(F_parameter); + if (!size) return F_status_set_error(F_parameter); + if (!callback) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (length > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); + + if (length < *size) { + const f_status_t status = callback(length, *size, *array); + if (F_status_is_error(status)) return status; + } + + return private_f_memory_array_resize(length, width, array, used, size); + } +#endif // _di_f_memory_arrays_resize_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_memory/c/memory/arrays.h b/level_0/f_memory/c/memory/arrays.h new file mode 100644 index 000000000..218ddcce6 --- /dev/null +++ b/level_0/f_memory/c/memory/arrays.h @@ -0,0 +1,113 @@ +/** + * FLL - Level 0 + * + * Project: Memory + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Defines memory array data. + * + * This is auto-included by memory.h and should not need to be explicitly included. + */ +#ifndef _F_memory_arrays_h +#define _F_memory_arrays_h + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Resize the memory array of arrays. + * + * This function is only useful for structures of the form "{ array, used, size }" where the array is a an array of simple types. + * If the simple type that is "array" requires additional memory manipulation on allocation or de-allocation, then do not use this function. + * + * The inner array can be a more complex structure because the callback is expected to know the type. + * + * @param length + * The new size to use. + * @param width + * The size of the structure represented by array. + * The word "width" is used due to conflicts of already using "length" and "size". + * Must not be 0. + * @param array + * The structure.array to resize. + * @param used + * The structure.used. + * @param size + * The structure.size. + * @param callback + * A callback to call on each array value when reducing the length of the array. + * This callback is expected to know the appropriate type and will cast the structure parameter to the appropriate type. + * + * This is only called when the requested length is less than the given size. + * + * Callback Parameters: + * - start: The start position in the array to start deleting. + * - stop: The stop in the array to stop deleting. + * - array: The array structure to delete all values of. + * + * Callback Returns: + * The standard status codes similar to this function. + * + * @return + * F_none on success. + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + */ +#ifndef _di_f_memory_arrays_adjust_ + extern f_status_t f_memory_arrays_adjust(const f_number_unsigned_t length, const size_t width, void ** array, f_number_unsigned_t * const used, f_number_unsigned_t * const size, f_status_t (*callback)(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array)); +#endif // _di_f_memory_arrays_adjust_ + +/** + * Resize the memory array of arrays. + * + * This function is only useful for structures of the form "{ array, used, size }" where the array is a an array of simple types. + * If the simple type that is "array" requires additional memory manipulation on allocation or de-allocation, then do not use this function. + * + * The inner array can be a more complex structure because the callback is expected to know the type. + * + * @param length + * The new size to use. + * @param width + * The size of the structure represented by array. + * The word "width" is used due to conflicts of already using "length" and "size". + * Must not be 0. + * @param array + * The structure.array to resize. + * @param used + * The structure.used. + * @param size + * The structure.size. + * @param callback + * A callback to call on each array value when reducing the length of the array. + * This callback is expected to know the appropriate type and will cast the structure parameter to the appropriate type. + * + * This is only called when the requested length is less than the given size. + * + * Callback Parameters: + * - start: The start position in the array to start deleting. + * - stop: The stop in the array to stop deleting. + * - array: The array structure to delete all values of. + * + * Callback Returns: + * The standard status codes similar to this function. + * + * @return + * F_none on success. + * + * F_array_too_large (with error bit) if the new array length is too large. + * F_memory_not (with error bit) on out of memory. + * F_parameter (with error bit) if a parameter is invalid. + */ +#ifndef _di_f_memory_arrays_resize_ + extern f_status_t f_memory_arrays_resize(const f_number_unsigned_t length, const size_t width, void ** array, f_number_unsigned_t * const used, f_number_unsigned_t * const size, f_status_t (*callback)(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array)); +#endif // _di_f_memory_arrays_resize_ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _F_memory_arrays_h diff --git a/level_0/f_memory/data/build/settings b/level_0/f_memory/data/build/settings index e073e5349..df7c0545e 100644 --- a/level_0/f_memory/data/build/settings +++ b/level_0/f_memory/data/build/settings @@ -31,10 +31,10 @@ build_language c build_libraries -lc -build_sources_library memory.c memory/array.c +build_sources_library memory.c memory/array.c memory/arrays.c build_sources_library private-memory.c memory/private-array.c -build_sources_headers memory.h memory/array.h memory/common.h +build_sources_headers memory.h memory/array.h memory/arrays.h memory/common.h build_script yes build_shared yes diff --git a/level_0/f_memory/data/build/settings-tests b/level_0/f_memory/data/build/settings-tests index d60609a35..21779e525 100644 --- a/level_0/f_memory/data/build/settings-tests +++ b/level_0/f_memory/data/build/settings-tests @@ -24,7 +24,8 @@ build_libraries -lc -lcmocka build_libraries-individual -lf_memory build_sources_program test-memory-adjust.c test-memory-delete.c test-memory-destroy.c test-memory-new_aligned.c test-memory-new.c test-memory-resize.c test-memory.c -build_sources_program test-memory-array_adjust.c test-memory-array_decimate_by.c test-memory-array_decrease_by.c test-memory-array_increase.c test-memory-array_increase_by.c test-memory-array_resize.c +build_sources_program test-memory-array_adjust.c test-memory-array_append.c test-memory-array_append_all.c test-memory-array_decimate_by.c test-memory-array_decrease_by.c test-memory-array_increase.c test-memory-array_increase_by.c test-memory-array_resize.c +build_sources_program test-memory-arrays_adjust.c test-memory-arrays_resize.c build_script no build_shared yes diff --git a/level_0/f_memory/tests/unit/c/test-memory-array_adjust.c b/level_0/f_memory/tests/unit/c/test-memory-array_adjust.c index 602545ae6..65c6d5972 100644 --- a/level_0/f_memory/tests/unit/c/test-memory-array_adjust.c +++ b/level_0/f_memory/tests/unit/c/test-memory-array_adjust.c @@ -80,7 +80,13 @@ void test__f_memory_array_adjust__works(void **state) { assert_int_equal(data.size, length); } - free((void *) data.array); + { + const f_status_t status = f_memory_array_adjust(0, sizeof(int), (void **) &data.array, &data.used, &data.size); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } } #ifdef __cplusplus diff --git a/level_0/f_memory/tests/unit/c/test-memory-array_adjust.h b/level_0/f_memory/tests/unit/c/test-memory-array_adjust.h index ecbbab290..e900348af 100644 --- a/level_0/f_memory/tests/unit/c/test-memory-array_adjust.h +++ b/level_0/f_memory/tests/unit/c/test-memory-array_adjust.h @@ -7,8 +7,8 @@ * * Test set quote adjust in the fss project. */ -#ifndef _TEST__F_fss__simple_packet_range_adjust -#define _TEST__F_fss__simple_packet_range_adjust +#ifndef _TEST__F_memory__array_adjust +#define _TEST__F_memory__array_adjust /** * Test that the function correctly fails on invalid parameter. @@ -31,4 +31,4 @@ extern void test__f_memory_array_adjust__returns_array_too_large(void **state); */ extern void test__f_memory_array_adjust__works(void **state); -#endif // _TEST__F_fss__simple_packet_range_adjust +#endif // _TEST__F_memory__array_adjust diff --git a/level_0/f_memory/tests/unit/c/test-memory-array_append.c b/level_0/f_memory/tests/unit/c/test-memory-array_append.c new file mode 100644 index 000000000..b2c5f6f0e --- /dev/null +++ b/level_0/f_memory/tests/unit/c/test-memory-array_append.c @@ -0,0 +1,113 @@ +#include "test-memory.h" +#include "test-memory-array_append.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_memory_array_append__parameter_checking(void **state) { + + const int number = 1; + test_memory_array_t data = test_memory_array_t_initialize; + + { + const f_status_t status = f_memory_array_append((void *) &number, sizeof(int), 0, 0, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + { + const f_status_t status = f_memory_array_append((void *) &number, sizeof(int), 0, &data.used, &data.size); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + { + const f_status_t status = f_memory_array_append((void *) &number, sizeof(int), (void **) &data.array, 0, &data.size); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + { + const f_status_t status = f_memory_array_append((void *) &number, sizeof(int), (void **) &data.array, &data.used, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + { + const f_status_t status = f_memory_array_append((void *) &number, 0, (void **) &data.array, &data.used, &data.size); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + { + const f_status_t status = f_memory_array_append(0, sizeof(int), (void **) &data.array, &data.used, &data.size); + + 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_memory_array_append__returns_array_too_large(void **state) { + + const int number = 1; + test_memory_array_t data = test_memory_array_t_initialize; + + data.used = F_number_t_size_unsigned_d; + + { + const f_status_t status = f_memory_array_append((void *) &number, sizeof(int), (void **) &data.array, &data.used, &data.size); + + assert_int_equal(status, F_status_set_error(F_array_too_large)); + assert_int_equal(data.used, F_number_t_size_unsigned_d); + assert_int_equal(data.size, 0); + } +} + +void test__f_memory_array_append__works(void **state) { + + const int number = 1; + test_memory_array_t data = test_memory_array_t_initialize; + + { + const f_status_t status = f_memory_array_append((void *) &number, sizeof(int), (void **) &data.array, &data.used, &data.size); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 1); + assert_int_equal(data.array[0], number); + assert_int_not_equal(data.size, 0); + } + + const f_number_unsigned_t size = data.size; + const int number_next = 2; + + { + const f_status_t status = f_memory_array_append((void *) &number_next, sizeof(int), (void **) &data.array, &data.used, &data.size); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 2); + assert_int_equal(data.array[0], number); + assert_int_equal(data.array[1], number_next); + assert_int_not_equal(data.size, 0); + assert_int_not_equal(data.size, size); + } + + free((void *) data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_memory/tests/unit/c/test-memory-array_append.h b/level_0/f_memory/tests/unit/c/test-memory-array_append.h new file mode 100644 index 000000000..c90af779a --- /dev/null +++ b/level_0/f_memory/tests/unit/c/test-memory-array_append.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: Memory + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test set quote resize in the fss project. + */ +#ifndef _TEST__F_memory__array_append +#define _TEST__F_memory__array_append + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_memory_array_append() + */ +extern void test__f_memory_array_append__parameter_checking(void **state); + +/** + * Test that the function returns F_array_too_large. + * + * @see f_memory_array_append() + */ +extern void test__f_memory_array_append__returns_array_too_large(void **state); + +/** + * Test that the function works. + * + * @see f_memory_array_append() + */ +extern void test__f_memory_array_append__works(void **state); + +#endif // _TEST__F_memory__array_append diff --git a/level_0/f_memory/tests/unit/c/test-memory-array_append_all.c b/level_0/f_memory/tests/unit/c/test-memory-array_append_all.c new file mode 100644 index 000000000..226e9977d --- /dev/null +++ b/level_0/f_memory/tests/unit/c/test-memory-array_append_all.c @@ -0,0 +1,135 @@ +#include "test-memory.h" +#include "test-memory-array_append_all.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_memory_array_append_all__parameter_checking(void **state) { + + int sources_array[2] = { 1, 2 }; + test_memory_array_t sources = { .array = sources_array, .used = 2, .size = 0 }; + test_memory_array_t data = test_memory_array_t_initialize; + + { + const f_status_t status = f_memory_array_append_all((void *) sources.array, sources.used, sizeof(int), 0, 0, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + { + const f_status_t status = f_memory_array_append_all((void *) sources.array, sources.used, sizeof(int), 0, &data.used, &data.size); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + { + const f_status_t status = f_memory_array_append_all((void *) sources.array, sources.used, sizeof(int), (void **) &data.array, 0, &data.size); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + { + const f_status_t status = f_memory_array_append_all((void *) sources.array, sources.used, sizeof(int), (void **) &data.array, &data.used, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + { + const f_status_t status = f_memory_array_append_all((void *) sources.array, sources.used, 0, (void **) &data.array, &data.used, &data.size); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + { + const f_status_t status = f_memory_array_append_all(0, sources.used, sizeof(int), (void **) &data.array, &data.used, &data.size); + + 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_memory_array_append_all__returns_array_too_large(void **state) { + + int sources_array[2] = { 1, 2 }; + test_memory_array_t sources = { .array = sources_array, .used = 2, .size = 0 }; + test_memory_array_t data = test_memory_array_t_initialize; + + data.used = F_number_t_size_unsigned_d; + + { + const f_status_t status = f_memory_array_append_all((void *) sources.array, sources.used, sizeof(int), (void **) &data.array, &data.used, &data.size); + + assert_int_equal(status, F_status_set_error(F_array_too_large)); + assert_int_equal(data.used, F_number_t_size_unsigned_d); + assert_int_equal(data.size, 0); + } +} + +void test__f_memory_array_append_all__returns_data_not(void **state) { + + int sources_array[0] = { }; + test_memory_array_t sources = { .array = sources_array, .used = 0, .size = 0 }; + test_memory_array_t data = test_memory_array_t_initialize; + + { + const f_status_t status = f_memory_array_append_all((void *) sources.array, sources.used, sizeof(int), (void **) &data.array, &data.used, &data.size); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } +} + +void test__f_memory_array_append_all__works(void **state) { + + int sources_array[2] = { 1, 2 }; + test_memory_array_t sources = { .array = sources_array, .used = 2, .size = 0 }; + test_memory_array_t data = test_memory_array_t_initialize; + + { + const f_status_t status = f_memory_array_append_all((void *) sources.array, sources.used, sizeof(int), (void **) &data.array, &data.used, &data.size); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 2); + assert_int_equal(data.array[0], sources.array[0]); + assert_int_equal(data.array[1], sources.array[1]); + assert_int_not_equal(data.size, 0); + } + + const f_number_unsigned_t size = data.size; + + int source_next_array[1] = { 3 }; + test_memory_array_t sources_next = { .array = source_next_array, .used = 1, .size = 0 }; + + { + const f_status_t status = f_memory_array_append_all((void *) sources_next.array, sources_next.used, sizeof(int), (void **) &data.array, &data.used, &data.size); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 3); + assert_int_equal(data.array[0], sources.array[0]); + assert_int_equal(data.array[1], sources.array[1]); + assert_int_equal(data.array[2], sources_next.array[0]); + assert_int_not_equal(data.size, 0); + assert_int_not_equal(data.size, size); + } + + free((void *) data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_memory/tests/unit/c/test-memory-array_append_all.h b/level_0/f_memory/tests/unit/c/test-memory-array_append_all.h new file mode 100644 index 000000000..519f3a029 --- /dev/null +++ b/level_0/f_memory/tests/unit/c/test-memory-array_append_all.h @@ -0,0 +1,41 @@ +/** + * FLL - Level 0 + * + * Project: Memory + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test set quote resize in the fss project. + */ +#ifndef _TEST__F_memory__array_append_all +#define _TEST__F_memory__array_append_all + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_memory_array_append_all() + */ +extern void test__f_memory_array_append_all__parameter_checking(void **state); + +/** + * Test that the function returns F_array_too_large. + * + * @see f_memory_array_append_all() + */ +extern void test__f_memory_array_append_all__returns_array_too_large(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see f_memory_array_append_all() + */ +extern void test__f_memory_array_append_all__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_memory_array_append_all() + */ +extern void test__f_memory_array_append_all__works(void **state); + +#endif // _TEST__F_memory__array_append_all diff --git a/level_0/f_memory/tests/unit/c/test-memory-array_decimate_by.c b/level_0/f_memory/tests/unit/c/test-memory-array_decimate_by.c index fabe67135..1d021e806 100644 --- a/level_0/f_memory/tests/unit/c/test-memory-array_decimate_by.c +++ b/level_0/f_memory/tests/unit/c/test-memory-array_decimate_by.c @@ -44,7 +44,7 @@ void test__f_memory_array_decimate_by__parameter_checking(void **state) { { const f_status_t status = f_memory_array_decimate_by(length, 0, (void **) &data.array, &data.used, &data.size); - assert_int_equal(status, F_size_not); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.array, 0); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); diff --git a/level_0/f_memory/tests/unit/c/test-memory-array_decimate_by.h b/level_0/f_memory/tests/unit/c/test-memory-array_decimate_by.h index 8293270e6..ae56351ec 100644 --- a/level_0/f_memory/tests/unit/c/test-memory-array_decimate_by.h +++ b/level_0/f_memory/tests/unit/c/test-memory-array_decimate_by.h @@ -1,14 +1,14 @@ /** * FLL - Level 0 * - * Project: FSS + * Project: Memory * API Version: 0.7 * Licenses: lgpl-2.1-or-later * * Test set quote decimate by in the fss project. */ -#ifndef _TEST__F_fss__simple_packet_range_decimate_by -#define _TEST__F_fss__simple_packet_range_decimate_by +#ifndef _TEST__F_memory__array_decimate_by +#define _TEST__F_memory__array_decimate_by /** * Test that the function correctly fails on invalid parameter. @@ -31,4 +31,4 @@ extern void test__f_memory_array_decimate_by__returns_data_not(void **state); */ extern void test__f_memory_array_decimate_by__works(void **state); -#endif // _TEST__F_fss__simple_packet_range_decimate_by +#endif // _TEST__F_memory__array_decimate_by diff --git a/level_0/f_memory/tests/unit/c/test-memory-array_decrease_by.c b/level_0/f_memory/tests/unit/c/test-memory-array_decrease_by.c index 7a2aba570..97e50b58e 100644 --- a/level_0/f_memory/tests/unit/c/test-memory-array_decrease_by.c +++ b/level_0/f_memory/tests/unit/c/test-memory-array_decrease_by.c @@ -44,7 +44,7 @@ void test__f_memory_array_decrease_by__parameter_checking(void **state) { { const f_status_t status = f_memory_array_decrease_by(length, 0, (void **) &data.array, &data.used, &data.size); - assert_int_equal(status, F_size_not); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.array, 0); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); diff --git a/level_0/f_memory/tests/unit/c/test-memory-array_decrease_by.h b/level_0/f_memory/tests/unit/c/test-memory-array_decrease_by.h index f8d6081b6..cb147f27a 100644 --- a/level_0/f_memory/tests/unit/c/test-memory-array_decrease_by.h +++ b/level_0/f_memory/tests/unit/c/test-memory-array_decrease_by.h @@ -1,14 +1,14 @@ /** * FLL - Level 0 * - * Project: FSS + * Project: Memory * API Version: 0.7 * Licenses: lgpl-2.1-or-later * * Test set quote decrease by in the fss project. */ -#ifndef _TEST__F_fss__simple_packet_range_decrease_by -#define _TEST__F_fss__simple_packet_range_decrease_by +#ifndef _TEST__F_memory__array_decrease_by +#define _TEST__F_memory__array_decrease_by /** * Test that the function correctly fails on invalid parameter. @@ -31,4 +31,4 @@ extern void test__f_memory_array_decrease_by__returns_data_not(void **state); */ extern void test__f_memory_array_decrease_by__works(void **state); -#endif // _TEST__F_fss__simple_packet_range_decrease_by +#endif // _TEST__F_memory__array_decrease_by diff --git a/level_0/f_memory/tests/unit/c/test-memory-array_increase.h b/level_0/f_memory/tests/unit/c/test-memory-array_increase.h index 912b2e8c9..04635e81b 100644 --- a/level_0/f_memory/tests/unit/c/test-memory-array_increase.h +++ b/level_0/f_memory/tests/unit/c/test-memory-array_increase.h @@ -1,14 +1,14 @@ /** * FLL - Level 0 * - * Project: FSS + * Project: Memory * API Version: 0.7 * Licenses: lgpl-2.1-or-later * * Test set quote increase in the fss project. */ -#ifndef _TEST__F_fss__simple_packet_range_increase -#define _TEST__F_fss__simple_packet_range_increase +#ifndef _TEST__F_memory__array_increase +#define _TEST__F_memory__array_increase /** * Test that the function correctly fails on invalid parameter. @@ -38,4 +38,4 @@ extern void test__f_memory_array_increase__returns_data_not(void **state); */ extern void test__f_memory_array_increase__works(void **state); -#endif // _TEST__F_fss__simple_packet_range_increase +#endif // _TEST__F_memory__array_increase diff --git a/level_0/f_memory/tests/unit/c/test-memory-array_increase_by.c b/level_0/f_memory/tests/unit/c/test-memory-array_increase_by.c index 7aaca88df..5ca37f287 100644 --- a/level_0/f_memory/tests/unit/c/test-memory-array_increase_by.c +++ b/level_0/f_memory/tests/unit/c/test-memory-array_increase_by.c @@ -85,7 +85,7 @@ void test__f_memory_array_increase_by__returns_data_not(void **state) { assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } free((void *) data.array); diff --git a/level_0/f_memory/tests/unit/c/test-memory-array_increase_by.h b/level_0/f_memory/tests/unit/c/test-memory-array_increase_by.h index 37db2d10b..1b641db00 100644 --- a/level_0/f_memory/tests/unit/c/test-memory-array_increase_by.h +++ b/level_0/f_memory/tests/unit/c/test-memory-array_increase_by.h @@ -1,14 +1,14 @@ /** * FLL - Level 0 * - * Project: FSS + * Project: Memory * API Version: 0.7 * Licenses: lgpl-2.1-or-later * * Test set quote increase by in the fss project. */ -#ifndef _TEST__F_fss__simple_packet_range_increase_by -#define _TEST__F_fss__simple_packet_range_increase_by +#ifndef _TEST__F_memory__array_increase_by +#define _TEST__F_memory__array_increase_by /** * Test that the function correctly fails on invalid parameter. @@ -38,4 +38,4 @@ extern void test__f_memory_array_increase_by__returns_data_not(void **state); */ extern void test__f_memory_array_increase_by__works(void **state); -#endif // _TEST__F_fss__simple_packet_range_increase_by +#endif // _TEST__F_memory__array_increase_by diff --git a/level_0/f_memory/tests/unit/c/test-memory-array_resize.c b/level_0/f_memory/tests/unit/c/test-memory-array_resize.c index 86d65b0f5..0a170c4dd 100644 --- a/level_0/f_memory/tests/unit/c/test-memory-array_resize.c +++ b/level_0/f_memory/tests/unit/c/test-memory-array_resize.c @@ -80,7 +80,13 @@ void test__f_memory_array_resize__works(void **state) { assert_int_equal(data.size, length); } - free((void *) data.array); + { + const f_status_t status = f_memory_array_resize(0, sizeof(int), (void **) &data.array, &data.used, &data.size); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } } #ifdef __cplusplus diff --git a/level_0/f_memory/tests/unit/c/test-memory-array_resize.h b/level_0/f_memory/tests/unit/c/test-memory-array_resize.h index 5703ab74d..08d0f7767 100644 --- a/level_0/f_memory/tests/unit/c/test-memory-array_resize.h +++ b/level_0/f_memory/tests/unit/c/test-memory-array_resize.h @@ -1,14 +1,14 @@ /** * FLL - Level 0 * - * Project: FSS + * Project: Memory * API Version: 0.7 * Licenses: lgpl-2.1-or-later * * Test set quote resize in the fss project. */ -#ifndef _TEST__F_fss__simple_packet_range_resize -#define _TEST__F_fss__simple_packet_range_resize +#ifndef _TEST__F_memory__array_resize +#define _TEST__F_memory__array_resize /** * Test that the function correctly fails on invalid parameter. @@ -31,4 +31,4 @@ extern void test__f_memory_array_resize__returns_array_too_large(void **state); */ extern void test__f_memory_array_resize__works(void **state); -#endif // _TEST__F_fss__simple_packet_range_resize +#endif // _TEST__F_memory__array_resize diff --git a/level_0/f_memory/tests/unit/c/test-memory-arrays_adjust.c b/level_0/f_memory/tests/unit/c/test-memory-arrays_adjust.c new file mode 100644 index 000000000..599745424 --- /dev/null +++ b/level_0/f_memory/tests/unit/c/test-memory-arrays_adjust.c @@ -0,0 +1,113 @@ +#include "test-memory.h" +#include "test-memory-arrays_adjust.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_memory_arrays_adjust__parameter_checking(void **state) { + + const int length = 5; + test_memory_arrays_t data = test_memory_arrays_t_initialize; + + { + const f_status_t status = f_memory_arrays_adjust(length, sizeof(test_memory_array_t), 0, 0, 0, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + { + const f_status_t status = f_memory_arrays_adjust(length, sizeof(test_memory_array_t), 0, &data.used, &data.size, &test_memory_array_callback); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + { + const f_status_t status = f_memory_arrays_adjust(length, sizeof(test_memory_array_t), (void **) &data.array, 0, &data.size, &test_memory_array_callback); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + { + const f_status_t status = f_memory_arrays_adjust(length, sizeof(test_memory_array_t), (void **) &data.array, &data.used, 0, &test_memory_array_callback); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + { + const f_status_t status = f_memory_arrays_adjust(length, sizeof(test_memory_array_t), (void **) &data.array, &data.used, &data.size, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + { + const f_status_t status = f_memory_arrays_adjust(length, 0, (void **) &data.array, &data.used, &data.size, &test_memory_array_callback); + + 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_memory_arrays_adjust__returns_array_too_large(void **state) { + + const f_number_unsigned_t length = F_number_t_size_unsigned_d + 1; + test_memory_arrays_t data = test_memory_arrays_t_initialize; + + { + const f_status_t status = f_memory_arrays_adjust(length, sizeof(test_memory_array_t), (void **) &data.array, &data.used, &data.size, &test_memory_array_callback); + + assert_int_equal(status, F_status_set_error(F_array_too_large)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } +} + +void test__f_memory_arrays_adjust__works(void **state) { + + const int length = 5; + test_memory_arrays_t data = test_memory_arrays_t_initialize; + + { + const f_status_t status = f_memory_arrays_adjust(length, sizeof(test_memory_array_t), (void **) &data.array, &data.used, &data.size, &test_memory_array_callback); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + // Allocate an additional location to check that the memory callback gets called and works. + { + const int length_inner = 2; + + const f_status_t status = f_memory_array_adjust(length_inner, sizeof(int), (void **) &data.array[0].array, &data.array[0].used, &data.array[0].size); + + assert_int_equal(status, F_none); + assert_int_equal(data.array[0].used, 0); + assert_int_equal(data.array[0].size, length_inner); + } + + { + const f_status_t status = f_memory_arrays_adjust(0, sizeof(test_memory_array_t), (void **) &data.array, &data.used, &data.size, &test_memory_array_callback); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_memory/tests/unit/c/test-memory-arrays_adjust.h b/level_0/f_memory/tests/unit/c/test-memory-arrays_adjust.h new file mode 100644 index 000000000..1b734a770 --- /dev/null +++ b/level_0/f_memory/tests/unit/c/test-memory-arrays_adjust.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: Memory + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test set quote adjust in the fss project. + */ +#ifndef _TEST__F_memory__arrays_adjust +#define _TEST__F_memory__arrays_adjust + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_memory_arrays_adjust() + */ +extern void test__f_memory_arrays_adjust__parameter_checking(void **state); + +/** + * Test that the function returns F_array_too_large. + * + * @see f_memory_arrays_adjust() + */ +extern void test__f_memory_arrays_adjust__returns_array_too_large(void **state); + +/** + * Test that the function works. + * + * @see f_memory_arrays_adjust() + */ +extern void test__f_memory_arrays_adjust__works(void **state); + +#endif // _TEST__F_memory__arrays_adjust diff --git a/level_0/f_memory/tests/unit/c/test-memory-arrays_resize.c b/level_0/f_memory/tests/unit/c/test-memory-arrays_resize.c new file mode 100644 index 000000000..7ff263386 --- /dev/null +++ b/level_0/f_memory/tests/unit/c/test-memory-arrays_resize.c @@ -0,0 +1,113 @@ +#include "test-memory.h" +#include "test-memory-arrays_resize.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_memory_arrays_resize__parameter_checking(void **state) { + + const int length = 5; + test_memory_arrays_t data = test_memory_arrays_t_initialize; + + { + const f_status_t status = f_memory_arrays_resize(length, sizeof(test_memory_array_t), 0, 0, 0, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + { + const f_status_t status = f_memory_arrays_resize(length, sizeof(test_memory_array_t), 0, &data.used, &data.size, &test_memory_array_callback); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + { + const f_status_t status = f_memory_arrays_resize(length, sizeof(test_memory_array_t), (void **) &data.array, 0, &data.size, &test_memory_array_callback); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + { + const f_status_t status = f_memory_arrays_resize(length, sizeof(test_memory_array_t), (void **) &data.array, &data.used, 0, &test_memory_array_callback); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + { + const f_status_t status = f_memory_arrays_resize(length, sizeof(test_memory_array_t), (void **) &data.array, &data.used, &data.size, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + { + const f_status_t status = f_memory_arrays_resize(length, 0, (void **) &data.array, &data.used, &data.size, &test_memory_array_callback); + + 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_memory_arrays_resize__returns_array_too_large(void **state) { + + const f_number_unsigned_t length = F_number_t_size_unsigned_d + 1; + test_memory_arrays_t data = test_memory_arrays_t_initialize; + + { + const f_status_t status = f_memory_arrays_resize(length, sizeof(test_memory_array_t), (void **) &data.array, &data.used, &data.size, &test_memory_array_callback); + + assert_int_equal(status, F_status_set_error(F_array_too_large)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } +} + +void test__f_memory_arrays_resize__works(void **state) { + + const int length = 5; + test_memory_arrays_t data = test_memory_arrays_t_initialize; + + { + const f_status_t status = f_memory_arrays_resize(length, sizeof(test_memory_array_t), (void **) &data.array, &data.used, &data.size, &test_memory_array_callback); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + // Allocate an additional location to check that the memory callback gets called and works. + { + const int length_inner = 2; + + const f_status_t status = f_memory_array_resize(length_inner, sizeof(int), (void **) &data.array[0].array, &data.array[0].used, &data.array[0].size); + + assert_int_equal(status, F_none); + assert_int_equal(data.array[0].used, 0); + assert_int_equal(data.array[0].size, length_inner); + } + + { + const f_status_t status = f_memory_arrays_resize(0, sizeof(test_memory_array_t), (void **) &data.array, &data.used, &data.size, &test_memory_array_callback); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_memory/tests/unit/c/test-memory-arrays_resize.h b/level_0/f_memory/tests/unit/c/test-memory-arrays_resize.h new file mode 100644 index 000000000..fe67468ff --- /dev/null +++ b/level_0/f_memory/tests/unit/c/test-memory-arrays_resize.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: Memory + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test set quote resize in the fss project. + */ +#ifndef _TEST__F_memory__arrays_resize +#define _TEST__F_memory__arrays_resize + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_memory_arrays_resize() + */ +extern void test__f_memory_arrays_resize__parameter_checking(void **state); + +/** + * Test that the function returns F_array_too_large. + * + * @see f_memory_arrays_resize() + */ +extern void test__f_memory_arrays_resize__returns_array_too_large(void **state); + +/** + * Test that the function works. + * + * @see f_memory_arrays_resize() + */ +extern void test__f_memory_arrays_resize__works(void **state); + +#endif // _TEST__F_memory__arrays_resize diff --git a/level_0/f_memory/tests/unit/c/test-memory.c b/level_0/f_memory/tests/unit/c/test-memory.c index c15dcb9e1..8636a840f 100644 --- a/level_0/f_memory/tests/unit/c/test-memory.c +++ b/level_0/f_memory/tests/unit/c/test-memory.c @@ -41,7 +41,9 @@ int main(void) { cmocka_unit_test(test__f_memory_array_increase_by__returns_array_too_large), cmocka_unit_test(test__f_memory_array_resize__returns_array_too_large), - cmocka_unit_test(test__f_memory_array_append__returns_data_not), + cmocka_unit_test(test__f_memory_arrays_adjust__returns_array_too_large), + cmocka_unit_test(test__f_memory_arrays_resize__returns_array_too_large), + cmocka_unit_test(test__f_memory_array_append_all__returns_data_not), cmocka_unit_test(test__f_memory_array_decimate_by__returns_data_not), cmocka_unit_test(test__f_memory_array_decrease_by__returns_data_not), @@ -57,6 +59,9 @@ int main(void) { cmocka_unit_test(test__f_memory_array_increase_by__works), cmocka_unit_test(test__f_memory_array_resize__works), + cmocka_unit_test(test__f_memory_arrays_adjust__works), + cmocka_unit_test(test__f_memory_arrays_resize__works), + #ifndef _di_level_0_parameter_checking_ cmocka_unit_test(test__f_memory_adjust__parameter_checking), cmocka_unit_test(test__f_memory_delete__parameter_checking), @@ -72,12 +77,31 @@ int main(void) { cmocka_unit_test(test__f_memory_array_increase__parameter_checking), cmocka_unit_test(test__f_memory_array_increase_by__parameter_checking), cmocka_unit_test(test__f_memory_array_resize__parameter_checking), + + cmocka_unit_test(test__f_memory_arrays_adjust__parameter_checking), + cmocka_unit_test(test__f_memory_arrays_resize__parameter_checking), #endif // _di_level_0_parameter_checking_ }; return cmocka_run_group_tests(tests, setup, setdown); } +f_status_t test_memory_array_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const void_array) { + + { + test_memory_array_t * const array = (test_memory_array_t *) void_array; + f_status_t status = F_none; + + for (f_number_unsigned_t i = start; i < size; ++i) { + + status = f_memory_array_adjust(0, sizeof(int), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } // for + } + + return F_none; +} + #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_memory/tests/unit/c/test-memory.h b/level_0/f_memory/tests/unit/c/test-memory.h index 605ab6191..9958b7336 100644 --- a/level_0/f_memory/tests/unit/c/test-memory.h +++ b/level_0/f_memory/tests/unit/c/test-memory.h @@ -32,6 +32,8 @@ #include "test-memory-array_increase.h" #include "test-memory-array_increase_by.h" #include "test-memory-array_resize.h" +#include "test-memory-arrays_adjust.h" +#include "test-memory-arrays_resize.h" #include "test-memory-delete.h" #include "test-memory-destroy.h" #include "test-memory-new.h" @@ -53,6 +55,17 @@ typedef struct { #define test_memory_array_t_initialize { 0, 0, 0 } +/** + * A structure used for testing the memory arrays functions. + */ +typedef struct { + test_memory_array_t *array; + f_number_unsigned_t used; + f_number_unsigned_t size; +} test_memory_arrays_t; + +#define test_memory_arrays_t_initialize { 0, 0, 0 } + /** * Perform any setup operations. * @@ -86,6 +99,11 @@ extern int setdown(void **state); */ extern int main(void); +/** + * Callback for passing to f_memory_arrays functions. + */ +extern f_status_t test_memory_array_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array); + #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_string/c/private-string.c b/level_0/f_string/c/private-string.c index f0556810f..1c8def800 100644 --- a/level_0/f_string/c/private-string.c +++ b/level_0/f_string/c/private-string.c @@ -1,6 +1,5 @@ #include "string.h" #include "private-string.h" -#include "string/private-dynamic.h" #ifdef __cplusplus extern "C" { diff --git a/level_0/f_string/c/string/dynamic.c b/level_0/f_string/c/string/dynamic.c index 14d95c508..be5c4de8f 100644 --- a/level_0/f_string/c/string/dynamic.c +++ b/level_0/f_string/c/string/dynamic.c @@ -1,6 +1,5 @@ #include "../string.h" #include "../private-string.h" -#include "private-dynamic.h" #ifdef __cplusplus extern "C" { diff --git a/level_0/f_string/c/string/dynamics.c b/level_0/f_string/c/string/dynamics.c index 1f475413c..58e2ea03c 100644 --- a/level_0/f_string/c/string/dynamics.c +++ b/level_0/f_string/c/string/dynamics.c @@ -1,6 +1,5 @@ #include "../string.h" #include "../private-string.h" -#include "private-dynamic.h" #include "private-dynamics.h" #ifdef __cplusplus diff --git a/level_0/f_string/c/string/dynamicss.c b/level_0/f_string/c/string/dynamicss.c index eecad3a8f..488bc144f 100644 --- a/level_0/f_string/c/string/dynamicss.c +++ b/level_0/f_string/c/string/dynamicss.c @@ -1,6 +1,5 @@ #include "../string.h" #include "../private-string.h" -#include "private-dynamic.h" #include "private-dynamics.h" #include "private-dynamicss.h" diff --git a/level_0/f_string/c/string/map_multi.c b/level_0/f_string/c/string/map_multi.c index b947a17bd..19bfbd9dd 100644 --- a/level_0/f_string/c/string/map_multi.c +++ b/level_0/f_string/c/string/map_multi.c @@ -1,6 +1,5 @@ #include "../string.h" #include "../private-string.h" -#include "private-dynamic.h" #ifdef __cplusplus extern "C" { diff --git a/level_0/f_string/c/string/map_multis.c b/level_0/f_string/c/string/map_multis.c index d806035ee..36f4527df 100644 --- a/level_0/f_string/c/string/map_multis.c +++ b/level_0/f_string/c/string/map_multis.c @@ -1,6 +1,5 @@ #include "../string.h" #include "../private-string.h" -#include "private-dynamic.h" #include "private-dynamics.h" #include "private-map_multis.h" diff --git a/level_0/f_string/c/string/map_multiss.c b/level_0/f_string/c/string/map_multiss.c index 3b3cea918..8aafa1751 100644 --- a/level_0/f_string/c/string/map_multiss.c +++ b/level_0/f_string/c/string/map_multiss.c @@ -1,6 +1,5 @@ #include "../string.h" #include "../private-string.h" -#include "private-dynamic.h" #include "private-dynamics.h" #include "private-map_multis.h" #include "private-map_multiss.h" diff --git a/level_0/f_string/c/string/private-dynamic.c b/level_0/f_string/c/string/private-dynamic.c deleted file mode 100644 index b947a17bd..000000000 --- a/level_0/f_string/c/string/private-dynamic.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "../string.h" -#include "../private-string.h" -#include "private-dynamic.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_string/c/string/private-dynamic.h b/level_0/f_string/c/string/private-dynamic.h deleted file mode 100644 index c0b536a04..000000000 --- a/level_0/f_string/c/string/private-dynamic.h +++ /dev/null @@ -1,22 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: String - * 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_string_dynamic_h -#define _PRIVATE_F_string_dynamic_h - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_F_string_dynamic_h diff --git a/level_0/f_string/c/string/private-dynamics.c b/level_0/f_string/c/string/private-dynamics.c index 690e82454..bfed5a9cd 100644 --- a/level_0/f_string/c/string/private-dynamics.c +++ b/level_0/f_string/c/string/private-dynamics.c @@ -1,6 +1,5 @@ #include "../string.h" #include "../private-string.h" -#include "private-dynamic.h" #include "private-dynamics.h" #ifdef __cplusplus diff --git a/level_0/f_string/c/string/private-dynamicss.c b/level_0/f_string/c/string/private-dynamicss.c index 372539c1e..8f45b002f 100644 --- a/level_0/f_string/c/string/private-dynamicss.c +++ b/level_0/f_string/c/string/private-dynamicss.c @@ -1,6 +1,5 @@ #include "../string.h" #include "../private-string.h" -#include "private-dynamic.h" #include "private-dynamics.h" #include "private-dynamicss.h" diff --git a/level_0/f_string/c/string/private-map_multis.c b/level_0/f_string/c/string/private-map_multis.c index f607bbd7b..6eb31333e 100644 --- a/level_0/f_string/c/string/private-map_multis.c +++ b/level_0/f_string/c/string/private-map_multis.c @@ -1,6 +1,5 @@ #include "../string.h" #include "../private-string.h" -#include "private-dynamic.h" #include "private-dynamics.h" #include "private-map_multis.h" diff --git a/level_0/f_string/c/string/private-map_multiss.c b/level_0/f_string/c/string/private-map_multiss.c index b1fd1af3e..a84e881e5 100644 --- a/level_0/f_string/c/string/private-map_multiss.c +++ b/level_0/f_string/c/string/private-map_multiss.c @@ -1,6 +1,5 @@ #include "../string.h" #include "../private-string.h" -#include "private-dynamic.h" #include "private-dynamics.h" #include "private-map_multis.h" #include "private-map_multiss.h" diff --git a/level_0/f_string/c/string/private-maps.c b/level_0/f_string/c/string/private-maps.c index f52e9d8fe..e1e1c8dae 100644 --- a/level_0/f_string/c/string/private-maps.c +++ b/level_0/f_string/c/string/private-maps.c @@ -1,6 +1,5 @@ #include "../string.h" #include "../private-string.h" -#include "private-dynamic.h" #include "private-maps.h" #ifdef __cplusplus diff --git a/level_0/f_string/c/string/private-mapss.c b/level_0/f_string/c/string/private-mapss.c index fb5a3c2cb..707461b63 100644 --- a/level_0/f_string/c/string/private-mapss.c +++ b/level_0/f_string/c/string/private-mapss.c @@ -1,6 +1,5 @@ #include "../string.h" #include "../private-string.h" -#include "private-dynamic.h" #include "private-maps.h" #include "private-mapss.h" diff --git a/level_0/f_string/c/string/private-triples.c b/level_0/f_string/c/string/private-triples.c index 8c764bcff..3bc2ef45d 100644 --- a/level_0/f_string/c/string/private-triples.c +++ b/level_0/f_string/c/string/private-triples.c @@ -1,6 +1,5 @@ #include "../string.h" #include "../private-string.h" -#include "private-dynamic.h" #include "private-triples.h" #ifdef __cplusplus diff --git a/level_0/f_string/c/string/private-tripless.c b/level_0/f_string/c/string/private-tripless.c index efbc39fef..e92a1ab92 100644 --- a/level_0/f_string/c/string/private-tripless.c +++ b/level_0/f_string/c/string/private-tripless.c @@ -1,6 +1,5 @@ #include "../string.h" #include "../private-string.h" -#include "private-dynamic.h" #include "private-triples.h" #include "private-tripless.h" diff --git a/level_0/f_string/data/build/settings b/level_0/f_string/data/build/settings index cacfd29c8..ec958fefe 100644 --- a/level_0/f_string/data/build/settings +++ b/level_0/f_string/data/build/settings @@ -34,7 +34,7 @@ build_libraries-individual -lf_memory build_sources_library string.c build_sources_library private-string.c string/common.c -build_sources_library string/private-dynamic.c string/private-dynamics.c string/private-dynamicss.c +build_sources_library string/private-dynamics.c string/private-dynamicss.c build_sources_library string/private-maps.c string/private-mapss.c build_sources_library string/private-map_multis.c string/private-map_multiss.c build_sources_library string/private-quantitys.c string/private-quantityss.c diff --git a/level_0/f_type_array/c/type_array/cell.c b/level_0/f_type_array/c/type_array/cell.c index 2de21111d..e9f6edc33 100644 --- a/level_0/f_type_array/c/type_array/cell.c +++ b/level_0/f_type_array/c/type_array/cell.c @@ -1,227 +1,45 @@ #include "../type_array.h" #include "cell.h" -#include "private-cell.h" #ifdef __cplusplus extern "C" { #endif -#ifndef _di_f_cells_adjust_ - f_status_t f_cells_adjust(const f_number_unsigned_t length, f_cells_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ +#ifndef _di_f_cells_adjust_callback_ + f_status_t f_cells_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const void_array) { - return f_memory_array_adjust(length, sizeof(f_cell_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_cells_adjust_ - -#ifndef _di_f_cells_append_ - f_status_t f_cells_append(const f_cell_t source, f_cells_t * const 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_cells_append(source, destination); - } -#endif // _di_f_cells_append_ - -#ifndef _di_f_cells_append_all_ - f_status_t f_cells_append_all(const f_cells_t source, f_cells_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_cells_append_all(source, destination); - } -#endif // _di_f_cells_append_all_ - -#ifndef _di_f_cells_decimate_by_ - f_status_t f_cells_decimate_by(const f_number_unsigned_t amount, f_cells_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_decimate_by(amount, sizeof(f_cell_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_cells_decimate_by_ - -#ifndef _di_f_cells_decrease_by_ - f_status_t f_cells_decrease_by(const f_number_unsigned_t amount, f_cells_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_decrease_by(amount, sizeof(f_cell_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_cells_decrease_by_ - -#ifndef _di_f_cells_increase_ - f_status_t f_cells_increase(const f_number_unsigned_t step, f_cells_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_increase(step, sizeof(f_cell_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_cells_increase_ - -#ifndef _di_f_cells_increase_by_ - f_status_t f_cells_increase_by(const f_number_unsigned_t amount, f_cells_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_increase_by(amount, sizeof(f_cell_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_cells_increase_by_ - -#ifndef _di_f_cells_resize_ - f_status_t f_cells_resize(const f_number_unsigned_t length, f_cells_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_resize(length, sizeof(f_cell_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_cells_resize_ - -#ifndef _di_f_cellss_adjust_ - f_status_t f_cellss_adjust(const f_number_unsigned_t length, f_cellss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_cellss_adjust(length, structure); - } -#endif // _di_f_cellss_adjust_ - -#ifndef _di_f_cellss_append_ - f_status_t f_cellss_append(const f_cells_t source, f_cellss_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_cells_t), (void **) &destination->array, &destination->used, &destination->size); - if (F_status_is_error(status)) return status; - - status = private_f_cells_append_all(source, &destination->array[destination->used]); - if (F_status_is_error(status)) return status; - - ++destination->used; + { + f_cells_t * const array = (f_cells_t *) void_array; + f_status_t status = F_none; - return F_none; - } -#endif // _di_f_cellss_append_ - -#ifndef _di_f_cellss_append_all_ - f_status_t f_cellss_append_all(const f_cellss_t source, f_cellss_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; + for (f_number_unsigned_t i = start; i < size; ++i) { - f_status_t status = f_memory_array_increase_by(source.used, sizeof(f_cells_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_cells_append_all(source.array[i], &destination->array[destination->used]); + status = f_memory_array_adjust(0, sizeof(f_cell_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; - } - } // for - - return F_none; - } -#endif // _di_f_cellss_append_all_ - -#ifndef _di_f_cellss_decimate_by_ - f_status_t f_cellss_decimate_by(const f_number_unsigned_t amount, f_cellss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!amount) return F_data_not; - - return private_f_cellss_adjust((structure->size - amount > 0) ? structure->size - amount : 0, structure); - } -#endif // _di_f_cellss_decimate_by_ - -#ifndef _di_f_cellss_decrease_by_ - f_status_t f_cellss_decrease_by(const f_number_unsigned_t amount, f_cellss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!amount) return F_data_not; - - return private_f_cellss_resize((structure->size - amount > 0) ? structure->size - amount : 0, structure); - } -#endif // _di_f_cellss_decrease_by_ - -#ifndef _di_f_cellss_increase_ - f_status_t f_cellss_increase(const f_number_unsigned_t step, f_cellss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (step && structure->used + 1 > structure->size) { - if (structure->used >= F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); - - f_number_unsigned_t length = structure->used + step; - - if (length > F_number_t_size_unsigned_d) { - if (structure->used + 1 > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); - - length = F_number_t_size_unsigned_d; - } - - return private_f_cellss_resize(length, structure); + } // for } - return F_data_not; + return F_none; } -#endif // _di_f_cellss_increase_ - -#ifndef _di_f_cellss_increase_by_ - f_status_t f_cellss_increase_by(const f_number_unsigned_t amount, f_cellss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ +#endif // _di_f_cells_adjust_callback_ - if (amount) { - if (structure->used >= F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); +#ifndef _di_f_cells_resize_callback_ + f_status_t f_cells_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const void_array) { - const f_number_unsigned_t length = structure->used + amount; + { + f_cells_t * const array = (f_cells_t *) void_array; + f_status_t status = F_none; - if (length > structure->size) { - if (length > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); + for (f_number_unsigned_t i = start; i < size; ++i) { - return private_f_cellss_resize(structure->used + amount, structure); - } + status = f_memory_array_resize(0, sizeof(f_cell_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } // for } - return F_data_not; - } -#endif // _di_f_cellss_increase_by_ - -#ifndef _di_f_cellss_resize_ - f_status_t f_cellss_resize(const f_number_unsigned_t length, f_cellss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_cellss_resize(length, structure); + return F_none; } -#endif // _di_f_cellss_resize_ +#endif // _di_f_cells_resize_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/cell.h b/level_0/f_type_array/c/type_array/cell.h index 5dcf80ca5..78ec6582a 100644 --- a/level_0/f_type_array/c/type_array/cell.h +++ b/level_0/f_type_array/c/type_array/cell.h @@ -17,275 +17,17 @@ extern "C" { #endif /** - * Resize the string cells array. + * A callback intended to be passed to f_memory_arrays_adjust() for an f_cellss_t structure. * - * @param length - * The new size to use. - * @param structure - * The string cells array to resize. + * This does not do parameter checking. * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_adjust(). - * - * @see f_memory_array_adjust() - */ -#ifndef _di_f_cells_adjust_ - extern f_status_t f_cells_adjust(const f_number_unsigned_t length, f_cells_t * const structure); -#endif // _di_f_cells_adjust_ - -/** - * Append the single source cell onto the destination. - * - * @param source - * The source cell to append. - * @param destination - * The destination cells the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase(). - * - * @see f_memory_array_increase() - */ -#ifndef _di_f_cells_append_ - extern f_status_t f_cells_append(const f_cell_t source, f_cells_t * const destination); -#endif // _di_f_cells_append_ - -/** - * Append the source cells onto the destination. - * - * @param source - * The source cells to append. - * @param destination - * The destination cells the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_cells_append_all_ - extern f_status_t f_cells_append_all(const f_cells_t source, f_cells_t * const destination); -#endif // _di_f_cells_append_all_ - -/** - * Resize the string cells 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 structure - * The string cells array to resize. - * - * @return - * F_none on success. - * F_data_not if amount is 0. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_decimate_by(). - * - * @see f_memory_array_decimate_by() - */ -#ifndef _di_f_cells_decimate_by_ - extern f_status_t f_cells_decimate_by(const f_number_unsigned_t amount, f_cells_t * const structure); -#endif // _di_f_cells_decimate_by_ - -/** - * Resize the string cells 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 structure - * The string cells array to resize. - * - * @return - * F_none on success. - * F_data_not if amount is 0. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_decrease_by(). - * - * @see f_memory_array_decrease_by() - */ -#ifndef _di_f_cells_decrease_by_ - extern f_status_t f_cells_decrease_by(const f_number_unsigned_t amount, f_cells_t * const structure); -#endif // _di_f_cells_decrease_by_ - -/** - * Increase the size of the string cells 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 structure - * The string cells array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_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_cells_increase_ - extern f_status_t f_cells_increase(const f_number_unsigned_t step, f_cells_t * const structure); -#endif // _di_f_cells_increase_ - -/** - * Resize the string cells 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 structure - * The string cells array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * 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_cells_increase_by_ - extern f_status_t f_cells_increase_by(const f_number_unsigned_t amount, f_cells_t * const structure); -#endif // _di_f_cells_increase_by_ - -/** - * Resize the string cells array. - * - * @param length - * The new size to use. - * @param structure - * The string cells array to adjust. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - */ -#ifndef _di_f_cells_resize_ - extern f_status_t f_cells_resize(const f_number_unsigned_t length, f_cells_t * const structure); -#endif // _di_f_cells_resize_ - -/** - * Resize the string cellss array. - * - * @param length - * The new size to use. - * @param structure - * The string cellss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_adjust(). - * - * @see f_memory_array_adjust() - */ -#ifndef _di_f_cellss_adjust_ - extern f_status_t f_cellss_adjust(const f_number_unsigned_t length, f_cellss_t * const structure); -#endif // _di_f_cellss_adjust_ - -/** - * Append the single source cells onto the destination. - * - * @param source - * The source cells to append. - * @param destination - * The destination ranges the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase(). - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase() - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_cellss_append_ - extern f_status_t f_cellss_append(const f_cells_t source, f_cellss_t * const destination); -#endif // _di_f_cellss_append_ - -/** - * Append the source cellss onto the destination. - * - * @param source - * The source cellss to append. - * @param destination - * The destination ranges the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_cellss_append_all_ - extern f_status_t f_cellss_append_all(const f_cellss_t source, f_cellss_t * const destination); -#endif // _di_f_cellss_append_all_ - -/** - * Resize the string cellss 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 structure - * The string cellss array to resize. + * @param start + * The start position in the array to start deleting. + * @param stop + * The stop in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return * F_none on success. @@ -295,97 +37,24 @@ extern "C" { * Errors (with error bit) from: f_memory_array_adjust(). * * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() */ -#ifndef _di_f_cellss_decimate_by_ - extern f_status_t f_cellss_decimate_by(const f_number_unsigned_t amount, f_cellss_t * const structure); -#endif // _di_f_cellss_decimate_by_ - -/** - * Resize the string cellss 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 structure - * The string cellss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - */ -#ifndef _di_f_cellss_decrease_by_ - extern f_status_t f_cellss_decrease_by(const f_number_unsigned_t amount, f_cellss_t * const structure); -#endif // _di_f_cellss_decrease_by_ +#ifndef _di_f_cells_adjust_callback_ + extern f_status_t f_cells_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array); +#endif // _di_f_cells_adjust_callback_ /** - * Increase the size of the string cellss 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. + * A callback intended to be passed to f_memory_arrays_resize() for an f_cellss_t structure. * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param structure - * The string cellss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_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_cellss_increase_ - extern f_status_t f_cellss_increase(const f_number_unsigned_t step, f_cellss_t * const structure); -#endif // _di_f_cellss_increase_ - -/** - * Resize the string cellss 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 structure - * The string cellss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * 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_cellss_increase_by_ - extern f_status_t f_cellss_increase_by(const f_number_unsigned_t amount, f_cellss_t * const structure); -#endif // _di_f_cellss_increase_by_ - -/** - * Resize the string cellss array. + * This does not do parameter checking. * - * @param length - * The new size to use. - * @param structure - * The string cellss array to adjust. + * @param start + * The start position in the array to start deleting. + * @param stop + * The stop in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return * F_none on success. @@ -395,10 +64,11 @@ extern "C" { * Errors (with error bit) from: f_memory_array_resize(). * * @see f_memory_array_resize() + * @see f_memory_arrays_resize() */ -#ifndef _di_f_cellss_resize_ - extern f_status_t f_cellss_resize(const f_number_unsigned_t length, f_cellss_t * const structure); -#endif // _di_f_cellss_resize_ +#ifndef _di_f_cells_resize_callback_ + extern f_status_t f_cells_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array); +#endif // _di_f_cells_resize_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/common.h b/level_0/f_type_array/c/type_array/common.h index 1a9bd2858..386ccccc9 100644 --- a/level_0/f_type_array/c/type_array/common.h +++ b/level_0/f_type_array/c/type_array/common.h @@ -16,528 +16,6 @@ extern "C" { #endif -/** - * Macros for f_statuss_t, see type.h for typedefs. - */ -#ifndef _di_f_statuss_t_ - #define macro_f_statuss_t_clear(statuss) macro_f_memory_structures_clear(statuss) - - #define macro_f_statuss_t_resize(status, statuss, length) status = f_statuss_resize(length, &statuss); - #define macro_f_statuss_t_adjust(status, statuss, length) status = f_statuss_adjust(length, &statuss); - - #define macro_f_statuss_t_delete_simple(statuss) f_statuss_resize(0, &statuss); - #define macro_f_statuss_t_destroy_simple(statuss) f_statuss_adjust(0, &statuss); - - #define macro_f_statuss_t_increase(status, step, statuss) status = f_statuss_increase(step, &statuss); - #define macro_f_statuss_t_increase_by(status, statuss, amount) status = f_statuss_increase_by(amount, &statuss); - #define macro_f_statuss_t_decrease_by(status, statuss, amount) status = f_statuss_decrease_by(amount, &statuss); - #define macro_f_statuss_t_decimate_by(status, statuss, amount) status = f_statuss_decimate_by(amount, &statuss); -#endif // _di_f_statuss_t_ - -/** - * Macros for f_statusss_t, see type.h for typedefs. - */ -#ifndef _di_f_statusss_t_ - #define macro_f_statusss_t_clear(statusss) macro_f_memory_structures_clear(statusss) - - #define macro_f_statusss_t_resize(status, statusss, length) status = f_statusss_resize(length, &statusss); - #define macro_f_statusss_t_adjust(status, statusss, length) status = f_statusss_adjust(length, &statusss); - - #define macro_f_statusss_t_delete_simple(statusss) f_statusss_resize(0, &statusss); - #define macro_f_statusss_t_destroy_simple(statusss) f_statusss_adjust(0, &statusss); - - #define macro_f_statusss_t_increase(status, step, statusss) status = f_statusss_increase(step, &statusss); - #define macro_f_statusss_t_increase_by(status, statusss, amount) status = f_statusss_increase_by(amount, &statusss); - #define macro_f_statusss_t_decrease_by(status, statusss, amount) status = f_statusss_decrease_by(amount, &statusss); - #define macro_f_statusss_t_decimate_by(status, statusss, amount) status = f_statusss_decimate_by(amount, &statusss); -#endif // _di_f_statusss_t_ - -/** - * Macros for f_states_t, see type.h for typedefs. - */ -#ifndef _di_f_states_t_ - #define macro_f_states_t_clear(states) macro_f_memory_structures_clear(states) - - #define macro_f_states_t_resize(status, states, length) status = f_states_resize(length, &states); - #define macro_f_states_t_adjust(status, states, length) status = f_states_adjust(length, &states); - - #define macro_f_states_t_delete_simple(states) f_states_resize(0, &states); - #define macro_f_states_t_destroy_simple(states) f_states_adjust(0, &states); - - #define macro_f_states_t_increase(status, step, states) status = f_states_increase(step, &states); - #define macro_f_states_t_increase_by(status, states, amount) status = f_states_increase_by(amount, &states); - #define macro_f_states_t_decrease_by(status, states, amount) status = f_states_decrease_by(amount, &states); - #define macro_f_states_t_decimate_by(status, states, amount) status = f_states_decimate_by(amount, &states); -#endif // _di_f_states_t_ - -/** - * Macros for f_statess_t, see type.h for typedefs. - */ -#ifndef _di_f_statess_t_ - #define macro_f_statess_t_clear(statess) macro_f_memory_structures_clear(statess) - - #define macro_f_statess_t_resize(status, statess, length) status = f_statess_resize(length, &statess); - #define macro_f_statess_t_adjust(status, statess, length) status = f_statess_adjust(length, &statess); - - #define macro_f_statess_t_delete_simple(statess) f_statess_resize(0, &statess); - #define macro_f_statess_t_destroy_simple(statess) f_statess_adjust(0, &statess); - - #define macro_f_statess_t_increase(status, step, statess) status = f_statess_increase(step, &statess); - #define macro_f_statess_t_increase_by(status, statess, amount) status = f_statess_increase_by(amount, &statess); - #define macro_f_statess_t_decrease_by(status, statess, amount) status = f_statess_decrease_by(amount, &statess); - #define macro_f_statess_t_decimate_by(status, statess, amount) status = f_statess_decimate_by(amount, &statess); -#endif // _di_f_statess_t_ - -/** - * Macros for f_cells_t, see type.h for typedefs. - */ -#ifndef _di_f_cells_t_ - #define macro_f_cells_t_clear(cells) macro_f_memory_structures_clear(cells) - - #define macro_f_cells_t_resize(status, cells, length) status = f_cells_resize(length, &cells); - #define macro_f_cells_t_adjust(status, cells, length) status = f_cells_adjust(length, &cells); - - #define macro_f_cells_t_delete_simple(cells) f_cells_resize(0, &cells); - #define macro_f_cells_t_destroy_simple(cells) f_cells_adjust(0, &cells); - - #define macro_f_cells_t_increase(status, step, cells) status = f_cells_increase(step, &cells); - #define macro_f_cells_t_increase_by(status, cells, amount) status = f_cells_increase_by(amount, &cells); - #define macro_f_cells_t_decrease_by(status, cells, amount) status = f_cells_decrease_by(amount, &cells); - #define macro_f_cells_t_decimate_by(status, cells, amount) status = f_cells_decimate_by(amount, &cells); -#endif // _di_f_cells_t_ - -/** - * Macros for f_cellss_t, see type.h for typedefs. - */ -#ifndef _di_f_cellss_t_ - #define macro_f_cellss_t_clear(cellss) macro_f_memory_structures_clear(cellss) - - #define macro_f_cellss_t_resize(status, cellss, length) status = f_cellss_resize(length, &cellss); - #define macro_f_cellss_t_adjust(status, cellss, length) status = f_cellss_adjust(length, &cellss); - - #define macro_f_cellss_t_delete_simple(cellss) f_cellss_resize(0, &cellss); - #define macro_f_cellss_t_destroy_simple(cellss) f_cellss_adjust(0, &cellss); - - #define macro_f_cellss_t_increase(status, step, cellss) status = f_cellss_increase(step, &cellss); - #define macro_f_cellss_t_increase_by(status, cellss, amount) status = f_cellss_increase_by(amount, &cellss); - #define macro_f_cellss_t_decrease_by(status, cellss, amount) status = f_cellss_decrease_by(amount, &cellss); - #define macro_f_cellss_t_decimate_by(status, cellss, amount) status = f_cellss_decimate_by(amount, &cellss); -#endif // _di_f_cellss_t_ - -/** - * Macros for f_fll_ids_t, see type.h for typedefs. - */ -#ifndef _di_f_fll_ids_t_ - #define macro_f_fll_ids_t_clear(fll_ids) macro_f_memory_structures_clear(fll_ids) - - #define macro_f_fll_ids_t_resize(status, fll_ids, length) status = f_fll_ids_resize(length, &fll_ids); - #define macro_f_fll_ids_t_adjust(status, fll_ids, length) status = f_fll_ids_adjust(length, &fll_ids); - - #define macro_f_fll_ids_t_delete_simple(fll_ids) f_fll_ids_resize(0, &fll_ids); - #define macro_f_fll_ids_t_destroy_simple(fll_ids) f_fll_ids_adjust(0, &fll_ids); - - #define macro_f_fll_ids_t_increase(status, step, fll_ids) status = f_fll_ids_increase(step, &fll_ids); - #define macro_f_fll_ids_t_increase_by(status, fll_ids, amount) status = f_fll_ids_increase_by(amount, &fll_ids); - #define macro_f_fll_ids_t_decrease_by(status, fll_ids, amount) status = f_fll_ids_decrease_by(amount, &fll_ids); - #define macro_f_fll_ids_t_decimate_by(status, fll_ids, amount) status = f_fll_ids_decimate_by(amount, &fll_ids); -#endif // _di_f_fll_ids_t_ - -/** - * Macros for f_fll_idss_t, see type.h for typedefs. - */ -#ifndef _di_f_fll_idss_t_ - #define macro_f_fll_idss_t_clear(fll_idss) macro_f_memory_structures_clear(fll_idss) - - #define macro_f_fll_idss_t_resize(status, fll_idss, length) status = f_fll_idss_resize(length, &fll_idss); - #define macro_f_fll_idss_t_adjust(status, fll_idss, length) status = f_fll_idss_adjust(length, &fll_idss); - - #define macro_f_fll_idss_t_delete_simple(fll_idss) f_fll_idss_resize(0, &fll_idss); - #define macro_f_fll_idss_t_destroy_simple(fll_idss) f_fll_idss_adjust(0, &fll_idss); - - #define macro_f_fll_idss_t_increase(status, step, fll_idss) status = f_fll_idss_increase(step, &fll_idss); - #define macro_f_fll_idss_t_increase_by(status, fll_idss, amount) status = f_fll_idss_increase_by(amount, &fll_idss); - #define macro_f_fll_idss_t_decrease_by(status, fll_idss, amount) status = f_fll_idss_decrease_by(amount, &fll_idss); - #define macro_f_fll_idss_t_decimate_by(status, fll_idss, amount) status = f_fll_idss_decimate_by(amount, &fll_idss); -#endif // _di_f_fll_idss_t_ - -/** - * Macros for f_number_unsigneds_t, see type.h for typedefs. - */ -#ifndef _di_f_number_unsignedss_t_ - #define macro_f_number_unsignedss_t_clear(lengthss) macro_f_memory_structures_clear(lengthss) - - #define macro_f_number_unsignedss_t_resize(status, lengths, length) status = f_number_unsignedss_resize(length, &lengths); - #define macro_f_number_unsignedss_t_adjust(status, lengths, length) status = f_number_unsignedss_adjust(length, &lengths); - - #define macro_f_number_unsignedss_t_delete_simple(lengths) f_number_unsignedss_resize(0, &lengths); - #define macro_f_number_unsignedss_t_destroy_simple(lengths) f_number_unsignedss_adjust(0, &lengths); - - #define macro_f_number_unsignedss_t_increase(status, step, lengths) status = f_number_unsignedss_increase(step, &lengths); - #define macro_f_number_unsignedss_t_increase_by(status, lengths, amount) status = f_number_unsignedss_increase_by(amount, &lengths); - #define macro_f_number_unsignedss_t_decrease_by(status, lengths, amount) status = f_number_unsignedss_decrease_by(amount, &lengths); - #define macro_f_number_unsignedss_t_decimate_by(status, lengths, amount) status = f_number_unsignedss_decimate_by(amount, &lengths); -#endif // _di_f_number_unsignedss_t_ - -/** - * Macros for int8_t, see type.h for typedefs. - */ -#ifndef _di_f_int8_t_ - #define macro_f_int8s_t_clear(int8s) macro_f_memory_structures_clear(int8s) - - #define macro_f_int8s_t_resize(status, int8s, length) status = f_int8s_resize(length, &int8s); - #define macro_f_int8s_t_adjust(status, int8s, length) status = f_int8s_adjust(length, &int8s); - - #define macro_f_int8s_t_increase(status, step, int8s) status = f_int8s_increase(step, &int8s); - #define macro_f_int8s_t_increase_by(status, int8s, amount) status = f_int8s_increase_by(amount, &int8s); - #define macro_f_int8s_t_decrease_by(status, int8s, amount) status = f_int8s_decrease_by(amount, &int8s); - #define macro_f_int8s_t_decimate_by(status, int8s, amount) status = f_int8s_decimate_by(amount, &int8s); - - #define macro_f_int8s_t_delete_simple(int8s) f_int8s_resize(0, &int8s); - #define macro_f_int8s_t_destroy_simple(int8s) f_int8s_adjust(0, &int8s); -#endif // _di_f_int8_t_ - -/** - * Macros for f_int8s_t, see type.h for typedefs. - */ -#ifndef _di_f_int8ss_t_ - #define macro_f_int8ss_t_clear(int8ss) macro_f_memory_structures_clear(int8ss) - - #define macro_f_int8ss_t_resize(status, int8ss, length) status = f_int8ss_resize(length, &int8ss); - #define macro_f_int8ss_t_adjust(status, int8ss, length) status = f_int8ss_adjust(length, &int8ss); - - #define macro_f_int8ss_t_increase(status, step, int8ss) status = f_int8ss_increase(step, &int8ss); - #define macro_f_int8ss_t_increase_by(status, int8ss, amount) status = f_int8ss_increase_by(amount, &int8ss); - #define macro_f_int8ss_t_decrease_by(status, int8ss, amount) status = f_int8ss_decrease_by(amount, &int8ss); - #define macro_f_int8ss_t_decimate_by(status, int8ss, amount) status = f_int8ss_decimate_by(amount, &int8ss); - - #define macro_f_int8ss_t_delete_simple(int8ss) f_int8ss_resize(0, &int8ss); - #define macro_f_int8ss_t_destroy_simple(int8ss) f_int8ss_adjust(0, &int8ss); -#endif // _di_f_int8ss_t_ - -/** - * Macros for f_uint8s_t, see type.h for typedefs. - */ -#ifndef _di_f_uint8s_t_ - #define macro_f_uint8s_t_clear(uint8s) macro_f_memory_structures_clear(uint8s) - - #define macro_f_uint8s_t_resize(status, uint8s, length) status = f_uint8s_resize(length, &uint8s); - #define macro_f_uint8s_t_adjust(status, uint8s, length) status = f_uint8s_adjust(length, &uint8s); - - #define macro_f_uint8s_t_delete_simple(uint8s) f_uint8s_resize(0, &uint8s); - #define macro_f_uint8s_t_destroy_simple(uint8s) f_uint8s_adjust(0, &uint8s); - - #define macro_f_uint8s_t_increase(status, step, uint8s) status = f_uint8s_increase(step, &uint8s); - #define macro_f_uint8s_t_increase_by(status, uint8s, amount) status = f_uint8s_increase_by(amount, &uint8s); - #define macro_f_uint8s_t_decrease_by(status, uint8s, amount) status = f_uint8s_decrease_by(amount, &uint8s); - #define macro_f_uint8s_t_decimate_by(status, uint8s, amount) status = f_uint8s_decimate_by(amount, &uint8s); -#endif // _di_f_uint8s_t_ - -/** - * Macros for f_uint8ss_t, see type.h for typedefs. - */ -#ifndef _di_f_uint8ss_t_ - #define macro_f_uint8ss_t_clear(uint8ss) macro_f_memory_structures_clear(uint8ss) - - #define macro_f_uint8ss_t_resize(status, uint8ss, length) status = f_uint8ss_resize(length, &uint8ss); - #define macro_f_uint8ss_t_adjust(status, uint8ss, length) status = f_uint8ss_adjust(length, &uint8ss); - - #define macro_f_uint8ss_t_delete_simple(uint8ss) f_uint8ss_resize(0, &uint8ss); - #define macro_f_uint8ss_t_destroy_simple(uint8ss) f_uint8ss_adjust(0, &uint8ss); - - #define macro_f_uint8ss_t_increase(status, step, uint8ss) status = f_uint8ss_increase(step, &uint8ss); - #define macro_f_uint8ss_t_increase_by(status, uint8ss, amount) status = f_uint8ss_increase_by(amount, &uint8ss); - #define macro_f_uint8ss_t_decrease_by(status, uint8ss, amount) status = f_uint8ss_decrease_by(amount, &uint8ss); - #define macro_f_uint8ss_t_decimate_by(status, uint8ss, amount) status = f_uint8ss_decimate_by(amount, &uint8ss); -#endif // _di_f_uint8ss_t_ - -/** - * Macros for f_int16s_t, see type.h for typedefs. - */ -#ifndef _di_f_int16s_t_ - #define macro_f_int16s_t_clear(int16s) macro_f_memory_structures_clear(int16s) - - #define macro_f_int16s_t_resize(status, int16s, length) status = f_int16s_resize(length, &int16s); - #define macro_f_int16s_t_adjust(status, int16s, length) status = f_int16s_adjust(length, &int16s); - - #define macro_f_int16s_t_increase(status, step, int16s) status = f_int16s_increase(step, &int16s); - #define macro_f_int16s_t_increase_by(status, int16s, amount) status = f_int16s_increase_by(amount, &int16s); - #define macro_f_int16s_t_decrease_by(status, int16s, amount) status = f_int16s_decrease_by(amount, &int16s); - #define macro_f_int16s_t_decimate_by(status, int16s, amount) status = f_int16s_decimate_by(amount, &int16s); - - #define macro_f_int16s_t_delete_simple(int16s) f_int16s_resize(0, &int16s); - #define macro_f_int16s_t_destroy_simple(int16s) f_int16s_adjust(0, &int16s); -#endif // _di_f_int16s_t_ - -/** - * Macros for f_int16ss_t, see type.h for typedefs. - */ -#ifndef _di_f_int16ss_t_ - #define macro_f_int16ss_t_clear(int16ss) macro_f_memory_structures_clear(int16ss) - - #define macro_f_int16ss_t_resize(status, int16ss, length) status = f_int16ss_resize(length, &int16ss); - #define macro_f_int16ss_t_adjust(status, int16ss, length) status = f_int16ss_adjust(length, &int16ss); - - #define macro_f_int16ss_t_increase(status, step, int16ss) status = f_int16ss_increase(step, &int16ss); - #define macro_f_int16ss_t_increase_by(status, int16ss, amount) status = f_int16ss_increase_by(amount, &int16ss); - #define macro_f_int16ss_t_decrease_by(status, int16ss, amount) status = f_int16ss_decrease_by(amount, &int16ss); - #define macro_f_int16ss_t_decimate_by(status, int16ss, amount) status = f_int16ss_decimate_by(amount, &int16ss); - - #define macro_f_int16ss_t_delete_simple(int16ss) f_int16ss_resize(0, &int16ss); - #define macro_f_int16ss_t_destroy_simple(int16ss) f_int16ss_adjust(0, &int16ss); -#endif // _di_f_int16ss_t_ - -/** - * Macros for f_uint16s_t, see type.h for typedefs. - */ -#ifndef _di_f_uint16s_t_ - #define macro_f_uint16s_t_clear(uint16s) macro_f_memory_structures_clear(uint16s) - - #define macro_f_uint16s_t_resize(status, uint16s, length) status = f_uint16s_resize(length, &uint16s); - #define macro_f_uint16s_t_adjust(status, uint16s, length) status = f_uint16s_adjust(length, &uint16s); - - #define macro_f_uint16s_t_delete_simple(uint16s) f_uint16s_resize(0, &uint16s); - #define macro_f_uint16s_t_destroy_simple(uint16s) f_uint16s_adjust(0, &uint16s); - - #define macro_f_uint16s_t_increase(status, step, uint16s) status = f_uint16s_increase(step, &uint16s); - #define macro_f_uint16s_t_increase_by(status, uint16s, amount) status = f_uint16s_increase_by(amount, &uint16s); - #define macro_f_uint16s_t_decrease_by(status, uint16s, amount) status = f_uint16s_decrease_by(amount, &uint16s); - #define macro_f_uint16s_t_decimate_by(status, uint16s, amount) status = f_uint16s_decimate_by(amount, &uint16s); -#endif // _di_f_uint16s_t_ - -/** - * Macros for f_uint16ss_t, see type.h for typedefs. - */ -#ifndef _di_f_uint16ss_t_ - #define macro_f_uint16ss_t_clear(uint16ss) macro_f_memory_structures_clear(uint16ss) - - #define macro_f_uint16ss_t_resize(status, uint16ss, length) status = f_uint16ss_resize(length, &uint16ss); - #define macro_f_uint16ss_t_adjust(status, uint16ss, length) status = f_uint16ss_adjust(length, &uint16ss); - - #define macro_f_uint16ss_t_delete_simple(uint16ss) f_uint16ss_resize(0, &uint16ss); - #define macro_f_uint16ss_t_destroy_simple(uint16ss) f_uint16ss_adjust(0, &uint16ss); - - #define macro_f_uint16ss_t_increase(status, step, uint16ss) status = f_uint16ss_increase(step, &uint16ss); - #define macro_f_uint16ss_t_increase_by(status, uint16ss, amount) status = f_uint16ss_increase_by(amount, &uint16ss); - #define macro_f_uint16ss_t_decrease_by(status, uint16ss, amount) status = f_uint16ss_decrease_by(amount, &uint16ss); - #define macro_f_uint16ss_t_decimate_by(status, uint16ss, amount) status = f_uint16ss_decimate_by(amount, &uint16ss); -#endif // _di_f_uint16ss_t_ - -/** - * Macros for f_int32s_t, see type.h for typedefs. - */ -#ifndef _di_f_int32s_t_ - #define macro_f_int32s_t_clear(int32s) macro_f_memory_structures_clear(int32s) - - #define macro_f_int32s_t_resize(status, int32s, length) status = f_int32s_resize(length, &int32s); - #define macro_f_int32s_t_adjust(status, int32s, length) status = f_int32s_adjust(length, &int32s); - - #define macro_f_int32s_t_delete_simple(int32s) f_int32s_resize(0, &int32s); - #define macro_f_int32s_t_destroy_simple(int32s) f_int32s_adjust(0, &int32s); - - #define macro_f_int32s_t_increase(status, step, int32s) status = f_int32s_increase(step, &int32s); - #define macro_f_int32s_t_increase_by(status, int32s, amount) status = f_int32s_increase_by(amount, &int32s); - #define macro_f_int32s_t_decrease_by(status, int32s, amount) status = f_int32s_decrease_by(amount, &int32s); - #define macro_f_int32s_t_decimate_by(status, int32s, amount) status = f_int32s_decimate_by(amount, &int32s); -#endif // _di_f_int32s_t_ - -/** - * Macros for f_number_unsigneds_t, see type.h for typedefs. - */ -#ifndef _di_f_int32ss_t_ - #define macro_f_int32ss_t_clear(int32ss) macro_f_memory_structures_clear(int32ss) - - #define macro_f_int32ss_t_resize(status, int32ss, length) status = f_int32ss_resize(length, &int32ss); - #define macro_f_int32ss_t_adjust(status, int32ss, length) status = f_int32ss_adjust(length, &int32ss); - - #define macro_f_int32ss_t_delete_simple(int32ss) f_int32ss_resize(0, &int32ss); - #define macro_f_int32ss_t_destroy_simple(int32ss) f_int32ss_adjust(0, &int32ss); - - #define macro_f_int32ss_t_increase(status, step, int32ss) status = f_int32ss_increase(step, &int32ss); - #define macro_f_int32ss_t_increase_by(status, int32ss, amount) status = f_int32ss_increase_by(amount, &int32ss); - #define macro_f_int32ss_t_decrease_by(status, int32ss, amount) status = f_int32ss_decrease_by(amount, &int32ss); - #define macro_f_int32ss_t_decimate_by(status, int32ss, amount) status = f_int32ss_decimate_by(amount, &int32ss); -#endif // _di_f_int32ss_t_ - -/** - * Macros for f_uint32s_t, see type.h for typedefs. - */ -#ifndef _di_f_uint32s_t_ - #define macro_f_uint32s_t_clear(uint32s) macro_f_memory_structures_clear(uint32s) - - #define macro_f_uint32s_t_resize(status, uint32s, length) status = f_uint32s_resize(length, &uint32s); - #define macro_f_uint32s_t_adjust(status, uint32s, length) status = f_uint32s_adjust(length, &uint32s); - - #define macro_f_uint32s_t_delete_simple(uint32s) f_uint32s_resize(0, &uint32s); - #define macro_f_uint32s_t_destroy_simple(uint32s) f_uint32s_adjust(0, &uint32s); - - #define macro_f_uint32s_t_increase(status, step, uint32s) status = f_uint32s_increase(step, &uint32s); - #define macro_f_uint32s_t_increase_by(status, uint32s, amount) status = f_uint32s_increase_by(amount, &uint32s); - #define macro_f_uint32s_t_decrease_by(status, uint32s, amount) status = f_uint32s_decrease_by(amount, &uint32s); - #define macro_f_uint32s_t_decimate_by(status, uint32s, amount) status = f_uint32s_decimate_by(amount, &uint32s); -#endif // _di_f_uint32s_t_ - -/** - * Macros for f_uint32ss_t, see type.h for typedefs. - */ -#ifndef _di_f_uint32ss_t_ - #define macro_f_uint32ss_t_clear(uint32ss) macro_f_memory_structures_clear(uint32ss) - - #define macro_f_uint32ss_t_resize(status, uint32ss, length) status = f_uint32ss_resize(length, &uint32ss); - #define macro_f_uint32ss_t_adjust(status, uint32ss, length) status = f_uint32ss_adjust(length, &uint32ss); - - #define macro_f_uint32ss_t_delete_simple(uint32ss) f_uint32ss_resize(0, &uint32ss); - #define macro_f_uint32ss_t_destroy_simple(uint32ss) f_uint32ss_adjust(0, &uint32ss); - - #define macro_f_uint32ss_t_increase(status, step, uint32ss) status = f_uint32ss_increase(step, &uint32ss); - #define macro_f_uint32ss_t_increase_by(status, uint32ss, amount) status = f_uint32ss_increase_by(amount, &uint32ss); - #define macro_f_uint32ss_t_decrease_by(status, uint32ss, amount) status = f_uint32ss_decrease_by(amount, &uint32ss); - #define macro_f_uint32ss_t_decimate_by(status, uint32ss, amount) status = f_uint32ss_decimate_by(amount, &uint32ss); -#endif // _di_f_uint32ss_t_ - -/** - * Macros for f_int64s_t, see type.h for typedefs. - */ -#ifndef _di_f_int64s_t_ - #define macro_f_int64s_t_clear(int64s) macro_f_memory_structures_clear(int64s) - - #define macro_f_int64s_t_resize(status, int64s, length) status = f_int64s_resize(length, &int64s); - #define macro_f_int64s_t_adjust(status, int64s, length) status = f_int64s_adjust(length, &int64s); - - #define macro_f_int64s_t_increase(status, step, int64s) status = f_int64s_increase(step, &int64s); - #define macro_f_int64s_t_increase_by(status, int64s, amount) status = f_int64s_increase_by(amount, &int64s); - #define macro_f_int64s_t_decrease_by(status, int64s, amount) status = f_int64s_decrease_by(amount, &int64s); - #define macro_f_int64s_t_decimate_by(status, int64s, amount) status = f_int64s_decimate_by(amount, &int64s); - - #define macro_f_int64s_t_delete_simple(int64s) f_int64s_resize(0, &int64s); - #define macro_f_int64s_t_destroy_simple(int64s) f_int64s_adjust(0, &int64s); -#endif // _di_f_int64s_t_ - -/** - * Macros for f_int64ss_t, see type.h for typedefs. - */ -#ifndef _di_f_int64ss_t_ - #define macro_f_int64ss_t_clear(int64ss) macro_f_memory_structures_clear(int64ss) - - #define macro_f_int64ss_t_resize(status, int64ss, length) status = f_int64ss_resize(length, &int64ss); - #define macro_f_int64ss_t_adjust(status, int64ss, length) status = f_int64ss_adjust(length, &int64ss); - - #define macro_f_int64ss_t_increase(status, step, int64ss) status = f_int64ss_increase(step, &int64ss); - #define macro_f_int64ss_t_increase_by(status, int64ss, amount) status = f_int64ss_increase_by(amount, &int64ss); - #define macro_f_int64ss_t_decrease_by(status, int64ss, amount) status = f_int64ss_decrease_by(amount, &int64ss); - #define macro_f_int64ss_t_decimate_by(status, int64ss, amount) status = f_int64ss_decimate_by(amount, &int64ss); - - #define macro_f_int64ss_t_delete_simple(int64ss) f_int64ss_resize(0, &int64ss); - #define macro_f_int64ss_t_destroy_simple(int64ss) f_int64ss_adjust(0, &int64ss); -#endif // _di_f_int64ss_t_ - -/** - * Macros for f_uint64s_t, see type.h for typedefs. - */ -#ifndef _di_f_uint64s_t_ - #define macro_f_uint64s_t_clear(uint64s) macro_f_memory_structures_clear(uint64s) - - #define macro_f_uint64s_t_resize(status, uint64s, length) status = f_uint64s_resize(length, &uint64s); - #define macro_f_uint64s_t_adjust(status, uint64s, length) status = f_uint64s_adjust(length, &uint64s); - - #define macro_f_uint64s_t_increase(status, step, uint64s) status = f_uint64s_increase(step, &uint64s); - #define macro_f_uint64s_t_increase_by(status, uint64s, amount) status = f_uint64s_increase_by(amount, &uint64s); - #define macro_f_uint64s_t_decrease_by(status, uint64s, amount) status = f_uint64s_decrease_by(amount, &uint64s); - #define macro_f_uint64s_t_decimate_by(status, uint64s, amount) status = f_uint64s_decimate_by(amount, &uint64s); - - #define macro_f_uint64s_t_delete_simple(uint64s) f_uint64s_resize(0, &uint64s); - #define macro_f_uint64s_t_destroy_simple(uint64s) f_uint64s_adjust(0, &uint64s); -#endif // _di_f_uint64s_t_ - -/** - * Macros for f_uint64ss_t, see type.h for typedefs. - */ -#ifndef _di_f_uint64ss_t_ - #define macro_f_uint64ss_t_clear(uint64ss) macro_f_memory_structures_clear(uint64ss) - - #define macro_f_uint64ss_t_resize(status, uint64ss, length) status = f_uint64ss_resize(length, &uint64ss); - #define macro_f_uint64ss_t_adjust(status, uint64ss, length) status = f_uint64ss_adjust(length, &uint64ss); - - #define macro_f_uint64ss_t_increase(status, step, uint64ss) status = f_uint64ss_increase(step, &uint64ss); - #define macro_f_uint64ss_t_increase_by(status, uint64ss, amount) status = f_uint64ss_increase_by(amount, &uint64ss); - #define macro_f_uint64ss_t_decrease_by(status, uint64ss, amount) status = f_uint64ss_decrease_by(amount, &uint64ss); - #define macro_f_uint64ss_t_decimate_by(status, uint64ss, amount) status = f_uint64ss_decimate_by(amount, &uint64ss); - - #define macro_f_uint64ss_t_delete_simple(uint64ss) f_uint64ss_resize(0, &uint64ss); - #define macro_f_uint64ss_t_destroy_simple(uint64ss) f_uint64ss_adjust(0, &uint64ss); -#endif // _di_f_uint64ss_t_ - -/** - * Macros for f_int128s_t, see type.h for typedefs. - */ -#ifndef _di_f_int128s_t_ - #define macro_f_int128s_t_clear(int128s) macro_f_memory_structures_clear(int128s) - - #define macro_f_int128s_t_resize(status, int128s, length) status = f_int128s_resize(length, &int128s); - #define macro_f_int128s_t_adjust(status, int128s, length) status = f_int128s_adjust(length, &int128s); - - #define macro_f_int128s_t_delete_simple(int128s) f_int128s_resize(0, &int128s); - #define macro_f_int128s_t_destroy_simple(int128s) f_int128s_adjust(0, &int128s); - - #define macro_f_int128s_t_increase(status, step, int128s) status = f_int128s_increase(step, &int128s); - #define macro_f_int128s_t_increase_by(status, int128s, amount) status = f_int128s_increase_by(amount, &int128s); - #define macro_f_int128s_t_decrease_by(status, int128s, amount) status = f_int128s_decrease_by(amount, &int128s); - #define macro_f_int128s_t_decimate_by(status, int128s, amount) status = f_int128s_decimate_by(amount, &int128s); -#endif // _di_f_int128s_t_ - -/** - * Macros for f_int128ss_t, see type.h for typedefs. - */ -#ifndef _di_f_int128ss_t_ - #define macro_f_int128ss_t_clear(int128ss) macro_f_memory_structures_clear(int128ss) - - #define macro_f_int128ss_t_resize(status, int128ss, length) status = f_int128ss_resize(length, &int128ss); - #define macro_f_int128ss_t_adjust(status, int128ss, length) status = f_int128ss_adjust(length, &int128ss); - - #define macro_f_int128ss_t_delete_simple(int128ss) f_int128ss_resize(0, &int128ss); - #define macro_f_int128ss_t_destroy_simple(int128ss) f_int128ss_adjust(0, &int128ss); - - #define macro_f_int128ss_t_increase(status, step, int128ss) status = f_int128ss_increase(step, &int128ss); - #define macro_f_int128ss_t_increase_by(status, int128ss, amount) status = f_int128ss_increase_by(amount, &int128ss); - #define macro_f_int128ss_t_decrease_by(status, int128ss, amount) status = f_int128ss_decrease_by(amount, &int128ss); - #define macro_f_int128ss_t_decimate_by(status, int128ss, amount) status = f_int128ss_decimate_by(amount, &int128ss); -#endif // _di_f_int128ss_t_ - -/** - * Macros for f_uint128s_t, see type.h for typedefs. - */ -#ifndef _di_f_uint128s_t_ - #define macro_f_uint128s_t_clear(uint128s) macro_f_memory_structures_clear(uint128s) - - #define macro_f_uint128s_t_resize(status, uint128s, length) status = f_uint128s_resize(length, &uint128s); - #define macro_f_uint128s_t_adjust(status, uint128s, length) status = f_uint128s_adjust(length, &uint128s); - - #define macro_f_uint128s_t_delete_simple(uint128s) f_uint128s_resize(0, &uint128s); - #define macro_f_uint128s_t_destroy_simple(uint128s) f_uint128s_adjust(0, &uint128s); - - #define macro_f_uint128s_t_increase(status, step, uint128s) status = f_uint128s_increase(step, &uint128s); - #define macro_f_uint128s_t_increase_by(status, uint128s, amount) status = f_uint128s_increase_by(amount, &uint128s); - #define macro_f_uint128s_t_decrease_by(status, uint128s, amount) status = f_uint128s_decrease_by(amount, &uint128s); - #define macro_f_uint128s_t_decimate_by(status, uint128s, amount) status = f_uint128s_decimate_by(amount, &uint128s); -#endif // _di_f_uint128s_t_ - -/** - * Macros for f_uint128ss_t, see type.h for typedefs. - */ -#ifndef _di_f_uint128ss_t_ - #define macro_f_uint128ss_t_clear(uint128ss) macro_f_memory_structures_clear(uint128ss) - - #define macro_f_uint128ss_t_resize(status, uint128ss, length) status = f_uint128ss_resize(length, &uint128ss); - #define macro_f_uint128ss_t_adjust(status, uint128ss, length) status = f_uint128ss_adjust(length, &uint128ss); - - #define macro_f_uint128ss_t_delete_simple(uint128ss) f_uint128ss_resize(0, &uint128ss); - #define macro_f_uint128ss_t_destroy_simple(uint128ss) f_uint128ss_adjust(0, &uint128ss); - - #define macro_f_uint128ss_t_increase(status, step, uint128ss) status = f_uint128ss_increase(step, &uint128ss); - #define macro_f_uint128ss_t_increase_by(status, uint128ss, amount) status = f_uint128ss_increase_by(amount, &uint128ss); - #define macro_f_uint128ss_t_decrease_by(status, uint128ss, amount) status = f_uint128ss_decrease_by(amount, &uint128ss); - #define macro_f_uint128ss_t_decimate_by(status, uint128ss, amount) status = f_uint128ss_decimate_by(amount, &uint128ss); -#endif // _di_f_uint128ss_t_ - #ifdef __cplusplus } // extern "C" #endif 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 b4f928ffa..cfa1ae86c 100644 --- a/level_0/f_type_array/c/type_array/file.c +++ b/level_0/f_type_array/c/type_array/file.c @@ -1,226 +1,46 @@ #include "../type_array.h" #include "../type_array_file.h" #include "file.h" -#include "private-file.h" #ifdef __cplusplus extern "C" { #endif -#ifndef _di_f_files_adjust_ - f_status_t f_files_adjust(const f_number_unsigned_t length, f_files_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_adjust(length, sizeof(f_file_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_files_adjust_ - -#ifndef _di_f_files_append_ - f_status_t f_files_append(const f_file_t source, f_files_t * const 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_files_append(source, destination); - } -#endif // _di_f_files_append_ - -#ifndef _di_f_files_append_all_ - f_status_t f_files_append_all(const f_files_t source, f_files_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_files_append_all(source, destination); - } -#endif // _di_f_files_append_all_ - -#ifndef _di_f_files_decimate_by_ - f_status_t f_files_decimate_by(const f_number_unsigned_t amount, f_files_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_decimate_by(amount, sizeof(f_file_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_files_decimate_by_ - -#ifndef _di_f_files_decrease_by_ - f_status_t f_files_decrease_by(const f_number_unsigned_t amount, f_files_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_decrease_by(amount, sizeof(f_file_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_files_decrease_by_ - -#ifndef _di_f_files_increase_ - f_status_t f_files_increase(const f_number_unsigned_t step, f_files_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_increase(step, sizeof(f_file_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_files_increase_ - -#ifndef _di_f_files_increase_by_ - f_status_t f_files_increase_by(const f_number_unsigned_t amount, f_files_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_increase_by(amount, sizeof(f_file_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_files_increase_by_ - -#ifndef _di_f_files_resize_ - f_status_t f_files_resize(const f_number_unsigned_t length, f_files_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_resize(length, sizeof(f_file_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_files_resize_ - -#ifndef _di_f_filess_adjust_ - f_status_t f_filess_adjust(const f_number_unsigned_t length, f_filess_t * const filess) { - #ifndef _di_level_0_parameter_checking_ - if (!filess) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_filess_adjust(length, filess); - } -#endif // _di_f_filess_adjust_ - -#ifndef _di_f_filess_append_ - f_status_t f_filess_append(const f_files_t source, f_filess_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_files_t), (void **) &destination->array, &destination->used, &destination->size); - if (F_status_is_error(status)) return status; - - status = private_f_files_append_all(source, &destination->array[destination->used]); - if (F_status_is_error(status)) return status; - - ++destination->used; - - return F_none; - } -#endif // _di_f_filess_append_ - -#ifndef _di_f_filess_append_all_ - f_status_t f_filess_append_all(const f_filess_t source, f_filess_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_none; +#ifndef _di_f_files_adjust_callback_ + f_status_t f_files_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const void_array) { { - status = f_memory_array_increase_by(source.used, sizeof(f_files_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) { + f_files_t * const array = (f_files_t *) void_array; + f_status_t status = F_none; - destination->array[destination->used].used = 0; + for (f_number_unsigned_t i = start; i < size; ++i) { - if (source.array[i].used) { - status = private_f_files_append_all(source.array[i], &destination->array[destination->used]); + status = f_memory_array_adjust(0, sizeof(f_file_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; - } - } // for - - return F_none; - } -#endif // _di_f_filess_append_all_ - -#ifndef _di_f_filess_decimate_by_ - f_status_t f_filess_decimate_by(const f_number_unsigned_t amount, f_filess_t * const filess) { - #ifndef _di_level_0_parameter_checking_ - if (!filess) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!amount) return F_data_not; - - return private_f_filess_adjust((filess->size - amount > 0) ? filess->size - amount : 0, filess); - } -#endif // _di_f_filess_decimate_by_ - -#ifndef _di_f_filess_decrease_by_ - f_status_t f_filess_decrease_by(const f_number_unsigned_t amount, f_filess_t * const filess) { - #ifndef _di_level_0_parameter_checking_ - if (!filess) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!amount) return F_data_not; - - return private_f_filess_resize((filess->size - amount > 0) ? filess->size - amount : 0, filess); - } -#endif // _di_f_filess_decrease_by_ - -#ifndef _di_f_filess_increase_ - f_status_t f_filess_increase(const f_number_unsigned_t step, f_filess_t * const filess) { - #ifndef _di_level_0_parameter_checking_ - if (!filess) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (step && filess->used + 1 > filess->size) { - f_number_unsigned_t length = filess->used + step; - - if (length > F_number_t_size_unsigned_d) { - if (filess->used + 1 > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); - - length = F_number_t_size_unsigned_d; - } - - return private_f_filess_resize(length, filess); + } // for } - return F_data_not; + return F_none; } -#endif // _di_f_filess_increase_ +#endif // _di_f_files_adjust_callback_ -#ifndef _di_f_filess_increase_by_ - f_status_t f_filess_increase_by(const f_number_unsigned_t amount, f_filess_t * const filess) { - #ifndef _di_level_0_parameter_checking_ - if (!filess) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ +#ifndef _di_f_files_resize_callback_ + f_status_t f_files_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const void_array) { - if (!amount) return F_data_not; + { + f_files_t * const array = (f_files_t *) void_array; + f_status_t status = F_none; - if (filess->used + amount > filess->size) { - if (filess->used + amount > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); + for (f_number_unsigned_t i = start; i < size; ++i) { - return private_f_filess_resize(filess->used + amount, filess); + status = f_memory_array_resize(0, sizeof(f_file_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } // for } - return F_data_not; - } -#endif // _di_f_filess_increase_by_ - -#ifndef _di_f_filess_resize_ - f_status_t f_filess_resize(const f_number_unsigned_t length, f_filess_t * const filess) { - #ifndef _di_level_0_parameter_checking_ - if (!filess) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_filess_resize(length, filess); + return F_none; } -#endif // _di_f_filess_resize_ +#endif // _di_f_files_resize_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/file.h b/level_0/f_type_array/c/type_array/file.h index e3060fce3..aa0a9b457 100644 --- a/level_0/f_type_array/c/type_array/file.h +++ b/level_0/f_type_array/c/type_array/file.h @@ -17,377 +17,44 @@ extern "C" { #endif /** - * Resize the files array. + * A callback intended to be passed to f_memory_arrays_adjust() for an f_filess_t structure. * - * @param length - * The new size to use. - * @param structure - * The files array to resize. + * This does not do parameter checking. * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_adjust(). - * - * @see f_memory_array_adjust() - */ -#ifndef _di_f_files_adjust_ - extern f_status_t f_files_adjust(const f_number_unsigned_t length, f_files_t * const structure); -#endif // _di_f_files_adjust_ - -/** - * Append the single source file onto the destination. - * - * @param source - * The source file to append. - * @param destination - * The destination files the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase(). - * - * @see f_memory_array_increase() - */ -#ifndef _di_f_files_append_ - extern f_status_t f_files_append(const f_file_t source, f_files_t * const destination); -#endif // _di_f_files_append_ - -/** - * Append the source files onto the destination. - * - * @param source - * The source files to append. - * @param destination - * The destination files the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_files_append_all_ - extern f_status_t f_files_append_all(const f_files_t source, f_files_t * const destination); -#endif // _di_f_files_append_all_ - -/** - * Resize the files 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 files - * The files array to resize. - * - * @return - * F_none on success. - * F_data_not if amount is 0. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_adjust(). - * - * @see f_memory_array_adjust() - */ -#ifndef _di_f_files_decimate_by_ - extern f_status_t f_files_decimate_by(const f_number_unsigned_t amount, f_files_t * const structure); -#endif // _di_f_files_decimate_by_ - -/** - * Resize the files 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 files - * The files array to resize. - * - * @return - * F_none on success. - * F_data_not if amount is 0. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - */ -#ifndef _di_f_files_decrease_by_ - extern f_status_t f_files_decrease_by(const f_number_unsigned_t amount, f_files_t * const files); -#endif // _di_f_files_decrease_by_ - -/** - * Increase the size of the files 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 files - * The files array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_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_files_increase_ - extern f_status_t f_files_increase(const f_number_unsigned_t step, f_files_t * const files); -#endif // _di_f_files_increase_ - -/** - * Resize the files 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 files - * The files array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * 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_files_increase_by_ - extern f_status_t f_files_increase_by(const f_number_unsigned_t amount, f_files_t * const files); -#endif // _di_f_files_increase_by_ - -/** - * Resize the files array. - * - * @param length - * The new size to use. - * @param files - * The files array to adjust. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - */ -#ifndef _di_f_files_resize_ - extern f_status_t f_files_resize(const f_number_unsigned_t length, f_files_t * const files); -#endif // _di_f_files_resize_ - -/** - * Resize the filess array. - * - * @param length - * The new size to use. - * @param filess - * The filess array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_adjust(). - * - * @see f_memory_array_adjust() - */ -#ifndef _di_f_filess_adjust_ - extern f_status_t f_filess_adjust(const f_number_unsigned_t length, f_filess_t * const filess); -#endif // _di_f_filess_adjust_ - -/** - * Append the single source files onto the destination. - * - * @param source - * The source files to append. - * @param destination - * The destination ranges the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase(). - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase() - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_filess_append_ - extern f_status_t f_filess_append(const f_files_t source, f_filess_t * const destination); -#endif // _di_f_filess_append_ - -/** - * Append the source filess onto the destination. - * - * @param source - * The source filess to append. - * @param destination - * The destination ranges the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_filess_append_all_ - extern f_status_t f_filess_append_all(const f_filess_t source, f_filess_t * const destination); -#endif // _di_f_filess_append_all_ - -/** - * Resize the filess 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 filess - * The filess array to resize. + * @param start + * The start position in the array to start deleting. + * @param stop + * The stop in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return * F_none on success. - * F_data_not if amount is 0. * * F_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_filess_decimate_by_ - extern f_status_t f_filess_decimate_by(const f_number_unsigned_t amount, f_filess_t * const filess); -#endif // _di_f_filess_decimate_by_ - -/** - * Resize the filess 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 filess - * The filess array to resize. - * - * @return - * F_none on success. - * F_data_not if amount is 0. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - */ -#ifndef _di_f_filess_decrease_by_ - extern f_status_t f_filess_decrease_by(const f_number_unsigned_t amount, f_filess_t * const filess); -#endif // _di_f_filess_decrease_by_ - -/** - * Increase the size of the filess 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 filess - * The filess array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_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_filess_increase_ - extern f_status_t f_filess_increase(const f_number_unsigned_t step, f_filess_t * const filess); -#endif // _di_f_filess_increase_ +#ifndef _di_f_files_adjust_callback_ + extern f_status_t f_files_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array); +#endif // _di_f_files_adjust_callback_ /** - * Resize the filess 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 filess - * The filess array to resize. + * A callback intended to be passed to f_memory_arrays_resize() for an f_filess_t structure. * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * 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_filess_increase_by_ - extern f_status_t f_filess_increase_by(const f_number_unsigned_t amount, f_filess_t * const filess); -#endif // _di_f_filess_increase_by_ - -/** - * Resize the filess array. + * This does not do parameter checking. * - * @param length - * The new size to use. - * @param filess - * The filess array to adjust. + * @param start + * The start position in the array to start deleting. + * @param stop + * The stop in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return * F_none on success. @@ -397,10 +64,11 @@ extern "C" { * Errors (with error bit) from: f_memory_array_resize(). * * @see f_memory_array_resize() + * @see f_memory_arrays_resize() */ -#ifndef _di_f_filess_resize_ - extern f_status_t f_filess_resize(const f_number_unsigned_t length, f_filess_t * const filess); -#endif // _di_f_filess_resize_ +#ifndef _di_f_files_resize_callback_ + extern f_status_t f_files_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array); +#endif // _di_f_files_resize_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/fll_id.c b/level_0/f_type_array/c/type_array/fll_id.c index b53d21981..1440c8020 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,227 +1,45 @@ #include "../type_array.h" #include "fll_id.h" -#include "private-fll_id.h" #ifdef __cplusplus extern "C" { #endif -#ifndef _di_f_fll_ids_adjust_ - f_status_t f_fll_ids_adjust(const f_number_unsigned_t length, f_fll_ids_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ +#ifndef _di_f_fll_ids_adjust_callback_ + f_status_t f_fll_ids_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const void_array) { - return f_memory_array_adjust(length, sizeof(f_fll_id_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_fll_ids_adjust_ - -#ifndef _di_f_fll_ids_append_ - f_status_t f_fll_ids_append(const f_fll_id_t source, f_fll_ids_t * const 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_fll_ids_append(source, destination); - } -#endif // _di_f_fll_ids_append_ - -#ifndef _di_f_fll_ids_append_all_ - f_status_t f_fll_ids_append_all(const f_fll_ids_t source, f_fll_ids_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_fll_ids_append_all(source, destination); - } -#endif // _di_f_fll_ids_append_all_ - -#ifndef _di_f_fll_ids_decimate_by_ - f_status_t f_fll_ids_decimate_by(const f_number_unsigned_t amount, f_fll_ids_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_decimate_by(amount, sizeof(f_fll_id_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_fll_ids_decimate_by_ - -#ifndef _di_f_fll_ids_decrease_by_ - f_status_t f_fll_ids_decrease_by(const f_number_unsigned_t amount, f_fll_ids_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_decrease_by(amount, sizeof(f_fll_id_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_fll_ids_decrease_by_ - -#ifndef _di_f_fll_ids_increase_ - f_status_t f_fll_ids_increase(const f_number_unsigned_t step, f_fll_ids_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_increase(step, sizeof(f_fll_id_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_fll_ids_increase_ - -#ifndef _di_f_fll_ids_increase_by_ - f_status_t f_fll_ids_increase_by(const f_number_unsigned_t amount, f_fll_ids_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_increase_by(amount, sizeof(f_fll_id_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_fll_ids_increase_by_ - -#ifndef _di_f_fll_ids_resize_ - f_status_t f_fll_ids_resize(const f_number_unsigned_t length, f_fll_ids_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_resize(length, sizeof(f_fll_id_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_fll_ids_resize_ - -#ifndef _di_f_fll_idss_adjust_ - f_status_t f_fll_idss_adjust(const f_number_unsigned_t length, f_fll_idss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_fll_idss_adjust(length, structure); - } -#endif // _di_f_fll_idss_adjust_ - -#ifndef _di_f_fll_idss_append_ - f_status_t f_fll_idss_append(const f_fll_ids_t source, f_fll_idss_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_fll_ids_t), (void **) &destination->array, &destination->used, &destination->size); - if (F_status_is_error(status)) return status; - - status = private_f_fll_ids_append_all(source, &destination->array[destination->used]); - if (F_status_is_error(status)) return status; - - ++destination->used; + { + f_fll_ids_t * const array = (f_fll_ids_t *) void_array; + f_status_t status = F_none; - return F_none; - } -#endif // _di_f_fll_idss_append_ - -#ifndef _di_f_fll_idss_append_all_ - f_status_t f_fll_idss_append_all(const f_fll_idss_t source, f_fll_idss_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; + for (f_number_unsigned_t i = start; i < size; ++i) { - f_status_t status = f_memory_array_increase_by(source.used, sizeof(f_fll_ids_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_fll_ids_append_all(source.array[i], &destination->array[destination->used]); + status = f_memory_array_adjust(0, sizeof(f_fll_id_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; - } - } // for - - return F_none; - } -#endif // _di_f_fll_idss_append_all_ - -#ifndef _di_f_fll_idss_decimate_by_ - f_status_t f_fll_idss_decimate_by(const f_number_unsigned_t amount, f_fll_idss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!amount) return F_data_not; - - return private_f_fll_idss_adjust((structure->size - amount > 0) ? structure->size - amount : 0, structure); - } -#endif // _di_f_fll_idss_decimate_by_ - -#ifndef _di_f_fll_idss_decrease_by_ - f_status_t f_fll_idss_decrease_by(const f_number_unsigned_t amount, f_fll_idss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!amount) return F_data_not; - - return private_f_fll_idss_resize((structure->size - amount > 0) ? structure->size - amount : 0, structure); - } -#endif // _di_f_fll_idss_decrease_by_ - -#ifndef _di_f_fll_idss_increase_ - f_status_t f_fll_idss_increase(const f_number_unsigned_t step, f_fll_idss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (step && structure->used + 1 > structure->size) { - if (structure->used >= F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); - - f_number_unsigned_t length = structure->used + step; - - if (length > F_number_t_size_unsigned_d) { - if (structure->used + 1 > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); - - length = F_number_t_size_unsigned_d; - } - - return private_f_fll_idss_resize(length, structure); + } // for } - return F_data_not; + return F_none; } -#endif // _di_f_fll_idss_increase_ - -#ifndef _di_f_fll_idss_increase_by_ - f_status_t f_fll_idss_increase_by(const f_number_unsigned_t amount, f_fll_idss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ +#endif // _di_f_fll_ids_adjust_callback_ - if (amount) { - if (structure->used >= F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); +#ifndef _di_f_fll_ids_resize_callback_ + f_status_t f_fll_ids_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const void_array) { - const f_number_unsigned_t length = structure->used + amount; + { + f_fll_ids_t * const array = (f_fll_ids_t *) void_array; + f_status_t status = F_none; - if (length > structure->size) { - if (length > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); + for (f_number_unsigned_t i = start; i < size; ++i) { - return private_f_fll_idss_resize(structure->used + amount, structure); - } + status = f_memory_array_resize(0, sizeof(f_fll_id_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } // for } - return F_data_not; - } -#endif // _di_f_fll_idss_increase_by_ - -#ifndef _di_f_fll_idss_resize_ - f_status_t f_fll_idss_resize(const f_number_unsigned_t length, f_fll_idss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_fll_idss_resize(length, structure); + return F_none; } -#endif // _di_f_fll_idss_resize_ +#endif // _di_f_fll_ids_resize_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/fll_id.h b/level_0/f_type_array/c/type_array/fll_id.h index 43c07e692..09bea22bc 100644 --- a/level_0/f_type_array/c/type_array/fll_id.h +++ b/level_0/f_type_array/c/type_array/fll_id.h @@ -17,275 +17,17 @@ extern "C" { #endif /** - * Resize the string fll_ids array. + * A callback intended to be passed to f_memory_arrays_adjust() for an f_fll_idss_t structure. * - * @param length - * The new size to use. - * @param structure - * The string fll_ids array to resize. + * This does not do parameter checking. * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_adjust(). - * - * @see f_memory_array_adjust() - */ -#ifndef _di_f_fll_ids_adjust_ - extern f_status_t f_fll_ids_adjust(const f_number_unsigned_t length, f_fll_ids_t * const structure); -#endif // _di_f_fll_ids_adjust_ - -/** - * Append the single source fll_id onto the destination. - * - * @param source - * The source fll_id to append. - * @param destination - * The destination fll_ids the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase(). - * - * @see f_memory_array_increase() - */ -#ifndef _di_f_fll_ids_append_ - extern f_status_t f_fll_ids_append(const f_fll_id_t source, f_fll_ids_t * const destination); -#endif // _di_f_fll_ids_append_ - -/** - * Append the source fll_ids onto the destination. - * - * @param source - * The source fll_ids to append. - * @param destination - * The destination fll_ids the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_fll_ids_append_all_ - extern f_status_t f_fll_ids_append_all(const f_fll_ids_t source, f_fll_ids_t * const destination); -#endif // _di_f_fll_ids_append_all_ - -/** - * Resize the string fll_ids 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 structure - * The string fll_ids array to resize. - * - * @return - * F_none on success. - * F_data_not if amount is 0. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_decimate_by(). - * - * @see f_memory_array_decimate_by() - */ -#ifndef _di_f_fll_ids_decimate_by_ - extern f_status_t f_fll_ids_decimate_by(const f_number_unsigned_t amount, f_fll_ids_t * const structure); -#endif // _di_f_fll_ids_decimate_by_ - -/** - * Resize the string fll_ids 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 structure - * The string fll_ids array to resize. - * - * @return - * F_none on success. - * F_data_not if amount is 0. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_decrease_by(). - * - * @see f_memory_array_decrease_by() - */ -#ifndef _di_f_fll_ids_decrease_by_ - extern f_status_t f_fll_ids_decrease_by(const f_number_unsigned_t amount, f_fll_ids_t * const structure); -#endif // _di_f_fll_ids_decrease_by_ - -/** - * Increase the size of the string fll_ids 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 structure - * The string fll_ids array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_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_fll_ids_increase_ - extern f_status_t f_fll_ids_increase(const f_number_unsigned_t step, f_fll_ids_t * const structure); -#endif // _di_f_fll_ids_increase_ - -/** - * Resize the string fll_ids 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 structure - * The string fll_ids array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * 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_fll_ids_increase_by_ - extern f_status_t f_fll_ids_increase_by(const f_number_unsigned_t amount, f_fll_ids_t * const structure); -#endif // _di_f_fll_ids_increase_by_ - -/** - * Resize the string fll_ids array. - * - * @param length - * The new size to use. - * @param structure - * The string fll_ids array to adjust. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - */ -#ifndef _di_f_fll_ids_resize_ - extern f_status_t f_fll_ids_resize(const f_number_unsigned_t length, f_fll_ids_t * const structure); -#endif // _di_f_fll_ids_resize_ - -/** - * Resize the string fll_idss array. - * - * @param length - * The new size to use. - * @param structure - * The string fll_idss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_adjust(). - * - * @see f_memory_array_adjust() - */ -#ifndef _di_f_fll_idss_adjust_ - extern f_status_t f_fll_idss_adjust(const f_number_unsigned_t length, f_fll_idss_t * const structure); -#endif // _di_f_fll_idss_adjust_ - -/** - * Append the single source fll_ids onto the destination. - * - * @param source - * The source fll_ids to append. - * @param destination - * The destination ranges the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase(). - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase() - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_fll_idss_append_ - extern f_status_t f_fll_idss_append(const f_fll_ids_t source, f_fll_idss_t * const destination); -#endif // _di_f_fll_idss_append_ - -/** - * Append the source fll_idss onto the destination. - * - * @param source - * The source fll_idss to append. - * @param destination - * The destination ranges the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_fll_idss_append_all_ - extern f_status_t f_fll_idss_append_all(const f_fll_idss_t source, f_fll_idss_t * const destination); -#endif // _di_f_fll_idss_append_all_ - -/** - * Resize the string fll_idss 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 structure - * The string fll_idss array to resize. + * @param start + * The start position in the array to start deleting. + * @param stop + * The stop in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return * F_none on success. @@ -295,97 +37,24 @@ extern "C" { * Errors (with error bit) from: f_memory_array_adjust(). * * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() */ -#ifndef _di_f_fll_idss_decimate_by_ - extern f_status_t f_fll_idss_decimate_by(const f_number_unsigned_t amount, f_fll_idss_t * const structure); -#endif // _di_f_fll_idss_decimate_by_ - -/** - * Resize the string fll_idss 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 structure - * The string fll_idss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - */ -#ifndef _di_f_fll_idss_decrease_by_ - extern f_status_t f_fll_idss_decrease_by(const f_number_unsigned_t amount, f_fll_idss_t * const structure); -#endif // _di_f_fll_idss_decrease_by_ +#ifndef _di_f_fll_ids_adjust_callback_ + extern f_status_t f_fll_ids_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array); +#endif // _di_f_fll_ids_adjust_callback_ /** - * Increase the size of the string fll_idss 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. + * A callback intended to be passed to f_memory_arrays_resize() for an f_fll_idss_t structure. * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param structure - * The string fll_idss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_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_fll_idss_increase_ - extern f_status_t f_fll_idss_increase(const f_number_unsigned_t step, f_fll_idss_t * const structure); -#endif // _di_f_fll_idss_increase_ - -/** - * Resize the string fll_idss 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 structure - * The string fll_idss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * 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_fll_idss_increase_by_ - extern f_status_t f_fll_idss_increase_by(const f_number_unsigned_t amount, f_fll_idss_t * const structure); -#endif // _di_f_fll_idss_increase_by_ - -/** - * Resize the string fll_idss array. + * This does not do parameter checking. * - * @param length - * The new size to use. - * @param structure - * The string fll_idss array to adjust. + * @param start + * The start position in the array to start deleting. + * @param stop + * The stop in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return * F_none on success. @@ -395,10 +64,11 @@ extern "C" { * Errors (with error bit) from: f_memory_array_resize(). * * @see f_memory_array_resize() + * @see f_memory_arrays_resize() */ -#ifndef _di_f_fll_idss_resize_ - extern f_status_t f_fll_idss_resize(const f_number_unsigned_t length, f_fll_idss_t * const structure); -#endif // _di_f_fll_idss_resize_ +#ifndef _di_f_fll_ids_resize_callback_ + extern f_status_t f_fll_ids_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array); +#endif // _di_f_fll_ids_resize_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/int128.c b/level_0/f_type_array/c/type_array/int128.c index 6a294bdbd..a3416b5ac 100644 --- a/level_0/f_type_array/c/type_array/int128.c +++ b/level_0/f_type_array/c/type_array/int128.c @@ -1,227 +1,45 @@ #include "../type_array.h" #include "int128.h" -#include "private-int128.h" #ifdef __cplusplus extern "C" { #endif -#ifndef _di_f_int128s_adjust_ - f_status_t f_int128s_adjust(const f_number_unsigned_t length, f_int128s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ +#ifndef _di_f_int128s_adjust_callback_ + f_status_t f_int128s_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const void_array) { - return f_memory_array_adjust(length, sizeof(int128_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_int128s_adjust_ - -#ifndef _di_f_int128s_append_ - f_status_t f_int128s_append(const int128_t source, f_int128s_t * const 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_int128s_append(source, destination); - } -#endif // _di_f_int128s_append_ - -#ifndef _di_f_int128s_append_all_ - f_status_t f_int128s_append_all(const f_int128s_t source, f_int128s_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_int128s_append_all(source, destination); - } -#endif // _di_f_int128s_append_all_ - -#ifndef _di_f_int128s_decimate_by_ - f_status_t f_int128s_decimate_by(const f_number_unsigned_t amount, f_int128s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_decimate_by(amount, sizeof(int128_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_int128s_decimate_by_ - -#ifndef _di_f_int128s_decrease_by_ - f_status_t f_int128s_decrease_by(const f_number_unsigned_t amount, f_int128s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_decrease_by(amount, sizeof(int128_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_int128s_decrease_by_ - -#ifndef _di_f_int128s_increase_ - f_status_t f_int128s_increase(const f_number_unsigned_t step, f_int128s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_increase(step, sizeof(int128_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_int128s_increase_ - -#ifndef _di_f_int128s_increase_by_ - f_status_t f_int128s_increase_by(const f_number_unsigned_t amount, f_int128s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_increase_by(amount, sizeof(int128_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_int128s_increase_by_ - -#ifndef _di_f_int128s_resize_ - f_status_t f_int128s_resize(const f_number_unsigned_t length, f_int128s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_resize(length, sizeof(int128_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_int128s_resize_ - -#ifndef _di_f_int128ss_adjust_ - f_status_t f_int128ss_adjust(const f_number_unsigned_t length, f_int128ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_int128ss_adjust(length, structure); - } -#endif // _di_f_int128ss_adjust_ - -#ifndef _di_f_int128ss_append_ - f_status_t f_int128ss_append(const f_int128s_t source, f_int128ss_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_int128s_t), (void **) &destination->array, &destination->used, &destination->size); - if (F_status_is_error(status)) return status; - - status = private_f_int128s_append_all(source, &destination->array[destination->used]); - if (F_status_is_error(status)) return status; - - ++destination->used; + { + f_int128s_t * const array = (f_int128s_t *) void_array; + f_status_t status = F_none; - return F_none; - } -#endif // _di_f_int128ss_append_ - -#ifndef _di_f_int128ss_append_all_ - f_status_t f_int128ss_append_all(const f_int128ss_t source, f_int128ss_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; + for (f_number_unsigned_t i = start; i < size; ++i) { - f_status_t status = f_memory_array_increase_by(source.used, sizeof(f_int128s_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_int128s_append_all(source.array[i], &destination->array[destination->used]); + status = f_memory_array_adjust(0, sizeof(f_int128_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; - } - } // for - - return F_none; - } -#endif // _di_f_int128ss_append_all_ - -#ifndef _di_f_int128ss_decimate_by_ - f_status_t f_int128ss_decimate_by(const f_number_unsigned_t amount, f_int128ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!amount) return F_data_not; - - return private_f_int128ss_adjust((structure->size - amount > 0) ? structure->size - amount : 0, structure); - } -#endif // _di_f_int128ss_decimate_by_ - -#ifndef _di_f_int128ss_decrease_by_ - f_status_t f_int128ss_decrease_by(const f_number_unsigned_t amount, f_int128ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!amount) return F_data_not; - - return private_f_int128ss_resize((structure->size - amount > 0) ? structure->size - amount : 0, structure); - } -#endif // _di_f_int128ss_decrease_by_ - -#ifndef _di_f_int128ss_increase_ - f_status_t f_int128ss_increase(const f_number_unsigned_t step, f_int128ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (step && structure->used + 1 > structure->size) { - if (structure->used >= F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); - - f_number_unsigned_t length = structure->used + step; - - if (length > F_number_t_size_unsigned_d) { - if (structure->used + 1 > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); - - length = F_number_t_size_unsigned_d; - } - - return private_f_int128ss_resize(length, structure); + } // for } - return F_data_not; + return F_none; } -#endif // _di_f_int128ss_increase_ - -#ifndef _di_f_int128ss_increase_by_ - f_status_t f_int128ss_increase_by(const f_number_unsigned_t amount, f_int128ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ +#endif // _di_f_int128s_adjust_callback_ - if (amount) { - if (structure->used >= F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); +#ifndef _di_f_int128s_resize_callback_ + f_status_t f_int128s_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const void_array) { - const f_number_unsigned_t length = structure->used + amount; + { + f_int128s_t * const array = (f_int128s_t *) void_array; + f_status_t status = F_none; - if (length > structure->size) { - if (length > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); + for (f_number_unsigned_t i = start; i < size; ++i) { - return private_f_int128ss_resize(structure->used + amount, structure); - } + status = f_memory_array_resize(0, sizeof(f_int128_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } // for } - return F_data_not; - } -#endif // _di_f_int128ss_increase_by_ - -#ifndef _di_f_int128ss_resize_ - f_status_t f_int128ss_resize(const f_number_unsigned_t length, f_int128ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_int128ss_resize(length, structure); + return F_none; } -#endif // _di_f_int128ss_resize_ +#endif // _di_f_int128s_resize_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/int128.h b/level_0/f_type_array/c/type_array/int128.h index 339944385..e0122eb79 100644 --- a/level_0/f_type_array/c/type_array/int128.h +++ b/level_0/f_type_array/c/type_array/int128.h @@ -17,275 +17,17 @@ extern "C" { #endif /** - * Resize the string int128s array. + * A callback intended to be passed to f_memory_arrays_adjust() for an f_int128ss_t structure. * - * @param length - * The new size to use. - * @param structure - * The string int128s array to resize. + * This does not do parameter checking. * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_adjust(). - * - * @see f_memory_array_adjust() - */ -#ifndef _di_f_int128s_adjust_ - extern f_status_t f_int128s_adjust(const f_number_unsigned_t length, f_int128s_t * const structure); -#endif // _di_f_int128s_adjust_ - -/** - * Append the single source int128 onto the destination. - * - * @param source - * The source int128 to append. - * @param destination - * The destination int128s the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase(). - * - * @see f_memory_array_increase() - */ -#ifndef _di_f_int128s_append_ - extern f_status_t f_int128s_append(const int128_t source, f_int128s_t * const destination); -#endif // _di_f_int128s_append_ - -/** - * Append the source int128s onto the destination. - * - * @param source - * The source int128s to append. - * @param destination - * The destination int128s the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_int128s_append_all_ - extern f_status_t f_int128s_append_all(const f_int128s_t source, f_int128s_t * const destination); -#endif // _di_f_int128s_append_all_ - -/** - * Resize the string int128s 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 structure - * The string int128s array to resize. - * - * @return - * F_none on success. - * F_data_not if amount is 0. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_decimate_by(). - * - * @see f_memory_array_decimate_by() - */ -#ifndef _di_f_int128s_decimate_by_ - extern f_status_t f_int128s_decimate_by(const f_number_unsigned_t amount, f_int128s_t * const structure); -#endif // _di_f_int128s_decimate_by_ - -/** - * Resize the string int128s 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 structure - * The string int128s array to resize. - * - * @return - * F_none on success. - * F_data_not if amount is 0. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_decrease_by(). - * - * @see f_memory_array_decrease_by() - */ -#ifndef _di_f_int128s_decrease_by_ - extern f_status_t f_int128s_decrease_by(const f_number_unsigned_t amount, f_int128s_t * const structure); -#endif // _di_f_int128s_decrease_by_ - -/** - * Increase the size of the string int128s 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 structure - * The string int128s array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_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_int128s_increase_ - extern f_status_t f_int128s_increase(const f_number_unsigned_t step, f_int128s_t * const structure); -#endif // _di_f_int128s_increase_ - -/** - * Resize the string int128s 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 structure - * The string int128s array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * 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_int128s_increase_by_ - extern f_status_t f_int128s_increase_by(const f_number_unsigned_t amount, f_int128s_t * const structure); -#endif // _di_f_int128s_increase_by_ - -/** - * Resize the string int128s array. - * - * @param length - * The new size to use. - * @param structure - * The string int128s array to adjust. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - */ -#ifndef _di_f_int128s_resize_ - extern f_status_t f_int128s_resize(const f_number_unsigned_t length, f_int128s_t * const structure); -#endif // _di_f_int128s_resize_ - -/** - * Resize the string int128ss array. - * - * @param length - * The new size to use. - * @param structure - * The string int128ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_adjust(). - * - * @see f_memory_array_adjust() - */ -#ifndef _di_f_int128ss_adjust_ - extern f_status_t f_int128ss_adjust(const f_number_unsigned_t length, f_int128ss_t * const structure); -#endif // _di_f_int128ss_adjust_ - -/** - * Append the single source int128s onto the destination. - * - * @param source - * The source int128s to append. - * @param destination - * The destination ranges the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase(). - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase() - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_int128ss_append_ - extern f_status_t f_int128ss_append(const f_int128s_t source, f_int128ss_t * const destination); -#endif // _di_f_int128ss_append_ - -/** - * Append the source int128ss onto the destination. - * - * @param source - * The source int128ss to append. - * @param destination - * The destination ranges the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_int128ss_append_all_ - extern f_status_t f_int128ss_append_all(const f_int128ss_t source, f_int128ss_t * const destination); -#endif // _di_f_int128ss_append_all_ - -/** - * Resize the string int128ss 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 structure - * The string int128ss array to resize. + * @param start + * The start position in the array to start deleting. + * @param stop + * The stop in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return * F_none on success. @@ -295,97 +37,24 @@ extern "C" { * Errors (with error bit) from: f_memory_array_adjust(). * * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() */ -#ifndef _di_f_int128ss_decimate_by_ - extern f_status_t f_int128ss_decimate_by(const f_number_unsigned_t amount, f_int128ss_t * const structure); -#endif // _di_f_int128ss_decimate_by_ - -/** - * Resize the string int128ss 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 structure - * The string int128ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - */ -#ifndef _di_f_int128ss_decrease_by_ - extern f_status_t f_int128ss_decrease_by(const f_number_unsigned_t amount, f_int128ss_t * const structure); -#endif // _di_f_int128ss_decrease_by_ +#ifndef _di_f_int128s_adjust_callback_ + extern f_status_t f_int128s_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array); +#endif // _di_f_int128s_adjust_callback_ /** - * Increase the size of the string int128ss 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. + * A callback intended to be passed to f_memory_arrays_resize() for an f_int128ss_t structure. * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param structure - * The string int128ss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_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_int128ss_increase_ - extern f_status_t f_int128ss_increase(const f_number_unsigned_t step, f_int128ss_t * const structure); -#endif // _di_f_int128ss_increase_ - -/** - * Resize the string int128ss 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 structure - * The string int128ss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * 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_int128ss_increase_by_ - extern f_status_t f_int128ss_increase_by(const f_number_unsigned_t amount, f_int128ss_t * const structure); -#endif // _di_f_int128ss_increase_by_ - -/** - * Resize the string int128ss array. + * This does not do parameter checking. * - * @param length - * The new size to use. - * @param structure - * The string int128ss array to adjust. + * @param start + * The start position in the array to start deleting. + * @param stop + * The stop in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return * F_none on success. @@ -395,10 +64,11 @@ extern "C" { * Errors (with error bit) from: f_memory_array_resize(). * * @see f_memory_array_resize() + * @see f_memory_arrays_resize() */ -#ifndef _di_f_int128ss_resize_ - extern f_status_t f_int128ss_resize(const f_number_unsigned_t length, f_int128ss_t * const structure); -#endif // _di_f_int128ss_resize_ +#ifndef _di_f_int128s_resize_callback_ + extern f_status_t f_int128s_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array); +#endif // _di_f_int128s_resize_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/int16.c b/level_0/f_type_array/c/type_array/int16.c index 0e5c5aee2..446baf399 100644 --- a/level_0/f_type_array/c/type_array/int16.c +++ b/level_0/f_type_array/c/type_array/int16.c @@ -1,227 +1,45 @@ #include "../type_array.h" #include "int16.h" -#include "private-int16.h" #ifdef __cplusplus extern "C" { #endif -#ifndef _di_f_int16s_adjust_ - f_status_t f_int16s_adjust(const f_number_unsigned_t length, f_int16s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ +#ifndef _di_f_int16s_adjust_callback_ + f_status_t f_int16s_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const void_array) { - return f_memory_array_adjust(length, sizeof(int16_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_int16s_adjust_ - -#ifndef _di_f_int16s_append_ - f_status_t f_int16s_append(const int16_t source, f_int16s_t * const 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_int16s_append(source, destination); - } -#endif // _di_f_int16s_append_ - -#ifndef _di_f_int16s_append_all_ - f_status_t f_int16s_append_all(const f_int16s_t source, f_int16s_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_int16s_append_all(source, destination); - } -#endif // _di_f_int16s_append_all_ - -#ifndef _di_f_int16s_decimate_by_ - f_status_t f_int16s_decimate_by(const f_number_unsigned_t amount, f_int16s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_decimate_by(amount, sizeof(int16_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_int16s_decimate_by_ - -#ifndef _di_f_int16s_decrease_by_ - f_status_t f_int16s_decrease_by(const f_number_unsigned_t amount, f_int16s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_decrease_by(amount, sizeof(int16_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_int16s_decrease_by_ - -#ifndef _di_f_int16s_increase_ - f_status_t f_int16s_increase(const f_number_unsigned_t step, f_int16s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_increase(step, sizeof(int16_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_int16s_increase_ - -#ifndef _di_f_int16s_increase_by_ - f_status_t f_int16s_increase_by(const f_number_unsigned_t amount, f_int16s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_increase_by(amount, sizeof(int16_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_int16s_increase_by_ - -#ifndef _di_f_int16s_resize_ - f_status_t f_int16s_resize(const f_number_unsigned_t length, f_int16s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_resize(length, sizeof(int16_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_int16s_resize_ - -#ifndef _di_f_int16ss_adjust_ - f_status_t f_int16ss_adjust(const f_number_unsigned_t length, f_int16ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_int16ss_adjust(length, structure); - } -#endif // _di_f_int16ss_adjust_ - -#ifndef _di_f_int16ss_append_ - f_status_t f_int16ss_append(const f_int16s_t source, f_int16ss_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_int16s_t), (void **) &destination->array, &destination->used, &destination->size); - if (F_status_is_error(status)) return status; - - status = private_f_int16s_append_all(source, &destination->array[destination->used]); - if (F_status_is_error(status)) return status; - - ++destination->used; + { + f_int16s_t * const array = (f_int16s_t *) void_array; + f_status_t status = F_none; - return F_none; - } -#endif // _di_f_int16ss_append_ - -#ifndef _di_f_int16ss_append_all_ - f_status_t f_int16ss_append_all(const f_int16ss_t source, f_int16ss_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; + for (f_number_unsigned_t i = start; i < size; ++i) { - f_status_t status = f_memory_array_increase_by(source.used, sizeof(f_int16s_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_int16s_append_all(source.array[i], &destination->array[destination->used]); + status = f_memory_array_adjust(0, sizeof(int16_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; - } - } // for - - return F_none; - } -#endif // _di_f_int16ss_append_all_ - -#ifndef _di_f_int16ss_decimate_by_ - f_status_t f_int16ss_decimate_by(const f_number_unsigned_t amount, f_int16ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!amount) return F_data_not; - - return private_f_int16ss_adjust((structure->size - amount > 0) ? structure->size - amount : 0, structure); - } -#endif // _di_f_int16ss_decimate_by_ - -#ifndef _di_f_int16ss_decrease_by_ - f_status_t f_int16ss_decrease_by(const f_number_unsigned_t amount, f_int16ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!amount) return F_data_not; - - return private_f_int16ss_resize((structure->size - amount > 0) ? structure->size - amount : 0, structure); - } -#endif // _di_f_int16ss_decrease_by_ - -#ifndef _di_f_int16ss_increase_ - f_status_t f_int16ss_increase(const f_number_unsigned_t step, f_int16ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (step && structure->used + 1 > structure->size) { - if (structure->used >= F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); - - f_number_unsigned_t length = structure->used + step; - - if (length > F_number_t_size_unsigned_d) { - if (structure->used + 1 > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); - - length = F_number_t_size_unsigned_d; - } - - return private_f_int16ss_resize(length, structure); + } // for } - return F_data_not; + return F_none; } -#endif // _di_f_int16ss_increase_ - -#ifndef _di_f_int16ss_increase_by_ - f_status_t f_int16ss_increase_by(const f_number_unsigned_t amount, f_int16ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ +#endif // _di_f_int16s_adjust_callback_ - if (amount) { - if (structure->used >= F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); +#ifndef _di_f_int16s_resize_callback_ + f_status_t f_int16s_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const void_array) { - const f_number_unsigned_t length = structure->used + amount; + { + f_int16s_t * const array = (f_int16s_t *) void_array; + f_status_t status = F_none; - if (length > structure->size) { - if (length > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); + for (f_number_unsigned_t i = start; i < size; ++i) { - return private_f_int16ss_resize(structure->used + amount, structure); - } + status = f_memory_array_resize(0, sizeof(int16_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } // for } - return F_data_not; - } -#endif // _di_f_int16ss_increase_by_ - -#ifndef _di_f_int16ss_resize_ - f_status_t f_int16ss_resize(const f_number_unsigned_t length, f_int16ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_int16ss_resize(length, structure); + return F_none; } -#endif // _di_f_int16ss_resize_ +#endif // _di_f_int16s_resize_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/int16.h b/level_0/f_type_array/c/type_array/int16.h index f7a4086c6..bccde6761 100644 --- a/level_0/f_type_array/c/type_array/int16.h +++ b/level_0/f_type_array/c/type_array/int16.h @@ -17,275 +17,17 @@ extern "C" { #endif /** - * Resize the string int16s array. + * A callback intended to be passed to f_memory_arrays_adjust() for an f_int16ss_t structure. * - * @param length - * The new size to use. - * @param structure - * The string int16s array to resize. + * This does not do parameter checking. * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_adjust(). - * - * @see f_memory_array_adjust() - */ -#ifndef _di_f_int16s_adjust_ - extern f_status_t f_int16s_adjust(const f_number_unsigned_t length, f_int16s_t * const structure); -#endif // _di_f_int16s_adjust_ - -/** - * Append the single source int16 onto the destination. - * - * @param source - * The source int16 to append. - * @param destination - * The destination int16s the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase(). - * - * @see f_memory_array_increase() - */ -#ifndef _di_f_int16s_append_ - extern f_status_t f_int16s_append(const int16_t source, f_int16s_t * const destination); -#endif // _di_f_int16s_append_ - -/** - * Append the source int16s onto the destination. - * - * @param source - * The source int16s to append. - * @param destination - * The destination int16s the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_int16s_append_all_ - extern f_status_t f_int16s_append_all(const f_int16s_t source, f_int16s_t * const destination); -#endif // _di_f_int16s_append_all_ - -/** - * Resize the string int16s 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 structure - * The string int16s array to resize. - * - * @return - * F_none on success. - * F_data_not if amount is 0. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_decimate_by(). - * - * @see f_memory_array_decimate_by() - */ -#ifndef _di_f_int16s_decimate_by_ - extern f_status_t f_int16s_decimate_by(const f_number_unsigned_t amount, f_int16s_t * const structure); -#endif // _di_f_int16s_decimate_by_ - -/** - * Resize the string int16s 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 structure - * The string int16s array to resize. - * - * @return - * F_none on success. - * F_data_not if amount is 0. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_decrease_by(). - * - * @see f_memory_array_decrease_by() - */ -#ifndef _di_f_int16s_decrease_by_ - extern f_status_t f_int16s_decrease_by(const f_number_unsigned_t amount, f_int16s_t * const structure); -#endif // _di_f_int16s_decrease_by_ - -/** - * Increase the size of the string int16s 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 structure - * The string int16s array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_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_int16s_increase_ - extern f_status_t f_int16s_increase(const f_number_unsigned_t step, f_int16s_t * const structure); -#endif // _di_f_int16s_increase_ - -/** - * Resize the string int16s 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 structure - * The string int16s array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * 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_int16s_increase_by_ - extern f_status_t f_int16s_increase_by(const f_number_unsigned_t amount, f_int16s_t * const structure); -#endif // _di_f_int16s_increase_by_ - -/** - * Resize the string int16s array. - * - * @param length - * The new size to use. - * @param structure - * The string int16s array to adjust. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - */ -#ifndef _di_f_int16s_resize_ - extern f_status_t f_int16s_resize(const f_number_unsigned_t length, f_int16s_t * const structure); -#endif // _di_f_int16s_resize_ - -/** - * Resize the string int16ss array. - * - * @param length - * The new size to use. - * @param structure - * The string int16ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_adjust(). - * - * @see f_memory_array_adjust() - */ -#ifndef _di_f_int16ss_adjust_ - extern f_status_t f_int16ss_adjust(const f_number_unsigned_t length, f_int16ss_t * const structure); -#endif // _di_f_int16ss_adjust_ - -/** - * Append the single source int16s onto the destination. - * - * @param source - * The source int16s to append. - * @param destination - * The destination ranges the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase(). - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase() - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_int16ss_append_ - extern f_status_t f_int16ss_append(const f_int16s_t source, f_int16ss_t * const destination); -#endif // _di_f_int16ss_append_ - -/** - * Append the source int16ss onto the destination. - * - * @param source - * The source int16ss to append. - * @param destination - * The destination ranges the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_int16ss_append_all_ - extern f_status_t f_int16ss_append_all(const f_int16ss_t source, f_int16ss_t * const destination); -#endif // _di_f_int16ss_append_all_ - -/** - * Resize the string int16ss 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 structure - * The string int16ss array to resize. + * @param start + * The start position in the array to start deleting. + * @param stop + * The stop in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return * F_none on success. @@ -295,111 +37,38 @@ extern "C" { * Errors (with error bit) from: f_memory_array_adjust(). * * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() */ -#ifndef _di_f_int16ss_decimate_by_ - extern f_status_t f_int16ss_decimate_by(const f_number_unsigned_t amount, f_int16ss_t * const structure); -#endif // _di_f_int16ss_decimate_by_ - -/** - * Resize the string int16ss 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 structure - * The string int16ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - */ -#ifndef _di_f_int16ss_decrease_by_ - extern f_status_t f_int16ss_decrease_by(const f_number_unsigned_t amount, f_int16ss_t * const structure); -#endif // _di_f_int16ss_decrease_by_ +#ifndef _di_f_int16s_adjust_callback_ + extern f_status_t f_int16s_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array); +#endif // _di_f_int16s_adjust_callback_ /** - * Increase the size of the string int16ss array, but only if necessary. + * A callback intended to be passed to f_memory_arrays_resize() for an f_int16ss_t structure. * - * If the given length is too large for the buffer, then attempt to set max buffer size (F_number_t_size_unsigned_d). - * If already set to the maximum buffer size, then the resize will fail. + * This does not do parameter checking. * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param structure - * The string int16ss array to resize. + * @param start + * The start position in the array to start deleting. + * @param stop + * The stop in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). * - * F_array_too_large (with error bit) if the new array length is too large. * F_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_int16ss_increase_ - extern f_status_t f_int16ss_increase(const f_number_unsigned_t step, f_int16ss_t * const structure); -#endif // _di_f_int16ss_increase_ - -/** - * Resize the string int16ss 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 structure - * The string int16ss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * 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_int16ss_increase_by_ - extern f_status_t f_int16ss_increase_by(const f_number_unsigned_t amount, f_int16ss_t * const structure); -#endif // _di_f_int16ss_increase_by_ - -/** - * Resize the string int16ss array. - * - * @param length - * The new size to use. - * @param structure - * The string int16ss array to adjust. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - */ -#ifndef _di_f_int16ss_resize_ - extern f_status_t f_int16ss_resize(const f_number_unsigned_t length, f_int16ss_t * const structure); -#endif // _di_f_int16ss_resize_ - +#ifndef _di_f_int16s_resize_callback_ + extern f_status_t f_int16s_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array); +#endif // _di_f_int16s_resize_callback_ #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_type_array/c/type_array/int32.c b/level_0/f_type_array/c/type_array/int32.c index 11f8ce5e5..4561c61e1 100644 --- a/level_0/f_type_array/c/type_array/int32.c +++ b/level_0/f_type_array/c/type_array/int32.c @@ -1,227 +1,45 @@ #include "../type_array.h" #include "int32.h" -#include "private-int32.h" #ifdef __cplusplus extern "C" { #endif -#ifndef _di_f_int32s_adjust_ - f_status_t f_int32s_adjust(const f_number_unsigned_t length, f_int32s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ +#ifndef _di_f_int32s_adjust_callback_ + f_status_t f_int32s_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const void_array) { - return f_memory_array_adjust(length, sizeof(int32_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_int32s_adjust_ - -#ifndef _di_f_int32s_append_ - f_status_t f_int32s_append(const int32_t source, f_int32s_t * const 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_int32s_append(source, destination); - } -#endif // _di_f_int32s_append_ - -#ifndef _di_f_int32s_append_all_ - f_status_t f_int32s_append_all(const f_int32s_t source, f_int32s_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_int32s_append_all(source, destination); - } -#endif // _di_f_int32s_append_all_ - -#ifndef _di_f_int32s_decimate_by_ - f_status_t f_int32s_decimate_by(const f_number_unsigned_t amount, f_int32s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_decimate_by(amount, sizeof(int32_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_int32s_decimate_by_ - -#ifndef _di_f_int32s_decrease_by_ - f_status_t f_int32s_decrease_by(const f_number_unsigned_t amount, f_int32s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_decrease_by(amount, sizeof(int32_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_int32s_decrease_by_ - -#ifndef _di_f_int32s_increase_ - f_status_t f_int32s_increase(const f_number_unsigned_t step, f_int32s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_increase(step, sizeof(int32_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_int32s_increase_ - -#ifndef _di_f_int32s_increase_by_ - f_status_t f_int32s_increase_by(const f_number_unsigned_t amount, f_int32s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_increase_by(amount, sizeof(int32_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_int32s_increase_by_ - -#ifndef _di_f_int32s_resize_ - f_status_t f_int32s_resize(const f_number_unsigned_t length, f_int32s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_resize(length, sizeof(int32_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_int32s_resize_ - -#ifndef _di_f_int32ss_adjust_ - f_status_t f_int32ss_adjust(const f_number_unsigned_t length, f_int32ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_int32ss_adjust(length, structure); - } -#endif // _di_f_int32ss_adjust_ - -#ifndef _di_f_int32ss_append_ - f_status_t f_int32ss_append(const f_int32s_t source, f_int32ss_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_int32s_t), (void **) &destination->array, &destination->used, &destination->size); - if (F_status_is_error(status)) return status; - - status = private_f_int32s_append_all(source, &destination->array[destination->used]); - if (F_status_is_error(status)) return status; - - ++destination->used; + { + f_int32s_t * const array = (f_int32s_t *) void_array; + f_status_t status = F_none; - return F_none; - } -#endif // _di_f_int32ss_append_ - -#ifndef _di_f_int32ss_append_all_ - f_status_t f_int32ss_append_all(const f_int32ss_t source, f_int32ss_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; + for (f_number_unsigned_t i = start; i < size; ++i) { - f_status_t status = f_memory_array_increase_by(source.used, sizeof(f_int32s_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_int32s_append_all(source.array[i], &destination->array[destination->used]); + status = f_memory_array_adjust(0, sizeof(int32_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; - } - } // for - - return F_none; - } -#endif // _di_f_int32ss_append_all_ - -#ifndef _di_f_int32ss_decimate_by_ - f_status_t f_int32ss_decimate_by(const f_number_unsigned_t amount, f_int32ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!amount) return F_data_not; - - return private_f_int32ss_adjust((structure->size - amount > 0) ? structure->size - amount : 0, structure); - } -#endif // _di_f_int32ss_decimate_by_ - -#ifndef _di_f_int32ss_decrease_by_ - f_status_t f_int32ss_decrease_by(const f_number_unsigned_t amount, f_int32ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!amount) return F_data_not; - - return private_f_int32ss_resize((structure->size - amount > 0) ? structure->size - amount : 0, structure); - } -#endif // _di_f_int32ss_decrease_by_ - -#ifndef _di_f_int32ss_increase_ - f_status_t f_int32ss_increase(const f_number_unsigned_t step, f_int32ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (step && structure->used + 1 > structure->size) { - if (structure->used >= F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); - - f_number_unsigned_t length = structure->used + step; - - if (length > F_number_t_size_unsigned_d) { - if (structure->used + 1 > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); - - length = F_number_t_size_unsigned_d; - } - - return private_f_int32ss_resize(length, structure); + } // for } - return F_data_not; + return F_none; } -#endif // _di_f_int32ss_increase_ - -#ifndef _di_f_int32ss_increase_by_ - f_status_t f_int32ss_increase_by(const f_number_unsigned_t amount, f_int32ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ +#endif // _di_f_int32s_adjust_callback_ - if (amount) { - if (structure->used >= F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); +#ifndef _di_f_int32s_resize_callback_ + f_status_t f_int32s_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const void_array) { - const f_number_unsigned_t length = structure->used + amount; + { + f_int32s_t * const array = (f_int32s_t *) void_array; + f_status_t status = F_none; - if (length > structure->size) { - if (length > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); + for (f_number_unsigned_t i = start; i < size; ++i) { - return private_f_int32ss_resize(structure->used + amount, structure); - } + status = f_memory_array_resize(0, sizeof(int32_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } // for } - return F_data_not; - } -#endif // _di_f_int32ss_increase_by_ - -#ifndef _di_f_int32ss_resize_ - f_status_t f_int32ss_resize(const f_number_unsigned_t length, f_int32ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_int32ss_resize(length, structure); + return F_none; } -#endif // _di_f_int32ss_resize_ +#endif // _di_f_int32s_resize_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/int32.h b/level_0/f_type_array/c/type_array/int32.h index 9ba6885bd..2cc3699f1 100644 --- a/level_0/f_type_array/c/type_array/int32.h +++ b/level_0/f_type_array/c/type_array/int32.h @@ -17,275 +17,17 @@ extern "C" { #endif /** - * Resize the string int32s array. + * A callback intended to be passed to f_memory_arrays_adjust() for an f_int32ss_t structure. * - * @param length - * The new size to use. - * @param structure - * The string int32s array to resize. + * This does not do parameter checking. * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_adjust(). - * - * @see f_memory_array_adjust() - */ -#ifndef _di_f_int32s_adjust_ - extern f_status_t f_int32s_adjust(const f_number_unsigned_t length, f_int32s_t * const structure); -#endif // _di_f_int32s_adjust_ - -/** - * Append the single source int32 onto the destination. - * - * @param source - * The source int32 to append. - * @param destination - * The destination int32s the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase(). - * - * @see f_memory_array_increase() - */ -#ifndef _di_f_int32s_append_ - extern f_status_t f_int32s_append(const int32_t source, f_int32s_t * const destination); -#endif // _di_f_int32s_append_ - -/** - * Append the source int32s onto the destination. - * - * @param source - * The source int32s to append. - * @param destination - * The destination int32s the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_int32s_append_all_ - extern f_status_t f_int32s_append_all(const f_int32s_t source, f_int32s_t * const destination); -#endif // _di_f_int32s_append_all_ - -/** - * Resize the string int32s 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 structure - * The string int32s array to resize. - * - * @return - * F_none on success. - * F_data_not if amount is 0. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_decimate_by(). - * - * @see f_memory_array_decimate_by() - */ -#ifndef _di_f_int32s_decimate_by_ - extern f_status_t f_int32s_decimate_by(const f_number_unsigned_t amount, f_int32s_t * const structure); -#endif // _di_f_int32s_decimate_by_ - -/** - * Resize the string int32s 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 structure - * The string int32s array to resize. - * - * @return - * F_none on success. - * F_data_not if amount is 0. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_decrease_by(). - * - * @see f_memory_array_decrease_by() - */ -#ifndef _di_f_int32s_decrease_by_ - extern f_status_t f_int32s_decrease_by(const f_number_unsigned_t amount, f_int32s_t * const structure); -#endif // _di_f_int32s_decrease_by_ - -/** - * Increase the size of the string int32s 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 structure - * The string int32s array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_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_int32s_increase_ - extern f_status_t f_int32s_increase(const f_number_unsigned_t step, f_int32s_t * const structure); -#endif // _di_f_int32s_increase_ - -/** - * Resize the string int32s 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 structure - * The string int32s array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * 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_int32s_increase_by_ - extern f_status_t f_int32s_increase_by(const f_number_unsigned_t amount, f_int32s_t * const structure); -#endif // _di_f_int32s_increase_by_ - -/** - * Resize the string int32s array. - * - * @param length - * The new size to use. - * @param structure - * The string int32s array to adjust. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - */ -#ifndef _di_f_int32s_resize_ - extern f_status_t f_int32s_resize(const f_number_unsigned_t length, f_int32s_t * const structure); -#endif // _di_f_int32s_resize_ - -/** - * Resize the string int32ss array. - * - * @param length - * The new size to use. - * @param structure - * The string int32ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_adjust(). - * - * @see f_memory_array_adjust() - */ -#ifndef _di_f_int32ss_adjust_ - extern f_status_t f_int32ss_adjust(const f_number_unsigned_t length, f_int32ss_t * const structure); -#endif // _di_f_int32ss_adjust_ - -/** - * Append the single source int32s onto the destination. - * - * @param source - * The source int32s to append. - * @param destination - * The destination ranges the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase(). - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase() - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_int32ss_append_ - extern f_status_t f_int32ss_append(const f_int32s_t source, f_int32ss_t * const destination); -#endif // _di_f_int32ss_append_ - -/** - * Append the source int32ss onto the destination. - * - * @param source - * The source int32ss to append. - * @param destination - * The destination ranges the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_int32ss_append_all_ - extern f_status_t f_int32ss_append_all(const f_int32ss_t source, f_int32ss_t * const destination); -#endif // _di_f_int32ss_append_all_ - -/** - * Resize the string int32ss 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 structure - * The string int32ss array to resize. + * @param start + * The start position in the array to start deleting. + * @param stop + * The stop in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return * F_none on success. @@ -295,97 +37,24 @@ extern "C" { * Errors (with error bit) from: f_memory_array_adjust(). * * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() */ -#ifndef _di_f_int32ss_decimate_by_ - extern f_status_t f_int32ss_decimate_by(const f_number_unsigned_t amount, f_int32ss_t * const structure); -#endif // _di_f_int32ss_decimate_by_ - -/** - * Resize the string int32ss 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 structure - * The string int32ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - */ -#ifndef _di_f_int32ss_decrease_by_ - extern f_status_t f_int32ss_decrease_by(const f_number_unsigned_t amount, f_int32ss_t * const structure); -#endif // _di_f_int32ss_decrease_by_ +#ifndef _di_f_int32s_adjust_callback_ + extern f_status_t f_int32s_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array); +#endif // _di_f_int32s_adjust_callback_ /** - * Increase the size of the string int32ss 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. + * A callback intended to be passed to f_memory_arrays_resize() for an f_int32ss_t structure. * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param structure - * The string int32ss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_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_int32ss_increase_ - extern f_status_t f_int32ss_increase(const f_number_unsigned_t step, f_int32ss_t * const structure); -#endif // _di_f_int32ss_increase_ - -/** - * Resize the string int32ss 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 structure - * The string int32ss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * 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_int32ss_increase_by_ - extern f_status_t f_int32ss_increase_by(const f_number_unsigned_t amount, f_int32ss_t * const structure); -#endif // _di_f_int32ss_increase_by_ - -/** - * Resize the string int32ss array. + * This does not do parameter checking. * - * @param length - * The new size to use. - * @param structure - * The string int32ss array to adjust. + * @param start + * The start position in the array to start deleting. + * @param stop + * The stop in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return * F_none on success. @@ -395,10 +64,11 @@ extern "C" { * Errors (with error bit) from: f_memory_array_resize(). * * @see f_memory_array_resize() + * @see f_memory_arrays_resize() */ -#ifndef _di_f_int32ss_resize_ - extern f_status_t f_int32ss_resize(const f_number_unsigned_t length, f_int32ss_t * const structure); -#endif // _di_f_int32ss_resize_ +#ifndef _di_f_int32s_resize_callback_ + extern f_status_t f_int32s_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array); +#endif // _di_f_int32s_resize_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/int64.c b/level_0/f_type_array/c/type_array/int64.c index 4d4da94e8..358375c9f 100644 --- a/level_0/f_type_array/c/type_array/int64.c +++ b/level_0/f_type_array/c/type_array/int64.c @@ -1,227 +1,45 @@ #include "../type_array.h" #include "int64.h" -#include "private-int64.h" #ifdef __cplusplus extern "C" { #endif -#ifndef _di_f_int64s_adjust_ - f_status_t f_int64s_adjust(const f_number_unsigned_t length, f_int64s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ +#ifndef _di_f_int64s_adjust_callback_ + f_status_t f_int64s_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const void_array) { - return f_memory_array_adjust(length, sizeof(int64_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_int64s_adjust_ - -#ifndef _di_f_int64s_append_ - f_status_t f_int64s_append(const int64_t source, f_int64s_t * const 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_int64s_append(source, destination); - } -#endif // _di_f_int64s_append_ - -#ifndef _di_f_int64s_append_all_ - f_status_t f_int64s_append_all(const f_int64s_t source, f_int64s_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_int64s_append_all(source, destination); - } -#endif // _di_f_int64s_append_all_ - -#ifndef _di_f_int64s_decimate_by_ - f_status_t f_int64s_decimate_by(const f_number_unsigned_t amount, f_int64s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_decimate_by(amount, sizeof(int64_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_int64s_decimate_by_ - -#ifndef _di_f_int64s_decrease_by_ - f_status_t f_int64s_decrease_by(const f_number_unsigned_t amount, f_int64s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_decrease_by(amount, sizeof(int64_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_int64s_decrease_by_ - -#ifndef _di_f_int64s_increase_ - f_status_t f_int64s_increase(const f_number_unsigned_t step, f_int64s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_increase(step, sizeof(int64_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_int64s_increase_ - -#ifndef _di_f_int64s_increase_by_ - f_status_t f_int64s_increase_by(const f_number_unsigned_t amount, f_int64s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_increase_by(amount, sizeof(int64_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_int64s_increase_by_ - -#ifndef _di_f_int64s_resize_ - f_status_t f_int64s_resize(const f_number_unsigned_t length, f_int64s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_resize(length, sizeof(int64_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_int64s_resize_ - -#ifndef _di_f_int64ss_adjust_ - f_status_t f_int64ss_adjust(const f_number_unsigned_t length, f_int64ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_int64ss_adjust(length, structure); - } -#endif // _di_f_int64ss_adjust_ - -#ifndef _di_f_int64ss_append_ - f_status_t f_int64ss_append(const f_int64s_t source, f_int64ss_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_int64s_t), (void **) &destination->array, &destination->used, &destination->size); - if (F_status_is_error(status)) return status; - - status = private_f_int64s_append_all(source, &destination->array[destination->used]); - if (F_status_is_error(status)) return status; - - ++destination->used; + { + f_int64s_t * const array = (f_int64s_t *) void_array; + f_status_t status = F_none; - return F_none; - } -#endif // _di_f_int64ss_append_ - -#ifndef _di_f_int64ss_append_all_ - f_status_t f_int64ss_append_all(const f_int64ss_t source, f_int64ss_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; + for (f_number_unsigned_t i = start; i < size; ++i) { - f_status_t status = f_memory_array_increase_by(source.used, sizeof(f_int64s_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_int64s_append_all(source.array[i], &destination->array[destination->used]); + status = f_memory_array_adjust(0, sizeof(int64_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; - } - } // for - - return F_none; - } -#endif // _di_f_int64ss_append_all_ - -#ifndef _di_f_int64ss_decimate_by_ - f_status_t f_int64ss_decimate_by(const f_number_unsigned_t amount, f_int64ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!amount) return F_data_not; - - return private_f_int64ss_adjust((structure->size - amount > 0) ? structure->size - amount : 0, structure); - } -#endif // _di_f_int64ss_decimate_by_ - -#ifndef _di_f_int64ss_decrease_by_ - f_status_t f_int64ss_decrease_by(const f_number_unsigned_t amount, f_int64ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!amount) return F_data_not; - - return private_f_int64ss_resize((structure->size - amount > 0) ? structure->size - amount : 0, structure); - } -#endif // _di_f_int64ss_decrease_by_ - -#ifndef _di_f_int64ss_increase_ - f_status_t f_int64ss_increase(const f_number_unsigned_t step, f_int64ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (step && structure->used + 1 > structure->size) { - if (structure->used >= F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); - - f_number_unsigned_t length = structure->used + step; - - if (length > F_number_t_size_unsigned_d) { - if (structure->used + 1 > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); - - length = F_number_t_size_unsigned_d; - } - - return private_f_int64ss_resize(length, structure); + } // for } - return F_data_not; + return F_none; } -#endif // _di_f_int64ss_increase_ - -#ifndef _di_f_int64ss_increase_by_ - f_status_t f_int64ss_increase_by(const f_number_unsigned_t amount, f_int64ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ +#endif // _di_f_int64s_adjust_callback_ - if (amount) { - if (structure->used >= F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); +#ifndef _di_f_int64s_resize_callback_ + f_status_t f_int64s_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const void_array) { - const f_number_unsigned_t length = structure->used + amount; + { + f_int64s_t * const array = (f_int64s_t *) void_array; + f_status_t status = F_none; - if (length > structure->size) { - if (length > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); + for (f_number_unsigned_t i = start; i < size; ++i) { - return private_f_int64ss_resize(structure->used + amount, structure); - } + status = f_memory_array_resize(0, sizeof(int64_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } // for } - return F_data_not; - } -#endif // _di_f_int64ss_increase_by_ - -#ifndef _di_f_int64ss_resize_ - f_status_t f_int64ss_resize(const f_number_unsigned_t length, f_int64ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_int64ss_resize(length, structure); + return F_none; } -#endif // _di_f_int64ss_resize_ +#endif // _di_f_int64s_resize_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/int64.h b/level_0/f_type_array/c/type_array/int64.h index 1ff2bd238..87b9b8fc5 100644 --- a/level_0/f_type_array/c/type_array/int64.h +++ b/level_0/f_type_array/c/type_array/int64.h @@ -17,275 +17,17 @@ extern "C" { #endif /** - * Resize the string int64s array. + * A callback intended to be passed to f_memory_arrays_adjust() for an f_int64ss_t structure. * - * @param length - * The new size to use. - * @param structure - * The string int64s array to resize. + * This does not do parameter checking. * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_adjust(). - * - * @see f_memory_array_adjust() - */ -#ifndef _di_f_int64s_adjust_ - extern f_status_t f_int64s_adjust(const f_number_unsigned_t length, f_int64s_t * const structure); -#endif // _di_f_int64s_adjust_ - -/** - * Append the single source int64 onto the destination. - * - * @param source - * The source int64 to append. - * @param destination - * The destination int64s the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase(). - * - * @see f_memory_array_increase() - */ -#ifndef _di_f_int64s_append_ - extern f_status_t f_int64s_append(const int64_t source, f_int64s_t * const destination); -#endif // _di_f_int64s_append_ - -/** - * Append the source int64s onto the destination. - * - * @param source - * The source int64s to append. - * @param destination - * The destination int64s the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_int64s_append_all_ - extern f_status_t f_int64s_append_all(const f_int64s_t source, f_int64s_t * const destination); -#endif // _di_f_int64s_append_all_ - -/** - * Resize the string int64s 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 structure - * The string int64s array to resize. - * - * @return - * F_none on success. - * F_data_not if amount is 0. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_decimate_by(). - * - * @see f_memory_array_decimate_by() - */ -#ifndef _di_f_int64s_decimate_by_ - extern f_status_t f_int64s_decimate_by(const f_number_unsigned_t amount, f_int64s_t * const structure); -#endif // _di_f_int64s_decimate_by_ - -/** - * Resize the string int64s 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 structure - * The string int64s array to resize. - * - * @return - * F_none on success. - * F_data_not if amount is 0. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_decrease_by(). - * - * @see f_memory_array_decrease_by() - */ -#ifndef _di_f_int64s_decrease_by_ - extern f_status_t f_int64s_decrease_by(const f_number_unsigned_t amount, f_int64s_t * const structure); -#endif // _di_f_int64s_decrease_by_ - -/** - * Increase the size of the string int64s 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 structure - * The string int64s array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_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_int64s_increase_ - extern f_status_t f_int64s_increase(const f_number_unsigned_t step, f_int64s_t * const structure); -#endif // _di_f_int64s_increase_ - -/** - * Resize the string int64s 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 structure - * The string int64s array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * 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_int64s_increase_by_ - extern f_status_t f_int64s_increase_by(const f_number_unsigned_t amount, f_int64s_t * const structure); -#endif // _di_f_int64s_increase_by_ - -/** - * Resize the string int64s array. - * - * @param length - * The new size to use. - * @param structure - * The string int64s array to adjust. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - */ -#ifndef _di_f_int64s_resize_ - extern f_status_t f_int64s_resize(const f_number_unsigned_t length, f_int64s_t * const structure); -#endif // _di_f_int64s_resize_ - -/** - * Resize the string int64ss array. - * - * @param length - * The new size to use. - * @param structure - * The string int64ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_adjust(). - * - * @see f_memory_array_adjust() - */ -#ifndef _di_f_int64ss_adjust_ - extern f_status_t f_int64ss_adjust(const f_number_unsigned_t length, f_int64ss_t * const structure); -#endif // _di_f_int64ss_adjust_ - -/** - * Append the single source int64s onto the destination. - * - * @param source - * The source int64s to append. - * @param destination - * The destination ranges the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase(). - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase() - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_int64ss_append_ - extern f_status_t f_int64ss_append(const f_int64s_t source, f_int64ss_t * const destination); -#endif // _di_f_int64ss_append_ - -/** - * Append the source int64ss onto the destination. - * - * @param source - * The source int64ss to append. - * @param destination - * The destination ranges the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_int64ss_append_all_ - extern f_status_t f_int64ss_append_all(const f_int64ss_t source, f_int64ss_t * const destination); -#endif // _di_f_int64ss_append_all_ - -/** - * Resize the string int64ss 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 structure - * The string int64ss array to resize. + * @param start + * The start position in the array to start deleting. + * @param stop + * The stop in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return * F_none on success. @@ -295,97 +37,24 @@ extern "C" { * Errors (with error bit) from: f_memory_array_adjust(). * * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() */ -#ifndef _di_f_int64ss_decimate_by_ - extern f_status_t f_int64ss_decimate_by(const f_number_unsigned_t amount, f_int64ss_t * const structure); -#endif // _di_f_int64ss_decimate_by_ - -/** - * Resize the string int64ss 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 structure - * The string int64ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - */ -#ifndef _di_f_int64ss_decrease_by_ - extern f_status_t f_int64ss_decrease_by(const f_number_unsigned_t amount, f_int64ss_t * const structure); -#endif // _di_f_int64ss_decrease_by_ +#ifndef _di_f_int64s_adjust_callback_ + extern f_status_t f_int64s_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array); +#endif // _di_f_int64s_adjust_callback_ /** - * Increase the size of the string int64ss 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. + * A callback intended to be passed to f_memory_arrays_resize() for an f_int64ss_t structure. * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param structure - * The string int64ss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_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_int64ss_increase_ - extern f_status_t f_int64ss_increase(const f_number_unsigned_t step, f_int64ss_t * const structure); -#endif // _di_f_int64ss_increase_ - -/** - * Resize the string int64ss 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 structure - * The string int64ss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * 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_int64ss_increase_by_ - extern f_status_t f_int64ss_increase_by(const f_number_unsigned_t amount, f_int64ss_t * const structure); -#endif // _di_f_int64ss_increase_by_ - -/** - * Resize the string int64ss array. + * This does not do parameter checking. * - * @param length - * The new size to use. - * @param structure - * The string int64ss array to adjust. + * @param start + * The start position in the array to start deleting. + * @param stop + * The stop in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return * F_none on success. @@ -395,10 +64,11 @@ extern "C" { * Errors (with error bit) from: f_memory_array_resize(). * * @see f_memory_array_resize() + * @see f_memory_arrays_resize() */ -#ifndef _di_f_int64ss_resize_ - extern f_status_t f_int64ss_resize(const f_number_unsigned_t length, f_int64ss_t * const structure); -#endif // _di_f_int64ss_resize_ +#ifndef _di_f_int64s_resize_callback_ + extern f_status_t f_int64s_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array); +#endif // _di_f_int64s_resize_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/int8.c b/level_0/f_type_array/c/type_array/int8.c index a74320f15..e362f1328 100644 --- a/level_0/f_type_array/c/type_array/int8.c +++ b/level_0/f_type_array/c/type_array/int8.c @@ -1,227 +1,45 @@ #include "../type_array.h" #include "int8.h" -#include "private-int8.h" #ifdef __cplusplus extern "C" { #endif -#ifndef _di_f_int8s_adjust_ - f_status_t f_int8s_adjust(const f_number_unsigned_t length, f_int8s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ +#ifndef _di_f_int8s_adjust_callback_ + f_status_t f_int8s_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const void_array) { - return f_memory_array_adjust(length, sizeof(int8_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_int8s_adjust_ - -#ifndef _di_f_int8s_append_ - f_status_t f_int8s_append(const int8_t source, f_int8s_t * const 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_int8s_append(source, destination); - } -#endif // _di_f_int8s_append_ - -#ifndef _di_f_int8s_append_all_ - f_status_t f_int8s_append_all(const f_int8s_t source, f_int8s_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_int8s_append_all(source, destination); - } -#endif // _di_f_int8s_append_all_ - -#ifndef _di_f_int8s_decimate_by_ - f_status_t f_int8s_decimate_by(const f_number_unsigned_t amount, f_int8s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_decimate_by(amount, sizeof(int8_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_int8s_decimate_by_ - -#ifndef _di_f_int8s_decrease_by_ - f_status_t f_int8s_decrease_by(const f_number_unsigned_t amount, f_int8s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_decrease_by(amount, sizeof(int8_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_int8s_decrease_by_ - -#ifndef _di_f_int8s_increase_ - f_status_t f_int8s_increase(const f_number_unsigned_t step, f_int8s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_increase(step, sizeof(int8_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_int8s_increase_ - -#ifndef _di_f_int8s_increase_by_ - f_status_t f_int8s_increase_by(const f_number_unsigned_t amount, f_int8s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_increase_by(amount, sizeof(int8_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_int8s_increase_by_ - -#ifndef _di_f_int8s_resize_ - f_status_t f_int8s_resize(const f_number_unsigned_t length, f_int8s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_resize(length, sizeof(int8_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_int8s_resize_ - -#ifndef _di_f_int8ss_adjust_ - f_status_t f_int8ss_adjust(const f_number_unsigned_t length, f_int8ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_int8ss_adjust(length, structure); - } -#endif // _di_f_int8ss_adjust_ - -#ifndef _di_f_int8ss_append_ - f_status_t f_int8ss_append(const f_int8s_t source, f_int8ss_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_int8s_t), (void **) &destination->array, &destination->used, &destination->size); - if (F_status_is_error(status)) return status; - - status = private_f_int8s_append_all(source, &destination->array[destination->used]); - if (F_status_is_error(status)) return status; - - ++destination->used; + { + f_int8s_t * const array = (f_int8s_t *) void_array; + f_status_t status = F_none; - return F_none; - } -#endif // _di_f_int8ss_append_ - -#ifndef _di_f_int8ss_append_all_ - f_status_t f_int8ss_append_all(const f_int8ss_t source, f_int8ss_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; + for (f_number_unsigned_t i = start; i < size; ++i) { - f_status_t status = f_memory_array_increase_by(source.used, sizeof(f_int8s_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_int8s_append_all(source.array[i], &destination->array[destination->used]); + status = f_memory_array_adjust(0, sizeof(int8_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; - } - } // for - - return F_none; - } -#endif // _di_f_int8ss_append_all_ - -#ifndef _di_f_int8ss_decimate_by_ - f_status_t f_int8ss_decimate_by(const f_number_unsigned_t amount, f_int8ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!amount) return F_data_not; - - return private_f_int8ss_adjust((structure->size - amount > 0) ? structure->size - amount : 0, structure); - } -#endif // _di_f_int8ss_decimate_by_ - -#ifndef _di_f_int8ss_decrease_by_ - f_status_t f_int8ss_decrease_by(const f_number_unsigned_t amount, f_int8ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!amount) return F_data_not; - - return private_f_int8ss_resize((structure->size - amount > 0) ? structure->size - amount : 0, structure); - } -#endif // _di_f_int8ss_decrease_by_ - -#ifndef _di_f_int8ss_increase_ - f_status_t f_int8ss_increase(const f_number_unsigned_t step, f_int8ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (step && structure->used + 1 > structure->size) { - if (structure->used >= F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); - - f_number_unsigned_t length = structure->used + step; - - if (length > F_number_t_size_unsigned_d) { - if (structure->used + 1 > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); - - length = F_number_t_size_unsigned_d; - } - - return private_f_int8ss_resize(length, structure); + } // for } - return F_data_not; + return F_none; } -#endif // _di_f_int8ss_increase_ - -#ifndef _di_f_int8ss_increase_by_ - f_status_t f_int8ss_increase_by(const f_number_unsigned_t amount, f_int8ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ +#endif // _di_f_int8s_adjust_callback_ - if (amount) { - if (structure->used >= F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); +#ifndef _di_f_int8s_resize_callback_ + f_status_t f_int8s_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const void_array) { - const f_number_unsigned_t length = structure->used + amount; + { + f_int8s_t * const array = (f_int8s_t *) void_array; + f_status_t status = F_none; - if (length > structure->size) { - if (length > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); + for (f_number_unsigned_t i = start; i < size; ++i) { - return private_f_int8ss_resize(structure->used + amount, structure); - } + status = f_memory_array_resize(0, sizeof(int8_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } // for } - return F_data_not; - } -#endif // _di_f_int8ss_increase_by_ - -#ifndef _di_f_int8ss_resize_ - f_status_t f_int8ss_resize(const f_number_unsigned_t length, f_int8ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_int8ss_resize(length, structure); + return F_none; } -#endif // _di_f_int8ss_resize_ +#endif // _di_f_int8s_resize_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/int8.h b/level_0/f_type_array/c/type_array/int8.h index 067ce1386..fc6f0ab92 100644 --- a/level_0/f_type_array/c/type_array/int8.h +++ b/level_0/f_type_array/c/type_array/int8.h @@ -17,275 +17,17 @@ extern "C" { #endif /** - * Resize the string int8s array. + * A callback intended to be passed to f_memory_arrays_adjust() for an f_int8ss_t structure. * - * @param length - * The new size to use. - * @param structure - * The string int8s array to resize. + * This does not do parameter checking. * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_adjust(). - * - * @see f_memory_array_adjust() - */ -#ifndef _di_f_int8s_adjust_ - extern f_status_t f_int8s_adjust(const f_number_unsigned_t length, f_int8s_t * const structure); -#endif // _di_f_int8s_adjust_ - -/** - * Append the single source int8 onto the destination. - * - * @param source - * The source int8 to append. - * @param destination - * The destination int8s the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase(). - * - * @see f_memory_array_increase() - */ -#ifndef _di_f_int8s_append_ - extern f_status_t f_int8s_append(const int8_t source, f_int8s_t * const destination); -#endif // _di_f_int8s_append_ - -/** - * Append the source int8s onto the destination. - * - * @param source - * The source int8s to append. - * @param destination - * The destination int8s the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_int8s_append_all_ - extern f_status_t f_int8s_append_all(const f_int8s_t source, f_int8s_t * const destination); -#endif // _di_f_int8s_append_all_ - -/** - * Resize the string int8s 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 structure - * The string int8s array to resize. - * - * @return - * F_none on success. - * F_data_not if amount is 0. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_decimate_by(). - * - * @see f_memory_array_decimate_by() - */ -#ifndef _di_f_int8s_decimate_by_ - extern f_status_t f_int8s_decimate_by(const f_number_unsigned_t amount, f_int8s_t * const structure); -#endif // _di_f_int8s_decimate_by_ - -/** - * Resize the string int8s 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 structure - * The string int8s array to resize. - * - * @return - * F_none on success. - * F_data_not if amount is 0. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_decrease_by(). - * - * @see f_memory_array_decrease_by() - */ -#ifndef _di_f_int8s_decrease_by_ - extern f_status_t f_int8s_decrease_by(const f_number_unsigned_t amount, f_int8s_t * const structure); -#endif // _di_f_int8s_decrease_by_ - -/** - * Increase the size of the string int8s 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 structure - * The string int8s array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_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_int8s_increase_ - extern f_status_t f_int8s_increase(const f_number_unsigned_t step, f_int8s_t * const structure); -#endif // _di_f_int8s_increase_ - -/** - * Resize the string int8s 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 structure - * The string int8s array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * 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_int8s_increase_by_ - extern f_status_t f_int8s_increase_by(const f_number_unsigned_t amount, f_int8s_t * const structure); -#endif // _di_f_int8s_increase_by_ - -/** - * Resize the string int8s array. - * - * @param length - * The new size to use. - * @param structure - * The string int8s array to adjust. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - */ -#ifndef _di_f_int8s_resize_ - extern f_status_t f_int8s_resize(const f_number_unsigned_t length, f_int8s_t * const structure); -#endif // _di_f_int8s_resize_ - -/** - * Resize the string int8ss array. - * - * @param length - * The new size to use. - * @param structure - * The string int8ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_adjust(). - * - * @see f_memory_array_adjust() - */ -#ifndef _di_f_int8ss_adjust_ - extern f_status_t f_int8ss_adjust(const f_number_unsigned_t length, f_int8ss_t * const structure); -#endif // _di_f_int8ss_adjust_ - -/** - * Append the single source int8s onto the destination. - * - * @param source - * The source int8s to append. - * @param destination - * The destination ranges the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase(). - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase() - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_int8ss_append_ - extern f_status_t f_int8ss_append(const f_int8s_t source, f_int8ss_t * const destination); -#endif // _di_f_int8ss_append_ - -/** - * Append the source int8ss onto the destination. - * - * @param source - * The source int8ss to append. - * @param destination - * The destination ranges the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_int8ss_append_all_ - extern f_status_t f_int8ss_append_all(const f_int8ss_t source, f_int8ss_t * const destination); -#endif // _di_f_int8ss_append_all_ - -/** - * Resize the string int8ss 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 structure - * The string int8ss array to resize. + * @param start + * The start position in the array to start deleting. + * @param stop + * The stop in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return * F_none on success. @@ -295,97 +37,24 @@ extern "C" { * Errors (with error bit) from: f_memory_array_adjust(). * * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() */ -#ifndef _di_f_int8ss_decimate_by_ - extern f_status_t f_int8ss_decimate_by(const f_number_unsigned_t amount, f_int8ss_t * const structure); -#endif // _di_f_int8ss_decimate_by_ - -/** - * Resize the string int8ss 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 structure - * The string int8ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - */ -#ifndef _di_f_int8ss_decrease_by_ - extern f_status_t f_int8ss_decrease_by(const f_number_unsigned_t amount, f_int8ss_t * const structure); -#endif // _di_f_int8ss_decrease_by_ +#ifndef _di_f_int8s_adjust_callback_ + extern f_status_t f_int8s_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array); +#endif // _di_f_int8s_adjust_callback_ /** - * Increase the size of the string int8ss 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. + * A callback intended to be passed to f_memory_arrays_resize() for an f_int8ss_t structure. * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param structure - * The string int8ss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_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_int8ss_increase_ - extern f_status_t f_int8ss_increase(const f_number_unsigned_t step, f_int8ss_t * const structure); -#endif // _di_f_int8ss_increase_ - -/** - * Resize the string int8ss 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 structure - * The string int8ss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * 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_int8ss_increase_by_ - extern f_status_t f_int8ss_increase_by(const f_number_unsigned_t amount, f_int8ss_t * const structure); -#endif // _di_f_int8ss_increase_by_ - -/** - * Resize the string int8ss array. + * This does not do parameter checking. * - * @param length - * The new size to use. - * @param structure - * The string int8ss array to adjust. + * @param start + * The start position in the array to start deleting. + * @param stop + * The stop in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return * F_none on success. @@ -395,10 +64,11 @@ extern "C" { * Errors (with error bit) from: f_memory_array_resize(). * * @see f_memory_array_resize() + * @see f_memory_arrays_resize() */ -#ifndef _di_f_int8ss_resize_ - extern f_status_t f_int8ss_resize(const f_number_unsigned_t length, f_int8ss_t * const structure); -#endif // _di_f_int8ss_resize_ +#ifndef _di_f_int8s_resize_callback_ + extern f_status_t f_int8s_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array); +#endif // _di_f_int8s_resize_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/number_unsigned.c b/level_0/f_type_array/c/type_array/number_unsigned.c index 6e99cebce..966a6cf41 100644 --- a/level_0/f_type_array/c/type_array/number_unsigned.c +++ b/level_0/f_type_array/c/type_array/number_unsigned.c @@ -5,264 +5,41 @@ extern "C" { #endif -#ifndef _di_f_number_unsigneds_append_ - f_status_t f_number_unsigneds_append(const f_number_unsigned_t source, f_number_unsigneds_t * const destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_append((const void *) &source, sizeof(f_number_unsigned_t), (void **) &destination->array, &destination->used, &destination->size); - } -#endif // _di_f_number_unsigneds_append_ - -#ifndef _di_f_number_unsigneds_append_all_ - f_status_t f_number_unsigneds_append_all(const f_number_unsigneds_t source, f_number_unsigneds_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 f_memory_array_append_all((const void *) &source.array, source.used, sizeof(f_number_unsigned_t), (void **) &destination->array, &destination->used, &destination->size); - } -#endif // _di_f_number_unsigneds_append_all_ - -#ifndef _di_f_number_unsigneds_decimate_by_ - f_status_t f_number_unsigneds_decimate_by(const f_number_unsigned_t amount, f_number_unsigneds_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_decimate_by(amount, sizeof(f_number_unsigned_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_number_unsigneds_decimate_by_ - -#ifndef _di_f_number_unsigneds_decrease_by_ - f_status_t f_number_unsigneds_decrease_by(const f_number_unsigned_t amount, f_number_unsigneds_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_decrease_by(amount, sizeof(f_number_unsigned_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_number_unsigneds_decrease_by_ - -#ifndef _di_f_number_unsigneds_increase_ - f_status_t f_number_unsigneds_increase(const f_number_unsigned_t step, f_number_unsigneds_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_increase(step, sizeof(f_number_unsigned_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_number_unsigneds_increase_ - -#ifndef _di_f_number_unsigneds_increase_by_ - f_status_t f_number_unsigneds_increase_by(const f_number_unsigned_t amount, f_number_unsigneds_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_increase_by(amount, sizeof(f_number_unsigned_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_number_unsigneds_increase_by_ - -#ifndef _di_f_number_unsignedss_adjust_ - f_status_t f_number_unsignedss_adjust(const f_number_unsigned_t length, f_number_unsignedss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = f_memory_array_adjust(0, sizeof(f_number_unsigned_t), (void **) &structure->array[i].array, &structure->array[i].used, &structure->array[i].size); - if (F_status_is_error(status)) return status; - } // for - - return f_memory_array_adjust(length, sizeof(f_number_unsigneds_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_number_unsignedss_adjust_ - -#ifndef _di_f_number_unsignedss_append_ - f_status_t f_number_unsignedss_append(const f_number_unsigneds_t source, f_number_unsignedss_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_number_unsigneds_t), (void **) &destination->array, &destination->used, &destination->size); - if (F_status_is_error(status)) return status; - - status = f_memory_array_append_all((const void *) &source.array, source.used, sizeof(f_number_unsigned_t), (void **) &destination->array[destination->used].array, &destination->array[destination->used].used, &destination->array[destination->used].size); - if (F_status_is_error(status)) return status; - - ++destination->used; - - return F_none; - } -#endif // _di_f_number_unsignedss_append_ - -#ifndef _di_f_number_unsignedss_append_all_ - f_status_t f_number_unsignedss_append_all(const f_number_unsignedss_t source, f_number_unsignedss_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_number_unsigneds_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 = f_memory_array_append_all((const void *) &source.array[i].array, source.array[i].used, sizeof(f_number_unsigned_t), (void **) &destination->array[destination->used].array, &destination->array[destination->used].used, &destination->array[destination->used].size); - if (F_status_is_error(status)) return status; - } - } // for - - return F_none; - } -#endif // _di_f_number_unsignedss_append_all_ - -#ifndef _di_f_number_unsignedss_decimate_by_ - f_status_t f_number_unsignedss_decimate_by(const f_number_unsigned_t amount, f_number_unsignedss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!amount) return F_data_not; - - const f_number_unsigned_t length = (structure->size - amount > 0) ? structure->size - amount : 0; +#ifndef _di_f_number_unsigneds_adjust_callback_ + f_status_t f_number_unsigneds_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const void_array) { { + f_number_unsigneds_t * const array = (f_number_unsigneds_t *) void_array; f_status_t status = F_none; - for (f_number_unsigned_t i = length; i < structure->size; ++i) { + for (f_number_unsigned_t i = start; i < size; ++i) { - status = f_memory_array_adjust(0, sizeof(f_number_unsigned_t), (void **) &structure->array[i].array, &structure->array[i].used, &structure->array[i].size); + status = f_memory_array_adjust(0, sizeof(f_number_unsigned_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } // for } - return f_memory_array_adjust(length, sizeof(f_number_unsigneds_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_number_unsignedss_decimate_by_ - -#ifndef _di_f_number_unsignedss_decrease_by_ - f_status_t f_number_unsignedss_decrease_by(const f_number_unsigned_t amount, f_number_unsignedss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!amount) return F_data_not; - - const f_number_unsigned_t length = (structure->size - amount > 0) ? structure->size - amount : 0; - - { - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &structure->array[i].array, &structure->array[i].used, &structure->array[i].size); - if (F_status_is_error(status)) return status; - } // for - } - - return f_memory_array_resize(length, sizeof(f_number_unsigneds_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_number_unsignedss_decrease_by_ - -#ifndef _di_f_number_unsignedss_increase_ - f_status_t f_number_unsignedss_increase(const f_number_unsigned_t step, f_number_unsignedss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (step && structure->used + 1 > structure->size) { - if (structure->used >= F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); - - f_number_unsigned_t length = structure->used + step; - - if (length > F_number_t_size_unsigned_d) { - if (structure->used + 1 > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); - - length = F_number_t_size_unsigned_d; - } - - { - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &structure->array[i].array, &structure->array[i].used, &structure->array[i].size); - if (F_status_is_error(status)) return status; - } // for - } - - return f_memory_array_resize(length, sizeof(f_number_unsigneds_t), (void **) &structure->array, &structure->used, &structure->size); - } - - return F_data_not; - } -#endif // _di_f_number_unsignedss_increase_ - -#ifndef _di_f_number_unsignedss_increase_by_ - f_status_t f_number_unsignedss_increase_by(const f_number_unsigned_t amount, f_number_unsignedss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (amount) { - if (structure->used >= F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); - - const f_number_unsigned_t length = structure->used + amount; - - if (length > structure->size) { - if (length > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); - - { - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &structure->array[i].array, &structure->array[i].used, &structure->array[i].size); - if (F_status_is_error(status)) return status; - } // for - } - - return f_memory_array_resize(length, sizeof(f_number_unsigneds_t), (void **) &structure->array, &structure->used, &structure->size); - } - } - - return F_data_not; + return F_none; } -#endif // _di_f_number_unsignedss_increase_by_ +#endif // _di_f_number_unsigneds_adjust_callback_ -#ifndef _di_f_number_unsignedss_resize_ - f_status_t f_number_unsignedss_resize(const f_number_unsigned_t length, f_number_unsignedss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ +#ifndef _di_f_number_unsigneds_resize_callback_ + f_status_t f_number_unsigneds_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const void_array) { { + f_number_unsigneds_t * const array = (f_number_unsigneds_t *) void_array; f_status_t status = F_none; - for (f_number_unsigned_t i = length; i < structure->size; ++i) { + for (f_number_unsigned_t i = start; i < size; ++i) { - status = f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &structure->array[i].array, &structure->array[i].used, &structure->array[i].size); + status = f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } // for } - return f_memory_array_resize(length, sizeof(f_number_unsigneds_t), (void **) &structure->array, &structure->used, &structure->size); + return F_none; } -#endif // _di_f_number_unsignedss_resize_ +#endif // _di_f_number_unsigneds_resize_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/number_unsigned.h b/level_0/f_type_array/c/type_array/number_unsigned.h index a93e8f8ff..99ac11ec1 100644 --- a/level_0/f_type_array/c/type_array/number_unsigned.h +++ b/level_0/f_type_array/c/type_array/number_unsigned.h @@ -17,233 +17,17 @@ extern "C" { #endif /** - * Append the single source number_unsigned onto the destination. + * A callback intended to be passed to f_memory_arrays_adjust() for an f_number_unsignedss_t structure. * - * @param source - * The source number_unsigned to append. - * @param destination - * The destination number_unsigneds the source is appended onto. + * This does not do parameter checking. * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase(). - * - * @see f_memory_array_increase() - */ -#ifndef _di_f_number_unsigneds_append_ - extern f_status_t f_number_unsigneds_append(const f_number_unsigned_t source, f_number_unsigneds_t * const destination); -#endif // _di_f_number_unsigneds_append_ - -/** - * Append the source number_unsigneds onto the destination. - * - * @param source - * The source number_unsigneds to append. - * @param destination - * The destination number_unsigneds the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_number_unsigneds_append_all_ - extern f_status_t f_number_unsigneds_append_all(const f_number_unsigneds_t source, f_number_unsigneds_t * const destination); -#endif // _di_f_number_unsigneds_append_all_ - -/** - * Resize the string number_unsigneds 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 structure - * The string number_unsigneds array to resize. - * - * @return - * F_none on success. - * F_data_not if amount is 0. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_decimate_by(). - * - * @see f_memory_array_decimate_by() - */ -#ifndef _di_f_number_unsigneds_decimate_by_ - extern f_status_t f_number_unsigneds_decimate_by(const f_number_unsigned_t amount, f_number_unsigneds_t * const structure); -#endif // _di_f_number_unsigneds_decimate_by_ - -/** - * Resize the string number_unsigneds 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 structure - * The string number_unsigneds array to resize. - * - * @return - * F_none on success. - * F_data_not if amount is 0. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_decrease_by(). - * - * @see f_memory_array_decrease_by() - */ -#ifndef _di_f_number_unsigneds_decrease_by_ - extern f_status_t f_number_unsigneds_decrease_by(const f_number_unsigned_t amount, f_number_unsigneds_t * const structure); -#endif // _di_f_number_unsigneds_decrease_by_ - -/** - * Increase the size of the string number_unsigneds 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 structure - * The string number_unsigneds array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_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_number_unsigneds_increase_ - extern f_status_t f_number_unsigneds_increase(const f_number_unsigned_t step, f_number_unsigneds_t * const structure); -#endif // _di_f_number_unsigneds_increase_ - -/** - * Resize the string number_unsigneds 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 structure - * The string number_unsigneds array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * 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_number_unsigneds_increase_by_ - extern f_status_t f_number_unsigneds_increase_by(const f_number_unsigned_t amount, f_number_unsigneds_t * const structure); -#endif // _di_f_number_unsigneds_increase_by_ - -/** - * Resize the string number_unsignedss array. - * - * @param length - * The new size to use. - * @param structure - * The string number_unsignedss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_adjust(). - * - * @see f_memory_array_adjust() - */ -#ifndef _di_f_number_unsignedss_adjust_ - extern f_status_t f_number_unsignedss_adjust(const f_number_unsigned_t length, f_number_unsignedss_t * const structure); -#endif // _di_f_number_unsignedss_adjust_ - -/** - * Append the single source number_unsigneds onto the destination. - * - * @param source - * The source number_unsigneds to append. - * @param destination - * The destination ranges the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase(). - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase() - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_number_unsignedss_append_ - extern f_status_t f_number_unsignedss_append(const f_number_unsigneds_t source, f_number_unsignedss_t * const destination); -#endif // _di_f_number_unsignedss_append_ - -/** - * Append the source number_unsignedss onto the destination. - * - * @param source - * The source number_unsignedss to append. - * @param destination - * The destination ranges the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_number_unsignedss_append_all_ - extern f_status_t f_number_unsignedss_append_all(const f_number_unsignedss_t source, f_number_unsignedss_t * const destination); -#endif // _di_f_number_unsignedss_append_all_ - -/** - * Resize the string number_unsignedss 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 structure - * The string number_unsignedss array to resize. + * @param start + * The start position in the array to start deleting. + * @param stop + * The stop in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return * F_none on success. @@ -253,97 +37,24 @@ extern "C" { * Errors (with error bit) from: f_memory_array_adjust(). * * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() */ -#ifndef _di_f_number_unsignedss_decimate_by_ - extern f_status_t f_number_unsignedss_decimate_by(const f_number_unsigned_t amount, f_number_unsignedss_t * const structure); -#endif // _di_f_number_unsignedss_decimate_by_ +#ifndef _di_f_number_unsigneds_adjust_callback_ + extern f_status_t f_number_unsigneds_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array); +#endif // _di_f_number_unsigneds_adjust_callback_ /** - * Resize the string number_unsignedss 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 structure - * The string number_unsignedss array to resize. - * - * @return - * F_none on success. + * A callback intended to be passed to f_memory_arrays_resize() for an f_number_unsignedss_t structure. * - * 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_number_unsignedss_decrease_by_ - extern f_status_t f_number_unsignedss_decrease_by(const f_number_unsigned_t amount, f_number_unsignedss_t * const structure); -#endif // _di_f_number_unsignedss_decrease_by_ - -/** - * Increase the size of the string number_unsignedss 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 structure - * The string number_unsignedss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_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_number_unsignedss_increase_ - extern f_status_t f_number_unsignedss_increase(const f_number_unsigned_t step, f_number_unsignedss_t * const structure); -#endif // _di_f_number_unsignedss_increase_ - -/** - * Resize the string number_unsignedss 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 structure - * The string number_unsignedss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * 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_number_unsignedss_increase_by_ - extern f_status_t f_number_unsignedss_increase_by(const f_number_unsigned_t amount, f_number_unsignedss_t * const structure); -#endif // _di_f_number_unsignedss_increase_by_ - -/** - * Resize the string number_unsignedss array. + * This does not do parameter checking. * - * @param length - * The new size to use. - * @param structure - * The string number_unsignedss array to adjust. + * @param start + * The start position in the array to start deleting. + * @param stop + * The stop in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return * F_none on success. @@ -353,10 +64,11 @@ extern "C" { * Errors (with error bit) from: f_memory_array_resize(). * * @see f_memory_array_resize() + * @see f_memory_arrays_resize() */ -#ifndef _di_f_number_unsignedss_resize_ - extern f_status_t f_number_unsignedss_resize(const f_number_unsigned_t length, f_number_unsignedss_t * const structure); -#endif // _di_f_number_unsignedss_resize_ +#ifndef _di_f_number_unsigneds_resize_callback_ + extern f_status_t f_number_unsigneds_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array); +#endif // _di_f_number_unsigneds_resize_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/private-cell.c b/level_0/f_type_array/c/type_array/private-cell.c deleted file mode 100644 index d1209b599..000000000 --- a/level_0/f_type_array/c/type_array/private-cell.c +++ /dev/null @@ -1,72 +0,0 @@ -#include "../type_array.h" -#include "private-cell.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#if !defined(_di_f_cells_append_) || !defined(_di_f_cellss_append_) - extern f_status_t private_f_cells_append(const f_cell_t source, f_cells_t * const destination) { - - { - const f_status_t status = f_memory_array_increase(F_memory_default_allocation_small_d, sizeof(f_cell_t), (void **) &destination->array, &destination->used, &destination->size); - if (F_status_is_error(status)) return status; - } - - destination->array[destination->used++] = source; - - return F_none; - } -#endif // !defined(_di_f_cells_append_) || !defined(_di_f_cellss_append_) - -#if !defined(_di_f_cells_append_) || !defined(_di_f_cells_append_all_) || !defined(_di_f_cellss_append_all_) - extern f_status_t private_f_cells_append_all(const f_cells_t source, f_cells_t * const destination) { - - { - const f_status_t status = f_memory_array_increase_by(source.used, sizeof(f_cell_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].row = source.array[i].row; - destination->array[destination->used++].column = source.array[i].column; - } // for - - return F_none; - } -#endif // !defined(_di_f_cells_append_) || !defined(_di_f_cells_append_all_) || !defined(_di_f_cellss_append_all_) - -#if !defined(_di_f_cellss_adjust_) || !defined(_di_f_cellss_decimate_by_) - f_status_t private_f_cellss_adjust(const f_number_unsigned_t length, f_cellss_t * const structure) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = f_memory_array_adjust(0, sizeof(f_cell_t), (void **) &structure->array[i].array, &structure->array[i].used, &structure->array[i].size); - if (F_status_is_error(status)) return status; - } // for - - return f_memory_array_adjust(length, sizeof(f_cells_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // !defined(_di_f_cellss_adjust_) || !defined(_di_f_cellss_decimate_by_) - -#if !defined(_di_f_cellss_decrease_by_) || !defined(_di_f_cellss_increase_) || !defined(_di_f_cellss_increase_by_) || !defined(_di_f_cellss_resize_) - f_status_t private_f_cellss_resize(const f_number_unsigned_t length, f_cellss_t * const structure) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = f_memory_array_resize(0, sizeof(f_cell_t), (void **) &structure->array[i].array, &structure->array[i].used, &structure->array[i].size); - if (F_status_is_error(status)) return status; - } // for - - return f_memory_array_resize(length, sizeof(f_cells_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // !defined(_di_f_cellss_decrease_by_) || !defined(_di_f_cellss_increase_) || !defined(_di_f_cellss_increase_by_) || !defined(_di_f_cellss_resize_) - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/c/type_array/private-cell.h b/level_0/f_type_array/c/type_array/private-cell.h deleted file mode 100644 index fd1550622..000000000 --- a/level_0/f_type_array/c/type_array/private-cell.h +++ /dev/null @@ -1,131 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * 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_type_array_cell_h -#define _PRIVATE_F_type_array_cell_h - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Private implementation for appending the cell array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param source - * The source cell to append. - * @param destination - * The destination lengths the source is appended onto. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_array_increase(). - * - * @see f_memory_array_increase() - * - * @see f_cells_append() - * @see f_cellss_append() - */ -#if !defined(_di_f_cells_append_) || !defined(_di_f_cellss_append_) - extern f_status_t private_f_cells_append(const f_cell_t source, f_cells_t * const destination) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_cells_append_) || !defined(_di_f_cellss_append_) - -/** - * Private implementation for appending the cell array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param source - * The source cells to append. - * @param destination - * The destination lengths the source is appended onto. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - * - * @see f_cells_append_all() - * @see f_cellss_append() - * @see f_cellss_append_all() - */ -#if !defined(_di_f_cells_append_) || !defined(_di_f_cells_append_all_) || !defined(_di_f_cellss_append_all_) - extern f_status_t private_f_cells_append_all(const f_cells_t source, f_cells_t * const destination) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_cells_append_) || !defined(_di_f_cells_append_all_) || !defined(_di_f_cellss_append_all_) - -/** - * Private implementation for resizing the cellss array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The length to adjust to. - * @param structure - * The cellss array to adjust. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if 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_cellss_adjust() - * @see f_cellss_decimate_by() - */ -#if !defined(_di_f_cellss_adjust_) || !defined(_di_f_cellss_decimate_by_) - extern f_status_t private_f_cellss_adjust(const f_number_unsigned_t length, f_cellss_t * const structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_cellss_adjust_) || !defined(_di_f_cellss_decimate_by_) - -/** - * Private implementation for resizing the cellss array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The length to resize to. - * @param structure - * The cellss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if 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_cellss_decrease_by() - * @see f_cellss_increase() - * @see f_cellss_increase_by() - * @see f_cellss_resize() - */ -#if !defined(_di_f_cellss_decrease_by_) || !defined(_di_f_cellss_increase_) || !defined(_di_f_cellss_increase_by_) || !defined(_di_f_cellss_resize_) - extern f_status_t private_f_cellss_resize(const f_number_unsigned_t length, f_cellss_t * const structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_cellss_decrease_by_) || !defined(_di_f_cellss_increase_) || !defined(_di_f_cellss_increase_by_) || !defined(_di_f_cellss_resize_) - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_F_type_array_cell_h diff --git a/level_0/f_type_array/c/type_array/private-file.c b/level_0/f_type_array/c/type_array/private-file.c deleted file mode 100644 index 5aacf0c68..000000000 --- a/level_0/f_type_array/c/type_array/private-file.c +++ /dev/null @@ -1,71 +0,0 @@ -#include "../type_array.h" -#include "../type_array_file.h" -#include "private-file.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#if !defined(_di_f_files_append_) || !defined(_di_f_filess_append_) - extern f_status_t private_f_files_append(const f_file_t source, f_files_t * const destination) { - - { - const f_status_t status = f_memory_array_increase(F_memory_default_allocation_small_d, sizeof(f_file_t), (void **) &destination->array, &destination->used, &destination->size); - if (F_status_is_error(status)) return status; - } - - destination->array[destination->used++] = source; - - return F_none; - } -#endif // !defined(_di_f_files_append_) || !defined(_di_f_filess_append_) - -#if !defined(_di_f_files_append_) || !defined(_di_f_files_append_all_) || !defined(_di_f_filess_append_all_) - extern f_status_t private_f_files_append_all(const f_files_t source, f_files_t * const destination) { - - { - const f_status_t status = f_memory_array_increase_by(source.used, sizeof(f_file_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_none; - } -#endif // !defined(_di_f_files_append_) || !defined(_di_f_files_append_all_) || !defined(_di_f_filess_append_all_) - -#if !defined(_di_f_filess_adjust_) || !defined(_di_f_filess_decimate_by_) - f_status_t private_f_filess_adjust(const f_number_unsigned_t length, f_filess_t * const structure) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = f_memory_array_adjust(0, sizeof(f_file_t), (void **) &structure->array[i].array, &structure->array[i].used, &structure->array[i].size); - if (F_status_is_error(status)) return status; - } // for - - return f_memory_array_adjust(length, sizeof(f_files_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // !defined(_di_f_filess_adjust_) || !defined(_di_f_filess_decimate_by_) - -#if !defined(_di_f_filess_decrease_by_) || !defined(_di_f_filess_increase_) || !defined(_di_f_filess_increase_by_) || !defined(_di_f_filess_resize_) - f_status_t private_f_filess_resize(const f_number_unsigned_t length, f_filess_t * const structure) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = f_memory_array_resize(0, sizeof(f_file_t), (void **) &structure->array[i].array, &structure->array[i].used, &structure->array[i].size); - if (F_status_is_error(status)) return status; - } // for - - return f_memory_array_resize(length, sizeof(f_files_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // !defined(_di_f_filess_decrease_by_) || !defined(_di_f_filess_increase_) || !defined(_di_f_filess_increase_by_) || !defined(_di_f_filess_resize_) - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/c/type_array/private-file.h b/level_0/f_type_array/c/type_array/private-file.h deleted file mode 100644 index a9fcf2fc9..000000000 --- a/level_0/f_type_array/c/type_array/private-file.h +++ /dev/null @@ -1,183 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * 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_type_array_file_h -#define _PRIVATE_F_type_array_file_h - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Private implementation for resizing the files array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The length to adjust to. - * @param structure - * The files array to adjust. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * Errors (with error bit) from: f_memory_array_increase(). - * - * @see f_memory_array_increase() - * - * @see f_files_adjust() - * @see f_files_decimate_by() - */ -#if !defined(_di_f_files_adjust_) || !defined(_di_f_files_decimate_by_) - extern f_status_t private_f_files_adjust(const f_number_unsigned_t length, f_files_t * const structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_files_adjust_) || !defined(_di_f_files_decimate_by_) - -/** - * Private implementation for appending the file array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param source - * The source file to append. - * @param destination - * The destination lengths the source is appended onto. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_array_increase(). - * - * @see f_memory_array_increase() - * - * @see f_files_append() - * @see f_filess_append() - */ -#if !defined(_di_f_files_append_) || !defined(_di_f_filess_append_) - extern f_status_t private_f_files_append(const f_file_t source, f_files_t * const destination) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_files_append_) || !defined(_di_f_filess_append_) - -/** - * Private implementation for appending the file array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param source - * The source files to append. - * @param destination - * The destination lengths the source is appended onto. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_resize(). - * - * @see f_memory_resize() - * @see f_files_append_all() - * @see f_filess_append() - * @see f_filess_append_all() - */ -#if !defined(_di_f_files_append_) || !defined(_di_f_files_append_all_) || !defined(_di_f_filess_append_all_) - extern f_status_t private_f_files_append_all(const f_files_t source, f_files_t * const destination) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_files_append_) || !defined(_di_f_files_append_all_) || !defined(_di_f_filess_append_all_) - -/** - * Private implementation for resizing the files array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The length to adjust to. - * @param structure - * The files array to adjust. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * Errors (with error bit) from: f_memory_resize(). - * - * @see f_files_append() - * @see f_files_append_all() - * @see f_files_decrease_by() - * @see f_files_increase() - * @see f_files_increase_by() - * @see f_files_resize() - * @see f_filess_append() - * @see f_filess_append_all() - * - */ -#if !defined(_di_f_files_append_) || !defined(_di_f_files_append_all_) || !defined(_di_f_files_decrease_by_) || !defined(_di_f_files_increase_) || !defined(_di_f_files_increase_by_) || !defined(_di_f_files_resize_) || !defined(_di_f_filess_append_) || !defined(_di_f_filess_append_all_) - extern f_status_t private_f_files_resize(const f_number_unsigned_t length, f_files_t * const structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_files_append_) || !defined(_di_f_files_append_all_) || !defined(_di_f_files_decrease_by_) || !defined(_di_f_files_increase_) || !defined(_di_f_files_increase_by_) || !defined(_di_f_files_resize_) || !defined(_di_f_filess_append_) || !defined(_di_f_filess_append_all_) - -/** - * Private implementation for resizing the filess array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The length to adjust to. - * @param structure - * The filess array to adjust. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if 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_adjust(). - * Errors (with error bit) from: f_memory_destroy(). - * - * @see f_filess_adjust() - * @see f_filess_decimate_by() - */ -#if !defined(_di_f_filess_adjust_) || !defined(_di_f_filess_decimate_by_) - extern f_status_t private_f_filess_adjust(const f_number_unsigned_t length, f_filess_t * const structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_filess_adjust_) || !defined(_di_f_filess_decimate_by_) - -/** - * Private implementation for resizing the filess array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The length to resize to. - * @param structure - * The filess array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if 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_delete(). - * Errors (with error bit) from: f_memory_resize(). - * - * @see f_filess_decrease_by() - * @see f_filess_increase() - * @see f_filess_increase_by() - * @see f_filess_resize() - */ -#if !defined(_di_f_filess_decrease_by_) || !defined(_di_f_filess_increase_) || !defined(_di_f_filess_increase_by_) || !defined(_di_f_filess_resize_) - extern f_status_t private_f_filess_resize(const f_number_unsigned_t length, f_filess_t * const structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_filess_decrease_by_) || !defined(_di_f_filess_increase_) || !defined(_di_f_filess_increase_by_) || !defined(_di_f_filess_resize_) - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_F_type_array_file_h diff --git a/level_0/f_type_array/c/type_array/private-fll_id.c b/level_0/f_type_array/c/type_array/private-fll_id.c deleted file mode 100644 index 0590c0880..000000000 --- a/level_0/f_type_array/c/type_array/private-fll_id.c +++ /dev/null @@ -1,77 +0,0 @@ -#include "../type_array.h" -#include "private-fll_id.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#if !defined(_di_f_fll_ids_append_) || !defined(_di_f_fll_idss_append_) - extern f_status_t private_f_fll_ids_append(const f_fll_id_t source, f_fll_ids_t * const destination) { - - { - const f_status_t status = f_memory_array_increase(F_memory_default_allocation_small_d, sizeof(f_fll_id_t), (void **) &destination->array, &destination->used, &destination->size); - if (F_status_is_error(status)) return status; - } - - memcpy(destination->array[destination->used].name, source.name, sizeof(char) * f_fll_id_name_length_d); - - destination->array[destination->used].type = source.type; - destination->array[destination->used++].used = source.used; - - return F_none; - } -#endif // !defined(_di_f_fll_ids_append_) || !defined(_di_f_fll_idss_append_) - -#if !defined(_di_f_fll_ids_append_) || !defined(_di_f_fll_ids_append_all_) || !defined(_di_f_fll_idss_append_all_) - extern f_status_t private_f_fll_ids_append_all(const f_fll_ids_t source, f_fll_ids_t * const destination) { - - { - const f_status_t status = f_memory_array_increase_by(source.used, sizeof(f_fll_id_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) { - - memcpy(destination->array[destination->used].name, source.array[i].name, sizeof(char) * f_fll_id_name_length_d); - - destination->array[destination->used].type = source.array[i].type; - destination->array[destination->used++].used = source.array[i].used; - } // for - - return F_none; - } -#endif // !defined(_di_f_fll_ids_append_) || !defined(_di_f_fll_ids_append_all_) || !defined(_di_f_fll_idss_append_all_) - -#if !defined(_di_f_fll_idss_adjust_) || !defined(_di_f_fll_idss_decimate_by_) - f_status_t private_f_fll_idss_adjust(const f_number_unsigned_t length, f_fll_idss_t * const structure) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = f_memory_array_adjust(0, sizeof(f_fll_id_t), (void **) &structure->array[i].array, &structure->array[i].used, &structure->array[i].size); - if (F_status_is_error(status)) return status; - } // for - - return f_memory_array_adjust(length, sizeof(f_fll_ids_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // !defined(_di_f_fll_idss_adjust_) || !defined(_di_f_fll_idss_decimate_by_) - -#if !defined(_di_f_fll_idss_decrease_by_) || !defined(_di_f_fll_idss_increase_) || !defined(_di_f_fll_idss_increase_by_) || !defined(_di_f_fll_idss_resize_) - f_status_t private_f_fll_idss_resize(const f_number_unsigned_t length, f_fll_idss_t * const structure) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = f_memory_array_resize(0, sizeof(f_fll_id_t), (void **) &structure->array[i].array, &structure->array[i].used, &structure->array[i].size); - if (F_status_is_error(status)) return status; - } // for - - return f_memory_array_resize(length, sizeof(f_fll_ids_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // !defined(_di_f_fll_idss_decrease_by_) || !defined(_di_f_fll_idss_increase_) || !defined(_di_f_fll_idss_increase_by_) || !defined(_di_f_fll_idss_resize_) - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/c/type_array/private-fll_id.h b/level_0/f_type_array/c/type_array/private-fll_id.h deleted file mode 100644 index 37f8aee22..000000000 --- a/level_0/f_type_array/c/type_array/private-fll_id.h +++ /dev/null @@ -1,131 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * 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_type_array_cell_h -#define _PRIVATE_F_type_array_cell_h - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Private implementation for appending the fll_id array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param source - * The source fll_id to append. - * @param destination - * The destination lengths the source is appended onto. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_array_increase(). - * - * @see f_memory_array_increase() - * - * @see f_fll_ids_append() - * @see f_fll_idss_append() - */ -#if !defined(_di_f_fll_ids_append_) || !defined(_di_f_fll_idss_append_) - extern f_status_t private_f_fll_ids_append(const f_fll_id_t source, f_fll_ids_t * const destination) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_fll_ids_append_) || !defined(_di_f_fll_idss_append_) - -/** - * Private implementation for appending the fll_id array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param source - * The source fll_ids to append. - * @param destination - * The destination lengths the source is appended onto. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - * - * @see f_fll_ids_append_all() - * @see f_fll_idss_append() - * @see f_fll_idss_append_all() - */ -#if !defined(_di_f_fll_ids_append_) || !defined(_di_f_fll_ids_append_all_) || !defined(_di_f_fll_idss_append_all_) - extern f_status_t private_f_fll_ids_append_all(const f_fll_ids_t source, f_fll_ids_t * const destination) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_fll_ids_append_) || !defined(_di_f_fll_ids_append_all_) || !defined(_di_f_fll_idss_append_all_) - -/** - * Private implementation for resizing the fll_idss array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The length to adjust to. - * @param structure - * The fll_idss array to adjust. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if 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_fll_idss_adjust() - * @see f_fll_idss_decimate_by() - */ -#if !defined(_di_f_fll_idss_adjust_) || !defined(_di_f_fll_idss_decimate_by_) - extern f_status_t private_f_fll_idss_adjust(const f_number_unsigned_t length, f_fll_idss_t * const structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_fll_idss_adjust_) || !defined(_di_f_fll_idss_decimate_by_) - -/** - * Private implementation for resizing the fll_idss array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The length to resize to. - * @param structure - * The fll_idss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if 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_fll_idss_decrease_by() - * @see f_fll_idss_increase() - * @see f_fll_idss_increase_by() - * @see f_fll_idss_resize() - */ -#if !defined(_di_f_fll_idss_decrease_by_) || !defined(_di_f_fll_idss_increase_) || !defined(_di_f_fll_idss_increase_by_) || !defined(_di_f_fll_idss_resize_) - extern f_status_t private_f_fll_idss_resize(const f_number_unsigned_t length, f_fll_idss_t * const structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_fll_idss_decrease_by_) || !defined(_di_f_fll_idss_increase_) || !defined(_di_f_fll_idss_increase_by_) || !defined(_di_f_fll_idss_resize_) - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_F_type_array_cell_h diff --git a/level_0/f_type_array/c/type_array/private-int128.c b/level_0/f_type_array/c/type_array/private-int128.c deleted file mode 100644 index 599c93b65..000000000 --- a/level_0/f_type_array/c/type_array/private-int128.c +++ /dev/null @@ -1,70 +0,0 @@ -#include "../type_array.h" -#include "private-int128.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#if !defined(_di_f_int128s_append_) || !defined(_di_f_int128ss_append_) - extern f_status_t private_f_int128s_append(const int128_t source, f_int128s_t * const destination) { - - { - const f_status_t status = f_memory_array_increase(F_memory_default_allocation_small_d, sizeof(int128_t), (void **) &destination->array, &destination->used, &destination->size); - if (F_status_is_error(status)) return status; - } - - destination->array[destination->used++] = source; - - return F_none; - } -#endif // !defined(_di_f_int128s_append_) || !defined(_di_f_int128ss_append_) - -#if !defined(_di_f_int128s_append_) || !defined(_di_f_int128s_append_all_) || !defined(_di_f_int128ss_append_all_) - extern f_status_t private_f_int128s_append_all(const f_int128s_t source, f_int128s_t * const destination) { - - { - const f_status_t status = f_memory_array_increase_by(source.used, sizeof(int128_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_none; - } -#endif // !defined(_di_f_int128s_append_) || !defined(_di_f_int128s_append_all_) || !defined(_di_f_int128ss_append_all_) - -#if !defined(_di_f_int128ss_adjust_) || !defined(_di_f_int128ss_decimate_by_) - f_status_t private_f_int128ss_adjust(const f_number_unsigned_t length, f_int128ss_t * const structure) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = f_memory_array_adjust(0, sizeof(int128_t), (void **) &structure->array[i].array, &structure->array[i].used, &structure->array[i].size); - if (F_status_is_error(status)) return status; - } // for - - return f_memory_array_adjust(length, sizeof(f_int128s_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // !defined(_di_f_int128ss_adjust_) || !defined(_di_f_int128ss_decimate_by_) - -#if !defined(_di_f_int128ss_decrease_by_) || !defined(_di_f_int128ss_increase_) || !defined(_di_f_int128ss_increase_by_) || !defined(_di_f_int128ss_resize_) - f_status_t private_f_int128ss_resize(const f_number_unsigned_t length, f_int128ss_t * const structure) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = f_memory_array_resize(0, sizeof(int128_t), (void **) &structure->array[i].array, &structure->array[i].used, &structure->array[i].size); - if (F_status_is_error(status)) return status; - } // for - - return f_memory_array_resize(length, sizeof(f_int128s_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // !defined(_di_f_int128ss_decrease_by_) || !defined(_di_f_int128ss_increase_) || !defined(_di_f_int128ss_increase_by_) || !defined(_di_f_int128ss_resize_) - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/c/type_array/private-int128.h b/level_0/f_type_array/c/type_array/private-int128.h deleted file mode 100644 index d8cbb7123..000000000 --- a/level_0/f_type_array/c/type_array/private-int128.h +++ /dev/null @@ -1,131 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * 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_type_array_int128_h -#define _PRIVATE_F_type_array_int128_h - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Private implementation for appending the int128 array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param source - * The source int128 to append. - * @param destination - * The destination lengths the source is appended onto. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_array_increase(). - * - * @see f_memory_array_increase() - * - * @see f_int128s_append() - * @see f_int128ss_append() - */ -#if !defined(_di_f_int128s_append_) || !defined(_di_f_int128ss_append_) - extern f_status_t private_f_int128s_append(const int128_t source, f_int128s_t * const destination) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_int128s_append_) || !defined(_di_f_int128ss_append_) - -/** - * Private implementation for appending the int128 array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param source - * The source int128s to append. - * @param destination - * The destination lengths the source is appended onto. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - * - * @see f_int128s_append_all() - * @see f_int128ss_append() - * @see f_int128ss_append_all() - */ -#if !defined(_di_f_int128s_append_) || !defined(_di_f_int128s_append_all_) || !defined(_di_f_int128ss_append_all_) - extern f_status_t private_f_int128s_append_all(const f_int128s_t source, f_int128s_t * const destination) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_int128s_append_) || !defined(_di_f_int128s_append_all_) || !defined(_di_f_int128ss_append_all_) - -/** - * Private implementation for resizing the int128ss array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The length to adjust to. - * @param structure - * The int128ss array to adjust. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if 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_int128ss_adjust() - * @see f_int128ss_decimate_by() - */ -#if !defined(_di_f_int128ss_adjust_) || !defined(_di_f_int128ss_decimate_by_) - extern f_status_t private_f_int128ss_adjust(const f_number_unsigned_t length, f_int128ss_t * const structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_int128ss_adjust_) || !defined(_di_f_int128ss_decimate_by_) - -/** - * Private implementation for resizing the int128ss array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The length to resize to. - * @param structure - * The int128ss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if 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_int128ss_decrease_by() - * @see f_int128ss_increase() - * @see f_int128ss_increase_by() - * @see f_int128ss_resize() - */ -#if !defined(_di_f_int128ss_decrease_by_) || !defined(_di_f_int128ss_increase_) || !defined(_di_f_int128ss_increase_by_) || !defined(_di_f_int128ss_resize_) - extern f_status_t private_f_int128ss_resize(const f_number_unsigned_t length, f_int128ss_t * const structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_int128ss_decrease_by_) || !defined(_di_f_int128ss_increase_) || !defined(_di_f_int128ss_increase_by_) || !defined(_di_f_int128ss_resize_) - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_F_type_array_int128_h diff --git a/level_0/f_type_array/c/type_array/private-int16.c b/level_0/f_type_array/c/type_array/private-int16.c deleted file mode 100644 index 1364456a4..000000000 --- a/level_0/f_type_array/c/type_array/private-int16.c +++ /dev/null @@ -1,70 +0,0 @@ -#include "../type_array.h" -#include "private-int16.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#if !defined(_di_f_int16s_append_) || !defined(_di_f_int16ss_append_) - extern f_status_t private_f_int16s_append(const int16_t source, f_int16s_t * const destination) { - - { - const f_status_t status = f_memory_array_increase(F_memory_default_allocation_small_d, sizeof(int16_t), (void **) &destination->array, &destination->used, &destination->size); - if (F_status_is_error(status)) return status; - } - - destination->array[destination->used++] = source; - - return F_none; - } -#endif // !defined(_di_f_int16s_append_) || !defined(_di_f_int16ss_append_) - -#if !defined(_di_f_int16s_append_) || !defined(_di_f_int16s_append_all_) || !defined(_di_f_int16ss_append_all_) - extern f_status_t private_f_int16s_append_all(const f_int16s_t source, f_int16s_t * const destination) { - - { - const f_status_t status = f_memory_array_increase_by(source.used, sizeof(int16_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_none; - } -#endif // !defined(_di_f_int16s_append_) || !defined(_di_f_int16s_append_all_) || !defined(_di_f_int16ss_append_all_) - -#if !defined(_di_f_int16ss_adjust_) || !defined(_di_f_int16ss_decimate_by_) - f_status_t private_f_int16ss_adjust(const f_number_unsigned_t length, f_int16ss_t * const structure) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = f_memory_array_adjust(0, sizeof(int16_t), (void **) &structure->array[i].array, &structure->array[i].used, &structure->array[i].size); - if (F_status_is_error(status)) return status; - } // for - - return f_memory_array_adjust(length, sizeof(f_int16s_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // !defined(_di_f_int16ss_adjust_) || !defined(_di_f_int16ss_decimate_by_) - -#if !defined(_di_f_int16ss_decrease_by_) || !defined(_di_f_int16ss_increase_) || !defined(_di_f_int16ss_increase_by_) || !defined(_di_f_int16ss_resize_) - f_status_t private_f_int16ss_resize(const f_number_unsigned_t length, f_int16ss_t * const structure) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = f_memory_array_resize(0, sizeof(int16_t), (void **) &structure->array[i].array, &structure->array[i].used, &structure->array[i].size); - if (F_status_is_error(status)) return status; - } // for - - return f_memory_array_resize(length, sizeof(f_int16s_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // !defined(_di_f_int16ss_decrease_by_) || !defined(_di_f_int16ss_increase_) || !defined(_di_f_int16ss_increase_by_) || !defined(_di_f_int16ss_resize_) - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/c/type_array/private-int16.h b/level_0/f_type_array/c/type_array/private-int16.h deleted file mode 100644 index fb499c00f..000000000 --- a/level_0/f_type_array/c/type_array/private-int16.h +++ /dev/null @@ -1,131 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * 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_type_array_int16_h -#define _PRIVATE_F_type_array_int16_h - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Private implementation for appending the int16 array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param source - * The source int16 to append. - * @param destination - * The destination lengths the source is appended onto. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_array_increase(). - * - * @see f_memory_array_increase() - * - * @see f_int16s_append() - * @see f_int16ss_append() - */ -#if !defined(_di_f_int16s_append_) || !defined(_di_f_int16ss_append_) - extern f_status_t private_f_int16s_append(const int16_t source, f_int16s_t * const destination) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_int16s_append_) || !defined(_di_f_int16ss_append_) - -/** - * Private implementation for appending the int16 array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param source - * The source int16s to append. - * @param destination - * The destination lengths the source is appended onto. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - * - * @see f_int16s_append_all() - * @see f_int16ss_append() - * @see f_int16ss_append_all() - */ -#if !defined(_di_f_int16s_append_) || !defined(_di_f_int16s_append_all_) || !defined(_di_f_int16ss_append_all_) - extern f_status_t private_f_int16s_append_all(const f_int16s_t source, f_int16s_t * const destination) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_int16s_append_) || !defined(_di_f_int16s_append_all_) || !defined(_di_f_int16ss_append_all_) - -/** - * Private implementation for resizing the int16ss array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The length to adjust to. - * @param structure - * The int16ss array to adjust. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if 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_int16ss_adjust() - * @see f_int16ss_decimate_by() - */ -#if !defined(_di_f_int16ss_adjust_) || !defined(_di_f_int16ss_decimate_by_) - extern f_status_t private_f_int16ss_adjust(const f_number_unsigned_t length, f_int16ss_t * const structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_int16ss_adjust_) || !defined(_di_f_int16ss_decimate_by_) - -/** - * Private implementation for resizing the int16ss array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The length to resize to. - * @param structure - * The int16ss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if 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_int16ss_decrease_by() - * @see f_int16ss_increase() - * @see f_int16ss_increase_by() - * @see f_int16ss_resize() - */ -#if !defined(_di_f_int16ss_decrease_by_) || !defined(_di_f_int16ss_increase_) || !defined(_di_f_int16ss_increase_by_) || !defined(_di_f_int16ss_resize_) - extern f_status_t private_f_int16ss_resize(const f_number_unsigned_t length, f_int16ss_t * const structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_int16ss_decrease_by_) || !defined(_di_f_int16ss_increase_) || !defined(_di_f_int16ss_increase_by_) || !defined(_di_f_int16ss_resize_) - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_F_type_array_int16_h diff --git a/level_0/f_type_array/c/type_array/private-int32.c b/level_0/f_type_array/c/type_array/private-int32.c deleted file mode 100644 index d3598d70d..000000000 --- a/level_0/f_type_array/c/type_array/private-int32.c +++ /dev/null @@ -1,70 +0,0 @@ -#include "../type_array.h" -#include "private-int32.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#if !defined(_di_f_int32s_append_) || !defined(_di_f_int32ss_append_) - extern f_status_t private_f_int32s_append(const int32_t source, f_int32s_t * const destination) { - - { - const f_status_t status = f_memory_array_increase(F_memory_default_allocation_small_d, sizeof(int32_t), (void **) &destination->array, &destination->used, &destination->size); - if (F_status_is_error(status)) return status; - } - - destination->array[destination->used++] = source; - - return F_none; - } -#endif // !defined(_di_f_int32s_append_) || !defined(_di_f_int32ss_append_) - -#if !defined(_di_f_int32s_append_) || !defined(_di_f_int32s_append_all_) || !defined(_di_f_int32ss_append_all_) - extern f_status_t private_f_int32s_append_all(const f_int32s_t source, f_int32s_t * const destination) { - - { - const f_status_t status = f_memory_array_increase_by(source.used, sizeof(int32_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_none; - } -#endif // !defined(_di_f_int32s_append_) || !defined(_di_f_int32s_append_all_) || !defined(_di_f_int32ss_append_all_) - -#if !defined(_di_f_int32ss_adjust_) || !defined(_di_f_int32ss_decimate_by_) - f_status_t private_f_int32ss_adjust(const f_number_unsigned_t length, f_int32ss_t * const structure) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = f_memory_array_adjust(0, sizeof(int32_t), (void **) &structure->array[i].array, &structure->array[i].used, &structure->array[i].size); - if (F_status_is_error(status)) return status; - } // for - - return f_memory_array_adjust(length, sizeof(f_int32s_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // !defined(_di_f_int32ss_adjust_) || !defined(_di_f_int32ss_decimate_by_) - -#if !defined(_di_f_int32ss_decrease_by_) || !defined(_di_f_int32ss_increase_) || !defined(_di_f_int32ss_increase_by_) || !defined(_di_f_int32ss_resize_) - f_status_t private_f_int32ss_resize(const f_number_unsigned_t length, f_int32ss_t * const structure) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = f_memory_array_resize(0, sizeof(int32_t), (void **) &structure->array[i].array, &structure->array[i].used, &structure->array[i].size); - if (F_status_is_error(status)) return status; - } // for - - return f_memory_array_resize(length, sizeof(f_int32s_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // !defined(_di_f_int32ss_decrease_by_) || !defined(_di_f_int32ss_increase_) || !defined(_di_f_int32ss_increase_by_) || !defined(_di_f_int32ss_resize_) - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/c/type_array/private-int32.h b/level_0/f_type_array/c/type_array/private-int32.h deleted file mode 100644 index 83309a40a..000000000 --- a/level_0/f_type_array/c/type_array/private-int32.h +++ /dev/null @@ -1,131 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * 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_type_array_int32_h -#define _PRIVATE_F_type_array_int32_h - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Private implementation for appending the int32 array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param source - * The source int32 to append. - * @param destination - * The destination lengths the source is appended onto. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_array_increase(). - * - * @see f_memory_array_increase() - * - * @see f_int32s_append() - * @see f_int32ss_append() - */ -#if !defined(_di_f_int32s_append_) || !defined(_di_f_int32ss_append_) - extern f_status_t private_f_int32s_append(const int32_t source, f_int32s_t * const destination) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_int32s_append_) || !defined(_di_f_int32ss_append_) - -/** - * Private implementation for appending the int32 array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param source - * The source int32s to append. - * @param destination - * The destination lengths the source is appended onto. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - * - * @see f_int32s_append_all() - * @see f_int32ss_append() - * @see f_int32ss_append_all() - */ -#if !defined(_di_f_int32s_append_) || !defined(_di_f_int32s_append_all_) || !defined(_di_f_int32ss_append_all_) - extern f_status_t private_f_int32s_append_all(const f_int32s_t source, f_int32s_t * const destination) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_int32s_append_) || !defined(_di_f_int32s_append_all_) || !defined(_di_f_int32ss_append_all_) - -/** - * Private implementation for resizing the int32ss array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The length to adjust to. - * @param structure - * The int32ss array to adjust. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if 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_int32ss_adjust() - * @see f_int32ss_decimate_by() - */ -#if !defined(_di_f_int32ss_adjust_) || !defined(_di_f_int32ss_decimate_by_) - extern f_status_t private_f_int32ss_adjust(const f_number_unsigned_t length, f_int32ss_t * const structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_int32ss_adjust_) || !defined(_di_f_int32ss_decimate_by_) - -/** - * Private implementation for resizing the int32ss array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The length to resize to. - * @param structure - * The int32ss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if 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_int32ss_decrease_by() - * @see f_int32ss_increase() - * @see f_int32ss_increase_by() - * @see f_int32ss_resize() - */ -#if !defined(_di_f_int32ss_decrease_by_) || !defined(_di_f_int32ss_increase_) || !defined(_di_f_int32ss_increase_by_) || !defined(_di_f_int32ss_resize_) - extern f_status_t private_f_int32ss_resize(const f_number_unsigned_t length, f_int32ss_t * const structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_int32ss_decrease_by_) || !defined(_di_f_int32ss_increase_) || !defined(_di_f_int32ss_increase_by_) || !defined(_di_f_int32ss_resize_) - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_F_type_array_int32_h diff --git a/level_0/f_type_array/c/type_array/private-int64.c b/level_0/f_type_array/c/type_array/private-int64.c deleted file mode 100644 index ea6cd7f18..000000000 --- a/level_0/f_type_array/c/type_array/private-int64.c +++ /dev/null @@ -1,70 +0,0 @@ -#include "../type_array.h" -#include "private-int64.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#if !defined(_di_f_int64s_append_) || !defined(_di_f_int64ss_append_) - extern f_status_t private_f_int64s_append(const int64_t source, f_int64s_t * const destination) { - - { - const f_status_t status = f_memory_array_increase(F_memory_default_allocation_small_d, sizeof(int64_t), (void **) &destination->array, &destination->used, &destination->size); - if (F_status_is_error(status)) return status; - } - - destination->array[destination->used++] = source; - - return F_none; - } -#endif // !defined(_di_f_int64s_append_) || !defined(_di_f_int64ss_append_) - -#if !defined(_di_f_int64s_append_) || !defined(_di_f_int64s_append_all_) || !defined(_di_f_int64ss_append_all_) - extern f_status_t private_f_int64s_append_all(const f_int64s_t source, f_int64s_t * const destination) { - - { - const f_status_t status = f_memory_array_increase_by(source.used, sizeof(int64_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_none; - } -#endif // !defined(_di_f_int64s_append_) || !defined(_di_f_int64s_append_all_) || !defined(_di_f_int64ss_append_all_) - -#if !defined(_di_f_int64ss_adjust_) || !defined(_di_f_int64ss_decimate_by_) - f_status_t private_f_int64ss_adjust(const f_number_unsigned_t length, f_int64ss_t * const structure) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = f_memory_array_adjust(0, sizeof(int64_t), (void **) &structure->array[i].array, &structure->array[i].used, &structure->array[i].size); - if (F_status_is_error(status)) return status; - } // for - - return f_memory_array_adjust(length, sizeof(f_int64s_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // !defined(_di_f_int64ss_adjust_) || !defined(_di_f_int64ss_decimate_by_) - -#if !defined(_di_f_int64ss_decrease_by_) || !defined(_di_f_int64ss_increase_) || !defined(_di_f_int64ss_increase_by_) || !defined(_di_f_int64ss_resize_) - f_status_t private_f_int64ss_resize(const f_number_unsigned_t length, f_int64ss_t * const structure) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = f_memory_array_resize(0, sizeof(int64_t), (void **) &structure->array[i].array, &structure->array[i].used, &structure->array[i].size); - if (F_status_is_error(status)) return status; - } // for - - return f_memory_array_resize(length, sizeof(f_int64s_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // !defined(_di_f_int64ss_decrease_by_) || !defined(_di_f_int64ss_increase_) || !defined(_di_f_int64ss_increase_by_) || !defined(_di_f_int64ss_resize_) - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/c/type_array/private-int64.h b/level_0/f_type_array/c/type_array/private-int64.h deleted file mode 100644 index 6a914367d..000000000 --- a/level_0/f_type_array/c/type_array/private-int64.h +++ /dev/null @@ -1,131 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * 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_type_array_int64_h -#define _PRIVATE_F_type_array_int64_h - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Private implementation for appending the int64 array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param source - * The source int64 to append. - * @param destination - * The destination lengths the source is appended onto. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_array_increase(). - * - * @see f_memory_array_increase() - * - * @see f_int64s_append() - * @see f_int64ss_append() - */ -#if !defined(_di_f_int64s_append_) || !defined(_di_f_int64ss_append_) - extern f_status_t private_f_int64s_append(const int64_t source, f_int64s_t * const destination) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_int64s_append_) || !defined(_di_f_int64ss_append_) - -/** - * Private implementation for appending the int64 array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param source - * The source int64s to append. - * @param destination - * The destination lengths the source is appended onto. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - * - * @see f_int64s_append_all() - * @see f_int64ss_append() - * @see f_int64ss_append_all() - */ -#if !defined(_di_f_int64s_append_) || !defined(_di_f_int64s_append_all_) || !defined(_di_f_int64ss_append_all_) - extern f_status_t private_f_int64s_append_all(const f_int64s_t source, f_int64s_t * const destination) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_int64s_append_) || !defined(_di_f_int64s_append_all_) || !defined(_di_f_int64ss_append_all_) - -/** - * Private implementation for resizing the int64ss array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The length to adjust to. - * @param structure - * The int64ss array to adjust. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if 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_int64ss_adjust() - * @see f_int64ss_decimate_by() - */ -#if !defined(_di_f_int64ss_adjust_) || !defined(_di_f_int64ss_decimate_by_) - extern f_status_t private_f_int64ss_adjust(const f_number_unsigned_t length, f_int64ss_t * const structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_int64ss_adjust_) || !defined(_di_f_int64ss_decimate_by_) - -/** - * Private implementation for resizing the int64ss array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The length to resize to. - * @param structure - * The int64ss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if 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_int64ss_decrease_by() - * @see f_int64ss_increase() - * @see f_int64ss_increase_by() - * @see f_int64ss_resize() - */ -#if !defined(_di_f_int64ss_decrease_by_) || !defined(_di_f_int64ss_increase_) || !defined(_di_f_int64ss_increase_by_) || !defined(_di_f_int64ss_resize_) - extern f_status_t private_f_int64ss_resize(const f_number_unsigned_t length, f_int64ss_t * const structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_int64ss_decrease_by_) || !defined(_di_f_int64ss_increase_) || !defined(_di_f_int64ss_increase_by_) || !defined(_di_f_int64ss_resize_) - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_F_type_array_int64_h diff --git a/level_0/f_type_array/c/type_array/private-int8.c b/level_0/f_type_array/c/type_array/private-int8.c deleted file mode 100644 index 2a2494376..000000000 --- a/level_0/f_type_array/c/type_array/private-int8.c +++ /dev/null @@ -1,70 +0,0 @@ -#include "../type_array.h" -#include "private-int8.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#if !defined(_di_f_int8s_append_) || !defined(_di_f_int8ss_append_) - extern f_status_t private_f_int8s_append(const int8_t source, f_int8s_t * const destination) { - - { - const f_status_t status = f_memory_array_increase(F_memory_default_allocation_small_d, sizeof(int8_t), (void **) &destination->array, &destination->used, &destination->size); - if (F_status_is_error(status)) return status; - } - - destination->array[destination->used++] = source; - - return F_none; - } -#endif // !defined(_di_f_int8s_append_) || !defined(_di_f_int8ss_append_) - -#if !defined(_di_f_int8s_append_) || !defined(_di_f_int8s_append_all_) || !defined(_di_f_int8ss_append_all_) - extern f_status_t private_f_int8s_append_all(const f_int8s_t source, f_int8s_t * const destination) { - - { - const f_status_t status = f_memory_array_increase_by(source.used, sizeof(int8_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_none; - } -#endif // !defined(_di_f_int8s_append_) || !defined(_di_f_int8s_append_all_) || !defined(_di_f_int8ss_append_all_) - -#if !defined(_di_f_int8ss_adjust_) || !defined(_di_f_int8ss_decimate_by_) - f_status_t private_f_int8ss_adjust(const f_number_unsigned_t length, f_int8ss_t * const structure) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = f_memory_array_adjust(0, sizeof(int8_t), (void **) &structure->array[i].array, &structure->array[i].used, &structure->array[i].size); - if (F_status_is_error(status)) return status; - } // for - - return f_memory_array_adjust(length, sizeof(f_int8s_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // !defined(_di_f_int8ss_adjust_) || !defined(_di_f_int8ss_decimate_by_) - -#if !defined(_di_f_int8ss_decrease_by_) || !defined(_di_f_int8ss_increase_) || !defined(_di_f_int8ss_increase_by_) || !defined(_di_f_int8ss_resize_) - f_status_t private_f_int8ss_resize(const f_number_unsigned_t length, f_int8ss_t * const structure) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = f_memory_array_resize(0, sizeof(int8_t), (void **) &structure->array[i].array, &structure->array[i].used, &structure->array[i].size); - if (F_status_is_error(status)) return status; - } // for - - return f_memory_array_resize(length, sizeof(f_int8s_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // !defined(_di_f_int8ss_decrease_by_) || !defined(_di_f_int8ss_increase_) || !defined(_di_f_int8ss_increase_by_) || !defined(_di_f_int8ss_resize_) - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/c/type_array/private-int8.h b/level_0/f_type_array/c/type_array/private-int8.h deleted file mode 100644 index 58596c857..000000000 --- a/level_0/f_type_array/c/type_array/private-int8.h +++ /dev/null @@ -1,131 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * 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_type_array_int8_h -#define _PRIVATE_F_type_array_int8_h - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Private implementation for appending the int8 array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param source - * The source int8 to append. - * @param destination - * The destination lengths the source is appended onto. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_array_increase(). - * - * @see f_memory_array_increase() - * - * @see f_int8s_append() - * @see f_int8ss_append() - */ -#if !defined(_di_f_int8s_append_) || !defined(_di_f_int8ss_append_) - extern f_status_t private_f_int8s_append(const int8_t source, f_int8s_t * const destination) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_int8s_append_) || !defined(_di_f_int8ss_append_) - -/** - * Private implementation for appending the int8 array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param source - * The source int8s to append. - * @param destination - * The destination lengths the source is appended onto. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - * - * @see f_int8s_append_all() - * @see f_int8ss_append() - * @see f_int8ss_append_all() - */ -#if !defined(_di_f_int8s_append_) || !defined(_di_f_int8s_append_all_) || !defined(_di_f_int8ss_append_all_) - extern f_status_t private_f_int8s_append_all(const f_int8s_t source, f_int8s_t * const destination) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_int8s_append_) || !defined(_di_f_int8s_append_all_) || !defined(_di_f_int8ss_append_all_) - -/** - * Private implementation for resizing the int8ss array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The length to adjust to. - * @param structure - * The int8ss array to adjust. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if 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_int8ss_adjust() - * @see f_int8ss_decimate_by() - */ -#if !defined(_di_f_int8ss_adjust_) || !defined(_di_f_int8ss_decimate_by_) - extern f_status_t private_f_int8ss_adjust(const f_number_unsigned_t length, f_int8ss_t * const structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_int8ss_adjust_) || !defined(_di_f_int8ss_decimate_by_) - -/** - * Private implementation for resizing the int8ss array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The length to resize to. - * @param structure - * The int8ss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if 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_int8ss_decrease_by() - * @see f_int8ss_increase() - * @see f_int8ss_increase_by() - * @see f_int8ss_resize() - */ -#if !defined(_di_f_int8ss_decrease_by_) || !defined(_di_f_int8ss_increase_) || !defined(_di_f_int8ss_increase_by_) || !defined(_di_f_int8ss_resize_) - extern f_status_t private_f_int8ss_resize(const f_number_unsigned_t length, f_int8ss_t * const structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_int8ss_decrease_by_) || !defined(_di_f_int8ss_increase_) || !defined(_di_f_int8ss_increase_by_) || !defined(_di_f_int8ss_resize_) - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_F_type_array_int8_h diff --git a/level_0/f_type_array/c/type_array/private-uint128.c b/level_0/f_type_array/c/type_array/private-uint128.c deleted file mode 100644 index 86c735bb6..000000000 --- a/level_0/f_type_array/c/type_array/private-uint128.c +++ /dev/null @@ -1,70 +0,0 @@ -#include "../type_array.h" -#include "private-uint128.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#if !defined(_di_f_uint128s_append_) || !defined(_di_f_uint128ss_append_) - extern f_status_t private_f_uint128s_append(const uint128_t source, f_uint128s_t * const destination) { - - { - const f_status_t status = f_memory_array_increase(F_memory_default_allocation_small_d, sizeof(uint128_t), (void **) &destination->array, &destination->used, &destination->size); - if (F_status_is_error(status)) return status; - } - - destination->array[destination->used++] = source; - - return F_none; - } -#endif // !defined(_di_f_uint128s_append_) || !defined(_di_f_uint128ss_append_) - -#if !defined(_di_f_uint128s_append_) || !defined(_di_f_uint128s_append_all_) || !defined(_di_f_uint128ss_append_all_) - extern f_status_t private_f_uint128s_append_all(const f_uint128s_t source, f_uint128s_t * const destination) { - - { - const f_status_t status = f_memory_array_increase_by(source.used, sizeof(uint128_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_none; - } -#endif // !defined(_di_f_uint128s_append_) || !defined(_di_f_uint128s_append_all_) || !defined(_di_f_uint128ss_append_all_) - -#if !defined(_di_f_uint128ss_adjust_) || !defined(_di_f_uint128ss_decimate_by_) - f_status_t private_f_uint128ss_adjust(const f_number_unsigned_t length, f_uint128ss_t * const structure) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = f_memory_array_adjust(0, sizeof(uint128_t), (void **) &structure->array[i].array, &structure->array[i].used, &structure->array[i].size); - if (F_status_is_error(status)) return status; - } // for - - return f_memory_array_adjust(length, sizeof(f_uint128s_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // !defined(_di_f_uint128ss_adjust_) || !defined(_di_f_uint128ss_decimate_by_) - -#if !defined(_di_f_uint128ss_decrease_by_) || !defined(_di_f_uint128ss_increase_) || !defined(_di_f_uint128ss_increase_by_) || !defined(_di_f_uint128ss_resize_) - f_status_t private_f_uint128ss_resize(const f_number_unsigned_t length, f_uint128ss_t * const structure) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = f_memory_array_resize(0, sizeof(uint128_t), (void **) &structure->array[i].array, &structure->array[i].used, &structure->array[i].size); - if (F_status_is_error(status)) return status; - } // for - - return f_memory_array_resize(length, sizeof(f_uint128s_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // !defined(_di_f_uint128ss_decrease_by_) || !defined(_di_f_uint128ss_increase_) || !defined(_di_f_uint128ss_increase_by_) || !defined(_di_f_uint128ss_resize_) - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/c/type_array/private-uint128.h b/level_0/f_type_array/c/type_array/private-uint128.h deleted file mode 100644 index 62edda5fc..000000000 --- a/level_0/f_type_array/c/type_array/private-uint128.h +++ /dev/null @@ -1,131 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * 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_type_array_uint128_h -#define _PRIVATE_F_type_array_uint128_h - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Private implementation for appending the uint128 array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param source - * The source uint128 to append. - * @param destination - * The destination lengths the source is appended onto. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_array_increase(). - * - * @see f_memory_array_increase() - * - * @see f_uint128s_append() - * @see f_uint128ss_append() - */ -#if !defined(_di_f_uint128s_append_) || !defined(_di_f_uint128ss_append_) - extern f_status_t private_f_uint128s_append(const uint128_t source, f_uint128s_t * const destination) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_uint128s_append_) || !defined(_di_f_uint128ss_append_) - -/** - * Private implementation for appending the uint128 array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param source - * The source uint128s to append. - * @param destination - * The destination lengths the source is appended onto. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - * - * @see f_uint128s_append_all() - * @see f_uint128ss_append() - * @see f_uint128ss_append_all() - */ -#if !defined(_di_f_uint128s_append_) || !defined(_di_f_uint128s_append_all_) || !defined(_di_f_uint128ss_append_all_) - extern f_status_t private_f_uint128s_append_all(const f_uint128s_t source, f_uint128s_t * const destination) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_uint128s_append_) || !defined(_di_f_uint128s_append_all_) || !defined(_di_f_uint128ss_append_all_) - -/** - * Private implementation for resizing the uint128ss array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The length to adjust to. - * @param structure - * The uint128ss array to adjust. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if 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_uint128ss_adjust() - * @see f_uint128ss_decimate_by() - */ -#if !defined(_di_f_uint128ss_adjust_) || !defined(_di_f_uint128ss_decimate_by_) - extern f_status_t private_f_uint128ss_adjust(const f_number_unsigned_t length, f_uint128ss_t * const structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_uint128ss_adjust_) || !defined(_di_f_uint128ss_decimate_by_) - -/** - * Private implementation for resizing the uint128ss array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The length to resize to. - * @param structure - * The uint128ss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if 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_uint128ss_decrease_by() - * @see f_uint128ss_increase() - * @see f_uint128ss_increase_by() - * @see f_uint128ss_resize() - */ -#if !defined(_di_f_uint128ss_decrease_by_) || !defined(_di_f_uint128ss_increase_) || !defined(_di_f_uint128ss_increase_by_) || !defined(_di_f_uint128ss_resize_) - extern f_status_t private_f_uint128ss_resize(const f_number_unsigned_t length, f_uint128ss_t * const structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_uint128ss_decrease_by_) || !defined(_di_f_uint128ss_increase_) || !defined(_di_f_uint128ss_increase_by_) || !defined(_di_f_uint128ss_resize_) - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_F_type_array_uint128_h diff --git a/level_0/f_type_array/c/type_array/private-uint16.c b/level_0/f_type_array/c/type_array/private-uint16.c deleted file mode 100644 index e1c7063f2..000000000 --- a/level_0/f_type_array/c/type_array/private-uint16.c +++ /dev/null @@ -1,70 +0,0 @@ -#include "../type_array.h" -#include "private-uint16.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#if !defined(_di_f_uint16s_append_) || !defined(_di_f_uint16ss_append_) - extern f_status_t private_f_uint16s_append(const uint16_t source, f_uint16s_t * const destination) { - - { - const f_status_t status = f_memory_array_increase(F_memory_default_allocation_small_d, sizeof(uint16_t), (void **) &destination->array, &destination->used, &destination->size); - if (F_status_is_error(status)) return status; - } - - destination->array[destination->used++] = source; - - return F_none; - } -#endif // !defined(_di_f_uint16s_append_) || !defined(_di_f_uint16ss_append_) - -#if !defined(_di_f_uint16s_append_) || !defined(_di_f_uint16s_append_all_) || !defined(_di_f_uint16ss_append_all_) - extern f_status_t private_f_uint16s_append_all(const f_uint16s_t source, f_uint16s_t * const destination) { - - { - const f_status_t status = f_memory_array_increase_by(source.used, sizeof(uint16_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_none; - } -#endif // !defined(_di_f_uint16s_append_) || !defined(_di_f_uint16s_append_all_) || !defined(_di_f_uint16ss_append_all_) - -#if !defined(_di_f_uint16ss_adjust_) || !defined(_di_f_uint16ss_decimate_by_) - f_status_t private_f_uint16ss_adjust(const f_number_unsigned_t length, f_uint16ss_t * const structure) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = f_memory_array_adjust(0, sizeof(uint16_t), (void **) &structure->array[i].array, &structure->array[i].used, &structure->array[i].size); - if (F_status_is_error(status)) return status; - } // for - - return f_memory_array_adjust(length, sizeof(f_uint16s_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // !defined(_di_f_uint16ss_adjust_) || !defined(_di_f_uint16ss_decimate_by_) - -#if !defined(_di_f_uint16ss_decrease_by_) || !defined(_di_f_uint16ss_increase_) || !defined(_di_f_uint16ss_increase_by_) || !defined(_di_f_uint16ss_resize_) - f_status_t private_f_uint16ss_resize(const f_number_unsigned_t length, f_uint16ss_t * const structure) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = f_memory_array_resize(0, sizeof(uint16_t), (void **) &structure->array[i].array, &structure->array[i].used, &structure->array[i].size); - if (F_status_is_error(status)) return status; - } // for - - return f_memory_array_resize(length, sizeof(f_uint16s_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // !defined(_di_f_uint16ss_decrease_by_) || !defined(_di_f_uint16ss_increase_) || !defined(_di_f_uint16ss_increase_by_) || !defined(_di_f_uint16ss_resize_) - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/c/type_array/private-uint16.h b/level_0/f_type_array/c/type_array/private-uint16.h deleted file mode 100644 index 641a4e2b5..000000000 --- a/level_0/f_type_array/c/type_array/private-uint16.h +++ /dev/null @@ -1,131 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * 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_type_array_uint16_h -#define _PRIVATE_F_type_array_uint16_h - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Private implementation for appending the uint16 array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param source - * The source uint16 to append. - * @param destination - * The destination lengths the source is appended onto. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_array_increase(). - * - * @see f_memory_array_increase() - * - * @see f_uint16s_append() - * @see f_uint16ss_append() - */ -#if !defined(_di_f_uint16s_append_) || !defined(_di_f_uint16ss_append_) - extern f_status_t private_f_uint16s_append(const uint16_t source, f_uint16s_t * const destination) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_uint16s_append_) || !defined(_di_f_uint16ss_append_) - -/** - * Private implementation for appending the uint16 array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param source - * The source uint16s to append. - * @param destination - * The destination lengths the source is appended onto. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - * - * @see f_uint16s_append_all() - * @see f_uint16ss_append() - * @see f_uint16ss_append_all() - */ -#if !defined(_di_f_uint16s_append_) || !defined(_di_f_uint16s_append_all_) || !defined(_di_f_uint16ss_append_all_) - extern f_status_t private_f_uint16s_append_all(const f_uint16s_t source, f_uint16s_t * const destination) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_uint16s_append_) || !defined(_di_f_uint16s_append_all_) || !defined(_di_f_uint16ss_append_all_) - -/** - * Private implementation for resizing the uint16ss array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The length to adjust to. - * @param structure - * The uint16ss array to adjust. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if 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_uint16ss_adjust() - * @see f_uint16ss_decimate_by() - */ -#if !defined(_di_f_uint16ss_adjust_) || !defined(_di_f_uint16ss_decimate_by_) - extern f_status_t private_f_uint16ss_adjust(const f_number_unsigned_t length, f_uint16ss_t * const structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_uint16ss_adjust_) || !defined(_di_f_uint16ss_decimate_by_) - -/** - * Private implementation for resizing the uint16ss array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The length to resize to. - * @param structure - * The uint16ss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if 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_uint16ss_decrease_by() - * @see f_uint16ss_increase() - * @see f_uint16ss_increase_by() - * @see f_uint16ss_resize() - */ -#if !defined(_di_f_uint16ss_decrease_by_) || !defined(_di_f_uint16ss_increase_) || !defined(_di_f_uint16ss_increase_by_) || !defined(_di_f_uint16ss_resize_) - extern f_status_t private_f_uint16ss_resize(const f_number_unsigned_t length, f_uint16ss_t * const structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_uint16ss_decrease_by_) || !defined(_di_f_uint16ss_increase_) || !defined(_di_f_uint16ss_increase_by_) || !defined(_di_f_uint16ss_resize_) - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_F_type_array_uint16_h diff --git a/level_0/f_type_array/c/type_array/private-uint32.c b/level_0/f_type_array/c/type_array/private-uint32.c deleted file mode 100644 index 7556684fa..000000000 --- a/level_0/f_type_array/c/type_array/private-uint32.c +++ /dev/null @@ -1,70 +0,0 @@ -#include "../type_array.h" -#include "private-uint32.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#if !defined(_di_f_uint32s_append_) || !defined(_di_f_uint32ss_append_) - extern f_status_t private_f_uint32s_append(const uint32_t source, f_uint32s_t * const destination) { - - { - const f_status_t status = f_memory_array_increase(F_memory_default_allocation_small_d, sizeof(uint32_t), (void **) &destination->array, &destination->used, &destination->size); - if (F_status_is_error(status)) return status; - } - - destination->array[destination->used++] = source; - - return F_none; - } -#endif // !defined(_di_f_uint32s_append_) || !defined(_di_f_uint32ss_append_) - -#if !defined(_di_f_uint32s_append_) || !defined(_di_f_uint32s_append_all_) || !defined(_di_f_uint32ss_append_all_) - extern f_status_t private_f_uint32s_append_all(const f_uint32s_t source, f_uint32s_t * const destination) { - - { - const f_status_t status = f_memory_array_increase_by(source.used, sizeof(uint32_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_none; - } -#endif // !defined(_di_f_uint32s_append_) || !defined(_di_f_uint32s_append_all_) || !defined(_di_f_uint32ss_append_all_) - -#if !defined(_di_f_uint32ss_adjust_) || !defined(_di_f_uint32ss_decimate_by_) - f_status_t private_f_uint32ss_adjust(const f_number_unsigned_t length, f_uint32ss_t * const structure) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = f_memory_array_adjust(0, sizeof(uint32_t), (void **) &structure->array[i].array, &structure->array[i].used, &structure->array[i].size); - if (F_status_is_error(status)) return status; - } // for - - return f_memory_array_adjust(length, sizeof(f_uint32s_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // !defined(_di_f_uint32ss_adjust_) || !defined(_di_f_uint32ss_decimate_by_) - -#if !defined(_di_f_uint32ss_decrease_by_) || !defined(_di_f_uint32ss_increase_) || !defined(_di_f_uint32ss_increase_by_) || !defined(_di_f_uint32ss_resize_) - f_status_t private_f_uint32ss_resize(const f_number_unsigned_t length, f_uint32ss_t * const structure) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = f_memory_array_resize(0, sizeof(uint32_t), (void **) &structure->array[i].array, &structure->array[i].used, &structure->array[i].size); - if (F_status_is_error(status)) return status; - } // for - - return f_memory_array_resize(length, sizeof(f_uint32s_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // !defined(_di_f_uint32ss_decrease_by_) || !defined(_di_f_uint32ss_increase_) || !defined(_di_f_uint32ss_increase_by_) || !defined(_di_f_uint32ss_resize_) - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/c/type_array/private-uint32.h b/level_0/f_type_array/c/type_array/private-uint32.h deleted file mode 100644 index 02e7cb4e6..000000000 --- a/level_0/f_type_array/c/type_array/private-uint32.h +++ /dev/null @@ -1,131 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * 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_type_array_uint32_h -#define _PRIVATE_F_type_array_uint32_h - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Private implementation for appending the uint32 array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param source - * The source uint32 to append. - * @param destination - * The destination lengths the source is appended onto. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_array_increase(). - * - * @see f_memory_array_increase() - * - * @see f_uint32s_append() - * @see f_uint32ss_append() - */ -#if !defined(_di_f_uint32s_append_) || !defined(_di_f_uint32ss_append_) - extern f_status_t private_f_uint32s_append(const uint32_t source, f_uint32s_t * const destination) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_uint32s_append_) || !defined(_di_f_uint32ss_append_) - -/** - * Private implementation for appending the uint32 array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param source - * The source uint32s to append. - * @param destination - * The destination lengths the source is appended onto. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - * - * @see f_uint32s_append_all() - * @see f_uint32ss_append() - * @see f_uint32ss_append_all() - */ -#if !defined(_di_f_uint32s_append_) || !defined(_di_f_uint32s_append_all_) || !defined(_di_f_uint32ss_append_all_) - extern f_status_t private_f_uint32s_append_all(const f_uint32s_t source, f_uint32s_t * const destination) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_uint32s_append_) || !defined(_di_f_uint32s_append_all_) || !defined(_di_f_uint32ss_append_all_) - -/** - * Private implementation for resizing the uint32ss array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The length to adjust to. - * @param structure - * The uint32ss array to adjust. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if 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_uint32ss_adjust() - * @see f_uint32ss_decimate_by() - */ -#if !defined(_di_f_uint32ss_adjust_) || !defined(_di_f_uint32ss_decimate_by_) - extern f_status_t private_f_uint32ss_adjust(const f_number_unsigned_t length, f_uint32ss_t * const structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_uint32ss_adjust_) || !defined(_di_f_uint32ss_decimate_by_) - -/** - * Private implementation for resizing the uint32ss array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The length to resize to. - * @param structure - * The uint32ss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if 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_uint32ss_decrease_by() - * @see f_uint32ss_increase() - * @see f_uint32ss_increase_by() - * @see f_uint32ss_resize() - */ -#if !defined(_di_f_uint32ss_decrease_by_) || !defined(_di_f_uint32ss_increase_) || !defined(_di_f_uint32ss_increase_by_) || !defined(_di_f_uint32ss_resize_) - extern f_status_t private_f_uint32ss_resize(const f_number_unsigned_t length, f_uint32ss_t * const structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_uint32ss_decrease_by_) || !defined(_di_f_uint32ss_increase_) || !defined(_di_f_uint32ss_increase_by_) || !defined(_di_f_uint32ss_resize_) - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_F_type_array_uint32_h diff --git a/level_0/f_type_array/c/type_array/private-uint64.c b/level_0/f_type_array/c/type_array/private-uint64.c deleted file mode 100644 index 4153b48b4..000000000 --- a/level_0/f_type_array/c/type_array/private-uint64.c +++ /dev/null @@ -1,70 +0,0 @@ -#include "../type_array.h" -#include "private-uint64.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#if !defined(_di_f_uint64s_append_) || !defined(_di_f_uint64ss_append_) - extern f_status_t private_f_uint64s_append(const uint64_t source, f_uint64s_t * const destination) { - - { - const f_status_t status = f_memory_array_increase(F_memory_default_allocation_small_d, sizeof(uint64_t), (void **) &destination->array, &destination->used, &destination->size); - if (F_status_is_error(status)) return status; - } - - destination->array[destination->used++] = source; - - return F_none; - } -#endif // !defined(_di_f_uint64s_append_) || !defined(_di_f_uint64ss_append_) - -#if !defined(_di_f_uint64s_append_) || !defined(_di_f_uint64s_append_all_) || !defined(_di_f_uint64ss_append_all_) - extern f_status_t private_f_uint64s_append_all(const f_uint64s_t source, f_uint64s_t * const destination) { - - { - const f_status_t status = f_memory_array_increase_by(source.used, sizeof(uint64_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_none; - } -#endif // !defined(_di_f_uint64s_append_) || !defined(_di_f_uint64s_append_all_) || !defined(_di_f_uint64ss_append_all_) - -#if !defined(_di_f_uint64ss_adjust_) || !defined(_di_f_uint64ss_decimate_by_) - f_status_t private_f_uint64ss_adjust(const f_number_unsigned_t length, f_uint64ss_t * const structure) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = f_memory_array_adjust(0, sizeof(uint64_t), (void **) &structure->array[i].array, &structure->array[i].used, &structure->array[i].size); - if (F_status_is_error(status)) return status; - } // for - - return f_memory_array_adjust(length, sizeof(f_uint64s_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // !defined(_di_f_uint64ss_adjust_) || !defined(_di_f_uint64ss_decimate_by_) - -#if !defined(_di_f_uint64ss_decrease_by_) || !defined(_di_f_uint64ss_increase_) || !defined(_di_f_uint64ss_increase_by_) || !defined(_di_f_uint64ss_resize_) - f_status_t private_f_uint64ss_resize(const f_number_unsigned_t length, f_uint64ss_t * const structure) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = f_memory_array_resize(0, sizeof(uint64_t), (void **) &structure->array[i].array, &structure->array[i].used, &structure->array[i].size); - if (F_status_is_error(status)) return status; - } // for - - return f_memory_array_resize(length, sizeof(f_uint64s_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // !defined(_di_f_uint64ss_decrease_by_) || !defined(_di_f_uint64ss_increase_) || !defined(_di_f_uint64ss_increase_by_) || !defined(_di_f_uint64ss_resize_) - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/c/type_array/private-uint64.h b/level_0/f_type_array/c/type_array/private-uint64.h deleted file mode 100644 index 5142b9ad1..000000000 --- a/level_0/f_type_array/c/type_array/private-uint64.h +++ /dev/null @@ -1,131 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * 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_type_array_uint64_h -#define _PRIVATE_F_type_array_uint64_h - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Private implementation for appending the uint64 array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param source - * The source uint64 to append. - * @param destination - * The destination lengths the source is appended onto. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_array_increase(). - * - * @see f_memory_array_increase() - * - * @see f_uint64s_append() - * @see f_uint64ss_append() - */ -#if !defined(_di_f_uint64s_append_) || !defined(_di_f_uint64ss_append_) - extern f_status_t private_f_uint64s_append(const uint64_t source, f_uint64s_t * const destination) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_uint64s_append_) || !defined(_di_f_uint64ss_append_) - -/** - * Private implementation for appending the uint64 array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param source - * The source uint64s to append. - * @param destination - * The destination lengths the source is appended onto. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - * - * @see f_uint64s_append_all() - * @see f_uint64ss_append() - * @see f_uint64ss_append_all() - */ -#if !defined(_di_f_uint64s_append_) || !defined(_di_f_uint64s_append_all_) || !defined(_di_f_uint64ss_append_all_) - extern f_status_t private_f_uint64s_append_all(const f_uint64s_t source, f_uint64s_t * const destination) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_uint64s_append_) || !defined(_di_f_uint64s_append_all_) || !defined(_di_f_uint64ss_append_all_) - -/** - * Private implementation for resizing the uint64ss array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The length to adjust to. - * @param structure - * The uint64ss array to adjust. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if 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_uint64ss_adjust() - * @see f_uint64ss_decimate_by() - */ -#if !defined(_di_f_uint64ss_adjust_) || !defined(_di_f_uint64ss_decimate_by_) - extern f_status_t private_f_uint64ss_adjust(const f_number_unsigned_t length, f_uint64ss_t * const structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_uint64ss_adjust_) || !defined(_di_f_uint64ss_decimate_by_) - -/** - * Private implementation for resizing the uint64ss array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The length to resize to. - * @param structure - * The uint64ss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if 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_uint64ss_decrease_by() - * @see f_uint64ss_increase() - * @see f_uint64ss_increase_by() - * @see f_uint64ss_resize() - */ -#if !defined(_di_f_uint64ss_decrease_by_) || !defined(_di_f_uint64ss_increase_) || !defined(_di_f_uint64ss_increase_by_) || !defined(_di_f_uint64ss_resize_) - extern f_status_t private_f_uint64ss_resize(const f_number_unsigned_t length, f_uint64ss_t * const structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_uint64ss_decrease_by_) || !defined(_di_f_uint64ss_increase_) || !defined(_di_f_uint64ss_increase_by_) || !defined(_di_f_uint64ss_resize_) - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_F_type_array_uint64_h diff --git a/level_0/f_type_array/c/type_array/private-uint8.c b/level_0/f_type_array/c/type_array/private-uint8.c deleted file mode 100644 index 617509fae..000000000 --- a/level_0/f_type_array/c/type_array/private-uint8.c +++ /dev/null @@ -1,70 +0,0 @@ -#include "../type_array.h" -#include "private-uint8.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#if !defined(_di_f_uint8s_append_) || !defined(_di_f_uint8ss_append_) - extern f_status_t private_f_uint8s_append(const uint8_t source, f_uint8s_t * const destination) { - - { - const f_status_t status = f_memory_array_increase(F_memory_default_allocation_small_d, sizeof(uint8_t), (void **) &destination->array, &destination->used, &destination->size); - if (F_status_is_error(status)) return status; - } - - destination->array[destination->used++] = source; - - return F_none; - } -#endif // !defined(_di_f_uint8s_append_) || !defined(_di_f_uint8ss_append_) - -#if !defined(_di_f_uint8s_append_) || !defined(_di_f_uint8s_append_all_) || !defined(_di_f_uint8ss_append_all_) - extern f_status_t private_f_uint8s_append_all(const f_uint8s_t source, f_uint8s_t * const destination) { - - { - const f_status_t status = f_memory_array_increase_by(source.used, sizeof(uint8_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_none; - } -#endif // !defined(_di_f_uint8s_append_) || !defined(_di_f_uint8s_append_all_) || !defined(_di_f_uint8ss_append_all_) - -#if !defined(_di_f_uint8ss_adjust_) || !defined(_di_f_uint8ss_decimate_by_) - f_status_t private_f_uint8ss_adjust(const f_number_unsigned_t length, f_uint8ss_t * const structure) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = f_memory_array_adjust(0, sizeof(uint8_t), (void **) &structure->array[i].array, &structure->array[i].used, &structure->array[i].size); - if (F_status_is_error(status)) return status; - } // for - - return f_memory_array_adjust(length, sizeof(f_uint8s_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // !defined(_di_f_uint8ss_adjust_) || !defined(_di_f_uint8ss_decimate_by_) - -#if !defined(_di_f_uint8ss_decrease_by_) || !defined(_di_f_uint8ss_increase_) || !defined(_di_f_uint8ss_increase_by_) || !defined(_di_f_uint8ss_resize_) - f_status_t private_f_uint8ss_resize(const f_number_unsigned_t length, f_uint8ss_t * const structure) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = f_memory_array_resize(0, sizeof(uint8_t), (void **) &structure->array[i].array, &structure->array[i].used, &structure->array[i].size); - if (F_status_is_error(status)) return status; - } // for - - return f_memory_array_resize(length, sizeof(f_uint8s_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // !defined(_di_f_uint8ss_decrease_by_) || !defined(_di_f_uint8ss_increase_) || !defined(_di_f_uint8ss_increase_by_) || !defined(_di_f_uint8ss_resize_) - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/c/type_array/private-uint8.h b/level_0/f_type_array/c/type_array/private-uint8.h deleted file mode 100644 index ec55c4d24..000000000 --- a/level_0/f_type_array/c/type_array/private-uint8.h +++ /dev/null @@ -1,131 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * 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_type_array_uint8_h -#define _PRIVATE_F_type_array_uint8_h - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Private implementation for appending the uint8 array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param source - * The source uint8 to append. - * @param destination - * The destination lengths the source is appended onto. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_array_increase(). - * - * @see f_memory_array_increase() - * - * @see f_uint8s_append() - * @see f_uint8ss_append() - */ -#if !defined(_di_f_uint8s_append_) || !defined(_di_f_uint8ss_append_) - extern f_status_t private_f_uint8s_append(const uint8_t source, f_uint8s_t * const destination) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_uint8s_append_) || !defined(_di_f_uint8ss_append_) - -/** - * Private implementation for appending the uint8 array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param source - * The source uint8s to append. - * @param destination - * The destination lengths the source is appended onto. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - * - * @see f_uint8s_append_all() - * @see f_uint8ss_append() - * @see f_uint8ss_append_all() - */ -#if !defined(_di_f_uint8s_append_) || !defined(_di_f_uint8s_append_all_) || !defined(_di_f_uint8ss_append_all_) - extern f_status_t private_f_uint8s_append_all(const f_uint8s_t source, f_uint8s_t * const destination) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_uint8s_append_) || !defined(_di_f_uint8s_append_all_) || !defined(_di_f_uint8ss_append_all_) - -/** - * Private implementation for resizing the uint8ss array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The length to adjust to. - * @param structure - * The uint8ss array to adjust. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if 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_uint8ss_adjust() - * @see f_uint8ss_decimate_by() - */ -#if !defined(_di_f_uint8ss_adjust_) || !defined(_di_f_uint8ss_decimate_by_) - extern f_status_t private_f_uint8ss_adjust(const f_number_unsigned_t length, f_uint8ss_t * const structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_uint8ss_adjust_) || !defined(_di_f_uint8ss_decimate_by_) - -/** - * Private implementation for resizing the uint8ss array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The length to resize to. - * @param structure - * The uint8ss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if 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_uint8ss_decrease_by() - * @see f_uint8ss_increase() - * @see f_uint8ss_increase_by() - * @see f_uint8ss_resize() - */ -#if !defined(_di_f_uint8ss_decrease_by_) || !defined(_di_f_uint8ss_increase_) || !defined(_di_f_uint8ss_increase_by_) || !defined(_di_f_uint8ss_resize_) - extern f_status_t private_f_uint8ss_resize(const f_number_unsigned_t length, f_uint8ss_t * const structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_uint8ss_decrease_by_) || !defined(_di_f_uint8ss_increase_) || !defined(_di_f_uint8ss_increase_by_) || !defined(_di_f_uint8ss_resize_) - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_F_type_array_uint8_h 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 844ae1061..d24084df0 100644 --- a/level_0/f_type_array/c/type_array/uint128.c +++ b/level_0/f_type_array/c/type_array/uint128.c @@ -1,227 +1,45 @@ #include "../type_array.h" #include "uint128.h" -#include "private-uint128.h" #ifdef __cplusplus extern "C" { #endif -#ifndef _di_f_uint128s_adjust_ - f_status_t f_uint128s_adjust(const f_number_unsigned_t length, f_uint128s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ +#ifndef _di_f_uint128s_adjust_callback_ + f_status_t f_uint128s_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const void_array) { - return f_memory_array_adjust(length, sizeof(uint128_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_uint128s_adjust_ - -#ifndef _di_f_uint128s_append_ - f_status_t f_uint128s_append(const uint128_t source, f_uint128s_t * const 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_uint128s_append(source, destination); - } -#endif // _di_f_uint128s_append_ - -#ifndef _di_f_uint128s_append_all_ - f_status_t f_uint128s_append_all(const f_uint128s_t source, f_uint128s_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_uint128s_append_all(source, destination); - } -#endif // _di_f_uint128s_append_all_ - -#ifndef _di_f_uint128s_decimate_by_ - f_status_t f_uint128s_decimate_by(const f_number_unsigned_t amount, f_uint128s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_decimate_by(amount, sizeof(uint128_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_uint128s_decimate_by_ - -#ifndef _di_f_uint128s_decrease_by_ - f_status_t f_uint128s_decrease_by(const f_number_unsigned_t amount, f_uint128s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_decrease_by(amount, sizeof(uint128_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_uint128s_decrease_by_ - -#ifndef _di_f_uint128s_increase_ - f_status_t f_uint128s_increase(const f_number_unsigned_t step, f_uint128s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_increase(step, sizeof(uint128_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_uint128s_increase_ - -#ifndef _di_f_uint128s_increase_by_ - f_status_t f_uint128s_increase_by(const f_number_unsigned_t amount, f_uint128s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_increase_by(amount, sizeof(uint128_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_uint128s_increase_by_ - -#ifndef _di_f_uint128s_resize_ - f_status_t f_uint128s_resize(const f_number_unsigned_t length, f_uint128s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_resize(length, sizeof(uint128_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_uint128s_resize_ - -#ifndef _di_f_uint128ss_adjust_ - f_status_t f_uint128ss_adjust(const f_number_unsigned_t length, f_uint128ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_uint128ss_adjust(length, structure); - } -#endif // _di_f_uint128ss_adjust_ - -#ifndef _di_f_uint128ss_append_ - f_status_t f_uint128ss_append(const f_uint128s_t source, f_uint128ss_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_uint128s_t), (void **) &destination->array, &destination->used, &destination->size); - if (F_status_is_error(status)) return status; - - status = private_f_uint128s_append_all(source, &destination->array[destination->used]); - if (F_status_is_error(status)) return status; - - ++destination->used; + { + f_uint128s_t * const array = (f_uint128s_t *) void_array; + f_status_t status = F_none; - return F_none; - } -#endif // _di_f_uint128ss_append_ - -#ifndef _di_f_uint128ss_append_all_ - f_status_t f_uint128ss_append_all(const f_uint128ss_t source, f_uint128ss_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; + for (f_number_unsigned_t i = start; i < size; ++i) { - f_status_t status = f_memory_array_increase_by(source.used, sizeof(f_uint128s_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_uint128s_append_all(source.array[i], &destination->array[destination->used]); + status = f_memory_array_adjust(0, sizeof(f_uint128_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; - } - } // for - - return F_none; - } -#endif // _di_f_uint128ss_append_all_ - -#ifndef _di_f_uint128ss_decimate_by_ - f_status_t f_uint128ss_decimate_by(const f_number_unsigned_t amount, f_uint128ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!amount) return F_data_not; - - return private_f_uint128ss_adjust((structure->size - amount > 0) ? structure->size - amount : 0, structure); - } -#endif // _di_f_uint128ss_decimate_by_ - -#ifndef _di_f_uint128ss_decrease_by_ - f_status_t f_uint128ss_decrease_by(const f_number_unsigned_t amount, f_uint128ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!amount) return F_data_not; - - return private_f_uint128ss_resize((structure->size - amount > 0) ? structure->size - amount : 0, structure); - } -#endif // _di_f_uint128ss_decrease_by_ - -#ifndef _di_f_uint128ss_increase_ - f_status_t f_uint128ss_increase(const f_number_unsigned_t step, f_uint128ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (step && structure->used + 1 > structure->size) { - if (structure->used >= F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); - - f_number_unsigned_t length = structure->used + step; - - if (length > F_number_t_size_unsigned_d) { - if (structure->used + 1 > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); - - length = F_number_t_size_unsigned_d; - } - - return private_f_uint128ss_resize(length, structure); + } // for } - return F_data_not; + return F_none; } -#endif // _di_f_uint128ss_increase_ - -#ifndef _di_f_uint128ss_increase_by_ - f_status_t f_uint128ss_increase_by(const f_number_unsigned_t amount, f_uint128ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ +#endif // _di_f_uint128s_adjust_callback_ - if (amount) { - if (structure->used >= F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); +#ifndef _di_f_uint128s_resize_callback_ + f_status_t f_uint128s_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const void_array) { - const f_number_unsigned_t length = structure->used + amount; + { + f_uint128s_t * const array = (f_uint128s_t *) void_array; + f_status_t status = F_none; - if (length > structure->size) { - if (length > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); + for (f_number_unsigned_t i = start; i < size; ++i) { - return private_f_uint128ss_resize(structure->used + amount, structure); - } + status = f_memory_array_resize(0, sizeof(f_uint128_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } // for } - return F_data_not; - } -#endif // _di_f_uint128ss_increase_by_ - -#ifndef _di_f_uint128ss_resize_ - f_status_t f_uint128ss_resize(const f_number_unsigned_t length, f_uint128ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_uint128ss_resize(length, structure); + return F_none; } -#endif // _di_f_uint128ss_resize_ +#endif // _di_f_uint128s_resize_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/uint128.h b/level_0/f_type_array/c/type_array/uint128.h index 1c68028c9..a46b8beee 100644 --- a/level_0/f_type_array/c/type_array/uint128.h +++ b/level_0/f_type_array/c/type_array/uint128.h @@ -17,275 +17,17 @@ extern "C" { #endif /** - * Resize the string uint128s array. + * A callback intended to be passed to f_memory_arrays_adjust() for an f_uint128ss_t structure. * - * @param length - * The new size to use. - * @param structure - * The string uint128s array to resize. + * This does not do parameter checking. * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_adjust(). - * - * @see f_memory_array_adjust() - */ -#ifndef _di_f_uint128s_adjust_ - extern f_status_t f_uint128s_adjust(const f_number_unsigned_t length, f_uint128s_t * const structure); -#endif // _di_f_uint128s_adjust_ - -/** - * Append the single source uint128 onto the destination. - * - * @param source - * The source uint128 to append. - * @param destination - * The destination uint128s the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase(). - * - * @see f_memory_array_increase() - */ -#ifndef _di_f_uint128s_append_ - extern f_status_t f_uint128s_append(const uint128_t source, f_uint128s_t * const destination); -#endif // _di_f_uint128s_append_ - -/** - * Append the source uint128s onto the destination. - * - * @param source - * The source uint128s to append. - * @param destination - * The destination uint128s the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_uint128s_append_all_ - extern f_status_t f_uint128s_append_all(const f_uint128s_t source, f_uint128s_t * const destination); -#endif // _di_f_uint128s_append_all_ - -/** - * Resize the string uint128s 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 structure - * The string uint128s array to resize. - * - * @return - * F_none on success. - * F_data_not if amount is 0. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_decimate_by(). - * - * @see f_memory_array_decimate_by() - */ -#ifndef _di_f_uint128s_decimate_by_ - extern f_status_t f_uint128s_decimate_by(const f_number_unsigned_t amount, f_uint128s_t * const structure); -#endif // _di_f_uint128s_decimate_by_ - -/** - * Resize the string uint128s 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 structure - * The string uint128s array to resize. - * - * @return - * F_none on success. - * F_data_not if amount is 0. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_decrease_by(). - * - * @see f_memory_array_decrease_by() - */ -#ifndef _di_f_uint128s_decrease_by_ - extern f_status_t f_uint128s_decrease_by(const f_number_unsigned_t amount, f_uint128s_t * const structure); -#endif // _di_f_uint128s_decrease_by_ - -/** - * Increase the size of the string uint128s 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 structure - * The string uint128s array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_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_uint128s_increase_ - extern f_status_t f_uint128s_increase(const f_number_unsigned_t step, f_uint128s_t * const structure); -#endif // _di_f_uint128s_increase_ - -/** - * Resize the string uint128s 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 structure - * The string uint128s array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * 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_uint128s_increase_by_ - extern f_status_t f_uint128s_increase_by(const f_number_unsigned_t amount, f_uint128s_t * const structure); -#endif // _di_f_uint128s_increase_by_ - -/** - * Resize the string uint128s array. - * - * @param length - * The new size to use. - * @param structure - * The string uint128s array to adjust. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - */ -#ifndef _di_f_uint128s_resize_ - extern f_status_t f_uint128s_resize(const f_number_unsigned_t length, f_uint128s_t * const structure); -#endif // _di_f_uint128s_resize_ - -/** - * Resize the string uint128ss array. - * - * @param length - * The new size to use. - * @param structure - * The string uint128ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_adjust(). - * - * @see f_memory_array_adjust() - */ -#ifndef _di_f_uint128ss_adjust_ - extern f_status_t f_uint128ss_adjust(const f_number_unsigned_t length, f_uint128ss_t * const structure); -#endif // _di_f_uint128ss_adjust_ - -/** - * Append the single source uint128s onto the destination. - * - * @param source - * The source uint128s to append. - * @param destination - * The destination ranges the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase(). - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase() - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_uint128ss_append_ - extern f_status_t f_uint128ss_append(const f_uint128s_t source, f_uint128ss_t * const destination); -#endif // _di_f_uint128ss_append_ - -/** - * Append the source uint128ss onto the destination. - * - * @param source - * The source uint128ss to append. - * @param destination - * The destination ranges the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_uint128ss_append_all_ - extern f_status_t f_uint128ss_append_all(const f_uint128ss_t source, f_uint128ss_t * const destination); -#endif // _di_f_uint128ss_append_all_ - -/** - * Resize the string uint128ss 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 structure - * The string uint128ss array to resize. + * @param start + * The start position in the array to start deleting. + * @param stop + * The stop in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return * F_none on success. @@ -295,97 +37,24 @@ extern "C" { * Errors (with error bit) from: f_memory_array_adjust(). * * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() */ -#ifndef _di_f_uint128ss_decimate_by_ - extern f_status_t f_uint128ss_decimate_by(const f_number_unsigned_t amount, f_uint128ss_t * const structure); -#endif // _di_f_uint128ss_decimate_by_ - -/** - * Resize the string uint128ss 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 structure - * The string uint128ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - */ -#ifndef _di_f_uint128ss_decrease_by_ - extern f_status_t f_uint128ss_decrease_by(const f_number_unsigned_t amount, f_uint128ss_t * const structure); -#endif // _di_f_uint128ss_decrease_by_ +#ifndef _di_f_uint128s_adjust_callback_ + extern f_status_t f_uint128s_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array); +#endif // _di_f_uint128s_adjust_callback_ /** - * Increase the size of the string uint128ss 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. + * A callback intended to be passed to f_memory_arrays_resize() for an f_uint128ss_t structure. * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param structure - * The string uint128ss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_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_uint128ss_increase_ - extern f_status_t f_uint128ss_increase(const f_number_unsigned_t step, f_uint128ss_t * const structure); -#endif // _di_f_uint128ss_increase_ - -/** - * Resize the string uint128ss 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 structure - * The string uint128ss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * 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_uint128ss_increase_by_ - extern f_status_t f_uint128ss_increase_by(const f_number_unsigned_t amount, f_uint128ss_t * const structure); -#endif // _di_f_uint128ss_increase_by_ - -/** - * Resize the string uint128ss array. + * This does not do parameter checking. * - * @param length - * The new size to use. - * @param structure - * The string uint128ss array to adjust. + * @param start + * The start position in the array to start deleting. + * @param stop + * The stop in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return * F_none on success. @@ -395,10 +64,11 @@ extern "C" { * Errors (with error bit) from: f_memory_array_resize(). * * @see f_memory_array_resize() + * @see f_memory_arrays_resize() */ -#ifndef _di_f_uint128ss_resize_ - extern f_status_t f_uint128ss_resize(const f_number_unsigned_t length, f_uint128ss_t * const structure); -#endif // _di_f_uint128ss_resize_ +#ifndef _di_f_uint128s_resize_callback_ + extern f_status_t f_uint128s_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array); +#endif // _di_f_uint128s_resize_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/uint16.c b/level_0/f_type_array/c/type_array/uint16.c index 91e6a0214..076ba6726 100644 --- a/level_0/f_type_array/c/type_array/uint16.c +++ b/level_0/f_type_array/c/type_array/uint16.c @@ -1,227 +1,45 @@ #include "../type_array.h" #include "uint16.h" -#include "private-uint16.h" #ifdef __cplusplus extern "C" { #endif -#ifndef _di_f_uint16s_adjust_ - f_status_t f_uint16s_adjust(const f_number_unsigned_t length, f_uint16s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ +#ifndef _di_f_uint16s_adjust_callback_ + f_status_t f_uint16s_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const void_array) { - return f_memory_array_adjust(length, sizeof(uint16_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_uint16s_adjust_ - -#ifndef _di_f_uint16s_append_ - f_status_t f_uint16s_append(const uint16_t source, f_uint16s_t * const 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_uint16s_append(source, destination); - } -#endif // _di_f_uint16s_append_ - -#ifndef _di_f_uint16s_append_all_ - f_status_t f_uint16s_append_all(const f_uint16s_t source, f_uint16s_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_uint16s_append_all(source, destination); - } -#endif // _di_f_uint16s_append_all_ - -#ifndef _di_f_uint16s_decimate_by_ - f_status_t f_uint16s_decimate_by(const f_number_unsigned_t amount, f_uint16s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_decimate_by(amount, sizeof(uint16_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_uint16s_decimate_by_ - -#ifndef _di_f_uint16s_decrease_by_ - f_status_t f_uint16s_decrease_by(const f_number_unsigned_t amount, f_uint16s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_decrease_by(amount, sizeof(uint16_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_uint16s_decrease_by_ - -#ifndef _di_f_uint16s_increase_ - f_status_t f_uint16s_increase(const f_number_unsigned_t step, f_uint16s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_increase(step, sizeof(uint16_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_uint16s_increase_ - -#ifndef _di_f_uint16s_increase_by_ - f_status_t f_uint16s_increase_by(const f_number_unsigned_t amount, f_uint16s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_increase_by(amount, sizeof(uint16_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_uint16s_increase_by_ - -#ifndef _di_f_uint16s_resize_ - f_status_t f_uint16s_resize(const f_number_unsigned_t length, f_uint16s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_resize(length, sizeof(uint16_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_uint16s_resize_ - -#ifndef _di_f_uint16ss_adjust_ - f_status_t f_uint16ss_adjust(const f_number_unsigned_t length, f_uint16ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_uint16ss_adjust(length, structure); - } -#endif // _di_f_uint16ss_adjust_ - -#ifndef _di_f_uint16ss_append_ - f_status_t f_uint16ss_append(const f_uint16s_t source, f_uint16ss_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_uint16s_t), (void **) &destination->array, &destination->used, &destination->size); - if (F_status_is_error(status)) return status; - - status = private_f_uint16s_append_all(source, &destination->array[destination->used]); - if (F_status_is_error(status)) return status; - - ++destination->used; + { + f_uint16s_t * const array = (f_uint16s_t *) void_array; + f_status_t status = F_none; - return F_none; - } -#endif // _di_f_uint16ss_append_ - -#ifndef _di_f_uint16ss_append_all_ - f_status_t f_uint16ss_append_all(const f_uint16ss_t source, f_uint16ss_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; + for (f_number_unsigned_t i = start; i < size; ++i) { - f_status_t status = f_memory_array_increase_by(source.used, sizeof(f_uint16s_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_uint16s_append_all(source.array[i], &destination->array[destination->used]); + status = f_memory_array_adjust(0, sizeof(uint16_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; - } - } // for - - return F_none; - } -#endif // _di_f_uint16ss_append_all_ - -#ifndef _di_f_uint16ss_decimate_by_ - f_status_t f_uint16ss_decimate_by(const f_number_unsigned_t amount, f_uint16ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!amount) return F_data_not; - - return private_f_uint16ss_adjust((structure->size - amount > 0) ? structure->size - amount : 0, structure); - } -#endif // _di_f_uint16ss_decimate_by_ - -#ifndef _di_f_uint16ss_decrease_by_ - f_status_t f_uint16ss_decrease_by(const f_number_unsigned_t amount, f_uint16ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!amount) return F_data_not; - - return private_f_uint16ss_resize((structure->size - amount > 0) ? structure->size - amount : 0, structure); - } -#endif // _di_f_uint16ss_decrease_by_ - -#ifndef _di_f_uint16ss_increase_ - f_status_t f_uint16ss_increase(const f_number_unsigned_t step, f_uint16ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (step && structure->used + 1 > structure->size) { - if (structure->used >= F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); - - f_number_unsigned_t length = structure->used + step; - - if (length > F_number_t_size_unsigned_d) { - if (structure->used + 1 > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); - - length = F_number_t_size_unsigned_d; - } - - return private_f_uint16ss_resize(length, structure); + } // for } - return F_data_not; + return F_none; } -#endif // _di_f_uint16ss_increase_ - -#ifndef _di_f_uint16ss_increase_by_ - f_status_t f_uint16ss_increase_by(const f_number_unsigned_t amount, f_uint16ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ +#endif // _di_f_uint16s_adjust_callback_ - if (amount) { - if (structure->used >= F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); +#ifndef _di_f_uint16s_resize_callback_ + f_status_t f_uint16s_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const void_array) { - const f_number_unsigned_t length = structure->used + amount; + { + f_uint16s_t * const array = (f_uint16s_t *) void_array; + f_status_t status = F_none; - if (length > structure->size) { - if (length > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); + for (f_number_unsigned_t i = start; i < size; ++i) { - return private_f_uint16ss_resize(structure->used + amount, structure); - } + status = f_memory_array_resize(0, sizeof(uint16_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } // for } - return F_data_not; - } -#endif // _di_f_uint16ss_increase_by_ - -#ifndef _di_f_uint16ss_resize_ - f_status_t f_uint16ss_resize(const f_number_unsigned_t length, f_uint16ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_uint16ss_resize(length, structure); + return F_none; } -#endif // _di_f_uint16ss_resize_ +#endif // _di_f_uint16s_resize_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/uint16.h b/level_0/f_type_array/c/type_array/uint16.h index b7cd2ddd2..c110caca2 100644 --- a/level_0/f_type_array/c/type_array/uint16.h +++ b/level_0/f_type_array/c/type_array/uint16.h @@ -17,275 +17,17 @@ extern "C" { #endif /** - * Resize the string uint16s array. + * A callback intended to be passed to f_memory_arrays_adjust() for an f_uint16ss_t structure. * - * @param length - * The new size to use. - * @param structure - * The string uint16s array to resize. + * This does not do parameter checking. * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_adjust(). - * - * @see f_memory_array_adjust() - */ -#ifndef _di_f_uint16s_adjust_ - extern f_status_t f_uint16s_adjust(const f_number_unsigned_t length, f_uint16s_t * const structure); -#endif // _di_f_uint16s_adjust_ - -/** - * Append the single source uint16 onto the destination. - * - * @param source - * The source uint16 to append. - * @param destination - * The destination uint16s the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase(). - * - * @see f_memory_array_increase() - */ -#ifndef _di_f_uint16s_append_ - extern f_status_t f_uint16s_append(const uint16_t source, f_uint16s_t * const destination); -#endif // _di_f_uint16s_append_ - -/** - * Append the source uint16s onto the destination. - * - * @param source - * The source uint16s to append. - * @param destination - * The destination uint16s the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_uint16s_append_all_ - extern f_status_t f_uint16s_append_all(const f_uint16s_t source, f_uint16s_t * const destination); -#endif // _di_f_uint16s_append_all_ - -/** - * Resize the string uint16s 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 structure - * The string uint16s array to resize. - * - * @return - * F_none on success. - * F_data_not if amount is 0. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_decimate_by(). - * - * @see f_memory_array_decimate_by() - */ -#ifndef _di_f_uint16s_decimate_by_ - extern f_status_t f_uint16s_decimate_by(const f_number_unsigned_t amount, f_uint16s_t * const structure); -#endif // _di_f_uint16s_decimate_by_ - -/** - * Resize the string uint16s 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 structure - * The string uint16s array to resize. - * - * @return - * F_none on success. - * F_data_not if amount is 0. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_decrease_by(). - * - * @see f_memory_array_decrease_by() - */ -#ifndef _di_f_uint16s_decrease_by_ - extern f_status_t f_uint16s_decrease_by(const f_number_unsigned_t amount, f_uint16s_t * const structure); -#endif // _di_f_uint16s_decrease_by_ - -/** - * Increase the size of the string uint16s 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 structure - * The string uint16s array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_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_uint16s_increase_ - extern f_status_t f_uint16s_increase(const f_number_unsigned_t step, f_uint16s_t * const structure); -#endif // _di_f_uint16s_increase_ - -/** - * Resize the string uint16s 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 structure - * The string uint16s array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * 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_uint16s_increase_by_ - extern f_status_t f_uint16s_increase_by(const f_number_unsigned_t amount, f_uint16s_t * const structure); -#endif // _di_f_uint16s_increase_by_ - -/** - * Resize the string uint16s array. - * - * @param length - * The new size to use. - * @param structure - * The string uint16s array to adjust. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - */ -#ifndef _di_f_uint16s_resize_ - extern f_status_t f_uint16s_resize(const f_number_unsigned_t length, f_uint16s_t * const structure); -#endif // _di_f_uint16s_resize_ - -/** - * Resize the string uint16ss array. - * - * @param length - * The new size to use. - * @param structure - * The string uint16ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_adjust(). - * - * @see f_memory_array_adjust() - */ -#ifndef _di_f_uint16ss_adjust_ - extern f_status_t f_uint16ss_adjust(const f_number_unsigned_t length, f_uint16ss_t * const structure); -#endif // _di_f_uint16ss_adjust_ - -/** - * Append the single source uint16s onto the destination. - * - * @param source - * The source uint16s to append. - * @param destination - * The destination ranges the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase(). - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase() - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_uint16ss_append_ - extern f_status_t f_uint16ss_append(const f_uint16s_t source, f_uint16ss_t * const destination); -#endif // _di_f_uint16ss_append_ - -/** - * Append the source uint16ss onto the destination. - * - * @param source - * The source uint16ss to append. - * @param destination - * The destination ranges the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_uint16ss_append_all_ - extern f_status_t f_uint16ss_append_all(const f_uint16ss_t source, f_uint16ss_t * const destination); -#endif // _di_f_uint16ss_append_all_ - -/** - * Resize the string uint16ss 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 structure - * The string uint16ss array to resize. + * @param start + * The start position in the array to start deleting. + * @param stop + * The stop in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return * F_none on success. @@ -295,97 +37,24 @@ extern "C" { * Errors (with error bit) from: f_memory_array_adjust(). * * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() */ -#ifndef _di_f_uint16ss_decimate_by_ - extern f_status_t f_uint16ss_decimate_by(const f_number_unsigned_t amount, f_uint16ss_t * const structure); -#endif // _di_f_uint16ss_decimate_by_ - -/** - * Resize the string uint16ss 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 structure - * The string uint16ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - */ -#ifndef _di_f_uint16ss_decrease_by_ - extern f_status_t f_uint16ss_decrease_by(const f_number_unsigned_t amount, f_uint16ss_t * const structure); -#endif // _di_f_uint16ss_decrease_by_ +#ifndef _di_f_uint16s_adjust_callback_ + extern f_status_t f_uint16s_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array); +#endif // _di_f_uint16s_adjust_callback_ /** - * Increase the size of the string uint16ss 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. + * A callback intended to be passed to f_memory_arrays_resize() for an f_uint16ss_t structure. * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param structure - * The string uint16ss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_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_uint16ss_increase_ - extern f_status_t f_uint16ss_increase(const f_number_unsigned_t step, f_uint16ss_t * const structure); -#endif // _di_f_uint16ss_increase_ - -/** - * Resize the string uint16ss 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 structure - * The string uint16ss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * 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_uint16ss_increase_by_ - extern f_status_t f_uint16ss_increase_by(const f_number_unsigned_t amount, f_uint16ss_t * const structure); -#endif // _di_f_uint16ss_increase_by_ - -/** - * Resize the string uint16ss array. + * This does not do parameter checking. * - * @param length - * The new size to use. - * @param structure - * The string uint16ss array to adjust. + * @param start + * The start position in the array to start deleting. + * @param stop + * The stop in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return * F_none on success. @@ -395,10 +64,11 @@ extern "C" { * Errors (with error bit) from: f_memory_array_resize(). * * @see f_memory_array_resize() + * @see f_memory_arrays_resize() */ -#ifndef _di_f_uint16ss_resize_ - extern f_status_t f_uint16ss_resize(const f_number_unsigned_t length, f_uint16ss_t * const structure); -#endif // _di_f_uint16ss_resize_ +#ifndef _di_f_uint16s_resize_callback_ + extern f_status_t f_uint16s_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array); +#endif // _di_f_uint16s_resize_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/uint32.c b/level_0/f_type_array/c/type_array/uint32.c index 84bf5ec0f..25de94b18 100644 --- a/level_0/f_type_array/c/type_array/uint32.c +++ b/level_0/f_type_array/c/type_array/uint32.c @@ -1,227 +1,45 @@ #include "../type_array.h" #include "uint32.h" -#include "private-uint32.h" #ifdef __cplusplus extern "C" { #endif -#ifndef _di_f_uint32s_adjust_ - f_status_t f_uint32s_adjust(const f_number_unsigned_t length, f_uint32s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ +#ifndef _di_f_uint32s_adjust_callback_ + f_status_t f_uint32s_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const void_array) { - return f_memory_array_adjust(length, sizeof(uint32_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_uint32s_adjust_ - -#ifndef _di_f_uint32s_append_ - f_status_t f_uint32s_append(const uint32_t source, f_uint32s_t * const 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_uint32s_append(source, destination); - } -#endif // _di_f_uint32s_append_ - -#ifndef _di_f_uint32s_append_all_ - f_status_t f_uint32s_append_all(const f_uint32s_t source, f_uint32s_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_uint32s_append_all(source, destination); - } -#endif // _di_f_uint32s_append_all_ - -#ifndef _di_f_uint32s_decimate_by_ - f_status_t f_uint32s_decimate_by(const f_number_unsigned_t amount, f_uint32s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_decimate_by(amount, sizeof(uint32_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_uint32s_decimate_by_ - -#ifndef _di_f_uint32s_decrease_by_ - f_status_t f_uint32s_decrease_by(const f_number_unsigned_t amount, f_uint32s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_decrease_by(amount, sizeof(uint32_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_uint32s_decrease_by_ - -#ifndef _di_f_uint32s_increase_ - f_status_t f_uint32s_increase(const f_number_unsigned_t step, f_uint32s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_increase(step, sizeof(uint32_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_uint32s_increase_ - -#ifndef _di_f_uint32s_increase_by_ - f_status_t f_uint32s_increase_by(const f_number_unsigned_t amount, f_uint32s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_increase_by(amount, sizeof(uint32_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_uint32s_increase_by_ - -#ifndef _di_f_uint32s_resize_ - f_status_t f_uint32s_resize(const f_number_unsigned_t length, f_uint32s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_resize(length, sizeof(uint32_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_uint32s_resize_ - -#ifndef _di_f_uint32ss_adjust_ - f_status_t f_uint32ss_adjust(const f_number_unsigned_t length, f_uint32ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_uint32ss_adjust(length, structure); - } -#endif // _di_f_uint32ss_adjust_ - -#ifndef _di_f_uint32ss_append_ - f_status_t f_uint32ss_append(const f_uint32s_t source, f_uint32ss_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_uint32s_t), (void **) &destination->array, &destination->used, &destination->size); - if (F_status_is_error(status)) return status; - - status = private_f_uint32s_append_all(source, &destination->array[destination->used]); - if (F_status_is_error(status)) return status; - - ++destination->used; + { + f_uint32s_t * const array = (f_uint32s_t *) void_array; + f_status_t status = F_none; - return F_none; - } -#endif // _di_f_uint32ss_append_ - -#ifndef _di_f_uint32ss_append_all_ - f_status_t f_uint32ss_append_all(const f_uint32ss_t source, f_uint32ss_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; + for (f_number_unsigned_t i = start; i < size; ++i) { - f_status_t status = f_memory_array_increase_by(source.used, sizeof(f_uint32s_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_uint32s_append_all(source.array[i], &destination->array[destination->used]); + status = f_memory_array_adjust(0, sizeof(uint32_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; - } - } // for - - return F_none; - } -#endif // _di_f_uint32ss_append_all_ - -#ifndef _di_f_uint32ss_decimate_by_ - f_status_t f_uint32ss_decimate_by(const f_number_unsigned_t amount, f_uint32ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!amount) return F_data_not; - - return private_f_uint32ss_adjust((structure->size - amount > 0) ? structure->size - amount : 0, structure); - } -#endif // _di_f_uint32ss_decimate_by_ - -#ifndef _di_f_uint32ss_decrease_by_ - f_status_t f_uint32ss_decrease_by(const f_number_unsigned_t amount, f_uint32ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!amount) return F_data_not; - - return private_f_uint32ss_resize((structure->size - amount > 0) ? structure->size - amount : 0, structure); - } -#endif // _di_f_uint32ss_decrease_by_ - -#ifndef _di_f_uint32ss_increase_ - f_status_t f_uint32ss_increase(const f_number_unsigned_t step, f_uint32ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (step && structure->used + 1 > structure->size) { - if (structure->used >= F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); - - f_number_unsigned_t length = structure->used + step; - - if (length > F_number_t_size_unsigned_d) { - if (structure->used + 1 > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); - - length = F_number_t_size_unsigned_d; - } - - return private_f_uint32ss_resize(length, structure); + } // for } - return F_data_not; + return F_none; } -#endif // _di_f_uint32ss_increase_ - -#ifndef _di_f_uint32ss_increase_by_ - f_status_t f_uint32ss_increase_by(const f_number_unsigned_t amount, f_uint32ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ +#endif // _di_f_uint32s_adjust_callback_ - if (amount) { - if (structure->used >= F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); +#ifndef _di_f_uint32s_resize_callback_ + f_status_t f_uint32s_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const void_array) { - const f_number_unsigned_t length = structure->used + amount; + { + f_uint32s_t * const array = (f_uint32s_t *) void_array; + f_status_t status = F_none; - if (length > structure->size) { - if (length > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); + for (f_number_unsigned_t i = start; i < size; ++i) { - return private_f_uint32ss_resize(structure->used + amount, structure); - } + status = f_memory_array_resize(0, sizeof(uint32_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } // for } - return F_data_not; - } -#endif // _di_f_uint32ss_increase_by_ - -#ifndef _di_f_uint32ss_resize_ - f_status_t f_uint32ss_resize(const f_number_unsigned_t length, f_uint32ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_uint32ss_resize(length, structure); + return F_none; } -#endif // _di_f_uint32ss_resize_ +#endif // _di_f_uint32s_resize_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/uint32.h b/level_0/f_type_array/c/type_array/uint32.h index 06894abb0..4f3e54ee0 100644 --- a/level_0/f_type_array/c/type_array/uint32.h +++ b/level_0/f_type_array/c/type_array/uint32.h @@ -17,275 +17,17 @@ extern "C" { #endif /** - * Resize the string uint32s array. + * A callback intended to be passed to f_memory_arrays_adjust() for an f_uint32ss_t structure. * - * @param length - * The new size to use. - * @param structure - * The string uint32s array to resize. + * This does not do parameter checking. * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_adjust(). - * - * @see f_memory_array_adjust() - */ -#ifndef _di_f_uint32s_adjust_ - extern f_status_t f_uint32s_adjust(const f_number_unsigned_t length, f_uint32s_t * const structure); -#endif // _di_f_uint32s_adjust_ - -/** - * Append the single source uint32 onto the destination. - * - * @param source - * The source uint32 to append. - * @param destination - * The destination uint32s the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase(). - * - * @see f_memory_array_increase() - */ -#ifndef _di_f_uint32s_append_ - extern f_status_t f_uint32s_append(const uint32_t source, f_uint32s_t * const destination); -#endif // _di_f_uint32s_append_ - -/** - * Append the source uint32s onto the destination. - * - * @param source - * The source uint32s to append. - * @param destination - * The destination uint32s the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_uint32s_append_all_ - extern f_status_t f_uint32s_append_all(const f_uint32s_t source, f_uint32s_t * const destination); -#endif // _di_f_uint32s_append_all_ - -/** - * Resize the string uint32s 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 structure - * The string uint32s array to resize. - * - * @return - * F_none on success. - * F_data_not if amount is 0. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_decimate_by(). - * - * @see f_memory_array_decimate_by() - */ -#ifndef _di_f_uint32s_decimate_by_ - extern f_status_t f_uint32s_decimate_by(const f_number_unsigned_t amount, f_uint32s_t * const structure); -#endif // _di_f_uint32s_decimate_by_ - -/** - * Resize the string uint32s 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 structure - * The string uint32s array to resize. - * - * @return - * F_none on success. - * F_data_not if amount is 0. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_decrease_by(). - * - * @see f_memory_array_decrease_by() - */ -#ifndef _di_f_uint32s_decrease_by_ - extern f_status_t f_uint32s_decrease_by(const f_number_unsigned_t amount, f_uint32s_t * const structure); -#endif // _di_f_uint32s_decrease_by_ - -/** - * Increase the size of the string uint32s 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 structure - * The string uint32s array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_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_uint32s_increase_ - extern f_status_t f_uint32s_increase(const f_number_unsigned_t step, f_uint32s_t * const structure); -#endif // _di_f_uint32s_increase_ - -/** - * Resize the string uint32s 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 structure - * The string uint32s array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * 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_uint32s_increase_by_ - extern f_status_t f_uint32s_increase_by(const f_number_unsigned_t amount, f_uint32s_t * const structure); -#endif // _di_f_uint32s_increase_by_ - -/** - * Resize the string uint32s array. - * - * @param length - * The new size to use. - * @param structure - * The string uint32s array to adjust. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - */ -#ifndef _di_f_uint32s_resize_ - extern f_status_t f_uint32s_resize(const f_number_unsigned_t length, f_uint32s_t * const structure); -#endif // _di_f_uint32s_resize_ - -/** - * Resize the string uint32ss array. - * - * @param length - * The new size to use. - * @param structure - * The string uint32ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_adjust(). - * - * @see f_memory_array_adjust() - */ -#ifndef _di_f_uint32ss_adjust_ - extern f_status_t f_uint32ss_adjust(const f_number_unsigned_t length, f_uint32ss_t * const structure); -#endif // _di_f_uint32ss_adjust_ - -/** - * Append the single source uint32s onto the destination. - * - * @param source - * The source uint32s to append. - * @param destination - * The destination ranges the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase(). - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase() - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_uint32ss_append_ - extern f_status_t f_uint32ss_append(const f_uint32s_t source, f_uint32ss_t * const destination); -#endif // _di_f_uint32ss_append_ - -/** - * Append the source uint32ss onto the destination. - * - * @param source - * The source uint32ss to append. - * @param destination - * The destination ranges the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_uint32ss_append_all_ - extern f_status_t f_uint32ss_append_all(const f_uint32ss_t source, f_uint32ss_t * const destination); -#endif // _di_f_uint32ss_append_all_ - -/** - * Resize the string uint32ss 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 structure - * The string uint32ss array to resize. + * @param start + * The start position in the array to start deleting. + * @param stop + * The stop in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return * F_none on success. @@ -295,97 +37,24 @@ extern "C" { * Errors (with error bit) from: f_memory_array_adjust(). * * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() */ -#ifndef _di_f_uint32ss_decimate_by_ - extern f_status_t f_uint32ss_decimate_by(const f_number_unsigned_t amount, f_uint32ss_t * const structure); -#endif // _di_f_uint32ss_decimate_by_ - -/** - * Resize the string uint32ss 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 structure - * The string uint32ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - */ -#ifndef _di_f_uint32ss_decrease_by_ - extern f_status_t f_uint32ss_decrease_by(const f_number_unsigned_t amount, f_uint32ss_t * const structure); -#endif // _di_f_uint32ss_decrease_by_ +#ifndef _di_f_uint32s_adjust_callback_ + extern f_status_t f_uint32s_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array); +#endif // _di_f_uint32s_adjust_callback_ /** - * Increase the size of the string uint32ss 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. + * A callback intended to be passed to f_memory_arrays_resize() for an f_uint32ss_t structure. * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param structure - * The string uint32ss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_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_uint32ss_increase_ - extern f_status_t f_uint32ss_increase(const f_number_unsigned_t step, f_uint32ss_t * const structure); -#endif // _di_f_uint32ss_increase_ - -/** - * Resize the string uint32ss 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 structure - * The string uint32ss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * 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_uint32ss_increase_by_ - extern f_status_t f_uint32ss_increase_by(const f_number_unsigned_t amount, f_uint32ss_t * const structure); -#endif // _di_f_uint32ss_increase_by_ - -/** - * Resize the string uint32ss array. + * This does not do parameter checking. * - * @param length - * The new size to use. - * @param structure - * The string uint32ss array to adjust. + * @param start + * The start position in the array to start deleting. + * @param stop + * The stop in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return * F_none on success. @@ -395,10 +64,11 @@ extern "C" { * Errors (with error bit) from: f_memory_array_resize(). * * @see f_memory_array_resize() + * @see f_memory_arrays_resize() */ -#ifndef _di_f_uint32ss_resize_ - extern f_status_t f_uint32ss_resize(const f_number_unsigned_t length, f_uint32ss_t * const structure); -#endif // _di_f_uint32ss_resize_ +#ifndef _di_f_uint32s_resize_callback_ + extern f_status_t f_uint32s_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array); +#endif // _di_f_uint32s_resize_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/uint64.c b/level_0/f_type_array/c/type_array/uint64.c index facdc3b88..cc436cb57 100644 --- a/level_0/f_type_array/c/type_array/uint64.c +++ b/level_0/f_type_array/c/type_array/uint64.c @@ -1,227 +1,45 @@ #include "../type_array.h" #include "uint64.h" -#include "private-uint64.h" #ifdef __cplusplus extern "C" { #endif -#ifndef _di_f_uint64s_adjust_ - f_status_t f_uint64s_adjust(const f_number_unsigned_t length, f_uint64s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ +#ifndef _di_f_uint64s_adjust_callback_ + f_status_t f_uint64s_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const void_array) { - return f_memory_array_adjust(length, sizeof(uint64_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_uint64s_adjust_ - -#ifndef _di_f_uint64s_append_ - f_status_t f_uint64s_append(const uint64_t source, f_uint64s_t * const 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_uint64s_append(source, destination); - } -#endif // _di_f_uint64s_append_ - -#ifndef _di_f_uint64s_append_all_ - f_status_t f_uint64s_append_all(const f_uint64s_t source, f_uint64s_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_uint64s_append_all(source, destination); - } -#endif // _di_f_uint64s_append_all_ - -#ifndef _di_f_uint64s_decimate_by_ - f_status_t f_uint64s_decimate_by(const f_number_unsigned_t amount, f_uint64s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_decimate_by(amount, sizeof(uint64_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_uint64s_decimate_by_ - -#ifndef _di_f_uint64s_decrease_by_ - f_status_t f_uint64s_decrease_by(const f_number_unsigned_t amount, f_uint64s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_decrease_by(amount, sizeof(uint64_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_uint64s_decrease_by_ - -#ifndef _di_f_uint64s_increase_ - f_status_t f_uint64s_increase(const f_number_unsigned_t step, f_uint64s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_increase(step, sizeof(uint64_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_uint64s_increase_ - -#ifndef _di_f_uint64s_increase_by_ - f_status_t f_uint64s_increase_by(const f_number_unsigned_t amount, f_uint64s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_increase_by(amount, sizeof(uint64_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_uint64s_increase_by_ - -#ifndef _di_f_uint64s_resize_ - f_status_t f_uint64s_resize(const f_number_unsigned_t length, f_uint64s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_resize(length, sizeof(uint64_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_uint64s_resize_ - -#ifndef _di_f_uint64ss_adjust_ - f_status_t f_uint64ss_adjust(const f_number_unsigned_t length, f_uint64ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_uint64ss_adjust(length, structure); - } -#endif // _di_f_uint64ss_adjust_ - -#ifndef _di_f_uint64ss_append_ - f_status_t f_uint64ss_append(const f_uint64s_t source, f_uint64ss_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_uint64s_t), (void **) &destination->array, &destination->used, &destination->size); - if (F_status_is_error(status)) return status; - - status = private_f_uint64s_append_all(source, &destination->array[destination->used]); - if (F_status_is_error(status)) return status; - - ++destination->used; + { + f_uint64s_t * const array = (f_uint64s_t *) void_array; + f_status_t status = F_none; - return F_none; - } -#endif // _di_f_uint64ss_append_ - -#ifndef _di_f_uint64ss_append_all_ - f_status_t f_uint64ss_append_all(const f_uint64ss_t source, f_uint64ss_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; + for (f_number_unsigned_t i = start; i < size; ++i) { - f_status_t status = f_memory_array_increase_by(source.used, sizeof(f_uint64s_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_uint64s_append_all(source.array[i], &destination->array[destination->used]); + status = f_memory_array_adjust(0, sizeof(uint64_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; - } - } // for - - return F_none; - } -#endif // _di_f_uint64ss_append_all_ - -#ifndef _di_f_uint64ss_decimate_by_ - f_status_t f_uint64ss_decimate_by(const f_number_unsigned_t amount, f_uint64ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!amount) return F_data_not; - - return private_f_uint64ss_adjust((structure->size - amount > 0) ? structure->size - amount : 0, structure); - } -#endif // _di_f_uint64ss_decimate_by_ - -#ifndef _di_f_uint64ss_decrease_by_ - f_status_t f_uint64ss_decrease_by(const f_number_unsigned_t amount, f_uint64ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!amount) return F_data_not; - - return private_f_uint64ss_resize((structure->size - amount > 0) ? structure->size - amount : 0, structure); - } -#endif // _di_f_uint64ss_decrease_by_ - -#ifndef _di_f_uint64ss_increase_ - f_status_t f_uint64ss_increase(const f_number_unsigned_t step, f_uint64ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (step && structure->used + 1 > structure->size) { - if (structure->used >= F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); - - f_number_unsigned_t length = structure->used + step; - - if (length > F_number_t_size_unsigned_d) { - if (structure->used + 1 > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); - - length = F_number_t_size_unsigned_d; - } - - return private_f_uint64ss_resize(length, structure); + } // for } - return F_data_not; + return F_none; } -#endif // _di_f_uint64ss_increase_ - -#ifndef _di_f_uint64ss_increase_by_ - f_status_t f_uint64ss_increase_by(const f_number_unsigned_t amount, f_uint64ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ +#endif // _di_f_uint64s_adjust_callback_ - if (amount) { - if (structure->used >= F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); +#ifndef _di_f_uint64s_resize_callback_ + f_status_t f_uint64s_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const void_array) { - const f_number_unsigned_t length = structure->used + amount; + { + f_uint64s_t * const array = (f_uint64s_t *) void_array; + f_status_t status = F_none; - if (length > structure->size) { - if (length > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); + for (f_number_unsigned_t i = start; i < size; ++i) { - return private_f_uint64ss_resize(structure->used + amount, structure); - } + status = f_memory_array_resize(0, sizeof(uint64_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } // for } - return F_data_not; - } -#endif // _di_f_uint64ss_increase_by_ - -#ifndef _di_f_uint64ss_resize_ - f_status_t f_uint64ss_resize(const f_number_unsigned_t length, f_uint64ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_uint64ss_resize(length, structure); + return F_none; } -#endif // _di_f_uint64ss_resize_ +#endif // _di_f_uint64s_resize_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/uint64.h b/level_0/f_type_array/c/type_array/uint64.h index c477fabbb..5d59fff22 100644 --- a/level_0/f_type_array/c/type_array/uint64.h +++ b/level_0/f_type_array/c/type_array/uint64.h @@ -17,275 +17,17 @@ extern "C" { #endif /** - * Resize the string uint64s array. + * A callback intended to be passed to f_memory_arrays_adjust() for an f_uint64ss_t structure. * - * @param length - * The new size to use. - * @param structure - * The string uint64s array to resize. + * This does not do parameter checking. * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_adjust(). - * - * @see f_memory_array_adjust() - */ -#ifndef _di_f_uint64s_adjust_ - extern f_status_t f_uint64s_adjust(const f_number_unsigned_t length, f_uint64s_t * const structure); -#endif // _di_f_uint64s_adjust_ - -/** - * Append the single source uint64 onto the destination. - * - * @param source - * The source uint64 to append. - * @param destination - * The destination uint64s the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase(). - * - * @see f_memory_array_increase() - */ -#ifndef _di_f_uint64s_append_ - extern f_status_t f_uint64s_append(const uint64_t source, f_uint64s_t * const destination); -#endif // _di_f_uint64s_append_ - -/** - * Append the source uint64s onto the destination. - * - * @param source - * The source uint64s to append. - * @param destination - * The destination uint64s the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_uint64s_append_all_ - extern f_status_t f_uint64s_append_all(const f_uint64s_t source, f_uint64s_t * const destination); -#endif // _di_f_uint64s_append_all_ - -/** - * Resize the string uint64s 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 structure - * The string uint64s array to resize. - * - * @return - * F_none on success. - * F_data_not if amount is 0. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_decimate_by(). - * - * @see f_memory_array_decimate_by() - */ -#ifndef _di_f_uint64s_decimate_by_ - extern f_status_t f_uint64s_decimate_by(const f_number_unsigned_t amount, f_uint64s_t * const structure); -#endif // _di_f_uint64s_decimate_by_ - -/** - * Resize the string uint64s 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 structure - * The string uint64s array to resize. - * - * @return - * F_none on success. - * F_data_not if amount is 0. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_decrease_by(). - * - * @see f_memory_array_decrease_by() - */ -#ifndef _di_f_uint64s_decrease_by_ - extern f_status_t f_uint64s_decrease_by(const f_number_unsigned_t amount, f_uint64s_t * const structure); -#endif // _di_f_uint64s_decrease_by_ - -/** - * Increase the size of the string uint64s 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 structure - * The string uint64s array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_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_uint64s_increase_ - extern f_status_t f_uint64s_increase(const f_number_unsigned_t step, f_uint64s_t * const structure); -#endif // _di_f_uint64s_increase_ - -/** - * Resize the string uint64s 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 structure - * The string uint64s array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * 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_uint64s_increase_by_ - extern f_status_t f_uint64s_increase_by(const f_number_unsigned_t amount, f_uint64s_t * const structure); -#endif // _di_f_uint64s_increase_by_ - -/** - * Resize the string uint64s array. - * - * @param length - * The new size to use. - * @param structure - * The string uint64s array to adjust. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - */ -#ifndef _di_f_uint64s_resize_ - extern f_status_t f_uint64s_resize(const f_number_unsigned_t length, f_uint64s_t * const structure); -#endif // _di_f_uint64s_resize_ - -/** - * Resize the string uint64ss array. - * - * @param length - * The new size to use. - * @param structure - * The string uint64ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_adjust(). - * - * @see f_memory_array_adjust() - */ -#ifndef _di_f_uint64ss_adjust_ - extern f_status_t f_uint64ss_adjust(const f_number_unsigned_t length, f_uint64ss_t * const structure); -#endif // _di_f_uint64ss_adjust_ - -/** - * Append the single source uint64s onto the destination. - * - * @param source - * The source uint64s to append. - * @param destination - * The destination ranges the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase(). - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase() - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_uint64ss_append_ - extern f_status_t f_uint64ss_append(const f_uint64s_t source, f_uint64ss_t * const destination); -#endif // _di_f_uint64ss_append_ - -/** - * Append the source uint64ss onto the destination. - * - * @param source - * The source uint64ss to append. - * @param destination - * The destination ranges the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_uint64ss_append_all_ - extern f_status_t f_uint64ss_append_all(const f_uint64ss_t source, f_uint64ss_t * const destination); -#endif // _di_f_uint64ss_append_all_ - -/** - * Resize the string uint64ss 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 structure - * The string uint64ss array to resize. + * @param start + * The start position in the array to start deleting. + * @param stop + * The stop in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return * F_none on success. @@ -295,97 +37,24 @@ extern "C" { * Errors (with error bit) from: f_memory_array_adjust(). * * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() */ -#ifndef _di_f_uint64ss_decimate_by_ - extern f_status_t f_uint64ss_decimate_by(const f_number_unsigned_t amount, f_uint64ss_t * const structure); -#endif // _di_f_uint64ss_decimate_by_ - -/** - * Resize the string uint64ss 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 structure - * The string uint64ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - */ -#ifndef _di_f_uint64ss_decrease_by_ - extern f_status_t f_uint64ss_decrease_by(const f_number_unsigned_t amount, f_uint64ss_t * const structure); -#endif // _di_f_uint64ss_decrease_by_ +#ifndef _di_f_uint64s_adjust_callback_ + extern f_status_t f_uint64s_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array); +#endif // _di_f_uint64s_adjust_callback_ /** - * Increase the size of the string uint64ss 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. + * A callback intended to be passed to f_memory_arrays_resize() for an f_uint64ss_t structure. * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param structure - * The string uint64ss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_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_uint64ss_increase_ - extern f_status_t f_uint64ss_increase(const f_number_unsigned_t step, f_uint64ss_t * const structure); -#endif // _di_f_uint64ss_increase_ - -/** - * Resize the string uint64ss 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 structure - * The string uint64ss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * 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_uint64ss_increase_by_ - extern f_status_t f_uint64ss_increase_by(const f_number_unsigned_t amount, f_uint64ss_t * const structure); -#endif // _di_f_uint64ss_increase_by_ - -/** - * Resize the string uint64ss array. + * This does not do parameter checking. * - * @param length - * The new size to use. - * @param structure - * The string uint64ss array to adjust. + * @param start + * The start position in the array to start deleting. + * @param stop + * The stop in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return * F_none on success. @@ -395,10 +64,11 @@ extern "C" { * Errors (with error bit) from: f_memory_array_resize(). * * @see f_memory_array_resize() + * @see f_memory_arrays_resize() */ -#ifndef _di_f_uint64ss_resize_ - extern f_status_t f_uint64ss_resize(const f_number_unsigned_t length, f_uint64ss_t * const structure); -#endif // _di_f_uint64ss_resize_ +#ifndef _di_f_uint64s_resize_callback_ + extern f_status_t f_uint64s_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array); +#endif // _di_f_uint64s_resize_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/uint8.c b/level_0/f_type_array/c/type_array/uint8.c index 4441883b6..eed0283f8 100644 --- a/level_0/f_type_array/c/type_array/uint8.c +++ b/level_0/f_type_array/c/type_array/uint8.c @@ -1,227 +1,45 @@ #include "../type_array.h" #include "uint8.h" -#include "private-uint8.h" #ifdef __cplusplus extern "C" { #endif -#ifndef _di_f_uint8s_adjust_ - f_status_t f_uint8s_adjust(const f_number_unsigned_t length, f_uint8s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ +#ifndef _di_f_uint8s_adjust_callback_ + f_status_t f_uint8s_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const void_array) { - return f_memory_array_adjust(length, sizeof(uint8_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_uint8s_adjust_ - -#ifndef _di_f_uint8s_append_ - f_status_t f_uint8s_append(const uint8_t source, f_uint8s_t * const 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_uint8s_append(source, destination); - } -#endif // _di_f_uint8s_append_ - -#ifndef _di_f_uint8s_append_all_ - f_status_t f_uint8s_append_all(const f_uint8s_t source, f_uint8s_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_uint8s_append_all(source, destination); - } -#endif // _di_f_uint8s_append_all_ - -#ifndef _di_f_uint8s_decimate_by_ - f_status_t f_uint8s_decimate_by(const f_number_unsigned_t amount, f_uint8s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_decimate_by(amount, sizeof(uint8_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_uint8s_decimate_by_ - -#ifndef _di_f_uint8s_decrease_by_ - f_status_t f_uint8s_decrease_by(const f_number_unsigned_t amount, f_uint8s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_decrease_by(amount, sizeof(uint8_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_uint8s_decrease_by_ - -#ifndef _di_f_uint8s_increase_ - f_status_t f_uint8s_increase(const f_number_unsigned_t step, f_uint8s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_increase(step, sizeof(uint8_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_uint8s_increase_ - -#ifndef _di_f_uint8s_increase_by_ - f_status_t f_uint8s_increase_by(const f_number_unsigned_t amount, f_uint8s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_increase_by(amount, sizeof(uint8_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_uint8s_increase_by_ - -#ifndef _di_f_uint8s_resize_ - f_status_t f_uint8s_resize(const f_number_unsigned_t length, f_uint8s_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_resize(length, sizeof(uint8_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_uint8s_resize_ - -#ifndef _di_f_uint8ss_adjust_ - f_status_t f_uint8ss_adjust(const f_number_unsigned_t length, f_uint8ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_uint8ss_adjust(length, structure); - } -#endif // _di_f_uint8ss_adjust_ - -#ifndef _di_f_uint8ss_append_ - f_status_t f_uint8ss_append(const f_uint8s_t source, f_uint8ss_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_uint8s_t), (void **) &destination->array, &destination->used, &destination->size); - if (F_status_is_error(status)) return status; - - status = private_f_uint8s_append_all(source, &destination->array[destination->used]); - if (F_status_is_error(status)) return status; - - ++destination->used; + { + f_uint8s_t * const array = (f_uint8s_t *) void_array; + f_status_t status = F_none; - return F_none; - } -#endif // _di_f_uint8ss_append_ - -#ifndef _di_f_uint8ss_append_all_ - f_status_t f_uint8ss_append_all(const f_uint8ss_t source, f_uint8ss_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; + for (f_number_unsigned_t i = start; i < size; ++i) { - f_status_t status = f_memory_array_increase_by(source.used, sizeof(f_uint8s_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_uint8s_append_all(source.array[i], &destination->array[destination->used]); + status = f_memory_array_adjust(0, sizeof(uint8_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; - } - } // for - - return F_none; - } -#endif // _di_f_uint8ss_append_all_ - -#ifndef _di_f_uint8ss_decimate_by_ - f_status_t f_uint8ss_decimate_by(const f_number_unsigned_t amount, f_uint8ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!amount) return F_data_not; - - return private_f_uint8ss_adjust((structure->size - amount > 0) ? structure->size - amount : 0, structure); - } -#endif // _di_f_uint8ss_decimate_by_ - -#ifndef _di_f_uint8ss_decrease_by_ - f_status_t f_uint8ss_decrease_by(const f_number_unsigned_t amount, f_uint8ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!amount) return F_data_not; - - return private_f_uint8ss_resize((structure->size - amount > 0) ? structure->size - amount : 0, structure); - } -#endif // _di_f_uint8ss_decrease_by_ - -#ifndef _di_f_uint8ss_increase_ - f_status_t f_uint8ss_increase(const f_number_unsigned_t step, f_uint8ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (step && structure->used + 1 > structure->size) { - if (structure->used >= F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); - - f_number_unsigned_t length = structure->used + step; - - if (length > F_number_t_size_unsigned_d) { - if (structure->used + 1 > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); - - length = F_number_t_size_unsigned_d; - } - - return private_f_uint8ss_resize(length, structure); + } // for } - return F_data_not; + return F_none; } -#endif // _di_f_uint8ss_increase_ - -#ifndef _di_f_uint8ss_increase_by_ - f_status_t f_uint8ss_increase_by(const f_number_unsigned_t amount, f_uint8ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ +#endif // _di_f_uint8s_adjust_callback_ - if (amount) { - if (structure->used >= F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); +#ifndef _di_f_uint8s_resize_callback_ + f_status_t f_uint8s_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const void_array) { - const f_number_unsigned_t length = structure->used + amount; + { + f_uint8s_t * const array = (f_uint8s_t *) void_array; + f_status_t status = F_none; - if (length > structure->size) { - if (length > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); + for (f_number_unsigned_t i = start; i < size; ++i) { - return private_f_uint8ss_resize(structure->used + amount, structure); - } + status = f_memory_array_resize(0, sizeof(uint8_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; + } // for } - return F_data_not; - } -#endif // _di_f_uint8ss_increase_by_ - -#ifndef _di_f_uint8ss_resize_ - f_status_t f_uint8ss_resize(const f_number_unsigned_t length, f_uint8ss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_uint8ss_resize(length, structure); + return F_none; } -#endif // _di_f_uint8ss_resize_ +#endif // _di_f_uint8s_resize_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/uint8.h b/level_0/f_type_array/c/type_array/uint8.h index 9dc7deefa..9ecab86cb 100644 --- a/level_0/f_type_array/c/type_array/uint8.h +++ b/level_0/f_type_array/c/type_array/uint8.h @@ -17,275 +17,17 @@ extern "C" { #endif /** - * Resize the string uint8s array. + * A callback intended to be passed to f_memory_arrays_adjust() for an f_uint8ss_t structure. * - * @param length - * The new size to use. - * @param structure - * The string uint8s array to resize. + * This does not do parameter checking. * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_adjust(). - * - * @see f_memory_array_adjust() - */ -#ifndef _di_f_uint8s_adjust_ - extern f_status_t f_uint8s_adjust(const f_number_unsigned_t length, f_uint8s_t * const structure); -#endif // _di_f_uint8s_adjust_ - -/** - * Append the single source uint8 onto the destination. - * - * @param source - * The source uint8 to append. - * @param destination - * The destination uint8s the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase(). - * - * @see f_memory_array_increase() - */ -#ifndef _di_f_uint8s_append_ - extern f_status_t f_uint8s_append(const uint8_t source, f_uint8s_t * const destination); -#endif // _di_f_uint8s_append_ - -/** - * Append the source uint8s onto the destination. - * - * @param source - * The source uint8s to append. - * @param destination - * The destination uint8s the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_uint8s_append_all_ - extern f_status_t f_uint8s_append_all(const f_uint8s_t source, f_uint8s_t * const destination); -#endif // _di_f_uint8s_append_all_ - -/** - * Resize the string uint8s 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 structure - * The string uint8s array to resize. - * - * @return - * F_none on success. - * F_data_not if amount is 0. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_decimate_by(). - * - * @see f_memory_array_decimate_by() - */ -#ifndef _di_f_uint8s_decimate_by_ - extern f_status_t f_uint8s_decimate_by(const f_number_unsigned_t amount, f_uint8s_t * const structure); -#endif // _di_f_uint8s_decimate_by_ - -/** - * Resize the string uint8s 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 structure - * The string uint8s array to resize. - * - * @return - * F_none on success. - * F_data_not if amount is 0. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_decrease_by(). - * - * @see f_memory_array_decrease_by() - */ -#ifndef _di_f_uint8s_decrease_by_ - extern f_status_t f_uint8s_decrease_by(const f_number_unsigned_t amount, f_uint8s_t * const structure); -#endif // _di_f_uint8s_decrease_by_ - -/** - * Increase the size of the string uint8s 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 structure - * The string uint8s array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_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_uint8s_increase_ - extern f_status_t f_uint8s_increase(const f_number_unsigned_t step, f_uint8s_t * const structure); -#endif // _di_f_uint8s_increase_ - -/** - * Resize the string uint8s 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 structure - * The string uint8s array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * 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_uint8s_increase_by_ - extern f_status_t f_uint8s_increase_by(const f_number_unsigned_t amount, f_uint8s_t * const structure); -#endif // _di_f_uint8s_increase_by_ - -/** - * Resize the string uint8s array. - * - * @param length - * The new size to use. - * @param structure - * The string uint8s array to adjust. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - */ -#ifndef _di_f_uint8s_resize_ - extern f_status_t f_uint8s_resize(const f_number_unsigned_t length, f_uint8s_t * const structure); -#endif // _di_f_uint8s_resize_ - -/** - * Resize the string uint8ss array. - * - * @param length - * The new size to use. - * @param structure - * The string uint8ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_adjust(). - * - * @see f_memory_array_adjust() - */ -#ifndef _di_f_uint8ss_adjust_ - extern f_status_t f_uint8ss_adjust(const f_number_unsigned_t length, f_uint8ss_t * const structure); -#endif // _di_f_uint8ss_adjust_ - -/** - * Append the single source uint8s onto the destination. - * - * @param source - * The source uint8s to append. - * @param destination - * The destination ranges the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase(). - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase() - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_uint8ss_append_ - extern f_status_t f_uint8ss_append(const f_uint8s_t source, f_uint8ss_t * const destination); -#endif // _di_f_uint8ss_append_ - -/** - * Append the source uint8ss onto the destination. - * - * @param source - * The source uint8ss to append. - * @param destination - * The destination ranges the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_uint8ss_append_all_ - extern f_status_t f_uint8ss_append_all(const f_uint8ss_t source, f_uint8ss_t * const destination); -#endif // _di_f_uint8ss_append_all_ - -/** - * Resize the string uint8ss 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 structure - * The string uint8ss array to resize. + * @param start + * The start position in the array to start deleting. + * @param stop + * The stop in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return * F_none on success. @@ -295,97 +37,24 @@ extern "C" { * Errors (with error bit) from: f_memory_array_adjust(). * * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() */ -#ifndef _di_f_uint8ss_decimate_by_ - extern f_status_t f_uint8ss_decimate_by(const f_number_unsigned_t amount, f_uint8ss_t * const structure); -#endif // _di_f_uint8ss_decimate_by_ - -/** - * Resize the string uint8ss 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 structure - * The string uint8ss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - */ -#ifndef _di_f_uint8ss_decrease_by_ - extern f_status_t f_uint8ss_decrease_by(const f_number_unsigned_t amount, f_uint8ss_t * const structure); -#endif // _di_f_uint8ss_decrease_by_ +#ifndef _di_f_uint8s_adjust_callback_ + extern f_status_t f_uint8s_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array); +#endif // _di_f_uint8s_adjust_callback_ /** - * Increase the size of the string uint8ss 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. + * A callback intended to be passed to f_memory_arrays_resize() for an f_uint8ss_t structure. * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param structure - * The string uint8ss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_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_uint8ss_increase_ - extern f_status_t f_uint8ss_increase(const f_number_unsigned_t step, f_uint8ss_t * const structure); -#endif // _di_f_uint8ss_increase_ - -/** - * Resize the string uint8ss 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 structure - * The string uint8ss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * 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_uint8ss_increase_by_ - extern f_status_t f_uint8ss_increase_by(const f_number_unsigned_t amount, f_uint8ss_t * const structure); -#endif // _di_f_uint8ss_increase_by_ - -/** - * Resize the string uint8ss array. + * This does not do parameter checking. * - * @param length - * The new size to use. - * @param structure - * The string uint8ss array to adjust. + * @param start + * The start position in the array to start deleting. + * @param stop + * The stop in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return * F_none on success. @@ -395,10 +64,11 @@ extern "C" { * Errors (with error bit) from: f_memory_array_resize(). * * @see f_memory_array_resize() + * @see f_memory_arrays_resize() */ -#ifndef _di_f_uint8ss_resize_ - extern f_status_t f_uint8ss_resize(const f_number_unsigned_t length, f_uint8ss_t * const structure); -#endif // _di_f_uint8ss_resize_ +#ifndef _di_f_uint8s_resize_callback_ + extern f_status_t f_uint8s_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array); +#endif // _di_f_uint8s_resize_callback_ #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 7abfdaa81..2120017bc 100644 --- a/level_0/f_type_array/data/build/settings +++ b/level_0/f_type_array/data/build/settings @@ -33,7 +33,7 @@ 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_unsigned.c type_array/poll.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/private-cell.c type_array/private-file.c type_array/private-fll_id.c type_array/private-int8.c type_array/private-int16.c type_array/private-int32.c type_array/private-int64.c type_array/private-int128.c type_array/private-poll.c type_array/private-state.c type_array/private-status.c type_array/private-uint8.c type_array/private-uint16.c type_array/private-uint32.c type_array/private-uint64.c type_array/private-uint128.c +build_sources_library type_array/private-poll.c type_array/private-state.c type_array/private-status.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_unsigned.h type_array/poll.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 diff --git a/level_0/f_type_array/data/build/settings-mocks b/level_0/f_type_array/data/build/settings-mocks index 595f66473..ba10b19ab 100644 --- a/level_0/f_type_array/data/build/settings-mocks +++ b/level_0/f_type_array/data/build/settings-mocks @@ -31,7 +31,7 @@ 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_unsigned.c type_array/poll.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/private-cell.c type_array/private-file.c type_array/private-fll_id.c type_array/private-int8.c type_array/private-int16.c type_array/private-int32.c type_array/private-int64.c type_array/private-int128.c type_array/private-poll.c type_array/private-state.c type_array/private-status.c type_array/private-uint8.c type_array/private-uint16.c type_array/private-uint32.c type_array/private-uint64.c type_array/private-uint128.c +build_sources_library type_array/private-poll.c type_array/private-state.c type_array/private-status.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_unsigned.h type_array/poll.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 @@ -63,4 +63,6 @@ flags-coverage --coverage -fprofile-abs-path -fprofile-dir=build/coverage/ flags_library -fPIC # Inject mocks. +flags -Wl,--wrap=f_memory_array_adjust +flags -Wl,--wrap=f_memory_array_resize flags -Wl,--wrap=poll diff --git a/level_0/f_type_array/data/build/settings-tests b/level_0/f_type_array/data/build/settings-tests index bb0f84e99..7f3fd2b07 100644 --- a/level_0/f_type_array/data/build/settings-tests +++ b/level_0/f_type_array/data/build/settings-tests @@ -23,40 +23,21 @@ build_language c build_libraries -lc -lcmocka build_libraries-individual -lf_memory -lf_type_array -build_sources_program test-type_array-files_adjust.c test-type_array-files_append.c test-type_array-files_append_all.c test-type_array-files_decimate_by.c test-type_array-files_decrease_by.c test-type_array-files_increase.c test-type_array-files_increase_by.c test-type_array-files_resize.c -build_sources_program test-type_array-filess_adjust.c test-type_array-filess_append.c test-type_array-filess_append_all.c test-type_array-filess_decimate_by.c test-type_array-filess_decrease_by.c test-type_array-filess_increase.c test-type_array-filess_increase_by.c test-type_array-filess_resize.c -build_sources_program test-type_array-fll_ids_adjust.c test-type_array-fll_ids_append.c test-type_array-fll_ids_append_all.c test-type_array-fll_ids_decimate_by.c test-type_array-fll_ids_decrease_by.c test-type_array-fll_ids_increase.c test-type_array-fll_ids_increase_by.c test-type_array-fll_ids_resize.c -build_sources_program test-type_array-fll_idss_adjust.c test-type_array-fll_idss_append.c test-type_array-fll_idss_append_all.c test-type_array-fll_idss_decimate_by.c test-type_array-fll_idss_decrease_by.c test-type_array-fll_idss_increase.c test-type_array-fll_idss_increase_by.c test-type_array-fll_idss_resize.c -build_sources_program test-type_array-cells_adjust.c test-type_array-cells_append.c test-type_array-cells_append_all.c test-type_array-cells_decimate_by.c test-type_array-cells_decrease_by.c test-type_array-cells_increase.c test-type_array-cells_increase_by.c test-type_array-cells_resize.c -build_sources_program test-type_array-cellss_adjust.c test-type_array-cellss_append.c test-type_array-cellss_append_all.c test-type_array-cellss_decimate_by.c test-type_array-cellss_decrease_by.c test-type_array-cellss_increase.c test-type_array-cellss_increase_by.c test-type_array-cellss_resize.c -build_sources_program test-type_array-int8s_adjust.c test-type_array-int8s_append.c test-type_array-int8s_append_all.c test-type_array-int8s_decimate_by.c test-type_array-int8s_decrease_by.c test-type_array-int8s_increase.c test-type_array-int8s_increase_by.c test-type_array-int8s_resize.c -build_sources_program test-type_array-int8ss_adjust.c test-type_array-int8ss_append.c test-type_array-int8ss_append_all.c test-type_array-int8ss_decimate_by.c test-type_array-int8ss_decrease_by.c test-type_array-int8ss_increase.c test-type_array-int8ss_increase_by.c test-type_array-int8ss_resize.c -build_sources_program test-type_array-int16s_adjust.c test-type_array-int16s_append.c test-type_array-int16s_append_all.c test-type_array-int16s_decimate_by.c test-type_array-int16s_decrease_by.c test-type_array-int16s_increase.c test-type_array-int16s_increase_by.c test-type_array-int16s_resize.c -build_sources_program test-type_array-int16ss_adjust.c test-type_array-int16ss_append.c test-type_array-int16ss_append_all.c test-type_array-int16ss_decimate_by.c test-type_array-int16ss_decrease_by.c test-type_array-int16ss_increase.c test-type_array-int16ss_increase_by.c test-type_array-int16ss_resize.c -build_sources_program test-type_array-int32s_adjust.c test-type_array-int32s_append.c test-type_array-int32s_append_all.c test-type_array-int32s_decimate_by.c test-type_array-int32s_decrease_by.c test-type_array-int32s_increase.c test-type_array-int32s_increase_by.c test-type_array-int32s_resize.c -build_sources_program test-type_array-int32ss_adjust.c test-type_array-int32ss_append.c test-type_array-int32ss_append_all.c test-type_array-int32ss_decimate_by.c test-type_array-int32ss_decrease_by.c test-type_array-int32ss_increase.c test-type_array-int32ss_increase_by.c test-type_array-int32ss_resize.c -build_sources_program test-type_array-int64s_adjust.c test-type_array-int64s_append.c test-type_array-int64s_append_all.c test-type_array-int64s_decimate_by.c test-type_array-int64s_decrease_by.c test-type_array-int64s_increase.c test-type_array-int64s_increase_by.c test-type_array-int64s_resize.c -build_sources_program test-type_array-int64ss_adjust.c test-type_array-int64ss_append.c test-type_array-int64ss_append_all.c test-type_array-int64ss_decimate_by.c test-type_array-int64ss_decrease_by.c test-type_array-int64ss_increase.c test-type_array-int64ss_increase_by.c test-type_array-int64ss_resize.c -build_sources_program test-type_array-int128s_adjust.c test-type_array-int128s_append.c test-type_array-int128s_append_all.c test-type_array-int128s_decimate_by.c test-type_array-int128s_decrease_by.c test-type_array-int128s_increase.c test-type_array-int128s_increase_by.c test-type_array-int128s_resize.c -build_sources_program test-type_array-int128ss_adjust.c test-type_array-int128ss_append.c test-type_array-int128ss_append_all.c test-type_array-int128ss_decimate_by.c test-type_array-int128ss_decrease_by.c test-type_array-int128ss_increase.c test-type_array-int128ss_increase_by.c test-type_array-int128ss_resize.c -build_sources_program test-type_array-number_unsigneds_adjust.c test-type_array-number_unsigneds_append.c test-type_array-number_unsigneds_append_all.c test-type_array-number_unsigneds_decimate_by.c test-type_array-number_unsigneds_decrease_by.c test-type_array-number_unsigneds_increase.c test-type_array-number_unsigneds_increase_by.c test-type_array-number_unsigneds_resize.c -build_sources_program test-type_array-number_unsignedss_adjust.c test-type_array-number_unsignedss_append.c test-type_array-number_unsignedss_append_all.c test-type_array-number_unsignedss_decimate_by.c test-type_array-number_unsignedss_decrease_by.c test-type_array-number_unsignedss_increase.c test-type_array-number_unsignedss_increase_by.c test-type_array-number_unsignedss_resize.c -build_sources_program test-type_array-polls_adjust.c test-type_array-polls_append.c test-type_array-polls_append_all.c test-type_array-polls_decimate_by.c test-type_array-polls_decrease_by.c test-type_array-polls_increase.c test-type_array-polls_increase_by.c test-type_array-polls_resize.c -build_sources_program test-type_array-pollss_adjust.c test-type_array-pollss_append.c test-type_array-pollss_append_all.c test-type_array-pollss_decimate_by.c test-type_array-pollss_decrease_by.c test-type_array-pollss_increase.c test-type_array-pollss_increase_by.c test-type_array-pollss_resize.c -build_sources_program test-type_array-states_adjust.c test-type_array-states_append.c test-type_array-states_append_all.c test-type_array-states_decimate_by.c test-type_array-states_decrease_by.c test-type_array-states_increase.c test-type_array-states_increase_by.c test-type_array-states_resize.c -build_sources_program test-type_array-statess_adjust.c test-type_array-statess_append.c test-type_array-statess_append_all.c test-type_array-statess_decimate_by.c test-type_array-statess_decrease_by.c test-type_array-statess_increase.c test-type_array-statess_increase_by.c test-type_array-statess_resize.c -build_sources_program test-type_array-statuss_adjust.c test-type_array-statuss_append.c test-type_array-statuss_append_all.c test-type_array-statuss_decimate_by.c test-type_array-statuss_decrease_by.c test-type_array-statuss_increase.c test-type_array-statuss_increase_by.c test-type_array-statuss_resize.c -build_sources_program test-type_array-statusss_adjust.c test-type_array-statusss_append.c test-type_array-statusss_append_all.c test-type_array-statusss_decimate_by.c test-type_array-statusss_decrease_by.c test-type_array-statusss_increase.c test-type_array-statusss_increase_by.c test-type_array-statusss_resize.c -build_sources_program test-type_array-uint8s_adjust.c test-type_array-uint8s_append.c test-type_array-uint8s_append_all.c test-type_array-uint8s_decimate_by.c test-type_array-uint8s_decrease_by.c test-type_array-uint8s_increase.c test-type_array-uint8s_increase_by.c test-type_array-uint8s_resize.c -build_sources_program test-type_array-uint8ss_adjust.c test-type_array-uint8ss_append.c test-type_array-uint8ss_append_all.c test-type_array-uint8ss_decimate_by.c test-type_array-uint8ss_decrease_by.c test-type_array-uint8ss_increase.c test-type_array-uint8ss_increase_by.c test-type_array-uint8ss_resize.c -build_sources_program test-type_array-uint16s_adjust.c test-type_array-uint16s_append.c test-type_array-uint16s_append_all.c test-type_array-uint16s_decimate_by.c test-type_array-uint16s_decrease_by.c test-type_array-uint16s_increase.c test-type_array-uint16s_increase_by.c test-type_array-uint16s_resize.c -build_sources_program test-type_array-uint16ss_adjust.c test-type_array-uint16ss_append.c test-type_array-uint16ss_append_all.c test-type_array-uint16ss_decimate_by.c test-type_array-uint16ss_decrease_by.c test-type_array-uint16ss_increase.c test-type_array-uint16ss_increase_by.c test-type_array-uint16ss_resize.c -build_sources_program test-type_array-uint32s_adjust.c test-type_array-uint32s_append.c test-type_array-uint32s_append_all.c test-type_array-uint32s_decimate_by.c test-type_array-uint32s_decrease_by.c test-type_array-uint32s_increase.c test-type_array-uint32s_increase_by.c test-type_array-uint32s_resize.c -build_sources_program test-type_array-uint32ss_adjust.c test-type_array-uint32ss_append.c test-type_array-uint32ss_append_all.c test-type_array-uint32ss_decimate_by.c test-type_array-uint32ss_decrease_by.c test-type_array-uint32ss_increase.c test-type_array-uint32ss_increase_by.c test-type_array-uint32ss_resize.c -build_sources_program test-type_array-uint64s_adjust.c test-type_array-uint64s_append.c test-type_array-uint64s_append_all.c test-type_array-uint64s_decimate_by.c test-type_array-uint64s_decrease_by.c test-type_array-uint64s_increase.c test-type_array-uint64s_increase_by.c test-type_array-uint64s_resize.c -build_sources_program test-type_array-uint64ss_adjust.c test-type_array-uint64ss_append.c test-type_array-uint64ss_append_all.c test-type_array-uint64ss_decimate_by.c test-type_array-uint64ss_decrease_by.c test-type_array-uint64ss_increase.c test-type_array-uint64ss_increase_by.c test-type_array-uint64ss_resize.c -build_sources_program test-type_array-uint128s_adjust.c test-type_array-uint128s_append.c test-type_array-uint128s_append_all.c test-type_array-uint128s_decimate_by.c test-type_array-uint128s_decrease_by.c test-type_array-uint128s_increase.c test-type_array-uint128s_increase_by.c test-type_array-uint128s_resize.c -build_sources_program test-type_array-uint128ss_adjust.c test-type_array-uint128ss_append.c test-type_array-uint128ss_append_all.c test-type_array-uint128ss_decimate_by.c test-type_array-uint128ss_decrease_by.c test-type_array-uint128ss_increase.c test-type_array-uint128ss_increase_by.c test-type_array-uint128ss_resize.c +build_sources_program test-type_array-cells_adjust_callback.c test-type_array-cells_resize_callback.c +build_sources_program test-type_array-files_adjust_callback.c test-type_array-files_resize_callback.c +build_sources_program test-type_array-fll_ids_adjust_callback.c test-type_array-fll_ids_resize_callback.c +build_sources_program test-type_array-int8s_adjust_callback.c test-type_array-int8s_resize_callback.c +build_sources_program test-type_array-int16s_adjust_callback.c test-type_array-int16s_resize_callback.c +build_sources_program test-type_array-int32s_adjust_callback.c test-type_array-int32s_resize_callback.c +build_sources_program test-type_array-int64s_adjust_callback.c test-type_array-int64s_resize_callback.c +build_sources_program test-type_array-int128s_adjust_callback.c test-type_array-int128s_resize_callback.c +build_sources_program test-type_array-number_unsigneds_adjust_callback.c test-type_array-number_unsigneds_resize_callback.c +build_sources_program test-type_array-uint8s_adjust_callback.c test-type_array-uint8s_resize_callback.c +build_sources_program test-type_array-uint16s_adjust_callback.c test-type_array-uint16s_resize_callback.c +build_sources_program test-type_array-uint32s_adjust_callback.c test-type_array-uint32s_resize_callback.c +build_sources_program test-type_array-uint64s_adjust_callback.c test-type_array-uint64s_resize_callback.c +build_sources_program test-type_array-uint128s_adjust_callback.c test-type_array-uint128s_resize_callback.c + build_sources_program test-type_array.c build_script no diff --git a/level_0/f_type_array/tests/unit/c/mock-type_array.c b/level_0/f_type_array/tests/unit/c/mock-type_array.c index cef5a0dde..771cdc3b6 100644 --- a/level_0/f_type_array/tests/unit/c/mock-type_array.c +++ b/level_0/f_type_array/tests/unit/c/mock-type_array.c @@ -19,6 +19,32 @@ int __wrap_poll(f_poll_t *fds, nfds_t nfds, int timeout) { return mock_type(int); } +f_status_t __wrap_f_memory_array_adjust(const f_number_unsigned_t length, const size_t width, void ** array, f_number_unsigned_t * const used, f_number_unsigned_t * const size) { + + if (!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 ** array, f_number_unsigned_t * const used, f_number_unsigned_t * const 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); +} + #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_type_array/tests/unit/c/mock-type_array.h b/level_0/f_type_array/tests/unit/c/mock-type_array.h index 061feda88..c9039209d 100644 --- a/level_0/f_type_array/tests/unit/c/mock-type_array.h +++ b/level_0/f_type_array/tests/unit/c/mock-type_array.h @@ -31,6 +31,8 @@ extern "C" { const static int mock_errno_generic = 32767; extern int __wrap_poll(f_poll_t *fds, nfds_t nfds, int timeout); +extern f_status_t __wrap_f_memory_array_adjust(const f_number_unsigned_t length, const size_t width, void ** array, f_number_unsigned_t * const used, f_number_unsigned_t * const size); +extern f_status_t __wrap_f_memory_array_resizze(const f_number_unsigned_t length, const size_t width, void ** array, f_number_unsigned_t * const used, f_number_unsigned_t * const size); #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cells_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-cells_adjust.c deleted file mode 100644 index fc8809eaa..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cells_adjust.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-cells_adjust.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_cells_adjust__parameter_checking(void **state) { - - const int length = 5; - f_cells_t data = f_cells_t_initialize; - - { - const f_status_t status = f_cells_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_type_array_cells_adjust__works(void **state) { - - const int length = 5; - f_cells_t data = f_cells_t_initialize; - - { - const f_status_t status = f_cells_adjust(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cells_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-cells_adjust.h deleted file mode 100644 index 5e80f9992..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cells_adjust.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__cells_adjust -#define _TEST__F_type_array__cells_adjust - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_cells_adjust() - */ -extern void test__f_type_array_cells_adjust__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_cells_adjust() - */ -extern void test__f_type_array_cells_adjust__works(void **state); - -#endif // _TEST__F_type_array__cells_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cells_adjust_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-cells_adjust_callback.c new file mode 100644 index 000000000..31906b2da --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-cells_adjust_callback.c @@ -0,0 +1,45 @@ +#include "test-type_array.h" +#include "test-type_array-cells_adjust_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_cells_adjust_callback__fails(void **state) { + + f_cell_t data = f_cell_t_initialize; + f_cell_t data_array[] = { data }; + f_cells_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_cells_t datass_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_adjust, true); + will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_cells_adjust_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_cells_adjust_callback__works(void **state) { + + f_cell_t data = f_cell_t_initialize; + f_cell_t data_array[] = { data }; + f_cells_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_cells_t datass_array[] = { datas }; + const f_number_unsigned_t length = 1; + + { + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_none); + + const f_status_t status = f_cells_adjust_callback(0, length, (void *) datass_array); + + assert_int_equal(status, F_none); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cells_adjust_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-cells_adjust_callback.h new file mode 100644 index 000000000..d3dc8c51c --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-cells_adjust_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__cells_adjust_callback +#define _TEST__F_type_array__cells_adjust_callback + +/** + * Test that the function fails. + * + * @see f_cells_adjust_callback() + */ +extern void test__f_type_array_cells_adjust_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_cells_adjust_callback() + */ +extern void test__f_type_array_cells_adjust_callback__works(void **state); + +#endif // _TEST__F_type_array__cells_adjust_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cells_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-cells_append.c deleted file mode 100644 index d0afa08cd..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cells_append.c +++ /dev/null @@ -1,38 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-cells_append.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_cells_append__parameter_checking(void **state) { - - const f_cell_t data = f_cell_t_initialize; - - { - const f_status_t status = f_cells_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_cells_append__works(void **state) { - - const f_cell_t source = { .row = 1, .column = 2 }; - f_cells_t destination = f_cells_t_initialize; - - { - const f_status_t status = f_cells_append(source, &destination); - - assert_int_equal(status, F_none); - assert_int_equal(destination.used, 1); - assert_int_equal(destination.array[0].row, source.row); - assert_int_equal(destination.array[0].column, source.column); - } - - free((void *) destination.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cells_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-cells_append.h deleted file mode 100644 index 1dd321405..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cells_append.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__cells_append -#define _TEST__F_type_array__cells_append - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_cells_append() - */ -extern void test__f_type_array_cells_append__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_cells_append() - */ -extern void test__f_type_array_cells_append__works(void **state); - -#endif // _TEST__F_type_array__cells_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cells_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-cells_append_all.c deleted file mode 100644 index 322ff81f3..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cells_append_all.c +++ /dev/null @@ -1,85 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-cells_append_all.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_cells_append_all__parameter_checking(void **state) { - - const f_cells_t data = f_cells_t_initialize; - - { - const f_status_t status = f_cells_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_cells_append_all__returns_data_not(void **state) { - - const int length = 5; - f_cells_t source = f_cells_t_initialize; - f_cells_t destination = f_cells_t_initialize; - - { - const f_status_t status = f_cells_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_cells_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_type_array_cells_append_all__works(void **state) { - - const int length = 5; - f_cells_t source = f_cells_t_initialize; - f_cells_t destination = f_cells_t_initialize; - - const f_cell_t cell_0 = { .row = 1, .column = 2 }; - const f_cell_t cell_1 = { .row = 3, .column = 4 }; - - { - const f_status_t status = f_cells_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - memcpy(&source.array[source.used++], (void *) &cell_0, sizeof(f_cell_t)); - memcpy(&source.array[source.used++], (void *) &cell_1, sizeof(f_cell_t)); - - { - const f_status_t status = f_cells_append_all(source, &destination); - - assert_int_equal(status, F_none); - assert_int_equal(destination.used, source.used); - assert_int_equal(destination.size, source.used); - - assert_int_equal(destination.array[0].row, cell_0.row); - assert_int_equal(destination.array[0].column, cell_0.column); - - assert_int_equal(destination.array[1].row, cell_1.row); - assert_int_equal(destination.array[1].column, cell_1.column); - } - - free((void *) source.array); - free((void *) destination.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cells_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-cells_append_all.h deleted file mode 100644 index 69186dbba..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cells_append_all.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__cells_append_all -#define _TEST__F_type_array__cells_append_all - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_cells_append_all() - */ -extern void test__f_type_array_cells_append_all__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_cells_append_all() - */ -extern void test__f_type_array_cells_append_all__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_cells_append_all() - */ -extern void test__f_type_array_cells_append_all__works(void **state); - -#endif // _TEST__F_type_array__cells_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cells_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-cells_decimate_by.c deleted file mode 100644 index 072ba7f3a..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cells_decimate_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-cells_decimate_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_cells_decimate_by__parameter_checking(void **state) { - - const int length = 5; - f_cells_t data = f_cells_t_initialize; - - { - const f_status_t status = f_cells_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_type_array_cells_decimate_by__returns_data_not(void **state) { - - const int length = 5; - f_cells_t data = f_cells_t_initialize; - - { - const f_status_t status = f_cells_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_cells_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_type_array_cells_decimate_by__works(void **state) { - - const int length = 5; - f_cells_t data = f_cells_t_initialize; - - { - const f_status_t status = f_cells_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_cells_decimate_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cells_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-cells_decimate_by.h deleted file mode 100644 index d4e5ed158..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cells_decimate_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__cells_decimate_by -#define _TEST__F_type_array__cells_decimate_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_cells_decimate_by() - */ -extern void test__f_type_array_cells_decimate_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_cells_decimate_by() - */ -extern void test__f_type_array_cells_decimate_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_cells_decimate_by() - */ -extern void test__f_type_array_cells_decimate_by__works(void **state); - -#endif // _TEST__F_type_array__cells_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cells_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-cells_decrease_by.c deleted file mode 100644 index 5f5015456..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cells_decrease_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-cells_decrease_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_cells_decrease_by__parameter_checking(void **state) { - - const int length = 5; - f_cells_t data = f_cells_t_initialize; - - { - const f_status_t status = f_cells_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_type_array_cells_decrease_by__returns_data_not(void **state) { - - const int length = 5; - f_cells_t data = f_cells_t_initialize; - - { - const f_status_t status = f_cells_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_cells_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_type_array_cells_decrease_by__works(void **state) { - - const int length = 5; - f_cells_t data = f_cells_t_initialize; - - { - const f_status_t status = f_cells_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_cells_decrease_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cells_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-cells_decrease_by.h deleted file mode 100644 index 44e06dd46..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cells_decrease_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__cells_decrease_by -#define _TEST__F_type_array__cells_decrease_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_cells_decrease_by() - */ -extern void test__f_type_array_cells_decrease_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_cells_decrease_by() - */ -extern void test__f_type_array_cells_decrease_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_cells_decrease_by() - */ -extern void test__f_type_array_cells_decrease_by__works(void **state); - -#endif // _TEST__F_type_array__cells_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cells_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-cells_increase.c deleted file mode 100644 index ef18ec2a8..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cells_increase.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-cells_increase.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_cells_increase__parameter_checking(void **state) { - - const int length = 5; - f_cells_t data = f_cells_t_initialize; - - { - const f_status_t status = f_cells_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_type_array_cells_increase__returns_data_not(void **state) { - - const int length = 5; - f_cells_t data = f_cells_t_initialize; - - { - const f_status_t status = f_cells_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_cells_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_type_array_cells_increase__works(void **state) { - - const int length = 5; - f_cells_t data = f_cells_t_initialize; - - { - const f_status_t status = f_cells_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_cells_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cells_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-cells_increase.h deleted file mode 100644 index d766f9920..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cells_increase.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__cells_increase -#define _TEST__F_type_array__cells_increase - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_cells_increase() - */ -extern void test__f_type_array_cells_increase__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_cells_increase() - */ -extern void test__f_type_array_cells_increase__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_cells_increase() - */ -extern void test__f_type_array_cells_increase__works(void **state); - -#endif // _TEST__F_type_array__cells_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cells_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-cells_increase_by.c deleted file mode 100644 index 7ae85cb85..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cells_increase_by.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-cells_increase_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_cells_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_cells_t data = f_cells_t_initialize; - - { - const f_status_t status = f_cells_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_type_array_cells_increase_by__returns_data_not(void **state) { - - const int length = 5; - f_cells_t data = f_cells_t_initialize; - - { - const f_status_t status = f_cells_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_cells_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_type_array_cells_increase_by__works(void **state) { - - const int length = 5; - f_cells_t data = f_cells_t_initialize; - - { - const f_status_t status = f_cells_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_cells_increase_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cells_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-cells_increase_by.h deleted file mode 100644 index 9285f493c..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cells_increase_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__cells_increase_by -#define _TEST__F_type_array__cells_increase_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_cells_increase_by() - */ -extern void test__f_type_array_cells_increase_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_cells_increase_by() - */ -extern void test__f_type_array_cells_increase_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_cells_increase_by() - */ -extern void test__f_type_array_cells_increase_by__works(void **state); - -#endif // _TEST__F_type_array__cells_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cells_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-cells_resize.c deleted file mode 100644 index 3ef50cea1..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cells_resize.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-cells_resize.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_cells_resize__parameter_checking(void **state) { - - const int length = 5; - f_cells_t data = f_cells_t_initialize; - - { - const f_status_t status = f_cells_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_type_array_cells_resize__works(void **state) { - - const int length = 5; - f_cells_t data = f_cells_t_initialize; - - { - const f_status_t status = f_cells_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cells_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-cells_resize.h deleted file mode 100644 index 79d54964b..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cells_resize.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__cells_resize -#define _TEST__F_type_array__cells_resize - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_cells_resize() - */ -extern void test__f_type_array_cells_resize__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_cells_resize() - */ -extern void test__f_type_array_cells_resize__works(void **state); - -#endif // _TEST__F_type_array__cells_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cells_resize_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-cells_resize_callback.c new file mode 100644 index 000000000..7aec37892 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-cells_resize_callback.c @@ -0,0 +1,45 @@ +#include "test-type_array.h" +#include "test-type_array-cells_resize_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_cells_resize_callback__fails(void **state) { + + f_cell_t data = f_cell_t_initialize; + f_cell_t data_array[] = { data }; + f_cells_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_cells_t datass_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_resize, true); + will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_cells_resize_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_cells_resize_callback__works(void **state) { + + f_cell_t data = f_cell_t_initialize; + f_cell_t data_array[] = { data }; + f_cells_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_cells_t datass_array[] = { datas }; + const f_number_unsigned_t length = 1; + + { + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_none); + + const f_status_t status = f_cells_resize_callback(0, length, (void *) datass_array); + + assert_int_equal(status, F_none); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cells_resize_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-cells_resize_callback.h new file mode 100644 index 000000000..5af9d4512 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-cells_resize_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__cells_resize_callback +#define _TEST__F_type_array__cells_resize_callback + +/** + * Test that the function fails. + * + * @see f_cells_resize_callback() + */ +extern void test__f_type_array_cells_resize_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_cells_resize_callback() + */ +extern void test__f_type_array_cells_resize_callback__works(void **state); + +#endif // _TEST__F_type_array__cells_resize_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-cellss_adjust.c deleted file mode 100644 index 2eb1c8ffa..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_adjust.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-cellss_adjust.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_cellss_adjust__parameter_checking(void **state) { - - const int length = 5; - f_cellss_t data = f_cellss_t_initialize; - - { - const f_status_t status = f_cellss_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_type_array_cellss_adjust__works(void **state) { - - const int length = 5; - f_cellss_t data = f_cellss_t_initialize; - - { - const f_status_t status = f_cellss_adjust(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-cellss_adjust.h deleted file mode 100644 index 14c007d78..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_adjust.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__cellss_adjust -#define _TEST__F_type_array__cellss_adjust - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_cellss_adjust() - */ -extern void test__f_type_array_cellss_adjust__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_cellss_adjust() - */ -extern void test__f_type_array_cellss_adjust__works(void **state); - -#endif // _TEST__F_type_array__cellss_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-cellss_append.c deleted file mode 100644 index 27f6e0d34..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_append.c +++ /dev/null @@ -1,90 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-cellss_append.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_cellss_append__parameter_checking(void **state) { - - f_cells_t data = f_cells_t_initialize; - - { - const f_status_t status = f_cellss_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_cellss_append__returns_data_not(void **state) { - - const int length = 5; - f_cells_t source = f_cellss_t_initialize; - f_cellss_t destination = f_cellss_t_initialize; - - { - const f_status_t status = f_cells_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_cellss_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_type_array_cellss_append__works(void **state) { - - const int length = 5; - f_cells_t source = f_cells_t_initialize; - f_cellss_t destination = f_cellss_t_initialize; - - const f_cell_t cell = { .row = 1, .column = 2 }; - - { - const f_status_t status = f_cells_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - while (source.used < length) { - memcpy(&source.array[source.used++], (void *) &cell, sizeof(f_cell_t)); - } // while - - { - const f_status_t status = f_cellss_append(source, &destination); - - assert_int_equal(status, F_none); - 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].row, cell.row); - assert_int_equal(destination.array[0].array[i].column, cell.column); - } // 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 diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-cellss_append.h deleted file mode 100644 index ceaceefc5..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_append.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__cellss_append -#define _TEST__F_type_array__cellss_append - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_cellss_append() - */ -extern void test__f_type_array_cellss_append__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_cellss_append() - */ -extern void test__f_type_array_cellss_append__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_cellss_append() - */ -extern void test__f_type_array_cellss_append__works(void **state); - -#endif // _TEST__F_type_array__cellss_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-cellss_append_all.c deleted file mode 100644 index c76ebe90c..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_append_all.c +++ /dev/null @@ -1,109 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-cellss_append_all.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_cellss_append_all__parameter_checking(void **state) { - - const f_cellss_t data = f_cellss_t_initialize; - - { - const f_status_t status = f_cellss_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_cellss_append_all__returns_data_not(void **state) { - - const int length = 5; - f_cellss_t source = f_cellss_t_initialize; - f_cellss_t destination = f_cellss_t_initialize; - - { - const f_status_t status = f_cellss_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_cellss_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_type_array_cellss_append_all__works(void **state) { - - const int length = 5; - const int length_inner = 2; - f_cellss_t source = f_cellss_t_initialize; - f_cellss_t destination = f_cellss_t_initialize; - - const f_cell_t cell_0 = { .row = 1, .column = 2 }; - const f_cell_t cell_1 = { .row = 3, .column = 4 }; - - { - const f_status_t status = f_cellss_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - for (; source.used < length; ++source.used) { - - const f_status_t status = f_cells_resize(length_inner, &source.array[source.used]); - - assert_int_equal(status, F_none); - - memcpy(&source.array[source.used].array[source.array[source.used].used++], (void *) &cell_0, sizeof(f_cell_t)); - memcpy(&source.array[source.used].array[source.array[source.used].used++], (void *) &cell_1, sizeof(f_cell_t)); - } // for - } - - { - const f_status_t status = f_cellss_append_all(source, &destination); - - assert_int_equal(status, F_none); - assert_int_equal(destination.used, source.used); - assert_int_equal(destination.size, source.used); - - for (f_number_unsigned_t i = 0; i < destination.used; ++i) { - - assert_int_equal(destination.array[i].used, length_inner); - assert_int_equal(destination.array[i].size, length_inner); - - assert_int_equal(destination.array[i].array[0].row, cell_0.row); - assert_int_equal(destination.array[i].array[0].column, cell_0.column); - - assert_int_equal(destination.array[i].array[1].row, cell_1.row); - assert_int_equal(destination.array[i].array[1].column, cell_1.column); - } // 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 diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-cellss_append_all.h deleted file mode 100644 index 90916d055..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_append_all.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__cellss_append_all -#define _TEST__F_type_array__cellss_append_all - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_cellss_append_all() - */ -extern void test__f_type_array_cellss_append_all__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_cellss_append_all() - */ -extern void test__f_type_array_cellss_append_all__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_cellss_append_all() - */ -extern void test__f_type_array_cellss_append_all__works(void **state); - -#endif // _TEST__F_type_array__cellss_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-cellss_decimate_by.c deleted file mode 100644 index 12aebeddf..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_decimate_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-cellss_decimate_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_cellss_decimate_by__parameter_checking(void **state) { - - const int length = 5; - f_cellss_t data = f_cells_t_initialize; - - { - const f_status_t status = f_cellss_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_type_array_cellss_decimate_by__returns_data_not(void **state) { - - const int length = 5; - f_cellss_t data = f_cellss_t_initialize; - - { - const f_status_t status = f_cellss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_cellss_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_type_array_cellss_decimate_by__works(void **state) { - - const int length = 5; - f_cellss_t data = f_cells_t_initialize; - - { - const f_status_t status = f_cellss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_cellss_decimate_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-cellss_decimate_by.h deleted file mode 100644 index 24ede5600..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_decimate_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__cellss_decimate_by -#define _TEST__F_type_array__cellss_decimate_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_cellss_decimate_by() - */ -extern void test__f_type_array_cellss_decimate_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_type_array_cellss_decimate_by() - */ -extern void test__f_type_array_cellss_decimate_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_cellss_decimate_by() - */ -extern void test__f_type_array_cellss_decimate_by__works(void **state); - -#endif // _TEST__F_type_array__cellss_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-cellss_decrease_by.c deleted file mode 100644 index ae118f0ae..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_decrease_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-cellss_decrease_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_cellss_decrease_by__parameter_checking(void **state) { - - const int length = 5; - f_cellss_t data = f_cells_t_initialize; - - { - const f_status_t status = f_cellss_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_type_array_cellss_decrease_by__returns_data_not(void **state) { - - const int length = 5; - f_cellss_t data = f_cellss_t_initialize; - - { - const f_status_t status = f_cellss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_cellss_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_type_array_cellss_decrease_by__works(void **state) { - - const int length = 5; - f_cellss_t data = f_cells_t_initialize; - - { - const f_status_t status = f_cellss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_cellss_decrease_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-cellss_decrease_by.h deleted file mode 100644 index e80923240..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_decrease_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__cellss_decrease_by -#define _TEST__F_type_array__cellss_decrease_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_cellss_decrease_by() - */ -extern void test__f_type_array_cellss_decrease_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_cellss_decrease_by() - */ -extern void test__f_type_array_cellss_decrease_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_cellss_decrease_by() - */ -extern void test__f_type_array_cellss_decrease_by__works(void **state); - -#endif // _TEST__F_type_array__cellss_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-cellss_increase.c deleted file mode 100644 index bba4c27f9..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_increase.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-cellss_increase.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_cellss_increase__parameter_checking(void **state) { - - const int length = 5; - f_cellss_t data = f_cells_t_initialize; - - { - const f_status_t status = f_cellss_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_type_array_cellss_increase__returns_data_not(void **state) { - - const int length = 5; - f_cellss_t data = f_cells_t_initialize; - - { - const f_status_t status = f_cellss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_cellss_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_type_array_cellss_increase__works(void **state) { - - const int length = 5; - f_cellss_t data = f_cells_t_initialize; - - { - const f_status_t status = f_cellss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_cellss_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-cellss_increase.h deleted file mode 100644 index e74b4080d..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_increase.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__cellss_increase -#define _TEST__F_type_array__cellss_increase - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_cellss_increase() - */ -extern void test__f_type_array_cellss_increase__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_cellss_increase() - */ -extern void test__f_type_array_cellss_increase__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_cellss_increase() - */ -extern void test__f_type_array_cellss_increase__works(void **state); - -#endif // _TEST__F_type_array__cellss_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-cellss_increase_by.c deleted file mode 100644 index 2a866d050..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_increase_by.c +++ /dev/null @@ -1,108 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-cellss_increase_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_cellss_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_cellss_t data = f_cells_t_initialize; - - { - const f_status_t status = f_cellss_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_type_array_cellss_increase_by__returns_data_not(void **state) { - - const int length = 5; - f_cellss_t data = f_cellss_t_initialize; - - { - const f_status_t status = f_cellss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_cellss_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_cellss_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_type_array_cell_decrease_by__returns_data_not(void **state) { - - const int length = 5; - f_cellss_t data = f_cellss_t_initialize; - - { - const f_status_t status = f_cellss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_cellss_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_type_array_cellss_increase_by__works(void **state) { - - const int length = 5; - f_cellss_t data = f_cells_t_initialize; - - { - const f_status_t status = f_cellss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_cellss_increase_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-cellss_increase_by.h deleted file mode 100644 index 5845526e9..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_increase_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__cellss_increase_by -#define _TEST__F_type_array__cellss_increase_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_cellss_increase_by() - */ -extern void test__f_type_array_cellss_increase_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_cellss_increase_by() - */ -extern void test__f_type_array_cellss_increase_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_cellss_increase_by() - */ -extern void test__f_type_array_cellss_increase_by__works(void **state); - -#endif // _TEST__F_type_array__cellss_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-cellss_resize.c deleted file mode 100644 index 41d81326d..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_resize.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-cellss_resize.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_cellss_resize__parameter_checking(void **state) { - - const int length = 5; - f_cellss_t data = f_cellss_t_initialize; - - { - const f_status_t status = f_cellss_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_type_array_cellss_resize__works(void **state) { - - const int length = 5; - f_cellss_t data = f_cellss_t_initialize; - - { - const f_status_t status = f_cellss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-cellss_resize.h deleted file mode 100644 index d84e7d4e0..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_resize.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__cellss_resize -#define _TEST__F_type_array__cellss_resize - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_cellss_resize() - */ -extern void test__f_type_array_cellss_resize__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_cellss_resize() - */ -extern void test__f_type_array_cellss_resize__works(void **state); - -#endif // _TEST__F_type_array__cellss_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-files_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-files_adjust.c deleted file mode 100644 index 2898b858d..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-files_adjust.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-files_adjust.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_files_adjust__parameter_checking(void **state) { - - const int length = 5; - f_files_t data = f_files_t_initialize; - - { - const f_status_t status = f_files_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_type_array_files_adjust__works(void **state) { - - const int length = 5; - f_files_t data = f_files_t_initialize; - - { - const f_status_t status = f_files_adjust(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-files_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-files_adjust.h deleted file mode 100644 index 29d4b64a2..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-files_adjust.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__files_adjust -#define _TEST__F_type_array__files_adjust - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_files_adjust() - */ -extern void test__f_type_array_files_adjust__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_files_adjust() - */ -extern void test__f_type_array_files_adjust__works(void **state); - -#endif // _TEST__F_type_array__files_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-files_adjust_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-files_adjust_callback.c new file mode 100644 index 000000000..4031df969 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-files_adjust_callback.c @@ -0,0 +1,45 @@ +#include "test-type_array.h" +#include "test-type_array-files_adjust_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_files_adjust_callback__fails(void **state) { + + f_file_t data = f_file_t_initialize; + f_file_t data_array[] = { data }; + f_files_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_files_t datass_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_adjust, true); + will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_files_adjust_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_files_adjust_callback__works(void **state) { + + f_file_t data = f_file_t_initialize; + f_file_t data_array[] = { data }; + f_files_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_files_t datass_array[] = { datas }; + const f_number_unsigned_t length = 1; + + { + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_none); + + const f_status_t status = f_files_adjust_callback(0, length, (void *) datass_array); + + assert_int_equal(status, F_none); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-files_adjust_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-files_adjust_callback.h new file mode 100644 index 000000000..b24b752e8 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-files_adjust_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__files_adjust_callback +#define _TEST__F_type_array__files_adjust_callback + +/** + * Test that the function fails. + * + * @see f_files_adjust_callback() + */ +extern void test__f_type_array_files_adjust_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_files_adjust_callback() + */ +extern void test__f_type_array_files_adjust_callback__works(void **state); + +#endif // _TEST__F_type_array__files_adjust_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-files_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-files_append.c deleted file mode 100644 index 60e088cab..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-files_append.c +++ /dev/null @@ -1,37 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-files_append.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_files_append__parameter_checking(void **state) { - - const f_file_t data = f_file_t_initialize; - - { - const f_status_t status = f_files_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_files_append__works(void **state) { - - const f_file_t source = macro_f_file_t_initialize_id(3); - f_files_t destination = f_files_t_initialize; - - { - const f_status_t status = f_files_append(source, &destination); - - assert_int_equal(status, F_none); - assert_int_equal(destination.used, 1); - assert_int_equal(destination.array[0].id, source.id); - } - - free((void *) destination.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-files_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-files_append.h deleted file mode 100644 index 7df88b91d..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-files_append.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__files_append -#define _TEST__F_type_array__files_append - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_files_append() - */ -extern void test__f_type_array_files_append__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_files_append() - */ -extern void test__f_type_array_files_append__works(void **state); - -#endif // _TEST__F_type_array__files_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-files_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-files_append_all.c deleted file mode 100644 index 24a87b122..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-files_append_all.c +++ /dev/null @@ -1,82 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-files_append_all.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_files_append_all__parameter_checking(void **state) { - - const f_files_t data = f_files_t_initialize; - - { - const f_status_t status = f_files_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_files_append_all__returns_data_not(void **state) { - - const int length = 5; - f_files_t source = f_files_t_initialize; - f_files_t destination = f_files_t_initialize; - - { - const f_status_t status = f_files_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_files_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_type_array_files_append_all__works(void **state) { - - const int length = 5; - const int length_used = 2; - f_files_t source = f_files_t_initialize; - f_files_t destination = f_files_t_initialize; - - { - const f_status_t status = f_files_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - for (; source.used < length_used; ++source.used) { - source.array[source.used].id = source.used + 1; - } // for - - { - const f_status_t status = f_files_append_all(source, &destination); - - assert_int_equal(status, F_none); - assert_int_equal(destination.used, source.used); - assert_int_equal(destination.size, source.used); - - for (f_number_unsigned_t i = 0; i < source.used; ++i) { - assert_int_equal(destination.array[i].id, i + 1); - } // for - } - - free((void *) source.array); - free((void *) destination.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-files_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-files_append_all.h deleted file mode 100644 index fa8e3e221..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-files_append_all.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__files_append_all -#define _TEST__F_type_array__files_append_all - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_files_append_all() - */ -extern void test__f_type_array_files_append_all__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_files_append_all() - */ -extern void test__f_type_array_files_append_all__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_files_append_all() - */ -extern void test__f_type_array_files_append_all__works(void **state); - -#endif // _TEST__F_type_array__files_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-files_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-files_decimate_by.c deleted file mode 100644 index 52b881983..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-files_decimate_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-files_decimate_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_files_decimate_by__parameter_checking(void **state) { - - const int length = 5; - f_files_t data = f_files_t_initialize; - - { - const f_status_t status = f_files_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_type_array_files_decimate_by__returns_data_not(void **state) { - - const int length = 5; - f_files_t data = f_files_t_initialize; - - { - const f_status_t status = f_files_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_files_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_type_array_files_decimate_by__works(void **state) { - - const int length = 5; - f_files_t data = f_files_t_initialize; - - { - const f_status_t status = f_files_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_files_decimate_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-files_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-files_decimate_by.h deleted file mode 100644 index 82bee2a24..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-files_decimate_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__files_decimate_by -#define _TEST__F_type_array__files_decimate_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_files_decimate_by() - */ -extern void test__f_type_array_files_decimate_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_files_decimate_by() - */ -extern void test__f_type_array_files_decimate_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_files_decimate_by() - */ -extern void test__f_type_array_files_decimate_by__works(void **state); - -#endif // _TEST__F_type_array__files_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-files_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-files_decrease_by.c deleted file mode 100644 index 7ecbe8ba9..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-files_decrease_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-files_decrease_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_files_decrease_by__parameter_checking(void **state) { - - const int length = 5; - f_files_t data = f_files_t_initialize; - - { - const f_status_t status = f_files_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_type_array_files_decrease_by__returns_data_not(void **state) { - - const int length = 5; - f_files_t data = f_files_t_initialize; - - { - const f_status_t status = f_files_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_files_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_type_array_files_decrease_by__works(void **state) { - - const int length = 5; - f_files_t data = f_files_t_initialize; - - { - const f_status_t status = f_files_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_files_decrease_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-files_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-files_decrease_by.h deleted file mode 100644 index 7fe8db334..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-files_decrease_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__files_decrease_by -#define _TEST__F_type_array__files_decrease_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_files_decrease_by() - */ -extern void test__f_type_array_files_decrease_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_files_decrease_by() - */ -extern void test__f_type_array_files_decrease_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_files_decrease_by() - */ -extern void test__f_type_array_files_decrease_by__works(void **state); - -#endif // _TEST__F_type_array__files_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-files_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-files_increase.c deleted file mode 100644 index 8801f67bf..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-files_increase.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-files_increase.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_files_increase__parameter_checking(void **state) { - - const int length = 5; - f_files_t data = f_files_t_initialize; - - { - const f_status_t status = f_files_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_type_array_files_increase__returns_data_not(void **state) { - - const int length = 5; - f_files_t data = f_files_t_initialize; - - { - const f_status_t status = f_files_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_files_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_type_array_files_increase__works(void **state) { - - const int length = 5; - f_files_t data = f_files_t_initialize; - - { - const f_status_t status = f_files_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_files_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-files_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-files_increase.h deleted file mode 100644 index 7c3adca88..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-files_increase.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__files_increase -#define _TEST__F_type_array__files_increase - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_files_increase() - */ -extern void test__f_type_array_files_increase__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_files_increase() - */ -extern void test__f_type_array_files_increase__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_files_increase() - */ -extern void test__f_type_array_files_increase__works(void **state); - -#endif // _TEST__F_type_array__files_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-files_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-files_increase_by.c deleted file mode 100644 index 8efbf25e1..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-files_increase_by.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-files_increase_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_files_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_files_t data = f_files_t_initialize; - - { - const f_status_t status = f_files_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_type_array_files_increase_by__returns_data_not(void **state) { - - const int length = 5; - f_files_t data = f_files_t_initialize; - - { - const f_status_t status = f_files_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_files_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_type_array_files_increase_by__works(void **state) { - - const int length = 5; - f_files_t data = f_files_t_initialize; - - { - const f_status_t status = f_files_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_files_increase_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-files_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-files_increase_by.h deleted file mode 100644 index e7a6dbcea..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-files_increase_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__files_increase_by -#define _TEST__F_type_array__files_increase_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_files_increase_by() - */ -extern void test__f_type_array_files_increase_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_files_increase_by() - */ -extern void test__f_type_array_files_increase_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_files_increase_by() - */ -extern void test__f_type_array_files_increase_by__works(void **state); - -#endif // _TEST__F_type_array__files_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-files_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-files_resize.c deleted file mode 100644 index 877714841..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-files_resize.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-files_resize.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_files_resize__parameter_checking(void **state) { - - const int length = 5; - f_files_t data = f_files_t_initialize; - - { - const f_status_t status = f_files_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_type_array_files_resize__works(void **state) { - - const int length = 5; - f_files_t data = f_files_t_initialize; - - { - const f_status_t status = f_files_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-files_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-files_resize.h deleted file mode 100644 index f62e6e12b..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-files_resize.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__files_resize -#define _TEST__F_type_array__files_resize - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_files_resize() - */ -extern void test__f_type_array_files_resize__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_files_resize() - */ -extern void test__f_type_array_files_resize__works(void **state); - -#endif // _TEST__F_type_array__files_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-files_resize_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-files_resize_callback.c new file mode 100644 index 000000000..948bb23f9 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-files_resize_callback.c @@ -0,0 +1,45 @@ +#include "test-type_array.h" +#include "test-type_array-files_resize_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_files_resize_callback__fails(void **state) { + + f_file_t data = f_file_t_initialize; + f_file_t data_array[] = { data }; + f_files_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_files_t datass_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_resize, true); + will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_files_resize_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_files_resize_callback__works(void **state) { + + f_file_t data = f_file_t_initialize; + f_file_t data_array[] = { data }; + f_files_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_files_t datass_array[] = { datas }; + const f_number_unsigned_t length = 1; + + { + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_none); + + const f_status_t status = f_files_resize_callback(0, length, (void *) datass_array); + + assert_int_equal(status, F_none); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-files_resize_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-files_resize_callback.h new file mode 100644 index 000000000..489a774f9 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-files_resize_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__files_resize_callback +#define _TEST__F_type_array__files_resize_callback + +/** + * Test that the function fails. + * + * @see f_files_resize_callback() + */ +extern void test__f_type_array_files_resize_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_files_resize_callback() + */ +extern void test__f_type_array_files_resize_callback__works(void **state); + +#endif // _TEST__F_type_array__files_resize_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-filess_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-filess_adjust.c deleted file mode 100644 index ea5b0881e..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-filess_adjust.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-filess_adjust.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_filess_adjust__parameter_checking(void **state) { - - const int length = 5; - f_filess_t data = f_filess_t_initialize; - - { - const f_status_t status = f_filess_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_type_array_filess_adjust__works(void **state) { - - const int length = 5; - f_filess_t data = f_filess_t_initialize; - - { - const f_status_t status = f_filess_adjust(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-filess_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-filess_adjust.h deleted file mode 100644 index e28182303..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-filess_adjust.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__filess_adjust -#define _TEST__F_type_array__filess_adjust - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_filess_adjust() - */ -extern void test__f_type_array_filess_adjust__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_filess_adjust() - */ -extern void test__f_type_array_filess_adjust__works(void **state); - -#endif // _TEST__F_type_array__filess_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-filess_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-filess_append.c deleted file mode 100644 index 09b483d2a..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-filess_append.c +++ /dev/null @@ -1,86 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-filess_append.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_filess_append__parameter_checking(void **state) { - - f_files_t data = f_files_t_initialize; - - { - const f_status_t status = f_filess_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_filess_append__returns_data_not(void **state) { - - const int length = 5; - f_files_t source = f_files_t_initialize; - f_filess_t destination = f_filess_t_initialize; - - { - const f_status_t status = f_files_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_filess_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_type_array_filess_append__works(void **state) { - - const int length = 5; - f_files_t source = f_files_t_initialize; - f_filess_t destination = f_filess_t_initialize; - - { - const f_status_t status = f_files_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - for (; source.used < length; ++source.used) { - source.array[source.used].id = source.used + 1; - } // for - - { - const f_status_t status = f_filess_append(source, &destination); - - assert_int_equal(status, F_none); - 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, i + 1); - } // 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 diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-filess_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-filess_append.h deleted file mode 100644 index 45b7e7c04..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-filess_append.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__filess_append -#define _TEST__F_type_array__filess_append - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_filess_append() - */ -extern void test__f_type_array_filess_append__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_filess_append() - */ -extern void test__f_type_array_filess_append__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_filess_append() - */ -extern void test__f_type_array_filess_append__works(void **state); - -#endif // _TEST__F_type_array__filess_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-filess_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-filess_append_all.c deleted file mode 100644 index 13a23b6b7..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-filess_append_all.c +++ /dev/null @@ -1,105 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-filess_append_all.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_filess_append_all__parameter_checking(void **state) { - - const f_filess_t data = f_filess_t_initialize; - - { - const f_status_t status = f_filess_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_filess_append_all__returns_data_not(void **state) { - - const int length = 5; - f_filess_t source = f_filess_t_initialize; - f_filess_t destination = f_filess_t_initialize; - - { - const f_status_t status = f_filess_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_filess_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_type_array_filess_append_all__works(void **state) { - - const int length = 5; - const int length_inner = 2; - f_filess_t source = f_filess_t_initialize; - f_filess_t destination = f_filess_t_initialize; - - { - const f_status_t status = f_filess_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - for (; source.used < length; ++source.used) { - - const f_status_t status = f_files_resize(length_inner, &source.array[source.used]); - - assert_int_equal(status, F_none); - - for (f_number_unsigned_t i = 0; i < length_inner; ++i) { - source.array[source.used].array[source.array[source.used].used++].id = i + 1; - } // for - } // for - } - - { - const f_status_t status = f_filess_append_all(source, &destination); - - assert_int_equal(status, F_none); - assert_int_equal(destination.used, source.used); - assert_int_equal(destination.size, source.used); - - for (f_number_unsigned_t i = 0; i < destination.used; ++i) { - - assert_int_equal(destination.array[i].used, length_inner); - assert_int_equal(destination.array[i].size, length_inner); - - for (f_number_unsigned_t j = 0; j < length_inner; ++j) { - assert_int_equal(destination.array[i].array[j].id, j + 1); - } // 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 diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-filess_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-filess_append_all.h deleted file mode 100644 index c4a981523..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-filess_append_all.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__filess_append_all -#define _TEST__F_type_array__filess_append_all - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_filess_append_all() - */ -extern void test__f_type_array_filess_append_all__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_filess_append_all() - */ -extern void test__f_type_array_filess_append_all__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_filess_append_all() - */ -extern void test__f_type_array_filess_append_all__works(void **state); - -#endif // _TEST__F_type_array__filess_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-filess_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-filess_decimate_by.c deleted file mode 100644 index b980a1a76..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-filess_decimate_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-filess_decimate_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_filess_decimate_by__parameter_checking(void **state) { - - const int length = 5; - f_filess_t data = f_filess_t_initialize; - - { - const f_status_t status = f_filess_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_type_array_filess_decimate_by__returns_data_not(void **state) { - - const int length = 5; - f_filess_t data = f_filess_t_initialize; - - { - const f_status_t status = f_filess_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_filess_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_type_array_filess_decimate_by__works(void **state) { - - const int length = 5; - f_filess_t data = f_filess_t_initialize; - - { - const f_status_t status = f_filess_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_filess_decimate_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-filess_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-filess_decimate_by.h deleted file mode 100644 index e2ff0f081..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-filess_decimate_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__filess_decimate_by -#define _TEST__F_type_array__filess_decimate_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_filess_decimate_by() - */ -extern void test__f_type_array_filess_decimate_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_type_array_filess_decimate_by() - */ -extern void test__f_type_array_filess_decimate_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_filess_decimate_by() - */ -extern void test__f_type_array_filess_decimate_by__works(void **state); - -#endif // _TEST__F_type_array__filess_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-filess_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-filess_decrease_by.c deleted file mode 100644 index a656bd62c..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-filess_decrease_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-filess_decrease_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_filess_decrease_by__parameter_checking(void **state) { - - const int length = 5; - f_filess_t data = f_filess_t_initialize; - - { - const f_status_t status = f_filess_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_type_array_filess_decrease_by__returns_data_not(void **state) { - - const int length = 5; - f_filess_t data = f_filess_t_initialize; - - { - const f_status_t status = f_filess_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_filess_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_type_array_filess_decrease_by__works(void **state) { - - const int length = 5; - f_filess_t data = f_filess_t_initialize; - - { - const f_status_t status = f_filess_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_filess_decrease_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-filess_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-filess_decrease_by.h deleted file mode 100644 index 816a091b7..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-filess_decrease_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__filess_decrease_by -#define _TEST__F_type_array__filess_decrease_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_filess_decrease_by() - */ -extern void test__f_type_array_filess_decrease_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_filess_decrease_by() - */ -extern void test__f_type_array_filess_decrease_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_filess_decrease_by() - */ -extern void test__f_type_array_filess_decrease_by__works(void **state); - -#endif // _TEST__F_type_array__filess_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-filess_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-filess_increase.c deleted file mode 100644 index 5a12a45d8..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-filess_increase.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-filess_increase.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_filess_increase__parameter_checking(void **state) { - - const int length = 5; - f_filess_t data = f_files_t_initialize; - - { - const f_status_t status = f_filess_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_type_array_filess_increase__returns_data_not(void **state) { - - const int length = 5; - f_filess_t data = f_filess_t_initialize; - - { - const f_status_t status = f_filess_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_filess_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_type_array_filess_increase__works(void **state) { - - const int length = 5; - f_filess_t data = f_filess_t_initialize; - - { - const f_status_t status = f_filess_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_filess_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-filess_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-filess_increase.h deleted file mode 100644 index 090122293..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-filess_increase.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__filess_increase -#define _TEST__F_type_array__filess_increase - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_filess_increase() - */ -extern void test__f_type_array_filess_increase__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_filess_increase() - */ -extern void test__f_type_array_filess_increase__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_filess_increase() - */ -extern void test__f_type_array_filess_increase__works(void **state); - -#endif // _TEST__F_type_array__filess_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-filess_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-filess_increase_by.c deleted file mode 100644 index 65b56e5a0..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-filess_increase_by.c +++ /dev/null @@ -1,84 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-filess_increase_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_filess_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_filess_t data = f_filess_t_initialize; - - { - const f_status_t status = f_filess_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_type_array_filess_increase_by__returns_data_not(void **state) { - - const int length = 5; - f_filess_t data = f_filess_t_initialize; - - { - const f_status_t status = f_filess_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_filess_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_filess_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_type_array_filess_increase_by__works(void **state) { - - const int length = 5; - f_filess_t data = f_filess_t_initialize; - - { - const f_status_t status = f_filess_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_filess_increase_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-filess_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-filess_increase_by.h deleted file mode 100644 index e5495853f..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-filess_increase_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__filess_increase_by -#define _TEST__F_type_array__filess_increase_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_filess_increase_by() - */ -extern void test__f_type_array_filess_increase_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_filess_increase_by() - */ -extern void test__f_type_array_filess_increase_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_filess_increase_by() - */ -extern void test__f_type_array_filess_increase_by__works(void **state); - -#endif // _TEST__F_type_array__filess_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-filess_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-filess_resize.c deleted file mode 100644 index 2323ae6e9..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-filess_resize.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-filess_resize.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_filess_resize__parameter_checking(void **state) { - - const int length = 5; - f_filess_t data = f_filess_t_initialize; - - { - const f_status_t status = f_filess_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_type_array_filess_resize__works(void **state) { - - const int length = 5; - f_filess_t data = f_filess_t_initialize; - - { - const f_status_t status = f_filess_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-filess_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-filess_resize.h deleted file mode 100644 index e2e04728c..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-filess_resize.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__filess_resize -#define _TEST__F_type_array__filess_resize - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_filess_resize() - */ -extern void test__f_type_array_filess_resize__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_filess_resize() - */ -extern void test__f_type_array_filess_resize__works(void **state); - -#endif // _TEST__F_type_array__filess_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_adjust.c deleted file mode 100644 index 62e20eb21..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_adjust.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-fll_ids_adjust.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_fll_ids_adjust__parameter_checking(void **state) { - - const int length = 5; - f_fll_ids_t data = f_fll_ids_t_initialize; - - { - const f_status_t status = f_fll_ids_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_type_array_fll_ids_adjust__works(void **state) { - - const int length = 5; - f_fll_ids_t data = f_fll_ids_t_initialize; - - { - const f_status_t status = f_fll_ids_adjust(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_adjust.h deleted file mode 100644 index 3f3002e7e..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_adjust.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__fll_ids_adjust -#define _TEST__F_type_array__fll_ids_adjust - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fll_ids_adjust() - */ -extern void test__f_type_array_fll_ids_adjust__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_fll_ids_adjust() - */ -extern void test__f_type_array_fll_ids_adjust__works(void **state); - -#endif // _TEST__F_type_array__fll_ids_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_adjust_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_adjust_callback.c new file mode 100644 index 000000000..1e38a59e2 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_adjust_callback.c @@ -0,0 +1,45 @@ +#include "test-type_array.h" +#include "test-type_array-fll_ids_adjust_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_fll_ids_adjust_callback__fails(void **state) { + + f_fll_id_t data = f_fll_id_t_initialize; + f_fll_id_t data_array[] = { data }; + f_fll_ids_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_fll_ids_t datass_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_adjust, true); + will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_fll_ids_adjust_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_fll_ids_adjust_callback__works(void **state) { + + f_fll_id_t data = f_fll_id_t_initialize; + f_fll_id_t data_array[] = { data }; + f_fll_ids_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_fll_ids_t datass_array[] = { datas }; + const f_number_unsigned_t length = 1; + + { + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_none); + + const f_status_t status = f_fll_ids_adjust_callback(0, length, (void *) datass_array); + + assert_int_equal(status, F_none); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_adjust_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_adjust_callback.h new file mode 100644 index 000000000..66c616703 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_adjust_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__fll_ids_adjust_callback +#define _TEST__F_type_array__fll_ids_adjust_callback + +/** + * Test that the function fails. + * + * @see f_fll_ids_adjust_callback() + */ +extern void test__f_type_array_fll_ids_adjust_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_fll_ids_adjust_callback() + */ +extern void test__f_type_array_fll_ids_adjust_callback__works(void **state); + +#endif // _TEST__F_type_array__fll_ids_adjust_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_append.c deleted file mode 100644 index d0905dbdf..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_append.c +++ /dev/null @@ -1,39 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-fll_ids_append.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_fll_ids_append__parameter_checking(void **state) { - - const f_fll_id_t data = f_fll_id_t_initialize; - - { - const f_status_t status = f_fll_ids_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_fll_ids_append__works(void **state) { - - const f_fll_id_t source = { .name = "test", .type = 1, .used = 4 }; - f_fll_ids_t destination = f_fll_ids_t_initialize; - - { - const f_status_t status = f_fll_ids_append(source, &destination); - - assert_int_equal(status, F_none); - assert_int_equal(destination.used, 1); - assert_string_equal(destination.array[0].name, source.name); - assert_int_equal(destination.array[0].type, source.type); - assert_int_equal(destination.array[0].used, source.used); - } - - free((void *) destination.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_append.h deleted file mode 100644 index 075a4a7e8..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_append.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__fll_ids_append -#define _TEST__F_type_array__fll_ids_append - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fll_ids_append() - */ -extern void test__f_type_array_fll_ids_append__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_fll_ids_append() - */ -extern void test__f_type_array_fll_ids_append__works(void **state); - -#endif // _TEST__F_type_array__fll_ids_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_append_all.c deleted file mode 100644 index c087020b9..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_append_all.c +++ /dev/null @@ -1,87 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-fll_ids_append_all.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_fll_ids_append_all__parameter_checking(void **state) { - - const f_fll_ids_t data = f_fll_ids_t_initialize; - - { - const f_status_t status = f_fll_ids_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_fll_ids_append_all__returns_data_not(void **state) { - - const int length = 5; - f_fll_ids_t source = f_fll_ids_t_initialize; - f_fll_ids_t destination = f_fll_ids_t_initialize; - - { - const f_status_t status = f_fll_ids_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_fll_ids_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_type_array_fll_ids_append_all__works(void **state) { - - const int length = 5; - f_fll_ids_t source = f_fll_ids_t_initialize; - f_fll_ids_t destination = f_fll_ids_t_initialize; - - const f_fll_id_t fll_id_0 = { .name = "test", .type = 1, .used = 4 }; - const f_fll_id_t fll_id_1 = { .name = "other", .type = 2, .used = 5 }; - - { - const f_status_t status = f_fll_ids_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - memcpy(&source.array[source.used++], (void *) &fll_id_0, sizeof(f_fll_id_t)); - memcpy(&source.array[source.used++], (void *) &fll_id_1, sizeof(f_fll_id_t)); - - { - const f_status_t status = f_fll_ids_append_all(source, &destination); - - assert_int_equal(status, F_none); - assert_int_equal(destination.used, source.used); - assert_int_equal(destination.size, source.used); - - assert_string_equal(destination.array[0].name, fll_id_0.name); - assert_int_equal(destination.array[0].type, fll_id_0.type); - assert_int_equal(destination.array[0].used, fll_id_0.used); - - assert_string_equal(destination.array[1].name, fll_id_1.name); - assert_int_equal(destination.array[1].type, fll_id_1.type); - assert_int_equal(destination.array[1].used, fll_id_1.used); - } - - free((void *) source.array); - free((void *) destination.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_append_all.h deleted file mode 100644 index 382886697..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_append_all.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__fll_ids_append_all -#define _TEST__F_type_array__fll_ids_append_all - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fll_ids_append_all() - */ -extern void test__f_type_array_fll_ids_append_all__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_fll_ids_append_all() - */ -extern void test__f_type_array_fll_ids_append_all__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_fll_ids_append_all() - */ -extern void test__f_type_array_fll_ids_append_all__works(void **state); - -#endif // _TEST__F_type_array__fll_ids_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_decimate_by.c deleted file mode 100644 index 85b522820..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_decimate_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-fll_ids_decimate_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_fll_ids_decimate_by__parameter_checking(void **state) { - - const int length = 5; - f_fll_ids_t data = f_fll_ids_t_initialize; - - { - const f_status_t status = f_fll_ids_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_type_array_fll_ids_decimate_by__returns_data_not(void **state) { - - const int length = 5; - f_fll_ids_t data = f_fll_ids_t_initialize; - - { - const f_status_t status = f_fll_ids_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_fll_ids_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_type_array_fll_ids_decimate_by__works(void **state) { - - const int length = 5; - f_fll_ids_t data = f_fll_ids_t_initialize; - - { - const f_status_t status = f_fll_ids_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_fll_ids_decimate_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_decimate_by.h deleted file mode 100644 index 9bcfde28d..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_decimate_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__fll_ids_decimate_by -#define _TEST__F_type_array__fll_ids_decimate_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fll_ids_decimate_by() - */ -extern void test__f_type_array_fll_ids_decimate_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_fll_ids_decimate_by() - */ -extern void test__f_type_array_fll_ids_decimate_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_fll_ids_decimate_by() - */ -extern void test__f_type_array_fll_ids_decimate_by__works(void **state); - -#endif // _TEST__F_type_array__fll_ids_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_decrease_by.c deleted file mode 100644 index 6815c0ccc..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_decrease_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-fll_ids_decrease_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_fll_ids_decrease_by__parameter_checking(void **state) { - - const int length = 5; - f_fll_ids_t data = f_fll_ids_t_initialize; - - { - const f_status_t status = f_fll_ids_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_type_array_fll_ids_decrease_by__returns_data_not(void **state) { - - const int length = 5; - f_fll_ids_t data = f_fll_ids_t_initialize; - - { - const f_status_t status = f_fll_ids_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_fll_ids_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_type_array_fll_ids_decrease_by__works(void **state) { - - const int length = 5; - f_fll_ids_t data = f_fll_ids_t_initialize; - - { - const f_status_t status = f_fll_ids_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_fll_ids_decrease_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_decrease_by.h deleted file mode 100644 index f7b8273e4..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_decrease_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__fll_ids_decrease_by -#define _TEST__F_type_array__fll_ids_decrease_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fll_ids_decrease_by() - */ -extern void test__f_type_array_fll_ids_decrease_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_fll_ids_decrease_by() - */ -extern void test__f_type_array_fll_ids_decrease_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_fll_ids_decrease_by() - */ -extern void test__f_type_array_fll_ids_decrease_by__works(void **state); - -#endif // _TEST__F_type_array__fll_ids_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_increase.c deleted file mode 100644 index d49fda557..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_increase.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-fll_ids_increase.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_fll_ids_increase__parameter_checking(void **state) { - - const int length = 5; - f_fll_ids_t data = f_fll_ids_t_initialize; - - { - const f_status_t status = f_fll_ids_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_type_array_fll_ids_increase__returns_data_not(void **state) { - - const int length = 5; - f_fll_ids_t data = f_fll_ids_t_initialize; - - { - const f_status_t status = f_fll_ids_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_fll_ids_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_type_array_fll_ids_increase__works(void **state) { - - const int length = 5; - f_fll_ids_t data = f_fll_ids_t_initialize; - - { - const f_status_t status = f_fll_ids_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_fll_ids_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_increase.h deleted file mode 100644 index 2ba7d7a59..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_increase.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__fll_ids_increase -#define _TEST__F_type_array__fll_ids_increase - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fll_ids_increase() - */ -extern void test__f_type_array_fll_ids_increase__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_fll_ids_increase() - */ -extern void test__f_type_array_fll_ids_increase__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_fll_ids_increase() - */ -extern void test__f_type_array_fll_ids_increase__works(void **state); - -#endif // _TEST__F_type_array__fll_ids_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_increase_by.c deleted file mode 100644 index e95bab0c6..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_increase_by.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-fll_ids_increase_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_fll_ids_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_fll_ids_t data = f_fll_ids_t_initialize; - - { - const f_status_t status = f_fll_ids_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_type_array_fll_ids_increase_by__returns_data_not(void **state) { - - const int length = 5; - f_fll_ids_t data = f_fll_ids_t_initialize; - - { - const f_status_t status = f_fll_ids_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_fll_ids_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_type_array_fll_ids_increase_by__works(void **state) { - - const int length = 5; - f_fll_ids_t data = f_fll_ids_t_initialize; - - { - const f_status_t status = f_fll_ids_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_fll_ids_increase_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_increase_by.h deleted file mode 100644 index a55e49a56..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_increase_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__fll_ids_increase_by -#define _TEST__F_type_array__fll_ids_increase_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fll_ids_increase_by() - */ -extern void test__f_type_array_fll_ids_increase_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_fll_ids_increase_by() - */ -extern void test__f_type_array_fll_ids_increase_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_fll_ids_increase_by() - */ -extern void test__f_type_array_fll_ids_increase_by__works(void **state); - -#endif // _TEST__F_type_array__fll_ids_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_resize.c deleted file mode 100644 index 519a625f2..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_resize.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-fll_ids_resize.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_fll_ids_resize__parameter_checking(void **state) { - - const int length = 5; - f_fll_ids_t data = f_fll_ids_t_initialize; - - { - const f_status_t status = f_fll_ids_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_type_array_fll_ids_resize__works(void **state) { - - const int length = 5; - f_fll_ids_t data = f_fll_ids_t_initialize; - - { - const f_status_t status = f_fll_ids_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_resize.h deleted file mode 100644 index f93dc6c74..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_resize.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__fll_ids_resize -#define _TEST__F_type_array__fll_ids_resize - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fll_ids_resize() - */ -extern void test__f_type_array_fll_ids_resize__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_fll_ids_resize() - */ -extern void test__f_type_array_fll_ids_resize__works(void **state); - -#endif // _TEST__F_type_array__fll_ids_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_resize_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_resize_callback.c new file mode 100644 index 000000000..6f22b4ebf --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_resize_callback.c @@ -0,0 +1,45 @@ +#include "test-type_array.h" +#include "test-type_array-fll_ids_resize_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_fll_ids_resize_callback__fails(void **state) { + + f_fll_id_t data = f_fll_id_t_initialize; + f_fll_id_t data_array[] = { data }; + f_fll_ids_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_fll_ids_t datass_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_resize, true); + will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_fll_ids_resize_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_fll_ids_resize_callback__works(void **state) { + + f_fll_id_t data = f_fll_id_t_initialize; + f_fll_id_t data_array[] = { data }; + f_fll_ids_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_fll_ids_t datass_array[] = { datas }; + const f_number_unsigned_t length = 1; + + { + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_none); + + const f_status_t status = f_fll_ids_resize_callback(0, length, (void *) datass_array); + + assert_int_equal(status, F_none); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_resize_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_resize_callback.h new file mode 100644 index 000000000..3495e97a7 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_resize_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__fll_ids_resize_callback +#define _TEST__F_type_array__fll_ids_resize_callback + +/** + * Test that the function fails. + * + * @see f_fll_ids_resize_callback() + */ +extern void test__f_type_array_fll_ids_resize_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_fll_ids_resize_callback() + */ +extern void test__f_type_array_fll_ids_resize_callback__works(void **state); + +#endif // _TEST__F_type_array__fll_ids_resize_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_adjust.c deleted file mode 100644 index fe2d8ecfb..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_adjust.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-fll_idss_adjust.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_fll_idss_adjust__parameter_checking(void **state) { - - const int length = 5; - f_fll_idss_t data = f_fll_idss_t_initialize; - - { - const f_status_t status = f_fll_idss_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_type_array_fll_idss_adjust__works(void **state) { - - const int length = 5; - f_fll_idss_t data = f_fll_idss_t_initialize; - - { - const f_status_t status = f_fll_idss_adjust(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_adjust.h deleted file mode 100644 index 280bc7cc2..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_adjust.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__fll_idss_adjust -#define _TEST__F_type_array__fll_idss_adjust - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fll_idss_adjust() - */ -extern void test__f_type_array_fll_idss_adjust__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_fll_idss_adjust() - */ -extern void test__f_type_array_fll_idss_adjust__works(void **state); - -#endif // _TEST__F_type_array__fll_idss_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_append.c deleted file mode 100644 index 1429f9c78..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_append.c +++ /dev/null @@ -1,91 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-fll_idss_append.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_fll_idss_append__parameter_checking(void **state) { - - f_fll_ids_t data = f_fll_ids_t_initialize; - - { - const f_status_t status = f_fll_idss_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_fll_idss_append__returns_data_not(void **state) { - - const int length = 5; - f_fll_ids_t source = f_fll_idss_t_initialize; - f_fll_idss_t destination = f_fll_idss_t_initialize; - - { - const f_status_t status = f_fll_ids_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_fll_idss_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_type_array_fll_idss_append__works(void **state) { - - const int length = 5; - f_fll_ids_t source = f_fll_ids_t_initialize; - f_fll_idss_t destination = f_fll_idss_t_initialize; - - const f_fll_id_t fll_id = { .name = "test", .type = 1, .used = 4 }; - - { - const f_status_t status = f_fll_ids_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - while (source.used < length) { - memcpy(&source.array[source.used++], (void *) &fll_id, sizeof(f_fll_id_t)); - } // while - - { - const f_status_t status = f_fll_idss_append(source, &destination); - - assert_int_equal(status, F_none); - 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_string_equal(destination.array[0].array[i].name, fll_id.name); - assert_int_equal(destination.array[0].array[i].type, fll_id.type); - assert_int_equal(destination.array[0].array[i].used, fll_id.used); - } // 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 diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_append.h deleted file mode 100644 index 353df1ecc..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_append.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__fll_idss_append -#define _TEST__F_type_array__fll_idss_append - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fll_idss_append() - */ -extern void test__f_type_array_fll_idss_append__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_fll_idss_append() - */ -extern void test__f_type_array_fll_idss_append__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_fll_idss_append() - */ -extern void test__f_type_array_fll_idss_append__works(void **state); - -#endif // _TEST__F_type_array__fll_idss_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_append_all.c deleted file mode 100644 index 78a11df0d..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_append_all.c +++ /dev/null @@ -1,111 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-fll_idss_append_all.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_fll_idss_append_all__parameter_checking(void **state) { - - const f_fll_idss_t data = f_fll_idss_t_initialize; - - { - const f_status_t status = f_fll_idss_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_fll_idss_append_all__returns_data_not(void **state) { - - const int length = 5; - f_fll_idss_t source = f_fll_idss_t_initialize; - f_fll_idss_t destination = f_fll_idss_t_initialize; - - { - const f_status_t status = f_fll_idss_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_fll_idss_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_type_array_fll_idss_append_all__works(void **state) { - - const int length = 5; - const int length_inner = 2; - f_fll_idss_t source = f_fll_idss_t_initialize; - f_fll_idss_t destination = f_fll_idss_t_initialize; - - const f_fll_id_t fll_id_0 = { .name = "test", .type = 1, .used = 4 }; - const f_fll_id_t fll_id_1 = { .name = "other", .type = 2, .used = 5 }; - - { - const f_status_t status = f_fll_idss_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - for (; source.used < length; ++source.used) { - - const f_status_t status = f_fll_ids_resize(length_inner, &source.array[source.used]); - - assert_int_equal(status, F_none); - - memcpy(&source.array[source.used].array[source.array[source.used].used++], (void *) &fll_id_0, sizeof(f_fll_id_t)); - memcpy(&source.array[source.used].array[source.array[source.used].used++], (void *) &fll_id_1, sizeof(f_fll_id_t)); - } // for - } - - { - const f_status_t status = f_fll_idss_append_all(source, &destination); - - assert_int_equal(status, F_none); - assert_int_equal(destination.used, source.used); - assert_int_equal(destination.size, source.used); - - for (f_number_unsigned_t i = 0; i < destination.used; ++i) { - - assert_int_equal(destination.array[i].used, length_inner); - assert_int_equal(destination.array[i].size, length_inner); - - assert_string_equal(destination.array[i].array[0].name, fll_id_0.name); - assert_int_equal(destination.array[i].array[0].type, fll_id_0.type); - assert_int_equal(destination.array[i].array[0].used, fll_id_0.used); - - assert_string_equal(destination.array[i].array[1].name, fll_id_1.name); - assert_int_equal(destination.array[i].array[1].type, fll_id_1.type); - assert_int_equal(destination.array[i].array[1].used, fll_id_1.used); - } // 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 diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_append_all.h deleted file mode 100644 index 53ddc2d8d..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_append_all.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__fll_idss_append_all -#define _TEST__F_type_array__fll_idss_append_all - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fll_idss_append_all() - */ -extern void test__f_type_array_fll_idss_append_all__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_fll_idss_append_all() - */ -extern void test__f_type_array_fll_idss_append_all__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_fll_idss_append_all() - */ -extern void test__f_type_array_fll_idss_append_all__works(void **state); - -#endif // _TEST__F_type_array__fll_idss_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_decimate_by.c deleted file mode 100644 index 14a0083e1..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_decimate_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-fll_idss_decimate_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_fll_idss_decimate_by__parameter_checking(void **state) { - - const int length = 5; - f_fll_idss_t data = f_fll_ids_t_initialize; - - { - const f_status_t status = f_fll_idss_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_type_array_fll_idss_decimate_by__returns_data_not(void **state) { - - const int length = 5; - f_fll_idss_t data = f_fll_idss_t_initialize; - - { - const f_status_t status = f_fll_idss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_fll_idss_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_type_array_fll_idss_decimate_by__works(void **state) { - - const int length = 5; - f_fll_idss_t data = f_fll_ids_t_initialize; - - { - const f_status_t status = f_fll_idss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_fll_idss_decimate_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_decimate_by.h deleted file mode 100644 index a3238427e..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_decimate_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__fll_idss_decimate_by -#define _TEST__F_type_array__fll_idss_decimate_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fll_idss_decimate_by() - */ -extern void test__f_type_array_fll_idss_decimate_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_type_array_fll_idss_decimate_by() - */ -extern void test__f_type_array_fll_idss_decimate_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_fll_idss_decimate_by() - */ -extern void test__f_type_array_fll_idss_decimate_by__works(void **state); - -#endif // _TEST__F_type_array__fll_idss_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_decrease_by.c deleted file mode 100644 index bd7a7d5fe..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_decrease_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-fll_idss_decrease_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_fll_idss_decrease_by__parameter_checking(void **state) { - - const int length = 5; - f_fll_idss_t data = f_fll_ids_t_initialize; - - { - const f_status_t status = f_fll_idss_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_type_array_fll_idss_decrease_by__returns_data_not(void **state) { - - const int length = 5; - f_fll_idss_t data = f_fll_idss_t_initialize; - - { - const f_status_t status = f_fll_idss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_fll_idss_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_type_array_fll_idss_decrease_by__works(void **state) { - - const int length = 5; - f_fll_idss_t data = f_fll_ids_t_initialize; - - { - const f_status_t status = f_fll_idss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_fll_idss_decrease_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_decrease_by.h deleted file mode 100644 index d6d779a47..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_decrease_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__fll_idss_decrease_by -#define _TEST__F_type_array__fll_idss_decrease_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fll_idss_decrease_by() - */ -extern void test__f_type_array_fll_idss_decrease_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_fll_idss_decrease_by() - */ -extern void test__f_type_array_fll_idss_decrease_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_fll_idss_decrease_by() - */ -extern void test__f_type_array_fll_idss_decrease_by__works(void **state); - -#endif // _TEST__F_type_array__fll_idss_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_increase.c deleted file mode 100644 index a6ac66860..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_increase.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-fll_idss_increase.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_fll_idss_increase__parameter_checking(void **state) { - - const int length = 5; - f_fll_idss_t data = f_fll_ids_t_initialize; - - { - const f_status_t status = f_fll_idss_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_type_array_fll_idss_increase__returns_data_not(void **state) { - - const int length = 5; - f_fll_idss_t data = f_fll_ids_t_initialize; - - { - const f_status_t status = f_fll_idss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_fll_idss_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_type_array_fll_idss_increase__works(void **state) { - - const int length = 5; - f_fll_idss_t data = f_fll_ids_t_initialize; - - { - const f_status_t status = f_fll_idss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_fll_idss_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_increase.h deleted file mode 100644 index 1b8ab3cb4..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_increase.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__fll_idss_increase -#define _TEST__F_type_array__fll_idss_increase - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fll_idss_increase() - */ -extern void test__f_type_array_fll_idss_increase__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_fll_idss_increase() - */ -extern void test__f_type_array_fll_idss_increase__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_fll_idss_increase() - */ -extern void test__f_type_array_fll_idss_increase__works(void **state); - -#endif // _TEST__F_type_array__fll_idss_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_increase_by.c deleted file mode 100644 index 523a85258..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_increase_by.c +++ /dev/null @@ -1,84 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-fll_idss_increase_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_fll_idss_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_fll_idss_t data = f_fll_ids_t_initialize; - - { - const f_status_t status = f_fll_idss_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_type_array_fll_idss_increase_by__returns_data_not(void **state) { - - const int length = 5; - f_fll_idss_t data = f_fll_idss_t_initialize; - - { - const f_status_t status = f_fll_idss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_fll_idss_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_fll_idss_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_type_array_fll_idss_increase_by__works(void **state) { - - const int length = 5; - f_fll_idss_t data = f_fll_ids_t_initialize; - - { - const f_status_t status = f_fll_idss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_fll_idss_increase_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_increase_by.h deleted file mode 100644 index 85e9632ca..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_increase_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__fll_idss_increase_by -#define _TEST__F_type_array__fll_idss_increase_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fll_idss_increase_by() - */ -extern void test__f_type_array_fll_idss_increase_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_fll_idss_increase_by() - */ -extern void test__f_type_array_fll_idss_increase_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_fll_idss_increase_by() - */ -extern void test__f_type_array_fll_idss_increase_by__works(void **state); - -#endif // _TEST__F_type_array__fll_idss_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_resize.c deleted file mode 100644 index 5b031af40..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_resize.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-fll_idss_resize.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_fll_idss_resize__parameter_checking(void **state) { - - const int length = 5; - f_fll_idss_t data = f_fll_idss_t_initialize; - - { - const f_status_t status = f_fll_idss_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_type_array_fll_idss_resize__works(void **state) { - - const int length = 5; - f_fll_idss_t data = f_fll_idss_t_initialize; - - { - const f_status_t status = f_fll_idss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_resize.h deleted file mode 100644 index a22ceb866..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_resize.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__fll_idss_resize -#define _TEST__F_type_array__fll_idss_resize - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_fll_idss_resize() - */ -extern void test__f_type_array_fll_idss_resize__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_fll_idss_resize() - */ -extern void test__f_type_array_fll_idss_resize__works(void **state); - -#endif // _TEST__F_type_array__fll_idss_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_adjust.c deleted file mode 100644 index eb2f97d4c..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_adjust.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int128s_adjust.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int128s_adjust__parameter_checking(void **state) { - - const int length = 5; - f_int128s_t data = f_int128s_t_initialize; - - { - const f_status_t status = f_int128s_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_type_array_int128s_adjust__works(void **state) { - - const int length = 5; - f_int128s_t data = f_int128s_t_initialize; - - { - const f_status_t status = f_int128s_adjust(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_adjust.h deleted file mode 100644 index a281b33f3..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_adjust.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int128s_adjust -#define _TEST__F_type_array__int128s_adjust - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int128s_adjust() - */ -extern void test__f_type_array_int128s_adjust__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_int128s_adjust() - */ -extern void test__f_type_array_int128s_adjust__works(void **state); - -#endif // _TEST__F_type_array__int128s_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_adjust_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_adjust_callback.c new file mode 100644 index 000000000..efb1bc228 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_adjust_callback.c @@ -0,0 +1,45 @@ +#include "test-type_array.h" +#include "test-type_array-int128s_adjust_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int128s_adjust_callback__fails(void **state) { + + f_int128_t data = 0; + f_int128_t data_array[] = { data }; + f_int128s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_int128s_t datass_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_adjust, true); + will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_int128s_adjust_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_int128s_adjust_callback__works(void **state) { + + f_int128_t data = 0; + f_int128_t data_array[] = { data }; + f_int128s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_int128s_t datass_array[] = { datas }; + const f_number_unsigned_t length = 1; + + { + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_none); + + const f_status_t status = f_int128s_adjust_callback(0, length, (void *) datass_array); + + assert_int_equal(status, F_none); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_adjust_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_adjust_callback.h new file mode 100644 index 000000000..97145c845 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_adjust_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int128s_adjust_callback +#define _TEST__F_type_array__int128s_adjust_callback + +/** + * Test that the function fails. + * + * @see f_int128s_adjust_callback() + */ +extern void test__f_type_array_int128s_adjust_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_int128s_adjust_callback() + */ +extern void test__f_type_array_int128s_adjust_callback__works(void **state); + +#endif // _TEST__F_type_array__int128s_adjust_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_append.c deleted file mode 100644 index 239ecb649..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_append.c +++ /dev/null @@ -1,37 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int128s_append.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int128s_append__parameter_checking(void **state) { - - const int128_t data = 0; - - { - const f_status_t status = f_int128s_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_int128s_append__works(void **state) { - - const int128_t source = 3; - f_int128s_t destination = f_int128s_t_initialize; - - { - const f_status_t status = f_int128s_append(source, &destination); - - assert_int_equal(status, F_none); - assert_int_equal(destination.used, 1); - assert_int_equal(destination.array[0], source); - } - - free((void *) destination.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_append.h deleted file mode 100644 index 1cd336189..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_append.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int128s_append -#define _TEST__F_type_array__int128s_append - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int128s_append() - */ -extern void test__f_type_array_int128s_append__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_int128s_append() - */ -extern void test__f_type_array_int128s_append__works(void **state); - -#endif // _TEST__F_type_array__int128s_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_append_all.c deleted file mode 100644 index b8a3bcd35..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_append_all.c +++ /dev/null @@ -1,82 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int128s_append_all.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int128s_append_all__parameter_checking(void **state) { - - const f_int128s_t data = f_int128s_t_initialize; - - { - const f_status_t status = f_int128s_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_int128s_append_all__returns_data_not(void **state) { - - const int length = 5; - f_int128s_t source = f_int128s_t_initialize; - f_int128s_t destination = f_int128s_t_initialize; - - { - const f_status_t status = f_int128s_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_int128s_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_type_array_int128s_append_all__works(void **state) { - - const int length = 5; - const int length_used = 2; - f_int128s_t source = f_int128s_t_initialize; - f_int128s_t destination = f_int128s_t_initialize; - - { - const f_status_t status = f_int128s_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - for (; source.used < length_used; ++source.used) { - source.array[source.used] = source.used + 1; - } // for - - { - const f_status_t status = f_int128s_append_all(source, &destination); - - assert_int_equal(status, F_none); - assert_int_equal(destination.used, source.used); - assert_int_equal(destination.size, source.used); - - for (f_number_unsigned_t i = 0; i < source.used; ++i) { - assert_int_equal(destination.array[i], i + 1); - } // for - } - - free((void *) source.array); - free((void *) destination.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_append_all.h deleted file mode 100644 index 8aba1f3e0..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_append_all.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int128s_append_all -#define _TEST__F_type_array__int128s_append_all - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int128s_append_all() - */ -extern void test__f_type_array_int128s_append_all__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_int128s_append_all() - */ -extern void test__f_type_array_int128s_append_all__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_int128s_append_all() - */ -extern void test__f_type_array_int128s_append_all__works(void **state); - -#endif // _TEST__F_type_array__int128s_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_decimate_by.c deleted file mode 100644 index 9a655aa06..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_decimate_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int128s_decimate_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int128s_decimate_by__parameter_checking(void **state) { - - const int length = 5; - f_int128s_t data = f_int128s_t_initialize; - - { - const f_status_t status = f_int128s_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_type_array_int128s_decimate_by__returns_data_not(void **state) { - - const int length = 5; - f_int128s_t data = f_int128s_t_initialize; - - { - const f_status_t status = f_int128s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int128s_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_type_array_int128s_decimate_by__works(void **state) { - - const int length = 5; - f_int128s_t data = f_int128s_t_initialize; - - { - const f_status_t status = f_int128s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int128s_decimate_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_decimate_by.h deleted file mode 100644 index 7b59d17eb..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_decimate_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int128s_decimate_by -#define _TEST__F_type_array__int128s_decimate_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int128s_decimate_by() - */ -extern void test__f_type_array_int128s_decimate_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_int128s_decimate_by() - */ -extern void test__f_type_array_int128s_decimate_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_int128s_decimate_by() - */ -extern void test__f_type_array_int128s_decimate_by__works(void **state); - -#endif // _TEST__F_type_array__int128s_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_decrease_by.c deleted file mode 100644 index 5039bf92e..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_decrease_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int128s_decrease_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int128s_decrease_by__parameter_checking(void **state) { - - const int length = 5; - f_int128s_t data = f_int128s_t_initialize; - - { - const f_status_t status = f_int128s_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_type_array_int128s_decrease_by__returns_data_not(void **state) { - - const int length = 5; - f_int128s_t data = f_int128s_t_initialize; - - { - const f_status_t status = f_int128s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int128s_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_type_array_int128s_decrease_by__works(void **state) { - - const int length = 5; - f_int128s_t data = f_int128s_t_initialize; - - { - const f_status_t status = f_int128s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int128s_decrease_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_decrease_by.h deleted file mode 100644 index ddd493bdd..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_decrease_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int128s_decrease_by -#define _TEST__F_type_array__int128s_decrease_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int128s_decrease_by() - */ -extern void test__f_type_array_int128s_decrease_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_int128s_decrease_by() - */ -extern void test__f_type_array_int128s_decrease_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_int128s_decrease_by() - */ -extern void test__f_type_array_int128s_decrease_by__works(void **state); - -#endif // _TEST__F_type_array__int128s_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_increase.c deleted file mode 100644 index 9a4e4254e..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_increase.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int128s_increase.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int128s_increase__parameter_checking(void **state) { - - const int length = 5; - f_int128s_t data = f_int128s_t_initialize; - - { - const f_status_t status = f_int128s_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_type_array_int128s_increase__returns_data_not(void **state) { - - const int length = 5; - f_int128s_t data = f_int128s_t_initialize; - - { - const f_status_t status = f_int128s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int128s_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_type_array_int128s_increase__works(void **state) { - - const int length = 5; - f_int128s_t data = f_int128s_t_initialize; - - { - const f_status_t status = f_int128s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_int128s_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_increase.h deleted file mode 100644 index 107c5374c..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_increase.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int128s_increase -#define _TEST__F_type_array__int128s_increase - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int128s_increase() - */ -extern void test__f_type_array_int128s_increase__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_int128s_increase() - */ -extern void test__f_type_array_int128s_increase__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_int128s_increase() - */ -extern void test__f_type_array_int128s_increase__works(void **state); - -#endif // _TEST__F_type_array__int128s_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_increase_by.c deleted file mode 100644 index d74b84d5e..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_increase_by.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int128s_increase_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int128s_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_int128s_t data = f_int128s_t_initialize; - - { - const f_status_t status = f_int128s_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_type_array_int128s_increase_by__returns_data_not(void **state) { - - const int length = 5; - f_int128s_t data = f_int128s_t_initialize; - - { - const f_status_t status = f_int128s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int128s_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_type_array_int128s_increase_by__works(void **state) { - - const int length = 5; - f_int128s_t data = f_int128s_t_initialize; - - { - const f_status_t status = f_int128s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_int128s_increase_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_increase_by.h deleted file mode 100644 index bf702c436..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_increase_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int128s_increase_by -#define _TEST__F_type_array__int128s_increase_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int128s_increase_by() - */ -extern void test__f_type_array_int128s_increase_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_int128s_increase_by() - */ -extern void test__f_type_array_int128s_increase_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_int128s_increase_by() - */ -extern void test__f_type_array_int128s_increase_by__works(void **state); - -#endif // _TEST__F_type_array__int128s_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_resize.c deleted file mode 100644 index 092258de2..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_resize.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int128s_resize.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int128s_resize__parameter_checking(void **state) { - - const int length = 5; - f_int128s_t data = f_int128s_t_initialize; - - { - const f_status_t status = f_int128s_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_type_array_int128s_resize__works(void **state) { - - const int length = 5; - f_int128s_t data = f_int128s_t_initialize; - - { - const f_status_t status = f_int128s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_resize.h deleted file mode 100644 index a04c18e2e..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_resize.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int128s_resize -#define _TEST__F_type_array__int128s_resize - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int128s_resize() - */ -extern void test__f_type_array_int128s_resize__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_int128s_resize() - */ -extern void test__f_type_array_int128s_resize__works(void **state); - -#endif // _TEST__F_type_array__int128s_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_resize_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_resize_callback.c new file mode 100644 index 000000000..12d2f3fe0 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_resize_callback.c @@ -0,0 +1,45 @@ +#include "test-type_array.h" +#include "test-type_array-int128s_resize_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int128s_resize_callback__fails(void **state) { + + f_int128_t data = 0; + f_int128_t data_array[] = { data }; + f_int128s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_int128s_t datass_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_resize, true); + will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_int128s_resize_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_int128s_resize_callback__works(void **state) { + + f_int128_t data = 0; + f_int128_t data_array[] = { data }; + f_int128s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_int128s_t datass_array[] = { datas }; + const f_number_unsigned_t length = 1; + + { + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_none); + + const f_status_t status = f_int128s_resize_callback(0, length, (void *) datass_array); + + assert_int_equal(status, F_none); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_resize_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_resize_callback.h new file mode 100644 index 000000000..7c82197b9 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_resize_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int128s_resize_callback +#define _TEST__F_type_array__int128s_resize_callback + +/** + * Test that the function fails. + * + * @see f_int128s_resize_callback() + */ +extern void test__f_type_array_int128s_resize_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_int128s_resize_callback() + */ +extern void test__f_type_array_int128s_resize_callback__works(void **state); + +#endif // _TEST__F_type_array__int128s_resize_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_adjust.c deleted file mode 100644 index 7ad575ab2..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_adjust.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int128ss_adjust.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int128ss_adjust__parameter_checking(void **state) { - - const int length = 5; - f_int128ss_t data = f_int128ss_t_initialize; - - { - const f_status_t status = f_int128ss_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_type_array_int128ss_adjust__works(void **state) { - - const int length = 5; - f_int128ss_t data = f_int128ss_t_initialize; - - { - const f_status_t status = f_int128ss_adjust(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_adjust.h deleted file mode 100644 index 24154749f..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_adjust.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int128ss_adjust -#define _TEST__F_type_array__int128ss_adjust - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int128ss_adjust() - */ -extern void test__f_type_array_int128ss_adjust__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_int128ss_adjust() - */ -extern void test__f_type_array_int128ss_adjust__works(void **state); - -#endif // _TEST__F_type_array__int128ss_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_append.c deleted file mode 100644 index 3ac172573..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_append.c +++ /dev/null @@ -1,86 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int128ss_append.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int128ss_append__parameter_checking(void **state) { - - f_int128s_t data = f_int128s_t_initialize; - - { - const f_status_t status = f_int128ss_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_int128ss_append__returns_data_not(void **state) { - - const int length = 5; - f_int128s_t source = f_int128s_t_initialize; - f_int128ss_t destination = f_int128ss_t_initialize; - - { - const f_status_t status = f_int128s_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_int128ss_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_type_array_int128ss_append__works(void **state) { - - const int length = 5; - f_int128s_t source = f_int128s_t_initialize; - f_int128ss_t destination = f_int128ss_t_initialize; - - { - const f_status_t status = f_int128s_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - for (; source.used < length; ++source.used) { - source.array[source.used] = source.used + 1; - } // for - - { - const f_status_t status = f_int128ss_append(source, &destination); - - assert_int_equal(status, F_none); - 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], i + 1); - } // 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 diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_append.h deleted file mode 100644 index f9e596002..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_append.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int128ss_append -#define _TEST__F_type_array__int128ss_append - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int128ss_append() - */ -extern void test__f_type_array_int128ss_append__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_int128ss_append() - */ -extern void test__f_type_array_int128ss_append__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_int128ss_append() - */ -extern void test__f_type_array_int128ss_append__works(void **state); - -#endif // _TEST__F_type_array__int128ss_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_append_all.c deleted file mode 100644 index cf6b1529f..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_append_all.c +++ /dev/null @@ -1,105 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int128ss_append_all.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int128ss_append_all__parameter_checking(void **state) { - - const f_int128ss_t data = f_int128ss_t_initialize; - - { - const f_status_t status = f_int128ss_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_int128ss_append_all__returns_data_not(void **state) { - - const int length = 5; - f_int128ss_t source = f_int128ss_t_initialize; - f_int128ss_t destination = f_int128ss_t_initialize; - - { - const f_status_t status = f_int128ss_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_int128ss_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_type_array_int128ss_append_all__works(void **state) { - - const int length = 5; - const int length_inner = 2; - f_int128ss_t source = f_int128ss_t_initialize; - f_int128ss_t destination = f_int128ss_t_initialize; - - { - const f_status_t status = f_int128ss_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - for (; source.used < length; ++source.used) { - - const f_status_t status = f_int128s_resize(length_inner, &source.array[source.used]); - - assert_int_equal(status, F_none); - - for (f_number_unsigned_t i = 0; i < length_inner; ++i) { - source.array[source.used].array[source.array[source.used].used++] = i + 1; - } // for - } // for - } - - { - const f_status_t status = f_int128ss_append_all(source, &destination); - - assert_int_equal(status, F_none); - assert_int_equal(destination.used, source.used); - assert_int_equal(destination.size, source.used); - - for (f_number_unsigned_t i = 0; i < destination.used; ++i) { - - assert_int_equal(destination.array[i].used, length_inner); - assert_int_equal(destination.array[i].size, length_inner); - - for (f_number_unsigned_t j = 0; j < length_inner; ++j) { - assert_int_equal(destination.array[i].array[j], j + 1); - } // 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 diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_append_all.h deleted file mode 100644 index 473f86bd5..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_append_all.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int128ss_append_all -#define _TEST__F_type_array__int128ss_append_all - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int128ss_append_all() - */ -extern void test__f_type_array_int128ss_append_all__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_int128ss_append_all() - */ -extern void test__f_type_array_int128ss_append_all__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_int128ss_append_all() - */ -extern void test__f_type_array_int128ss_append_all__works(void **state); - -#endif // _TEST__F_type_array__int128ss_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_decimate_by.c deleted file mode 100644 index e46fc9e26..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_decimate_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int128ss_decimate_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int128ss_decimate_by__parameter_checking(void **state) { - - const int length = 5; - f_int128ss_t data = f_int128ss_t_initialize; - - { - const f_status_t status = f_int128ss_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_type_array_int128ss_decimate_by__returns_data_not(void **state) { - - const int length = 5; - f_int128ss_t data = f_int128ss_t_initialize; - - { - const f_status_t status = f_int128ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int128ss_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_type_array_int128ss_decimate_by__works(void **state) { - - const int length = 5; - f_int128ss_t data = f_int128ss_t_initialize; - - { - const f_status_t status = f_int128ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int128ss_decimate_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_decimate_by.h deleted file mode 100644 index c3dd04104..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_decimate_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int128ss_decimate_by -#define _TEST__F_type_array__int128ss_decimate_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int128ss_decimate_by() - */ -extern void test__f_type_array_int128ss_decimate_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_type_array_int128ss_decimate_by() - */ -extern void test__f_type_array_int128ss_decimate_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_int128ss_decimate_by() - */ -extern void test__f_type_array_int128ss_decimate_by__works(void **state); - -#endif // _TEST__F_type_array__int128ss_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_decrease_by.c deleted file mode 100644 index 62b909e32..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_decrease_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int128ss_decrease_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int128ss_decrease_by__parameter_checking(void **state) { - - const int length = 5; - f_int128ss_t data = f_int128ss_t_initialize; - - { - const f_status_t status = f_int128ss_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_type_array_int128ss_decrease_by__returns_data_not(void **state) { - - const int length = 5; - f_int128ss_t data = f_int128ss_t_initialize; - - { - const f_status_t status = f_int128ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int128ss_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_type_array_int128ss_decrease_by__works(void **state) { - - const int length = 5; - f_int128ss_t data = f_int128ss_t_initialize; - - { - const f_status_t status = f_int128ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int128ss_decrease_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_decrease_by.h deleted file mode 100644 index d572c6ad7..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_decrease_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int128ss_decrease_by -#define _TEST__F_type_array__int128ss_decrease_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int128ss_decrease_by() - */ -extern void test__f_type_array_int128ss_decrease_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_int128ss_decrease_by() - */ -extern void test__f_type_array_int128ss_decrease_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_int128ss_decrease_by() - */ -extern void test__f_type_array_int128ss_decrease_by__works(void **state); - -#endif // _TEST__F_type_array__int128ss_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_increase.c deleted file mode 100644 index 048b4617f..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_increase.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int128ss_increase.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int128ss_increase__parameter_checking(void **state) { - - const int length = 5; - f_int128ss_t data = f_int128ss_t_initialize; - - { - const f_status_t status = f_int128ss_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_type_array_int128ss_increase__returns_data_not(void **state) { - - const int length = 5; - f_int128ss_t data = f_int128ss_t_initialize; - - { - const f_status_t status = f_int128ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int128ss_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_type_array_int128ss_increase__works(void **state) { - - const int length = 5; - f_int128ss_t data = f_int128ss_t_initialize; - - { - const f_status_t status = f_int128ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_int128ss_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_increase.h deleted file mode 100644 index c3a33334b..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_increase.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int128ss_increase -#define _TEST__F_type_array__int128ss_increase - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int128ss_increase() - */ -extern void test__f_type_array_int128ss_increase__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_int128ss_increase() - */ -extern void test__f_type_array_int128ss_increase__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_int128ss_increase() - */ -extern void test__f_type_array_int128ss_increase__works(void **state); - -#endif // _TEST__F_type_array__int128ss_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_increase_by.c deleted file mode 100644 index f8da9195c..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_increase_by.c +++ /dev/null @@ -1,84 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int128ss_increase_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int128ss_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_int128ss_t data = f_int128ss_t_initialize; - - { - const f_status_t status = f_int128ss_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_type_array_int128ss_increase_by__returns_data_not(void **state) { - - const int length = 5; - f_int128ss_t data = f_int128ss_t_initialize; - - { - const f_status_t status = f_int128ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int128ss_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_int128ss_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_type_array_int128ss_increase_by__works(void **state) { - - const int length = 5; - f_int128ss_t data = f_int128ss_t_initialize; - - { - const f_status_t status = f_int128ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_int128ss_increase_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_increase_by.h deleted file mode 100644 index e4129e149..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_increase_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int128ss_increase_by -#define _TEST__F_type_array__int128ss_increase_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int128ss_increase_by() - */ -extern void test__f_type_array_int128ss_increase_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_int128ss_increase_by() - */ -extern void test__f_type_array_int128ss_increase_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_int128ss_increase_by() - */ -extern void test__f_type_array_int128ss_increase_by__works(void **state); - -#endif // _TEST__F_type_array__int128ss_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_resize.c deleted file mode 100644 index cabbb02cc..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_resize.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int128ss_resize.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int128ss_resize__parameter_checking(void **state) { - - const int length = 5; - f_int128ss_t data = f_int128ss_t_initialize; - - { - const f_status_t status = f_int128ss_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_type_array_int128ss_resize__works(void **state) { - - const int length = 5; - f_int128ss_t data = f_int128ss_t_initialize; - - { - const f_status_t status = f_int128ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_resize.h deleted file mode 100644 index f275d5a5d..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_resize.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int128ss_resize -#define _TEST__F_type_array__int128ss_resize - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int128ss_resize() - */ -extern void test__f_type_array_int128ss_resize__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_int128ss_resize() - */ -extern void test__f_type_array_int128ss_resize__works(void **state); - -#endif // _TEST__F_type_array__int128ss_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_adjust.c deleted file mode 100644 index 3c4f2796e..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_adjust.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int16s_adjust.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int16s_adjust__parameter_checking(void **state) { - - const int length = 5; - f_int16s_t data = f_int16s_t_initialize; - - { - const f_status_t status = f_int16s_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_type_array_int16s_adjust__works(void **state) { - - const int length = 5; - f_int16s_t data = f_int16s_t_initialize; - - { - const f_status_t status = f_int16s_adjust(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_adjust.h deleted file mode 100644 index d0d8b14ef..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_adjust.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int16s_adjust -#define _TEST__F_type_array__int16s_adjust - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int16s_adjust() - */ -extern void test__f_type_array_int16s_adjust__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_int16s_adjust() - */ -extern void test__f_type_array_int16s_adjust__works(void **state); - -#endif // _TEST__F_type_array__int16s_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_adjust_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_adjust_callback.c new file mode 100644 index 000000000..f881270d6 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_adjust_callback.c @@ -0,0 +1,45 @@ +#include "test-type_array.h" +#include "test-type_array-int16s_adjust_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int16s_adjust_callback__fails(void **state) { + + int16_t data = 0; + int16_t data_array[] = { data }; + f_int16s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_int16s_t datass_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_adjust, true); + will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_int16s_adjust_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_int16s_adjust_callback__works(void **state) { + + int16_t data = 0; + int16_t data_array[] = { data }; + f_int16s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_int16s_t datass_array[] = { datas }; + const f_number_unsigned_t length = 1; + + { + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_none); + + const f_status_t status = f_int16s_adjust_callback(0, length, (void *) datass_array); + + assert_int_equal(status, F_none); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_adjust_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_adjust_callback.h new file mode 100644 index 000000000..6cb44f19f --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_adjust_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int16s_adjust_callback +#define _TEST__F_type_array__int16s_adjust_callback + +/** + * Test that the function fails. + * + * @see f_int16s_adjust_callback() + */ +extern void test__f_type_array_int16s_adjust_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_int16s_adjust_callback() + */ +extern void test__f_type_array_int16s_adjust_callback__works(void **state); + +#endif // _TEST__F_type_array__int16s_adjust_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_append.c deleted file mode 100644 index 205719672..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_append.c +++ /dev/null @@ -1,37 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int16s_append.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int16s_append__parameter_checking(void **state) { - - const int16_t data = 0; - - { - const f_status_t status = f_int16s_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_int16s_append__works(void **state) { - - const int16_t source = 3; - f_int16s_t destination = f_int16s_t_initialize; - - { - const f_status_t status = f_int16s_append(source, &destination); - - assert_int_equal(status, F_none); - assert_int_equal(destination.used, 1); - assert_int_equal(destination.array[0], source); - } - - free((void *) destination.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_append.h deleted file mode 100644 index f472be0fc..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_append.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int16s_append -#define _TEST__F_type_array__int16s_append - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int16s_append() - */ -extern void test__f_type_array_int16s_append__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_int16s_append() - */ -extern void test__f_type_array_int16s_append__works(void **state); - -#endif // _TEST__F_type_array__int16s_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_append_all.c deleted file mode 100644 index a6a82b8e4..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_append_all.c +++ /dev/null @@ -1,82 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int16s_append_all.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int16s_append_all__parameter_checking(void **state) { - - const f_int16s_t data = f_int16s_t_initialize; - - { - const f_status_t status = f_int16s_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_int16s_append_all__returns_data_not(void **state) { - - const int length = 5; - f_int16s_t source = f_int16s_t_initialize; - f_int16s_t destination = f_int16s_t_initialize; - - { - const f_status_t status = f_int16s_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_int16s_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_type_array_int16s_append_all__works(void **state) { - - const int length = 5; - const int length_used = 2; - f_int16s_t source = f_int16s_t_initialize; - f_int16s_t destination = f_int16s_t_initialize; - - { - const f_status_t status = f_int16s_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - for (; source.used < length_used; ++source.used) { - source.array[source.used] = source.used + 1; - } // for - - { - const f_status_t status = f_int16s_append_all(source, &destination); - - assert_int_equal(status, F_none); - assert_int_equal(destination.used, source.used); - assert_int_equal(destination.size, source.used); - - for (f_number_unsigned_t i = 0; i < source.used; ++i) { - assert_int_equal(destination.array[i], i + 1); - } // for - } - - free((void *) source.array); - free((void *) destination.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_append_all.h deleted file mode 100644 index ac188271e..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_append_all.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int16s_append_all -#define _TEST__F_type_array__int16s_append_all - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int16s_append_all() - */ -extern void test__f_type_array_int16s_append_all__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_int16s_append_all() - */ -extern void test__f_type_array_int16s_append_all__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_int16s_append_all() - */ -extern void test__f_type_array_int16s_append_all__works(void **state); - -#endif // _TEST__F_type_array__int16s_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_decimate_by.c deleted file mode 100644 index a8f4dd183..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_decimate_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int16s_decimate_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int16s_decimate_by__parameter_checking(void **state) { - - const int length = 5; - f_int16s_t data = f_int16s_t_initialize; - - { - const f_status_t status = f_int16s_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_type_array_int16s_decimate_by__returns_data_not(void **state) { - - const int length = 5; - f_int16s_t data = f_int16s_t_initialize; - - { - const f_status_t status = f_int16s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int16s_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_type_array_int16s_decimate_by__works(void **state) { - - const int length = 5; - f_int16s_t data = f_int16s_t_initialize; - - { - const f_status_t status = f_int16s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int16s_decimate_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_decimate_by.h deleted file mode 100644 index fd8844163..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_decimate_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int16s_decimate_by -#define _TEST__F_type_array__int16s_decimate_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int16s_decimate_by() - */ -extern void test__f_type_array_int16s_decimate_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_int16s_decimate_by() - */ -extern void test__f_type_array_int16s_decimate_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_int16s_decimate_by() - */ -extern void test__f_type_array_int16s_decimate_by__works(void **state); - -#endif // _TEST__F_type_array__int16s_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_decrease_by.c deleted file mode 100644 index a25efbd81..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_decrease_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int16s_decrease_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int16s_decrease_by__parameter_checking(void **state) { - - const int length = 5; - f_int16s_t data = f_int16s_t_initialize; - - { - const f_status_t status = f_int16s_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_type_array_int16s_decrease_by__returns_data_not(void **state) { - - const int length = 5; - f_int16s_t data = f_int16s_t_initialize; - - { - const f_status_t status = f_int16s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int16s_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_type_array_int16s_decrease_by__works(void **state) { - - const int length = 5; - f_int16s_t data = f_int16s_t_initialize; - - { - const f_status_t status = f_int16s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int16s_decrease_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_decrease_by.h deleted file mode 100644 index 63db78229..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_decrease_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int16s_decrease_by -#define _TEST__F_type_array__int16s_decrease_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int16s_decrease_by() - */ -extern void test__f_type_array_int16s_decrease_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_int16s_decrease_by() - */ -extern void test__f_type_array_int16s_decrease_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_int16s_decrease_by() - */ -extern void test__f_type_array_int16s_decrease_by__works(void **state); - -#endif // _TEST__F_type_array__int16s_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_increase.c deleted file mode 100644 index a10f86865..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_increase.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int16s_increase.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int16s_increase__parameter_checking(void **state) { - - const int length = 5; - f_int16s_t data = f_int16s_t_initialize; - - { - const f_status_t status = f_int16s_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_type_array_int16s_increase__returns_data_not(void **state) { - - const int length = 5; - f_int16s_t data = f_int16s_t_initialize; - - { - const f_status_t status = f_int16s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int16s_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_type_array_int16s_increase__works(void **state) { - - const int length = 5; - f_int16s_t data = f_int16s_t_initialize; - - { - const f_status_t status = f_int16s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_int16s_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_increase.h deleted file mode 100644 index e60a74dc6..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_increase.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int16s_increase -#define _TEST__F_type_array__int16s_increase - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int16s_increase() - */ -extern void test__f_type_array_int16s_increase__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_int16s_increase() - */ -extern void test__f_type_array_int16s_increase__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_int16s_increase() - */ -extern void test__f_type_array_int16s_increase__works(void **state); - -#endif // _TEST__F_type_array__int16s_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_increase_by.c deleted file mode 100644 index e1d7d72ec..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_increase_by.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int16s_increase_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int16s_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_int16s_t data = f_int16s_t_initialize; - - { - const f_status_t status = f_int16s_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_type_array_int16s_increase_by__returns_data_not(void **state) { - - const int length = 5; - f_int16s_t data = f_int16s_t_initialize; - - { - const f_status_t status = f_int16s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int16s_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_type_array_int16s_increase_by__works(void **state) { - - const int length = 5; - f_int16s_t data = f_int16s_t_initialize; - - { - const f_status_t status = f_int16s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_int16s_increase_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_increase_by.h deleted file mode 100644 index fc4c5567a..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_increase_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int16s_increase_by -#define _TEST__F_type_array__int16s_increase_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int16s_increase_by() - */ -extern void test__f_type_array_int16s_increase_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_int16s_increase_by() - */ -extern void test__f_type_array_int16s_increase_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_int16s_increase_by() - */ -extern void test__f_type_array_int16s_increase_by__works(void **state); - -#endif // _TEST__F_type_array__int16s_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_resize.c deleted file mode 100644 index 9b5c14b98..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_resize.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int16s_resize.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int16s_resize__parameter_checking(void **state) { - - const int length = 5; - f_int16s_t data = f_int16s_t_initialize; - - { - const f_status_t status = f_int16s_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_type_array_int16s_resize__works(void **state) { - - const int length = 5; - f_int16s_t data = f_int16s_t_initialize; - - { - const f_status_t status = f_int16s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_resize.h deleted file mode 100644 index 324a8d0f1..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_resize.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int16s_resize -#define _TEST__F_type_array__int16s_resize - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int16s_resize() - */ -extern void test__f_type_array_int16s_resize__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_int16s_resize() - */ -extern void test__f_type_array_int16s_resize__works(void **state); - -#endif // _TEST__F_type_array__int16s_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_resize_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_resize_callback.c new file mode 100644 index 000000000..691fa64d4 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_resize_callback.c @@ -0,0 +1,45 @@ +#include "test-type_array.h" +#include "test-type_array-int16s_resize_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int16s_resize_callback__fails(void **state) { + + int16_t data = 0; + int16_t data_array[] = { data }; + f_int16s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_int16s_t datass_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_resize, true); + will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_int16s_resize_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_int16s_resize_callback__works(void **state) { + + int16_t data = 0; + int16_t data_array[] = { data }; + f_int16s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_int16s_t datass_array[] = { datas }; + const f_number_unsigned_t length = 1; + + { + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_none); + + const f_status_t status = f_int16s_resize_callback(0, length, (void *) datass_array); + + assert_int_equal(status, F_none); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_resize_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_resize_callback.h new file mode 100644 index 000000000..680e5cdd0 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_resize_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int16s_resize_callback +#define _TEST__F_type_array__int16s_resize_callback + +/** + * Test that the function fails. + * + * @see f_int16s_resize_callback() + */ +extern void test__f_type_array_int16s_resize_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_int16s_resize_callback() + */ +extern void test__f_type_array_int16s_resize_callback__works(void **state); + +#endif // _TEST__F_type_array__int16s_resize_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_adjust.c deleted file mode 100644 index 336011bf6..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_adjust.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int16ss_adjust.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int16ss_adjust__parameter_checking(void **state) { - - const int length = 5; - f_int16ss_t data = f_int16ss_t_initialize; - - { - const f_status_t status = f_int16ss_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_type_array_int16ss_adjust__works(void **state) { - - const int length = 5; - f_int16ss_t data = f_int16ss_t_initialize; - - { - const f_status_t status = f_int16ss_adjust(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_adjust.h deleted file mode 100644 index b239ec389..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_adjust.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int16ss_adjust -#define _TEST__F_type_array__int16ss_adjust - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int16ss_adjust() - */ -extern void test__f_type_array_int16ss_adjust__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_int16ss_adjust() - */ -extern void test__f_type_array_int16ss_adjust__works(void **state); - -#endif // _TEST__F_type_array__int16ss_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_append.c deleted file mode 100644 index 80cb2bcf3..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_append.c +++ /dev/null @@ -1,86 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int16ss_append.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int16ss_append__parameter_checking(void **state) { - - f_int16s_t data = f_int16s_t_initialize; - - { - const f_status_t status = f_int16ss_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_int16ss_append__returns_data_not(void **state) { - - const int length = 5; - f_int16s_t source = f_int16s_t_initialize; - f_int16ss_t destination = f_int16ss_t_initialize; - - { - const f_status_t status = f_int16s_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_int16ss_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_type_array_int16ss_append__works(void **state) { - - const int length = 5; - f_int16s_t source = f_int16s_t_initialize; - f_int16ss_t destination = f_int16ss_t_initialize; - - { - const f_status_t status = f_int16s_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - for (; source.used < length; ++source.used) { - source.array[source.used] = source.used + 1; - } // for - - { - const f_status_t status = f_int16ss_append(source, &destination); - - assert_int_equal(status, F_none); - 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], i + 1); - } // 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 diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_append.h deleted file mode 100644 index 987ffc8cd..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_append.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int16ss_append -#define _TEST__F_type_array__int16ss_append - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int16ss_append() - */ -extern void test__f_type_array_int16ss_append__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_int16ss_append() - */ -extern void test__f_type_array_int16ss_append__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_int16ss_append() - */ -extern void test__f_type_array_int16ss_append__works(void **state); - -#endif // _TEST__F_type_array__int16ss_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_append_all.c deleted file mode 100644 index 8a2c0fc28..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_append_all.c +++ /dev/null @@ -1,105 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int16ss_append_all.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int16ss_append_all__parameter_checking(void **state) { - - const f_int16ss_t data = f_int16ss_t_initialize; - - { - const f_status_t status = f_int16ss_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_int16ss_append_all__returns_data_not(void **state) { - - const int length = 5; - f_int16ss_t source = f_int16ss_t_initialize; - f_int16ss_t destination = f_int16ss_t_initialize; - - { - const f_status_t status = f_int16ss_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_int16ss_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_type_array_int16ss_append_all__works(void **state) { - - const int length = 5; - const int length_inner = 2; - f_int16ss_t source = f_int16ss_t_initialize; - f_int16ss_t destination = f_int16ss_t_initialize; - - { - const f_status_t status = f_int16ss_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - for (; source.used < length; ++source.used) { - - const f_status_t status = f_int16s_resize(length_inner, &source.array[source.used]); - - assert_int_equal(status, F_none); - - for (f_number_unsigned_t i = 0; i < length_inner; ++i) { - source.array[source.used].array[source.array[source.used].used++] = i + 1; - } // for - } // for - } - - { - const f_status_t status = f_int16ss_append_all(source, &destination); - - assert_int_equal(status, F_none); - assert_int_equal(destination.used, source.used); - assert_int_equal(destination.size, source.used); - - for (f_number_unsigned_t i = 0; i < destination.used; ++i) { - - assert_int_equal(destination.array[i].used, length_inner); - assert_int_equal(destination.array[i].size, length_inner); - - for (f_number_unsigned_t j = 0; j < length_inner; ++j) { - assert_int_equal(destination.array[i].array[j], j + 1); - } // 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 diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_append_all.h deleted file mode 100644 index 29601683b..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_append_all.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int16ss_append_all -#define _TEST__F_type_array__int16ss_append_all - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int16ss_append_all() - */ -extern void test__f_type_array_int16ss_append_all__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_int16ss_append_all() - */ -extern void test__f_type_array_int16ss_append_all__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_int16ss_append_all() - */ -extern void test__f_type_array_int16ss_append_all__works(void **state); - -#endif // _TEST__F_type_array__int16ss_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_decimate_by.c deleted file mode 100644 index 94f8c5200..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_decimate_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int16ss_decimate_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int16ss_decimate_by__parameter_checking(void **state) { - - const int length = 5; - f_int16ss_t data = f_int16ss_t_initialize; - - { - const f_status_t status = f_int16ss_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_type_array_int16ss_decimate_by__returns_data_not(void **state) { - - const int length = 5; - f_int16ss_t data = f_int16ss_t_initialize; - - { - const f_status_t status = f_int16ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int16ss_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_type_array_int16ss_decimate_by__works(void **state) { - - const int length = 5; - f_int16ss_t data = f_int16ss_t_initialize; - - { - const f_status_t status = f_int16ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int16ss_decimate_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_decimate_by.h deleted file mode 100644 index e0f323ccf..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_decimate_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int16ss_decimate_by -#define _TEST__F_type_array__int16ss_decimate_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int16ss_decimate_by() - */ -extern void test__f_type_array_int16ss_decimate_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_type_array_int16ss_decimate_by() - */ -extern void test__f_type_array_int16ss_decimate_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_int16ss_decimate_by() - */ -extern void test__f_type_array_int16ss_decimate_by__works(void **state); - -#endif // _TEST__F_type_array__int16ss_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_decrease_by.c deleted file mode 100644 index e733e00ac..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_decrease_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int16ss_decrease_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int16ss_decrease_by__parameter_checking(void **state) { - - const int length = 5; - f_int16ss_t data = f_int16ss_t_initialize; - - { - const f_status_t status = f_int16ss_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_type_array_int16ss_decrease_by__returns_data_not(void **state) { - - const int length = 5; - f_int16ss_t data = f_int16ss_t_initialize; - - { - const f_status_t status = f_int16ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int16ss_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_type_array_int16ss_decrease_by__works(void **state) { - - const int length = 5; - f_int16ss_t data = f_int16ss_t_initialize; - - { - const f_status_t status = f_int16ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int16ss_decrease_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_decrease_by.h deleted file mode 100644 index 6a8945a82..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_decrease_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int16ss_decrease_by -#define _TEST__F_type_array__int16ss_decrease_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int16ss_decrease_by() - */ -extern void test__f_type_array_int16ss_decrease_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_int16ss_decrease_by() - */ -extern void test__f_type_array_int16ss_decrease_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_int16ss_decrease_by() - */ -extern void test__f_type_array_int16ss_decrease_by__works(void **state); - -#endif // _TEST__F_type_array__int16ss_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_increase.c deleted file mode 100644 index a9b2ea96f..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_increase.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int16ss_increase.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int16ss_increase__parameter_checking(void **state) { - - const int length = 5; - f_int16ss_t data = f_int16s_t_initialize; - - { - const f_status_t status = f_int16ss_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_type_array_int16ss_increase__returns_data_not(void **state) { - - const int length = 5; - f_int16ss_t data = f_int16ss_t_initialize; - - { - const f_status_t status = f_int16ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int16ss_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_type_array_int16ss_increase__works(void **state) { - - const int length = 5; - f_int16ss_t data = f_int16ss_t_initialize; - - { - const f_status_t status = f_int16ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_int16ss_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_increase.h deleted file mode 100644 index 23e6b85c8..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_increase.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int16ss_increase -#define _TEST__F_type_array__int16ss_increase - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int16ss_increase() - */ -extern void test__f_type_array_int16ss_increase__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_int16ss_increase() - */ -extern void test__f_type_array_int16ss_increase__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_int16ss_increase() - */ -extern void test__f_type_array_int16ss_increase__works(void **state); - -#endif // _TEST__F_type_array__int16ss_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_increase_by.c deleted file mode 100644 index 91cd889ab..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_increase_by.c +++ /dev/null @@ -1,84 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int16ss_increase_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int16ss_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_int16ss_t data = f_int16ss_t_initialize; - - { - const f_status_t status = f_int16ss_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_type_array_int16ss_increase_by__returns_data_not(void **state) { - - const int length = 5; - f_int16ss_t data = f_int16ss_t_initialize; - - { - const f_status_t status = f_int16ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int16ss_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_int16ss_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_type_array_int16ss_increase_by__works(void **state) { - - const int length = 5; - f_int16ss_t data = f_int16ss_t_initialize; - - { - const f_status_t status = f_int16ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_int16ss_increase_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_increase_by.h deleted file mode 100644 index 5ed54ef3e..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_increase_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int16ss_increase_by -#define _TEST__F_type_array__int16ss_increase_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int16ss_increase_by() - */ -extern void test__f_type_array_int16ss_increase_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_int16ss_increase_by() - */ -extern void test__f_type_array_int16ss_increase_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_int16ss_increase_by() - */ -extern void test__f_type_array_int16ss_increase_by__works(void **state); - -#endif // _TEST__F_type_array__int16ss_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_resize.c deleted file mode 100644 index c5ce86526..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_resize.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int16ss_resize.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int16ss_resize__parameter_checking(void **state) { - - const int length = 5; - f_int16ss_t data = f_int16ss_t_initialize; - - { - const f_status_t status = f_int16ss_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_type_array_int16ss_resize__works(void **state) { - - const int length = 5; - f_int16ss_t data = f_int16ss_t_initialize; - - { - const f_status_t status = f_int16ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_resize.h deleted file mode 100644 index 2521942ad..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_resize.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int16ss_resize -#define _TEST__F_type_array__int16ss_resize - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int16ss_resize() - */ -extern void test__f_type_array_int16ss_resize__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_int16ss_resize() - */ -extern void test__f_type_array_int16ss_resize__works(void **state); - -#endif // _TEST__F_type_array__int16ss_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_adjust.c deleted file mode 100644 index 7f0012e14..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_adjust.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int32s_adjust.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int32s_adjust__parameter_checking(void **state) { - - const int length = 5; - f_int32s_t data = f_int32s_t_initialize; - - { - const f_status_t status = f_int32s_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_type_array_int32s_adjust__works(void **state) { - - const int length = 5; - f_int32s_t data = f_int32s_t_initialize; - - { - const f_status_t status = f_int32s_adjust(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_adjust.h deleted file mode 100644 index 8351ffecd..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_adjust.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int32s_adjust -#define _TEST__F_type_array__int32s_adjust - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int32s_adjust() - */ -extern void test__f_type_array_int32s_adjust__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_int32s_adjust() - */ -extern void test__f_type_array_int32s_adjust__works(void **state); - -#endif // _TEST__F_type_array__int32s_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_adjust_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_adjust_callback.c new file mode 100644 index 000000000..884fcb4f4 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_adjust_callback.c @@ -0,0 +1,45 @@ +#include "test-type_array.h" +#include "test-type_array-int32s_adjust_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int32s_adjust_callback__fails(void **state) { + + int32_t data = 0; + int32_t data_array[] = { data }; + f_int32s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_int32s_t datass_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_adjust, true); + will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_int32s_adjust_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_int32s_adjust_callback__works(void **state) { + + int32_t data = 0; + int32_t data_array[] = { data }; + f_int32s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_int32s_t datass_array[] = { datas }; + const f_number_unsigned_t length = 1; + + { + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_none); + + const f_status_t status = f_int32s_adjust_callback(0, length, (void *) datass_array); + + assert_int_equal(status, F_none); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_adjust_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_adjust_callback.h new file mode 100644 index 000000000..c8650571a --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_adjust_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int32s_adjust_callback +#define _TEST__F_type_array__int32s_adjust_callback + +/** + * Test that the function fails. + * + * @see f_int32s_adjust_callback() + */ +extern void test__f_type_array_int32s_adjust_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_int32s_adjust_callback() + */ +extern void test__f_type_array_int32s_adjust_callback__works(void **state); + +#endif // _TEST__F_type_array__int32s_adjust_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_append.c deleted file mode 100644 index 9cd73cfd1..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_append.c +++ /dev/null @@ -1,37 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int32s_append.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int32s_append__parameter_checking(void **state) { - - const int32_t data = 0; - - { - const f_status_t status = f_int32s_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_int32s_append__works(void **state) { - - const int32_t source = 3; - f_int32s_t destination = f_int32s_t_initialize; - - { - const f_status_t status = f_int32s_append(source, &destination); - - assert_int_equal(status, F_none); - assert_int_equal(destination.used, 1); - assert_int_equal(destination.array[0], source); - } - - free((void *) destination.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_append.h deleted file mode 100644 index 6505b2832..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_append.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int32s_append -#define _TEST__F_type_array__int32s_append - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int32s_append() - */ -extern void test__f_type_array_int32s_append__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_int32s_append() - */ -extern void test__f_type_array_int32s_append__works(void **state); - -#endif // _TEST__F_type_array__int32s_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_append_all.c deleted file mode 100644 index 4ce3d3430..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_append_all.c +++ /dev/null @@ -1,82 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int32s_append_all.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int32s_append_all__parameter_checking(void **state) { - - const f_int32s_t data = f_int32s_t_initialize; - - { - const f_status_t status = f_int32s_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_int32s_append_all__returns_data_not(void **state) { - - const int length = 5; - f_int32s_t source = f_int32s_t_initialize; - f_int32s_t destination = f_int32s_t_initialize; - - { - const f_status_t status = f_int32s_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_int32s_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_type_array_int32s_append_all__works(void **state) { - - const int length = 5; - const int length_used = 2; - f_int32s_t source = f_int32s_t_initialize; - f_int32s_t destination = f_int32s_t_initialize; - - { - const f_status_t status = f_int32s_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - for (; source.used < length_used; ++source.used) { - source.array[source.used] = source.used + 1; - } // for - - { - const f_status_t status = f_int32s_append_all(source, &destination); - - assert_int_equal(status, F_none); - assert_int_equal(destination.used, source.used); - assert_int_equal(destination.size, source.used); - - for (f_number_unsigned_t i = 0; i < source.used; ++i) { - assert_int_equal(destination.array[i], i + 1); - } // for - } - - free((void *) source.array); - free((void *) destination.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_append_all.h deleted file mode 100644 index b48a4500f..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_append_all.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int32s_append_all -#define _TEST__F_type_array__int32s_append_all - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int32s_append_all() - */ -extern void test__f_type_array_int32s_append_all__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_int32s_append_all() - */ -extern void test__f_type_array_int32s_append_all__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_int32s_append_all() - */ -extern void test__f_type_array_int32s_append_all__works(void **state); - -#endif // _TEST__F_type_array__int32s_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_decimate_by.c deleted file mode 100644 index 7b6c32694..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_decimate_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int32s_decimate_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int32s_decimate_by__parameter_checking(void **state) { - - const int length = 5; - f_int32s_t data = f_int32s_t_initialize; - - { - const f_status_t status = f_int32s_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_type_array_int32s_decimate_by__returns_data_not(void **state) { - - const int length = 5; - f_int32s_t data = f_int32s_t_initialize; - - { - const f_status_t status = f_int32s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int32s_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_type_array_int32s_decimate_by__works(void **state) { - - const int length = 5; - f_int32s_t data = f_int32s_t_initialize; - - { - const f_status_t status = f_int32s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int32s_decimate_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_decimate_by.h deleted file mode 100644 index f0989fc1e..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_decimate_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int32s_decimate_by -#define _TEST__F_type_array__int32s_decimate_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int32s_decimate_by() - */ -extern void test__f_type_array_int32s_decimate_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_int32s_decimate_by() - */ -extern void test__f_type_array_int32s_decimate_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_int32s_decimate_by() - */ -extern void test__f_type_array_int32s_decimate_by__works(void **state); - -#endif // _TEST__F_type_array__int32s_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_decrease_by.c deleted file mode 100644 index 3bfb171b2..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_decrease_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int32s_decrease_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int32s_decrease_by__parameter_checking(void **state) { - - const int length = 5; - f_int32s_t data = f_int32s_t_initialize; - - { - const f_status_t status = f_int32s_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_type_array_int32s_decrease_by__returns_data_not(void **state) { - - const int length = 5; - f_int32s_t data = f_int32s_t_initialize; - - { - const f_status_t status = f_int32s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int32s_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_type_array_int32s_decrease_by__works(void **state) { - - const int length = 5; - f_int32s_t data = f_int32s_t_initialize; - - { - const f_status_t status = f_int32s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int32s_decrease_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_decrease_by.h deleted file mode 100644 index d09729f77..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_decrease_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int32s_decrease_by -#define _TEST__F_type_array__int32s_decrease_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int32s_decrease_by() - */ -extern void test__f_type_array_int32s_decrease_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_int32s_decrease_by() - */ -extern void test__f_type_array_int32s_decrease_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_int32s_decrease_by() - */ -extern void test__f_type_array_int32s_decrease_by__works(void **state); - -#endif // _TEST__F_type_array__int32s_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_increase.c deleted file mode 100644 index a21f42bfc..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_increase.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int32s_increase.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int32s_increase__parameter_checking(void **state) { - - const int length = 5; - f_int32s_t data = f_int32s_t_initialize; - - { - const f_status_t status = f_int32s_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_type_array_int32s_increase__returns_data_not(void **state) { - - const int length = 5; - f_int32s_t data = f_int32s_t_initialize; - - { - const f_status_t status = f_int32s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int32s_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_type_array_int32s_increase__works(void **state) { - - const int length = 5; - f_int32s_t data = f_int32s_t_initialize; - - { - const f_status_t status = f_int32s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_int32s_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_increase.h deleted file mode 100644 index 9f3312ec7..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_increase.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int32s_increase -#define _TEST__F_type_array__int32s_increase - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int32s_increase() - */ -extern void test__f_type_array_int32s_increase__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_int32s_increase() - */ -extern void test__f_type_array_int32s_increase__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_int32s_increase() - */ -extern void test__f_type_array_int32s_increase__works(void **state); - -#endif // _TEST__F_type_array__int32s_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_increase_by.c deleted file mode 100644 index f7ee04a1c..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_increase_by.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int32s_increase_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int32s_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_int32s_t data = f_int32s_t_initialize; - - { - const f_status_t status = f_int32s_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_type_array_int32s_increase_by__returns_data_not(void **state) { - - const int length = 5; - f_int32s_t data = f_int32s_t_initialize; - - { - const f_status_t status = f_int32s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int32s_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_type_array_int32s_increase_by__works(void **state) { - - const int length = 5; - f_int32s_t data = f_int32s_t_initialize; - - { - const f_status_t status = f_int32s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_int32s_increase_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_increase_by.h deleted file mode 100644 index 3469ed8ce..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_increase_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int32s_increase_by -#define _TEST__F_type_array__int32s_increase_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int32s_increase_by() - */ -extern void test__f_type_array_int32s_increase_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_int32s_increase_by() - */ -extern void test__f_type_array_int32s_increase_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_int32s_increase_by() - */ -extern void test__f_type_array_int32s_increase_by__works(void **state); - -#endif // _TEST__F_type_array__int32s_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_resize.c deleted file mode 100644 index eca19f6e3..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_resize.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int32s_resize.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int32s_resize__parameter_checking(void **state) { - - const int length = 5; - f_int32s_t data = f_int32s_t_initialize; - - { - const f_status_t status = f_int32s_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_type_array_int32s_resize__works(void **state) { - - const int length = 5; - f_int32s_t data = f_int32s_t_initialize; - - { - const f_status_t status = f_int32s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_resize.h deleted file mode 100644 index 153e7dd7c..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_resize.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int32s_resize -#define _TEST__F_type_array__int32s_resize - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int32s_resize() - */ -extern void test__f_type_array_int32s_resize__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_int32s_resize() - */ -extern void test__f_type_array_int32s_resize__works(void **state); - -#endif // _TEST__F_type_array__int32s_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_resize_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_resize_callback.c new file mode 100644 index 000000000..914ffddb5 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_resize_callback.c @@ -0,0 +1,45 @@ +#include "test-type_array.h" +#include "test-type_array-int32s_resize_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int32s_resize_callback__fails(void **state) { + + int32_t data = 0; + int32_t data_array[] = { data }; + f_int32s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_int32s_t datass_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_resize, true); + will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_int32s_resize_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_int32s_resize_callback__works(void **state) { + + int32_t data = 0; + int32_t data_array[] = { data }; + f_int32s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_int32s_t datass_array[] = { datas }; + const f_number_unsigned_t length = 1; + + { + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_none); + + const f_status_t status = f_int32s_resize_callback(0, length, (void *) datass_array); + + assert_int_equal(status, F_none); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_resize_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_resize_callback.h new file mode 100644 index 000000000..bc3d95b3f --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_resize_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int32s_resize_callback +#define _TEST__F_type_array__int32s_resize_callback + +/** + * Test that the function fails. + * + * @see f_int32s_resize_callback() + */ +extern void test__f_type_array_int32s_resize_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_int32s_resize_callback() + */ +extern void test__f_type_array_int32s_resize_callback__works(void **state); + +#endif // _TEST__F_type_array__int32s_resize_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_adjust.c deleted file mode 100644 index 33de3919f..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_adjust.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int32ss_adjust.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int32ss_adjust__parameter_checking(void **state) { - - const int length = 5; - f_int32ss_t data = f_int32ss_t_initialize; - - { - const f_status_t status = f_int32ss_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_type_array_int32ss_adjust__works(void **state) { - - const int length = 5; - f_int32ss_t data = f_int32ss_t_initialize; - - { - const f_status_t status = f_int32ss_adjust(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_adjust.h deleted file mode 100644 index b888f9a38..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_adjust.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int32ss_adjust -#define _TEST__F_type_array__int32ss_adjust - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int32ss_adjust() - */ -extern void test__f_type_array_int32ss_adjust__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_int32ss_adjust() - */ -extern void test__f_type_array_int32ss_adjust__works(void **state); - -#endif // _TEST__F_type_array__int32ss_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_append.c deleted file mode 100644 index 777047a40..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_append.c +++ /dev/null @@ -1,86 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int32ss_append.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int32ss_append__parameter_checking(void **state) { - - f_int32s_t data = f_int32s_t_initialize; - - { - const f_status_t status = f_int32ss_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_int32ss_append__returns_data_not(void **state) { - - const int length = 5; - f_int32s_t source = f_int32s_t_initialize; - f_int32ss_t destination = f_int32ss_t_initialize; - - { - const f_status_t status = f_int32s_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_int32ss_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_type_array_int32ss_append__works(void **state) { - - const int length = 5; - f_int32s_t source = f_int32s_t_initialize; - f_int32ss_t destination = f_int32ss_t_initialize; - - { - const f_status_t status = f_int32s_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - for (; source.used < length; ++source.used) { - source.array[source.used] = source.used + 1; - } // for - - { - const f_status_t status = f_int32ss_append(source, &destination); - - assert_int_equal(status, F_none); - 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], i + 1); - } // 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 diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_append.h deleted file mode 100644 index df0537874..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_append.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int32ss_append -#define _TEST__F_type_array__int32ss_append - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int32ss_append() - */ -extern void test__f_type_array_int32ss_append__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_int32ss_append() - */ -extern void test__f_type_array_int32ss_append__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_int32ss_append() - */ -extern void test__f_type_array_int32ss_append__works(void **state); - -#endif // _TEST__F_type_array__int32ss_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_append_all.c deleted file mode 100644 index b2d364fbe..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_append_all.c +++ /dev/null @@ -1,105 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int32ss_append_all.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int32ss_append_all__parameter_checking(void **state) { - - const f_int32ss_t data = f_int32ss_t_initialize; - - { - const f_status_t status = f_int32ss_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_int32ss_append_all__returns_data_not(void **state) { - - const int length = 5; - f_int32ss_t source = f_int32ss_t_initialize; - f_int32ss_t destination = f_int32ss_t_initialize; - - { - const f_status_t status = f_int32ss_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_int32ss_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_type_array_int32ss_append_all__works(void **state) { - - const int length = 5; - const int length_inner = 2; - f_int32ss_t source = f_int32ss_t_initialize; - f_int32ss_t destination = f_int32ss_t_initialize; - - { - const f_status_t status = f_int32ss_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - for (; source.used < length; ++source.used) { - - const f_status_t status = f_int32s_resize(length_inner, &source.array[source.used]); - - assert_int_equal(status, F_none); - - for (f_number_unsigned_t i = 0; i < length_inner; ++i) { - source.array[source.used].array[source.array[source.used].used++] = i + 1; - } // for - } // for - } - - { - const f_status_t status = f_int32ss_append_all(source, &destination); - - assert_int_equal(status, F_none); - assert_int_equal(destination.used, source.used); - assert_int_equal(destination.size, source.used); - - for (f_number_unsigned_t i = 0; i < destination.used; ++i) { - - assert_int_equal(destination.array[i].used, length_inner); - assert_int_equal(destination.array[i].size, length_inner); - - for (f_number_unsigned_t j = 0; j < length_inner; ++j) { - assert_int_equal(destination.array[i].array[j], j + 1); - } // 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 diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_append_all.h deleted file mode 100644 index 18f81e3fa..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_append_all.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int32ss_append_all -#define _TEST__F_type_array__int32ss_append_all - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int32ss_append_all() - */ -extern void test__f_type_array_int32ss_append_all__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_int32ss_append_all() - */ -extern void test__f_type_array_int32ss_append_all__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_int32ss_append_all() - */ -extern void test__f_type_array_int32ss_append_all__works(void **state); - -#endif // _TEST__F_type_array__int32ss_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_decimate_by.c deleted file mode 100644 index 2b16cc73f..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_decimate_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int32ss_decimate_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int32ss_decimate_by__parameter_checking(void **state) { - - const int length = 5; - f_int32ss_t data = f_int32ss_t_initialize; - - { - const f_status_t status = f_int32ss_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_type_array_int32ss_decimate_by__returns_data_not(void **state) { - - const int length = 5; - f_int32ss_t data = f_int32ss_t_initialize; - - { - const f_status_t status = f_int32ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int32ss_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_type_array_int32ss_decimate_by__works(void **state) { - - const int length = 5; - f_int32ss_t data = f_int32ss_t_initialize; - - { - const f_status_t status = f_int32ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int32ss_decimate_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_decimate_by.h deleted file mode 100644 index 65fa0eba2..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_decimate_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int32ss_decimate_by -#define _TEST__F_type_array__int32ss_decimate_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int32ss_decimate_by() - */ -extern void test__f_type_array_int32ss_decimate_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_type_array_int32ss_decimate_by() - */ -extern void test__f_type_array_int32ss_decimate_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_int32ss_decimate_by() - */ -extern void test__f_type_array_int32ss_decimate_by__works(void **state); - -#endif // _TEST__F_type_array__int32ss_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_decrease_by.c deleted file mode 100644 index 575bd125d..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_decrease_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int32ss_decrease_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int32ss_decrease_by__parameter_checking(void **state) { - - const int length = 5; - f_int32ss_t data = f_int32ss_t_initialize; - - { - const f_status_t status = f_int32ss_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_type_array_int32ss_decrease_by__returns_data_not(void **state) { - - const int length = 5; - f_int32ss_t data = f_int32ss_t_initialize; - - { - const f_status_t status = f_int32ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int32ss_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_type_array_int32ss_decrease_by__works(void **state) { - - const int length = 5; - f_int32ss_t data = f_int32ss_t_initialize; - - { - const f_status_t status = f_int32ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int32ss_decrease_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_decrease_by.h deleted file mode 100644 index 7ec4f502a..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_decrease_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int32ss_decrease_by -#define _TEST__F_type_array__int32ss_decrease_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int32ss_decrease_by() - */ -extern void test__f_type_array_int32ss_decrease_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_int32ss_decrease_by() - */ -extern void test__f_type_array_int32ss_decrease_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_int32ss_decrease_by() - */ -extern void test__f_type_array_int32ss_decrease_by__works(void **state); - -#endif // _TEST__F_type_array__int32ss_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_increase.c deleted file mode 100644 index cf6c38109..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_increase.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int32ss_increase.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int32ss_increase__parameter_checking(void **state) { - - const int length = 5; - f_int32ss_t data = f_int32s_t_initialize; - - { - const f_status_t status = f_int32ss_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_type_array_int32ss_increase__returns_data_not(void **state) { - - const int length = 5; - f_int32ss_t data = f_int32ss_t_initialize; - - { - const f_status_t status = f_int32ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int32ss_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_type_array_int32ss_increase__works(void **state) { - - const int length = 5; - f_int32ss_t data = f_int32ss_t_initialize; - - { - const f_status_t status = f_int32ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_int32ss_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_increase.h deleted file mode 100644 index edd5c96a9..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_increase.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int32ss_increase -#define _TEST__F_type_array__int32ss_increase - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int32ss_increase() - */ -extern void test__f_type_array_int32ss_increase__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_int32ss_increase() - */ -extern void test__f_type_array_int32ss_increase__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_int32ss_increase() - */ -extern void test__f_type_array_int32ss_increase__works(void **state); - -#endif // _TEST__F_type_array__int32ss_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_increase_by.c deleted file mode 100644 index ac607fae7..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_increase_by.c +++ /dev/null @@ -1,84 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int32ss_increase_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int32ss_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_int32ss_t data = f_int32ss_t_initialize; - - { - const f_status_t status = f_int32ss_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_type_array_int32ss_increase_by__returns_data_not(void **state) { - - const int length = 5; - f_int32ss_t data = f_int32ss_t_initialize; - - { - const f_status_t status = f_int32ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int32ss_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_int32ss_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_type_array_int32ss_increase_by__works(void **state) { - - const int length = 5; - f_int32ss_t data = f_int32ss_t_initialize; - - { - const f_status_t status = f_int32ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_int32ss_increase_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_increase_by.h deleted file mode 100644 index bdfb7261c..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_increase_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int32ss_increase_by -#define _TEST__F_type_array__int32ss_increase_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int32ss_increase_by() - */ -extern void test__f_type_array_int32ss_increase_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_int32ss_increase_by() - */ -extern void test__f_type_array_int32ss_increase_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_int32ss_increase_by() - */ -extern void test__f_type_array_int32ss_increase_by__works(void **state); - -#endif // _TEST__F_type_array__int32ss_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_resize.c deleted file mode 100644 index 64b38cfbb..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_resize.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int32ss_resize.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int32ss_resize__parameter_checking(void **state) { - - const int length = 5; - f_int32ss_t data = f_int32ss_t_initialize; - - { - const f_status_t status = f_int32ss_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_type_array_int32ss_resize__works(void **state) { - - const int length = 5; - f_int32ss_t data = f_int32ss_t_initialize; - - { - const f_status_t status = f_int32ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_resize.h deleted file mode 100644 index 1ba577e68..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_resize.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int32ss_resize -#define _TEST__F_type_array__int32ss_resize - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int32ss_resize() - */ -extern void test__f_type_array_int32ss_resize__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_int32ss_resize() - */ -extern void test__f_type_array_int32ss_resize__works(void **state); - -#endif // _TEST__F_type_array__int32ss_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_adjust.c deleted file mode 100644 index 5e0237e1d..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_adjust.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int64s_adjust.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int64s_adjust__parameter_checking(void **state) { - - const int length = 5; - f_int64s_t data = f_int64s_t_initialize; - - { - const f_status_t status = f_int64s_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_type_array_int64s_adjust__works(void **state) { - - const int length = 5; - f_int64s_t data = f_int64s_t_initialize; - - { - const f_status_t status = f_int64s_adjust(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_adjust.h deleted file mode 100644 index c80001651..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_adjust.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int64s_adjust -#define _TEST__F_type_array__int64s_adjust - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int64s_adjust() - */ -extern void test__f_type_array_int64s_adjust__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_int64s_adjust() - */ -extern void test__f_type_array_int64s_adjust__works(void **state); - -#endif // _TEST__F_type_array__int64s_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_adjust_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_adjust_callback.c new file mode 100644 index 000000000..4506963e8 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_adjust_callback.c @@ -0,0 +1,45 @@ +#include "test-type_array.h" +#include "test-type_array-int64s_adjust_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int64s_adjust_callback__fails(void **state) { + + int64_t data = 0; + int64_t data_array[] = { data }; + f_int64s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_int64s_t datass_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_adjust, true); + will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_int64s_adjust_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_int64s_adjust_callback__works(void **state) { + + int64_t data = 0; + int64_t data_array[] = { data }; + f_int64s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_int64s_t datass_array[] = { datas }; + const f_number_unsigned_t length = 1; + + { + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_none); + + const f_status_t status = f_int64s_adjust_callback(0, length, (void *) datass_array); + + assert_int_equal(status, F_none); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_adjust_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_adjust_callback.h new file mode 100644 index 000000000..ee7080238 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_adjust_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int64s_adjust_callback +#define _TEST__F_type_array__int64s_adjust_callback + +/** + * Test that the function fails. + * + * @see f_int64s_adjust_callback() + */ +extern void test__f_type_array_int64s_adjust_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_int64s_adjust_callback() + */ +extern void test__f_type_array_int64s_adjust_callback__works(void **state); + +#endif // _TEST__F_type_array__int64s_adjust_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_append.c deleted file mode 100644 index 0600e9d91..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_append.c +++ /dev/null @@ -1,37 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int64s_append.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int64s_append__parameter_checking(void **state) { - - const int64_t data = 0; - - { - const f_status_t status = f_int64s_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_int64s_append__works(void **state) { - - const int64_t source = 3; - f_int64s_t destination = f_int64s_t_initialize; - - { - const f_status_t status = f_int64s_append(source, &destination); - - assert_int_equal(status, F_none); - assert_int_equal(destination.used, 1); - assert_int_equal(destination.array[0], source); - } - - free((void *) destination.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_append.h deleted file mode 100644 index c817cd56f..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_append.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int64s_append -#define _TEST__F_type_array__int64s_append - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int64s_append() - */ -extern void test__f_type_array_int64s_append__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_int64s_append() - */ -extern void test__f_type_array_int64s_append__works(void **state); - -#endif // _TEST__F_type_array__int64s_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_append_all.c deleted file mode 100644 index 6480f46c7..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_append_all.c +++ /dev/null @@ -1,82 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int64s_append_all.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int64s_append_all__parameter_checking(void **state) { - - const f_int64s_t data = f_int64s_t_initialize; - - { - const f_status_t status = f_int64s_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_int64s_append_all__returns_data_not(void **state) { - - const int length = 5; - f_int64s_t source = f_int64s_t_initialize; - f_int64s_t destination = f_int64s_t_initialize; - - { - const f_status_t status = f_int64s_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_int64s_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_type_array_int64s_append_all__works(void **state) { - - const int length = 5; - const int length_used = 2; - f_int64s_t source = f_int64s_t_initialize; - f_int64s_t destination = f_int64s_t_initialize; - - { - const f_status_t status = f_int64s_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - for (; source.used < length_used; ++source.used) { - source.array[source.used] = source.used + 1; - } // for - - { - const f_status_t status = f_int64s_append_all(source, &destination); - - assert_int_equal(status, F_none); - assert_int_equal(destination.used, source.used); - assert_int_equal(destination.size, source.used); - - for (f_number_unsigned_t i = 0; i < source.used; ++i) { - assert_int_equal(destination.array[i], i + 1); - } // for - } - - free((void *) source.array); - free((void *) destination.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_append_all.h deleted file mode 100644 index 06b617054..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_append_all.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int64s_append_all -#define _TEST__F_type_array__int64s_append_all - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int64s_append_all() - */ -extern void test__f_type_array_int64s_append_all__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_int64s_append_all() - */ -extern void test__f_type_array_int64s_append_all__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_int64s_append_all() - */ -extern void test__f_type_array_int64s_append_all__works(void **state); - -#endif // _TEST__F_type_array__int64s_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_decimate_by.c deleted file mode 100644 index 272d0801c..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_decimate_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int64s_decimate_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int64s_decimate_by__parameter_checking(void **state) { - - const int length = 5; - f_int64s_t data = f_int64s_t_initialize; - - { - const f_status_t status = f_int64s_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_type_array_int64s_decimate_by__returns_data_not(void **state) { - - const int length = 5; - f_int64s_t data = f_int64s_t_initialize; - - { - const f_status_t status = f_int64s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int64s_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_type_array_int64s_decimate_by__works(void **state) { - - const int length = 5; - f_int64s_t data = f_int64s_t_initialize; - - { - const f_status_t status = f_int64s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int64s_decimate_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_decimate_by.h deleted file mode 100644 index 265bcb334..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_decimate_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int64s_decimate_by -#define _TEST__F_type_array__int64s_decimate_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int64s_decimate_by() - */ -extern void test__f_type_array_int64s_decimate_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_int64s_decimate_by() - */ -extern void test__f_type_array_int64s_decimate_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_int64s_decimate_by() - */ -extern void test__f_type_array_int64s_decimate_by__works(void **state); - -#endif // _TEST__F_type_array__int64s_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_decrease_by.c deleted file mode 100644 index 83c490745..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_decrease_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int64s_decrease_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int64s_decrease_by__parameter_checking(void **state) { - - const int length = 5; - f_int64s_t data = f_int64s_t_initialize; - - { - const f_status_t status = f_int64s_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_type_array_int64s_decrease_by__returns_data_not(void **state) { - - const int length = 5; - f_int64s_t data = f_int64s_t_initialize; - - { - const f_status_t status = f_int64s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int64s_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_type_array_int64s_decrease_by__works(void **state) { - - const int length = 5; - f_int64s_t data = f_int64s_t_initialize; - - { - const f_status_t status = f_int64s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int64s_decrease_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_decrease_by.h deleted file mode 100644 index 33d4bdd39..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_decrease_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int64s_decrease_by -#define _TEST__F_type_array__int64s_decrease_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int64s_decrease_by() - */ -extern void test__f_type_array_int64s_decrease_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_int64s_decrease_by() - */ -extern void test__f_type_array_int64s_decrease_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_int64s_decrease_by() - */ -extern void test__f_type_array_int64s_decrease_by__works(void **state); - -#endif // _TEST__F_type_array__int64s_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_increase.c deleted file mode 100644 index bd4cab60d..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_increase.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int64s_increase.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int64s_increase__parameter_checking(void **state) { - - const int length = 5; - f_int64s_t data = f_int64s_t_initialize; - - { - const f_status_t status = f_int64s_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_type_array_int64s_increase__returns_data_not(void **state) { - - const int length = 5; - f_int64s_t data = f_int64s_t_initialize; - - { - const f_status_t status = f_int64s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int64s_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_type_array_int64s_increase__works(void **state) { - - const int length = 5; - f_int64s_t data = f_int64s_t_initialize; - - { - const f_status_t status = f_int64s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_int64s_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_increase.h deleted file mode 100644 index ae3ff9588..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_increase.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int64s_increase -#define _TEST__F_type_array__int64s_increase - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int64s_increase() - */ -extern void test__f_type_array_int64s_increase__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_int64s_increase() - */ -extern void test__f_type_array_int64s_increase__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_int64s_increase() - */ -extern void test__f_type_array_int64s_increase__works(void **state); - -#endif // _TEST__F_type_array__int64s_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_increase_by.c deleted file mode 100644 index a45c56fa9..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_increase_by.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int64s_increase_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int64s_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_int64s_t data = f_int64s_t_initialize; - - { - const f_status_t status = f_int64s_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_type_array_int64s_increase_by__returns_data_not(void **state) { - - const int length = 5; - f_int64s_t data = f_int64s_t_initialize; - - { - const f_status_t status = f_int64s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int64s_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_type_array_int64s_increase_by__works(void **state) { - - const int length = 5; - f_int64s_t data = f_int64s_t_initialize; - - { - const f_status_t status = f_int64s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_int64s_increase_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_increase_by.h deleted file mode 100644 index 785402eac..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_increase_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int64s_increase_by -#define _TEST__F_type_array__int64s_increase_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int64s_increase_by() - */ -extern void test__f_type_array_int64s_increase_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_int64s_increase_by() - */ -extern void test__f_type_array_int64s_increase_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_int64s_increase_by() - */ -extern void test__f_type_array_int64s_increase_by__works(void **state); - -#endif // _TEST__F_type_array__int64s_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_resize.c deleted file mode 100644 index 1286b86f5..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_resize.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int64s_resize.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int64s_resize__parameter_checking(void **state) { - - const int length = 5; - f_int64s_t data = f_int64s_t_initialize; - - { - const f_status_t status = f_int64s_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_type_array_int64s_resize__works(void **state) { - - const int length = 5; - f_int64s_t data = f_int64s_t_initialize; - - { - const f_status_t status = f_int64s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_resize.h deleted file mode 100644 index 1e05819b4..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_resize.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int64s_resize -#define _TEST__F_type_array__int64s_resize - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int64s_resize() - */ -extern void test__f_type_array_int64s_resize__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_int64s_resize() - */ -extern void test__f_type_array_int64s_resize__works(void **state); - -#endif // _TEST__F_type_array__int64s_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_resize_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_resize_callback.c new file mode 100644 index 000000000..3d78bee74 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_resize_callback.c @@ -0,0 +1,45 @@ +#include "test-type_array.h" +#include "test-type_array-int64s_resize_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int64s_resize_callback__fails(void **state) { + + int64_t data = 0; + int64_t data_array[] = { data }; + f_int64s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_int64s_t datass_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_resize, true); + will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_int64s_resize_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_int64s_resize_callback__works(void **state) { + + int64_t data = 0; + int64_t data_array[] = { data }; + f_int64s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_int64s_t datass_array[] = { datas }; + const f_number_unsigned_t length = 1; + + { + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_none); + + const f_status_t status = f_int64s_resize_callback(0, length, (void *) datass_array); + + assert_int_equal(status, F_none); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_resize_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_resize_callback.h new file mode 100644 index 000000000..cbc99f3c8 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_resize_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int64s_resize_callback +#define _TEST__F_type_array__int64s_resize_callback + +/** + * Test that the function fails. + * + * @see f_int64s_resize_callback() + */ +extern void test__f_type_array_int64s_resize_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_int64s_resize_callback() + */ +extern void test__f_type_array_int64s_resize_callback__works(void **state); + +#endif // _TEST__F_type_array__int64s_resize_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_adjust.c deleted file mode 100644 index 92a11fa3e..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_adjust.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int64ss_adjust.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int64ss_adjust__parameter_checking(void **state) { - - const int length = 5; - f_int64ss_t data = f_int64ss_t_initialize; - - { - const f_status_t status = f_int64ss_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_type_array_int64ss_adjust__works(void **state) { - - const int length = 5; - f_int64ss_t data = f_int64ss_t_initialize; - - { - const f_status_t status = f_int64ss_adjust(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_adjust.h deleted file mode 100644 index 7344c98db..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_adjust.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int64ss_adjust -#define _TEST__F_type_array__int64ss_adjust - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int64ss_adjust() - */ -extern void test__f_type_array_int64ss_adjust__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_int64ss_adjust() - */ -extern void test__f_type_array_int64ss_adjust__works(void **state); - -#endif // _TEST__F_type_array__int64ss_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_append.c deleted file mode 100644 index 42d8d6920..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_append.c +++ /dev/null @@ -1,86 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int64ss_append.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int64ss_append__parameter_checking(void **state) { - - f_int64s_t data = f_int64s_t_initialize; - - { - const f_status_t status = f_int64ss_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_int64ss_append__returns_data_not(void **state) { - - const int length = 5; - f_int64s_t source = f_int64s_t_initialize; - f_int64ss_t destination = f_int64ss_t_initialize; - - { - const f_status_t status = f_int64s_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_int64ss_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_type_array_int64ss_append__works(void **state) { - - const int length = 5; - f_int64s_t source = f_int64s_t_initialize; - f_int64ss_t destination = f_int64ss_t_initialize; - - { - const f_status_t status = f_int64s_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - for (; source.used < length; ++source.used) { - source.array[source.used] = source.used + 1; - } // for - - { - const f_status_t status = f_int64ss_append(source, &destination); - - assert_int_equal(status, F_none); - 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], i + 1); - } // 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 diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_append.h deleted file mode 100644 index f8805388e..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_append.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int64ss_append -#define _TEST__F_type_array__int64ss_append - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int64ss_append() - */ -extern void test__f_type_array_int64ss_append__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_int64ss_append() - */ -extern void test__f_type_array_int64ss_append__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_int64ss_append() - */ -extern void test__f_type_array_int64ss_append__works(void **state); - -#endif // _TEST__F_type_array__int64ss_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_append_all.c deleted file mode 100644 index 915305ba8..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_append_all.c +++ /dev/null @@ -1,105 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int64ss_append_all.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int64ss_append_all__parameter_checking(void **state) { - - const f_int64ss_t data = f_int64ss_t_initialize; - - { - const f_status_t status = f_int64ss_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_int64ss_append_all__returns_data_not(void **state) { - - const int length = 5; - f_int64ss_t source = f_int64ss_t_initialize; - f_int64ss_t destination = f_int64ss_t_initialize; - - { - const f_status_t status = f_int64ss_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_int64ss_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_type_array_int64ss_append_all__works(void **state) { - - const int length = 5; - const int length_inner = 2; - f_int64ss_t source = f_int64ss_t_initialize; - f_int64ss_t destination = f_int64ss_t_initialize; - - { - const f_status_t status = f_int64ss_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - for (; source.used < length; ++source.used) { - - const f_status_t status = f_int64s_resize(length_inner, &source.array[source.used]); - - assert_int_equal(status, F_none); - - for (f_number_unsigned_t i = 0; i < length_inner; ++i) { - source.array[source.used].array[source.array[source.used].used++] = i + 1; - } // for - } // for - } - - { - const f_status_t status = f_int64ss_append_all(source, &destination); - - assert_int_equal(status, F_none); - assert_int_equal(destination.used, source.used); - assert_int_equal(destination.size, source.used); - - for (f_number_unsigned_t i = 0; i < destination.used; ++i) { - - assert_int_equal(destination.array[i].used, length_inner); - assert_int_equal(destination.array[i].size, length_inner); - - for (f_number_unsigned_t j = 0; j < length_inner; ++j) { - assert_int_equal(destination.array[i].array[j], j + 1); - } // 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 diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_append_all.h deleted file mode 100644 index af12357eb..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_append_all.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int64ss_append_all -#define _TEST__F_type_array__int64ss_append_all - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int64ss_append_all() - */ -extern void test__f_type_array_int64ss_append_all__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_int64ss_append_all() - */ -extern void test__f_type_array_int64ss_append_all__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_int64ss_append_all() - */ -extern void test__f_type_array_int64ss_append_all__works(void **state); - -#endif // _TEST__F_type_array__int64ss_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_decimate_by.c deleted file mode 100644 index cf0e34d99..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_decimate_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int64ss_decimate_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int64ss_decimate_by__parameter_checking(void **state) { - - const int length = 5; - f_int64ss_t data = f_int64ss_t_initialize; - - { - const f_status_t status = f_int64ss_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_type_array_int64ss_decimate_by__returns_data_not(void **state) { - - const int length = 5; - f_int64ss_t data = f_int64ss_t_initialize; - - { - const f_status_t status = f_int64ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int64ss_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_type_array_int64ss_decimate_by__works(void **state) { - - const int length = 5; - f_int64ss_t data = f_int64ss_t_initialize; - - { - const f_status_t status = f_int64ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int64ss_decimate_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_decimate_by.h deleted file mode 100644 index b78ff3620..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_decimate_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int64ss_decimate_by -#define _TEST__F_type_array__int64ss_decimate_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int64ss_decimate_by() - */ -extern void test__f_type_array_int64ss_decimate_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_type_array_int64ss_decimate_by() - */ -extern void test__f_type_array_int64ss_decimate_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_int64ss_decimate_by() - */ -extern void test__f_type_array_int64ss_decimate_by__works(void **state); - -#endif // _TEST__F_type_array__int64ss_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_decrease_by.c deleted file mode 100644 index d93f5e2f7..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_decrease_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int64ss_decrease_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int64ss_decrease_by__parameter_checking(void **state) { - - const int length = 5; - f_int64ss_t data = f_int64ss_t_initialize; - - { - const f_status_t status = f_int64ss_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_type_array_int64ss_decrease_by__returns_data_not(void **state) { - - const int length = 5; - f_int64ss_t data = f_int64ss_t_initialize; - - { - const f_status_t status = f_int64ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int64ss_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_type_array_int64ss_decrease_by__works(void **state) { - - const int length = 5; - f_int64ss_t data = f_int64ss_t_initialize; - - { - const f_status_t status = f_int64ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int64ss_decrease_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_decrease_by.h deleted file mode 100644 index ad49394d5..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_decrease_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int64ss_decrease_by -#define _TEST__F_type_array__int64ss_decrease_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int64ss_decrease_by() - */ -extern void test__f_type_array_int64ss_decrease_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_int64ss_decrease_by() - */ -extern void test__f_type_array_int64ss_decrease_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_int64ss_decrease_by() - */ -extern void test__f_type_array_int64ss_decrease_by__works(void **state); - -#endif // _TEST__F_type_array__int64ss_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_increase.c deleted file mode 100644 index f2521343f..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_increase.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int64ss_increase.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int64ss_increase__parameter_checking(void **state) { - - const int length = 5; - f_int64ss_t data = f_int64s_t_initialize; - - { - const f_status_t status = f_int64ss_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_type_array_int64ss_increase__returns_data_not(void **state) { - - const int length = 5; - f_int64ss_t data = f_int64ss_t_initialize; - - { - const f_status_t status = f_int64ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int64ss_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_type_array_int64ss_increase__works(void **state) { - - const int length = 5; - f_int64ss_t data = f_int64ss_t_initialize; - - { - const f_status_t status = f_int64ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_int64ss_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_increase.h deleted file mode 100644 index b11a16fe5..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_increase.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int64ss_increase -#define _TEST__F_type_array__int64ss_increase - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int64ss_increase() - */ -extern void test__f_type_array_int64ss_increase__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_int64ss_increase() - */ -extern void test__f_type_array_int64ss_increase__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_int64ss_increase() - */ -extern void test__f_type_array_int64ss_increase__works(void **state); - -#endif // _TEST__F_type_array__int64ss_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_increase_by.c deleted file mode 100644 index 27238ba81..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_increase_by.c +++ /dev/null @@ -1,84 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int64ss_increase_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int64ss_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_int64ss_t data = f_int64ss_t_initialize; - - { - const f_status_t status = f_int64ss_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_type_array_int64ss_increase_by__returns_data_not(void **state) { - - const int length = 5; - f_int64ss_t data = f_int64ss_t_initialize; - - { - const f_status_t status = f_int64ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int64ss_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_int64ss_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_type_array_int64ss_increase_by__works(void **state) { - - const int length = 5; - f_int64ss_t data = f_int64ss_t_initialize; - - { - const f_status_t status = f_int64ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_int64ss_increase_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_increase_by.h deleted file mode 100644 index 172f3d4df..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_increase_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int64ss_increase_by -#define _TEST__F_type_array__int64ss_increase_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int64ss_increase_by() - */ -extern void test__f_type_array_int64ss_increase_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_int64ss_increase_by() - */ -extern void test__f_type_array_int64ss_increase_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_int64ss_increase_by() - */ -extern void test__f_type_array_int64ss_increase_by__works(void **state); - -#endif // _TEST__F_type_array__int64ss_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_resize.c deleted file mode 100644 index 65b19ea46..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_resize.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int64ss_resize.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int64ss_resize__parameter_checking(void **state) { - - const int length = 5; - f_int64ss_t data = f_int64ss_t_initialize; - - { - const f_status_t status = f_int64ss_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_type_array_int64ss_resize__works(void **state) { - - const int length = 5; - f_int64ss_t data = f_int64ss_t_initialize; - - { - const f_status_t status = f_int64ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_resize.h deleted file mode 100644 index ffc21ea3d..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_resize.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int64ss_resize -#define _TEST__F_type_array__int64ss_resize - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int64ss_resize() - */ -extern void test__f_type_array_int64ss_resize__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_int64ss_resize() - */ -extern void test__f_type_array_int64ss_resize__works(void **state); - -#endif // _TEST__F_type_array__int64ss_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_adjust.c deleted file mode 100644 index ff4db0190..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_adjust.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int8s_adjust.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int8s_adjust__parameter_checking(void **state) { - - const int length = 5; - f_int8s_t data = f_int8s_t_initialize; - - { - const f_status_t status = f_int8s_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_type_array_int8s_adjust__works(void **state) { - - const int length = 5; - f_int8s_t data = f_int8s_t_initialize; - - { - const f_status_t status = f_int8s_adjust(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_adjust.h deleted file mode 100644 index ce9389cb5..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_adjust.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int8s_adjust -#define _TEST__F_type_array__int8s_adjust - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int8s_adjust() - */ -extern void test__f_type_array_int8s_adjust__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_int8s_adjust() - */ -extern void test__f_type_array_int8s_adjust__works(void **state); - -#endif // _TEST__F_type_array__int8s_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_adjust_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_adjust_callback.c new file mode 100644 index 000000000..419248236 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_adjust_callback.c @@ -0,0 +1,45 @@ +#include "test-type_array.h" +#include "test-type_array-int8s_adjust_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int8s_adjust_callback__fails(void **state) { + + int8_t data = 0; + int8_t data_array[] = { data }; + f_int8s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_int8s_t datass_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_adjust, true); + will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_int8s_adjust_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_int8s_adjust_callback__works(void **state) { + + int8_t data = 0; + int8_t data_array[] = { data }; + f_int8s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_int8s_t datass_array[] = { datas }; + const f_number_unsigned_t length = 1; + + { + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_none); + + const f_status_t status = f_int8s_adjust_callback(0, length, (void *) datass_array); + + assert_int_equal(status, F_none); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_adjust_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_adjust_callback.h new file mode 100644 index 000000000..50e09dc5a --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_adjust_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int8s_adjust_callback +#define _TEST__F_type_array__int8s_adjust_callback + +/** + * Test that the function fails. + * + * @see f_int8s_adjust_callback() + */ +extern void test__f_type_array_int8s_adjust_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_int8s_adjust_callback() + */ +extern void test__f_type_array_int8s_adjust_callback__works(void **state); + +#endif // _TEST__F_type_array__int8s_adjust_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_append.c deleted file mode 100644 index 1eef1eaf7..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_append.c +++ /dev/null @@ -1,37 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int8s_append.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int8s_append__parameter_checking(void **state) { - - const int8_t data = 0; - - { - const f_status_t status = f_int8s_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_int8s_append__works(void **state) { - - const int8_t source = 3; - f_int8s_t destination = f_int8s_t_initialize; - - { - const f_status_t status = f_int8s_append(source, &destination); - - assert_int_equal(status, F_none); - assert_int_equal(destination.used, 1); - assert_int_equal(destination.array[0], source); - } - - free((void *) destination.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_append.h deleted file mode 100644 index d54964d1d..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_append.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int8s_append -#define _TEST__F_type_array__int8s_append - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int8s_append() - */ -extern void test__f_type_array_int8s_append__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_int8s_append() - */ -extern void test__f_type_array_int8s_append__works(void **state); - -#endif // _TEST__F_type_array__int8s_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_append_all.c deleted file mode 100644 index d4570113e..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_append_all.c +++ /dev/null @@ -1,82 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int8s_append_all.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int8s_append_all__parameter_checking(void **state) { - - const f_int8s_t data = f_int8s_t_initialize; - - { - const f_status_t status = f_int8s_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_int8s_append_all__returns_data_not(void **state) { - - const int length = 5; - f_int8s_t source = f_int8s_t_initialize; - f_int8s_t destination = f_int8s_t_initialize; - - { - const f_status_t status = f_int8s_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_int8s_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_type_array_int8s_append_all__works(void **state) { - - const int length = 5; - const int length_used = 2; - f_int8s_t source = f_int8s_t_initialize; - f_int8s_t destination = f_int8s_t_initialize; - - { - const f_status_t status = f_int8s_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - for (; source.used < length_used; ++source.used) { - source.array[source.used] = source.used + 1; - } // for - - { - const f_status_t status = f_int8s_append_all(source, &destination); - - assert_int_equal(status, F_none); - assert_int_equal(destination.used, source.used); - assert_int_equal(destination.size, source.used); - - for (f_number_unsigned_t i = 0; i < source.used; ++i) { - assert_int_equal(destination.array[i], i + 1); - } // for - } - - free((void *) source.array); - free((void *) destination.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_append_all.h deleted file mode 100644 index 0d2d894df..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_append_all.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int8s_append_all -#define _TEST__F_type_array__int8s_append_all - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int8s_append_all() - */ -extern void test__f_type_array_int8s_append_all__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_int8s_append_all() - */ -extern void test__f_type_array_int8s_append_all__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_int8s_append_all() - */ -extern void test__f_type_array_int8s_append_all__works(void **state); - -#endif // _TEST__F_type_array__int8s_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_decimate_by.c deleted file mode 100644 index 2bf8d355a..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_decimate_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int8s_decimate_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int8s_decimate_by__parameter_checking(void **state) { - - const int length = 5; - f_int8s_t data = f_int8s_t_initialize; - - { - const f_status_t status = f_int8s_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_type_array_int8s_decimate_by__returns_data_not(void **state) { - - const int length = 5; - f_int8s_t data = f_int8s_t_initialize; - - { - const f_status_t status = f_int8s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int8s_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_type_array_int8s_decimate_by__works(void **state) { - - const int length = 5; - f_int8s_t data = f_int8s_t_initialize; - - { - const f_status_t status = f_int8s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int8s_decimate_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_decimate_by.h deleted file mode 100644 index 2432f7528..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_decimate_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int8s_decimate_by -#define _TEST__F_type_array__int8s_decimate_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int8s_decimate_by() - */ -extern void test__f_type_array_int8s_decimate_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_int8s_decimate_by() - */ -extern void test__f_type_array_int8s_decimate_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_int8s_decimate_by() - */ -extern void test__f_type_array_int8s_decimate_by__works(void **state); - -#endif // _TEST__F_type_array__int8s_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_decrease_by.c deleted file mode 100644 index 79ba58723..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_decrease_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int8s_decrease_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int8s_decrease_by__parameter_checking(void **state) { - - const int length = 5; - f_int8s_t data = f_int8s_t_initialize; - - { - const f_status_t status = f_int8s_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_type_array_int8s_decrease_by__returns_data_not(void **state) { - - const int length = 5; - f_int8s_t data = f_int8s_t_initialize; - - { - const f_status_t status = f_int8s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int8s_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_type_array_int8s_decrease_by__works(void **state) { - - const int length = 5; - f_int8s_t data = f_int8s_t_initialize; - - { - const f_status_t status = f_int8s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int8s_decrease_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_decrease_by.h deleted file mode 100644 index 9463ded0a..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_decrease_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int8s_decrease_by -#define _TEST__F_type_array__int8s_decrease_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int8s_decrease_by() - */ -extern void test__f_type_array_int8s_decrease_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_int8s_decrease_by() - */ -extern void test__f_type_array_int8s_decrease_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_int8s_decrease_by() - */ -extern void test__f_type_array_int8s_decrease_by__works(void **state); - -#endif // _TEST__F_type_array__int8s_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_increase.c deleted file mode 100644 index b79827a61..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_increase.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int8s_increase.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int8s_increase__parameter_checking(void **state) { - - const int length = 5; - f_int8s_t data = f_int8s_t_initialize; - - { - const f_status_t status = f_int8s_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_type_array_int8s_increase__returns_data_not(void **state) { - - const int length = 5; - f_int8s_t data = f_int8s_t_initialize; - - { - const f_status_t status = f_int8s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int8s_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_type_array_int8s_increase__works(void **state) { - - const int length = 5; - f_int8s_t data = f_int8s_t_initialize; - - { - const f_status_t status = f_int8s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_int8s_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_increase.h deleted file mode 100644 index 451422166..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_increase.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int8s_increase -#define _TEST__F_type_array__int8s_increase - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int8s_increase() - */ -extern void test__f_type_array_int8s_increase__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_int8s_increase() - */ -extern void test__f_type_array_int8s_increase__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_int8s_increase() - */ -extern void test__f_type_array_int8s_increase__works(void **state); - -#endif // _TEST__F_type_array__int8s_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_increase_by.c deleted file mode 100644 index 6e9445cb7..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_increase_by.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int8s_increase_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int8s_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_int8s_t data = f_int8s_t_initialize; - - { - const f_status_t status = f_int8s_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_type_array_int8s_increase_by__returns_data_not(void **state) { - - const int length = 5; - f_int8s_t data = f_int8s_t_initialize; - - { - const f_status_t status = f_int8s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int8s_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_type_array_int8s_increase_by__works(void **state) { - - const int length = 5; - f_int8s_t data = f_int8s_t_initialize; - - { - const f_status_t status = f_int8s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_int8s_increase_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_increase_by.h deleted file mode 100644 index b524456bc..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_increase_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int8s_increase_by -#define _TEST__F_type_array__int8s_increase_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int8s_increase_by() - */ -extern void test__f_type_array_int8s_increase_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_int8s_increase_by() - */ -extern void test__f_type_array_int8s_increase_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_int8s_increase_by() - */ -extern void test__f_type_array_int8s_increase_by__works(void **state); - -#endif // _TEST__F_type_array__int8s_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_resize.c deleted file mode 100644 index c6ec662fe..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_resize.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int8s_resize.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int8s_resize__parameter_checking(void **state) { - - const int length = 5; - f_int8s_t data = f_int8s_t_initialize; - - { - const f_status_t status = f_int8s_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_type_array_int8s_resize__works(void **state) { - - const int length = 5; - f_int8s_t data = f_int8s_t_initialize; - - { - const f_status_t status = f_int8s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_resize.h deleted file mode 100644 index 56434762b..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_resize.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int8s_resize -#define _TEST__F_type_array__int8s_resize - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int8s_resize() - */ -extern void test__f_type_array_int8s_resize__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_int8s_resize() - */ -extern void test__f_type_array_int8s_resize__works(void **state); - -#endif // _TEST__F_type_array__int8s_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_resize_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_resize_callback.c new file mode 100644 index 000000000..942847582 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_resize_callback.c @@ -0,0 +1,45 @@ +#include "test-type_array.h" +#include "test-type_array-int8s_resize_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int8s_resize_callback__fails(void **state) { + + int8_t data = 0; + int8_t data_array[] = { data }; + f_int8s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_int8s_t datass_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_resize, true); + will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_int8s_resize_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_int8s_resize_callback__works(void **state) { + + int8_t data = 0; + int8_t data_array[] = { data }; + f_int8s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_int8s_t datass_array[] = { datas }; + const f_number_unsigned_t length = 1; + + { + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_none); + + const f_status_t status = f_int8s_resize_callback(0, length, (void *) datass_array); + + assert_int_equal(status, F_none); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_resize_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_resize_callback.h new file mode 100644 index 000000000..509e9519a --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_resize_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int8s_resize_callback +#define _TEST__F_type_array__int8s_resize_callback + +/** + * Test that the function fails. + * + * @see f_int8s_resize_callback() + */ +extern void test__f_type_array_int8s_resize_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_int8s_resize_callback() + */ +extern void test__f_type_array_int8s_resize_callback__works(void **state); + +#endif // _TEST__F_type_array__int8s_resize_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_adjust.c deleted file mode 100644 index bbba3cd61..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_adjust.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int8ss_adjust.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int8ss_adjust__parameter_checking(void **state) { - - const int length = 5; - f_int8ss_t data = f_int8ss_t_initialize; - - { - const f_status_t status = f_int8ss_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_type_array_int8ss_adjust__works(void **state) { - - const int length = 5; - f_int8ss_t data = f_int8ss_t_initialize; - - { - const f_status_t status = f_int8ss_adjust(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_adjust.h deleted file mode 100644 index 3c1def35d..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_adjust.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int8ss_adjust -#define _TEST__F_type_array__int8ss_adjust - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int8ss_adjust() - */ -extern void test__f_type_array_int8ss_adjust__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_int8ss_adjust() - */ -extern void test__f_type_array_int8ss_adjust__works(void **state); - -#endif // _TEST__F_type_array__int8ss_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_append.c deleted file mode 100644 index 9402d6352..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_append.c +++ /dev/null @@ -1,86 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int8ss_append.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int8ss_append__parameter_checking(void **state) { - - f_int8s_t data = f_int8s_t_initialize; - - { - const f_status_t status = f_int8ss_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_int8ss_append__returns_data_not(void **state) { - - const int length = 5; - f_int8s_t source = f_int8s_t_initialize; - f_int8ss_t destination = f_int8ss_t_initialize; - - { - const f_status_t status = f_int8s_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_int8ss_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_type_array_int8ss_append__works(void **state) { - - const int length = 5; - f_int8s_t source = f_int8s_t_initialize; - f_int8ss_t destination = f_int8ss_t_initialize; - - { - const f_status_t status = f_int8s_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - for (; source.used < length; ++source.used) { - source.array[source.used] = source.used + 1; - } // for - - { - const f_status_t status = f_int8ss_append(source, &destination); - - assert_int_equal(status, F_none); - 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], i + 1); - } // 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 diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_append.h deleted file mode 100644 index 2809e9162..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_append.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int8ss_append -#define _TEST__F_type_array__int8ss_append - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int8ss_append() - */ -extern void test__f_type_array_int8ss_append__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_int8ss_append() - */ -extern void test__f_type_array_int8ss_append__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_int8ss_append() - */ -extern void test__f_type_array_int8ss_append__works(void **state); - -#endif // _TEST__F_type_array__int8ss_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_append_all.c deleted file mode 100644 index c36684663..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_append_all.c +++ /dev/null @@ -1,105 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int8ss_append_all.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int8ss_append_all__parameter_checking(void **state) { - - const f_int8ss_t data = f_int8ss_t_initialize; - - { - const f_status_t status = f_int8ss_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_int8ss_append_all__returns_data_not(void **state) { - - const int length = 5; - f_int8ss_t source = f_int8ss_t_initialize; - f_int8ss_t destination = f_int8ss_t_initialize; - - { - const f_status_t status = f_int8ss_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_int8ss_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_type_array_int8ss_append_all__works(void **state) { - - const int length = 5; - const int length_inner = 2; - f_int8ss_t source = f_int8ss_t_initialize; - f_int8ss_t destination = f_int8ss_t_initialize; - - { - const f_status_t status = f_int8ss_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - for (; source.used < length; ++source.used) { - - const f_status_t status = f_int8s_resize(length_inner, &source.array[source.used]); - - assert_int_equal(status, F_none); - - for (f_number_unsigned_t i = 0; i < length_inner; ++i) { - source.array[source.used].array[source.array[source.used].used++] = i + 1; - } // for - } // for - } - - { - const f_status_t status = f_int8ss_append_all(source, &destination); - - assert_int_equal(status, F_none); - assert_int_equal(destination.used, source.used); - assert_int_equal(destination.size, source.used); - - for (f_number_unsigned_t i = 0; i < destination.used; ++i) { - - assert_int_equal(destination.array[i].used, length_inner); - assert_int_equal(destination.array[i].size, length_inner); - - for (f_number_unsigned_t j = 0; j < length_inner; ++j) { - assert_int_equal(destination.array[i].array[j], j + 1); - } // 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 diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_append_all.h deleted file mode 100644 index ff1cd1486..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_append_all.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int8ss_append_all -#define _TEST__F_type_array__int8ss_append_all - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int8ss_append_all() - */ -extern void test__f_type_array_int8ss_append_all__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_int8ss_append_all() - */ -extern void test__f_type_array_int8ss_append_all__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_int8ss_append_all() - */ -extern void test__f_type_array_int8ss_append_all__works(void **state); - -#endif // _TEST__F_type_array__int8ss_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_decimate_by.c deleted file mode 100644 index 048822334..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_decimate_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int8ss_decimate_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int8ss_decimate_by__parameter_checking(void **state) { - - const int length = 5; - f_int8ss_t data = f_int8ss_t_initialize; - - { - const f_status_t status = f_int8ss_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_type_array_int8ss_decimate_by__returns_data_not(void **state) { - - const int length = 5; - f_int8ss_t data = f_int8ss_t_initialize; - - { - const f_status_t status = f_int8ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int8ss_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_type_array_int8ss_decimate_by__works(void **state) { - - const int length = 5; - f_int8ss_t data = f_int8ss_t_initialize; - - { - const f_status_t status = f_int8ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int8ss_decimate_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_decimate_by.h deleted file mode 100644 index a90f82741..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_decimate_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int8ss_decimate_by -#define _TEST__F_type_array__int8ss_decimate_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int8ss_decimate_by() - */ -extern void test__f_type_array_int8ss_decimate_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_type_array_int8ss_decimate_by() - */ -extern void test__f_type_array_int8ss_decimate_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_int8ss_decimate_by() - */ -extern void test__f_type_array_int8ss_decimate_by__works(void **state); - -#endif // _TEST__F_type_array__int8ss_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_decrease_by.c deleted file mode 100644 index d6dc68e33..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_decrease_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int8ss_decrease_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int8ss_decrease_by__parameter_checking(void **state) { - - const int length = 5; - f_int8ss_t data = f_int8ss_t_initialize; - - { - const f_status_t status = f_int8ss_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_type_array_int8ss_decrease_by__returns_data_not(void **state) { - - const int length = 5; - f_int8ss_t data = f_int8ss_t_initialize; - - { - const f_status_t status = f_int8ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int8ss_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_type_array_int8ss_decrease_by__works(void **state) { - - const int length = 5; - f_int8ss_t data = f_int8ss_t_initialize; - - { - const f_status_t status = f_int8ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int8ss_decrease_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_decrease_by.h deleted file mode 100644 index 26059142a..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_decrease_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int8ss_decrease_by -#define _TEST__F_type_array__int8ss_decrease_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int8ss_decrease_by() - */ -extern void test__f_type_array_int8ss_decrease_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_int8ss_decrease_by() - */ -extern void test__f_type_array_int8ss_decrease_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_int8ss_decrease_by() - */ -extern void test__f_type_array_int8ss_decrease_by__works(void **state); - -#endif // _TEST__F_type_array__int8ss_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_increase.c deleted file mode 100644 index 0cc0c5038..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_increase.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int8ss_increase.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int8ss_increase__parameter_checking(void **state) { - - const int length = 5; - f_int8ss_t data = f_int8s_t_initialize; - - { - const f_status_t status = f_int8ss_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_type_array_int8ss_increase__returns_data_not(void **state) { - - const int length = 5; - f_int8ss_t data = f_int8ss_t_initialize; - - { - const f_status_t status = f_int8ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int8ss_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_type_array_int8ss_increase__works(void **state) { - - const int length = 5; - f_int8ss_t data = f_int8ss_t_initialize; - - { - const f_status_t status = f_int8ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_int8ss_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_increase.h deleted file mode 100644 index 93122f04f..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_increase.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int8ss_increase -#define _TEST__F_type_array__int8ss_increase - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int8ss_increase() - */ -extern void test__f_type_array_int8ss_increase__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_int8ss_increase() - */ -extern void test__f_type_array_int8ss_increase__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_int8ss_increase() - */ -extern void test__f_type_array_int8ss_increase__works(void **state); - -#endif // _TEST__F_type_array__int8ss_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_increase_by.c deleted file mode 100644 index f37b14b78..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_increase_by.c +++ /dev/null @@ -1,84 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int8ss_increase_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int8ss_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_int8ss_t data = f_int8ss_t_initialize; - - { - const f_status_t status = f_int8ss_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_type_array_int8ss_increase_by__returns_data_not(void **state) { - - const int length = 5; - f_int8ss_t data = f_int8ss_t_initialize; - - { - const f_status_t status = f_int8ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int8ss_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_int8ss_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_type_array_int8ss_increase_by__works(void **state) { - - const int length = 5; - f_int8ss_t data = f_int8ss_t_initialize; - - { - const f_status_t status = f_int8ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_int8ss_increase_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_increase_by.h deleted file mode 100644 index af7520a32..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_increase_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int8ss_increase_by -#define _TEST__F_type_array__int8ss_increase_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int8ss_increase_by() - */ -extern void test__f_type_array_int8ss_increase_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_int8ss_increase_by() - */ -extern void test__f_type_array_int8ss_increase_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_int8ss_increase_by() - */ -extern void test__f_type_array_int8ss_increase_by__works(void **state); - -#endif // _TEST__F_type_array__int8ss_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_resize.c deleted file mode 100644 index b3ef69cfa..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_resize.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-int8ss_resize.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_int8ss_resize__parameter_checking(void **state) { - - const int length = 5; - f_int8ss_t data = f_int8ss_t_initialize; - - { - const f_status_t status = f_int8ss_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_type_array_int8ss_resize__works(void **state) { - - const int length = 5; - f_int8ss_t data = f_int8ss_t_initialize; - - { - const f_status_t status = f_int8ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_resize.h deleted file mode 100644 index 5cca2d632..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_resize.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__int8ss_resize -#define _TEST__F_type_array__int8ss_resize - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_int8ss_resize() - */ -extern void test__f_type_array_int8ss_resize__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_int8ss_resize() - */ -extern void test__f_type_array_int8ss_resize__works(void **state); - -#endif // _TEST__F_type_array__int8ss_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_adjust.c deleted file mode 100644 index 926c36350..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_adjust.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-number_unsigneds_adjust.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_number_unsigneds_adjust__parameter_checking(void **state) { - - const int length = 5; - f_number_unsigneds_t data = f_number_unsigneds_t_initialize; - - { - const f_status_t status = f_number_unsigneds_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_type_array_number_unsigneds_adjust__works(void **state) { - - const int length = 5; - f_number_unsigneds_t data = f_number_unsigneds_t_initialize; - - { - const f_status_t status = f_number_unsigneds_adjust(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_adjust.h deleted file mode 100644 index 86813b382..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_adjust.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__number_unsigneds_adjust -#define _TEST__F_type_array__number_unsigneds_adjust - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_number_unsigneds_adjust() - */ -extern void test__f_type_array_number_unsigneds_adjust__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_number_unsigneds_adjust() - */ -extern void test__f_type_array_number_unsigneds_adjust__works(void **state); - -#endif // _TEST__F_type_array__number_unsigneds_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_adjust_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_adjust_callback.c new file mode 100644 index 000000000..d0ae02e53 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_adjust_callback.c @@ -0,0 +1,45 @@ +#include "test-type_array.h" +#include "test-type_array-number_unsigneds_adjust_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_number_unsigneds_adjust_callback__fails(void **state) { + + f_number_unsigned_t data = f_number_unsigned_t_initialize; + f_number_unsigned_t data_array[] = { data }; + f_number_unsigneds_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_number_unsigneds_t datass_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_adjust, true); + will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_number_unsigneds_adjust_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_number_unsigneds_adjust_callback__works(void **state) { + + f_number_unsigned_t data = f_number_unsigned_t_initialize; + f_number_unsigned_t data_array[] = { data }; + f_number_unsigneds_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_number_unsigneds_t datass_array[] = { datas }; + const f_number_unsigned_t length = 1; + + { + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_none); + + const f_status_t status = f_number_unsigneds_adjust_callback(0, length, (void *) datass_array); + + assert_int_equal(status, F_none); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_adjust_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_adjust_callback.h new file mode 100644 index 000000000..f6bb18723 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_adjust_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__number_unsigneds_adjust_callback +#define _TEST__F_type_array__number_unsigneds_adjust_callback + +/** + * Test that the function fails. + * + * @see f_number_unsigneds_adjust_callback() + */ +extern void test__f_type_array_number_unsigneds_adjust_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_number_unsigneds_adjust_callback() + */ +extern void test__f_type_array_number_unsigneds_adjust_callback__works(void **state); + +#endif // _TEST__F_type_array__number_unsigneds_adjust_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_append.c deleted file mode 100644 index 2edbb7d64..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_append.c +++ /dev/null @@ -1,37 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-number_unsigneds_append.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_number_unsigneds_append__parameter_checking(void **state) { - - const f_number_unsigned_t data = f_number_unsigned_t_initialize; - - { - const f_status_t status = f_number_unsigneds_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_number_unsigneds_append__works(void **state) { - - const f_number_unsigned_t source = 3; - f_number_unsigneds_t destination = f_number_unsigneds_t_initialize; - - { - const f_status_t status = f_number_unsigneds_append(source, &destination); - - assert_int_equal(status, F_none); - assert_int_equal(destination.used, 1); - assert_int_equal(destination.array[0], source); - } - - free((void *) destination.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_append.h deleted file mode 100644 index 22fffcaf0..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_append.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__number_unsigneds_append -#define _TEST__F_type_array__number_unsigneds_append - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_number_unsigneds_append() - */ -extern void test__f_type_array_number_unsigneds_append__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_number_unsigneds_append() - */ -extern void test__f_type_array_number_unsigneds_append__works(void **state); - -#endif // _TEST__F_type_array__number_unsigneds_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_append_all.c deleted file mode 100644 index 58bf1cb05..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_append_all.c +++ /dev/null @@ -1,82 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-number_unsigneds_append_all.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_number_unsigneds_append_all__parameter_checking(void **state) { - - const f_number_unsigneds_t data = f_number_unsigneds_t_initialize; - - { - const f_status_t status = f_number_unsigneds_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_number_unsigneds_append_all__returns_data_not(void **state) { - - const int length = 5; - f_number_unsigneds_t source = f_number_unsigneds_t_initialize; - f_number_unsigneds_t destination = f_number_unsigneds_t_initialize; - - { - const f_status_t status = f_number_unsigneds_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_number_unsigneds_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_type_array_number_unsigneds_append_all__works(void **state) { - - const int length = 5; - const int length_used = 2; - f_number_unsigneds_t source = f_number_unsigneds_t_initialize; - f_number_unsigneds_t destination = f_number_unsigneds_t_initialize; - - { - const f_status_t status = f_number_unsigneds_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - for (; source.used < length_used; ++source.used) { - source.array[source.used] = source.used + 1; - } // for - - { - const f_status_t status = f_number_unsigneds_append_all(source, &destination); - - assert_int_equal(status, F_none); - assert_int_equal(destination.used, source.used); - assert_int_equal(destination.size, source.used); - - for (f_number_unsigned_t i = 0; i < source.used; ++i) { - assert_int_equal(destination.array[i], i + 1); - } // for - } - - free((void *) source.array); - free((void *) destination.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_append_all.h deleted file mode 100644 index 0bbb2915d..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_append_all.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__number_unsigneds_append_all -#define _TEST__F_type_array__number_unsigneds_append_all - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_number_unsigneds_append_all() - */ -extern void test__f_type_array_number_unsigneds_append_all__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_number_unsigneds_append_all() - */ -extern void test__f_type_array_number_unsigneds_append_all__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_number_unsigneds_append_all() - */ -extern void test__f_type_array_number_unsigneds_append_all__works(void **state); - -#endif // _TEST__F_type_array__number_unsigneds_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_decimate_by.c deleted file mode 100644 index 6c782a6e0..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_decimate_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-number_unsigneds_decimate_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_number_unsigneds_decimate_by__parameter_checking(void **state) { - - const int length = 5; - f_number_unsigneds_t data = f_number_unsigneds_t_initialize; - - { - const f_status_t status = f_number_unsigneds_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_type_array_number_unsigneds_decimate_by__returns_data_not(void **state) { - - const int length = 5; - f_number_unsigneds_t data = f_number_unsigneds_t_initialize; - - { - const f_status_t status = f_number_unsigneds_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_number_unsigneds_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_type_array_number_unsigneds_decimate_by__works(void **state) { - - const int length = 5; - f_number_unsigneds_t data = f_number_unsigneds_t_initialize; - - { - const f_status_t status = f_number_unsigneds_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_number_unsigneds_decimate_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_decimate_by.h deleted file mode 100644 index 42c3cfcdf..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_decimate_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__number_unsigneds_decimate_by -#define _TEST__F_type_array__number_unsigneds_decimate_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_number_unsigneds_decimate_by() - */ -extern void test__f_type_array_number_unsigneds_decimate_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_number_unsigneds_decimate_by() - */ -extern void test__f_type_array_number_unsigneds_decimate_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_number_unsigneds_decimate_by() - */ -extern void test__f_type_array_number_unsigneds_decimate_by__works(void **state); - -#endif // _TEST__F_type_array__number_unsigneds_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_decrease_by.c deleted file mode 100644 index db1acd339..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_decrease_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-number_unsigneds_decrease_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_number_unsigneds_decrease_by__parameter_checking(void **state) { - - const int length = 5; - f_number_unsigneds_t data = f_number_unsigneds_t_initialize; - - { - const f_status_t status = f_number_unsigneds_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_type_array_number_unsigneds_decrease_by__returns_data_not(void **state) { - - const int length = 5; - f_number_unsigneds_t data = f_number_unsigneds_t_initialize; - - { - const f_status_t status = f_number_unsigneds_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_number_unsigneds_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_type_array_number_unsigneds_decrease_by__works(void **state) { - - const int length = 5; - f_number_unsigneds_t data = f_number_unsigneds_t_initialize; - - { - const f_status_t status = f_number_unsigneds_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_number_unsigneds_decrease_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_decrease_by.h deleted file mode 100644 index 9b585d94b..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_decrease_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__number_unsigneds_decrease_by -#define _TEST__F_type_array__number_unsigneds_decrease_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_number_unsigneds_decrease_by() - */ -extern void test__f_type_array_number_unsigneds_decrease_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_number_unsigneds_decrease_by() - */ -extern void test__f_type_array_number_unsigneds_decrease_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_number_unsigneds_decrease_by() - */ -extern void test__f_type_array_number_unsigneds_decrease_by__works(void **state); - -#endif // _TEST__F_type_array__number_unsigneds_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_increase.c deleted file mode 100644 index 4f50ee133..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_increase.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-number_unsigneds_increase.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_number_unsigneds_increase__parameter_checking(void **state) { - - const int length = 5; - f_number_unsigneds_t data = f_number_unsigneds_t_initialize; - - { - const f_status_t status = f_number_unsigneds_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_type_array_number_unsigneds_increase__returns_data_not(void **state) { - - const int length = 5; - f_number_unsigneds_t data = f_number_unsigneds_t_initialize; - - { - const f_status_t status = f_number_unsigneds_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_number_unsigneds_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_type_array_number_unsigneds_increase__works(void **state) { - - const int length = 5; - f_number_unsigneds_t data = f_number_unsigneds_t_initialize; - - { - const f_status_t status = f_number_unsigneds_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_number_unsigneds_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_increase.h deleted file mode 100644 index 7d2cbcaeb..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_increase.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__number_unsigneds_increase -#define _TEST__F_type_array__number_unsigneds_increase - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_number_unsigneds_increase() - */ -extern void test__f_type_array_number_unsigneds_increase__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_number_unsigneds_increase() - */ -extern void test__f_type_array_number_unsigneds_increase__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_number_unsigneds_increase() - */ -extern void test__f_type_array_number_unsigneds_increase__works(void **state); - -#endif // _TEST__F_type_array__number_unsigneds_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_increase_by.c deleted file mode 100644 index 2aef32928..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_increase_by.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-number_unsigneds_increase_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_number_unsigneds_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_number_unsigneds_t data = f_number_unsigneds_t_initialize; - - { - const f_status_t status = f_number_unsigneds_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_type_array_number_unsigneds_increase_by__returns_data_not(void **state) { - - const int length = 5; - f_number_unsigneds_t data = f_number_unsigneds_t_initialize; - - { - const f_status_t status = f_number_unsigneds_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_number_unsigneds_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_type_array_number_unsigneds_increase_by__works(void **state) { - - const int length = 5; - f_number_unsigneds_t data = f_number_unsigneds_t_initialize; - - { - const f_status_t status = f_number_unsigneds_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_number_unsigneds_increase_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_increase_by.h deleted file mode 100644 index 248f699b8..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_increase_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__number_unsigneds_increase_by -#define _TEST__F_type_array__number_unsigneds_increase_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_number_unsigneds_increase_by() - */ -extern void test__f_type_array_number_unsigneds_increase_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_number_unsigneds_increase_by() - */ -extern void test__f_type_array_number_unsigneds_increase_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_number_unsigneds_increase_by() - */ -extern void test__f_type_array_number_unsigneds_increase_by__works(void **state); - -#endif // _TEST__F_type_array__number_unsigneds_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_resize.c deleted file mode 100644 index 852d2447f..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_resize.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-number_unsigneds_resize.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_number_unsigneds_resize__parameter_checking(void **state) { - - const int length = 5; - f_number_unsigneds_t data = f_number_unsigneds_t_initialize; - - { - const f_status_t status = f_number_unsigneds_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_type_array_number_unsigneds_resize__works(void **state) { - - const int length = 5; - f_number_unsigneds_t data = f_number_unsigneds_t_initialize; - - { - const f_status_t status = f_number_unsigneds_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_resize.h deleted file mode 100644 index 274dabba8..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_resize.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__number_unsigneds_resize -#define _TEST__F_type_array__number_unsigneds_resize - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_number_unsigneds_resize() - */ -extern void test__f_type_array_number_unsigneds_resize__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_number_unsigneds_resize() - */ -extern void test__f_type_array_number_unsigneds_resize__works(void **state); - -#endif // _TEST__F_type_array__number_unsigneds_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_resize_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_resize_callback.c new file mode 100644 index 000000000..edf3164d0 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_resize_callback.c @@ -0,0 +1,45 @@ +#include "test-type_array.h" +#include "test-type_array-number_unsigneds_resize_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_number_unsigneds_resize_callback__fails(void **state) { + + f_number_unsigned_t data = f_number_unsigned_t_initialize; + f_number_unsigned_t data_array[] = { data }; + f_number_unsigneds_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_number_unsigneds_t datass_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_resize, true); + will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_number_unsigneds_resize_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_number_unsigneds_resize_callback__works(void **state) { + + f_number_unsigned_t data = f_number_unsigned_t_initialize; + f_number_unsigned_t data_array[] = { data }; + f_number_unsigneds_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_number_unsigneds_t datass_array[] = { datas }; + const f_number_unsigned_t length = 1; + + { + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_none); + + const f_status_t status = f_number_unsigneds_resize_callback(0, length, (void *) datass_array); + + assert_int_equal(status, F_none); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_resize_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_resize_callback.h new file mode 100644 index 000000000..49bda4539 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsigneds_resize_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__number_unsigneds_resize_callback +#define _TEST__F_type_array__number_unsigneds_resize_callback + +/** + * Test that the function fails. + * + * @see f_number_unsigneds_resize_callback() + */ +extern void test__f_type_array_number_unsigneds_resize_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_number_unsigneds_resize_callback() + */ +extern void test__f_type_array_number_unsigneds_resize_callback__works(void **state); + +#endif // _TEST__F_type_array__number_unsigneds_resize_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_adjust.c deleted file mode 100644 index 7ece6deb9..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_adjust.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-number_unsignedss_adjust.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_number_unsignedss_adjust__parameter_checking(void **state) { - - const int length = 5; - f_number_unsignedss_t data = f_number_unsignedss_t_initialize; - - { - const f_status_t status = f_number_unsignedss_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_type_array_number_unsignedss_adjust__works(void **state) { - - const int length = 5; - f_number_unsignedss_t data = f_number_unsignedss_t_initialize; - - { - const f_status_t status = f_number_unsignedss_adjust(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_adjust.h deleted file mode 100644 index 9aa4b180a..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_adjust.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__number_unsignedss_adjust -#define _TEST__F_type_array__number_unsignedss_adjust - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_number_unsignedss_adjust() - */ -extern void test__f_type_array_number_unsignedss_adjust__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_number_unsignedss_adjust() - */ -extern void test__f_type_array_number_unsignedss_adjust__works(void **state); - -#endif // _TEST__F_type_array__number_unsignedss_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_append.c deleted file mode 100644 index 6ba4a4144..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_append.c +++ /dev/null @@ -1,86 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-number_unsignedss_append.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_number_unsignedss_append__parameter_checking(void **state) { - - const f_number_unsigneds_t data = f_number_unsigneds_t_initialize; - - { - const f_status_t status = f_number_unsignedss_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_number_unsignedss_append__returns_data_not(void **state) { - - const int length = 5; - f_number_unsigneds_t source = f_number_unsigneds_t_initialize; - f_number_unsignedss_t destination = f_number_unsignedss_t_initialize; - - { - const f_status_t status = f_number_unsigneds_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_number_unsignedss_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_type_array_number_unsignedss_append__works(void **state) { - - const int length = 5; - f_number_unsigneds_t source = f_number_unsigneds_t_initialize; - f_number_unsignedss_t destination = f_number_unsignedss_t_initialize; - - { - const f_status_t status = f_number_unsigneds_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - for (; source.used < length; ++source.used) { - source.array[source.used] = source.used + 1; - } // for - - { - const f_status_t status = f_number_unsignedss_append(source, &destination); - - assert_int_equal(status, F_none); - 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], i + 1); - } // 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 diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_append.h deleted file mode 100644 index c09eafa91..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_append.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__number_unsignedss_append -#define _TEST__F_type_array__number_unsignedss_append - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_number_unsignedss_append() - */ -extern void test__f_type_array_number_unsignedss_append__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_number_unsignedss_append() - */ -extern void test__f_type_array_number_unsignedss_append__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_number_unsignedss_append() - */ -extern void test__f_type_array_number_unsignedss_append__works(void **state); - -#endif // _TEST__F_type_array__number_unsignedss_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_append_all.c deleted file mode 100644 index 3b29d4ce4..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_append_all.c +++ /dev/null @@ -1,105 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-number_unsignedss_append_all.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_number_unsignedss_append_all__parameter_checking(void **state) { - - const f_number_unsignedss_t data = f_number_unsignedss_t_initialize; - - { - const f_status_t status = f_number_unsignedss_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_number_unsignedss_append_all__returns_data_not(void **state) { - - const int length = 5; - f_number_unsignedss_t source = f_number_unsignedss_t_initialize; - f_number_unsignedss_t destination = f_number_unsignedss_t_initialize; - - { - const f_status_t status = f_number_unsignedss_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_number_unsignedss_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_type_array_number_unsignedss_append_all__works(void **state) { - - const int length = 5; - const int length_inner = 2; - f_number_unsignedss_t source = f_number_unsignedss_t_initialize; - f_number_unsignedss_t destination = f_number_unsignedss_t_initialize; - - { - const f_status_t status = f_number_unsignedss_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - for (; source.used < length; ++source.used) { - - const f_status_t status = f_number_unsigneds_resize(length_inner, &source.array[source.used]); - - assert_int_equal(status, F_none); - - for (f_number_unsigned_t i = 0; i < length_inner; ++i) { - source.array[source.used].array[source.array[source.used].used++] = i + 1; - } // for - } // for - } - - { - const f_status_t status = f_number_unsignedss_append_all(source, &destination); - - assert_int_equal(status, F_none); - assert_int_equal(destination.used, source.used); - assert_int_equal(destination.size, source.used); - - for (f_number_unsigned_t i = 0; i < destination.used; ++i) { - - assert_int_equal(destination.array[i].used, length_inner); - assert_int_equal(destination.array[i].size, length_inner); - - for (f_number_unsigned_t j = 0; j < length_inner; ++j) { - assert_int_equal(destination.array[i].array[j], j + 1); - } // 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 diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_append_all.h deleted file mode 100644 index 51eeb5242..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_append_all.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__number_unsignedss_append_all -#define _TEST__F_type_array__number_unsignedss_append_all - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_number_unsignedss_append_all() - */ -extern void test__f_type_array_number_unsignedss_append_all__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_number_unsignedss_append_all() - */ -extern void test__f_type_array_number_unsignedss_append_all__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_number_unsignedss_append_all() - */ -extern void test__f_type_array_number_unsignedss_append_all__works(void **state); - -#endif // _TEST__F_type_array__number_unsignedss_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_decimate_by.c deleted file mode 100644 index 9abf13bc9..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_decimate_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-number_unsignedss_decimate_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_number_unsignedss_decimate_by__parameter_checking(void **state) { - - const int length = 5; - f_number_unsignedss_t data = f_number_unsigneds_t_initialize; - - { - const f_status_t status = f_number_unsignedss_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_type_array_number_unsignedss_decimate_by__returns_data_not(void **state) { - - const int length = 5; - f_number_unsignedss_t data = f_number_unsignedss_t_initialize; - - { - const f_status_t status = f_number_unsignedss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_number_unsignedss_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_type_array_number_unsignedss_decimate_by__works(void **state) { - - const int length = 5; - f_number_unsignedss_t data = f_number_unsigneds_t_initialize; - - { - const f_status_t status = f_number_unsignedss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_number_unsignedss_decimate_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_decimate_by.h deleted file mode 100644 index 00cd2b923..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_decimate_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__number_unsignedss_decimate_by -#define _TEST__F_type_array__number_unsignedss_decimate_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_number_unsignedss_decimate_by() - */ -extern void test__f_type_array_number_unsignedss_decimate_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_type_array_number_unsignedss_decimate_by() - */ -extern void test__f_type_array_number_unsignedss_decimate_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_number_unsignedss_decimate_by() - */ -extern void test__f_type_array_number_unsignedss_decimate_by__works(void **state); - -#endif // _TEST__F_type_array__number_unsignedss_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_decrease_by.c deleted file mode 100644 index e8e3fb159..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_decrease_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-number_unsignedss_decrease_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_number_unsignedss_decrease_by__parameter_checking(void **state) { - - const int length = 5; - f_number_unsignedss_t data = f_number_unsigneds_t_initialize; - - { - const f_status_t status = f_number_unsignedss_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_type_array_number_unsignedss_decrease_by__returns_data_not(void **state) { - - const int length = 5; - f_number_unsignedss_t data = f_number_unsignedss_t_initialize; - - { - const f_status_t status = f_number_unsignedss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_number_unsignedss_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_type_array_number_unsignedss_decrease_by__works(void **state) { - - const int length = 5; - f_number_unsignedss_t data = f_number_unsigneds_t_initialize; - - { - const f_status_t status = f_number_unsignedss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_number_unsignedss_decrease_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_decrease_by.h deleted file mode 100644 index de9d1ddba..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_decrease_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__number_unsignedss_decrease_by -#define _TEST__F_type_array__number_unsignedss_decrease_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_number_unsignedss_decrease_by() - */ -extern void test__f_type_array_number_unsignedss_decrease_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_number_unsignedss_decrease_by() - */ -extern void test__f_type_array_number_unsignedss_decrease_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_number_unsignedss_decrease_by() - */ -extern void test__f_type_array_number_unsignedss_decrease_by__works(void **state); - -#endif // _TEST__F_type_array__number_unsignedss_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_increase.c deleted file mode 100644 index 82fa6578a..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_increase.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-number_unsignedss_increase.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_number_unsignedss_increase__parameter_checking(void **state) { - - const int length = 5; - f_number_unsignedss_t data = f_number_unsigneds_t_initialize; - - { - const f_status_t status = f_number_unsignedss_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_type_array_number_unsignedss_increase__returns_data_not(void **state) { - - const int length = 5; - f_number_unsignedss_t data = f_number_unsigneds_t_initialize; - - { - const f_status_t status = f_number_unsignedss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_number_unsignedss_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_type_array_number_unsignedss_increase__works(void **state) { - - const int length = 5; - f_number_unsignedss_t data = f_number_unsigneds_t_initialize; - - { - const f_status_t status = f_number_unsignedss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_number_unsignedss_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_increase.h deleted file mode 100644 index 31e742662..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_increase.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__number_unsignedss_increase -#define _TEST__F_type_array__number_unsignedss_increase - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_number_unsignedss_increase() - */ -extern void test__f_type_array_number_unsignedss_increase__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_number_unsignedss_increase() - */ -extern void test__f_type_array_number_unsignedss_increase__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_number_unsignedss_increase() - */ -extern void test__f_type_array_number_unsignedss_increase__works(void **state); - -#endif // _TEST__F_type_array__number_unsignedss_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_increase_by.c deleted file mode 100644 index fb9fa4e13..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_increase_by.c +++ /dev/null @@ -1,84 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-number_unsignedss_increase_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_number_unsignedss_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_number_unsignedss_t data = f_number_unsigneds_t_initialize; - - { - const f_status_t status = f_number_unsignedss_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_type_array_number_unsignedss_increase_by__returns_data_not(void **state) { - - const int length = 5; - f_number_unsignedss_t data = f_number_unsignedss_t_initialize; - - { - const f_status_t status = f_number_unsignedss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_number_unsignedss_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_number_unsignedss_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_type_array_number_unsignedss_increase_by__works(void **state) { - - const int length = 5; - f_number_unsignedss_t data = f_number_unsigneds_t_initialize; - - { - const f_status_t status = f_number_unsignedss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_number_unsignedss_increase_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_increase_by.h deleted file mode 100644 index 254b9fe7f..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_increase_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__number_unsignedss_increase_by -#define _TEST__F_type_array__number_unsignedss_increase_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_number_unsignedss_increase_by() - */ -extern void test__f_type_array_number_unsignedss_increase_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_number_unsignedss_increase_by() - */ -extern void test__f_type_array_number_unsignedss_increase_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_number_unsignedss_increase_by() - */ -extern void test__f_type_array_number_unsignedss_increase_by__works(void **state); - -#endif // _TEST__F_type_array__number_unsignedss_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_resize.c deleted file mode 100644 index e629438fc..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_resize.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-number_unsignedss_resize.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_number_unsignedss_resize__parameter_checking(void **state) { - - const int length = 5; - f_number_unsignedss_t data = f_number_unsignedss_t_initialize; - - { - const f_status_t status = f_number_unsignedss_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_type_array_number_unsignedss_resize__works(void **state) { - - const int length = 5; - f_number_unsignedss_t data = f_number_unsignedss_t_initialize; - - { - const f_status_t status = f_number_unsignedss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_resize.h deleted file mode 100644 index 34395fc7c..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsignedss_resize.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__number_unsignedss_resize -#define _TEST__F_type_array__number_unsignedss_resize - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_number_unsignedss_resize() - */ -extern void test__f_type_array_number_unsignedss_resize__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_number_unsignedss_resize() - */ -extern void test__f_type_array_number_unsignedss_resize__works(void **state); - -#endif // _TEST__F_type_array__number_unsignedss_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsingedss_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsingedss_adjust.c deleted file mode 100644 index 7ece6deb9..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsingedss_adjust.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-number_unsignedss_adjust.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_number_unsignedss_adjust__parameter_checking(void **state) { - - const int length = 5; - f_number_unsignedss_t data = f_number_unsignedss_t_initialize; - - { - const f_status_t status = f_number_unsignedss_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_type_array_number_unsignedss_adjust__works(void **state) { - - const int length = 5; - f_number_unsignedss_t data = f_number_unsignedss_t_initialize; - - { - const f_status_t status = f_number_unsignedss_adjust(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsingedss_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsingedss_adjust.h deleted file mode 100644 index 9aa4b180a..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsingedss_adjust.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__number_unsignedss_adjust -#define _TEST__F_type_array__number_unsignedss_adjust - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_number_unsignedss_adjust() - */ -extern void test__f_type_array_number_unsignedss_adjust__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_number_unsignedss_adjust() - */ -extern void test__f_type_array_number_unsignedss_adjust__works(void **state); - -#endif // _TEST__F_type_array__number_unsignedss_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsingedss_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsingedss_append.c deleted file mode 100644 index 6ba4a4144..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsingedss_append.c +++ /dev/null @@ -1,86 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-number_unsignedss_append.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_number_unsignedss_append__parameter_checking(void **state) { - - const f_number_unsigneds_t data = f_number_unsigneds_t_initialize; - - { - const f_status_t status = f_number_unsignedss_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_number_unsignedss_append__returns_data_not(void **state) { - - const int length = 5; - f_number_unsigneds_t source = f_number_unsigneds_t_initialize; - f_number_unsignedss_t destination = f_number_unsignedss_t_initialize; - - { - const f_status_t status = f_number_unsigneds_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_number_unsignedss_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_type_array_number_unsignedss_append__works(void **state) { - - const int length = 5; - f_number_unsigneds_t source = f_number_unsigneds_t_initialize; - f_number_unsignedss_t destination = f_number_unsignedss_t_initialize; - - { - const f_status_t status = f_number_unsigneds_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - for (; source.used < length; ++source.used) { - source.array[source.used] = source.used + 1; - } // for - - { - const f_status_t status = f_number_unsignedss_append(source, &destination); - - assert_int_equal(status, F_none); - 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], i + 1); - } // 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 diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsingedss_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsingedss_append.h deleted file mode 100644 index c09eafa91..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsingedss_append.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__number_unsignedss_append -#define _TEST__F_type_array__number_unsignedss_append - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_number_unsignedss_append() - */ -extern void test__f_type_array_number_unsignedss_append__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_number_unsignedss_append() - */ -extern void test__f_type_array_number_unsignedss_append__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_number_unsignedss_append() - */ -extern void test__f_type_array_number_unsignedss_append__works(void **state); - -#endif // _TEST__F_type_array__number_unsignedss_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsingedss_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsingedss_append_all.c deleted file mode 100644 index 3b29d4ce4..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsingedss_append_all.c +++ /dev/null @@ -1,105 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-number_unsignedss_append_all.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_number_unsignedss_append_all__parameter_checking(void **state) { - - const f_number_unsignedss_t data = f_number_unsignedss_t_initialize; - - { - const f_status_t status = f_number_unsignedss_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_number_unsignedss_append_all__returns_data_not(void **state) { - - const int length = 5; - f_number_unsignedss_t source = f_number_unsignedss_t_initialize; - f_number_unsignedss_t destination = f_number_unsignedss_t_initialize; - - { - const f_status_t status = f_number_unsignedss_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_number_unsignedss_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_type_array_number_unsignedss_append_all__works(void **state) { - - const int length = 5; - const int length_inner = 2; - f_number_unsignedss_t source = f_number_unsignedss_t_initialize; - f_number_unsignedss_t destination = f_number_unsignedss_t_initialize; - - { - const f_status_t status = f_number_unsignedss_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - for (; source.used < length; ++source.used) { - - const f_status_t status = f_number_unsigneds_resize(length_inner, &source.array[source.used]); - - assert_int_equal(status, F_none); - - for (f_number_unsigned_t i = 0; i < length_inner; ++i) { - source.array[source.used].array[source.array[source.used].used++] = i + 1; - } // for - } // for - } - - { - const f_status_t status = f_number_unsignedss_append_all(source, &destination); - - assert_int_equal(status, F_none); - assert_int_equal(destination.used, source.used); - assert_int_equal(destination.size, source.used); - - for (f_number_unsigned_t i = 0; i < destination.used; ++i) { - - assert_int_equal(destination.array[i].used, length_inner); - assert_int_equal(destination.array[i].size, length_inner); - - for (f_number_unsigned_t j = 0; j < length_inner; ++j) { - assert_int_equal(destination.array[i].array[j], j + 1); - } // 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 diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsingedss_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsingedss_append_all.h deleted file mode 100644 index 51eeb5242..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsingedss_append_all.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__number_unsignedss_append_all -#define _TEST__F_type_array__number_unsignedss_append_all - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_number_unsignedss_append_all() - */ -extern void test__f_type_array_number_unsignedss_append_all__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_number_unsignedss_append_all() - */ -extern void test__f_type_array_number_unsignedss_append_all__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_number_unsignedss_append_all() - */ -extern void test__f_type_array_number_unsignedss_append_all__works(void **state); - -#endif // _TEST__F_type_array__number_unsignedss_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsingedss_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsingedss_decimate_by.c deleted file mode 100644 index 9abf13bc9..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsingedss_decimate_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-number_unsignedss_decimate_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_number_unsignedss_decimate_by__parameter_checking(void **state) { - - const int length = 5; - f_number_unsignedss_t data = f_number_unsigneds_t_initialize; - - { - const f_status_t status = f_number_unsignedss_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_type_array_number_unsignedss_decimate_by__returns_data_not(void **state) { - - const int length = 5; - f_number_unsignedss_t data = f_number_unsignedss_t_initialize; - - { - const f_status_t status = f_number_unsignedss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_number_unsignedss_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_type_array_number_unsignedss_decimate_by__works(void **state) { - - const int length = 5; - f_number_unsignedss_t data = f_number_unsigneds_t_initialize; - - { - const f_status_t status = f_number_unsignedss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_number_unsignedss_decimate_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsingedss_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsingedss_decimate_by.h deleted file mode 100644 index 1f53c1613..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsingedss_decimate_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__number_unsignedss_decimate_by -#define _TEST__F_type_array__number_unsignedss_decimate_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_number_unsignedss_decimate_by() - */ -extern void test__f_type_array_number_unsignedss_decimate_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_number_unsignedss_decimate_by() - */ -extern void test__f_type_array_number_unsignedss_decimate_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_number_unsignedss_decimate_by() - */ -extern void test__f_type_array_number_unsignedss_decimate_by__works(void **state); - -#endif // _TEST__F_type_array__number_unsignedss_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsingedss_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsingedss_decrease_by.c deleted file mode 100644 index e8e3fb159..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsingedss_decrease_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-number_unsignedss_decrease_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_number_unsignedss_decrease_by__parameter_checking(void **state) { - - const int length = 5; - f_number_unsignedss_t data = f_number_unsigneds_t_initialize; - - { - const f_status_t status = f_number_unsignedss_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_type_array_number_unsignedss_decrease_by__returns_data_not(void **state) { - - const int length = 5; - f_number_unsignedss_t data = f_number_unsignedss_t_initialize; - - { - const f_status_t status = f_number_unsignedss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_number_unsignedss_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_type_array_number_unsignedss_decrease_by__works(void **state) { - - const int length = 5; - f_number_unsignedss_t data = f_number_unsigneds_t_initialize; - - { - const f_status_t status = f_number_unsignedss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_number_unsignedss_decrease_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsingedss_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsingedss_decrease_by.h deleted file mode 100644 index de9d1ddba..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsingedss_decrease_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__number_unsignedss_decrease_by -#define _TEST__F_type_array__number_unsignedss_decrease_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_number_unsignedss_decrease_by() - */ -extern void test__f_type_array_number_unsignedss_decrease_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_number_unsignedss_decrease_by() - */ -extern void test__f_type_array_number_unsignedss_decrease_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_number_unsignedss_decrease_by() - */ -extern void test__f_type_array_number_unsignedss_decrease_by__works(void **state); - -#endif // _TEST__F_type_array__number_unsignedss_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsingedss_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsingedss_increase.c deleted file mode 100644 index 82fa6578a..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsingedss_increase.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-number_unsignedss_increase.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_number_unsignedss_increase__parameter_checking(void **state) { - - const int length = 5; - f_number_unsignedss_t data = f_number_unsigneds_t_initialize; - - { - const f_status_t status = f_number_unsignedss_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_type_array_number_unsignedss_increase__returns_data_not(void **state) { - - const int length = 5; - f_number_unsignedss_t data = f_number_unsigneds_t_initialize; - - { - const f_status_t status = f_number_unsignedss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_number_unsignedss_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_type_array_number_unsignedss_increase__works(void **state) { - - const int length = 5; - f_number_unsignedss_t data = f_number_unsigneds_t_initialize; - - { - const f_status_t status = f_number_unsignedss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_number_unsignedss_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsingedss_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsingedss_increase.h deleted file mode 100644 index 31e742662..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsingedss_increase.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__number_unsignedss_increase -#define _TEST__F_type_array__number_unsignedss_increase - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_number_unsignedss_increase() - */ -extern void test__f_type_array_number_unsignedss_increase__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_number_unsignedss_increase() - */ -extern void test__f_type_array_number_unsignedss_increase__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_number_unsignedss_increase() - */ -extern void test__f_type_array_number_unsignedss_increase__works(void **state); - -#endif // _TEST__F_type_array__number_unsignedss_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsingedss_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsingedss_increase_by.c deleted file mode 100644 index fb9fa4e13..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsingedss_increase_by.c +++ /dev/null @@ -1,84 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-number_unsignedss_increase_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_number_unsignedss_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_number_unsignedss_t data = f_number_unsigneds_t_initialize; - - { - const f_status_t status = f_number_unsignedss_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_type_array_number_unsignedss_increase_by__returns_data_not(void **state) { - - const int length = 5; - f_number_unsignedss_t data = f_number_unsignedss_t_initialize; - - { - const f_status_t status = f_number_unsignedss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_number_unsignedss_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_number_unsignedss_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_type_array_number_unsignedss_increase_by__works(void **state) { - - const int length = 5; - f_number_unsignedss_t data = f_number_unsigneds_t_initialize; - - { - const f_status_t status = f_number_unsignedss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_number_unsignedss_increase_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsingedss_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsingedss_increase_by.h deleted file mode 100644 index 254b9fe7f..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsingedss_increase_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__number_unsignedss_increase_by -#define _TEST__F_type_array__number_unsignedss_increase_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_number_unsignedss_increase_by() - */ -extern void test__f_type_array_number_unsignedss_increase_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_number_unsignedss_increase_by() - */ -extern void test__f_type_array_number_unsignedss_increase_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_number_unsignedss_increase_by() - */ -extern void test__f_type_array_number_unsignedss_increase_by__works(void **state); - -#endif // _TEST__F_type_array__number_unsignedss_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsingedss_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsingedss_resize.c deleted file mode 100644 index e629438fc..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsingedss_resize.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-number_unsignedss_resize.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_number_unsignedss_resize__parameter_checking(void **state) { - - const int length = 5; - f_number_unsignedss_t data = f_number_unsignedss_t_initialize; - - { - const f_status_t status = f_number_unsignedss_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_type_array_number_unsignedss_resize__works(void **state) { - - const int length = 5; - f_number_unsignedss_t data = f_number_unsignedss_t_initialize; - - { - const f_status_t status = f_number_unsignedss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsingedss_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-number_unsingedss_resize.h deleted file mode 100644 index 34395fc7c..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-number_unsingedss_resize.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__number_unsignedss_resize -#define _TEST__F_type_array__number_unsignedss_resize - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_number_unsignedss_resize() - */ -extern void test__f_type_array_number_unsignedss_resize__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_number_unsignedss_resize() - */ -extern void test__f_type_array_number_unsignedss_resize__works(void **state); - -#endif // _TEST__F_type_array__number_unsignedss_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-polls_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-polls_adjust.c deleted file mode 100644 index 3b8669fc2..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-polls_adjust.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-polls_adjust.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_polls_adjust__parameter_checking(void **poll) { - - const int length = 5; - f_polls_t data = f_polls_t_initialize; - - { - const f_status_t status = f_polls_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_type_array_polls_adjust__works(void **poll) { - - const int length = 5; - f_polls_t data = f_polls_t_initialize; - - { - const f_status_t status = f_polls_adjust(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-polls_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-polls_adjust.h deleted file mode 100644 index 540f21c70..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-polls_adjust.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__polls_adjust -#define _TEST__F_type_array__polls_adjust - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_polls_adjust() - */ -extern void test__f_type_array_polls_adjust__parameter_checking(void **poll); - -/** - * Test that the function works. - * - * @see f_polls_adjust() - */ -extern void test__f_type_array_polls_adjust__works(void **poll); - -#endif // _TEST__F_type_array__polls_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-polls_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-polls_append.c deleted file mode 100644 index f455a427b..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-polls_append.c +++ /dev/null @@ -1,39 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-polls_append.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_polls_append__parameter_checking(void **poll) { - - const f_poll_t data = f_poll_t_initialize; - - { - const f_status_t status = f_polls_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_polls_append__works(void **poll) { - - const f_poll_t source = macro_f_poll_t_initialize_1(0, 1, 2); - f_polls_t destination = f_polls_t_initialize; - - { - const f_status_t status = f_polls_append(source, &destination); - - assert_int_equal(status, F_none); - assert_int_equal(destination.used, 1); - assert_int_equal(destination.array[0].fd, source.fd); - assert_int_equal(destination.array[0].events, source.events); - assert_int_equal(destination.array[0].revents, source.revents); - } - - free((void *) destination.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-polls_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-polls_append.h deleted file mode 100644 index 3b5b519da..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-polls_append.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__polls_append -#define _TEST__F_type_array__polls_append - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_polls_append() - */ -extern void test__f_type_array_polls_append__parameter_checking(void **poll); - -/** - * Test that the function works. - * - * @see f_polls_append() - */ -extern void test__f_type_array_polls_append__works(void **poll); - -#endif // _TEST__F_type_array__polls_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-polls_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-polls_append_all.c deleted file mode 100644 index 25f096c54..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-polls_append_all.c +++ /dev/null @@ -1,86 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-polls_append_all.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_polls_append_all__parameter_checking(void **poll) { - - const f_polls_t data = f_polls_t_initialize; - - { - const f_status_t status = f_polls_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_polls_append_all__returns_data_not(void **poll) { - - const int length = 5; - f_polls_t source = f_polls_t_initialize; - f_polls_t destination = f_polls_t_initialize; - - { - const f_status_t status = f_polls_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_polls_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_type_array_polls_append_all__works(void **poll) { - - const int length = 5; - f_polls_t source = f_polls_t_initialize; - f_polls_t destination = f_polls_t_initialize; - - const f_poll_t poll_0 = { 0, 1, 2 }; - const f_poll_t poll_1 = { 0, 2, 3 }; - - { - const f_status_t status = f_polls_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - memcpy(&source.array[source.used++], (void *) &poll_0, sizeof(f_poll_t)); - memcpy(&source.array[source.used++], (void *) &poll_1, sizeof(f_poll_t)); - - { - const f_status_t status = f_polls_append_all(source, &destination); - - assert_int_equal(status, F_none); - assert_int_equal(destination.used, source.used); - assert_int_equal(destination.size, source.used); - - for (f_number_unsigned_t i = 0; i < source.used; ++i) { - - assert_int_equal(destination.array[i].fd, source.array[i].fd); - assert_int_equal(destination.array[i].events, source.array[i].events); - assert_int_equal(destination.array[i].revents, source.array[i].revents); - } // for - } - - free((void *) source.array); - free((void *) destination.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-polls_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-polls_append_all.h deleted file mode 100644 index 15bf28fda..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-polls_append_all.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__polls_append_all -#define _TEST__F_type_array__polls_append_all - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_polls_append_all() - */ -extern void test__f_type_array_polls_append_all__parameter_checking(void **poll); - -/** - * Test that the function returns F_data_not. - * - * @see f_polls_append_all() - */ -extern void test__f_type_array_polls_append_all__returns_data_not(void **poll); - -/** - * Test that the function works. - * - * @see f_polls_append_all() - */ -extern void test__f_type_array_polls_append_all__works(void **poll); - -#endif // _TEST__F_type_array__polls_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-polls_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-polls_decimate_by.c deleted file mode 100644 index 7efb15173..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-polls_decimate_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-polls_decimate_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_polls_decimate_by__parameter_checking(void **poll) { - - const int length = 5; - f_polls_t data = f_polls_t_initialize; - - { - const f_status_t status = f_polls_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_type_array_polls_decimate_by__returns_data_not(void **poll) { - - const int length = 5; - f_polls_t data = f_polls_t_initialize; - - { - const f_status_t status = f_polls_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_polls_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_type_array_polls_decimate_by__works(void **poll) { - - const int length = 5; - f_polls_t data = f_polls_t_initialize; - - { - const f_status_t status = f_polls_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_polls_decimate_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-polls_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-polls_decimate_by.h deleted file mode 100644 index 359403feb..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-polls_decimate_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__polls_decimate_by -#define _TEST__F_type_array__polls_decimate_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_polls_decimate_by() - */ -extern void test__f_type_array_polls_decimate_by__parameter_checking(void **poll); - -/** - * Test that the function returns F_data_not. - * - * @see f_polls_decimate_by() - */ -extern void test__f_type_array_polls_decimate_by__returns_data_not(void **poll); - -/** - * Test that the function works. - * - * @see f_polls_decimate_by() - */ -extern void test__f_type_array_polls_decimate_by__works(void **poll); - -#endif // _TEST__F_type_array__polls_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-polls_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-polls_decrease_by.c deleted file mode 100644 index 1c7fb649b..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-polls_decrease_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-polls_decrease_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_polls_decrease_by__parameter_checking(void **poll) { - - const int length = 5; - f_polls_t data = f_polls_t_initialize; - - { - const f_status_t status = f_polls_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_type_array_polls_decrease_by__returns_data_not(void **poll) { - - const int length = 5; - f_polls_t data = f_polls_t_initialize; - - { - const f_status_t status = f_polls_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_polls_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_type_array_polls_decrease_by__works(void **poll) { - - const int length = 5; - f_polls_t data = f_polls_t_initialize; - - { - const f_status_t status = f_polls_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_polls_decrease_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-polls_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-polls_decrease_by.h deleted file mode 100644 index 3024366bf..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-polls_decrease_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__polls_decrease_by -#define _TEST__F_type_array__polls_decrease_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_polls_decrease_by() - */ -extern void test__f_type_array_polls_decrease_by__parameter_checking(void **poll); - -/** - * Test that the function returns F_data_not. - * - * @see f_polls_decrease_by() - */ -extern void test__f_type_array_polls_decrease_by__returns_data_not(void **poll); - -/** - * Test that the function works. - * - * @see f_polls_decrease_by() - */ -extern void test__f_type_array_polls_decrease_by__works(void **poll); - -#endif // _TEST__F_type_array__polls_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-polls_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-polls_increase.c deleted file mode 100644 index f5a882625..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-polls_increase.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-polls_increase.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_polls_increase__parameter_checking(void **poll) { - - const int length = 5; - f_polls_t data = f_polls_t_initialize; - - { - const f_status_t status = f_polls_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_type_array_polls_increase__returns_data_not(void **poll) { - - const int length = 5; - f_polls_t data = f_polls_t_initialize; - - { - const f_status_t status = f_polls_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_polls_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_type_array_polls_increase__works(void **poll) { - - const int length = 5; - f_polls_t data = f_polls_t_initialize; - - { - const f_status_t status = f_polls_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_polls_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-polls_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-polls_increase.h deleted file mode 100644 index 485664699..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-polls_increase.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__polls_increase -#define _TEST__F_type_array__polls_increase - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_polls_increase() - */ -extern void test__f_type_array_polls_increase__parameter_checking(void **poll); - -/** - * Test that the function returns F_data_not. - * - * @see f_polls_increase() - */ -extern void test__f_type_array_polls_increase__returns_data_not(void **poll); - -/** - * Test that the function works. - * - * @see f_polls_increase() - */ -extern void test__f_type_array_polls_increase__works(void **poll); - -#endif // _TEST__F_type_array__polls_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-polls_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-polls_increase_by.c deleted file mode 100644 index 535b4f356..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-polls_increase_by.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-polls_increase_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_polls_increase_by__parameter_checking(void **poll) { - - const int length = 5; - f_polls_t data = f_polls_t_initialize; - - { - const f_status_t status = f_polls_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_type_array_polls_increase_by__returns_data_not(void **poll) { - - const int length = 5; - f_polls_t data = f_polls_t_initialize; - - { - const f_status_t status = f_polls_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_polls_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_type_array_polls_increase_by__works(void **poll) { - - const int length = 5; - f_polls_t data = f_polls_t_initialize; - - { - const f_status_t status = f_polls_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_polls_increase_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-polls_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-polls_increase_by.h deleted file mode 100644 index f6356c471..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-polls_increase_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__polls_increase_by -#define _TEST__F_type_array__polls_increase_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_polls_increase_by() - */ -extern void test__f_type_array_polls_increase_by__parameter_checking(void **poll); - -/** - * Test that the function returns F_data_not. - * - * @see f_polls_increase_by() - */ -extern void test__f_type_array_polls_increase_by__returns_data_not(void **poll); - -/** - * Test that the function works. - * - * @see f_polls_increase_by() - */ -extern void test__f_type_array_polls_increase_by__works(void **poll); - -#endif // _TEST__F_type_array__polls_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-polls_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-polls_resize.c deleted file mode 100644 index 87f01e203..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-polls_resize.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-polls_resize.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_polls_resize__parameter_checking(void **poll) { - - const int length = 5; - f_polls_t data = f_polls_t_initialize; - - { - const f_status_t status = f_polls_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_type_array_polls_resize__works(void **poll) { - - const int length = 5; - f_polls_t data = f_polls_t_initialize; - - { - const f_status_t status = f_polls_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-polls_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-polls_resize.h deleted file mode 100644 index 52e3e9439..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-polls_resize.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__polls_resize -#define _TEST__F_type_array__polls_resize - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_polls_resize() - */ -extern void test__f_type_array_polls_resize__parameter_checking(void **poll); - -/** - * Test that the function works. - * - * @see f_polls_resize() - */ -extern void test__f_type_array_polls_resize__works(void **poll); - -#endif // _TEST__F_type_array__polls_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-pollss_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-pollss_adjust.c deleted file mode 100644 index 007cf1a1d..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-pollss_adjust.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-pollss_adjust.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_pollss_adjust__parameter_checking(void **poll) { - - const int length = 5; - f_pollss_t data = f_pollss_t_initialize; - - { - const f_status_t status = f_pollss_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_type_array_pollss_adjust__works(void **poll) { - - const int length = 5; - f_pollss_t data = f_pollss_t_initialize; - - { - const f_status_t status = f_pollss_adjust(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-pollss_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-pollss_adjust.h deleted file mode 100644 index 51481a3ab..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-pollss_adjust.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__pollss_adjust -#define _TEST__F_type_array__pollss_adjust - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_pollss_adjust() - */ -extern void test__f_type_array_pollss_adjust__parameter_checking(void **poll); - -/** - * Test that the function works. - * - * @see f_pollss_adjust() - */ -extern void test__f_type_array_pollss_adjust__works(void **poll); - -#endif // _TEST__F_type_array__pollss_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-pollss_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-pollss_append.c deleted file mode 100644 index 8f22b0226..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-pollss_append.c +++ /dev/null @@ -1,91 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-pollss_append.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_pollss_append__parameter_checking(void **poll) { - - f_polls_t data = f_polls_t_initialize; - - { - const f_status_t status = f_pollss_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_pollss_append__returns_data_not(void **poll) { - - const int length = 5; - f_polls_t source = f_polls_t_initialize; - f_pollss_t destination = f_pollss_t_initialize; - - { - const f_status_t status = f_polls_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_pollss_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_type_array_pollss_append__works(void **poll) { - - const int length = 5; - f_polls_t source = f_polls_t_initialize; - f_pollss_t destination = f_pollss_t_initialize; - - const f_poll_t poll_data = macro_f_poll_t_initialize_1(0, 1, 2); - - { - const f_status_t status = f_polls_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - while (source.used < length) { - memcpy(&source.array[source.used++], (void *) &poll_data, sizeof(f_poll_t)); - } // while - - { - const f_status_t status = f_pollss_append(source, &destination); - - assert_int_equal(status, F_none); - 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].fd, source.array[0].fd); - assert_int_equal(destination.array[0].array[i].events, source.array[0].events); - assert_int_equal(destination.array[0].array[i].revents, source.array[0].revents); - } // 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 diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-pollss_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-pollss_append.h deleted file mode 100644 index c61f63e5e..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-pollss_append.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__pollss_append -#define _TEST__F_type_array__pollss_append - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_pollss_append() - */ -extern void test__f_type_array_pollss_append__parameter_checking(void **poll); - -/** - * Test that the function returns F_data_not. - * - * @see f_pollss_append() - */ -extern void test__f_type_array_pollss_append__returns_data_not(void **poll); - -/** - * Test that the function works. - * - * @see f_pollss_append() - */ -extern void test__f_type_array_pollss_append__works(void **poll); - -#endif // _TEST__F_type_array__pollss_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-pollss_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-pollss_append_all.c deleted file mode 100644 index a8be357f3..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-pollss_append_all.c +++ /dev/null @@ -1,110 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-pollss_append_all.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_pollss_append_all__parameter_checking(void **poll) { - - const f_pollss_t data = f_pollss_t_initialize; - - { - const f_status_t status = f_pollss_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_pollss_append_all__returns_data_not(void **poll) { - - const int length = 5; - f_pollss_t source = f_pollss_t_initialize; - f_pollss_t destination = f_pollss_t_initialize; - - { - const f_status_t status = f_pollss_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_pollss_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_type_array_pollss_append_all__works(void **poll) { - - const int length = 5; - const int length_inner = 2; - f_pollss_t source = f_pollss_t_initialize; - f_pollss_t destination = f_pollss_t_initialize; - - const f_poll_t poll_0 = { 0, 1, 2 }; - const f_poll_t poll_1 = { 0, 3, 4 }; - - { - const f_status_t status = f_pollss_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - for (; source.used < length; ++source.used) { - - const f_status_t status = f_polls_resize(length_inner, &source.array[source.used]); - - assert_int_equal(status, F_none); - - memcpy(&source.array[source.used].array[source.array[source.used].used++], (void *) &poll_0, sizeof(f_poll_t)); - memcpy(&source.array[source.used].array[source.array[source.used].used++], (void *) &poll_1, sizeof(f_poll_t)); - } // for - } - - { - const f_status_t status = f_pollss_append_all(source, &destination); - - assert_int_equal(status, F_none); - assert_int_equal(destination.used, source.used); - assert_int_equal(destination.size, source.used); - - for (f_number_unsigned_t i = 0; i < destination.used; ++i) { - - assert_int_equal(destination.array[i].used, length_inner); - assert_int_equal(destination.array[i].size, length_inner); - - for (f_number_unsigned_t j = 0; j < length_inner; ++j) { - - assert_int_equal(destination.array[i].array[j].fd, source.array[i].array[j].fd); - assert_int_equal(destination.array[i].array[j].events, source.array[i].array[j].events); - assert_int_equal(destination.array[i].array[j].revents, source.array[i].array[j].revents); - } // 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 diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-pollss_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-pollss_append_all.h deleted file mode 100644 index b07cfb03d..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-pollss_append_all.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__pollss_append_all -#define _TEST__F_type_array__pollss_append_all - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_pollss_append_all() - */ -extern void test__f_type_array_pollss_append_all__parameter_checking(void **poll); - -/** - * Test that the function returns F_data_not. - * - * @see f_pollss_append_all() - */ -extern void test__f_type_array_pollss_append_all__returns_data_not(void **poll); - -/** - * Test that the function works. - * - * @see f_pollss_append_all() - */ -extern void test__f_type_array_pollss_append_all__works(void **poll); - -#endif // _TEST__F_type_array__pollss_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-pollss_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-pollss_decimate_by.c deleted file mode 100644 index f76b13619..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-pollss_decimate_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-pollss_decimate_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_pollss_decimate_by__parameter_checking(void **poll) { - - const int length = 5; - f_pollss_t data = f_polls_t_initialize; - - { - const f_status_t status = f_pollss_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_type_array_pollss_decimate_by__returns_data_not(void **poll) { - - const int length = 5; - f_pollss_t data = f_pollss_t_initialize; - - { - const f_status_t status = f_pollss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_pollss_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_type_array_pollss_decimate_by__works(void **poll) { - - const int length = 5; - f_pollss_t data = f_polls_t_initialize; - - { - const f_status_t status = f_pollss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_pollss_decimate_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-pollss_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-pollss_decimate_by.h deleted file mode 100644 index d67aed4d9..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-pollss_decimate_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__pollss_decimate_by -#define _TEST__F_type_array__pollss_decimate_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_pollss_decimate_by() - */ -extern void test__f_type_array_pollss_decimate_by__parameter_checking(void **poll); - -/** - * Test that the function returns F_data_not. - * - * @see f_type_array_pollss_decimate_by() - */ -extern void test__f_type_array_pollss_decimate_by__returns_data_not(void **poll); - -/** - * Test that the function works. - * - * @see f_pollss_decimate_by() - */ -extern void test__f_type_array_pollss_decimate_by__works(void **poll); - -#endif // _TEST__F_type_array__pollss_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-pollss_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-pollss_decrease_by.c deleted file mode 100644 index 68bc83624..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-pollss_decrease_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-pollss_decrease_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_pollss_decrease_by__parameter_checking(void **poll) { - - const int length = 5; - f_pollss_t data = f_polls_t_initialize; - - { - const f_status_t status = f_pollss_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_type_array_pollss_decrease_by__returns_data_not(void **poll) { - - const int length = 5; - f_pollss_t data = f_pollss_t_initialize; - - { - const f_status_t status = f_pollss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_pollss_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_type_array_pollss_decrease_by__works(void **poll) { - - const int length = 5; - f_pollss_t data = f_polls_t_initialize; - - { - const f_status_t status = f_pollss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_pollss_decrease_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-pollss_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-pollss_decrease_by.h deleted file mode 100644 index 48919c0f4..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-pollss_decrease_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__pollss_decrease_by -#define _TEST__F_type_array__pollss_decrease_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_pollss_decrease_by() - */ -extern void test__f_type_array_pollss_decrease_by__parameter_checking(void **poll); - -/** - * Test that the function returns F_data_not. - * - * @see f_pollss_decrease_by() - */ -extern void test__f_type_array_pollss_decrease_by__returns_data_not(void **poll); - -/** - * Test that the function works. - * - * @see f_pollss_decrease_by() - */ -extern void test__f_type_array_pollss_decrease_by__works(void **poll); - -#endif // _TEST__F_type_array__pollss_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-pollss_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-pollss_increase.c deleted file mode 100644 index 518f191ef..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-pollss_increase.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-pollss_increase.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_pollss_increase__parameter_checking(void **poll) { - - const int length = 5; - f_pollss_t data = f_polls_t_initialize; - - { - const f_status_t status = f_pollss_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_type_array_pollss_increase__returns_data_not(void **poll) { - - const int length = 5; - f_pollss_t data = f_polls_t_initialize; - - { - const f_status_t status = f_pollss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_pollss_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_type_array_pollss_increase__works(void **poll) { - - const int length = 5; - f_pollss_t data = f_polls_t_initialize; - - { - const f_status_t status = f_pollss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_pollss_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-pollss_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-pollss_increase.h deleted file mode 100644 index 78956f280..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-pollss_increase.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__pollss_increase -#define _TEST__F_type_array__pollss_increase - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_pollss_increase() - */ -extern void test__f_type_array_pollss_increase__parameter_checking(void **poll); - -/** - * Test that the function returns F_data_not. - * - * @see f_pollss_increase() - */ -extern void test__f_type_array_pollss_increase__returns_data_not(void **poll); - -/** - * Test that the function works. - * - * @see f_pollss_increase() - */ -extern void test__f_type_array_pollss_increase__works(void **poll); - -#endif // _TEST__F_type_array__pollss_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-pollss_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-pollss_increase_by.c deleted file mode 100644 index 0cd5a63ec..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-pollss_increase_by.c +++ /dev/null @@ -1,84 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-pollss_increase_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_pollss_increase_by__parameter_checking(void **poll) { - - const int length = 5; - f_pollss_t data = f_polls_t_initialize; - - { - const f_status_t status = f_pollss_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_type_array_pollss_increase_by__returns_data_not(void **poll) { - - const int length = 5; - f_pollss_t data = f_pollss_t_initialize; - - { - const f_status_t status = f_pollss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_pollss_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_pollss_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_type_array_pollss_increase_by__works(void **poll) { - - const int length = 5; - f_pollss_t data = f_polls_t_initialize; - - { - const f_status_t status = f_pollss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_pollss_increase_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-pollss_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-pollss_increase_by.h deleted file mode 100644 index af7fb3f68..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-pollss_increase_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__pollss_increase_by -#define _TEST__F_type_array__pollss_increase_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_pollss_increase_by() - */ -extern void test__f_type_array_pollss_increase_by__parameter_checking(void **poll); - -/** - * Test that the function returns F_data_not. - * - * @see f_pollss_increase_by() - */ -extern void test__f_type_array_pollss_increase_by__returns_data_not(void **poll); - -/** - * Test that the function works. - * - * @see f_pollss_increase_by() - */ -extern void test__f_type_array_pollss_increase_by__works(void **poll); - -#endif // _TEST__F_type_array__pollss_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-pollss_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-pollss_resize.c deleted file mode 100644 index d553ed662..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-pollss_resize.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-pollss_resize.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_pollss_resize__parameter_checking(void **poll) { - - const int length = 5; - f_pollss_t data = f_pollss_t_initialize; - - { - const f_status_t status = f_pollss_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_type_array_pollss_resize__works(void **poll) { - - const int length = 5; - f_pollss_t data = f_pollss_t_initialize; - - { - const f_status_t status = f_pollss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-pollss_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-pollss_resize.h deleted file mode 100644 index 35ff45472..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-pollss_resize.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__pollss_resize -#define _TEST__F_type_array__pollss_resize - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_pollss_resize() - */ -extern void test__f_type_array_pollss_resize__parameter_checking(void **poll); - -/** - * Test that the function works. - * - * @see f_pollss_resize() - */ -extern void test__f_type_array_pollss_resize__works(void **poll); - -#endif // _TEST__F_type_array__pollss_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-states_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-states_adjust.c deleted file mode 100644 index 3ec472769..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-states_adjust.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-states_adjust.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_states_adjust__parameter_checking(void **state) { - - const int length = 5; - f_states_t data = f_states_t_initialize; - - { - const f_status_t status = f_states_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_type_array_states_adjust__works(void **state) { - - const int length = 5; - f_states_t data = f_states_t_initialize; - - { - const f_status_t status = f_states_adjust(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-states_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-states_adjust.h deleted file mode 100644 index 0c99b071c..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-states_adjust.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__states_adjust -#define _TEST__F_type_array__states_adjust - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_states_adjust() - */ -extern void test__f_type_array_states_adjust__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_states_adjust() - */ -extern void test__f_type_array_states_adjust__works(void **state); - -#endif // _TEST__F_type_array__states_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-states_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-states_append.c deleted file mode 100644 index 33cf0e236..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-states_append.c +++ /dev/null @@ -1,47 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-states_append.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_states_append__parameter_checking(void **state) { - - const f_state_t data = f_state_t_initialize; - - { - const f_status_t status = f_states_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_states_append__works(void **state) { - - int fake_1 = 1; - int fake_2 = 2; - int fake_3 = 3; - - const f_state_t source = macro_f_state_t_initialize_1(12, 6, 0, 0, 0, 0, 0, (void *) &fake_1, (void *) &fake_2, (void *) &fake_3); - f_states_t destination = f_states_t_initialize; - - { - const f_status_t status = f_states_append(source, &destination); - - assert_int_equal(status, F_none); - assert_int_equal(destination.used, 1); - assert_int_equal(destination.array[0].step_large, source.step_large); - assert_int_equal(destination.array[0].step_small, source.step_small); - assert_int_equal(destination.array[0].handle, source.handle); - assert_int_equal(destination.array[0].interrupt, source.interrupt); - assert_int_equal(destination.array[0].callbacks, source.callbacks); - assert_int_equal(destination.array[0].custom, source.custom); - assert_int_equal(destination.array[0].data, source.data); - } - - free((void *) destination.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-states_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-states_append.h deleted file mode 100644 index 400236657..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-states_append.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__states_append -#define _TEST__F_type_array__states_append - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_states_append() - */ -extern void test__f_type_array_states_append__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_states_append() - */ -extern void test__f_type_array_states_append__works(void **state); - -#endif // _TEST__F_type_array__states_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-states_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-states_append_all.c deleted file mode 100644 index 9616d7519..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-states_append_all.c +++ /dev/null @@ -1,95 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-states_append_all.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_states_append_all__parameter_checking(void **state) { - - const f_states_t data = f_states_t_initialize; - - { - const f_status_t status = f_states_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_states_append_all__returns_data_not(void **state) { - - const int length = 5; - f_states_t source = f_states_t_initialize; - f_states_t destination = f_states_t_initialize; - - { - const f_status_t status = f_states_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_states_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_type_array_states_append_all__works(void **state) { - - const int length = 5; - f_states_t source = f_states_t_initialize; - f_states_t destination = f_states_t_initialize; - - const f_state_t state_0 = { .step_large = 10, .step_small = 1, .handle = 0, .interrupt = 0, .callbacks = 0, .custom = 0, .data = 0 }; - const f_state_t state_1 = { .step_large = 20, .step_small = 2, .handle = 0, .interrupt = 0, .callbacks = 0, .custom = 0, .data = 0 }; - - { - const f_status_t status = f_states_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - memcpy(&source.array[source.used++], (void *) &state_0, sizeof(f_state_t)); - memcpy(&source.array[source.used++], (void *) &state_1, sizeof(f_state_t)); - - { - const f_status_t status = f_states_append_all(source, &destination); - - assert_int_equal(status, F_none); - assert_int_equal(destination.used, source.used); - assert_int_equal(destination.size, source.used); - - assert_int_equal(destination.array[0].step_large, state_0.step_large); - assert_int_equal(destination.array[0].step_small, state_0.step_small); - assert_null(destination.array[0].handle); - assert_null(destination.array[0].interrupt); - assert_null(destination.array[0].callbacks); - assert_null(destination.array[0].custom); - assert_null(destination.array[0].data); - - assert_int_equal(destination.array[1].step_large, state_1.step_large); - assert_int_equal(destination.array[1].step_small, state_1.step_small); - assert_null(destination.array[1].handle); - assert_null(destination.array[1].interrupt); - assert_null(destination.array[1].callbacks); - assert_null(destination.array[1].custom); - assert_null(destination.array[1].data); - } - - free((void *) source.array); - free((void *) destination.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-states_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-states_append_all.h deleted file mode 100644 index 991f0a87a..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-states_append_all.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__states_append_all -#define _TEST__F_type_array__states_append_all - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_states_append_all() - */ -extern void test__f_type_array_states_append_all__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_states_append_all() - */ -extern void test__f_type_array_states_append_all__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_states_append_all() - */ -extern void test__f_type_array_states_append_all__works(void **state); - -#endif // _TEST__F_type_array__states_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-states_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-states_decimate_by.c deleted file mode 100644 index 363cc277d..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-states_decimate_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-states_decimate_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_states_decimate_by__parameter_checking(void **state) { - - const int length = 5; - f_states_t data = f_states_t_initialize; - - { - const f_status_t status = f_states_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_type_array_states_decimate_by__returns_data_not(void **state) { - - const int length = 5; - f_states_t data = f_states_t_initialize; - - { - const f_status_t status = f_states_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_states_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_type_array_states_decimate_by__works(void **state) { - - const int length = 5; - f_states_t data = f_states_t_initialize; - - { - const f_status_t status = f_states_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_states_decimate_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-states_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-states_decimate_by.h deleted file mode 100644 index 7fb14ae3f..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-states_decimate_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__states_decimate_by -#define _TEST__F_type_array__states_decimate_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_states_decimate_by() - */ -extern void test__f_type_array_states_decimate_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_states_decimate_by() - */ -extern void test__f_type_array_states_decimate_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_states_decimate_by() - */ -extern void test__f_type_array_states_decimate_by__works(void **state); - -#endif // _TEST__F_type_array__states_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-states_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-states_decrease_by.c deleted file mode 100644 index 6ecf14fc4..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-states_decrease_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-states_decrease_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_states_decrease_by__parameter_checking(void **state) { - - const int length = 5; - f_states_t data = f_states_t_initialize; - - { - const f_status_t status = f_states_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_type_array_states_decrease_by__returns_data_not(void **state) { - - const int length = 5; - f_states_t data = f_states_t_initialize; - - { - const f_status_t status = f_states_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_states_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_type_array_states_decrease_by__works(void **state) { - - const int length = 5; - f_states_t data = f_states_t_initialize; - - { - const f_status_t status = f_states_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_states_decrease_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-states_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-states_decrease_by.h deleted file mode 100644 index abaf2a7a2..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-states_decrease_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__states_decrease_by -#define _TEST__F_type_array__states_decrease_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_states_decrease_by() - */ -extern void test__f_type_array_states_decrease_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_states_decrease_by() - */ -extern void test__f_type_array_states_decrease_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_states_decrease_by() - */ -extern void test__f_type_array_states_decrease_by__works(void **state); - -#endif // _TEST__F_type_array__states_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-states_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-states_increase.c deleted file mode 100644 index cacd401da..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-states_increase.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-states_increase.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_states_increase__parameter_checking(void **state) { - - const int length = 5; - f_states_t data = f_states_t_initialize; - - { - const f_status_t status = f_states_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_type_array_states_increase__returns_data_not(void **state) { - - const int length = 5; - f_states_t data = f_states_t_initialize; - - { - const f_status_t status = f_states_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_states_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_type_array_states_increase__works(void **state) { - - const int length = 5; - f_states_t data = f_states_t_initialize; - - { - const f_status_t status = f_states_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_states_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-states_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-states_increase.h deleted file mode 100644 index 45ac42c68..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-states_increase.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__states_increase -#define _TEST__F_type_array__states_increase - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_states_increase() - */ -extern void test__f_type_array_states_increase__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_states_increase() - */ -extern void test__f_type_array_states_increase__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_states_increase() - */ -extern void test__f_type_array_states_increase__works(void **state); - -#endif // _TEST__F_type_array__states_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-states_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-states_increase_by.c deleted file mode 100644 index ae7f3112b..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-states_increase_by.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-states_increase_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_states_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_states_t data = f_states_t_initialize; - - { - const f_status_t status = f_states_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_type_array_states_increase_by__returns_data_not(void **state) { - - const int length = 5; - f_states_t data = f_states_t_initialize; - - { - const f_status_t status = f_states_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_states_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_type_array_states_increase_by__works(void **state) { - - const int length = 5; - f_states_t data = f_states_t_initialize; - - { - const f_status_t status = f_states_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_states_increase_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-states_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-states_increase_by.h deleted file mode 100644 index 7b199868c..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-states_increase_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__states_increase_by -#define _TEST__F_type_array__states_increase_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_states_increase_by() - */ -extern void test__f_type_array_states_increase_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_states_increase_by() - */ -extern void test__f_type_array_states_increase_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_states_increase_by() - */ -extern void test__f_type_array_states_increase_by__works(void **state); - -#endif // _TEST__F_type_array__states_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-states_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-states_resize.c deleted file mode 100644 index 3751188dd..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-states_resize.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-states_resize.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_states_resize__parameter_checking(void **state) { - - const int length = 5; - f_states_t data = f_states_t_initialize; - - { - const f_status_t status = f_states_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_type_array_states_resize__works(void **state) { - - const int length = 5; - f_states_t data = f_states_t_initialize; - - { - const f_status_t status = f_states_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-states_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-states_resize.h deleted file mode 100644 index 8bcd9d863..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-states_resize.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__states_resize -#define _TEST__F_type_array__states_resize - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_states_resize() - */ -extern void test__f_type_array_states_resize__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_states_resize() - */ -extern void test__f_type_array_states_resize__works(void **state); - -#endif // _TEST__F_type_array__states_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statess_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-statess_adjust.c deleted file mode 100644 index 883bd1d6e..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statess_adjust.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-statess_adjust.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_statess_adjust__parameter_checking(void **state) { - - const int length = 5; - f_statess_t data = f_statess_t_initialize; - - { - const f_status_t status = f_statess_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_type_array_statess_adjust__works(void **state) { - - const int length = 5; - f_statess_t data = f_statess_t_initialize; - - { - const f_status_t status = f_statess_adjust(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statess_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-statess_adjust.h deleted file mode 100644 index 3b2db6981..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statess_adjust.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__statess_adjust -#define _TEST__F_type_array__statess_adjust - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_statess_adjust() - */ -extern void test__f_type_array_statess_adjust__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_statess_adjust() - */ -extern void test__f_type_array_statess_adjust__works(void **state); - -#endif // _TEST__F_type_array__statess_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statess_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-statess_append.c deleted file mode 100644 index fc5d3322a..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statess_append.c +++ /dev/null @@ -1,99 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-statess_append.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_statess_append__parameter_checking(void **state) { - - f_states_t data = f_states_t_initialize; - - { - const f_status_t status = f_statess_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_statess_append__returns_data_not(void **state) { - - const int length = 5; - f_states_t source = f_states_t_initialize; - f_statess_t destination = f_statess_t_initialize; - - { - const f_status_t status = f_states_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_statess_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_type_array_statess_append__works(void **state) { - - const int length = 5; - f_states_t source = f_states_t_initialize; - f_statess_t destination = f_statess_t_initialize; - - int fake_1 = 1; - int fake_2 = 2; - int fake_3 = 3; - - const f_state_t state_data = macro_f_state_t_initialize_1(12, 6, 0, 0, 0, 0, 0, (void *) &fake_1, (void *) &fake_2, (void *) &fake_3); - - { - const f_status_t status = f_states_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - while (source.used < length) { - memcpy(&source.array[source.used++], (void *) &state_data, sizeof(f_state_t)); - } // while - - { - const f_status_t status = f_statess_append(source, &destination); - - assert_int_equal(status, F_none); - 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].step_large, state_data.step_large); - assert_int_equal(destination.array[0].array[i].step_small, state_data.step_small); - assert_int_equal(destination.array[0].array[i].handle, state_data.handle); - assert_int_equal(destination.array[0].array[i].interrupt, state_data.interrupt); - assert_int_equal(destination.array[0].array[i].callbacks, state_data.callbacks); - assert_int_equal(destination.array[0].array[i].custom, state_data.custom); - assert_int_equal(destination.array[0].array[i].data, state_data.data); - } // 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 diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statess_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-statess_append.h deleted file mode 100644 index 7cad34a91..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statess_append.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__statess_append -#define _TEST__F_type_array__statess_append - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_statess_append() - */ -extern void test__f_type_array_statess_append__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_statess_append() - */ -extern void test__f_type_array_statess_append__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_statess_append() - */ -extern void test__f_type_array_statess_append__works(void **state); - -#endif // _TEST__F_type_array__statess_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statess_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-statess_append_all.c deleted file mode 100644 index 497d7b917..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statess_append_all.c +++ /dev/null @@ -1,119 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-statess_append_all.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_statess_append_all__parameter_checking(void **state) { - - const f_statess_t data = f_statess_t_initialize; - - { - const f_status_t status = f_statess_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_statess_append_all__returns_data_not(void **state) { - - const int length = 5; - f_statess_t source = f_statess_t_initialize; - f_statess_t destination = f_statess_t_initialize; - - { - const f_status_t status = f_statess_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_statess_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_type_array_statess_append_all__works(void **state) { - - const int length = 5; - const int length_inner = 2; - f_statess_t source = f_statess_t_initialize; - f_statess_t destination = f_statess_t_initialize; - - const f_state_t state_0 = { .step_large = 10, .step_small = 1, .handle = 0, .interrupt = 0, .callbacks = 0, .custom = 0, .data = 0 }; - const f_state_t state_1 = { .step_large = 20, .step_small = 2, .handle = 0, .interrupt = 0, .callbacks = 0, .custom = 0, .data = 0 }; - - { - const f_status_t status = f_statess_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - for (; source.used < length; ++source.used) { - - const f_status_t status = f_states_resize(length_inner, &source.array[source.used]); - - assert_int_equal(status, F_none); - - memcpy(&source.array[source.used].array[source.array[source.used].used++], (void *) &state_0, sizeof(f_state_t)); - memcpy(&source.array[source.used].array[source.array[source.used].used++], (void *) &state_1, sizeof(f_state_t)); - } // for - } - - { - const f_status_t status = f_statess_append_all(source, &destination); - - assert_int_equal(status, F_none); - assert_int_equal(destination.used, source.used); - assert_int_equal(destination.size, source.used); - - for (f_number_unsigned_t i = 0; i < destination.used; ++i) { - - assert_int_equal(destination.array[i].used, length_inner); - assert_int_equal(destination.array[i].size, length_inner); - - assert_int_equal(destination.array[i].array[0].step_large, state_0.step_large); - assert_int_equal(destination.array[i].array[0].step_small, state_0.step_small); - assert_null(destination.array[i].array[0].handle); - assert_null(destination.array[i].array[0].interrupt); - assert_null(destination.array[i].array[0].callbacks); - assert_null(destination.array[i].array[0].custom); - assert_null(destination.array[i].array[0].data); - - assert_int_equal(destination.array[i].array[1].step_large, state_1.step_large); - assert_int_equal(destination.array[i].array[1].step_small, state_1.step_small); - assert_null(destination.array[i].array[1].handle); - assert_null(destination.array[i].array[1].interrupt); - assert_null(destination.array[i].array[1].callbacks); - assert_null(destination.array[i].array[1].custom); - assert_null(destination.array[i].array[1].data); - } // 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 diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statess_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-statess_append_all.h deleted file mode 100644 index 20e8dab92..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statess_append_all.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__statess_append_all -#define _TEST__F_type_array__statess_append_all - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_statess_append_all() - */ -extern void test__f_type_array_statess_append_all__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_statess_append_all() - */ -extern void test__f_type_array_statess_append_all__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_statess_append_all() - */ -extern void test__f_type_array_statess_append_all__works(void **state); - -#endif // _TEST__F_type_array__statess_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statess_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-statess_decimate_by.c deleted file mode 100644 index 911c7e4da..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statess_decimate_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-statess_decimate_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_statess_decimate_by__parameter_checking(void **state) { - - const int length = 5; - f_statess_t data = f_states_t_initialize; - - { - const f_status_t status = f_statess_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_type_array_statess_decimate_by__returns_data_not(void **state) { - - const int length = 5; - f_statess_t data = f_statess_t_initialize; - - { - const f_status_t status = f_statess_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_statess_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_type_array_statess_decimate_by__works(void **state) { - - const int length = 5; - f_statess_t data = f_states_t_initialize; - - { - const f_status_t status = f_statess_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_statess_decimate_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statess_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-statess_decimate_by.h deleted file mode 100644 index a709de768..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statess_decimate_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__statess_decimate_by -#define _TEST__F_type_array__statess_decimate_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_statess_decimate_by() - */ -extern void test__f_type_array_statess_decimate_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_type_array_statess_decimate_by() - */ -extern void test__f_type_array_statess_decimate_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_statess_decimate_by() - */ -extern void test__f_type_array_statess_decimate_by__works(void **state); - -#endif // _TEST__F_type_array__statess_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statess_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-statess_decrease_by.c deleted file mode 100644 index 4990d95d6..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statess_decrease_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-statess_decrease_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_statess_decrease_by__parameter_checking(void **state) { - - const int length = 5; - f_statess_t data = f_states_t_initialize; - - { - const f_status_t status = f_statess_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_type_array_statess_decrease_by__returns_data_not(void **state) { - - const int length = 5; - f_statess_t data = f_statess_t_initialize; - - { - const f_status_t status = f_statess_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_statess_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_type_array_statess_decrease_by__works(void **state) { - - const int length = 5; - f_statess_t data = f_states_t_initialize; - - { - const f_status_t status = f_statess_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_statess_decrease_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statess_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-statess_decrease_by.h deleted file mode 100644 index 21c4b068a..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statess_decrease_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__statess_decrease_by -#define _TEST__F_type_array__statess_decrease_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_statess_decrease_by() - */ -extern void test__f_type_array_statess_decrease_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_statess_decrease_by() - */ -extern void test__f_type_array_statess_decrease_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_statess_decrease_by() - */ -extern void test__f_type_array_statess_decrease_by__works(void **state); - -#endif // _TEST__F_type_array__statess_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statess_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-statess_increase.c deleted file mode 100644 index e187d564e..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statess_increase.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-statess_increase.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_statess_increase__parameter_checking(void **state) { - - const int length = 5; - f_statess_t data = f_states_t_initialize; - - { - const f_status_t status = f_statess_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_type_array_statess_increase__returns_data_not(void **state) { - - const int length = 5; - f_statess_t data = f_states_t_initialize; - - { - const f_status_t status = f_statess_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_statess_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_type_array_statess_increase__works(void **state) { - - const int length = 5; - f_statess_t data = f_states_t_initialize; - - { - const f_status_t status = f_statess_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_statess_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statess_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-statess_increase.h deleted file mode 100644 index d56b23924..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statess_increase.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__statess_increase -#define _TEST__F_type_array__statess_increase - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_statess_increase() - */ -extern void test__f_type_array_statess_increase__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_statess_increase() - */ -extern void test__f_type_array_statess_increase__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_statess_increase() - */ -extern void test__f_type_array_statess_increase__works(void **state); - -#endif // _TEST__F_type_array__statess_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statess_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-statess_increase_by.c deleted file mode 100644 index 57251b075..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statess_increase_by.c +++ /dev/null @@ -1,84 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-statess_increase_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_statess_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_statess_t data = f_states_t_initialize; - - { - const f_status_t status = f_statess_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_type_array_statess_increase_by__returns_data_not(void **state) { - - const int length = 5; - f_statess_t data = f_statess_t_initialize; - - { - const f_status_t status = f_statess_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_statess_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_statess_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_type_array_statess_increase_by__works(void **state) { - - const int length = 5; - f_statess_t data = f_states_t_initialize; - - { - const f_status_t status = f_statess_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_statess_increase_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statess_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-statess_increase_by.h deleted file mode 100644 index 2546a1b77..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statess_increase_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__statess_increase_by -#define _TEST__F_type_array__statess_increase_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_statess_increase_by() - */ -extern void test__f_type_array_statess_increase_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_statess_increase_by() - */ -extern void test__f_type_array_statess_increase_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_statess_increase_by() - */ -extern void test__f_type_array_statess_increase_by__works(void **state); - -#endif // _TEST__F_type_array__statess_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statess_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-statess_resize.c deleted file mode 100644 index b30e2a06d..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statess_resize.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-statess_resize.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_statess_resize__parameter_checking(void **state) { - - const int length = 5; - f_statess_t data = f_statess_t_initialize; - - { - const f_status_t status = f_statess_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_type_array_statess_resize__works(void **state) { - - const int length = 5; - f_statess_t data = f_statess_t_initialize; - - { - const f_status_t status = f_statess_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statess_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-statess_resize.h deleted file mode 100644 index 8d5c52323..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statess_resize.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__statess_resize -#define _TEST__F_type_array__statess_resize - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_statess_resize() - */ -extern void test__f_type_array_statess_resize__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_statess_resize() - */ -extern void test__f_type_array_statess_resize__works(void **state); - -#endif // _TEST__F_type_array__statess_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_adjust.c deleted file mode 100644 index 0862cf679..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_adjust.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-statuss_adjust.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_statuss_adjust__parameter_checking(void **state) { - - const int length = 5; - f_statuss_t data = f_statuss_t_initialize; - - { - const f_status_t status = f_statuss_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_type_array_statuss_adjust__works(void **state) { - - const int length = 5; - f_statuss_t data = f_statuss_t_initialize; - - { - const f_status_t status = f_statuss_adjust(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_adjust.h deleted file mode 100644 index 7dcfc020d..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_adjust.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__statuss_adjust -#define _TEST__F_type_array__statuss_adjust - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_statuss_adjust() - */ -extern void test__f_type_array_statuss_adjust__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_statuss_adjust() - */ -extern void test__f_type_array_statuss_adjust__works(void **state); - -#endif // _TEST__F_type_array__statuss_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_append.c deleted file mode 100644 index 454ebaa3a..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_append.c +++ /dev/null @@ -1,37 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-statuss_append.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_statuss_append__parameter_checking(void **state) { - - const f_status_t data = f_status_t_initialize; - - { - const f_status_t status = f_statuss_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_statuss_append__works(void **state) { - - const f_status_t source = 3; - f_statuss_t destination = f_statuss_t_initialize; - - { - const f_status_t status = f_statuss_append(source, &destination); - - assert_int_equal(status, F_none); - assert_int_equal(destination.used, 1); - assert_int_equal(destination.array[0], source); - } - - free((void *) destination.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_append.h deleted file mode 100644 index 7bb9bb7d6..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_append.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__statuss_append -#define _TEST__F_type_array__statuss_append - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_statuss_append() - */ -extern void test__f_type_array_statuss_append__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_statuss_append() - */ -extern void test__f_type_array_statuss_append__works(void **state); - -#endif // _TEST__F_type_array__statuss_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_append_all.c deleted file mode 100644 index bd9760011..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_append_all.c +++ /dev/null @@ -1,82 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-statuss_append_all.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_statuss_append_all__parameter_checking(void **state) { - - const f_statuss_t data = f_statuss_t_initialize; - - { - const f_status_t status = f_statuss_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_statuss_append_all__returns_data_not(void **state) { - - const int length = 5; - f_statuss_t source = f_statuss_t_initialize; - f_statuss_t destination = f_statuss_t_initialize; - - { - const f_status_t status = f_statuss_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_statuss_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_type_array_statuss_append_all__works(void **state) { - - const int length = 5; - const int length_used = 2; - f_statuss_t source = f_statuss_t_initialize; - f_statuss_t destination = f_statuss_t_initialize; - - { - const f_status_t status = f_statuss_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - for (; source.used < length_used; ++source.used) { - source.array[source.used] = source.used + 1; - } // for - - { - const f_status_t status = f_statuss_append_all(source, &destination); - - assert_int_equal(status, F_none); - assert_int_equal(destination.used, source.used); - assert_int_equal(destination.size, source.used); - - for (f_number_unsigned_t i = 0; i < source.used; ++i) { - assert_int_equal(destination.array[i], i + 1); - } // for - } - - free((void *) source.array); - free((void *) destination.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_append_all.h deleted file mode 100644 index 293b10cc9..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_append_all.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__statuss_append_all -#define _TEST__F_type_array__statuss_append_all - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_statuss_append_all() - */ -extern void test__f_type_array_statuss_append_all__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_statuss_append_all() - */ -extern void test__f_type_array_statuss_append_all__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_statuss_append_all() - */ -extern void test__f_type_array_statuss_append_all__works(void **state); - -#endif // _TEST__F_type_array__statuss_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_decimate_by.c deleted file mode 100644 index 961dc76c3..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_decimate_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-statuss_decimate_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_statuss_decimate_by__parameter_checking(void **state) { - - const int length = 5; - f_statuss_t data = f_statuss_t_initialize; - - { - const f_status_t status = f_statuss_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_type_array_statuss_decimate_by__returns_data_not(void **state) { - - const int length = 5; - f_statuss_t data = f_statuss_t_initialize; - - { - const f_status_t status = f_statuss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_statuss_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_type_array_statuss_decimate_by__works(void **state) { - - const int length = 5; - f_statuss_t data = f_statuss_t_initialize; - - { - const f_status_t status = f_statuss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_statuss_decimate_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_decimate_by.h deleted file mode 100644 index af763fdd3..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_decimate_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__statuss_decimate_by -#define _TEST__F_type_array__statuss_decimate_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_statuss_decimate_by() - */ -extern void test__f_type_array_statuss_decimate_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_statuss_decimate_by() - */ -extern void test__f_type_array_statuss_decimate_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_statuss_decimate_by() - */ -extern void test__f_type_array_statuss_decimate_by__works(void **state); - -#endif // _TEST__F_type_array__statuss_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_decrease_by.c deleted file mode 100644 index 449c3f9cc..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_decrease_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-statuss_decrease_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_statuss_decrease_by__parameter_checking(void **state) { - - const int length = 5; - f_statuss_t data = f_statuss_t_initialize; - - { - const f_status_t status = f_statuss_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_type_array_statuss_decrease_by__returns_data_not(void **state) { - - const int length = 5; - f_statuss_t data = f_statuss_t_initialize; - - { - const f_status_t status = f_statuss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_statuss_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_type_array_statuss_decrease_by__works(void **state) { - - const int length = 5; - f_statuss_t data = f_statuss_t_initialize; - - { - const f_status_t status = f_statuss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_statuss_decrease_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_decrease_by.h deleted file mode 100644 index 8694432b6..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_decrease_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__statuss_decrease_by -#define _TEST__F_type_array__statuss_decrease_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_statuss_decrease_by() - */ -extern void test__f_type_array_statuss_decrease_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_statuss_decrease_by() - */ -extern void test__f_type_array_statuss_decrease_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_statuss_decrease_by() - */ -extern void test__f_type_array_statuss_decrease_by__works(void **state); - -#endif // _TEST__F_type_array__statuss_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_increase.c deleted file mode 100644 index a07eb6c9e..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_increase.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-statuss_increase.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_statuss_increase__parameter_checking(void **state) { - - const int length = 5; - f_statuss_t data = f_statuss_t_initialize; - - { - const f_status_t status = f_statuss_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_type_array_statuss_increase__returns_data_not(void **state) { - - const int length = 5; - f_statuss_t data = f_statuss_t_initialize; - - { - const f_status_t status = f_statuss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_statuss_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_type_array_statuss_increase__works(void **state) { - - const int length = 5; - f_statuss_t data = f_statuss_t_initialize; - - { - const f_status_t status = f_statuss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_statuss_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_increase.h deleted file mode 100644 index d1057e410..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_increase.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__statuss_increase -#define _TEST__F_type_array__statuss_increase - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_statuss_increase() - */ -extern void test__f_type_array_statuss_increase__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_statuss_increase() - */ -extern void test__f_type_array_statuss_increase__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_statuss_increase() - */ -extern void test__f_type_array_statuss_increase__works(void **state); - -#endif // _TEST__F_type_array__statuss_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_increase_by.c deleted file mode 100644 index 5585c1701..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_increase_by.c +++ /dev/null @@ -1,77 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-statuss_increase_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - - -void test__f_type_array_statuss_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_statuss_t data = f_statuss_t_initialize; - - { - const f_status_t status = f_statuss_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_type_array_statuss_increase_by__returns_data_not(void **state) { - - const int length = 5; - f_statuss_t data = f_statuss_t_initialize; - - { - const f_status_t status = f_statuss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_statuss_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_type_array_statuss_increase_by__works(void **state) { - - const int length = 5; - f_statuss_t data = f_statuss_t_initialize; - - { - const f_status_t status = f_statuss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_statuss_increase_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_increase_by.h deleted file mode 100644 index 80f27e6b5..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_increase_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__statuss_increase_by -#define _TEST__F_type_array__statuss_increase_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_statuss_increase_by() - */ -extern void test__f_type_array_statuss_increase_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_statuss_increase_by() - */ -extern void test__f_type_array_statuss_increase_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_statuss_increase_by() - */ -extern void test__f_type_array_statuss_increase_by__works(void **state); - -#endif // _TEST__F_type_array__statuss_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_resize.c deleted file mode 100644 index 94d097d62..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_resize.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-statuss_resize.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_statuss_resize__parameter_checking(void **state) { - - const int length = 5; - f_statuss_t data = f_statuss_t_initialize; - - { - const f_status_t status = f_statuss_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_type_array_statuss_resize__works(void **state) { - - const int length = 5; - f_statuss_t data = f_statuss_t_initialize; - - { - const f_status_t status = f_statuss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_resize.h deleted file mode 100644 index e79e71da9..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_resize.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__statuss_resize -#define _TEST__F_type_array__statuss_resize - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_statuss_resize() - */ -extern void test__f_type_array_statuss_resize__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_statuss_resize() - */ -extern void test__f_type_array_statuss_resize__works(void **state); - -#endif // _TEST__F_type_array__statuss_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-statusss_adjust.c deleted file mode 100644 index 80c78991d..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_adjust.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-statusss_adjust.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_statusss_adjust__parameter_checking(void **state) { - - const int length = 5; - f_statusss_t data = f_statusss_t_initialize; - - { - const f_status_t status = f_statusss_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_type_array_statusss_adjust__works(void **state) { - - const int length = 5; - f_statusss_t data = f_statusss_t_initialize; - - { - const f_status_t status = f_statusss_adjust(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-statusss_adjust.h deleted file mode 100644 index b0d96f610..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_adjust.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__statusss_adjust -#define _TEST__F_type_array__statusss_adjust - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_statusss_adjust() - */ -extern void test__f_type_array_statusss_adjust__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_statusss_adjust() - */ -extern void test__f_type_array_statusss_adjust__works(void **state); - -#endif // _TEST__F_type_array__statusss_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-statusss_append.c deleted file mode 100644 index cc035ffe0..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_append.c +++ /dev/null @@ -1,86 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-statusss_append.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_statusss_append__parameter_checking(void **state) { - - f_statuss_t data = f_statuss_t_initialize; - - { - const f_status_t status = f_statusss_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_statusss_append__returns_data_not(void **state) { - - const int length = 5; - f_statuss_t source = f_statuss_t_initialize; - f_statusss_t destination = f_statusss_t_initialize; - - { - const f_status_t status = f_statuss_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_statusss_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_type_array_statusss_append__works(void **state) { - - const int length = 5; - f_statuss_t source = f_statuss_t_initialize; - f_statusss_t destination = f_statusss_t_initialize; - - { - const f_status_t status = f_statuss_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - for (; source.used < length; ++source.used) { - source.array[source.used] = source.used + 1; - } // for - - { - const f_status_t status = f_statusss_append(source, &destination); - - assert_int_equal(status, F_none); - 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], i + 1); - } // 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 diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-statusss_append.h deleted file mode 100644 index 7ec5764ac..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_append.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__statusss_append -#define _TEST__F_type_array__statusss_append - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_statusss_append() - */ -extern void test__f_type_array_statusss_append__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_statusss_append() - */ -extern void test__f_type_array_statusss_append__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_statusss_append() - */ -extern void test__f_type_array_statusss_append__works(void **state); - -#endif // _TEST__F_type_array__statusss_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-statusss_append_all.c deleted file mode 100644 index e37163a8c..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_append_all.c +++ /dev/null @@ -1,105 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-statusss_append_all.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_statusss_append_all__parameter_checking(void **state) { - - const f_statusss_t data = f_statusss_t_initialize; - - { - const f_status_t status = f_statusss_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_statusss_append_all__returns_data_not(void **state) { - - const int length = 5; - f_statusss_t source = f_statusss_t_initialize; - f_statusss_t destination = f_statusss_t_initialize; - - { - const f_status_t status = f_statusss_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_statusss_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_type_array_statusss_append_all__works(void **state) { - - const int length = 5; - const int length_inner = 2; - f_statusss_t source = f_statusss_t_initialize; - f_statusss_t destination = f_statusss_t_initialize; - - { - const f_status_t status = f_statusss_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - for (; source.used < length; ++source.used) { - - const f_status_t status = f_statuss_resize(length_inner, &source.array[source.used]); - - assert_int_equal(status, F_none); - - for (f_number_unsigned_t i = 0; i < length_inner; ++i) { - source.array[source.used].array[source.array[source.used].used++] = i + 1; - } // for - } // for - } - - { - const f_status_t status = f_statusss_append_all(source, &destination); - - assert_int_equal(status, F_none); - assert_int_equal(destination.used, source.used); - assert_int_equal(destination.size, source.used); - - for (f_number_unsigned_t i = 0; i < destination.used; ++i) { - - assert_int_equal(destination.array[i].used, length_inner); - assert_int_equal(destination.array[i].size, length_inner); - - for (f_number_unsigned_t j = 0; j < length_inner; ++j) { - assert_int_equal(destination.array[i].array[j], j + 1); - } // 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 diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-statusss_append_all.h deleted file mode 100644 index e4a1fcd77..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_append_all.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__statusss_append_all -#define _TEST__F_type_array__statusss_append_all - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_statusss_append_all() - */ -extern void test__f_type_array_statusss_append_all__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_statusss_append_all() - */ -extern void test__f_type_array_statusss_append_all__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_statusss_append_all() - */ -extern void test__f_type_array_statusss_append_all__works(void **state); - -#endif // _TEST__F_type_array__statusss_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-statusss_decimate_by.c deleted file mode 100644 index 7265fd4cd..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_decimate_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-statusss_decimate_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_statusss_decimate_by__parameter_checking(void **state) { - - const int length = 5; - f_statusss_t data = f_statuss_t_initialize; - - { - const f_status_t status = f_statusss_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_type_array_statusss_decimate_by__returns_data_not(void **state) { - - const int length = 5; - f_statusss_t data = f_statusss_t_initialize; - - { - const f_status_t status = f_statusss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_statusss_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_type_array_statusss_decimate_by__works(void **state) { - - const int length = 5; - f_statusss_t data = f_statuss_t_initialize; - - { - const f_status_t status = f_statusss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_statusss_decimate_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-statusss_decimate_by.h deleted file mode 100644 index 4e1f0e484..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_decimate_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__statusss_decimate_by -#define _TEST__F_type_array__statusss_decimate_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_statusss_decimate_by() - */ -extern void test__f_type_array_statusss_decimate_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_type_array_statusss_decimate_by() - */ -extern void test__f_type_array_statusss_decimate_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_statusss_decimate_by() - */ -extern void test__f_type_array_statusss_decimate_by__works(void **state); - -#endif // _TEST__F_type_array__statusss_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-statusss_decrease_by.c deleted file mode 100644 index 43e408cb8..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_decrease_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-statusss_decrease_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_statusss_decrease_by__parameter_checking(void **state) { - - const int length = 5; - f_statusss_t data = f_statuss_t_initialize; - - { - const f_status_t status = f_statusss_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_type_array_statusss_decrease_by__returns_data_not(void **state) { - - const int length = 5; - f_statusss_t data = f_statusss_t_initialize; - - { - const f_status_t status = f_statusss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_statusss_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_type_array_statusss_decrease_by__works(void **state) { - - const int length = 5; - f_statusss_t data = f_statuss_t_initialize; - - { - const f_status_t status = f_statusss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_statusss_decrease_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-statusss_decrease_by.h deleted file mode 100644 index 8604cbdf8..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_decrease_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__statusss_decrease_by -#define _TEST__F_type_array__statusss_decrease_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_statusss_decrease_by() - */ -extern void test__f_type_array_statusss_decrease_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_statusss_decrease_by() - */ -extern void test__f_type_array_statusss_decrease_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_statusss_decrease_by() - */ -extern void test__f_type_array_statusss_decrease_by__works(void **state); - -#endif // _TEST__F_type_array__statusss_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-statusss_increase.c deleted file mode 100644 index ec29f0233..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_increase.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-statusss_increase.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_statusss_increase__parameter_checking(void **state) { - - const int length = 5; - f_statusss_t data = f_statuss_t_initialize; - - { - const f_status_t status = f_statusss_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_type_array_statusss_increase__returns_data_not(void **state) { - - const int length = 5; - f_statusss_t data = f_statuss_t_initialize; - - { - const f_status_t status = f_statusss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_statusss_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_type_array_statusss_increase__works(void **state) { - - const int length = 5; - f_statusss_t data = f_statuss_t_initialize; - - { - const f_status_t status = f_statusss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_statusss_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-statusss_increase.h deleted file mode 100644 index e559ab353..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_increase.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__statusss_increase -#define _TEST__F_type_array__statusss_increase - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_statusss_increase() - */ -extern void test__f_type_array_statusss_increase__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_statusss_increase() - */ -extern void test__f_type_array_statusss_increase__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_statusss_increase() - */ -extern void test__f_type_array_statusss_increase__works(void **state); - -#endif // _TEST__F_type_array__statusss_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-statusss_increase_by.c deleted file mode 100644 index 5a1206827..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_increase_by.c +++ /dev/null @@ -1,84 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-statusss_increase_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_statusss_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_statusss_t data = f_statuss_t_initialize; - - { - const f_status_t status = f_statusss_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_type_array_statusss_increase_by__returns_data_not(void **state) { - - const int length = 5; - f_statusss_t data = f_statusss_t_initialize; - - { - const f_status_t status = f_statusss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_statusss_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_statusss_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_type_array_statusss_increase_by__works(void **state) { - - const int length = 5; - f_statusss_t data = f_statuss_t_initialize; - - { - const f_status_t status = f_statusss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_statusss_increase_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-statusss_increase_by.h deleted file mode 100644 index eb3d0766e..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_increase_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__statusss_increase_by -#define _TEST__F_type_array__statusss_increase_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_statusss_increase_by() - */ -extern void test__f_type_array_statusss_increase_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_statusss_increase_by() - */ -extern void test__f_type_array_statusss_increase_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_statusss_increase_by() - */ -extern void test__f_type_array_statusss_increase_by__works(void **state); - -#endif // _TEST__F_type_array__statusss_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-statusss_resize.c deleted file mode 100644 index 39aa72d6f..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_resize.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-statusss_resize.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_statusss_resize__parameter_checking(void **state) { - - const int length = 5; - f_statusss_t data = f_statusss_t_initialize; - - { - const f_status_t status = f_statusss_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_type_array_statusss_resize__works(void **state) { - - const int length = 5; - f_statusss_t data = f_statusss_t_initialize; - - { - const f_status_t status = f_statusss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-statusss_resize.h deleted file mode 100644 index 6073a9be6..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_resize.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__statusss_resize -#define _TEST__F_type_array__statusss_resize - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_statusss_resize() - */ -extern void test__f_type_array_statusss_resize__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_statusss_resize() - */ -extern void test__f_type_array_statusss_resize__works(void **state); - -#endif // _TEST__F_type_array__statusss_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_adjust.c deleted file mode 100644 index ffe293770..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_adjust.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint128s_adjust.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint128s_adjust__parameter_checking(void **state) { - - const int length = 5; - f_uint128s_t data = f_uint128s_t_initialize; - - { - const f_status_t status = f_uint128s_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_type_array_uint128s_adjust__works(void **state) { - - const int length = 5; - f_uint128s_t data = f_uint128s_t_initialize; - - { - const f_status_t status = f_uint128s_adjust(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_adjust.h deleted file mode 100644 index 7971d5b87..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_adjust.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint128s_adjust -#define _TEST__F_type_array__uint128s_adjust - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint128s_adjust() - */ -extern void test__f_type_array_uint128s_adjust__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_uint128s_adjust() - */ -extern void test__f_type_array_uint128s_adjust__works(void **state); - -#endif // _TEST__F_type_array__uint128s_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_adjust_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_adjust_callback.c new file mode 100644 index 000000000..005f732f2 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_adjust_callback.c @@ -0,0 +1,45 @@ +#include "test-type_array.h" +#include "test-type_array-uint128s_adjust_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint128s_adjust_callback__fails(void **state) { + + f_uint128_t data = 0; + f_uint128_t data_array[] = { data }; + f_uint128s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_uint128s_t datass_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_adjust, true); + will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_uint128s_adjust_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_uint128s_adjust_callback__works(void **state) { + + f_uint128_t data = 0; + f_uint128_t data_array[] = { data }; + f_uint128s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_uint128s_t datass_array[] = { datas }; + const f_number_unsigned_t length = 1; + + { + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_none); + + const f_status_t status = f_uint128s_adjust_callback(0, length, (void *) datass_array); + + assert_int_equal(status, F_none); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_adjust_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_adjust_callback.h new file mode 100644 index 000000000..c1e04c399 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_adjust_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint128s_adjust_callback +#define _TEST__F_type_array__uint128s_adjust_callback + +/** + * Test that the function fails. + * + * @see f_uint128s_adjust_callback() + */ +extern void test__f_type_array_uint128s_adjust_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_uint128s_adjust_callback() + */ +extern void test__f_type_array_uint128s_adjust_callback__works(void **state); + +#endif // _TEST__F_type_array__uint128s_adjust_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_append.c deleted file mode 100644 index e46007595..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_append.c +++ /dev/null @@ -1,37 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint128s_append.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint128s_append__parameter_checking(void **state) { - - const uint128_t data = 0; - - { - const f_status_t status = f_uint128s_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_uint128s_append__works(void **state) { - - const uint128_t source = 3; - f_uint128s_t destination = f_uint128s_t_initialize; - - { - const f_status_t status = f_uint128s_append(source, &destination); - - assert_int_equal(status, F_none); - assert_int_equal(destination.used, 1); - assert_int_equal(destination.array[0], source); - } - - free((void *) destination.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_append.h deleted file mode 100644 index 35114c427..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_append.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint128s_append -#define _TEST__F_type_array__uint128s_append - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint128s_append() - */ -extern void test__f_type_array_uint128s_append__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_uint128s_append() - */ -extern void test__f_type_array_uint128s_append__works(void **state); - -#endif // _TEST__F_type_array__uint128s_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_append_all.c deleted file mode 100644 index abc897c63..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_append_all.c +++ /dev/null @@ -1,82 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint128s_append_all.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint128s_append_all__parameter_checking(void **state) { - - const f_uint128s_t data = f_uint128s_t_initialize; - - { - const f_status_t status = f_uint128s_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_uint128s_append_all__returns_data_not(void **state) { - - const int length = 5; - f_uint128s_t source = f_uint128s_t_initialize; - f_uint128s_t destination = f_uint128s_t_initialize; - - { - const f_status_t status = f_uint128s_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_uint128s_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_type_array_uint128s_append_all__works(void **state) { - - const int length = 5; - const int length_used = 2; - f_uint128s_t source = f_uint128s_t_initialize; - f_uint128s_t destination = f_uint128s_t_initialize; - - { - const f_status_t status = f_uint128s_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - for (; source.used < length_used; ++source.used) { - source.array[source.used] = source.used + 1; - } // for - - { - const f_status_t status = f_uint128s_append_all(source, &destination); - - assert_int_equal(status, F_none); - assert_int_equal(destination.used, source.used); - assert_int_equal(destination.size, source.used); - - for (f_number_unsigned_t i = 0; i < source.used; ++i) { - assert_int_equal(destination.array[i], i + 1); - } // for - } - - free((void *) source.array); - free((void *) destination.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_append_all.h deleted file mode 100644 index 5cb702bf5..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_append_all.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint128s_append_all -#define _TEST__F_type_array__uint128s_append_all - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint128s_append_all() - */ -extern void test__f_type_array_uint128s_append_all__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_uint128s_append_all() - */ -extern void test__f_type_array_uint128s_append_all__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_uint128s_append_all() - */ -extern void test__f_type_array_uint128s_append_all__works(void **state); - -#endif // _TEST__F_type_array__uint128s_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_decimate_by.c deleted file mode 100644 index 14b4f6694..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_decimate_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint128s_decimate_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint128s_decimate_by__parameter_checking(void **state) { - - const int length = 5; - f_uint128s_t data = f_uint128s_t_initialize; - - { - const f_status_t status = f_uint128s_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_type_array_uint128s_decimate_by__returns_data_not(void **state) { - - const int length = 5; - f_uint128s_t data = f_uint128s_t_initialize; - - { - const f_status_t status = f_uint128s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint128s_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_type_array_uint128s_decimate_by__works(void **state) { - - const int length = 5; - f_uint128s_t data = f_uint128s_t_initialize; - - { - const f_status_t status = f_uint128s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint128s_decimate_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_decimate_by.h deleted file mode 100644 index 2ceb38722..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_decimate_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint128s_decimate_by -#define _TEST__F_type_array__uint128s_decimate_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint128s_decimate_by() - */ -extern void test__f_type_array_uint128s_decimate_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_uint128s_decimate_by() - */ -extern void test__f_type_array_uint128s_decimate_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_uint128s_decimate_by() - */ -extern void test__f_type_array_uint128s_decimate_by__works(void **state); - -#endif // _TEST__F_type_array__uint128s_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_decrease_by.c deleted file mode 100644 index 11025d116..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_decrease_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint128s_decrease_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint128s_decrease_by__parameter_checking(void **state) { - - const int length = 5; - f_uint128s_t data = f_uint128s_t_initialize; - - { - const f_status_t status = f_uint128s_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_type_array_uint128s_decrease_by__returns_data_not(void **state) { - - const int length = 5; - f_uint128s_t data = f_uint128s_t_initialize; - - { - const f_status_t status = f_uint128s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint128s_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_type_array_uint128s_decrease_by__works(void **state) { - - const int length = 5; - f_uint128s_t data = f_uint128s_t_initialize; - - { - const f_status_t status = f_uint128s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint128s_decrease_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_decrease_by.h deleted file mode 100644 index a66408f10..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_decrease_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint128s_decrease_by -#define _TEST__F_type_array__uint128s_decrease_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint128s_decrease_by() - */ -extern void test__f_type_array_uint128s_decrease_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_uint128s_decrease_by() - */ -extern void test__f_type_array_uint128s_decrease_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_uint128s_decrease_by() - */ -extern void test__f_type_array_uint128s_decrease_by__works(void **state); - -#endif // _TEST__F_type_array__uint128s_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_increase.c deleted file mode 100644 index 8987e3618..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_increase.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint128s_increase.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint128s_increase__parameter_checking(void **state) { - - const int length = 5; - f_uint128s_t data = f_uint128s_t_initialize; - - { - const f_status_t status = f_uint128s_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_type_array_uint128s_increase__returns_data_not(void **state) { - - const int length = 5; - f_uint128s_t data = f_uint128s_t_initialize; - - { - const f_status_t status = f_uint128s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint128s_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_type_array_uint128s_increase__works(void **state) { - - const int length = 5; - f_uint128s_t data = f_uint128s_t_initialize; - - { - const f_status_t status = f_uint128s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_uint128s_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_increase.h deleted file mode 100644 index ea29039aa..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_increase.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint128s_increase -#define _TEST__F_type_array__uint128s_increase - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint128s_increase() - */ -extern void test__f_type_array_uint128s_increase__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_uint128s_increase() - */ -extern void test__f_type_array_uint128s_increase__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_uint128s_increase() - */ -extern void test__f_type_array_uint128s_increase__works(void **state); - -#endif // _TEST__F_type_array__uint128s_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_increase_by.c deleted file mode 100644 index 6be1ebafd..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_increase_by.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint128s_increase_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint128s_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_uint128s_t data = f_uint128s_t_initialize; - - { - const f_status_t status = f_uint128s_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_type_array_uint128s_increase_by__returns_data_not(void **state) { - - const int length = 5; - f_uint128s_t data = f_uint128s_t_initialize; - - { - const f_status_t status = f_uint128s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint128s_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_type_array_uint128s_increase_by__works(void **state) { - - const int length = 5; - f_uint128s_t data = f_uint128s_t_initialize; - - { - const f_status_t status = f_uint128s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_uint128s_increase_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_increase_by.h deleted file mode 100644 index 7d8b01d53..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_increase_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint128s_increase_by -#define _TEST__F_type_array__uint128s_increase_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint128s_increase_by() - */ -extern void test__f_type_array_uint128s_increase_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_uint128s_increase_by() - */ -extern void test__f_type_array_uint128s_increase_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_uint128s_increase_by() - */ -extern void test__f_type_array_uint128s_increase_by__works(void **state); - -#endif // _TEST__F_type_array__uint128s_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_resize.c deleted file mode 100644 index b9bac7482..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_resize.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint128s_resize.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint128s_resize__parameter_checking(void **state) { - - const int length = 5; - f_uint128s_t data = f_uint128s_t_initialize; - - { - const f_status_t status = f_uint128s_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_type_array_uint128s_resize__works(void **state) { - - const int length = 5; - f_uint128s_t data = f_uint128s_t_initialize; - - { - const f_status_t status = f_uint128s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_resize.h deleted file mode 100644 index 0fb63a511..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_resize.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint128s_resize -#define _TEST__F_type_array__uint128s_resize - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint128s_resize() - */ -extern void test__f_type_array_uint128s_resize__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_uint128s_resize() - */ -extern void test__f_type_array_uint128s_resize__works(void **state); - -#endif // _TEST__F_type_array__uint128s_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_resize_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_resize_callback.c new file mode 100644 index 000000000..15c3b0112 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_resize_callback.c @@ -0,0 +1,45 @@ +#include "test-type_array.h" +#include "test-type_array-uint128s_resize_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint128s_resize_callback__fails(void **state) { + + f_uint128_t data = 0; + f_uint128_t data_array[] = { data }; + f_uint128s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_uint128s_t datass_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_resize, true); + will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_uint128s_resize_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_uint128s_resize_callback__works(void **state) { + + f_uint128_t data = 0; + f_uint128_t data_array[] = { data }; + f_uint128s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_uint128s_t datass_array[] = { datas }; + const f_number_unsigned_t length = 1; + + { + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_none); + + const f_status_t status = f_uint128s_resize_callback(0, length, (void *) datass_array); + + assert_int_equal(status, F_none); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_resize_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_resize_callback.h new file mode 100644 index 000000000..84e6dac57 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_resize_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint128s_resize_callback +#define _TEST__F_type_array__uint128s_resize_callback + +/** + * Test that the function fails. + * + * @see f_uint128s_resize_callback() + */ +extern void test__f_type_array_uint128s_resize_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_uint128s_resize_callback() + */ +extern void test__f_type_array_uint128s_resize_callback__works(void **state); + +#endif // _TEST__F_type_array__uint128s_resize_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_adjust.c deleted file mode 100644 index d42630b3b..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_adjust.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint128ss_adjust.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint128ss_adjust__parameter_checking(void **state) { - - const int length = 5; - f_uint128ss_t data = f_uint128ss_t_initialize; - - { - const f_status_t status = f_uint128ss_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_type_array_uint128ss_adjust__works(void **state) { - - const int length = 5; - f_uint128ss_t data = f_uint128ss_t_initialize; - - { - const f_status_t status = f_uint128ss_adjust(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_adjust.h deleted file mode 100644 index 3f2865b1e..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_adjust.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint128ss_adjust -#define _TEST__F_type_array__uint128ss_adjust - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint128ss_adjust() - */ -extern void test__f_type_array_uint128ss_adjust__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_uint128ss_increase_by() - */ -extern void test__f_type_array_uint128ss_increase_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_uint128ss_adjust() - */ -extern void test__f_type_array_uint128ss_adjust__works(void **state); - -#endif // _TEST__F_type_array__uint128ss_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_append.c deleted file mode 100644 index 838f00719..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_append.c +++ /dev/null @@ -1,86 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint128ss_append.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint128ss_append__parameter_checking(void **state) { - - f_uint128s_t data = f_uint128s_t_initialize; - - { - const f_status_t status = f_uint128ss_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_uint128ss_append__returns_data_not(void **state) { - - const int length = 5; - f_uint128s_t source = f_uint128s_t_initialize; - f_uint128ss_t destination = f_uint128ss_t_initialize; - - { - const f_status_t status = f_uint128s_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_uint128ss_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_type_array_uint128ss_append__works(void **state) { - - const int length = 5; - f_uint128s_t source = f_uint128s_t_initialize; - f_uint128ss_t destination = f_uint128ss_t_initialize; - - { - const f_status_t status = f_uint128s_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - for (; source.used < length; ++source.used) { - source.array[source.used] = source.used + 1; - } // for - - { - const f_status_t status = f_uint128ss_append(source, &destination); - - assert_int_equal(status, F_none); - 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], i + 1); - } // 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 diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_append.h deleted file mode 100644 index 0a2d806bd..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_append.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint128ss_append -#define _TEST__F_type_array__uint128ss_append - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint128ss_append() - */ -extern void test__f_type_array_uint128ss_append__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_uint128ss_append() - */ -extern void test__f_type_array_uint128ss_append__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_uint128ss_append() - */ -extern void test__f_type_array_uint128ss_append__works(void **state); - -#endif // _TEST__F_type_array__uint128ss_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_append_all.c deleted file mode 100644 index 57ae7bcc6..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_append_all.c +++ /dev/null @@ -1,105 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint128ss_append_all.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint128ss_append_all__parameter_checking(void **state) { - - const f_uint128ss_t data = f_uint128ss_t_initialize; - - { - const f_status_t status = f_uint128ss_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_uint128ss_append_all__returns_data_not(void **state) { - - const int length = 5; - f_uint128ss_t source = f_uint128ss_t_initialize; - f_uint128ss_t destination = f_uint128ss_t_initialize; - - { - const f_status_t status = f_uint128ss_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_uint128ss_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_type_array_uint128ss_append_all__works(void **state) { - - const int length = 5; - const int length_inner = 2; - f_uint128ss_t source = f_uint128ss_t_initialize; - f_uint128ss_t destination = f_uint128ss_t_initialize; - - { - const f_status_t status = f_uint128ss_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - for (; source.used < length; ++source.used) { - - const f_status_t status = f_uint128s_resize(length_inner, &source.array[source.used]); - - assert_int_equal(status, F_none); - - for (f_number_unsigned_t i = 0; i < length_inner; ++i) { - source.array[source.used].array[source.array[source.used].used++] = i + 1; - } // for - } // for - } - - { - const f_status_t status = f_uint128ss_append_all(source, &destination); - - assert_int_equal(status, F_none); - assert_int_equal(destination.used, source.used); - assert_int_equal(destination.size, source.used); - - for (f_number_unsigned_t i = 0; i < destination.used; ++i) { - - assert_int_equal(destination.array[i].used, length_inner); - assert_int_equal(destination.array[i].size, length_inner); - - for (f_number_unsigned_t j = 0; j < length_inner; ++j) { - assert_int_equal(destination.array[i].array[j], j + 1); - } // 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 diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_append_all.h deleted file mode 100644 index 9fdd35805..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_append_all.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint128ss_append_all -#define _TEST__F_type_array__uint128ss_append_all - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint128ss_append_all() - */ -extern void test__f_type_array_uint128ss_append_all__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_uint128ss_append_all() - */ -extern void test__f_type_array_uint128ss_append_all__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_uint128ss_append_all() - */ -extern void test__f_type_array_uint128ss_append_all__works(void **state); - -#endif // _TEST__F_type_array__uint128ss_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_decimate_by.c deleted file mode 100644 index 71e42e27d..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_decimate_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint128ss_decimate_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint128ss_decimate_by__parameter_checking(void **state) { - - const int length = 5; - f_uint128ss_t data = f_uint128s_t_initialize; - - { - const f_status_t status = f_uint128ss_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_type_array_uint128ss_decimate_by__returns_data_not(void **state) { - - const int length = 5; - f_uint128ss_t data = f_uint128ss_t_initialize; - - { - const f_status_t status = f_uint128ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint128ss_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_type_array_uint128ss_decimate_by__works(void **state) { - - const int length = 5; - f_uint128ss_t data = f_uint128s_t_initialize; - - { - const f_status_t status = f_uint128ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint128ss_decimate_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_decimate_by.h deleted file mode 100644 index bfc51614c..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_decimate_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint128ss_decimate_by -#define _TEST__F_type_array__uint128ss_decimate_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint128ss_decimate_by() - */ -extern void test__f_type_array_uint128ss_decimate_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_type_array_uint128ss_decimate_by() - */ -extern void test__f_type_array_uint128ss_decimate_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_uint128ss_decimate_by() - */ -extern void test__f_type_array_uint128ss_decimate_by__works(void **state); - -#endif // _TEST__F_type_array__uint128ss_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_decrease_by.c deleted file mode 100644 index 59f7298c9..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_decrease_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint128ss_decrease_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint128ss_decrease_by__parameter_checking(void **state) { - - const int length = 5; - f_uint128ss_t data = f_uint128s_t_initialize; - - { - const f_status_t status = f_uint128ss_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_type_array_uint128ss_decrease_by__returns_data_not(void **state) { - - const int length = 5; - f_uint128ss_t data = f_uint128ss_t_initialize; - - { - const f_status_t status = f_uint128ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint128ss_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_type_array_uint128ss_decrease_by__works(void **state) { - - const int length = 5; - f_uint128ss_t data = f_uint128s_t_initialize; - - { - const f_status_t status = f_uint128ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint128ss_decrease_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_decrease_by.h deleted file mode 100644 index fbad03d4c..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_decrease_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint128ss_decrease_by -#define _TEST__F_type_array__uint128ss_decrease_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint128ss_decrease_by() - */ -extern void test__f_type_array_uint128ss_decrease_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_uint128ss_decrease_by() - */ -extern void test__f_type_array_uint128ss_decrease_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_uint128ss_decrease_by() - */ -extern void test__f_type_array_uint128ss_decrease_by__works(void **state); - -#endif // _TEST__F_type_array__uint128ss_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_increase.c deleted file mode 100644 index cc5daad25..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_increase.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint128ss_increase.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint128ss_increase__parameter_checking(void **state) { - - const int length = 5; - f_uint128ss_t data = f_uint128s_t_initialize; - - { - const f_status_t status = f_uint128ss_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_type_array_uint128ss_increase__returns_data_not(void **state) { - - const int length = 5; - f_uint128ss_t data = f_uint128s_t_initialize; - - { - const f_status_t status = f_uint128ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint128ss_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_type_array_uint128ss_increase__works(void **state) { - - const int length = 5; - f_uint128ss_t data = f_uint128s_t_initialize; - - { - const f_status_t status = f_uint128ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_uint128ss_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_increase.h deleted file mode 100644 index 2e2e59915..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_increase.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint128ss_increase -#define _TEST__F_type_array__uint128ss_increase - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint128ss_increase() - */ -extern void test__f_type_array_uint128ss_increase__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_uint128ss_increase() - */ -extern void test__f_type_array_uint128ss_increase__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_uint128ss_increase() - */ -extern void test__f_type_array_uint128ss_increase__works(void **state); - -#endif // _TEST__F_type_array__uint128ss_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_increase_by.c deleted file mode 100644 index af14f4a11..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_increase_by.c +++ /dev/null @@ -1,84 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint128ss_increase_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint128ss_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_uint128ss_t data = f_uint128s_t_initialize; - - { - const f_status_t status = f_uint128ss_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_type_array_uint128ss_increase_by__returns_data_not(void **state) { - - const int length = 5; - f_uint128ss_t data = f_uint128ss_t_initialize; - - { - const f_status_t status = f_uint128ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint128ss_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_uint128ss_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_type_array_uint128ss_increase_by__works(void **state) { - - const int length = 5; - f_uint128ss_t data = f_uint128s_t_initialize; - - { - const f_status_t status = f_uint128ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_uint128ss_increase_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_increase_by.h deleted file mode 100644 index 5b6651fa3..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_increase_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint128ss_increase_by -#define _TEST__F_type_array__uint128ss_increase_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint128ss_increase_by() - */ -extern void test__f_type_array_uint128ss_increase_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_uint128ss_increase_by() - */ -extern void test__f_type_array_uint128ss_increase_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_uint128ss_increase_by() - */ -extern void test__f_type_array_uint128ss_increase_by__works(void **state); - -#endif // _TEST__F_type_array__uint128ss_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_resize.c deleted file mode 100644 index 52a3c4aba..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_resize.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint128ss_resize.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint128ss_resize__parameter_checking(void **state) { - - const int length = 5; - f_uint128ss_t data = f_uint128ss_t_initialize; - - { - const f_status_t status = f_uint128ss_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_type_array_uint128ss_resize__works(void **state) { - - const int length = 5; - f_uint128ss_t data = f_uint128ss_t_initialize; - - { - const f_status_t status = f_uint128ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_resize.h deleted file mode 100644 index c37f7c9f7..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_resize.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint128ss_resize -#define _TEST__F_type_array__uint128ss_resize - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint128ss_resize() - */ -extern void test__f_type_array_uint128ss_resize__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_uint128ss_resize() - */ -extern void test__f_type_array_uint128ss_resize__works(void **state); - -#endif // _TEST__F_type_array__uint128ss_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_adjust.c deleted file mode 100644 index c9c6b449f..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_adjust.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint16s_adjust.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint16s_adjust__parameter_checking(void **state) { - - const int length = 5; - f_uint16s_t data = f_uint16s_t_initialize; - - { - const f_status_t status = f_uint16s_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_type_array_uint16s_adjust__works(void **state) { - - const int length = 5; - f_uint16s_t data = f_uint16s_t_initialize; - - { - const f_status_t status = f_uint16s_adjust(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_adjust.h deleted file mode 100644 index 7170bbb42..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_adjust.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint16s_adjust -#define _TEST__F_type_array__uint16s_adjust - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint16s_adjust() - */ -extern void test__f_type_array_uint16s_adjust__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_uint16s_adjust() - */ -extern void test__f_type_array_uint16s_adjust__works(void **state); - -#endif // _TEST__F_type_array__uint16s_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_adjust_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_adjust_callback.c new file mode 100644 index 000000000..c4f9ef350 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_adjust_callback.c @@ -0,0 +1,45 @@ +#include "test-type_array.h" +#include "test-type_array-uint16s_adjust_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint16s_adjust_callback__fails(void **state) { + + uint16_t data = 0; + uint16_t data_array[] = { data }; + f_uint16s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_uint16s_t datass_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_adjust, true); + will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_uint16s_adjust_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_uint16s_adjust_callback__works(void **state) { + + uint16_t data = 0; + uint16_t data_array[] = { data }; + f_uint16s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_uint16s_t datass_array[] = { datas }; + const f_number_unsigned_t length = 1; + + { + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_none); + + const f_status_t status = f_uint16s_adjust_callback(0, length, (void *) datass_array); + + assert_int_equal(status, F_none); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_adjust_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_adjust_callback.h new file mode 100644 index 000000000..322b477ed --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_adjust_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint16s_adjust_callback +#define _TEST__F_type_array__uint16s_adjust_callback + +/** + * Test that the function fails. + * + * @see f_uint16s_adjust_callback() + */ +extern void test__f_type_array_uint16s_adjust_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_uint16s_adjust_callback() + */ +extern void test__f_type_array_uint16s_adjust_callback__works(void **state); + +#endif // _TEST__F_type_array__uint16s_adjust_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_append.c deleted file mode 100644 index 0fc429184..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_append.c +++ /dev/null @@ -1,37 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint16s_append.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint16s_append__parameter_checking(void **state) { - - const uint16_t data = 0; - - { - const f_status_t status = f_uint16s_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_uint16s_append__works(void **state) { - - const uint16_t source = 3; - f_uint16s_t destination = f_uint16s_t_initialize; - - { - const f_status_t status = f_uint16s_append(source, &destination); - - assert_int_equal(status, F_none); - assert_int_equal(destination.used, 1); - assert_int_equal(destination.array[0], source); - } - - free((void *) destination.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_append.h deleted file mode 100644 index 9b877420d..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_append.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint16s_append -#define _TEST__F_type_array__uint16s_append - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint16s_append() - */ -extern void test__f_type_array_uint16s_append__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_uint16s_append() - */ -extern void test__f_type_array_uint16s_append__works(void **state); - -#endif // _TEST__F_type_array__uint16s_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_append_all.c deleted file mode 100644 index 669a45382..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_append_all.c +++ /dev/null @@ -1,82 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint16s_append_all.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint16s_append_all__parameter_checking(void **state) { - - const f_uint16s_t data = f_uint16s_t_initialize; - - { - const f_status_t status = f_uint16s_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_uint16s_append_all__returns_data_not(void **state) { - - const int length = 5; - f_uint16s_t source = f_uint16s_t_initialize; - f_uint16s_t destination = f_uint16s_t_initialize; - - { - const f_status_t status = f_uint16s_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_uint16s_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_type_array_uint16s_append_all__works(void **state) { - - const int length = 5; - const int length_used = 2; - f_uint16s_t source = f_uint16s_t_initialize; - f_uint16s_t destination = f_uint16s_t_initialize; - - { - const f_status_t status = f_uint16s_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - for (; source.used < length_used; ++source.used) { - source.array[source.used] = source.used + 1; - } // for - - { - const f_status_t status = f_uint16s_append_all(source, &destination); - - assert_int_equal(status, F_none); - assert_int_equal(destination.used, source.used); - assert_int_equal(destination.size, source.used); - - for (f_number_unsigned_t i = 0; i < source.used; ++i) { - assert_int_equal(destination.array[i], i + 1); - } // for - } - - free((void *) source.array); - free((void *) destination.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_append_all.h deleted file mode 100644 index a80554ef7..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_append_all.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint16s_append_all -#define _TEST__F_type_array__uint16s_append_all - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint16s_append_all() - */ -extern void test__f_type_array_uint16s_append_all__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_uint16s_append_all() - */ -extern void test__f_type_array_uint16s_append_all__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_uint16s_append_all() - */ -extern void test__f_type_array_uint16s_append_all__works(void **state); - -#endif // _TEST__F_type_array__uint16s_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_decimate_by.c deleted file mode 100644 index 4c4c0b9e0..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_decimate_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint16s_decimate_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint16s_decimate_by__parameter_checking(void **state) { - - const int length = 5; - f_uint16s_t data = f_uint16s_t_initialize; - - { - const f_status_t status = f_uint16s_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_type_array_uint16s_decimate_by__returns_data_not(void **state) { - - const int length = 5; - f_uint16s_t data = f_uint16s_t_initialize; - - { - const f_status_t status = f_uint16s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint16s_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_type_array_uint16s_decimate_by__works(void **state) { - - const int length = 5; - f_uint16s_t data = f_uint16s_t_initialize; - - { - const f_status_t status = f_uint16s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint16s_decimate_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_decimate_by.h deleted file mode 100644 index ec5e40465..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_decimate_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint16s_decimate_by -#define _TEST__F_type_array__uint16s_decimate_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint16s_decimate_by() - */ -extern void test__f_type_array_uint16s_decimate_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_uint16s_decimate_by() - */ -extern void test__f_type_array_uint16s_decimate_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_uint16s_decimate_by() - */ -extern void test__f_type_array_uint16s_decimate_by__works(void **state); - -#endif // _TEST__F_type_array__uint16s_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_decrease_by.c deleted file mode 100644 index 9c0ffe0c1..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_decrease_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint16s_decrease_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint16s_decrease_by__parameter_checking(void **state) { - - const int length = 5; - f_uint16s_t data = f_uint16s_t_initialize; - - { - const f_status_t status = f_uint16s_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_type_array_uint16s_decrease_by__returns_data_not(void **state) { - - const int length = 5; - f_uint16s_t data = f_uint16s_t_initialize; - - { - const f_status_t status = f_uint16s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint16s_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_type_array_uint16s_decrease_by__works(void **state) { - - const int length = 5; - f_uint16s_t data = f_uint16s_t_initialize; - - { - const f_status_t status = f_uint16s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint16s_decrease_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_decrease_by.h deleted file mode 100644 index 9c6dc0c11..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_decrease_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint16s_decrease_by -#define _TEST__F_type_array__uint16s_decrease_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint16s_decrease_by() - */ -extern void test__f_type_array_uint16s_decrease_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_uint16s_decrease_by() - */ -extern void test__f_type_array_uint16s_decrease_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_uint16s_decrease_by() - */ -extern void test__f_type_array_uint16s_decrease_by__works(void **state); - -#endif // _TEST__F_type_array__uint16s_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_increase.c deleted file mode 100644 index 95342c8ff..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_increase.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint16s_increase.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint16s_increase__parameter_checking(void **state) { - - const int length = 5; - f_uint16s_t data = f_uint16s_t_initialize; - - { - const f_status_t status = f_uint16s_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_type_array_uint16s_increase__returns_data_not(void **state) { - - const int length = 5; - f_uint16s_t data = f_uint16s_t_initialize; - - { - const f_status_t status = f_uint16s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint16s_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_type_array_uint16s_increase__works(void **state) { - - const int length = 5; - f_uint16s_t data = f_uint16s_t_initialize; - - { - const f_status_t status = f_uint16s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_uint16s_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_increase.h deleted file mode 100644 index abee5b3fa..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_increase.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint16s_increase -#define _TEST__F_type_array__uint16s_increase - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint16s_increase() - */ -extern void test__f_type_array_uint16s_increase__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_uint16s_increase() - */ -extern void test__f_type_array_uint16s_increase__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_uint16s_increase() - */ -extern void test__f_type_array_uint16s_increase__works(void **state); - -#endif // _TEST__F_type_array__uint16s_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_increase_by.c deleted file mode 100644 index 8da3d3eb9..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_increase_by.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint16s_increase_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint16s_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_uint16s_t data = f_uint16s_t_initialize; - - { - const f_status_t status = f_uint16s_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_type_array_uint16s_increase_by__returns_data_not(void **state) { - - const int length = 5; - f_uint16s_t data = f_uint16s_t_initialize; - - { - const f_status_t status = f_uint16s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint16s_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_type_array_uint16s_increase_by__works(void **state) { - - const int length = 5; - f_uint16s_t data = f_uint16s_t_initialize; - - { - const f_status_t status = f_uint16s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_uint16s_increase_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_increase_by.h deleted file mode 100644 index 9a532e124..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_increase_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint16s_increase_by -#define _TEST__F_type_array__uint16s_increase_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint16s_increase_by() - */ -extern void test__f_type_array_uint16s_increase_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_uint16s_increase_by() - */ -extern void test__f_type_array_uint16s_increase_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_uint16s_increase_by() - */ -extern void test__f_type_array_uint16s_increase_by__works(void **state); - -#endif // _TEST__F_type_array__uint16s_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_resize.c deleted file mode 100644 index 048ff5eaf..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_resize.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint16s_resize.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint16s_resize__parameter_checking(void **state) { - - const int length = 5; - f_uint16s_t data = f_uint16s_t_initialize; - - { - const f_status_t status = f_uint16s_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_type_array_uint16s_resize__works(void **state) { - - const int length = 5; - f_uint16s_t data = f_uint16s_t_initialize; - - { - const f_status_t status = f_uint16s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_resize.h deleted file mode 100644 index 1f99cbdbc..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_resize.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint16s_resize -#define _TEST__F_type_array__uint16s_resize - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint16s_resize() - */ -extern void test__f_type_array_uint16s_resize__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_uint16s_resize() - */ -extern void test__f_type_array_uint16s_resize__works(void **state); - -#endif // _TEST__F_type_array__uint16s_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_resize_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_resize_callback.c new file mode 100644 index 000000000..f8d3f0cf5 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_resize_callback.c @@ -0,0 +1,45 @@ +#include "test-type_array.h" +#include "test-type_array-uint16s_resize_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint16s_resize_callback__fails(void **state) { + + uint16_t data = 0; + uint16_t data_array[] = { data }; + f_uint16s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_uint16s_t datass_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_resize, true); + will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_uint16s_resize_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_uint16s_resize_callback__works(void **state) { + + uint16_t data = 0; + uint16_t data_array[] = { data }; + f_uint16s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_uint16s_t datass_array[] = { datas }; + const f_number_unsigned_t length = 1; + + { + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_none); + + const f_status_t status = f_uint16s_resize_callback(0, length, (void *) datass_array); + + assert_int_equal(status, F_none); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_resize_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_resize_callback.h new file mode 100644 index 000000000..7b6c3320a --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_resize_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint16s_resize_callback +#define _TEST__F_type_array__uint16s_resize_callback + +/** + * Test that the function fails. + * + * @see f_uint16s_resize_callback() + */ +extern void test__f_type_array_uint16s_resize_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_uint16s_resize_callback() + */ +extern void test__f_type_array_uint16s_resize_callback__works(void **state); + +#endif // _TEST__F_type_array__uint16s_resize_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_adjust.c deleted file mode 100644 index c1c2285fe..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_adjust.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint16ss_adjust.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint16ss_adjust__parameter_checking(void **state) { - - const int length = 5; - f_uint16ss_t data = f_uint16ss_t_initialize; - - { - const f_status_t status = f_uint16ss_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_type_array_uint16ss_adjust__works(void **state) { - - const int length = 5; - f_uint16ss_t data = f_uint16ss_t_initialize; - - { - const f_status_t status = f_uint16ss_adjust(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_adjust.h deleted file mode 100644 index edd992937..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_adjust.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint16ss_adjust -#define _TEST__F_type_array__uint16ss_adjust - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint16ss_adjust() - */ -extern void test__f_type_array_uint16ss_adjust__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_uint16ss_adjust() - */ -extern void test__f_type_array_uint16ss_adjust__works(void **state); - -#endif // _TEST__F_type_array__uint16ss_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_append.c deleted file mode 100644 index 2a81be35e..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_append.c +++ /dev/null @@ -1,86 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint16ss_append.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint16ss_append__parameter_checking(void **state) { - - f_uint16s_t data = f_uint16s_t_initialize; - - { - const f_status_t status = f_uint16ss_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_uint16ss_append__returns_data_not(void **state) { - - const int length = 5; - f_uint16s_t source = f_uint16s_t_initialize; - f_uint16ss_t destination = f_uint16ss_t_initialize; - - { - const f_status_t status = f_uint16s_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_uint16ss_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_type_array_uint16ss_append__works(void **state) { - - const int length = 5; - f_uint16s_t source = f_uint16s_t_initialize; - f_uint16ss_t destination = f_uint16ss_t_initialize; - - { - const f_status_t status = f_uint16s_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - for (; source.used < length; ++source.used) { - source.array[source.used] = source.used + 1; - } // for - - { - const f_status_t status = f_uint16ss_append(source, &destination); - - assert_int_equal(status, F_none); - 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], i + 1); - } // 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 diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_append.h deleted file mode 100644 index 05aeb7c6c..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_append.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint16ss_append -#define _TEST__F_type_array__uint16ss_append - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint16ss_append() - */ -extern void test__f_type_array_uint16ss_append__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_uint16ss_append() - */ -extern void test__f_type_array_uint16ss_append__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_uint16ss_append() - */ -extern void test__f_type_array_uint16ss_append__works(void **state); - -#endif // _TEST__F_type_array__uint16ss_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_append_all.c deleted file mode 100644 index e643da8dc..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_append_all.c +++ /dev/null @@ -1,105 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint16ss_append_all.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint16ss_append_all__parameter_checking(void **state) { - - const f_uint16ss_t data = f_uint16ss_t_initialize; - - { - const f_status_t status = f_uint16ss_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_uint16ss_append_all__returns_data_not(void **state) { - - const int length = 5; - f_uint16ss_t source = f_uint16ss_t_initialize; - f_uint16ss_t destination = f_uint16ss_t_initialize; - - { - const f_status_t status = f_uint16ss_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_uint16ss_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_type_array_uint16ss_append_all__works(void **state) { - - const int length = 5; - const int length_inner = 2; - f_uint16ss_t source = f_uint16ss_t_initialize; - f_uint16ss_t destination = f_uint16ss_t_initialize; - - { - const f_status_t status = f_uint16ss_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - for (; source.used < length; ++source.used) { - - const f_status_t status = f_uint16s_resize(length_inner, &source.array[source.used]); - - assert_int_equal(status, F_none); - - for (f_number_unsigned_t i = 0; i < length_inner; ++i) { - source.array[source.used].array[source.array[source.used].used++] = i + 1; - } // for - } // for - } - - { - const f_status_t status = f_uint16ss_append_all(source, &destination); - - assert_int_equal(status, F_none); - assert_int_equal(destination.used, source.used); - assert_int_equal(destination.size, source.used); - - for (f_number_unsigned_t i = 0; i < destination.used; ++i) { - - assert_int_equal(destination.array[i].used, length_inner); - assert_int_equal(destination.array[i].size, length_inner); - - for (f_number_unsigned_t j = 0; j < length_inner; ++j) { - assert_int_equal(destination.array[i].array[j], j + 1); - } // 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 diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_append_all.h deleted file mode 100644 index 73e526113..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_append_all.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint16ss_append_all -#define _TEST__F_type_array__uint16ss_append_all - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint16ss_append_all() - */ -extern void test__f_type_array_uint16ss_append_all__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_uint16ss_append_all() - */ -extern void test__f_type_array_uint16ss_append_all__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_uint16ss_append_all() - */ -extern void test__f_type_array_uint16ss_append_all__works(void **state); - -#endif // _TEST__F_type_array__uint16ss_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_decimate_by.c deleted file mode 100644 index bc1bf2024..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_decimate_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint16ss_decimate_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint16ss_decimate_by__parameter_checking(void **state) { - - const int length = 5; - f_uint16ss_t data = f_uint16s_t_initialize; - - { - const f_status_t status = f_uint16ss_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_type_array_uint16ss_decimate_by__returns_data_not(void **state) { - - const int length = 5; - f_uint16ss_t data = f_uint16ss_t_initialize; - - { - const f_status_t status = f_uint16ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint16ss_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_type_array_uint16ss_decimate_by__works(void **state) { - - const int length = 5; - f_uint16ss_t data = f_uint16s_t_initialize; - - { - const f_status_t status = f_uint16ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint16ss_decimate_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_decimate_by.h deleted file mode 100644 index 91852c8bd..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_decimate_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint16ss_decimate_by -#define _TEST__F_type_array__uint16ss_decimate_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint16ss_decimate_by() - */ -extern void test__f_type_array_uint16ss_decimate_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_type_array_uint16ss_decimate_by() - */ -extern void test__f_type_array_uint16ss_decimate_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_uint16ss_decimate_by() - */ -extern void test__f_type_array_uint16ss_decimate_by__works(void **state); - -#endif // _TEST__F_type_array__uint16ss_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_decrease_by.c deleted file mode 100644 index 2b9c9550f..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_decrease_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint16ss_decrease_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint16ss_decrease_by__parameter_checking(void **state) { - - const int length = 5; - f_uint16ss_t data = f_uint16s_t_initialize; - - { - const f_status_t status = f_uint16ss_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_type_array_uint16ss_decrease_by__returns_data_not(void **state) { - - const int length = 5; - f_uint16ss_t data = f_uint16ss_t_initialize; - - { - const f_status_t status = f_uint16ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint16ss_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_type_array_uint16ss_decrease_by__works(void **state) { - - const int length = 5; - f_uint16ss_t data = f_uint16s_t_initialize; - - { - const f_status_t status = f_uint16ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint16ss_decrease_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_decrease_by.h deleted file mode 100644 index f1a9d912b..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_decrease_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint16ss_decrease_by -#define _TEST__F_type_array__uint16ss_decrease_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint16ss_decrease_by() - */ -extern void test__f_type_array_uint16ss_decrease_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_uint16ss_decrease_by() - */ -extern void test__f_type_array_uint16ss_decrease_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_uint16ss_decrease_by() - */ -extern void test__f_type_array_uint16ss_decrease_by__works(void **state); - -#endif // _TEST__F_type_array__uint16ss_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_increase.c deleted file mode 100644 index 8808da3aa..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_increase.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint16ss_increase.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint16ss_increase__parameter_checking(void **state) { - - const int length = 5; - f_uint16ss_t data = f_uint16s_t_initialize; - - { - const f_status_t status = f_uint16ss_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_type_array_uint16ss_increase__returns_data_not(void **state) { - - const int length = 5; - f_uint16ss_t data = f_uint16s_t_initialize; - - { - const f_status_t status = f_uint16ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint16ss_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_type_array_uint16ss_increase__works(void **state) { - - const int length = 5; - f_uint16ss_t data = f_uint16s_t_initialize; - - { - const f_status_t status = f_uint16ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_uint16ss_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_increase.h deleted file mode 100644 index 859b13832..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_increase.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint16ss_increase -#define _TEST__F_type_array__uint16ss_increase - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint16ss_increase() - */ -extern void test__f_type_array_uint16ss_increase__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_uint16ss_increase() - */ -extern void test__f_type_array_uint16ss_increase__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_uint16ss_increase() - */ -extern void test__f_type_array_uint16ss_increase__works(void **state); - -#endif // _TEST__F_type_array__uint16ss_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_increase_by.c deleted file mode 100644 index 79b090028..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_increase_by.c +++ /dev/null @@ -1,84 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint16ss_increase_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint16ss_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_uint16ss_t data = f_uint16s_t_initialize; - - { - const f_status_t status = f_uint16ss_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_type_array_uint16ss_increase_by__returns_data_not(void **state) { - - const int length = 5; - f_uint16ss_t data = f_uint16ss_t_initialize; - - { - const f_status_t status = f_uint16ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint16ss_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_uint16ss_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_type_array_uint16ss_increase_by__works(void **state) { - - const int length = 5; - f_uint16ss_t data = f_uint16s_t_initialize; - - { - const f_status_t status = f_uint16ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_uint16ss_increase_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_increase_by.h deleted file mode 100644 index f2295b7fb..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_increase_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint16ss_increase_by -#define _TEST__F_type_array__uint16ss_increase_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint16ss_increase_by() - */ -extern void test__f_type_array_uint16ss_increase_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_uint16ss_increase_by() - */ -extern void test__f_type_array_uint16ss_increase_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_uint16ss_increase_by() - */ -extern void test__f_type_array_uint16ss_increase_by__works(void **state); - -#endif // _TEST__F_type_array__uint16ss_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_resize.c deleted file mode 100644 index b087228c0..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_resize.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint16ss_resize.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint16ss_resize__parameter_checking(void **state) { - - const int length = 5; - f_uint16ss_t data = f_uint16ss_t_initialize; - - { - const f_status_t status = f_uint16ss_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_type_array_uint16ss_resize__works(void **state) { - - const int length = 5; - f_uint16ss_t data = f_uint16ss_t_initialize; - - { - const f_status_t status = f_uint16ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_resize.h deleted file mode 100644 index c15254697..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_resize.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint16ss_resize -#define _TEST__F_type_array__uint16ss_resize - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint16ss_resize() - */ -extern void test__f_type_array_uint16ss_resize__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_uint16ss_resize() - */ -extern void test__f_type_array_uint16ss_resize__works(void **state); - -#endif // _TEST__F_type_array__uint16ss_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_adjust.c deleted file mode 100644 index 2e732dbf9..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_adjust.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint32s_adjust.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint32s_adjust__parameter_checking(void **state) { - - const int length = 5; - f_uint32s_t data = f_uint32s_t_initialize; - - { - const f_status_t status = f_uint32s_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_type_array_uint32s_adjust__works(void **state) { - - const int length = 5; - f_uint32s_t data = f_uint32s_t_initialize; - - { - const f_status_t status = f_uint32s_adjust(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_adjust.h deleted file mode 100644 index f547b955c..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_adjust.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint32s_adjust -#define _TEST__F_type_array__uint32s_adjust - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint32s_adjust() - */ -extern void test__f_type_array_uint32s_adjust__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_uint32s_adjust() - */ -extern void test__f_type_array_uint32s_adjust__works(void **state); - -#endif // _TEST__F_type_array__uint32s_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_adjust_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_adjust_callback.c new file mode 100644 index 000000000..466a72636 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_adjust_callback.c @@ -0,0 +1,45 @@ +#include "test-type_array.h" +#include "test-type_array-uint32s_adjust_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint32s_adjust_callback__fails(void **state) { + + uint32_t data = 0; + uint32_t data_array[] = { data }; + f_uint32s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_uint32s_t datass_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_adjust, true); + will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_uint32s_adjust_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_uint32s_adjust_callback__works(void **state) { + + uint32_t data = 0; + uint32_t data_array[] = { data }; + f_uint32s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_uint32s_t datass_array[] = { datas }; + const f_number_unsigned_t length = 1; + + { + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_none); + + const f_status_t status = f_uint32s_adjust_callback(0, length, (void *) datass_array); + + assert_int_equal(status, F_none); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_adjust_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_adjust_callback.h new file mode 100644 index 000000000..17a024c16 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_adjust_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint32s_adjust_callback +#define _TEST__F_type_array__uint32s_adjust_callback + +/** + * Test that the function fails. + * + * @see f_uint32s_adjust_callback() + */ +extern void test__f_type_array_uint32s_adjust_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_uint32s_adjust_callback() + */ +extern void test__f_type_array_uint32s_adjust_callback__works(void **state); + +#endif // _TEST__F_type_array__uint32s_adjust_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_append.c deleted file mode 100644 index 718879010..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_append.c +++ /dev/null @@ -1,37 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint32s_append.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint32s_append__parameter_checking(void **state) { - - const uint32_t data = 0; - - { - const f_status_t status = f_uint32s_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_uint32s_append__works(void **state) { - - const uint32_t source = 3; - f_uint32s_t destination = f_uint32s_t_initialize; - - { - const f_status_t status = f_uint32s_append(source, &destination); - - assert_int_equal(status, F_none); - assert_int_equal(destination.used, 1); - assert_int_equal(destination.array[0], source); - } - - free((void *) destination.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_append.h deleted file mode 100644 index d507f0b0a..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_append.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint32s_append -#define _TEST__F_type_array__uint32s_append -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint32s_append() - */ -extern void test__f_type_array_uint32s_append__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_uint32s_append() - */ -extern void test__f_type_array_uint32s_append__works(void **state); - - -#endif // _TEST__F_type_array__uint32s_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_append_all.c deleted file mode 100644 index 9e2807d62..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_append_all.c +++ /dev/null @@ -1,82 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint32s_append_all.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint32s_append_all__parameter_checking(void **state) { - - const f_uint32s_t data = f_uint32s_t_initialize; - - { - const f_status_t status = f_uint32s_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_uint32s_append_all__returns_data_not(void **state) { - - const int length = 5; - f_uint32s_t source = f_uint32s_t_initialize; - f_uint32s_t destination = f_uint32s_t_initialize; - - { - const f_status_t status = f_uint32s_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_uint32s_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_type_array_uint32s_append_all__works(void **state) { - - const int length = 5; - const int length_used = 2; - f_uint32s_t source = f_uint32s_t_initialize; - f_uint32s_t destination = f_uint32s_t_initialize; - - { - const f_status_t status = f_uint32s_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - for (; source.used < length_used; ++source.used) { - source.array[source.used] = source.used + 1; - } // for - - { - const f_status_t status = f_uint32s_append_all(source, &destination); - - assert_int_equal(status, F_none); - assert_int_equal(destination.used, source.used); - assert_int_equal(destination.size, source.used); - - for (f_number_unsigned_t i = 0; i < source.used; ++i) { - assert_int_equal(destination.array[i], i + 1); - } // for - } - - free((void *) source.array); - free((void *) destination.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_append_all.h deleted file mode 100644 index 1f89aa89b..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_append_all.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint32s_append_all -#define _TEST__F_type_array__uint32s_append_all - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint32s_append_all() - */ -extern void test__f_type_array_uint32s_append_all__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_uint32s_append_all() - */ -extern void test__f_type_array_uint32s_append_all__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_uint32s_append_all() - */ -extern void test__f_type_array_uint32s_append_all__works(void **state); - -#endif // _TEST__F_type_array__uint32s_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_decimate_by.c deleted file mode 100644 index f73028ad4..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_decimate_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint32s_decimate_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint32s_decimate_by__parameter_checking(void **state) { - - const int length = 5; - f_uint32s_t data = f_uint32s_t_initialize; - - { - const f_status_t status = f_uint32s_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_type_array_uint32s_decimate_by__returns_data_not(void **state) { - - const int length = 5; - f_uint32s_t data = f_uint32s_t_initialize; - - { - const f_status_t status = f_uint32s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint32s_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_type_array_uint32s_decimate_by__works(void **state) { - - const int length = 5; - f_uint32s_t data = f_uint32s_t_initialize; - - { - const f_status_t status = f_uint32s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint32s_decimate_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_decimate_by.h deleted file mode 100644 index 1adc46db9..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_decimate_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint32s_decimate_by -#define _TEST__F_type_array__uint32s_decimate_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint32s_decimate_by() - */ -extern void test__f_type_array_uint32s_decimate_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_uint32s_decimate_by() - */ -extern void test__f_type_array_uint32s_decimate_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_uint32s_decimate_by() - */ -extern void test__f_type_array_uint32s_decimate_by__works(void **state); - -#endif // _TEST__F_type_array__uint32s_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_decrease_by.c deleted file mode 100644 index eff4ffa9d..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_decrease_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint32s_decrease_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint32s_decrease_by__parameter_checking(void **state) { - - const int length = 5; - f_uint32s_t data = f_uint32s_t_initialize; - - { - const f_status_t status = f_uint32s_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_type_array_uint32s_decrease_by__returns_data_not(void **state) { - - const int length = 5; - f_uint32s_t data = f_uint32s_t_initialize; - - { - const f_status_t status = f_uint32s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint32s_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_type_array_uint32s_decrease_by__works(void **state) { - - const int length = 5; - f_uint32s_t data = f_uint32s_t_initialize; - - { - const f_status_t status = f_uint32s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint32s_decrease_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_decrease_by.h deleted file mode 100644 index fb7c0219b..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_decrease_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint32s_decrease_by -#define _TEST__F_type_array__uint32s_decrease_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint32s_decrease_by() - */ -extern void test__f_type_array_uint32s_decrease_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_uint32s_decrease_by() - */ -extern void test__f_type_array_uint32s_decrease_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_uint32s_decrease_by() - */ -extern void test__f_type_array_uint32s_decrease_by__works(void **state); - -#endif // _TEST__F_type_array__uint32s_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_increase.c deleted file mode 100644 index 378ae00eb..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_increase.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint32s_increase.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint32s_increase__parameter_checking(void **state) { - - const int length = 5; - f_uint32s_t data = f_uint32s_t_initialize; - - { - const f_status_t status = f_uint32s_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_type_array_uint32s_increase__returns_data_not(void **state) { - - const int length = 5; - f_uint32s_t data = f_uint32s_t_initialize; - - { - const f_status_t status = f_uint32s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint32s_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_type_array_uint32s_increase__works(void **state) { - - const int length = 5; - f_uint32s_t data = f_uint32s_t_initialize; - - { - const f_status_t status = f_uint32s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_uint32s_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_increase.h deleted file mode 100644 index 9fc1518d4..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_increase.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint32s_increase -#define _TEST__F_type_array__uint32s_increase - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint32s_increase() - */ -extern void test__f_type_array_uint32s_increase__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_uint32s_increase() - */ -extern void test__f_type_array_uint32s_increase__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_uint32s_increase() - */ -extern void test__f_type_array_uint32s_increase__works(void **state); - -#endif // _TEST__F_type_array__uint32s_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_increase_by.c deleted file mode 100644 index a05c1d24b..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_increase_by.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint32s_increase_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint32s_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_uint32s_t data = f_uint32s_t_initialize; - - { - const f_status_t status = f_uint32s_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_type_array_uint32s_increase_by__returns_data_not(void **state) { - - const int length = 5; - f_uint32s_t data = f_uint32s_t_initialize; - - { - const f_status_t status = f_uint32s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint32s_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_type_array_uint32s_increase_by__works(void **state) { - - const int length = 5; - f_uint32s_t data = f_uint32s_t_initialize; - - { - const f_status_t status = f_uint32s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_uint32s_increase_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_increase_by.h deleted file mode 100644 index b8891520d..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_increase_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint32s_increase_by -#define _TEST__F_type_array__uint32s_increase_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint32s_increase_by() - */ -extern void test__f_type_array_uint32s_increase_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_uint32s_increase_by() - */ -extern void test__f_type_array_uint32s_increase_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_uint32s_increase_by() - */ -extern void test__f_type_array_uint32s_increase_by__works(void **state); - -#endif // _TEST__F_type_array__uint32s_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_resize.c deleted file mode 100644 index 54d8457e7..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_resize.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint32s_resize.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint32s_resize__parameter_checking(void **state) { - - const int length = 5; - f_uint32s_t data = f_uint32s_t_initialize; - - { - const f_status_t status = f_uint32s_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_type_array_uint32s_resize__works(void **state) { - - const int length = 5; - f_uint32s_t data = f_uint32s_t_initialize; - - { - const f_status_t status = f_uint32s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_resize.h deleted file mode 100644 index 89368fb01..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_resize.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint32s_resize -#define _TEST__F_type_array__uint32s_resize - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint32s_resize() - */ -extern void test__f_type_array_uint32s_resize__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_uint32s_resize() - */ -extern void test__f_type_array_uint32s_resize__works(void **state); - -#endif // _TEST__F_type_array__uint32s_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_resize_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_resize_callback.c new file mode 100644 index 000000000..02f0a6762 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_resize_callback.c @@ -0,0 +1,45 @@ +#include "test-type_array.h" +#include "test-type_array-uint32s_resize_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint32s_resize_callback__fails(void **state) { + + uint32_t data = 0; + uint32_t data_array[] = { data }; + f_uint32s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_uint32s_t datass_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_resize, true); + will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_uint32s_resize_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_uint32s_resize_callback__works(void **state) { + + uint32_t data = 0; + uint32_t data_array[] = { data }; + f_uint32s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_uint32s_t datass_array[] = { datas }; + const f_number_unsigned_t length = 1; + + { + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_none); + + const f_status_t status = f_uint32s_resize_callback(0, length, (void *) datass_array); + + assert_int_equal(status, F_none); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_resize_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_resize_callback.h new file mode 100644 index 000000000..45782c021 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_resize_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint32s_resize_callback +#define _TEST__F_type_array__uint32s_resize_callback + +/** + * Test that the function fails. + * + * @see f_uint32s_resize_callback() + */ +extern void test__f_type_array_uint32s_resize_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_uint32s_resize_callback() + */ +extern void test__f_type_array_uint32s_resize_callback__works(void **state); + +#endif // _TEST__F_type_array__uint32s_resize_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_adjust.c deleted file mode 100644 index 89bf16c93..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_adjust.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint32ss_adjust.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint32ss_adjust__parameter_checking(void **state) { - - const int length = 5; - f_uint32ss_t data = f_uint32ss_t_initialize; - - { - const f_status_t status = f_uint32ss_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_type_array_uint32ss_adjust__works(void **state) { - - const int length = 5; - f_uint32ss_t data = f_uint32ss_t_initialize; - - { - const f_status_t status = f_uint32ss_adjust(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_adjust.h deleted file mode 100644 index 3d1c1989c..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_adjust.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint32ss_adjust -#define _TEST__F_type_array__uint32ss_adjust - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint32ss_adjust() - */ -extern void test__f_type_array_uint32ss_adjust__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_uint32ss_adjust() - */ -extern void test__f_type_array_uint32ss_adjust__works(void **state); - -#endif // _TEST__F_type_array__uint32ss_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_append.c deleted file mode 100644 index 9e8405a3e..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_append.c +++ /dev/null @@ -1,86 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint32ss_append.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint32ss_append__parameter_checking(void **state) { - - f_uint32s_t data = f_uint32s_t_initialize; - - { - const f_status_t status = f_uint32ss_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_uint32ss_append__returns_data_not(void **state) { - - const int length = 5; - f_uint32s_t source = f_uint32s_t_initialize; - f_uint32ss_t destination = f_uint32ss_t_initialize; - - { - const f_status_t status = f_uint32s_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_uint32ss_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_type_array_uint32ss_append__works(void **state) { - - const int length = 5; - f_uint32s_t source = f_uint32s_t_initialize; - f_uint32ss_t destination = f_uint32ss_t_initialize; - - { - const f_status_t status = f_uint32s_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - for (; source.used < length; ++source.used) { - source.array[source.used] = source.used + 1; - } // for - - { - const f_status_t status = f_uint32ss_append(source, &destination); - - assert_int_equal(status, F_none); - 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], i + 1); - } // 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 diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_append.h deleted file mode 100644 index 3e50a1061..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_append.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint32ss_append -#define _TEST__F_type_array__uint32ss_append - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint32ss_append() - */ -extern void test__f_type_array_uint32ss_append__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_uint32ss_append() - */ -extern void test__f_type_array_uint32ss_append__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_uint32ss_append() - */ -extern void test__f_type_array_uint32ss_append__works(void **state); - -#endif // _TEST__F_type_array__uint32ss_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_append_all.c deleted file mode 100644 index 91bc05e0e..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_append_all.c +++ /dev/null @@ -1,105 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint32ss_append_all.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint32ss_append_all__parameter_checking(void **state) { - - const f_uint32ss_t data = f_uint32ss_t_initialize; - - { - const f_status_t status = f_uint32ss_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_uint32ss_append_all__returns_data_not(void **state) { - - const int length = 5; - f_uint32ss_t source = f_uint32ss_t_initialize; - f_uint32ss_t destination = f_uint32ss_t_initialize; - - { - const f_status_t status = f_uint32ss_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_uint32ss_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_type_array_uint32ss_append_all__works(void **state) { - - const int length = 5; - const int length_inner = 2; - f_uint32ss_t source = f_uint32ss_t_initialize; - f_uint32ss_t destination = f_uint32ss_t_initialize; - - { - const f_status_t status = f_uint32ss_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - for (; source.used < length; ++source.used) { - - const f_status_t status = f_uint32s_resize(length_inner, &source.array[source.used]); - - assert_int_equal(status, F_none); - - for (f_number_unsigned_t i = 0; i < length_inner; ++i) { - source.array[source.used].array[source.array[source.used].used++] = i + 1; - } // for - } // for - } - - { - const f_status_t status = f_uint32ss_append_all(source, &destination); - - assert_int_equal(status, F_none); - assert_int_equal(destination.used, source.used); - assert_int_equal(destination.size, source.used); - - for (f_number_unsigned_t i = 0; i < destination.used; ++i) { - - assert_int_equal(destination.array[i].used, length_inner); - assert_int_equal(destination.array[i].size, length_inner); - - for (f_number_unsigned_t j = 0; j < length_inner; ++j) { - assert_int_equal(destination.array[i].array[j], j + 1); - } // 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 diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_append_all.h deleted file mode 100644 index dece6c9ab..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_append_all.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint32ss_append_all -#define _TEST__F_type_array__uint32ss_append_all - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint32ss_append_all() - */ -extern void test__f_type_array_uint32ss_append_all__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_uint32ss_append_all() - */ -extern void test__f_type_array_uint32ss_append_all__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_uint32ss_append_all() - */ -extern void test__f_type_array_uint32ss_append_all__works(void **state); - -#endif // _TEST__F_type_array__uint32ss_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_decimate_by.c deleted file mode 100644 index 5219c964f..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_decimate_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint32ss_decimate_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint32ss_decimate_by__parameter_checking(void **state) { - - const int length = 5; - f_uint32ss_t data = f_uint32s_t_initialize; - - { - const f_status_t status = f_uint32ss_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_type_array_uint32ss_decimate_by__returns_data_not(void **state) { - - const int length = 5; - f_uint32ss_t data = f_uint32ss_t_initialize; - - { - const f_status_t status = f_uint32ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint32ss_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_type_array_uint32ss_decimate_by__works(void **state) { - - const int length = 5; - f_uint32ss_t data = f_uint32s_t_initialize; - - { - const f_status_t status = f_uint32ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint32ss_decimate_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_decimate_by.h deleted file mode 100644 index d9d8563db..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_decimate_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint32ss_decimate_by -#define _TEST__F_type_array__uint32ss_decimate_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint32ss_decimate_by() - */ -extern void test__f_type_array_uint32ss_decimate_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_type_array_uint32ss_decimate_by() - */ -extern void test__f_type_array_uint32ss_decimate_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_uint32ss_decimate_by() - */ -extern void test__f_type_array_uint32ss_decimate_by__works(void **state); - -#endif // _TEST__F_type_array__uint32ss_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_decrease_by.c deleted file mode 100644 index 27512737f..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_decrease_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint32ss_decrease_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint32ss_decrease_by__parameter_checking(void **state) { - - const int length = 5; - f_uint32ss_t data = f_uint32s_t_initialize; - - { - const f_status_t status = f_uint32ss_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_type_array_uint32ss_decrease_by__returns_data_not(void **state) { - - const int length = 5; - f_uint32ss_t data = f_uint32ss_t_initialize; - - { - const f_status_t status = f_uint32ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint32ss_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_type_array_uint32ss_decrease_by__works(void **state) { - - const int length = 5; - f_uint32ss_t data = f_uint32s_t_initialize; - - { - const f_status_t status = f_uint32ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint32ss_decrease_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_decrease_by.h deleted file mode 100644 index 3abfcfd27..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_decrease_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint32ss_decrease_by -#define _TEST__F_type_array__uint32ss_decrease_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint32ss_decrease_by() - */ -extern void test__f_type_array_uint32ss_decrease_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_uint32ss_decrease_by() - */ -extern void test__f_type_array_uint32ss_decrease_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_uint32ss_decrease_by() - */ -extern void test__f_type_array_uint32ss_decrease_by__works(void **state); - -#endif // _TEST__F_type_array__uint32ss_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_increase.c deleted file mode 100644 index 344012ec7..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_increase.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint32ss_increase.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint32ss_increase__parameter_checking(void **state) { - - const int length = 5; - f_uint32ss_t data = f_uint32s_t_initialize; - - { - const f_status_t status = f_uint32ss_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_type_array_uint32ss_increase__returns_data_not(void **state) { - - const int length = 5; - f_uint32ss_t data = f_uint32s_t_initialize; - - { - const f_status_t status = f_uint32ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint32ss_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_type_array_uint32ss_increase__works(void **state) { - - const int length = 5; - f_uint32ss_t data = f_uint32s_t_initialize; - - { - const f_status_t status = f_uint32ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_uint32ss_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_increase.h deleted file mode 100644 index 571bdf22f..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_increase.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint32ss_increase -#define _TEST__F_type_array__uint32ss_increase - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint32ss_increase() - */ -extern void test__f_type_array_uint32ss_increase__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_uint32ss_increase() - */ -extern void test__f_type_array_uint32ss_increase__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_uint32ss_increase() - */ -extern void test__f_type_array_uint32ss_increase__works(void **state); - -#endif // _TEST__F_type_array__uint32ss_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_increase_by.c deleted file mode 100644 index 449e2b242..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_increase_by.c +++ /dev/null @@ -1,84 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint32ss_increase_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint32ss_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_uint32ss_t data = f_uint32s_t_initialize; - - { - const f_status_t status = f_uint32ss_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_type_array_uint32ss_increase_by__returns_data_not(void **state) { - - const int length = 5; - f_uint32ss_t data = f_uint32ss_t_initialize; - - { - const f_status_t status = f_uint32ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint32ss_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_uint32ss_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_type_array_uint32ss_increase_by__works(void **state) { - - const int length = 5; - f_uint32ss_t data = f_uint32s_t_initialize; - - { - const f_status_t status = f_uint32ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_uint32ss_increase_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_increase_by.h deleted file mode 100644 index a067e2aa3..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_increase_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint32ss_increase_by -#define _TEST__F_type_array__uint32ss_increase_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint32ss_increase_by() - */ -extern void test__f_type_array_uint32ss_increase_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_uint32ss_increase_by() - */ -extern void test__f_type_array_uint32ss_increase_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_uint32ss_increase_by() - */ -extern void test__f_type_array_uint32ss_increase_by__works(void **state); - -#endif // _TEST__F_type_array__uint32ss_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_resize.c deleted file mode 100644 index 27209a415..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_resize.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint32ss_resize.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint32ss_resize__parameter_checking(void **state) { - - const int length = 5; - f_uint32ss_t data = f_uint32ss_t_initialize; - - { - const f_status_t status = f_uint32ss_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_type_array_uint32ss_resize__works(void **state) { - - const int length = 5; - f_uint32ss_t data = f_uint32ss_t_initialize; - - { - const f_status_t status = f_uint32ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_resize.h deleted file mode 100644 index 738b9fb04..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_resize.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint32ss_resize -#define _TEST__F_type_array__uint32ss_resize - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint32ss_resize() - */ -extern void test__f_type_array_uint32ss_resize__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_uint32ss_resize() - */ -extern void test__f_type_array_uint32ss_resize__works(void **state); - -#endif // _TEST__F_type_array__uint32ss_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_adjust.c deleted file mode 100644 index fd65031fe..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_adjust.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint64s_adjust.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint64s_adjust__parameter_checking(void **state) { - - const int length = 5; - f_uint64s_t data = f_uint64s_t_initialize; - - { - const f_status_t status = f_uint64s_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_type_array_uint64s_adjust__works(void **state) { - - const int length = 5; - f_uint64s_t data = f_uint64s_t_initialize; - - { - const f_status_t status = f_uint64s_adjust(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_adjust.h deleted file mode 100644 index 678592f78..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_adjust.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint64s_adjust -#define _TEST__F_type_array__uint64s_adjust - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint64s_adjust() - */ -extern void test__f_type_array_uint64s_adjust__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_uint64s_adjust() - */ -extern void test__f_type_array_uint64s_adjust__works(void **state); - -#endif // _TEST__F_type_array__uint64s_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_adjust_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_adjust_callback.c new file mode 100644 index 000000000..c40b2a3a0 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_adjust_callback.c @@ -0,0 +1,45 @@ +#include "test-type_array.h" +#include "test-type_array-uint64s_adjust_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint64s_adjust_callback__fails(void **state) { + + uint64_t data = 0; + uint64_t data_array[] = { data }; + f_uint64s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_uint64s_t datass_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_adjust, true); + will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_uint64s_adjust_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_uint64s_adjust_callback__works(void **state) { + + uint64_t data = 0; + uint64_t data_array[] = { data }; + f_uint64s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_uint64s_t datass_array[] = { datas }; + const f_number_unsigned_t length = 1; + + { + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_none); + + const f_status_t status = f_uint64s_adjust_callback(0, length, (void *) datass_array); + + assert_int_equal(status, F_none); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_adjust_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_adjust_callback.h new file mode 100644 index 000000000..ddde9009e --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_adjust_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint64s_adjust_callback +#define _TEST__F_type_array__uint64s_adjust_callback + +/** + * Test that the function fails. + * + * @see f_uint64s_adjust_callback() + */ +extern void test__f_type_array_uint64s_adjust_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_uint64s_adjust_callback() + */ +extern void test__f_type_array_uint64s_adjust_callback__works(void **state); + +#endif // _TEST__F_type_array__uint64s_adjust_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_append.c deleted file mode 100644 index a4490fbd9..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_append.c +++ /dev/null @@ -1,37 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint64s_append.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint64s_append__parameter_checking(void **state) { - - const uint64_t data = 0; - - { - const f_status_t status = f_uint64s_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_uint64s_append__works(void **state) { - - const uint64_t source = 3; - f_uint64s_t destination = f_uint64s_t_initialize; - - { - const f_status_t status = f_uint64s_append(source, &destination); - - assert_int_equal(status, F_none); - assert_int_equal(destination.used, 1); - assert_int_equal(destination.array[0], source); - } - - free((void *) destination.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_append.h deleted file mode 100644 index 05e79cb71..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_append.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint64s_append -#define _TEST__F_type_array__uint64s_append - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint64s_append() - */ -extern void test__f_type_array_uint64s_append__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_uint64s_append() - */ -extern void test__f_type_array_uint64s_append__works(void **state); - -#endif // _TEST__F_type_array__uint64s_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_append_all.c deleted file mode 100644 index 5af7533fb..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_append_all.c +++ /dev/null @@ -1,82 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint64s_append_all.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint64s_append_all__parameter_checking(void **state) { - - const f_uint64s_t data = f_uint64s_t_initialize; - - { - const f_status_t status = f_uint64s_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_uint64s_append_all__returns_data_not(void **state) { - - const int length = 5; - f_uint64s_t source = f_uint64s_t_initialize; - f_uint64s_t destination = f_uint64s_t_initialize; - - { - const f_status_t status = f_uint64s_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_uint64s_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_type_array_uint64s_append_all__works(void **state) { - - const int length = 5; - const int length_used = 2; - f_uint64s_t source = f_uint64s_t_initialize; - f_uint64s_t destination = f_uint64s_t_initialize; - - { - const f_status_t status = f_uint64s_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - for (; source.used < length_used; ++source.used) { - source.array[source.used] = source.used + 1; - } // for - - { - const f_status_t status = f_uint64s_append_all(source, &destination); - - assert_int_equal(status, F_none); - assert_int_equal(destination.used, source.used); - assert_int_equal(destination.size, source.used); - - for (f_number_unsigned_t i = 0; i < source.used; ++i) { - assert_int_equal(destination.array[i], i + 1); - } // for - } - - free((void *) source.array); - free((void *) destination.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_append_all.h deleted file mode 100644 index 9d47c2a3c..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_append_all.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint64s_append_all -#define _TEST__F_type_array__uint64s_append_all - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint64s_append_all() - */ -extern void test__f_type_array_uint64s_append_all__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_uint64s_append_all() - */ -extern void test__f_type_array_uint64s_append_all__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_uint64s_append_all() - */ -extern void test__f_type_array_uint64s_append_all__works(void **state); - -#endif // _TEST__F_type_array__uint64s_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_decimate_by.c deleted file mode 100644 index 92109ee96..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_decimate_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint64s_decimate_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint64s_decimate_by__parameter_checking(void **state) { - - const int length = 5; - f_uint64s_t data = f_uint64s_t_initialize; - - { - const f_status_t status = f_uint64s_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_type_array_uint64s_decimate_by__returns_data_not(void **state) { - - const int length = 5; - f_uint64s_t data = f_uint64s_t_initialize; - - { - const f_status_t status = f_uint64s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint64s_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_type_array_uint64s_decimate_by__works(void **state) { - - const int length = 5; - f_uint64s_t data = f_uint64s_t_initialize; - - { - const f_status_t status = f_uint64s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint64s_decimate_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_decimate_by.h deleted file mode 100644 index b381715ab..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_decimate_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint64s_decimate_by -#define _TEST__F_type_array__uint64s_decimate_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint64s_decimate_by() - */ -extern void test__f_type_array_uint64s_decimate_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_uint64s_decimate_by() - */ -extern void test__f_type_array_uint64s_decimate_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_uint64s_decimate_by() - */ -extern void test__f_type_array_uint64s_decimate_by__works(void **state); - -#endif // _TEST__F_type_array__uint64s_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_decrease_by.c deleted file mode 100644 index 018c1c8fa..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_decrease_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint64s_decrease_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint64s_decrease_by__parameter_checking(void **state) { - - const int length = 5; - f_uint64s_t data = f_uint64s_t_initialize; - - { - const f_status_t status = f_uint64s_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_type_array_uint64s_decrease_by__returns_data_not(void **state) { - - const int length = 5; - f_uint64s_t data = f_uint64s_t_initialize; - - { - const f_status_t status = f_uint64s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint64s_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_type_array_uint64s_decrease_by__works(void **state) { - - const int length = 5; - f_uint64s_t data = f_uint64s_t_initialize; - - { - const f_status_t status = f_uint64s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint64s_decrease_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_decrease_by.h deleted file mode 100644 index 9b8aaa3fd..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_decrease_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint64s_decrease_by -#define _TEST__F_type_array__uint64s_decrease_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint64s_decrease_by() - */ -extern void test__f_type_array_uint64s_decrease_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_uint64s_decrease_by() - */ -extern void test__f_type_array_uint64s_decrease_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_uint64s_decrease_by() - */ -extern void test__f_type_array_uint64s_decrease_by__works(void **state); - -#endif // _TEST__F_type_array__uint64s_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_increase.c deleted file mode 100644 index 1a48211f7..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_increase.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint64s_increase.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint64s_increase__parameter_checking(void **state) { - - const int length = 5; - f_uint64s_t data = f_uint64s_t_initialize; - - { - const f_status_t status = f_uint64s_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_type_array_uint64s_increase__returns_data_not(void **state) { - - const int length = 5; - f_uint64s_t data = f_uint64s_t_initialize; - - { - const f_status_t status = f_uint64s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint64s_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_type_array_uint64s_increase__works(void **state) { - - const int length = 5; - f_uint64s_t data = f_uint64s_t_initialize; - - { - const f_status_t status = f_uint64s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_uint64s_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_increase.h deleted file mode 100644 index 4190d1dca..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_increase.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint64s_increase -#define _TEST__F_type_array__uint64s_increase - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint64s_increase() - */ -extern void test__f_type_array_uint64s_increase__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_uint64s_increase() - */ -extern void test__f_type_array_uint64s_increase__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_uint64s_increase() - */ -extern void test__f_type_array_uint64s_increase__works(void **state); - -#endif // _TEST__F_type_array__uint64s_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_increase_by.c deleted file mode 100644 index a16d82c72..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_increase_by.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint64s_increase_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint64s_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_uint64s_t data = f_uint64s_t_initialize; - - { - const f_status_t status = f_uint64s_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_type_array_uint64s_increase_by__returns_data_not(void **state) { - - const int length = 5; - f_uint64s_t data = f_uint64s_t_initialize; - - { - const f_status_t status = f_uint64s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint64s_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_type_array_uint64s_increase_by__works(void **state) { - - const int length = 5; - f_uint64s_t data = f_uint64s_t_initialize; - - { - const f_status_t status = f_uint64s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_uint64s_increase_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_increase_by.h deleted file mode 100644 index 673194def..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_increase_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint64s_increase_by -#define _TEST__F_type_array__uint64s_increase_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint64s_increase_by() - */ -extern void test__f_type_array_uint64s_increase_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_uint64s_increase_by() - */ -extern void test__f_type_array_uint64s_increase_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_uint64s_increase_by() - */ -extern void test__f_type_array_uint64s_increase_by__works(void **state); - -#endif // _TEST__F_type_array__uint64s_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_resize.c deleted file mode 100644 index ee4873999..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_resize.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint64s_resize.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint64s_resize__parameter_checking(void **state) { - - const int length = 5; - f_uint64s_t data = f_uint64s_t_initialize; - - { - const f_status_t status = f_uint64s_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_type_array_uint64s_resize__works(void **state) { - - const int length = 5; - f_uint64s_t data = f_uint64s_t_initialize; - - { - const f_status_t status = f_uint64s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_resize.h deleted file mode 100644 index f05a84deb..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_resize.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint64s_resize -#define _TEST__F_type_array__uint64s_resize - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint64s_resize() - */ -extern void test__f_type_array_uint64s_resize__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_uint64s_resize() - */ -extern void test__f_type_array_uint64s_resize__works(void **state); - -#endif // _TEST__F_type_array__uint64s_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_resize_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_resize_callback.c new file mode 100644 index 000000000..9adaeb485 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_resize_callback.c @@ -0,0 +1,45 @@ +#include "test-type_array.h" +#include "test-type_array-uint64s_resize_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint64s_resize_callback__fails(void **state) { + + uint64_t data = 0; + uint64_t data_array[] = { data }; + f_uint64s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_uint64s_t datass_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_resize, true); + will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_uint64s_resize_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_uint64s_resize_callback__works(void **state) { + + uint64_t data = 0; + uint64_t data_array[] = { data }; + f_uint64s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_uint64s_t datass_array[] = { datas }; + const f_number_unsigned_t length = 1; + + { + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_none); + + const f_status_t status = f_uint64s_resize_callback(0, length, (void *) datass_array); + + assert_int_equal(status, F_none); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_resize_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_resize_callback.h new file mode 100644 index 000000000..c4487dbfa --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_resize_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint64s_resize_callback +#define _TEST__F_type_array__uint64s_resize_callback + +/** + * Test that the function fails. + * + * @see f_uint64s_resize_callback() + */ +extern void test__f_type_array_uint64s_resize_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_uint64s_resize_callback() + */ +extern void test__f_type_array_uint64s_resize_callback__works(void **state); + +#endif // _TEST__F_type_array__uint64s_resize_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_adjust.c deleted file mode 100644 index 162a7b789..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_adjust.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint64ss_adjust.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint64ss_adjust__parameter_checking(void **state) { - - const int length = 5; - f_uint64ss_t data = f_uint64ss_t_initialize; - - { - const f_status_t status = f_uint64ss_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_type_array_uint64ss_adjust__works(void **state) { - - const int length = 5; - f_uint64ss_t data = f_uint64ss_t_initialize; - - { - const f_status_t status = f_uint64ss_adjust(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_adjust.h deleted file mode 100644 index a5cc3cda5..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_adjust.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint64ss_adjust -#define _TEST__F_type_array__uint64ss_adjust - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint64ss_adjust() - */ -extern void test__f_type_array_uint64ss_adjust__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_uint64ss_adjust() - */ -extern void test__f_type_array_uint64ss_adjust__works(void **state); - -#endif // _TEST__F_type_array__uint64ss_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_append.c deleted file mode 100644 index 23c83e0e6..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_append.c +++ /dev/null @@ -1,86 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint64ss_append.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint64ss_append__parameter_checking(void **state) { - - f_uint64s_t data = f_uint64s_t_initialize; - - { - const f_status_t status = f_uint64ss_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_uint64ss_append__returns_data_not(void **state) { - - const int length = 5; - f_uint64s_t source = f_uint64s_t_initialize; - f_uint64ss_t destination = f_uint64ss_t_initialize; - - { - const f_status_t status = f_uint64s_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_uint64ss_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_type_array_uint64ss_append__works(void **state) { - - const int length = 5; - f_uint64s_t source = f_uint64s_t_initialize; - f_uint64ss_t destination = f_uint64ss_t_initialize; - - { - const f_status_t status = f_uint64s_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - for (; source.used < length; ++source.used) { - source.array[source.used] = source.used + 1; - } // for - - { - const f_status_t status = f_uint64ss_append(source, &destination); - - assert_int_equal(status, F_none); - 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], i + 1); - } // 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 diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_append.h deleted file mode 100644 index 613587586..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_append.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint64ss_append -#define _TEST__F_type_array__uint64ss_append - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint64ss_append() - */ -extern void test__f_type_array_uint64ss_append__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_uint64ss_append() - */ -extern void test__f_type_array_uint64ss_append__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_uint64ss_append() - */ -extern void test__f_type_array_uint64ss_append__works(void **state); - -#endif // _TEST__F_type_array__uint64ss_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_append_all.c deleted file mode 100644 index b910413a2..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_append_all.c +++ /dev/null @@ -1,105 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint64ss_append_all.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint64ss_append_all__parameter_checking(void **state) { - - const f_uint64ss_t data = f_uint64ss_t_initialize; - - { - const f_status_t status = f_uint64ss_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_uint64ss_append_all__returns_data_not(void **state) { - - const int length = 5; - f_uint64ss_t source = f_uint64ss_t_initialize; - f_uint64ss_t destination = f_uint64ss_t_initialize; - - { - const f_status_t status = f_uint64ss_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_uint64ss_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_type_array_uint64ss_append_all__works(void **state) { - - const int length = 5; - const int length_inner = 2; - f_uint64ss_t source = f_uint64ss_t_initialize; - f_uint64ss_t destination = f_uint64ss_t_initialize; - - { - const f_status_t status = f_uint64ss_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - for (; source.used < length; ++source.used) { - - const f_status_t status = f_uint64s_resize(length_inner, &source.array[source.used]); - - assert_int_equal(status, F_none); - - for (f_number_unsigned_t i = 0; i < length_inner; ++i) { - source.array[source.used].array[source.array[source.used].used++] = i + 1; - } // for - } // for - } - - { - const f_status_t status = f_uint64ss_append_all(source, &destination); - - assert_int_equal(status, F_none); - assert_int_equal(destination.used, source.used); - assert_int_equal(destination.size, source.used); - - for (f_number_unsigned_t i = 0; i < destination.used; ++i) { - - assert_int_equal(destination.array[i].used, length_inner); - assert_int_equal(destination.array[i].size, length_inner); - - for (f_number_unsigned_t j = 0; j < length_inner; ++j) { - assert_int_equal(destination.array[i].array[j], j + 1); - } // 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 diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_append_all.h deleted file mode 100644 index 510eb331a..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_append_all.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint64ss_append_all -#define _TEST__F_type_array__uint64ss_append_all - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint64ss_append_all() - */ -extern void test__f_type_array_uint64ss_append_all__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_uint64ss_append_all() - */ -extern void test__f_type_array_uint64ss_append_all__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_uint64ss_append_all() - */ -extern void test__f_type_array_uint64ss_append_all__works(void **state); - -#endif // _TEST__F_type_array__uint64ss_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_decimate_by.c deleted file mode 100644 index 889e2b9c4..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_decimate_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint64ss_decimate_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint64ss_decimate_by__parameter_checking(void **state) { - - const int length = 5; - f_uint64ss_t data = f_uint64s_t_initialize; - - { - const f_status_t status = f_uint64ss_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_type_array_uint64ss_decimate_by__returns_data_not(void **state) { - - const int length = 5; - f_uint64ss_t data = f_uint64ss_t_initialize; - - { - const f_status_t status = f_uint64ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint64ss_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_type_array_uint64ss_decimate_by__works(void **state) { - - const int length = 5; - f_uint64ss_t data = f_uint64s_t_initialize; - - { - const f_status_t status = f_uint64ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint64ss_decimate_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_decimate_by.h deleted file mode 100644 index b4f0b7f8f..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_decimate_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint64ss_decimate_by -#define _TEST__F_type_array__uint64ss_decimate_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint64ss_decimate_by() - */ -extern void test__f_type_array_uint64ss_decimate_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_type_array_uint64ss_decimate_by() - */ -extern void test__f_type_array_uint64ss_decimate_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_uint64ss_decimate_by() - */ -extern void test__f_type_array_uint64ss_decimate_by__works(void **state); - -#endif // _TEST__F_type_array__uint64ss_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_decrease_by.c deleted file mode 100644 index 0240f3d40..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_decrease_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint64ss_decrease_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint64ss_decrease_by__parameter_checking(void **state) { - - const int length = 5; - f_uint64ss_t data = f_uint64s_t_initialize; - - { - const f_status_t status = f_uint64ss_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_type_array_uint64ss_decrease_by__returns_data_not(void **state) { - - const int length = 5; - f_uint64ss_t data = f_uint64ss_t_initialize; - - { - const f_status_t status = f_uint64ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint64ss_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_type_array_uint64ss_decrease_by__works(void **state) { - - const int length = 5; - f_uint64ss_t data = f_uint64s_t_initialize; - - { - const f_status_t status = f_uint64ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint64ss_decrease_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_decrease_by.h deleted file mode 100644 index 1378c1054..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_decrease_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint64ss_decrease_by -#define _TEST__F_type_array__uint64ss_decrease_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint64ss_decrease_by() - */ -extern void test__f_type_array_uint64ss_decrease_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_uint64ss_decrease_by() - */ -extern void test__f_type_array_uint64ss_decrease_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_uint64ss_decrease_by() - */ -extern void test__f_type_array_uint64ss_decrease_by__works(void **state); - -#endif // _TEST__F_type_array__uint64ss_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_increase.c deleted file mode 100644 index 622dd6775..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_increase.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint64ss_increase.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint64ss_increase__parameter_checking(void **state) { - - const int length = 5; - f_uint64ss_t data = f_uint64s_t_initialize; - - { - const f_status_t status = f_uint64ss_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_type_array_uint64ss_increase__returns_data_not(void **state) { - - const int length = 5; - f_uint64ss_t data = f_uint64s_t_initialize; - - { - const f_status_t status = f_uint64ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint64ss_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_type_array_uint64ss_increase__works(void **state) { - - const int length = 5; - f_uint64ss_t data = f_uint64s_t_initialize; - - { - const f_status_t status = f_uint64ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_uint64ss_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_increase.h deleted file mode 100644 index e59df4fc5..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_increase.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint64ss_increase -#define _TEST__F_type_array__uint64ss_increase - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint64ss_increase() - */ -extern void test__f_type_array_uint64ss_increase__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_uint64ss_increase() - */ -extern void test__f_type_array_uint64ss_increase__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_uint64ss_increase() - */ -extern void test__f_type_array_uint64ss_increase__works(void **state); - -#endif // _TEST__F_type_array__uint64ss_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_increase_by.c deleted file mode 100644 index d6e0bc5ab..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_increase_by.c +++ /dev/null @@ -1,84 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint64ss_increase_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint64ss_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_uint64ss_t data = f_uint64s_t_initialize; - - { - const f_status_t status = f_uint64ss_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_type_array_uint64ss_increase_by__returns_data_not(void **state) { - - const int length = 5; - f_uint64ss_t data = f_uint64ss_t_initialize; - - { - const f_status_t status = f_uint64ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint64ss_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_uint64ss_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_type_array_uint64ss_increase_by__works(void **state) { - - const int length = 5; - f_uint64ss_t data = f_uint64s_t_initialize; - - { - const f_status_t status = f_uint64ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_uint64ss_increase_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_increase_by.h deleted file mode 100644 index 2d7741100..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_increase_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint64ss_increase_by -#define _TEST__F_type_array__uint64ss_increase_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint64ss_increase_by() - */ -extern void test__f_type_array_uint64ss_increase_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_uint64ss_increase_by() - */ -extern void test__f_type_array_uint64ss_increase_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_uint64ss_increase_by() - */ -extern void test__f_type_array_uint64ss_increase_by__works(void **state); - -#endif // _TEST__F_type_array__uint64ss_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_resize.c deleted file mode 100644 index f08eb18bf..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_resize.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint64ss_resize.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint64ss_resize__parameter_checking(void **state) { - - const int length = 5; - f_uint64ss_t data = f_uint64ss_t_initialize; - - { - const f_status_t status = f_uint64ss_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_type_array_uint64ss_resize__works(void **state) { - - const int length = 5; - f_uint64ss_t data = f_uint64ss_t_initialize; - - { - const f_status_t status = f_uint64ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_resize.h deleted file mode 100644 index 67a335892..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_resize.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint64ss_resize -#define _TEST__F_type_array__uint64ss_resize - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint64ss_resize() - */ -extern void test__f_type_array_uint64ss_resize__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_uint64ss_resize() - */ -extern void test__f_type_array_uint64ss_resize__works(void **state); - -#endif // _TEST__F_type_array__uint64ss_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_adjust.c deleted file mode 100644 index 3817a51ea..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_adjust.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint8s_adjust.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint8s_adjust__parameter_checking(void **state) { - - const int length = 5; - f_uint8s_t data = f_uint8s_t_initialize; - - { - const f_status_t status = f_uint8s_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_type_array_uint8s_adjust__works(void **state) { - - const int length = 5; - f_uint8s_t data = f_uint8s_t_initialize; - - { - const f_status_t status = f_uint8s_adjust(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_adjust.h deleted file mode 100644 index 74a1f421d..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_adjust.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint8s_adjust -#define _TEST__F_type_array__uint8s_adjust - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint8s_adjust() - */ -extern void test__f_type_array_uint8s_adjust__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_uint8s_adjust() - */ -extern void test__f_type_array_uint8s_adjust__works(void **state); - -#endif // _TEST__F_type_array__uint8s_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_adjust_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_adjust_callback.c new file mode 100644 index 000000000..8485915cc --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_adjust_callback.c @@ -0,0 +1,45 @@ +#include "test-type_array.h" +#include "test-type_array-uint8s_adjust_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint8s_adjust_callback__fails(void **state) { + + uint8_t data = 0; + uint8_t data_array[] = { data }; + f_uint8s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_uint8s_t datass_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_adjust, true); + will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_uint8s_adjust_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_uint8s_adjust_callback__works(void **state) { + + uint8_t data = 0; + uint8_t data_array[] = { data }; + f_uint8s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_uint8s_t datass_array[] = { datas }; + const f_number_unsigned_t length = 1; + + { + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_none); + + const f_status_t status = f_uint8s_adjust_callback(0, length, (void *) datass_array); + + assert_int_equal(status, F_none); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_adjust_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_adjust_callback.h new file mode 100644 index 000000000..e04c034b7 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_adjust_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint8s_adjust_callback +#define _TEST__F_type_array__uint8s_adjust_callback + +/** + * Test that the function fails. + * + * @see f_uint8s_adjust_callback() + */ +extern void test__f_type_array_uint8s_adjust_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_uint8s_adjust_callback() + */ +extern void test__f_type_array_uint8s_adjust_callback__works(void **state); + +#endif // _TEST__F_type_array__uint8s_adjust_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_append.c deleted file mode 100644 index caca1cc61..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_append.c +++ /dev/null @@ -1,37 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint8s_append.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint8s_append__parameter_checking(void **state) { - - const uint8_t data = 0; - - { - const f_status_t status = f_uint8s_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_uint8s_append__works(void **state) { - - const uint8_t source = 3; - f_uint8s_t destination = f_uint8s_t_initialize; - - { - const f_status_t status = f_uint8s_append(source, &destination); - - assert_int_equal(status, F_none); - assert_int_equal(destination.used, 1); - assert_int_equal(destination.array[0], source); - } - - free((void *) destination.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_append.h deleted file mode 100644 index c0b713c67..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_append.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint8s_append -#define _TEST__F_type_array__uint8s_append - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint8s_append() - */ -extern void test__f_type_array_uint8s_append__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_uint8s_append() - */ -extern void test__f_type_array_uint8s_append__works(void **state); - -#endif // _TEST__F_type_array__uint8s_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_append_all.c deleted file mode 100644 index 168a17988..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_append_all.c +++ /dev/null @@ -1,82 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint8s_append_all.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint8s_append_all__parameter_checking(void **state) { - - const f_uint8s_t data = f_uint8s_t_initialize; - - { - const f_status_t status = f_uint8s_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_uint8s_append_all__returns_data_not(void **state) { - - const int length = 5; - f_uint8s_t source = f_uint8s_t_initialize; - f_uint8s_t destination = f_uint8s_t_initialize; - - { - const f_status_t status = f_uint8s_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_uint8s_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_type_array_uint8s_append_all__works(void **state) { - - const int length = 5; - const int length_used = 2; - f_uint8s_t source = f_uint8s_t_initialize; - f_uint8s_t destination = f_uint8s_t_initialize; - - { - const f_status_t status = f_uint8s_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - for (; source.used < length_used; ++source.used) { - source.array[source.used] = source.used + 1; - } // for - - { - const f_status_t status = f_uint8s_append_all(source, &destination); - - assert_int_equal(status, F_none); - assert_int_equal(destination.used, source.used); - assert_int_equal(destination.size, source.used); - - for (f_number_unsigned_t i = 0; i < source.used; ++i) { - assert_int_equal(destination.array[i], i + 1); - } // for - } - - free((void *) source.array); - free((void *) destination.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_append_all.h deleted file mode 100644 index 620e46144..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_append_all.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint8s_append_all -#define _TEST__F_type_array__uint8s_append_all - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint8s_append_all() - */ -extern void test__f_type_array_uint8s_append_all__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_uint8s_append_all() - */ -extern void test__f_type_array_uint8s_append_all__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_uint8s_append_all() - */ -extern void test__f_type_array_uint8s_append_all__works(void **state); - -#endif // _TEST__F_type_array__uint8s_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_decimate_by.c deleted file mode 100644 index 99e13196e..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_decimate_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint8s_decimate_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint8s_decimate_by__parameter_checking(void **state) { - - const int length = 5; - f_uint8s_t data = f_uint8s_t_initialize; - - { - const f_status_t status = f_uint8s_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_type_array_uint8s_decimate_by__returns_data_not(void **state) { - - const int length = 5; - f_uint8s_t data = f_uint8s_t_initialize; - - { - const f_status_t status = f_uint8s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint8s_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_type_array_uint8s_decimate_by__works(void **state) { - - const int length = 5; - f_uint8s_t data = f_uint8s_t_initialize; - - { - const f_status_t status = f_uint8s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint8s_decimate_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_decimate_by.h deleted file mode 100644 index 4989513b8..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_decimate_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint8s_decimate_by -#define _TEST__F_type_array__uint8s_decimate_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint8s_decimate_by() - */ -extern void test__f_type_array_uint8s_decimate_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_uint8s_decimate_by() - */ -extern void test__f_type_array_uint8s_decimate_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_uint8s_decimate_by() - */ -extern void test__f_type_array_uint8s_decimate_by__works(void **state); - -#endif // _TEST__F_type_array__uint8s_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_decrease_by.c deleted file mode 100644 index ead28f546..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_decrease_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint8s_decrease_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint8s_decrease_by__parameter_checking(void **state) { - - const int length = 5; - f_uint8s_t data = f_uint8s_t_initialize; - - { - const f_status_t status = f_uint8s_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_type_array_uint8s_decrease_by__returns_data_not(void **state) { - - const int length = 5; - f_uint8s_t data = f_uint8s_t_initialize; - - { - const f_status_t status = f_uint8s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint8s_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_type_array_uint8s_decrease_by__works(void **state) { - - const int length = 5; - f_uint8s_t data = f_uint8s_t_initialize; - - { - const f_status_t status = f_uint8s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint8s_decrease_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_decrease_by.h deleted file mode 100644 index 029b22e77..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_decrease_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint8s_decrease_by -#define _TEST__F_type_array__uint8s_decrease_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint8s_decrease_by() - */ -extern void test__f_type_array_uint8s_decrease_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_uint8s_decrease_by() - */ -extern void test__f_type_array_uint8s_decrease_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_uint8s_decrease_by() - */ -extern void test__f_type_array_uint8s_decrease_by__works(void **state); - -#endif // _TEST__F_type_array__uint8s_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_increase.c deleted file mode 100644 index b5b8ccb13..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_increase.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint8s_increase.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint8s_increase__parameter_checking(void **state) { - - const int length = 5; - f_uint8s_t data = f_uint8s_t_initialize; - - { - const f_status_t status = f_uint8s_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_type_array_uint8s_increase__returns_data_not(void **state) { - - const int length = 5; - f_uint8s_t data = f_uint8s_t_initialize; - - { - const f_status_t status = f_uint8s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint8s_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_type_array_uint8s_increase__works(void **state) { - - const int length = 5; - f_uint8s_t data = f_uint8s_t_initialize; - - { - const f_status_t status = f_uint8s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_uint8s_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_increase.h deleted file mode 100644 index c7f3c2501..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_increase.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint8s_increase -#define _TEST__F_type_array__uint8s_increase - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint8s_increase() - */ -extern void test__f_type_array_uint8s_increase__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_uint8s_increase() - */ -extern void test__f_type_array_uint8s_increase__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_uint8s_increase() - */ -extern void test__f_type_array_uint8s_increase__works(void **state); - -#endif // _TEST__F_type_array__uint8s_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_increase_by.c deleted file mode 100644 index 29ac46d7d..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_increase_by.c +++ /dev/null @@ -1,77 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint8s_increase_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - - -void test__f_type_array_uint8s_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_uint8s_t data = f_uint8s_t_initialize; - - { - const f_status_t status = f_uint8s_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_type_array_uint8s_increase_by__returns_data_not(void **state) { - - const int length = 5; - f_uint8s_t data = f_uint8s_t_initialize; - - { - const f_status_t status = f_uint8s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint8s_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_type_array_uint8s_increase_by__works(void **state) { - - const int length = 5; - f_uint8s_t data = f_uint8s_t_initialize; - - { - const f_status_t status = f_uint8s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_uint8s_increase_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_increase_by.h deleted file mode 100644 index 321e78c8c..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_increase_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint8s_increase_by -#define _TEST__F_type_array__uint8s_increase_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint8s_increase_by() - */ -extern void test__f_type_array_uint8s_increase_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_uint8s_increase_by() - */ -extern void test__f_type_array_uint8s_increase_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_uint8s_increase_by() - */ -extern void test__f_type_array_uint8s_increase_by__works(void **state); - -#endif // _TEST__F_type_array__uint8s_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_resize.c deleted file mode 100644 index 5c2d172a8..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_resize.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint8s_resize.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint8s_resize__parameter_checking(void **state) { - - const int length = 5; - f_uint8s_t data = f_uint8s_t_initialize; - - { - const f_status_t status = f_uint8s_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_type_array_uint8s_resize__works(void **state) { - - const int length = 5; - f_uint8s_t data = f_uint8s_t_initialize; - - { - const f_status_t status = f_uint8s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_resize.h deleted file mode 100644 index 3cd72346c..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_resize.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint8s_resize -#define _TEST__F_type_array__uint8s_resize - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint8s_resize() - */ -extern void test__f_type_array_uint8s_resize__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_uint8s_resize() - */ -extern void test__f_type_array_uint8s_resize__works(void **state); - -#endif // _TEST__F_type_array__uint8s_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_resize_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_resize_callback.c new file mode 100644 index 000000000..747c8df21 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_resize_callback.c @@ -0,0 +1,45 @@ +#include "test-type_array.h" +#include "test-type_array-uint8s_resize_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint8s_resize_callback__fails(void **state) { + + uint8_t data = 0; + uint8_t data_array[] = { data }; + f_uint8s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_uint8s_t datass_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_resize, true); + will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_uint8s_resize_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_uint8s_resize_callback__works(void **state) { + + uint8_t data = 0; + uint8_t data_array[] = { data }; + f_uint8s_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_uint8s_t datass_array[] = { datas }; + const f_number_unsigned_t length = 1; + + { + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_none); + + const f_status_t status = f_uint8s_resize_callback(0, length, (void *) datass_array); + + assert_int_equal(status, F_none); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_resize_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_resize_callback.h new file mode 100644 index 000000000..e53c13e7d --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_resize_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint8s_resize_callback +#define _TEST__F_type_array__uint8s_resize_callback + +/** + * Test that the function fails. + * + * @see f_uint8s_resize_callback() + */ +extern void test__f_type_array_uint8s_resize_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_uint8s_resize_callback() + */ +extern void test__f_type_array_uint8s_resize_callback__works(void **state); + +#endif // _TEST__F_type_array__uint8s_resize_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_adjust.c deleted file mode 100644 index 45ace00cd..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_adjust.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint8ss_adjust.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint8ss_adjust__parameter_checking(void **state) { - - const int length = 5; - f_uint8ss_t data = f_uint8ss_t_initialize; - - { - const f_status_t status = f_uint8ss_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_type_array_uint8ss_adjust__works(void **state) { - - const int length = 5; - f_uint8ss_t data = f_uint8ss_t_initialize; - - { - const f_status_t status = f_uint8ss_adjust(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_adjust.h deleted file mode 100644 index ef347992d..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_adjust.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint8ss_adjust -#define _TEST__F_type_array__uint8ss_adjust - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint8ss_adjust() - */ -extern void test__f_type_array_uint8ss_adjust__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_uint8ss_adjust() - */ -extern void test__f_type_array_uint8ss_adjust__works(void **state); - -#endif // _TEST__F_type_array__uint8ss_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_append.c deleted file mode 100644 index 3f603b68e..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_append.c +++ /dev/null @@ -1,86 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint8ss_append.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint8ss_append__parameter_checking(void **state) { - - f_uint8s_t data = f_uint8s_t_initialize; - - { - const f_status_t status = f_uint8ss_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_uint8ss_append__returns_data_not(void **state) { - - const int length = 5; - f_uint8s_t source = f_uint8s_t_initialize; - f_uint8ss_t destination = f_uint8ss_t_initialize; - - { - const f_status_t status = f_uint8s_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_uint8ss_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_type_array_uint8ss_append__works(void **state) { - - const int length = 5; - f_uint8s_t source = f_uint8s_t_initialize; - f_uint8ss_t destination = f_uint8ss_t_initialize; - - { - const f_status_t status = f_uint8s_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - for (; source.used < length; ++source.used) { - source.array[source.used] = source.used + 1; - } // for - - { - const f_status_t status = f_uint8ss_append(source, &destination); - - assert_int_equal(status, F_none); - 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], i + 1); - } // 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 diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_append.h deleted file mode 100644 index 06910008e..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_append.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint8ss_append -#define _TEST__F_type_array__uint8ss_append - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint8ss_append() - */ -extern void test__f_type_array_uint8ss_append__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_uint8ss_append() - */ -extern void test__f_type_array_uint8ss_append__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_uint8ss_append() - */ -extern void test__f_type_array_uint8ss_append__works(void **state); - -#endif // _TEST__F_type_array__uint8ss_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_append_all.c deleted file mode 100644 index 5f61c555f..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_append_all.c +++ /dev/null @@ -1,105 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint8ss_append_all.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint8ss_append_all__parameter_checking(void **state) { - - const f_uint8ss_t data = f_uint8ss_t_initialize; - - { - const f_status_t status = f_uint8ss_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - -void test__f_type_array_uint8ss_append_all__returns_data_not(void **state) { - - const int length = 5; - f_uint8ss_t source = f_uint8ss_t_initialize; - f_uint8ss_t destination = f_uint8ss_t_initialize; - - { - const f_status_t status = f_uint8ss_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_uint8ss_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_type_array_uint8ss_append_all__works(void **state) { - - const int length = 5; - const int length_inner = 2; - f_uint8ss_t source = f_uint8ss_t_initialize; - f_uint8ss_t destination = f_uint8ss_t_initialize; - - { - const f_status_t status = f_uint8ss_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - for (; source.used < length; ++source.used) { - - const f_status_t status = f_uint8s_resize(length_inner, &source.array[source.used]); - - assert_int_equal(status, F_none); - - for (f_number_unsigned_t i = 0; i < length_inner; ++i) { - source.array[source.used].array[source.array[source.used].used++] = i + 1; - } // for - } // for - } - - { - const f_status_t status = f_uint8ss_append_all(source, &destination); - - assert_int_equal(status, F_none); - assert_int_equal(destination.used, source.used); - assert_int_equal(destination.size, source.used); - - for (f_number_unsigned_t i = 0; i < destination.used; ++i) { - - assert_int_equal(destination.array[i].used, length_inner); - assert_int_equal(destination.array[i].size, length_inner); - - for (f_number_unsigned_t j = 0; j < length_inner; ++j) { - assert_int_equal(destination.array[i].array[j], j + 1); - } // 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 diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_append_all.h deleted file mode 100644 index adda02507..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_append_all.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint8ss_append_all -#define _TEST__F_type_array__uint8ss_append_all - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint8ss_append_all() - */ -extern void test__f_type_array_uint8ss_append_all__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_uint8ss_append_all() - */ -extern void test__f_type_array_uint8ss_append_all__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_uint8ss_append_all() - */ -extern void test__f_type_array_uint8ss_append_all__works(void **state); - -#endif // _TEST__F_type_array__uint8ss_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_decimate_by.c deleted file mode 100644 index 271c78099..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_decimate_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint8ss_decimate_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint8ss_decimate_by__parameter_checking(void **state) { - - const int length = 5; - f_uint8ss_t data = f_uint8s_t_initialize; - - { - const f_status_t status = f_uint8ss_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_type_array_uint8ss_decimate_by__returns_data_not(void **state) { - - const int length = 5; - f_uint8ss_t data = f_uint8ss_t_initialize; - - { - const f_status_t status = f_uint8ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint8ss_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_type_array_uint8ss_decimate_by__works(void **state) { - - const int length = 5; - f_uint8ss_t data = f_uint8s_t_initialize; - - { - const f_status_t status = f_uint8ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint8ss_decimate_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_decimate_by.h deleted file mode 100644 index f35c0a1b5..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_decimate_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint8ss_decimate_by -#define _TEST__F_type_array__uint8ss_decimate_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint8ss_decimate_by() - */ -extern void test__f_type_array_uint8ss_decimate_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_type_array_uint8ss_decimate_by() - */ -extern void test__f_type_array_uint8ss_decimate_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_uint8ss_decimate_by() - */ -extern void test__f_type_array_uint8ss_decimate_by__works(void **state); - -#endif // _TEST__F_type_array__uint8ss_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_decrease_by.c deleted file mode 100644 index 8ec58153b..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_decrease_by.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint8ss_decrease_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint8ss_decrease_by__parameter_checking(void **state) { - - const int length = 5; - f_uint8ss_t data = f_uint8s_t_initialize; - - { - const f_status_t status = f_uint8ss_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_type_array_uint8ss_decrease_by__returns_data_not(void **state) { - - const int length = 5; - f_uint8ss_t data = f_uint8ss_t_initialize; - - { - const f_status_t status = f_uint8ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint8ss_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_type_array_uint8ss_decrease_by__works(void **state) { - - const int length = 5; - f_uint8ss_t data = f_uint8s_t_initialize; - - { - const f_status_t status = f_uint8ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint8ss_decrease_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_decrease_by.h deleted file mode 100644 index 066a0d801..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_decrease_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint8ss_decrease_by -#define _TEST__F_type_array__uint8ss_decrease_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint8ss_decrease_by() - */ -extern void test__f_type_array_uint8ss_decrease_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_uint8ss_decrease_by() - */ -extern void test__f_type_array_uint8ss_decrease_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_uint8ss_decrease_by() - */ -extern void test__f_type_array_uint8ss_decrease_by__works(void **state); - -#endif // _TEST__F_type_array__uint8ss_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_increase.c deleted file mode 100644 index 5775dd4c9..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_increase.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint8ss_increase.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint8ss_increase__parameter_checking(void **state) { - - const int length = 5; - f_uint8ss_t data = f_uint8s_t_initialize; - - { - const f_status_t status = f_uint8ss_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_type_array_uint8ss_increase__returns_data_not(void **state) { - - const int length = 5; - f_uint8ss_t data = f_uint8s_t_initialize; - - { - const f_status_t status = f_uint8ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint8ss_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_type_array_uint8ss_increase__works(void **state) { - - const int length = 5; - f_uint8ss_t data = f_uint8s_t_initialize; - - { - const f_status_t status = f_uint8ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_uint8ss_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_increase.h deleted file mode 100644 index 943f00786..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_increase.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint8ss_increase -#define _TEST__F_type_array__uint8ss_increase - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint8ss_increase() - */ -extern void test__f_type_array_uint8ss_increase__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_uint8ss_increase() - */ -extern void test__f_type_array_uint8ss_increase__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_uint8ss_increase() - */ -extern void test__f_type_array_uint8ss_increase__works(void **state); - -#endif // _TEST__F_type_array__uint8ss_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_increase_by.c deleted file mode 100644 index 93481c766..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_increase_by.c +++ /dev/null @@ -1,84 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint8ss_increase_by.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint8ss_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_uint8ss_t data = f_uint8s_t_initialize; - - { - const f_status_t status = f_uint8ss_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_type_array_uint8ss_increase_by__returns_data_not(void **state) { - - const int length = 5; - f_uint8ss_t data = f_uint8ss_t_initialize; - - { - const f_status_t status = f_uint8ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint8ss_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_uint8ss_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_type_array_uint8ss_increase_by__works(void **state) { - - const int length = 5; - f_uint8ss_t data = f_uint8s_t_initialize; - - { - const f_status_t status = f_uint8ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_uint8ss_increase_by(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_increase_by.h deleted file mode 100644 index fbd20d0e3..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_increase_by.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint8ss_increase_by -#define _TEST__F_type_array__uint8ss_increase_by - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint8ss_increase_by() - */ -extern void test__f_type_array_uint8ss_increase_by__parameter_checking(void **state); - -/** - * Test that the function returns F_data_not. - * - * @see f_uint8ss_increase_by() - */ -extern void test__f_type_array_uint8ss_increase_by__returns_data_not(void **state); - -/** - * Test that the function works. - * - * @see f_uint8ss_increase_by() - */ -extern void test__f_type_array_uint8ss_increase_by__works(void **state); - -#endif // _TEST__F_type_array__uint8ss_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_resize.c deleted file mode 100644 index 667b3fe8a..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_resize.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "test-type_array.h" -#include "test-type_array-uint8ss_resize.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void test__f_type_array_uint8ss_resize__parameter_checking(void **state) { - - const int length = 5; - f_uint8ss_t data = f_uint8ss_t_initialize; - - { - const f_status_t status = f_uint8ss_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_type_array_uint8ss_resize__works(void **state) { - - const int length = 5; - f_uint8ss_t data = f_uint8ss_t_initialize; - - { - const f_status_t status = f_uint8ss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - free((void *) data.array); -} - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_resize.h deleted file mode 100644 index 63c7af4da..000000000 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_resize.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * Test the array types in the type project. - */ -#ifndef _TEST__F_type_array__uint8ss_resize -#define _TEST__F_type_array__uint8ss_resize - -/** - * Test that the function correctly fails on invalid parameter. - * - * @see f_uint8ss_resize() - */ -extern void test__f_type_array_uint8ss_resize__parameter_checking(void **state); - -/** - * Test that the function works. - * - * @see f_uint8ss_resize() - */ -extern void test__f_type_array_uint8ss_resize__works(void **state); - -#endif // _TEST__F_type_array__uint8ss_resize 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 d87b729c4..79dab2c93 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array.c @@ -17,838 +17,132 @@ int setdown(void **state) { int main(void) { const struct CMUnitTest tests[] = { - cmocka_unit_test(test__f_type_array_cells_append_all__returns_data_not), - cmocka_unit_test(test__f_type_array_cells_decimate_by__returns_data_not), - cmocka_unit_test(test__f_type_array_cells_decrease_by__returns_data_not), - cmocka_unit_test(test__f_type_array_cells_increase__returns_data_not), - cmocka_unit_test(test__f_type_array_cells_increase_by__returns_data_not), - - cmocka_unit_test(test__f_type_array_cells_adjust__works), - cmocka_unit_test(test__f_type_array_cells_append__works), - cmocka_unit_test(test__f_type_array_cells_append_all__works), - cmocka_unit_test(test__f_type_array_cells_decimate_by__works), - cmocka_unit_test(test__f_type_array_cells_decrease_by__works), - cmocka_unit_test(test__f_type_array_cells_increase__works), - cmocka_unit_test(test__f_type_array_cells_increase_by__works), - cmocka_unit_test(test__f_type_array_cells_resize__works), - - cmocka_unit_test(test__f_type_array_cellss_append__returns_data_not), - cmocka_unit_test(test__f_type_array_cellss_append_all__returns_data_not), - cmocka_unit_test(test__f_type_array_cellss_decimate_by__returns_data_not), - cmocka_unit_test(test__f_type_array_cellss_decrease_by__returns_data_not), - cmocka_unit_test(test__f_type_array_cellss_increase__returns_data_not), - cmocka_unit_test(test__f_type_array_cellss_increase_by__returns_data_not), - - cmocka_unit_test(test__f_type_array_cellss_adjust__works), - cmocka_unit_test(test__f_type_array_cellss_append__works), - cmocka_unit_test(test__f_type_array_cellss_append_all__works), - cmocka_unit_test(test__f_type_array_cellss_decimate_by__works), - cmocka_unit_test(test__f_type_array_cellss_decrease_by__works), - cmocka_unit_test(test__f_type_array_cellss_increase__works), - cmocka_unit_test(test__f_type_array_cellss_increase_by__works), - cmocka_unit_test(test__f_type_array_cellss_resize__works), - - cmocka_unit_test(test__f_type_array_files_append_all__returns_data_not), - cmocka_unit_test(test__f_type_array_files_decimate_by__returns_data_not), - cmocka_unit_test(test__f_type_array_files_decrease_by__returns_data_not), - cmocka_unit_test(test__f_type_array_files_increase__returns_data_not), - cmocka_unit_test(test__f_type_array_files_increase_by__returns_data_not), - - cmocka_unit_test(test__f_type_array_files_adjust__works), - cmocka_unit_test(test__f_type_array_files_append__works), - cmocka_unit_test(test__f_type_array_files_append_all__works), - cmocka_unit_test(test__f_type_array_files_decimate_by__works), - cmocka_unit_test(test__f_type_array_files_decrease_by__works), - cmocka_unit_test(test__f_type_array_files_increase__works), - cmocka_unit_test(test__f_type_array_files_increase_by__works), - cmocka_unit_test(test__f_type_array_files_resize__works), - - cmocka_unit_test(test__f_type_array_filess_append__returns_data_not), - cmocka_unit_test(test__f_type_array_filess_append_all__returns_data_not), - cmocka_unit_test(test__f_type_array_filess_decimate_by__returns_data_not), - cmocka_unit_test(test__f_type_array_filess_decrease_by__returns_data_not), - cmocka_unit_test(test__f_type_array_filess_increase__returns_data_not), - cmocka_unit_test(test__f_type_array_filess_increase_by__returns_data_not), - - cmocka_unit_test(test__f_type_array_filess_adjust__works), - cmocka_unit_test(test__f_type_array_filess_append__works), - cmocka_unit_test(test__f_type_array_filess_append_all__works), - cmocka_unit_test(test__f_type_array_filess_decimate_by__works), - cmocka_unit_test(test__f_type_array_filess_decrease_by__works), - cmocka_unit_test(test__f_type_array_filess_increase__works), - cmocka_unit_test(test__f_type_array_filess_increase_by__works), - cmocka_unit_test(test__f_type_array_filess_resize__works), - - cmocka_unit_test(test__f_type_array_fll_ids_append_all__returns_data_not), - cmocka_unit_test(test__f_type_array_fll_ids_decimate_by__returns_data_not), - cmocka_unit_test(test__f_type_array_fll_ids_decrease_by__returns_data_not), - cmocka_unit_test(test__f_type_array_fll_ids_increase__returns_data_not), - cmocka_unit_test(test__f_type_array_fll_ids_increase_by__returns_data_not), - - cmocka_unit_test(test__f_type_array_fll_ids_adjust__works), - cmocka_unit_test(test__f_type_array_fll_ids_append__works), - cmocka_unit_test(test__f_type_array_fll_ids_append_all__works), - cmocka_unit_test(test__f_type_array_fll_ids_decimate_by__works), - cmocka_unit_test(test__f_type_array_fll_ids_decrease_by__works), - cmocka_unit_test(test__f_type_array_fll_ids_increase__works), - cmocka_unit_test(test__f_type_array_fll_ids_increase_by__works), - cmocka_unit_test(test__f_type_array_fll_ids_resize__works), - - cmocka_unit_test(test__f_type_array_fll_idss_append__returns_data_not), - cmocka_unit_test(test__f_type_array_fll_idss_append_all__returns_data_not), - cmocka_unit_test(test__f_type_array_fll_idss_decimate_by__returns_data_not), - cmocka_unit_test(test__f_type_array_fll_idss_decrease_by__returns_data_not), - cmocka_unit_test(test__f_type_array_fll_idss_increase__returns_data_not), - cmocka_unit_test(test__f_type_array_fll_idss_increase_by__returns_data_not), - - cmocka_unit_test(test__f_type_array_fll_idss_adjust__works), - cmocka_unit_test(test__f_type_array_fll_idss_append__works), - cmocka_unit_test(test__f_type_array_fll_idss_append_all__works), - cmocka_unit_test(test__f_type_array_fll_idss_decimate_by__works), - cmocka_unit_test(test__f_type_array_fll_idss_decrease_by__works), - cmocka_unit_test(test__f_type_array_fll_idss_increase__works), - cmocka_unit_test(test__f_type_array_fll_idss_increase_by__works), - cmocka_unit_test(test__f_type_array_fll_idss_resize__works), - - cmocka_unit_test(test__f_type_array_int8s_append_all__returns_data_not), - cmocka_unit_test(test__f_type_array_int8s_decimate_by__returns_data_not), - cmocka_unit_test(test__f_type_array_int8s_decrease_by__returns_data_not), - cmocka_unit_test(test__f_type_array_int8s_increase__returns_data_not), - cmocka_unit_test(test__f_type_array_int8s_increase_by__returns_data_not), - - cmocka_unit_test(test__f_type_array_int8s_adjust__works), - cmocka_unit_test(test__f_type_array_int8s_append__works), - cmocka_unit_test(test__f_type_array_int8s_append_all__works), - cmocka_unit_test(test__f_type_array_int8s_decimate_by__works), - cmocka_unit_test(test__f_type_array_int8s_decrease_by__works), - cmocka_unit_test(test__f_type_array_int8s_increase__works), - cmocka_unit_test(test__f_type_array_int8s_increase_by__works), - cmocka_unit_test(test__f_type_array_int8s_resize__works), - - cmocka_unit_test(test__f_type_array_int8ss_append__returns_data_not), - cmocka_unit_test(test__f_type_array_int8ss_append_all__returns_data_not), - cmocka_unit_test(test__f_type_array_int8ss_decimate_by__returns_data_not), - cmocka_unit_test(test__f_type_array_int8ss_decrease_by__returns_data_not), - cmocka_unit_test(test__f_type_array_int8ss_increase__returns_data_not), - cmocka_unit_test(test__f_type_array_int8ss_increase_by__returns_data_not), - - cmocka_unit_test(test__f_type_array_int8ss_adjust__works), - cmocka_unit_test(test__f_type_array_int8ss_append__works), - cmocka_unit_test(test__f_type_array_int8ss_append_all__works), - cmocka_unit_test(test__f_type_array_int8ss_decimate_by__works), - cmocka_unit_test(test__f_type_array_int8ss_decrease_by__works), - cmocka_unit_test(test__f_type_array_int8ss_increase__works), - cmocka_unit_test(test__f_type_array_int8ss_increase_by__works), - cmocka_unit_test(test__f_type_array_int8ss_resize__works), - - cmocka_unit_test(test__f_type_array_int16s_append_all__returns_data_not), - cmocka_unit_test(test__f_type_array_int16s_decimate_by__returns_data_not), - cmocka_unit_test(test__f_type_array_int16s_decrease_by__returns_data_not), - cmocka_unit_test(test__f_type_array_int16s_increase__returns_data_not), - cmocka_unit_test(test__f_type_array_int16s_increase_by__returns_data_not), - - cmocka_unit_test(test__f_type_array_int16s_adjust__works), - cmocka_unit_test(test__f_type_array_int16s_append__works), - cmocka_unit_test(test__f_type_array_int16s_append_all__works), - cmocka_unit_test(test__f_type_array_int16s_decimate_by__works), - cmocka_unit_test(test__f_type_array_int16s_decrease_by__works), - cmocka_unit_test(test__f_type_array_int16s_increase__works), - cmocka_unit_test(test__f_type_array_int16s_increase_by__works), - cmocka_unit_test(test__f_type_array_int16s_resize__works), - - cmocka_unit_test(test__f_type_array_int16ss_append__returns_data_not), - cmocka_unit_test(test__f_type_array_int16ss_append_all__returns_data_not), - cmocka_unit_test(test__f_type_array_int16ss_decimate_by__returns_data_not), - cmocka_unit_test(test__f_type_array_int16ss_decrease_by__returns_data_not), - cmocka_unit_test(test__f_type_array_int16ss_increase__returns_data_not), - cmocka_unit_test(test__f_type_array_int16ss_increase_by__returns_data_not), - - cmocka_unit_test(test__f_type_array_int16ss_adjust__works), - cmocka_unit_test(test__f_type_array_int16ss_append__works), - cmocka_unit_test(test__f_type_array_int16ss_append_all__works), - cmocka_unit_test(test__f_type_array_int16ss_decimate_by__works), - cmocka_unit_test(test__f_type_array_int16ss_decrease_by__works), - cmocka_unit_test(test__f_type_array_int16ss_increase__works), - cmocka_unit_test(test__f_type_array_int16ss_increase_by__works), - cmocka_unit_test(test__f_type_array_int16ss_resize__works), - - cmocka_unit_test(test__f_type_array_int32s_append_all__returns_data_not), - cmocka_unit_test(test__f_type_array_int32s_decimate_by__returns_data_not), - cmocka_unit_test(test__f_type_array_int32s_decrease_by__returns_data_not), - cmocka_unit_test(test__f_type_array_int32s_increase__returns_data_not), - cmocka_unit_test(test__f_type_array_int32s_increase_by__returns_data_not), - - cmocka_unit_test(test__f_type_array_int32s_adjust__works), - cmocka_unit_test(test__f_type_array_int32s_append__works), - cmocka_unit_test(test__f_type_array_int32s_append_all__works), - cmocka_unit_test(test__f_type_array_int32s_decimate_by__works), - cmocka_unit_test(test__f_type_array_int32s_decrease_by__works), - cmocka_unit_test(test__f_type_array_int32s_increase__works), - cmocka_unit_test(test__f_type_array_int32s_increase_by__works), - cmocka_unit_test(test__f_type_array_int32s_resize__works), - - cmocka_unit_test(test__f_type_array_int32ss_append__returns_data_not), - cmocka_unit_test(test__f_type_array_int32ss_append_all__returns_data_not), - cmocka_unit_test(test__f_type_array_int32ss_decimate_by__returns_data_not), - cmocka_unit_test(test__f_type_array_int32ss_decrease_by__returns_data_not), - cmocka_unit_test(test__f_type_array_int32ss_increase__returns_data_not), - cmocka_unit_test(test__f_type_array_int32ss_increase_by__returns_data_not), - - cmocka_unit_test(test__f_type_array_int32ss_adjust__works), - cmocka_unit_test(test__f_type_array_int32ss_append__works), - cmocka_unit_test(test__f_type_array_int32ss_append_all__works), - cmocka_unit_test(test__f_type_array_int32ss_decimate_by__works), - cmocka_unit_test(test__f_type_array_int32ss_decrease_by__works), - cmocka_unit_test(test__f_type_array_int32ss_increase__works), - cmocka_unit_test(test__f_type_array_int32ss_increase_by__works), - cmocka_unit_test(test__f_type_array_int32ss_resize__works), - - cmocka_unit_test(test__f_type_array_int64s_append_all__returns_data_not), - cmocka_unit_test(test__f_type_array_int64s_decimate_by__returns_data_not), - cmocka_unit_test(test__f_type_array_int64s_decrease_by__returns_data_not), - cmocka_unit_test(test__f_type_array_int64s_increase__returns_data_not), - cmocka_unit_test(test__f_type_array_int64s_increase_by__returns_data_not), - - cmocka_unit_test(test__f_type_array_int64s_adjust__works), - cmocka_unit_test(test__f_type_array_int64s_append__works), - cmocka_unit_test(test__f_type_array_int64s_append_all__works), - cmocka_unit_test(test__f_type_array_int64s_decimate_by__works), - cmocka_unit_test(test__f_type_array_int64s_decrease_by__works), - cmocka_unit_test(test__f_type_array_int64s_increase__works), - cmocka_unit_test(test__f_type_array_int64s_increase_by__works), - cmocka_unit_test(test__f_type_array_int64s_resize__works), - - cmocka_unit_test(test__f_type_array_int64ss_append__returns_data_not), - cmocka_unit_test(test__f_type_array_int64ss_append_all__returns_data_not), - cmocka_unit_test(test__f_type_array_int64ss_decimate_by__returns_data_not), - cmocka_unit_test(test__f_type_array_int64ss_decrease_by__returns_data_not), - cmocka_unit_test(test__f_type_array_int64ss_increase__returns_data_not), - cmocka_unit_test(test__f_type_array_int64ss_increase_by__returns_data_not), - - cmocka_unit_test(test__f_type_array_int64ss_adjust__works), - cmocka_unit_test(test__f_type_array_int64ss_append__works), - cmocka_unit_test(test__f_type_array_int64ss_append_all__works), - cmocka_unit_test(test__f_type_array_int64ss_decimate_by__works), - cmocka_unit_test(test__f_type_array_int64ss_decrease_by__works), - cmocka_unit_test(test__f_type_array_int64ss_increase__works), - cmocka_unit_test(test__f_type_array_int64ss_increase_by__works), - cmocka_unit_test(test__f_type_array_int64ss_resize__works), - - cmocka_unit_test(test__f_type_array_int128s_append_all__returns_data_not), - cmocka_unit_test(test__f_type_array_int128s_decimate_by__returns_data_not), - cmocka_unit_test(test__f_type_array_int128s_decrease_by__returns_data_not), - cmocka_unit_test(test__f_type_array_int128s_increase__returns_data_not), - cmocka_unit_test(test__f_type_array_int128s_increase_by__returns_data_not), - - cmocka_unit_test(test__f_type_array_int128s_adjust__works), - cmocka_unit_test(test__f_type_array_int128s_append__works), - cmocka_unit_test(test__f_type_array_int128s_append_all__works), - cmocka_unit_test(test__f_type_array_int128s_decimate_by__works), - cmocka_unit_test(test__f_type_array_int128s_decrease_by__works), - cmocka_unit_test(test__f_type_array_int128s_increase__works), - cmocka_unit_test(test__f_type_array_int128s_increase_by__works), - cmocka_unit_test(test__f_type_array_int128s_resize__works), - - cmocka_unit_test(test__f_type_array_int128ss_append__returns_data_not), - cmocka_unit_test(test__f_type_array_int128ss_append_all__returns_data_not), - cmocka_unit_test(test__f_type_array_int128ss_decimate_by__returns_data_not), - cmocka_unit_test(test__f_type_array_int128ss_decrease_by__returns_data_not), - cmocka_unit_test(test__f_type_array_int128ss_increase__returns_data_not), - cmocka_unit_test(test__f_type_array_int128ss_increase_by__returns_data_not), - - cmocka_unit_test(test__f_type_array_number_unsigneds_append_all__returns_data_not), - cmocka_unit_test(test__f_type_array_number_unsigneds_decimate_by__returns_data_not), - cmocka_unit_test(test__f_type_array_number_unsigneds_decrease_by__returns_data_not), - cmocka_unit_test(test__f_type_array_number_unsigneds_increase__returns_data_not), - cmocka_unit_test(test__f_type_array_number_unsigneds_increase_by__returns_data_not), - - cmocka_unit_test(test__f_type_array_number_unsigneds_adjust__works), - cmocka_unit_test(test__f_type_array_number_unsigneds_append__works), - cmocka_unit_test(test__f_type_array_number_unsigneds_append_all__works), - cmocka_unit_test(test__f_type_array_number_unsigneds_decimate_by__works), - cmocka_unit_test(test__f_type_array_number_unsigneds_decrease_by__works), - cmocka_unit_test(test__f_type_array_number_unsigneds_increase__works), - cmocka_unit_test(test__f_type_array_number_unsigneds_increase_by__works), - cmocka_unit_test(test__f_type_array_number_unsigneds_resize__works), - - cmocka_unit_test(test__f_type_array_number_unsignedss_append__returns_data_not), - cmocka_unit_test(test__f_type_array_number_unsignedss_append_all__returns_data_not), - cmocka_unit_test(test__f_type_array_number_unsignedss_decimate_by__returns_data_not), - cmocka_unit_test(test__f_type_array_number_unsignedss_decrease_by__returns_data_not), - cmocka_unit_test(test__f_type_array_number_unsignedss_increase__returns_data_not), - cmocka_unit_test(test__f_type_array_number_unsignedss_increase_by__returns_data_not), - - cmocka_unit_test(test__f_type_array_number_unsignedss_adjust__works), - cmocka_unit_test(test__f_type_array_number_unsignedss_append__works), - cmocka_unit_test(test__f_type_array_number_unsignedss_append_all__works), - cmocka_unit_test(test__f_type_array_number_unsignedss_decimate_by__works), - cmocka_unit_test(test__f_type_array_number_unsignedss_decrease_by__works), - cmocka_unit_test(test__f_type_array_number_unsignedss_increase__works), - cmocka_unit_test(test__f_type_array_number_unsignedss_increase_by__works), - cmocka_unit_test(test__f_type_array_number_unsignedss_resize__works), - - cmocka_unit_test(test__f_type_array_int128ss_adjust__works), - cmocka_unit_test(test__f_type_array_int128ss_append__works), - cmocka_unit_test(test__f_type_array_int128ss_append_all__works), - cmocka_unit_test(test__f_type_array_int128ss_decimate_by__works), - cmocka_unit_test(test__f_type_array_int128ss_decrease_by__works), - cmocka_unit_test(test__f_type_array_int128ss_increase__works), - cmocka_unit_test(test__f_type_array_int128ss_increase_by__works), - cmocka_unit_test(test__f_type_array_int128ss_resize__works), - - cmocka_unit_test(test__f_type_array_polls_append_all__returns_data_not), - cmocka_unit_test(test__f_type_array_polls_decimate_by__returns_data_not), - cmocka_unit_test(test__f_type_array_polls_decrease_by__returns_data_not), - cmocka_unit_test(test__f_type_array_polls_increase__returns_data_not), - cmocka_unit_test(test__f_type_array_polls_increase_by__returns_data_not), - - cmocka_unit_test(test__f_type_array_polls_adjust__works), - cmocka_unit_test(test__f_type_array_polls_append__works), - cmocka_unit_test(test__f_type_array_polls_append_all__works), - cmocka_unit_test(test__f_type_array_polls_decimate_by__works), - cmocka_unit_test(test__f_type_array_polls_decrease_by__works), - cmocka_unit_test(test__f_type_array_polls_increase__works), - cmocka_unit_test(test__f_type_array_polls_increase_by__works), - cmocka_unit_test(test__f_type_array_polls_resize__works), - - cmocka_unit_test(test__f_type_array_pollss_append_all__returns_data_not), - cmocka_unit_test(test__f_type_array_pollss_decimate_by__returns_data_not), - cmocka_unit_test(test__f_type_array_pollss_decrease_by__returns_data_not), - cmocka_unit_test(test__f_type_array_pollss_increase__returns_data_not), - cmocka_unit_test(test__f_type_array_pollss_increase_by__returns_data_not), - - cmocka_unit_test(test__f_type_array_pollss_adjust__works), - cmocka_unit_test(test__f_type_array_pollss_append__works), - cmocka_unit_test(test__f_type_array_pollss_append_all__works), - cmocka_unit_test(test__f_type_array_pollss_decimate_by__works), - cmocka_unit_test(test__f_type_array_pollss_decrease_by__works), - cmocka_unit_test(test__f_type_array_pollss_increase__works), - cmocka_unit_test(test__f_type_array_pollss_increase_by__works), - cmocka_unit_test(test__f_type_array_pollss_resize__works), - - cmocka_unit_test(test__f_type_array_states_append_all__returns_data_not), - cmocka_unit_test(test__f_type_array_states_decimate_by__returns_data_not), - cmocka_unit_test(test__f_type_array_states_decrease_by__returns_data_not), - cmocka_unit_test(test__f_type_array_states_increase__returns_data_not), - cmocka_unit_test(test__f_type_array_states_increase_by__returns_data_not), - - cmocka_unit_test(test__f_type_array_states_adjust__works), - cmocka_unit_test(test__f_type_array_states_append__works), - cmocka_unit_test(test__f_type_array_states_append_all__works), - cmocka_unit_test(test__f_type_array_states_decimate_by__works), - cmocka_unit_test(test__f_type_array_states_decrease_by__works), - cmocka_unit_test(test__f_type_array_states_increase__works), - cmocka_unit_test(test__f_type_array_states_increase_by__works), - cmocka_unit_test(test__f_type_array_states_resize__works), - - cmocka_unit_test(test__f_type_array_statess_append__returns_data_not), - cmocka_unit_test(test__f_type_array_statess_append_all__returns_data_not), - cmocka_unit_test(test__f_type_array_statess_decimate_by__returns_data_not), - cmocka_unit_test(test__f_type_array_statess_decrease_by__returns_data_not), - cmocka_unit_test(test__f_type_array_statess_increase__returns_data_not), - cmocka_unit_test(test__f_type_array_statess_increase_by__returns_data_not), - - cmocka_unit_test(test__f_type_array_statess_adjust__works), - cmocka_unit_test(test__f_type_array_statess_append__works), - cmocka_unit_test(test__f_type_array_statess_append_all__works), - cmocka_unit_test(test__f_type_array_statess_decimate_by__works), - cmocka_unit_test(test__f_type_array_statess_decrease_by__works), - cmocka_unit_test(test__f_type_array_statess_increase__works), - cmocka_unit_test(test__f_type_array_statess_increase_by__works), - cmocka_unit_test(test__f_type_array_statess_resize__works), - - cmocka_unit_test(test__f_type_array_statuss_append_all__returns_data_not), - cmocka_unit_test(test__f_type_array_statuss_decimate_by__returns_data_not), - cmocka_unit_test(test__f_type_array_statuss_decrease_by__returns_data_not), - cmocka_unit_test(test__f_type_array_statuss_increase__returns_data_not), - cmocka_unit_test(test__f_type_array_statuss_increase_by__returns_data_not), - - cmocka_unit_test(test__f_type_array_statuss_adjust__works), - cmocka_unit_test(test__f_type_array_statuss_append__works), - cmocka_unit_test(test__f_type_array_statuss_append_all__works), - cmocka_unit_test(test__f_type_array_statuss_decimate_by__works), - cmocka_unit_test(test__f_type_array_statuss_decrease_by__works), - cmocka_unit_test(test__f_type_array_statuss_increase__works), - cmocka_unit_test(test__f_type_array_statuss_increase_by__works), - cmocka_unit_test(test__f_type_array_statuss_resize__works), - - cmocka_unit_test(test__f_type_array_statusss_append__returns_data_not), - cmocka_unit_test(test__f_type_array_statusss_append_all__returns_data_not), - cmocka_unit_test(test__f_type_array_statusss_decimate_by__returns_data_not), - cmocka_unit_test(test__f_type_array_statusss_decrease_by__returns_data_not), - cmocka_unit_test(test__f_type_array_statusss_increase__returns_data_not), - cmocka_unit_test(test__f_type_array_statusss_increase_by__returns_data_not), - - cmocka_unit_test(test__f_type_array_statusss_adjust__works), - cmocka_unit_test(test__f_type_array_statusss_append__works), - cmocka_unit_test(test__f_type_array_statusss_append_all__works), - cmocka_unit_test(test__f_type_array_statusss_decimate_by__works), - cmocka_unit_test(test__f_type_array_statusss_decrease_by__works), - cmocka_unit_test(test__f_type_array_statusss_increase__works), - cmocka_unit_test(test__f_type_array_statusss_increase_by__works), - cmocka_unit_test(test__f_type_array_statusss_resize__works), - - cmocka_unit_test(test__f_type_array_uint8s_append_all__returns_data_not), - cmocka_unit_test(test__f_type_array_uint8s_decimate_by__returns_data_not), - cmocka_unit_test(test__f_type_array_uint8s_decrease_by__returns_data_not), - cmocka_unit_test(test__f_type_array_uint8s_increase__returns_data_not), - cmocka_unit_test(test__f_type_array_uint8s_increase_by__returns_data_not), - - cmocka_unit_test(test__f_type_array_uint8s_adjust__works), - cmocka_unit_test(test__f_type_array_uint8s_append__works), - cmocka_unit_test(test__f_type_array_uint8s_append_all__works), - cmocka_unit_test(test__f_type_array_uint8s_decimate_by__works), - cmocka_unit_test(test__f_type_array_uint8s_decrease_by__works), - cmocka_unit_test(test__f_type_array_uint8s_increase__works), - cmocka_unit_test(test__f_type_array_uint8s_increase_by__works), - cmocka_unit_test(test__f_type_array_uint8s_resize__works), - - cmocka_unit_test(test__f_type_array_uint8ss_append__returns_data_not), - cmocka_unit_test(test__f_type_array_uint8ss_append_all__returns_data_not), - cmocka_unit_test(test__f_type_array_uint8ss_decimate_by__returns_data_not), - cmocka_unit_test(test__f_type_array_uint8ss_decrease_by__returns_data_not), - cmocka_unit_test(test__f_type_array_uint8ss_increase__returns_data_not), - cmocka_unit_test(test__f_type_array_uint8ss_increase_by__returns_data_not), - - cmocka_unit_test(test__f_type_array_uint8ss_adjust__works), - cmocka_unit_test(test__f_type_array_uint8ss_append__works), - cmocka_unit_test(test__f_type_array_uint8ss_append_all__works), - cmocka_unit_test(test__f_type_array_uint8ss_decimate_by__works), - cmocka_unit_test(test__f_type_array_uint8ss_decrease_by__works), - cmocka_unit_test(test__f_type_array_uint8ss_increase__works), - cmocka_unit_test(test__f_type_array_uint8ss_increase_by__works), - cmocka_unit_test(test__f_type_array_uint8ss_resize__works), - - cmocka_unit_test(test__f_type_array_uint16s_append_all__returns_data_not), - cmocka_unit_test(test__f_type_array_uint16s_decimate_by__returns_data_not), - cmocka_unit_test(test__f_type_array_uint16s_decrease_by__returns_data_not), - cmocka_unit_test(test__f_type_array_uint16s_increase__returns_data_not), - cmocka_unit_test(test__f_type_array_uint16s_increase_by__returns_data_not), - - cmocka_unit_test(test__f_type_array_uint16s_adjust__works), - cmocka_unit_test(test__f_type_array_uint16s_append__works), - cmocka_unit_test(test__f_type_array_uint16s_append_all__works), - cmocka_unit_test(test__f_type_array_uint16s_decimate_by__works), - cmocka_unit_test(test__f_type_array_uint16s_decrease_by__works), - cmocka_unit_test(test__f_type_array_uint16s_increase__works), - cmocka_unit_test(test__f_type_array_uint16s_increase_by__works), - cmocka_unit_test(test__f_type_array_uint16s_resize__works), - - cmocka_unit_test(test__f_type_array_uint16ss_append__returns_data_not), - cmocka_unit_test(test__f_type_array_uint16ss_append_all__returns_data_not), - cmocka_unit_test(test__f_type_array_uint16ss_decimate_by__returns_data_not), - cmocka_unit_test(test__f_type_array_uint16ss_decrease_by__returns_data_not), - cmocka_unit_test(test__f_type_array_uint16ss_increase__returns_data_not), - cmocka_unit_test(test__f_type_array_uint16ss_increase_by__returns_data_not), - - cmocka_unit_test(test__f_type_array_uint16ss_adjust__works), - cmocka_unit_test(test__f_type_array_uint16ss_append__works), - cmocka_unit_test(test__f_type_array_uint16ss_append_all__works), - cmocka_unit_test(test__f_type_array_uint16ss_decimate_by__works), - cmocka_unit_test(test__f_type_array_uint16ss_decrease_by__works), - cmocka_unit_test(test__f_type_array_uint16ss_increase__works), - cmocka_unit_test(test__f_type_array_uint16ss_increase_by__works), - cmocka_unit_test(test__f_type_array_uint16ss_resize__works), - - cmocka_unit_test(test__f_type_array_uint32s_append_all__returns_data_not), - cmocka_unit_test(test__f_type_array_uint32s_decimate_by__returns_data_not), - cmocka_unit_test(test__f_type_array_uint32s_decrease_by__returns_data_not), - cmocka_unit_test(test__f_type_array_uint32s_increase__returns_data_not), - cmocka_unit_test(test__f_type_array_uint32s_increase_by__returns_data_not), - - cmocka_unit_test(test__f_type_array_uint32s_adjust__works), - cmocka_unit_test(test__f_type_array_uint32s_append__works), - cmocka_unit_test(test__f_type_array_uint32s_append_all__works), - cmocka_unit_test(test__f_type_array_uint32s_decimate_by__works), - cmocka_unit_test(test__f_type_array_uint32s_decrease_by__works), - cmocka_unit_test(test__f_type_array_uint32s_increase__works), - cmocka_unit_test(test__f_type_array_uint32s_increase_by__works), - cmocka_unit_test(test__f_type_array_uint32s_resize__works), - - cmocka_unit_test(test__f_type_array_uint32ss_append__returns_data_not), - cmocka_unit_test(test__f_type_array_uint32ss_append_all__returns_data_not), - cmocka_unit_test(test__f_type_array_uint32ss_decimate_by__returns_data_not), - cmocka_unit_test(test__f_type_array_uint32ss_decrease_by__returns_data_not), - cmocka_unit_test(test__f_type_array_uint32ss_increase__returns_data_not), - cmocka_unit_test(test__f_type_array_uint32ss_increase_by__returns_data_not), - - cmocka_unit_test(test__f_type_array_uint32ss_adjust__works), - cmocka_unit_test(test__f_type_array_uint32ss_append__works), - cmocka_unit_test(test__f_type_array_uint32ss_append_all__works), - cmocka_unit_test(test__f_type_array_uint32ss_decimate_by__works), - cmocka_unit_test(test__f_type_array_uint32ss_decrease_by__works), - cmocka_unit_test(test__f_type_array_uint32ss_increase__works), - cmocka_unit_test(test__f_type_array_uint32ss_increase_by__works), - cmocka_unit_test(test__f_type_array_uint32ss_resize__works), - - cmocka_unit_test(test__f_type_array_uint64s_append_all__returns_data_not), - cmocka_unit_test(test__f_type_array_uint64s_decimate_by__returns_data_not), - cmocka_unit_test(test__f_type_array_uint64s_decrease_by__returns_data_not), - cmocka_unit_test(test__f_type_array_uint64s_increase__returns_data_not), - cmocka_unit_test(test__f_type_array_uint64s_increase_by__returns_data_not), - - cmocka_unit_test(test__f_type_array_uint64s_adjust__works), - cmocka_unit_test(test__f_type_array_uint64s_append__works), - cmocka_unit_test(test__f_type_array_uint64s_append_all__works), - cmocka_unit_test(test__f_type_array_uint64s_decimate_by__works), - cmocka_unit_test(test__f_type_array_uint64s_decrease_by__works), - cmocka_unit_test(test__f_type_array_uint64s_increase__works), - cmocka_unit_test(test__f_type_array_uint64s_increase_by__works), - cmocka_unit_test(test__f_type_array_uint64s_resize__works), - - cmocka_unit_test(test__f_type_array_uint64ss_append__returns_data_not), - cmocka_unit_test(test__f_type_array_uint64ss_append_all__returns_data_not), - cmocka_unit_test(test__f_type_array_uint64ss_decimate_by__returns_data_not), - cmocka_unit_test(test__f_type_array_uint64ss_decrease_by__returns_data_not), - cmocka_unit_test(test__f_type_array_uint64ss_increase__returns_data_not), - cmocka_unit_test(test__f_type_array_uint64ss_increase_by__returns_data_not), - - cmocka_unit_test(test__f_type_array_uint64ss_adjust__works), - cmocka_unit_test(test__f_type_array_uint64ss_append__works), - cmocka_unit_test(test__f_type_array_uint64ss_append_all__works), - cmocka_unit_test(test__f_type_array_uint64ss_decimate_by__works), - cmocka_unit_test(test__f_type_array_uint64ss_decrease_by__works), - cmocka_unit_test(test__f_type_array_uint64ss_increase__works), - cmocka_unit_test(test__f_type_array_uint64ss_increase_by__works), - cmocka_unit_test(test__f_type_array_uint64ss_resize__works), - - cmocka_unit_test(test__f_type_array_uint128s_append_all__returns_data_not), - cmocka_unit_test(test__f_type_array_uint128s_decimate_by__returns_data_not), - cmocka_unit_test(test__f_type_array_uint128s_decrease_by__returns_data_not), - cmocka_unit_test(test__f_type_array_uint128s_increase__returns_data_not), - cmocka_unit_test(test__f_type_array_uint128s_increase_by__returns_data_not), - - cmocka_unit_test(test__f_type_array_uint128s_adjust__works), - cmocka_unit_test(test__f_type_array_uint128s_append__works), - cmocka_unit_test(test__f_type_array_uint128s_append_all__works), - cmocka_unit_test(test__f_type_array_uint128s_decimate_by__works), - cmocka_unit_test(test__f_type_array_uint128s_decrease_by__works), - cmocka_unit_test(test__f_type_array_uint128s_increase__works), - cmocka_unit_test(test__f_type_array_uint128s_increase_by__works), - cmocka_unit_test(test__f_type_array_uint128s_resize__works), - - cmocka_unit_test(test__f_type_array_uint128ss_append__returns_data_not), - cmocka_unit_test(test__f_type_array_uint128ss_append_all__returns_data_not), - cmocka_unit_test(test__f_type_array_uint128ss_decimate_by__returns_data_not), - cmocka_unit_test(test__f_type_array_uint128ss_decrease_by__returns_data_not), - cmocka_unit_test(test__f_type_array_uint128ss_increase__returns_data_not), - cmocka_unit_test(test__f_type_array_uint128ss_increase_by__returns_data_not), - - cmocka_unit_test(test__f_type_array_uint128ss_adjust__works), - cmocka_unit_test(test__f_type_array_uint128ss_append__works), - cmocka_unit_test(test__f_type_array_uint128ss_append_all__works), - cmocka_unit_test(test__f_type_array_uint128ss_decimate_by__works), - cmocka_unit_test(test__f_type_array_uint128ss_decrease_by__works), - cmocka_unit_test(test__f_type_array_uint128ss_increase__works), - cmocka_unit_test(test__f_type_array_uint128ss_increase_by__works), - cmocka_unit_test(test__f_type_array_uint128ss_resize__works), + cmocka_unit_test(test__f_type_array_cells_adjust_callback__fails), + cmocka_unit_test(test__f_type_array_cells_resize_callback__fails), + + cmocka_unit_test(test__f_type_array_files_adjust_callback__fails), + cmocka_unit_test(test__f_type_array_files_resize_callback__fails), + + cmocka_unit_test(test__f_type_array_fll_ids_adjust_callback__fails), + cmocka_unit_test(test__f_type_array_fll_ids_resize_callback__fails), + + cmocka_unit_test(test__f_type_array_int8s_adjust_callback__fails), + cmocka_unit_test(test__f_type_array_int8s_resize_callback__fails), + + cmocka_unit_test(test__f_type_array_int16s_adjust_callback__fails), + cmocka_unit_test(test__f_type_array_int16s_resize_callback__fails), + + cmocka_unit_test(test__f_type_array_int32s_adjust_callback__fails), + cmocka_unit_test(test__f_type_array_int32s_resize_callback__fails), + + cmocka_unit_test(test__f_type_array_int64s_adjust_callback__fails), + cmocka_unit_test(test__f_type_array_int64s_resize_callback__fails), + + cmocka_unit_test(test__f_type_array_int128s_adjust_callback__fails), + cmocka_unit_test(test__f_type_array_int128s_resize_callback__fails), + + cmocka_unit_test(test__f_type_array_number_unsigneds_adjust_callback__fails), + cmocka_unit_test(test__f_type_array_number_unsigneds_resize_callback__fails), + + cmocka_unit_test(test__f_type_array_uint8s_adjust_callback__fails), + cmocka_unit_test(test__f_type_array_uint8s_resize_callback__fails), + + cmocka_unit_test(test__f_type_array_uint16s_adjust_callback__fails), + cmocka_unit_test(test__f_type_array_uint16s_resize_callback__fails), + + cmocka_unit_test(test__f_type_array_uint32s_adjust_callback__fails), + cmocka_unit_test(test__f_type_array_uint32s_resize_callback__fails), + + cmocka_unit_test(test__f_type_array_uint64s_adjust_callback__fails), + cmocka_unit_test(test__f_type_array_uint64s_resize_callback__fails), + + cmocka_unit_test(test__f_type_array_uint128s_adjust_callback__fails), + cmocka_unit_test(test__f_type_array_uint128s_resize_callback__fails), + + cmocka_unit_test(test__f_type_array_cells_adjust_callback__works), + cmocka_unit_test(test__f_type_array_cells_resize_callback__works), + + cmocka_unit_test(test__f_type_array_files_adjust_callback__works), + cmocka_unit_test(test__f_type_array_files_resize_callback__works), + + cmocka_unit_test(test__f_type_array_fll_ids_adjust_callback__works), + cmocka_unit_test(test__f_type_array_fll_ids_resize_callback__works), + + cmocka_unit_test(test__f_type_array_int8s_adjust_callback__works), + cmocka_unit_test(test__f_type_array_int8s_resize_callback__works), + + cmocka_unit_test(test__f_type_array_int16s_adjust_callback__works), + cmocka_unit_test(test__f_type_array_int16s_resize_callback__works), + + cmocka_unit_test(test__f_type_array_int32s_adjust_callback__works), + cmocka_unit_test(test__f_type_array_int32s_resize_callback__works), + + cmocka_unit_test(test__f_type_array_int64s_adjust_callback__works), + cmocka_unit_test(test__f_type_array_int64s_resize_callback__works), + + cmocka_unit_test(test__f_type_array_int128s_adjust_callback__works), + cmocka_unit_test(test__f_type_array_int128s_resize_callback__works), + + cmocka_unit_test(test__f_type_array_number_unsigneds_adjust_callback__works), + cmocka_unit_test(test__f_type_array_number_unsigneds_resize_callback__works), + + cmocka_unit_test(test__f_type_array_uint8s_adjust_callback__works), + cmocka_unit_test(test__f_type_array_uint8s_resize_callback__works), + + cmocka_unit_test(test__f_type_array_uint16s_adjust_callback__works), + cmocka_unit_test(test__f_type_array_uint16s_resize_callback__works), + + cmocka_unit_test(test__f_type_array_uint32s_adjust_callback__works), + cmocka_unit_test(test__f_type_array_uint32s_resize_callback__works), + + cmocka_unit_test(test__f_type_array_uint64s_adjust_callback__works), + cmocka_unit_test(test__f_type_array_uint64s_resize_callback__works), + + cmocka_unit_test(test__f_type_array_uint128s_adjust_callback__works), + cmocka_unit_test(test__f_type_array_uint128s_resize_callback__works), #ifndef _di_level_0_parameter_checking_ - cmocka_unit_test(test__f_type_array_number_unsigneds_adjust__parameter_checking), - cmocka_unit_test(test__f_type_array_number_unsigneds_append__parameter_checking), - cmocka_unit_test(test__f_type_array_number_unsigneds_append_all__parameter_checking), - cmocka_unit_test(test__f_type_array_number_unsigneds_decimate_by__parameter_checking), - cmocka_unit_test(test__f_type_array_number_unsigneds_decrease_by__parameter_checking), - cmocka_unit_test(test__f_type_array_number_unsigneds_increase__parameter_checking), - cmocka_unit_test(test__f_type_array_number_unsigneds_increase_by__parameter_checking), - cmocka_unit_test(test__f_type_array_number_unsigneds_resize__parameter_checking), - - cmocka_unit_test(test__f_type_array_number_unsignedss_adjust__parameter_checking), - cmocka_unit_test(test__f_type_array_number_unsignedss_append__parameter_checking), - cmocka_unit_test(test__f_type_array_number_unsignedss_append_all__parameter_checking), - cmocka_unit_test(test__f_type_array_number_unsignedss_decimate_by__parameter_checking), - cmocka_unit_test(test__f_type_array_number_unsignedss_decrease_by__parameter_checking), - cmocka_unit_test(test__f_type_array_number_unsignedss_increase__parameter_checking), - cmocka_unit_test(test__f_type_array_number_unsignedss_increase_by__parameter_checking), - cmocka_unit_test(test__f_type_array_number_unsignedss_resize__parameter_checking), - - cmocka_unit_test(test__f_type_array_cells_adjust__parameter_checking), - cmocka_unit_test(test__f_type_array_cells_append__parameter_checking), - cmocka_unit_test(test__f_type_array_cells_append_all__parameter_checking), - cmocka_unit_test(test__f_type_array_cells_decimate_by__parameter_checking), - cmocka_unit_test(test__f_type_array_cells_decrease_by__parameter_checking), - cmocka_unit_test(test__f_type_array_cells_increase__parameter_checking), - cmocka_unit_test(test__f_type_array_cells_increase_by__parameter_checking), - cmocka_unit_test(test__f_type_array_cells_resize__parameter_checking), - - cmocka_unit_test(test__f_type_array_cellss_adjust__parameter_checking), - cmocka_unit_test(test__f_type_array_cellss_append__parameter_checking), - cmocka_unit_test(test__f_type_array_cellss_append_all__parameter_checking), - cmocka_unit_test(test__f_type_array_cellss_decimate_by__parameter_checking), - cmocka_unit_test(test__f_type_array_cellss_decrease_by__parameter_checking), - cmocka_unit_test(test__f_type_array_cellss_increase__parameter_checking), - cmocka_unit_test(test__f_type_array_cellss_increase_by__parameter_checking), - cmocka_unit_test(test__f_type_array_cellss_resize__parameter_checking), - - cmocka_unit_test(test__f_type_array_files_adjust__parameter_checking), - cmocka_unit_test(test__f_type_array_files_append__parameter_checking), - cmocka_unit_test(test__f_type_array_files_append_all__parameter_checking), - cmocka_unit_test(test__f_type_array_files_decimate_by__parameter_checking), - cmocka_unit_test(test__f_type_array_files_decrease_by__parameter_checking), - cmocka_unit_test(test__f_type_array_files_increase__parameter_checking), - cmocka_unit_test(test__f_type_array_files_increase_by__parameter_checking), - cmocka_unit_test(test__f_type_array_files_resize__parameter_checking), - - cmocka_unit_test(test__f_type_array_filess_adjust__parameter_checking), - cmocka_unit_test(test__f_type_array_filess_append__parameter_checking), - cmocka_unit_test(test__f_type_array_filess_append_all__parameter_checking), - cmocka_unit_test(test__f_type_array_filess_decimate_by__parameter_checking), - cmocka_unit_test(test__f_type_array_filess_decrease_by__parameter_checking), - cmocka_unit_test(test__f_type_array_filess_increase__parameter_checking), - cmocka_unit_test(test__f_type_array_filess_increase_by__parameter_checking), - cmocka_unit_test(test__f_type_array_filess_resize__parameter_checking), - - cmocka_unit_test(test__f_type_array_fll_ids_adjust__parameter_checking), - cmocka_unit_test(test__f_type_array_fll_ids_append__parameter_checking), - cmocka_unit_test(test__f_type_array_fll_ids_append_all__parameter_checking), - cmocka_unit_test(test__f_type_array_fll_ids_decimate_by__parameter_checking), - cmocka_unit_test(test__f_type_array_fll_ids_decrease_by__parameter_checking), - cmocka_unit_test(test__f_type_array_fll_ids_increase__parameter_checking), - cmocka_unit_test(test__f_type_array_fll_ids_increase_by__parameter_checking), - cmocka_unit_test(test__f_type_array_fll_ids_resize__parameter_checking), - - cmocka_unit_test(test__f_type_array_fll_idss_adjust__parameter_checking), - cmocka_unit_test(test__f_type_array_fll_idss_append__parameter_checking), - cmocka_unit_test(test__f_type_array_fll_idss_append_all__parameter_checking), - cmocka_unit_test(test__f_type_array_fll_idss_decimate_by__parameter_checking), - cmocka_unit_test(test__f_type_array_fll_idss_decrease_by__parameter_checking), - cmocka_unit_test(test__f_type_array_fll_idss_increase__parameter_checking), - cmocka_unit_test(test__f_type_array_fll_idss_increase_by__parameter_checking), - cmocka_unit_test(test__f_type_array_fll_idss_resize__parameter_checking), - - cmocka_unit_test(test__f_type_array_int8s_adjust__parameter_checking), - cmocka_unit_test(test__f_type_array_int8s_append__parameter_checking), - cmocka_unit_test(test__f_type_array_int8s_append_all__parameter_checking), - cmocka_unit_test(test__f_type_array_int8s_decimate_by__parameter_checking), - cmocka_unit_test(test__f_type_array_int8s_decrease_by__parameter_checking), - cmocka_unit_test(test__f_type_array_int8s_increase__parameter_checking), - cmocka_unit_test(test__f_type_array_int8s_increase_by__parameter_checking), - cmocka_unit_test(test__f_type_array_int8s_resize__parameter_checking), - - cmocka_unit_test(test__f_type_array_int8ss_adjust__parameter_checking), - cmocka_unit_test(test__f_type_array_int8ss_append__parameter_checking), - cmocka_unit_test(test__f_type_array_int8ss_append_all__parameter_checking), - cmocka_unit_test(test__f_type_array_int8ss_decimate_by__parameter_checking), - cmocka_unit_test(test__f_type_array_int8ss_decrease_by__parameter_checking), - cmocka_unit_test(test__f_type_array_int8ss_increase__parameter_checking), - cmocka_unit_test(test__f_type_array_int8ss_increase_by__parameter_checking), - cmocka_unit_test(test__f_type_array_int8ss_resize__parameter_checking), - - cmocka_unit_test(test__f_type_array_int16s_adjust__parameter_checking), - cmocka_unit_test(test__f_type_array_int16s_append__parameter_checking), - cmocka_unit_test(test__f_type_array_int16s_append_all__parameter_checking), - cmocka_unit_test(test__f_type_array_int16s_decimate_by__parameter_checking), - cmocka_unit_test(test__f_type_array_int16s_decrease_by__parameter_checking), - cmocka_unit_test(test__f_type_array_int16s_increase__parameter_checking), - cmocka_unit_test(test__f_type_array_int16s_increase_by__parameter_checking), - cmocka_unit_test(test__f_type_array_int16s_resize__parameter_checking), - - cmocka_unit_test(test__f_type_array_int16ss_adjust__parameter_checking), - cmocka_unit_test(test__f_type_array_int16ss_append__parameter_checking), - cmocka_unit_test(test__f_type_array_int16ss_append_all__parameter_checking), - cmocka_unit_test(test__f_type_array_int16ss_decimate_by__parameter_checking), - cmocka_unit_test(test__f_type_array_int16ss_decrease_by__parameter_checking), - cmocka_unit_test(test__f_type_array_int16ss_increase__parameter_checking), - cmocka_unit_test(test__f_type_array_int16ss_increase_by__parameter_checking), - cmocka_unit_test(test__f_type_array_int16ss_resize__parameter_checking), - - cmocka_unit_test(test__f_type_array_int32s_adjust__parameter_checking), - cmocka_unit_test(test__f_type_array_int32s_append__parameter_checking), - cmocka_unit_test(test__f_type_array_int32s_append_all__parameter_checking), - cmocka_unit_test(test__f_type_array_int32s_decimate_by__parameter_checking), - cmocka_unit_test(test__f_type_array_int32s_decrease_by__parameter_checking), - cmocka_unit_test(test__f_type_array_int32s_increase__parameter_checking), - cmocka_unit_test(test__f_type_array_int32s_increase_by__parameter_checking), - cmocka_unit_test(test__f_type_array_int32s_resize__parameter_checking), - - cmocka_unit_test(test__f_type_array_int32ss_adjust__parameter_checking), - cmocka_unit_test(test__f_type_array_int32ss_append__parameter_checking), - cmocka_unit_test(test__f_type_array_int32ss_append_all__parameter_checking), - cmocka_unit_test(test__f_type_array_int32ss_decimate_by__parameter_checking), - cmocka_unit_test(test__f_type_array_int32ss_decrease_by__parameter_checking), - cmocka_unit_test(test__f_type_array_int32ss_increase__parameter_checking), - cmocka_unit_test(test__f_type_array_int32ss_increase_by__parameter_checking), - cmocka_unit_test(test__f_type_array_int32ss_resize__parameter_checking), - - cmocka_unit_test(test__f_type_array_int64s_adjust__parameter_checking), - cmocka_unit_test(test__f_type_array_int64s_append__parameter_checking), - cmocka_unit_test(test__f_type_array_int64s_append_all__parameter_checking), - cmocka_unit_test(test__f_type_array_int64s_decimate_by__parameter_checking), - cmocka_unit_test(test__f_type_array_int64s_decrease_by__parameter_checking), - cmocka_unit_test(test__f_type_array_int64s_increase__parameter_checking), - cmocka_unit_test(test__f_type_array_int64s_increase_by__parameter_checking), - cmocka_unit_test(test__f_type_array_int64s_resize__parameter_checking), - - cmocka_unit_test(test__f_type_array_int64ss_adjust__parameter_checking), - cmocka_unit_test(test__f_type_array_int64ss_append__parameter_checking), - cmocka_unit_test(test__f_type_array_int64ss_append_all__parameter_checking), - cmocka_unit_test(test__f_type_array_int64ss_decimate_by__parameter_checking), - cmocka_unit_test(test__f_type_array_int64ss_decrease_by__parameter_checking), - cmocka_unit_test(test__f_type_array_int64ss_increase__parameter_checking), - cmocka_unit_test(test__f_type_array_int64ss_increase_by__parameter_checking), - cmocka_unit_test(test__f_type_array_int64ss_resize__parameter_checking), - - cmocka_unit_test(test__f_type_array_int128s_adjust__parameter_checking), - cmocka_unit_test(test__f_type_array_int128s_append__parameter_checking), - cmocka_unit_test(test__f_type_array_int128s_append_all__parameter_checking), - cmocka_unit_test(test__f_type_array_int128s_decimate_by__parameter_checking), - cmocka_unit_test(test__f_type_array_int128s_decrease_by__parameter_checking), - cmocka_unit_test(test__f_type_array_int128s_increase__parameter_checking), - cmocka_unit_test(test__f_type_array_int128s_increase_by__parameter_checking), - cmocka_unit_test(test__f_type_array_int128s_resize__parameter_checking), - - cmocka_unit_test(test__f_type_array_int128ss_adjust__parameter_checking), - cmocka_unit_test(test__f_type_array_int128ss_append__parameter_checking), - cmocka_unit_test(test__f_type_array_int128ss_append_all__parameter_checking), - cmocka_unit_test(test__f_type_array_int128ss_decimate_by__parameter_checking), - cmocka_unit_test(test__f_type_array_int128ss_decrease_by__parameter_checking), - cmocka_unit_test(test__f_type_array_int128ss_increase__parameter_checking), - cmocka_unit_test(test__f_type_array_int128ss_increase_by__parameter_checking), - cmocka_unit_test(test__f_type_array_int128ss_resize__parameter_checking), - - cmocka_unit_test(test__f_type_array_polls_adjust__parameter_checking), - cmocka_unit_test(test__f_type_array_polls_append__parameter_checking), - cmocka_unit_test(test__f_type_array_polls_append_all__parameter_checking), - cmocka_unit_test(test__f_type_array_polls_decimate_by__parameter_checking), - cmocka_unit_test(test__f_type_array_polls_decrease_by__parameter_checking), - cmocka_unit_test(test__f_type_array_polls_increase__parameter_checking), - cmocka_unit_test(test__f_type_array_polls_increase_by__parameter_checking), - cmocka_unit_test(test__f_type_array_polls_resize__parameter_checking), - - cmocka_unit_test(test__f_type_array_pollss_adjust__parameter_checking), - cmocka_unit_test(test__f_type_array_pollss_append__parameter_checking), - cmocka_unit_test(test__f_type_array_pollss_append_all__parameter_checking), - cmocka_unit_test(test__f_type_array_pollss_decimate_by__parameter_checking), - cmocka_unit_test(test__f_type_array_pollss_decrease_by__parameter_checking), - cmocka_unit_test(test__f_type_array_pollss_increase__parameter_checking), - cmocka_unit_test(test__f_type_array_pollss_increase_by__parameter_checking), - cmocka_unit_test(test__f_type_array_pollss_resize__parameter_checking), - - cmocka_unit_test(test__f_type_array_states_adjust__parameter_checking), - cmocka_unit_test(test__f_type_array_states_append__parameter_checking), - cmocka_unit_test(test__f_type_array_states_append_all__parameter_checking), - cmocka_unit_test(test__f_type_array_states_decimate_by__parameter_checking), - cmocka_unit_test(test__f_type_array_states_decrease_by__parameter_checking), - cmocka_unit_test(test__f_type_array_states_increase__parameter_checking), - cmocka_unit_test(test__f_type_array_states_increase_by__parameter_checking), - cmocka_unit_test(test__f_type_array_states_resize__parameter_checking), - - cmocka_unit_test(test__f_type_array_statess_adjust__parameter_checking), - cmocka_unit_test(test__f_type_array_statess_append__parameter_checking), - cmocka_unit_test(test__f_type_array_statess_append_all__parameter_checking), - cmocka_unit_test(test__f_type_array_statess_decimate_by__parameter_checking), - cmocka_unit_test(test__f_type_array_statess_decrease_by__parameter_checking), - cmocka_unit_test(test__f_type_array_statess_increase__parameter_checking), - cmocka_unit_test(test__f_type_array_statess_increase_by__parameter_checking), - cmocka_unit_test(test__f_type_array_statess_resize__parameter_checking), - - cmocka_unit_test(test__f_type_array_statuss_adjust__parameter_checking), - cmocka_unit_test(test__f_type_array_statuss_append__parameter_checking), - cmocka_unit_test(test__f_type_array_statuss_append_all__parameter_checking), - cmocka_unit_test(test__f_type_array_statuss_decimate_by__parameter_checking), - cmocka_unit_test(test__f_type_array_statuss_decrease_by__parameter_checking), - cmocka_unit_test(test__f_type_array_statuss_increase__parameter_checking), - cmocka_unit_test(test__f_type_array_statuss_increase_by__parameter_checking), - cmocka_unit_test(test__f_type_array_statuss_resize__parameter_checking), - - cmocka_unit_test(test__f_type_array_statusss_adjust__parameter_checking), - cmocka_unit_test(test__f_type_array_statusss_append__parameter_checking), - cmocka_unit_test(test__f_type_array_statusss_append_all__parameter_checking), - cmocka_unit_test(test__f_type_array_statusss_decimate_by__parameter_checking), - cmocka_unit_test(test__f_type_array_statusss_decrease_by__parameter_checking), - cmocka_unit_test(test__f_type_array_statusss_increase__parameter_checking), - cmocka_unit_test(test__f_type_array_statusss_increase_by__parameter_checking), - cmocka_unit_test(test__f_type_array_statusss_resize__parameter_checking), - - cmocka_unit_test(test__f_type_array_uint8s_adjust__parameter_checking), - cmocka_unit_test(test__f_type_array_uint8s_append__parameter_checking), - cmocka_unit_test(test__f_type_array_uint8s_append_all__parameter_checking), - cmocka_unit_test(test__f_type_array_uint8s_decimate_by__parameter_checking), - cmocka_unit_test(test__f_type_array_uint8s_decrease_by__parameter_checking), - cmocka_unit_test(test__f_type_array_uint8s_increase__parameter_checking), - cmocka_unit_test(test__f_type_array_uint8s_increase_by__parameter_checking), - cmocka_unit_test(test__f_type_array_uint8s_resize__parameter_checking), - - cmocka_unit_test(test__f_type_array_uint8ss_adjust__parameter_checking), - cmocka_unit_test(test__f_type_array_uint8ss_append__parameter_checking), - cmocka_unit_test(test__f_type_array_uint8ss_append_all__parameter_checking), - cmocka_unit_test(test__f_type_array_uint8ss_decimate_by__parameter_checking), - cmocka_unit_test(test__f_type_array_uint8ss_decrease_by__parameter_checking), - cmocka_unit_test(test__f_type_array_uint8ss_increase__parameter_checking), - cmocka_unit_test(test__f_type_array_uint8ss_increase_by__parameter_checking), - cmocka_unit_test(test__f_type_array_uint8ss_resize__parameter_checking), - - cmocka_unit_test(test__f_type_array_uint16s_adjust__parameter_checking), - cmocka_unit_test(test__f_type_array_uint16s_append__parameter_checking), - cmocka_unit_test(test__f_type_array_uint16s_append_all__parameter_checking), - cmocka_unit_test(test__f_type_array_uint16s_decimate_by__parameter_checking), - cmocka_unit_test(test__f_type_array_uint16s_decrease_by__parameter_checking), - cmocka_unit_test(test__f_type_array_uint16s_increase__parameter_checking), - cmocka_unit_test(test__f_type_array_uint16s_increase_by__parameter_checking), - cmocka_unit_test(test__f_type_array_uint16s_resize__parameter_checking), - - cmocka_unit_test(test__f_type_array_uint16ss_adjust__parameter_checking), - cmocka_unit_test(test__f_type_array_uint16ss_append__parameter_checking), - cmocka_unit_test(test__f_type_array_uint16ss_append_all__parameter_checking), - cmocka_unit_test(test__f_type_array_uint16ss_decimate_by__parameter_checking), - cmocka_unit_test(test__f_type_array_uint16ss_decrease_by__parameter_checking), - cmocka_unit_test(test__f_type_array_uint16ss_increase__parameter_checking), - cmocka_unit_test(test__f_type_array_uint16ss_increase_by__parameter_checking), - cmocka_unit_test(test__f_type_array_uint16ss_resize__parameter_checking), - - cmocka_unit_test(test__f_type_array_uint32s_adjust__parameter_checking), - cmocka_unit_test(test__f_type_array_uint32s_append__parameter_checking), - cmocka_unit_test(test__f_type_array_uint32s_append_all__parameter_checking), - cmocka_unit_test(test__f_type_array_uint32s_decimate_by__parameter_checking), - cmocka_unit_test(test__f_type_array_uint32s_decrease_by__parameter_checking), - cmocka_unit_test(test__f_type_array_uint32s_increase__parameter_checking), - cmocka_unit_test(test__f_type_array_uint32s_increase_by__parameter_checking), - cmocka_unit_test(test__f_type_array_uint32s_resize__parameter_checking), - - cmocka_unit_test(test__f_type_array_uint32ss_adjust__parameter_checking), - cmocka_unit_test(test__f_type_array_uint32ss_append__parameter_checking), - cmocka_unit_test(test__f_type_array_uint32ss_append_all__parameter_checking), - cmocka_unit_test(test__f_type_array_uint32ss_decimate_by__parameter_checking), - cmocka_unit_test(test__f_type_array_uint32ss_decrease_by__parameter_checking), - cmocka_unit_test(test__f_type_array_uint32ss_increase__parameter_checking), - cmocka_unit_test(test__f_type_array_uint32ss_increase_by__parameter_checking), - cmocka_unit_test(test__f_type_array_uint32ss_resize__parameter_checking), - - cmocka_unit_test(test__f_type_array_uint64s_adjust__parameter_checking), - cmocka_unit_test(test__f_type_array_uint64s_append__parameter_checking), - cmocka_unit_test(test__f_type_array_uint64s_append_all__parameter_checking), - cmocka_unit_test(test__f_type_array_uint64s_decimate_by__parameter_checking), - cmocka_unit_test(test__f_type_array_uint64s_decrease_by__parameter_checking), - cmocka_unit_test(test__f_type_array_uint64s_increase__parameter_checking), - cmocka_unit_test(test__f_type_array_uint64s_increase_by__parameter_checking), - cmocka_unit_test(test__f_type_array_uint64s_resize__parameter_checking), - - cmocka_unit_test(test__f_type_array_uint64ss_adjust__parameter_checking), - cmocka_unit_test(test__f_type_array_uint64ss_append__parameter_checking), - cmocka_unit_test(test__f_type_array_uint64ss_append_all__parameter_checking), - cmocka_unit_test(test__f_type_array_uint64ss_decimate_by__parameter_checking), - cmocka_unit_test(test__f_type_array_uint64ss_decrease_by__parameter_checking), - cmocka_unit_test(test__f_type_array_uint64ss_increase__parameter_checking), - cmocka_unit_test(test__f_type_array_uint64ss_increase_by__parameter_checking), - cmocka_unit_test(test__f_type_array_uint64ss_resize__parameter_checking), - - cmocka_unit_test(test__f_type_array_uint128s_adjust__parameter_checking), - cmocka_unit_test(test__f_type_array_uint128s_append__parameter_checking), - cmocka_unit_test(test__f_type_array_uint128s_append_all__parameter_checking), - cmocka_unit_test(test__f_type_array_uint128s_decimate_by__parameter_checking), - cmocka_unit_test(test__f_type_array_uint128s_decrease_by__parameter_checking), - cmocka_unit_test(test__f_type_array_uint128s_increase__parameter_checking), - cmocka_unit_test(test__f_type_array_uint128s_increase_by__parameter_checking), - cmocka_unit_test(test__f_type_array_uint128s_resize__parameter_checking), - - cmocka_unit_test(test__f_type_array_uint128ss_adjust__parameter_checking), - cmocka_unit_test(test__f_type_array_uint128ss_append__parameter_checking), - cmocka_unit_test(test__f_type_array_uint128ss_append_all__parameter_checking), - cmocka_unit_test(test__f_type_array_uint128ss_decimate_by__parameter_checking), - cmocka_unit_test(test__f_type_array_uint128ss_decrease_by__parameter_checking), - cmocka_unit_test(test__f_type_array_uint128ss_increase__parameter_checking), - cmocka_unit_test(test__f_type_array_uint128ss_increase_by__parameter_checking), - cmocka_unit_test(test__f_type_array_uint128ss_resize__parameter_checking), + // f_cells_adjust_callback() doesn't use parameter checking. + // f_cells_resize_callback() doesn't use parameter checking. + + // f_files_adjust_callback() doesn't use parameter checking. + // f_files_resize_callback() doesn't use parameter checking. + + // f_fll_ids_adjust_callback() doesn't use parameter checking. + // f_fll_ids_resize_callback() doesn't use parameter checking. + + // f_int8s_adjust_callback() doesn't use parameter checking. + // f_int8s_resize_callback() doesn't use parameter checking. + + // f_int16s_adjust_callback() doesn't use parameter checking. + // f_int16s_resize_callback() doesn't use parameter checking. + + // f_int32s_adjust_callback() doesn't use parameter checking. + // f_int32s_resize_callback() doesn't use parameter checking. + + // f_int64s_adjust_callback() doesn't use parameter checking. + // f_int64s_resize_callback() doesn't use parameter checking. + + // f_int128s_adjust_callback() doesn't use parameter checking. + // f_int128s_resize_callback() doesn't use parameter checking. + + // f_number_unsigneds_adjust_callback() doesn't use parameter checking. + // f_number_unsigneds_resize_callback() doesn't use parameter checking. + + // f_uint8s_adjust_callback() doesn't use parameter checking. + // f_uint8s_resize_callback() doesn't use parameter checking. + + // f_uint16s_adjust_callback() doesn't use parameter checking. + // f_uint16s_resize_callback() doesn't use parameter checking. + + // f_uint32s_adjust_callback() doesn't use parameter checking. + // f_uint32s_resize_callback() doesn't use parameter checking. + + // f_uint64s_adjust_callback() doesn't use parameter checking. + // f_uint64s_resize_callback() doesn't use parameter checking. + + // f_uint128s_adjust_callback() doesn't use parameter checking. + // f_uint128s_resize_callback() doesn't use parameter checking. #endif // _di_level_0_parameter_checking_ }; diff --git a/level_0/f_type_array/tests/unit/c/test-type_array.h b/level_0/f_type_array/tests/unit/c/test-type_array.h index 2018c6c2c..fa5e2d010 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array.h @@ -27,278 +27,34 @@ #include // Test includes. -#include "test-type_array-cells_adjust.h" -#include "test-type_array-cells_append.h" -#include "test-type_array-cells_append_all.h" -#include "test-type_array-cells_decimate_by.h" -#include "test-type_array-cells_decrease_by.h" -#include "test-type_array-cells_increase.h" -#include "test-type_array-cells_increase_by.h" -#include "test-type_array-cells_resize.h" -#include "test-type_array-cellss_adjust.h" -#include "test-type_array-cellss_append.h" -#include "test-type_array-cellss_append_all.h" -#include "test-type_array-cellss_decimate_by.h" -#include "test-type_array-cellss_decrease_by.h" -#include "test-type_array-cellss_increase.h" -#include "test-type_array-cellss_increase_by.h" -#include "test-type_array-cellss_resize.h" -#include "test-type_array-files_adjust.h" -#include "test-type_array-files_append.h" -#include "test-type_array-files_append_all.h" -#include "test-type_array-files_decimate_by.h" -#include "test-type_array-files_decrease_by.h" -#include "test-type_array-files_increase.h" -#include "test-type_array-files_increase_by.h" -#include "test-type_array-files_resize.h" -#include "test-type_array-filess_adjust.h" -#include "test-type_array-filess_append.h" -#include "test-type_array-filess_append_all.h" -#include "test-type_array-filess_decimate_by.h" -#include "test-type_array-filess_decrease_by.h" -#include "test-type_array-filess_increase.h" -#include "test-type_array-filess_increase_by.h" -#include "test-type_array-filess_resize.h" -#include "test-type_array-fll_ids_adjust.h" -#include "test-type_array-fll_ids_append.h" -#include "test-type_array-fll_ids_append_all.h" -#include "test-type_array-fll_ids_decimate_by.h" -#include "test-type_array-fll_ids_decrease_by.h" -#include "test-type_array-fll_ids_increase.h" -#include "test-type_array-fll_ids_increase_by.h" -#include "test-type_array-fll_ids_resize.h" -#include "test-type_array-fll_idss_adjust.h" -#include "test-type_array-fll_idss_append.h" -#include "test-type_array-fll_idss_append_all.h" -#include "test-type_array-fll_idss_decimate_by.h" -#include "test-type_array-fll_idss_decrease_by.h" -#include "test-type_array-fll_idss_increase.h" -#include "test-type_array-fll_idss_increase_by.h" -#include "test-type_array-fll_idss_resize.h" -#include "test-type_array-int8s_adjust.h" -#include "test-type_array-int8s_append.h" -#include "test-type_array-int8s_append_all.h" -#include "test-type_array-int8s_decimate_by.h" -#include "test-type_array-int8s_decrease_by.h" -#include "test-type_array-int8s_increase.h" -#include "test-type_array-int8s_increase_by.h" -#include "test-type_array-int8s_resize.h" -#include "test-type_array-int8ss_adjust.h" -#include "test-type_array-int8ss_append.h" -#include "test-type_array-int8ss_append_all.h" -#include "test-type_array-int8ss_decimate_by.h" -#include "test-type_array-int8ss_decrease_by.h" -#include "test-type_array-int8ss_increase.h" -#include "test-type_array-int8ss_increase_by.h" -#include "test-type_array-int8ss_resize.h" -#include "test-type_array-int16s_adjust.h" -#include "test-type_array-int16s_append.h" -#include "test-type_array-int16s_append_all.h" -#include "test-type_array-int16s_decimate_by.h" -#include "test-type_array-int16s_decrease_by.h" -#include "test-type_array-int16s_increase.h" -#include "test-type_array-int16s_increase_by.h" -#include "test-type_array-int16s_resize.h" -#include "test-type_array-int16ss_adjust.h" -#include "test-type_array-int16ss_append.h" -#include "test-type_array-int16ss_append_all.h" -#include "test-type_array-int16ss_decimate_by.h" -#include "test-type_array-int16ss_decrease_by.h" -#include "test-type_array-int16ss_increase.h" -#include "test-type_array-int16ss_increase_by.h" -#include "test-type_array-int16ss_resize.h" -#include "test-type_array-int32s_adjust.h" -#include "test-type_array-int32s_append.h" -#include "test-type_array-int32s_append_all.h" -#include "test-type_array-int32s_decimate_by.h" -#include "test-type_array-int32s_decrease_by.h" -#include "test-type_array-int32s_increase.h" -#include "test-type_array-int32s_increase_by.h" -#include "test-type_array-int32s_resize.h" -#include "test-type_array-int32ss_adjust.h" -#include "test-type_array-int32ss_append.h" -#include "test-type_array-int32ss_append_all.h" -#include "test-type_array-int32ss_decimate_by.h" -#include "test-type_array-int32ss_decrease_by.h" -#include "test-type_array-int32ss_increase.h" -#include "test-type_array-int32ss_increase_by.h" -#include "test-type_array-int32ss_resize.h" -#include "test-type_array-int64s_adjust.h" -#include "test-type_array-int64s_append.h" -#include "test-type_array-int64s_append_all.h" -#include "test-type_array-int64s_decimate_by.h" -#include "test-type_array-int64s_decrease_by.h" -#include "test-type_array-int64s_increase.h" -#include "test-type_array-int64s_increase_by.h" -#include "test-type_array-int64s_resize.h" -#include "test-type_array-int64ss_adjust.h" -#include "test-type_array-int64ss_append.h" -#include "test-type_array-int64ss_append_all.h" -#include "test-type_array-int64ss_decimate_by.h" -#include "test-type_array-int64ss_decrease_by.h" -#include "test-type_array-int64ss_increase.h" -#include "test-type_array-int64ss_increase_by.h" -#include "test-type_array-int64ss_resize.h" -#include "test-type_array-int128s_adjust.h" -#include "test-type_array-int128s_append.h" -#include "test-type_array-int128s_append_all.h" -#include "test-type_array-int128s_decimate_by.h" -#include "test-type_array-int128s_decrease_by.h" -#include "test-type_array-int128s_increase.h" -#include "test-type_array-int128s_increase_by.h" -#include "test-type_array-int128s_resize.h" -#include "test-type_array-int128ss_adjust.h" -#include "test-type_array-int128ss_append.h" -#include "test-type_array-int128ss_append_all.h" -#include "test-type_array-int128ss_decimate_by.h" -#include "test-type_array-int128ss_decrease_by.h" -#include "test-type_array-int128ss_increase.h" -#include "test-type_array-int128ss_increase_by.h" -#include "test-type_array-int128ss_resize.h" -#include "test-type_array-number_unsigneds_adjust.h" -#include "test-type_array-number_unsigneds_append.h" -#include "test-type_array-number_unsigneds_append_all.h" -#include "test-type_array-number_unsigneds_decimate_by.h" -#include "test-type_array-number_unsigneds_decrease_by.h" -#include "test-type_array-number_unsigneds_increase.h" -#include "test-type_array-number_unsigneds_increase_by.h" -#include "test-type_array-number_unsigneds_resize.h" -#include "test-type_array-number_unsignedss_adjust.h" -#include "test-type_array-number_unsignedss_append.h" -#include "test-type_array-number_unsignedss_append_all.h" -#include "test-type_array-number_unsignedss_decimate_by.h" -#include "test-type_array-number_unsignedss_decrease_by.h" -#include "test-type_array-number_unsignedss_increase.h" -#include "test-type_array-number_unsignedss_increase_by.h" -#include "test-type_array-number_unsignedss_resize.h" -#include "test-type_array-polls_adjust.h" -#include "test-type_array-polls_append.h" -#include "test-type_array-polls_append_all.h" -#include "test-type_array-polls_decimate_by.h" -#include "test-type_array-polls_decrease_by.h" -#include "test-type_array-polls_increase.h" -#include "test-type_array-polls_increase_by.h" -#include "test-type_array-polls_resize.h" -#include "test-type_array-pollss_adjust.h" -#include "test-type_array-pollss_append.h" -#include "test-type_array-pollss_append_all.h" -#include "test-type_array-pollss_decimate_by.h" -#include "test-type_array-pollss_decrease_by.h" -#include "test-type_array-pollss_increase.h" -#include "test-type_array-pollss_increase_by.h" -#include "test-type_array-pollss_resize.h" -#include "test-type_array-states_adjust.h" -#include "test-type_array-states_append.h" -#include "test-type_array-states_append_all.h" -#include "test-type_array-states_decimate_by.h" -#include "test-type_array-states_decrease_by.h" -#include "test-type_array-states_increase.h" -#include "test-type_array-states_increase_by.h" -#include "test-type_array-states_resize.h" -#include "test-type_array-statess_adjust.h" -#include "test-type_array-statess_append.h" -#include "test-type_array-statess_append_all.h" -#include "test-type_array-statess_decimate_by.h" -#include "test-type_array-statess_decrease_by.h" -#include "test-type_array-statess_increase.h" -#include "test-type_array-statess_increase_by.h" -#include "test-type_array-statess_resize.h" -#include "test-type_array-statuss_adjust.h" -#include "test-type_array-statuss_append.h" -#include "test-type_array-statuss_append_all.h" -#include "test-type_array-statuss_decimate_by.h" -#include "test-type_array-statuss_decrease_by.h" -#include "test-type_array-statuss_increase.h" -#include "test-type_array-statuss_increase_by.h" -#include "test-type_array-statuss_resize.h" -#include "test-type_array-statusss_adjust.h" -#include "test-type_array-statusss_append.h" -#include "test-type_array-statusss_append_all.h" -#include "test-type_array-statusss_decimate_by.h" -#include "test-type_array-statusss_decrease_by.h" -#include "test-type_array-statusss_increase.h" -#include "test-type_array-statusss_increase_by.h" -#include "test-type_array-statusss_resize.h" -#include "test-type_array-uint8s_adjust.h" -#include "test-type_array-uint8s_append.h" -#include "test-type_array-uint8s_append_all.h" -#include "test-type_array-uint8s_decimate_by.h" -#include "test-type_array-uint8s_decrease_by.h" -#include "test-type_array-uint8s_increase.h" -#include "test-type_array-uint8s_increase_by.h" -#include "test-type_array-uint8s_resize.h" -#include "test-type_array-uint8ss_adjust.h" -#include "test-type_array-uint8ss_append.h" -#include "test-type_array-uint8ss_append_all.h" -#include "test-type_array-uint8ss_decimate_by.h" -#include "test-type_array-uint8ss_decrease_by.h" -#include "test-type_array-uint8ss_increase.h" -#include "test-type_array-uint8ss_increase_by.h" -#include "test-type_array-uint8ss_resize.h" -#include "test-type_array-uint16s_adjust.h" -#include "test-type_array-uint16s_append.h" -#include "test-type_array-uint16s_append_all.h" -#include "test-type_array-uint16s_decimate_by.h" -#include "test-type_array-uint16s_decrease_by.h" -#include "test-type_array-uint16s_increase.h" -#include "test-type_array-uint16s_increase_by.h" -#include "test-type_array-uint16s_resize.h" -#include "test-type_array-uint16ss_adjust.h" -#include "test-type_array-uint16ss_append.h" -#include "test-type_array-uint16ss_append_all.h" -#include "test-type_array-uint16ss_decimate_by.h" -#include "test-type_array-uint16ss_decrease_by.h" -#include "test-type_array-uint16ss_increase.h" -#include "test-type_array-uint16ss_increase_by.h" -#include "test-type_array-uint16ss_resize.h" -#include "test-type_array-uint32s_adjust.h" -#include "test-type_array-uint32s_append.h" -#include "test-type_array-uint32s_append_all.h" -#include "test-type_array-uint32s_decimate_by.h" -#include "test-type_array-uint32s_decrease_by.h" -#include "test-type_array-uint32s_increase.h" -#include "test-type_array-uint32s_increase_by.h" -#include "test-type_array-uint32s_resize.h" -#include "test-type_array-uint32ss_adjust.h" -#include "test-type_array-uint32ss_append.h" -#include "test-type_array-uint32ss_append_all.h" -#include "test-type_array-uint32ss_decimate_by.h" -#include "test-type_array-uint32ss_decrease_by.h" -#include "test-type_array-uint32ss_increase.h" -#include "test-type_array-uint32ss_increase_by.h" -#include "test-type_array-uint32ss_resize.h" -#include "test-type_array-uint64s_adjust.h" -#include "test-type_array-uint64s_append.h" -#include "test-type_array-uint64s_append_all.h" -#include "test-type_array-uint64s_decimate_by.h" -#include "test-type_array-uint64s_decrease_by.h" -#include "test-type_array-uint64s_increase.h" -#include "test-type_array-uint64s_increase_by.h" -#include "test-type_array-uint64s_resize.h" -#include "test-type_array-uint64ss_adjust.h" -#include "test-type_array-uint64ss_append.h" -#include "test-type_array-uint64ss_append_all.h" -#include "test-type_array-uint64ss_decimate_by.h" -#include "test-type_array-uint64ss_decrease_by.h" -#include "test-type_array-uint64ss_increase.h" -#include "test-type_array-uint64ss_increase_by.h" -#include "test-type_array-uint64ss_resize.h" -#include "test-type_array-uint128s_adjust.h" -#include "test-type_array-uint128s_append.h" -#include "test-type_array-uint128s_append_all.h" -#include "test-type_array-uint128s_decimate_by.h" -#include "test-type_array-uint128s_decrease_by.h" -#include "test-type_array-uint128s_increase.h" -#include "test-type_array-uint128s_increase_by.h" -#include "test-type_array-uint128s_resize.h" -#include "test-type_array-uint128ss_adjust.h" -#include "test-type_array-uint128ss_append.h" -#include "test-type_array-uint128ss_append_all.h" -#include "test-type_array-uint128ss_decimate_by.h" -#include "test-type_array-uint128ss_decrease_by.h" -#include "test-type_array-uint128ss_increase.h" -#include "test-type_array-uint128ss_increase_by.h" -#include "test-type_array-uint128ss_resize.h" +#include "test-type_array-cells_adjust_callback.h" +#include "test-type_array-cells_resize_callback.h" +#include "test-type_array-files_adjust_callback.h" +#include "test-type_array-files_resize_callback.h" +#include "test-type_array-fll_ids_adjust_callback.h" +#include "test-type_array-fll_ids_resize_callback.h" +#include "test-type_array-int8s_adjust_callback.h" +#include "test-type_array-int8s_resize_callback.h" +#include "test-type_array-int16s_adjust_callback.h" +#include "test-type_array-int16s_resize_callback.h" +#include "test-type_array-int32s_adjust_callback.h" +#include "test-type_array-int32s_resize_callback.h" +#include "test-type_array-int64s_adjust_callback.h" +#include "test-type_array-int64s_resize_callback.h" +#include "test-type_array-int128s_adjust_callback.h" +#include "test-type_array-int128s_resize_callback.h" +#include "test-type_array-number_unsigneds_adjust_callback.h" +#include "test-type_array-number_unsigneds_resize_callback.h" +#include "test-type_array-uint8s_adjust_callback.h" +#include "test-type_array-uint8s_resize_callback.h" +#include "test-type_array-uint16s_adjust_callback.h" +#include "test-type_array-uint16s_resize_callback.h" +#include "test-type_array-uint32s_adjust_callback.h" +#include "test-type_array-uint32s_resize_callback.h" +#include "test-type_array-uint64s_adjust_callback.h" +#include "test-type_array-uint64s_resize_callback.h" +#include "test-type_array-uint128s_adjust_callback.h" +#include "test-type_array-uint128s_resize_callback.h" #ifdef __cplusplus extern "C" { diff --git a/level_1/fl_fss/c/fss/basic.h b/level_1/fl_fss/c/fss/basic.h index 0108c7a20..c415897d0 100644 --- a/level_1/fl_fss/c/fss/basic.h +++ b/level_1/fl_fss/c/fss/basic.h @@ -180,24 +180,22 @@ extern "C" { * F_interrupt (with error bit) if stopping due to an interrupt. * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_number_unsigneds_increase(). - * Errors (with error bit) from: f_number_unsigneds_increase_by(). * Errors (with error bit) from: f_fss_is_graph(). * Errors (with error bit) from: f_fss_is_space(). * Errors (with error bit) from: f_fss_is_zero_width(). * Errors (with error bit) from: f_fss_seek_to_eol(). * Errors (with error bit) from: f_fss_skip_past_delimit(). * Errors (with error bit) from: f_fss_skip_past_space(). + * Errors (with error bit) from: f_memory_array_increase_by(). * Errors (with error bit) from: f_utf_buffer_increment(). * - * @see f_number_unsigneds_increase() - * @see f_number_unsigneds_increase_by() * @see f_fss_is_graph() * @see f_fss_is_space() * @see f_fss_is_zero_width() * @see f_fss_seek_to_eol() * @see f_fss_skip_past_delimit() * @see f_fss_skip_past_space() + * @see f_memory_array_increase_by() * @see f_utf_buffer_increment() */ #ifndef _di_fl_fss_basic_object_read_ diff --git a/level_1/fl_fss/c/fss/basic_list.c b/level_1/fl_fss/c/fss/basic_list.c index c4604edde..98ef33a71 100644 --- a/level_1/fl_fss/c/fss/basic_list.c +++ b/level_1/fl_fss/c/fss/basic_list.c @@ -63,7 +63,7 @@ extern "C" { if (buffer.string[range->start] == f_fss_eol_s.string[0]) { if (graph_first == 0x2) { - state->status = f_number_unsigneds_increase(state->step_small, delimits); + state->status = f_memory_array_increase(state->step_small, sizeof(f_number_unsigned_t), (void **) &delimits->array, &delimits->used, &delimits->size); if (F_status_is_error(state->status)) break; delimits->array[delimits->used++] = comment_delimit; @@ -132,7 +132,7 @@ extern "C" { return; } - state->status = f_number_unsigneds_increase_by((slash_count / 2) + 1, delimits); + state->status = f_memory_array_increase_by((slash_count / 2) + 1, sizeof(f_number_unsigned_t), (void **) &delimits->array, &delimits->used, &delimits->size); if (F_status_is_error(state->status)) break; while (slash_count > 0) { @@ -152,7 +152,7 @@ extern "C" { if (F_status_is_error(state->status)) break; if (graph_first == 0x2) { - state->status = f_number_unsigneds_increase(state->step_small, delimits); + state->status = f_memory_array_increase(state->step_small, sizeof(f_number_unsigned_t), (void **) &delimits->array, &delimits->used, &delimits->size); if (F_status_is_error(state->status)) break; delimits->array[delimits->used++] = comment_delimit; @@ -217,7 +217,7 @@ extern "C" { if (buffer.string[range->start] == f_fss_eol_s.string[0]) { if (graph_first == 0x2) { - state->status = f_number_unsigneds_increase(state->step_small, delimits); + state->status = f_memory_array_increase(state->step_small, sizeof(f_number_unsigned_t), (void **) &delimits->array, &delimits->used, &delimits->size); if (F_status_is_error(state->status)) break; delimits->array[delimits->used++] = comment_delimit; @@ -699,7 +699,7 @@ extern "C" { range->start = slash_first; - state->status = f_number_unsigneds_increase_by((slash_count / 2) + 1, delimits); + state->status = f_memory_array_increase_by((slash_count / 2) + 1, sizeof(f_number_unsigned_t), (void **) &delimits->array, &delimits->used, &delimits->size); if (F_status_is_error(state->status)) break; if (slash_count % 2 == 0) { @@ -740,7 +740,7 @@ extern "C" { graph_first = F_false; // Comments may only have white space before the '#', therefore only the first slash needs to be delimited. - state->status = f_number_unsigneds_increase(state->step_small, delimits); + state->status = f_memory_array_increase(state->step_small, sizeof(f_number_unsigned_t), (void **) &delimits->array, &delimits->used, &delimits->size); if (F_status_is_error(state->status)) break; delimits->array[delimits->used++] = slash_first; diff --git a/level_1/fl_fss/c/fss/basic_list.h b/level_1/fl_fss/c/fss/basic_list.h index 74fb4313a..b429eb92f 100644 --- a/level_1/fl_fss/c/fss/basic_list.h +++ b/level_1/fl_fss/c/fss/basic_list.h @@ -74,16 +74,16 @@ extern "C" { * F_interrupt (with error bit) if stopping due to an interrupt. * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_number_unsigneds_increase(). - * Errors (with error bit) from: f_number_unsigneds_increase_by(). + * Errors (with error bit) from: f_memory_array_increase(). + * Errors (with error bit) from: f_memory_array_increase_by(). * Errors (with error bit) from: f_fss_is_space(). * Errors (with error bit) from: f_fss_seek_to_eol(). * Errors (with error bit) from: f_fss_skip_past_delimit(). * Errors (with error bit) from: f_string_ranges_increase(). * Errors (with error bit) from: f_utf_buffer_increment(). * - * @see f_number_unsigneds_increase() - * @see f_number_unsigneds_increase_by() + * @see f_memory_array_increase() + * @see f_memory_array_increase_by() * @see f_fss_is_space() * @see f_fss_seek_to_eol() * @see f_fss_skip_past_delimit() @@ -200,22 +200,22 @@ extern "C" { * F_interrupt (with error bit) if stopping due to an interrupt. * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_number_unsigneds_increase_by(). * Errors (with error bit) from: f_fss_is_graph(). * Errors (with error bit) from: f_fss_is_space(). * Errors (with error bit) from: f_fss_is_zero_width(). * Errors (with error bit) from: f_fss_seek_to_eol(). * Errors (with error bit) from: f_fss_skip_past_delimit(). * Errors (with error bit) from: f_fss_skip_past_space(). + * Errors (with error bit) from: f_memory_array_increase_by(). * Errors (with error bit) from: f_utf_buffer_increment(). * - * @see f_number_unsigneds_increase_by() * @see f_fss_is_graph() * @see f_fss_is_space() * @see f_fss_is_zero_width() * @see f_fss_seek_to_eol() * @see f_fss_skip_past_delimit() * @see f_fss_skip_past_space() + * @see f_memory_array_increase_by() * @see f_utf_buffer_increment() */ #ifndef _di_fl_fss_basic_list_object_read_ diff --git a/level_1/fl_fss/c/fss/embedded_list.c b/level_1/fl_fss/c/fss/embedded_list.c index b40a53854..114cf9c2c 100644 --- a/level_1/fl_fss/c/fss/embedded_list.c +++ b/level_1/fl_fss/c/fss/embedded_list.c @@ -27,7 +27,7 @@ extern "C" { f_number_unsigneds_t positions_start = f_number_unsigneds_t_initialize; - state->status = f_number_unsigneds_increase(state->step_small, &positions_start); + state->status = f_memory_array_increase(state->step_small, sizeof(f_number_unsigned_t), (void **) &positions_start.array, &positions_start.used, &positions_start.size); if (F_status_is_error(state->status)) return; f_string_ranges_t objects = f_string_ranges_t_initialize; @@ -42,7 +42,7 @@ extern "C" { f_number_unsigneds_t slashes = f_number_unsigneds_t_initialize; - state->status = f_number_unsigneds_increase(state->step_small, &slashes); + state->status = f_memory_array_increase(state->step_small, sizeof(f_number_unsigned_t), (void **) &slashes.array, &slashes.used, &slashes.size); if (F_status_is_error(state->status)) { f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &positions_start.array, &positions_start.used, &positions_start.size); @@ -89,7 +89,7 @@ extern "C" { if (buffer.string[range->start] == f_fss_eol_s.string[0]) { if (graph_first == 0x2) { - state->status = f_number_unsigneds_increase(state->step_small, delimits); + state->status = f_memory_array_increase(state->step_small, sizeof(f_number_unsigned_t), (void **) &delimits->array, &delimits->used, &delimits->size); if (F_status_is_error(state->status)) break; delimits->array[delimits->used++] = comment_delimit; @@ -194,7 +194,7 @@ extern "C" { // When slash is odd and a (delimited) valid open/close is found, then save delimited positions and continue. if (buffer.string[range->start] == f_fss_eol_s.string[0]) { if (graph_first == 0x2) { - state->status = f_number_unsigneds_increase(state->step_small, delimits); + state->status = f_memory_array_increase(state->step_small, sizeof(f_number_unsigned_t), (void **) &delimits->array, &delimits->used, &delimits->size); if (F_status_is_error(state->status)) break; delimits->array[delimits->used++] = comment_delimit; @@ -225,7 +225,7 @@ extern "C" { if (buffer.string[range->start] == f_fss_eol_s.string[0]) { if (graph_first == 0x2) { - state->status = f_number_unsigneds_increase(state->step_small, delimits); + state->status = f_memory_array_increase(state->step_small, sizeof(f_number_unsigned_t), (void **) &delimits->array, &delimits->used, &delimits->size); if (F_status_is_error(state->status)) break; delimits->array[delimits->used++] = comment_delimit; @@ -298,7 +298,7 @@ extern "C" { range->start = slash_first; - state->status = f_number_unsigneds_increase_by((slashes.array[depth] / 2) + 1, delimits); + state->status = f_memory_array_increase_by((slashes.array[depth] / 2) + 1, sizeof(f_number_unsigned_t), (void **) &delimits->array, &delimits->used, &delimits->size); if (F_status_is_error(state->status)) break; // Apply slash delimits, only slashes and placeholders should be present. @@ -321,13 +321,13 @@ extern "C" { // When slashes are even, the object is valid and needs to be processed. if (is_object) { if (++depth > positions_start.size) { - state->status = f_number_unsigneds_increase(state->step_small, &positions_start); + state->status = f_memory_array_increase(state->step_small, sizeof(f_number_unsigned_t), (void **) &positions_start.array, &positions_start.used, &positions_start.size); if (F_status_is_error(state->status)) break; state->status = f_string_ranges_increase(state->step_small, &objects); if (F_status_is_error(state->status)) break; - state->status = f_number_unsigneds_increase(state->step_small, &slashes); + state->status = f_memory_array_increase(state->step_small, sizeof(f_number_unsigned_t), (void **) &slashes.array, &slashes.used, &slashes.size); if (F_status_is_error(state->status)) break; } @@ -345,7 +345,7 @@ extern "C" { } } else { - state->status = f_number_unsigneds_increase(state->step_small, delimits); + state->status = f_memory_array_increase(state->step_small, sizeof(f_number_unsigned_t), (void **) &delimits->array, &delimits->used, &delimits->size); if (F_status_is_error(state->status)) break; delimits->array[delimits->used++] = slash_last; @@ -428,13 +428,13 @@ extern "C" { ++depth; if (depth >= positions_start.size) { - state->status = f_number_unsigneds_increase(state->step_small, &positions_start); + state->status = f_memory_array_increase(state->step_small, sizeof(f_number_unsigned_t), (void **) &positions_start.array, &positions_start.used, &positions_start.size); if (F_status_is_error(state->status)) break; state->status = f_string_ranges_increase(state->step_small, &objects); if (F_status_is_error(state->status)) break; - state->status = f_number_unsigneds_increase(state->step_small, &slashes); + state->status = f_memory_array_increase(state->step_small, sizeof(f_number_unsigned_t), (void **) &slashes.array, &slashes.used, &slashes.size); if (F_status_is_error(state->status)) break; } @@ -451,7 +451,7 @@ extern "C" { slashes.array[depth] = 0; if (graph_first == 0x2) { - state->status = f_number_unsigneds_increase(state->step_small, delimits); + state->status = f_memory_array_increase(state->step_small, sizeof(f_number_unsigned_t), (void **) &delimits->array, &delimits->used, &delimits->size); if (F_status_is_error(state->status)) break; delimits->array[delimits->used++] = comment_delimit; @@ -468,7 +468,7 @@ extern "C" { if (F_status_is_error(state->status)) break; if (graph_first == 0x2) { - state->status = f_number_unsigneds_increase(state->step_small, delimits); + state->status = f_memory_array_increase(state->step_small, sizeof(f_number_unsigned_t), (void **) &delimits->array, &delimits->used, &delimits->size); if (F_status_is_error(state->status)) break; delimits->array[delimits->used++] = comment_delimit; @@ -624,7 +624,7 @@ extern "C" { } if (graph_first == 0x2) { - state->status = f_number_unsigneds_increase(state->step_small, delimits); + state->status = f_memory_array_increase(state->step_small, sizeof(f_number_unsigned_t), (void **) &delimits->array, &delimits->used, &delimits->size); if (F_status_is_error(state->status)) break; delimits->array[delimits->used++] = comment_delimit; @@ -668,7 +668,7 @@ extern "C" { if (buffer.string[range->start] == f_fss_eol_s.string[0]) { if (graph_first == 0x2) { - state->status = f_number_unsigneds_increase(state->step_small, delimits); + state->status = f_memory_array_increase(state->step_small, sizeof(f_number_unsigned_t), (void **) &delimits->array, &delimits->used, &delimits->size); if (F_status_is_error(state->status)) break; delimits->array[delimits->used++] = comment_delimit; @@ -733,7 +733,7 @@ extern "C" { } else { if (graph_first == 0x2) { - state->status = f_number_unsigneds_increase(state->step_small, delimits); + state->status = f_memory_array_increase(state->step_small, sizeof(f_number_unsigned_t), (void **) &delimits->array, &delimits->used, &delimits->size); if (F_status_is_error(state->status)) break; delimits->array[delimits->used++] = comment_delimit; @@ -1263,7 +1263,7 @@ extern "C" { range->start = slash_first; - state->status = f_number_unsigneds_increase_by((slash_count / 2) + 1, delimits); + state->status = f_memory_array_increase_by((slash_count / 2) + 1, sizeof(f_number_unsigned_t), (void **) &delimits->array, &delimits->used, &delimits->size); if (F_status_is_error(state->status)) break; if (slash_count % 2 == 0) { @@ -1300,7 +1300,7 @@ extern "C" { graph_first = F_false; // Comments may only have white space before the '#', therefore only the first slash needs to be delimited. - state->status = f_number_unsigneds_increase(state->step_small, delimits); + state->status = f_memory_array_increase(state->step_small, sizeof(f_number_unsigned_t), (void **) &delimits->array, &delimits->used, &delimits->size); if (F_status_is_error(state->status)) break; delimits->array[delimits->used++] = slash_first; diff --git a/level_1/fl_fss/c/fss/embedded_list.h b/level_1/fl_fss/c/fss/embedded_list.h index 1254c5077..430325813 100644 --- a/level_1/fl_fss/c/fss/embedded_list.h +++ b/level_1/fl_fss/c/fss/embedded_list.h @@ -78,8 +78,8 @@ extern "C" { * F_interrupt (with error bit) if stopping due to an interrupt. * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_number_unsigneds_increase(). - * Errors (with error bit) from: f_number_unsigneds_increase_by(). + * Errors (with error bit) from: f_memory_array_increase(). + * Errors (with error bit) from: f_memory_array_increase_by(). * Errors (with error bit) from: f_fss_is_space(). * Errors (with error bit) from: f_fss_nest_increase(). * Errors (with error bit) from: f_fss_seek_to_eol(). @@ -87,8 +87,8 @@ extern "C" { * Errors (with error bit) from: f_string_ranges_increase(). * Errors (with error bit) from: f_utf_buffer_increment(). * - * @see f_number_unsigneds_increase() - * @see f_number_unsigneds_increase_by() + * @see f_memory_array_increase() + * @see f_memory_array_increase_by() * @see f_fss_is_space() * @see f_fss_nest_increase() * @see f_fss_seek_to_eol() @@ -210,22 +210,22 @@ extern "C" { * F_interrupt (with error bit) if stopping due to an interrupt. * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_number_unsigneds_increase_by(). * Errors (with error bit) from: f_fss_is_graph(). * Errors (with error bit) from: f_fss_is_space(). * Errors (with error bit) from: f_fss_is_zero_width(). * Errors (with error bit) from: f_fss_seek_to_eol(). * Errors (with error bit) from: f_fss_skip_past_delimit(). * Errors (with error bit) from: f_fss_skip_past_space(). + * Errors (with error bit) from: f_memory_array_increase_by(). * Errors (with error bit) from: f_utf_buffer_increment(). * - * @see f_number_unsigneds_increase_by() * @see f_fss_is_graph() * @see f_fss_is_space() * @see f_fss_is_zero_width() * @see f_fss_seek_to_eol() * @see f_fss_skip_past_delimit() * @see f_fss_skip_past_space() + * @see f_memory_array_increase_by() * @see f_utf_buffer_increment() */ #ifndef _di_fl_fss_embedded_list_object_read_ diff --git a/level_1/fl_fss/c/fss/extended.c b/level_1/fl_fss/c/fss/extended.c index dea677f82..ece6555f1 100644 --- a/level_1/fl_fss/c/fss/extended.c +++ b/level_1/fl_fss/c/fss/extended.c @@ -63,7 +63,7 @@ extern "C" { } if (F_status_is_error_not(status) && quotes) { - status = f_uint8s_increase(state->step_small, quotes); + status = f_memory_array_increase(state->step_small, sizeof(uint8_t), (void **) "es->array, "es->used, "es->size); } if (F_status_is_error(status)) { diff --git a/level_1/fl_fss/c/fss/extended.h b/level_1/fl_fss/c/fss/extended.h index 9f047c8b2..c030d62ea 100644 --- a/level_1/fl_fss/c/fss/extended.h +++ b/level_1/fl_fss/c/fss/extended.h @@ -72,8 +72,6 @@ extern "C" { * F_interrupt (with error bit) if stopping due to an interrupt. * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_number_unsigneds_increase(). - * Errors (with error bit) from: f_number_unsigneds_increase_by(). * Errors (with error bit) from: f_fss_is_graph(). * Errors (with error bit) from: f_fss_is_space(). * Errors (with error bit) from: f_fss_is_zero_width(). @@ -81,8 +79,6 @@ extern "C" { * Errors (with error bit) from: f_fss_skip_past_space(). * Errors (with error bit) from: f_utf_buffer_increment(). * - * @see f_number_unsigneds_increase() - * @see f_number_unsigneds_increase_by() * @see f_fss_is_graph() * @see f_fss_is_space() * @see f_fss_is_zero_width() @@ -207,26 +203,22 @@ extern "C" { * F_interrupt (with error bit) if stopping due to an interrupt. * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_number_unsigneds_increase(). - * Errors (with error bit) from: f_number_unsigneds_increase_by(). + * Errors (with error bit) from: f_memory_array_increase(). * Errors (with error bit) from: f_fss_is_graph(). * Errors (with error bit) from: f_fss_is_space(). * Errors (with error bit) from: f_fss_is_zero_width(). * Errors (with error bit) from: f_fss_skip_past_delimit(). * Errors (with error bit) from: f_fss_skip_past_space(). * Errors (with error bit) from: f_string_ranges_increase(). - * Errors (with error bit) from: f_uint8s_increase(). * Errors (with error bit) from: f_utf_buffer_increment(). * - * @see f_number_unsigneds_increase() - * @see f_number_unsigneds_increase_by() + * @see f_memory_array_increase() * @see f_fss_is_graph() * @see f_fss_is_space() * @see f_fss_is_zero_width() * @see f_fss_skip_past_delimit() * @see f_fss_skip_past_space() * @see f_string_ranges_increase() - * @see f_uint8s_increase() * @see f_utf_buffer_increment() * @see fl_fss_basic_object_read() * @see fl_fss_extended_object_read() diff --git a/level_1/fl_fss/c/fss/extended_list.c b/level_1/fl_fss/c/fss/extended_list.c index aa5dc2d99..1a53a7109 100644 --- a/level_1/fl_fss/c/fss/extended_list.c +++ b/level_1/fl_fss/c/fss/extended_list.c @@ -116,7 +116,7 @@ extern "C" { if (range->start > range->stop || range->start >= buffer.used) break; if (buffer.string[range->start] == f_fss_eol_s.string[0]) { - state->status = f_number_unsigneds_increase(state->step_small, delimits); + state->status = f_memory_array_increase(state->step_small, sizeof(f_number_unsigned_t), (void **) &delimits->array, &delimits->used, &delimits->size); if (F_status_is_error(state->status)) break; delimits->array[delimits->used++] = slash_first; @@ -125,7 +125,7 @@ extern "C" { } } else if (buffer.string[range->start] == f_fss_comment_s.string[0]) { - state->status = f_number_unsigneds_increase(state->step_small, delimits); + state->status = f_memory_array_increase(state->step_small, sizeof(f_number_unsigned_t), (void **) &delimits->array, &delimits->used, &delimits->size); if (F_status_is_error(state->status)) break; delimits->array[delimits->used++] = slash_first; @@ -702,7 +702,7 @@ extern "C" { start = range->start; range->start = slash_first; - state->status = f_number_unsigneds_increase_by((slash_count / 2) + 1, delimits); + state->status = f_memory_array_increase_by((slash_count / 2) + 1, sizeof(f_number_unsigned_t), (void **) &delimits->array, &delimits->used, &delimits->size); if (F_status_is_error(state->status)) break; if (slash_count % 2 == 0) { @@ -739,7 +739,7 @@ extern "C" { graph_first = F_false; // Comments may only have white space before the '#', therefore only the first slash needs to be delimited. - state->status = f_number_unsigneds_increase(state->step_small, delimits); + state->status = f_memory_array_increase(state->step_small, sizeof(f_number_unsigned_t), (void **) &delimits->array, &delimits->used, &delimits->size); if (F_status_is_error(state->status)) break; delimits->array[delimits->used++] = slash_first; diff --git a/level_1/fl_fss/c/fss/extended_list.h b/level_1/fl_fss/c/fss/extended_list.h index f03eb811c..729ca318d 100644 --- a/level_1/fl_fss/c/fss/extended_list.h +++ b/level_1/fl_fss/c/fss/extended_list.h @@ -76,16 +76,16 @@ extern "C" { * F_interrupt (with error bit) if stopping due to an interrupt. * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_number_unsigneds_increase(). - * Errors (with error bit) from: f_number_unsigneds_increase_by(). + * Errors (with error bit) from: f_memory_array_increase(). + * Errors (with error bit) from: f_memory_array_increase_by(). * Errors (with error bit) from: f_fss_is_space(). * Errors (with error bit) from: f_fss_seek_to_eol(). * Errors (with error bit) from: f_fss_skip_past_delimit(). * Errors (with error bit) from: f_string_ranges_increase(). * Errors (with error bit) from: f_utf_buffer_increment(). * - * @see f_number_unsigneds_increase() - * @see f_number_unsigneds_increase_by() + * @see f_memory_array_increase() + * @see f_memory_array_increase_by() * @see f_fss_is_space() * @see f_fss_seek_to_eol() * @see f_fss_skip_past_delimit() @@ -206,22 +206,22 @@ extern "C" { * F_interrupt (with error bit) if stopping due to an interrupt. * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_number_unsigneds_increase_by(). * Errors (with error bit) from: f_fss_is_graph(). * Errors (with error bit) from: f_fss_is_space(). * Errors (with error bit) from: f_fss_is_zero_width(). * Errors (with error bit) from: f_fss_seek_to_eol(). * Errors (with error bit) from: f_fss_skip_past_delimit(). * Errors (with error bit) from: f_fss_skip_past_space(). + * Errors (with error bit) from: f_memory_array_increase_by(). * Errors (with error bit) from: f_utf_buffer_increment(). * - * @see f_number_unsigneds_increase_by() * @see f_fss_is_graph() * @see f_fss_is_space() * @see f_fss_is_zero_width() * @see f_fss_seek_to_eol() * @see f_fss_skip_past_delimit() * @see f_fss_skip_past_space() + * @see f_memory_array_increase_by() * @see f_utf_buffer_increment() */ #ifndef _di_fl_fss_extended_list_object_read_ diff --git a/level_1/fl_fss/c/private-fss.c b/level_1/fl_fss/c/private-fss.c index 883c278e3..2003f5488 100644 --- a/level_1/fl_fss/c/private-fss.c +++ b/level_1/fl_fss/c/private-fss.c @@ -259,7 +259,7 @@ extern "C" { // Only the first slash before a quote needs to be escaped (or not) as once there is a slash before a quote, this cannot ever be a quote object. // This simplifies the number of slashes needed. - state->status = f_number_unsigneds_increase(state->step_small, delimits); + state->status = f_memory_array_increase(state->step_small, sizeof(f_number_unsigned_t), (void **) &delimits->array, &delimits->used, &delimits->size); if (F_status_is_error(state->status)) return; delimits->array[delimits->used++] = first_slash; @@ -382,7 +382,7 @@ extern "C" { range->start = first_slash; if (slash_count % 2 == 0) { - state->status = f_number_unsigneds_increase_by(slash_count / 2, delimits); + state->status = f_memory_array_increase_by(slash_count / 2, sizeof(f_number_unsigned_t), (void **) &delimits->array, &delimits->used, &delimits->size); if (F_status_is_error(state->status)) return; while (slash_count > 0) { @@ -480,7 +480,7 @@ extern "C" { return; } - state->status = f_number_unsigneds_increase_by((slash_count / 2) + 1, delimits); + state->status = f_memory_array_increase_by((slash_count / 2) + 1, sizeof(f_number_unsigned_t), (void **) &delimits->array, &delimits->used, &delimits->size); if (F_status_is_error(state->status)) return; while (slash_count > 0) { diff --git a/level_1/fl_fss/c/private-fss.h b/level_1/fl_fss/c/private-fss.h index 7578c2e94..f82933f75 100644 --- a/level_1/fl_fss/c/private-fss.h +++ b/level_1/fl_fss/c/private-fss.h @@ -134,8 +134,8 @@ extern "C" { * F_none_eol (with error bit) after reaching an EOL, which is not supported by the standard. * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_number_unsigneds_increase(). - * Errors (with error bit) from: f_number_unsigneds_increase_by(). + * Errors (with error bit) from: f_memory_array_increase(). + * Errors (with error bit) from: f_memory_array_increase_by(). * Errors (with error bit) from: f_fss_is_graph(). * Errors (with error bit) from: f_fss_is_space(). * Errors (with error bit) from: f_fss_is_zero_width(). @@ -143,8 +143,8 @@ extern "C" { * Errors (with error bit) from: f_fss_skip_past_space(). * Errors (with error bit) from: f_utf_buffer_increment(). * - * @see f_number_unsigneds_increase() - * @see f_number_unsigneds_increase_by() + * @see f_memory_array_increase() + * @see f_memory_array_increase_by() * @see f_fss_is_graph() * @see f_fss_is_space() * @see f_fss_is_zero_width() diff --git a/level_2/fll_fss/c/fss.c b/level_2/fll_fss/c/fss.c index c1f2f0c1e..0349b6f53 100644 --- a/level_2/fll_fss/c/fss.c +++ b/level_2/fll_fss/c/fss.c @@ -111,7 +111,7 @@ extern "C" { do { if (ids && ids->used + 1 > ids->size) { - status = f_fll_ids_increase(F_fss_default_allocation_step_small_d, ids); + status = f_memory_array_increase(F_fss_default_allocation_step_small_d, sizeof(f_fll_id_t), (void **) &ids->array, &ids->used, &ids->size); } if (F_status_is_error_not(status)) { @@ -140,7 +140,7 @@ extern "C" { } if (ids) { - status = f_fll_ids_increase(F_fss_default_allocation_step_small_d, ids); + status = f_memory_array_increase(F_fss_default_allocation_step_small_d, sizeof(f_fll_id_t), (void **) &ids->array, &ids->used, &ids->size); if (F_status_is_error(status)) { if (ids) { @@ -260,7 +260,7 @@ extern "C" { if (F_status_is_error(status)) return status; if (indexs) { - status = f_number_unsigneds_increase_by(content->used, indexs[j]); + status = f_memory_array_increase_by(content->used, sizeof(f_number_unsigned_t), (void **) &indexs[j]->array, &indexs[j]->used, &indexs[j]->size); if (F_status_is_error(status)) return status; } } diff --git a/level_2/fll_fss/c/fss.h b/level_2/fll_fss/c/fss.h index 6f5a03369..0b5860b3f 100644 --- a/level_2/fll_fss/c/fss.h +++ b/level_2/fll_fss/c/fss.h @@ -64,11 +64,11 @@ extern "C" { * * F_complete_not_utf (with error bit) if character is an incomplete UTF-8 fragment. * - * Errors (with error bit) from: f_fll_ids_increase(). + * Errors (with error bit) from: f_memory_array_increase(). * Errors (with error bit) from: f_utf_is_whitespace(). * Errors (with error bit) from: f_parse_dynamic_partial_fll_identify(). * - * @see f_fll_ids_increase() + * @see f_memory_array_increase() * @see f_utf_is_whitespace() * @see f_parse_dynamic_partial_fll_identify() */ @@ -160,11 +160,13 @@ extern "C" { * * F_parameter (with error bit) if a parameter is invalid. * - * Errors (with error bit) from: f_string_dynamic_partial_append_nulless(). * Errors (with error bit) from: f_compare_dynamic_partial_trim_string(). + * Errors (with error bit) from: f_memory_array_increase_by(). + * Errors (with error bit) from: f_string_dynamic_partial_append_nulless(). * - * @see f_string_dynamic_partial_append_nulless() * @see f_compare_trim() + * @see f_memory_array_increase_by() + * @see f_string_dynamic_partial_append_nulless() */ #ifndef _di_fll_fss_snatch_apart_ extern f_status_t fll_fss_snatch_apart(const f_string_static_t buffer, const f_string_ranges_t objects, const f_string_rangess_t contents, const f_string_static_t names[], const f_number_unsigned_t size, f_string_dynamics_t * const values[], bool matches[], f_number_unsigneds_t * const indexs[]); diff --git a/level_2/fll_fss/c/fss/basic.c b/level_2/fll_fss/c/fss/basic.c index d20cababd..b70157e67 100644 --- a/level_2/fll_fss/c/fss/basic.c +++ b/level_2/fll_fss/c/fss/basic.c @@ -33,7 +33,7 @@ extern "C" { contents->array[contents->used].used = 0; if (objects_quoted) { - state->status = f_uint8s_increase(state->step_small, objects_quoted); + state->status = f_memory_array_increase(state->step_small, sizeof(uint8_t), (void **) &objects_quoted->array, &objects_quoted->used, &objects_quoted->size); if (F_status_is_error(state->status)) return; } diff --git a/level_2/fll_fss/c/fss/basic.h b/level_2/fll_fss/c/fss/basic.h index 2df31bf06..e73df0a66 100644 --- a/level_2/fll_fss/c/fss/basic.h +++ b/level_2/fll_fss/c/fss/basic.h @@ -69,15 +69,15 @@ extern "C" { * F_number_overflow (with error bit) if the maximum buffer size is reached. * F_parameter (with error bit) if a parameter is invalid. * + * Errors (with error bit) from: f_memory_array_increase(). * Errors (with error bit) from: f_string_ranges_increase(). * Errors (with error bit) from: f_string_rangess_increase(). - * Errors (with error bit) from: f_uint8s_increase(). * Errors (with error bit) from: fl_fss_basic_content_read(). * Errors (with error bit) from: fl_fss_basic_object_read(). * + * @see f_memory_array_increase() * @see f_string_ranges_increase() * @see f_string_rangess_increase() - * @see f_uint8s_increase() * @see fl_fss_basic_content_read() * @see fl_fss_basic_object_read() */ diff --git a/level_2/fll_fss/c/fss/basic_list.h b/level_2/fll_fss/c/fss/basic_list.h index 7f6fc5321..1c80c7faa 100644 --- a/level_2/fll_fss/c/fss/basic_list.h +++ b/level_2/fll_fss/c/fss/basic_list.h @@ -68,15 +68,15 @@ extern "C" { * F_number_overflow (with error bit) if the maximum buffer size is reached. * F_parameter (with error bit) if a parameter is invalid. * + * Errors (with error bit) from: f_memory_array_increase(). * Errors (with error bit) from: f_string_ranges_increase(). * Errors (with error bit) from: f_string_rangess_increase(). - * Errors (with error bit) from: f_uint8s_increase(). * Errors (with error bit) from: fl_fss_basic_list_content_read(). * Errors (with error bit) from: fl_fss_basic_list_object_read(). * + * @see f_memory_array_increase() * @see f_string_ranges_increase() * @see f_string_rangess_increase() - * @see f_uint8s_increase() * @see fl_fss_basic_list_content_read() * @see fl_fss_basic_list_object_read() */ diff --git a/level_2/fll_fss/c/fss/embedded_list.h b/level_2/fll_fss/c/fss/embedded_list.h index 0dd2cb588..001090575 100644 --- a/level_2/fll_fss/c/fss/embedded_list.h +++ b/level_2/fll_fss/c/fss/embedded_list.h @@ -68,15 +68,15 @@ extern "C" { * F_number_overflow (with error bit) if the maximum buffer size is reached. * F_parameter (with error bit) if a parameter is invalid. * + * Errors (with error bit) from: f_memory_array_increase(). * Errors (with error bit) from: f_string_ranges_increase(). * Errors (with error bit) from: f_string_rangess_increase(). - * Errors (with error bit) from: f_uint8s_increase(). * Errors (with error bit) from: fl_fss_embedded_list_content_read(). * Errors (with error bit) from: fl_fss_embedded_list_object_read(). * + * @see f_memory_array_increase() * @see f_string_ranges_increase() * @see f_string_rangess_increase() - * @see f_uint8s_increase() * @see fl_fss_embedded_list_content_read() * @see fl_fss_embedded_list_object_read() */ diff --git a/level_2/fll_fss/c/fss/extended.c b/level_2/fll_fss/c/fss/extended.c index c05848207..667078df2 100644 --- a/level_2/fll_fss/c/fss/extended.c +++ b/level_2/fll_fss/c/fss/extended.c @@ -34,12 +34,12 @@ extern "C" { contents->array[contents->used].used = 0; if (objects_quoted) { - state->status = f_uint8s_increase(state->step_small, objects_quoted); + state->status = f_memory_array_increase(state->step_small, sizeof(uint8_t), (void **) &objects_quoted->array, &objects_quoted->used, &objects_quoted->size); if (F_status_is_error(state->status)) return; } if (contents_quoted) { - state->status = f_uint8ss_increase(state->step_small, contents_quoted); + state->status = f_memory_array_increase(state->step_small, sizeof(f_uint8s_t), (void **) &contents_quoted->array, &contents_quoted->used, &contents_quoted->size); if (F_status_is_error(state->status)) return; contents_quoted->array[contents_quoted->used].used = 0; @@ -67,7 +67,7 @@ extern "C" { contents->array[contents->used++].used = 0; if (contents_quoted) { - status = f_uint8s_increase(state->step_small, &contents_quoted->array[contents_quoted->used]); + status = f_memory_array_increase(state->step_small, sizeof(uint8_t), (void **) &contents_quoted->array[contents_quoted->used].array, &contents_quoted->array[contents_quoted->used].used, &contents_quoted->array[contents_quoted->used].size); if (F_status_is_error(status)) return; contents_quoted->array[contents_quoted->used++].used = 0; @@ -96,7 +96,7 @@ extern "C" { contents->array[contents->used].used = 0; if (contents_quoted) { - state->status = f_uint8s_increase(state->step_small, &contents_quoted->array[contents_quoted->used]); + state->status = f_memory_array_increase(state->step_small, sizeof(uint8_t), (void **) &contents_quoted->array[contents_quoted->used].array, &contents_quoted->array[contents_quoted->used].used, &contents_quoted->array[contents_quoted->used].size); if (F_status_is_error(state->status)) return; quoted_content = &contents_quoted->array[contents_quoted->used]; diff --git a/level_2/fll_fss/c/fss/extended.h b/level_2/fll_fss/c/fss/extended.h index 7fb7030e3..5d0c333d9 100644 --- a/level_2/fll_fss/c/fss/extended.h +++ b/level_2/fll_fss/c/fss/extended.h @@ -72,15 +72,15 @@ extern "C" { * F_number_overflow (with error bit) if the maximum buffer size is reached. * F_parameter (with error bit) if a parameter is invalid. * + * Errors (with error bit) from: f_memory_array_increase(). * Errors (with error bit) from: f_string_ranges_increase(). * Errors (with error bit) from: f_string_rangess_increase(). - * Errors (with error bit) from: f_uint8s_increase(). * Errors (with error bit) from: fl_fss_extended_content_read(). * Errors (with error bit) from: fl_fss_extended_object_read(). * + * @see f_memory_array_increase() * @see f_string_ranges_increase() * @see f_string_rangess_increase() - * @see f_uint8s_increase() * @see fl_fss_extended_content_read() * @see fl_fss_extended_object_read() */ diff --git a/level_2/fll_fss/c/fss/extended_list.h b/level_2/fll_fss/c/fss/extended_list.h index 371b61d49..c04308bbd 100644 --- a/level_2/fll_fss/c/fss/extended_list.h +++ b/level_2/fll_fss/c/fss/extended_list.h @@ -72,15 +72,15 @@ extern "C" { * F_number_overflow (with error bit) if the maximum buffer size is reached. * F_parameter (with error bit) if a parameter is invalid. * + * Errors (with error bit) from: f_memory_array_increase(). * Errors (with error bit) from: f_string_ranges_increase(). * Errors (with error bit) from: f_string_rangess_increase(). - * Errors (with error bit) from: f_uint8s_increase(). * Errors (with error bit) from: fl_fss_extended_list_content_read(). * Errors (with error bit) from: fl_fss_extended_list_object_read(). * + * @see f_memory_array_increase() * @see f_string_ranges_increase() * @see f_string_rangess_increase() - * @see f_uint8s_increase() * @see fl_fss_extended_list_content_read() * @see fl_fss_extended_list_object_read() */ diff --git a/level_2/fll_fss/c/fss/payload.h b/level_2/fll_fss/c/fss/payload.h index cfc5cdc70..e39cc7541 100644 --- a/level_2/fll_fss/c/fss/payload.h +++ b/level_2/fll_fss/c/fss/payload.h @@ -85,15 +85,15 @@ extern "C" { * * F_number_overflow (with error bit) if the maximum buffer size is reached. * + * Errors (with error bit) from: f_memory_array_increase(). * Errors (with error bit) from: f_string_ranges_increase(). * Errors (with error bit) from: f_string_rangess_increase(). - * Errors (with error bit) from: f_uint8s_increase(). * Errors (with error bit) from: fl_fss_basic_list_content_read(). * Errors (with error bit) from: fl_fss_basic_list_object_read(). * + * @see f_memory_array_increase() * @see f_string_ranges_increase() * @see f_string_rangess_increase() - * @see f_uint8s_increase() * @see fl_fss_basic_list_content_read() * @see fl_fss_basic_list_object_read() */ diff --git a/level_3/controller/c/rule/private-rule.c b/level_3/controller/c/rule/private-rule.c index 67af86eef..dd79b8a16 100644 --- a/level_3/controller/c/rule/private-rule.c +++ b/level_3/controller/c/rule/private-rule.c @@ -3470,10 +3470,10 @@ extern "C" { } if (F_status_is_error_not(status)) { - status = f_number_unsigneds_increase(controller_common_allocation_small_d, &process->stack); + status = f_memory_array_increase(controller_common_allocation_small_d, sizeof(f_number_unsigned_t), (void **) &process->stack.array, &process->stack.used, &process->stack.size); if (F_status_is_error(status)) { - controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_number_unsigneds_increase", F_true); + controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_memory_array_increase", F_true); } else { f_thread_unlock(&process->lock); diff --git a/level_3/fake/c/main/common.c b/level_3/fake/c/main/common.c index 958453e85..578ae9e9c 100644 --- a/level_3/fake/c/main/common.c +++ b/level_3/fake/c/main/common.c @@ -443,14 +443,14 @@ extern "C" { main->setting.flag |= fake_main_flag_operation_make_e; main->setting.flag -= main->setting.flag & fake_main_flag_operation_e; - main->setting.state.status = f_uint8s_increase_by(1, &main->setting.operations); + main->setting.state.status = f_memory_array_increase_by(1, sizeof(uint8_t), (void **) &main->setting.operations.array, &main->setting.operations.used, &main->setting.operations.size); if (F_status_is_error(main->setting.state.status)) { if ((main->setting.flag & fake_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); } - fake_print_error(&main->program.error, macro_fake_f(f_uint8s_increase_by)); + fake_print_error(&main->program.error, macro_fake_f(f_memory_array_increase_by)); return; } @@ -475,10 +475,10 @@ extern "C" { if (!data->main) return; - parameter_state->state->status = f_uint8s_increase(parameter_state->state->step_small, &data->main->setting.operations); + parameter_state->state->status = f_memory_array_increase(parameter_state->state->step_small, sizeof(uint8_t), (void **) &data->main->setting.operations.array, &data->main->setting.operations.used, &data->main->setting.operations.size); if (F_status_is_error(parameter_state->state->status)) { - fake_print_error(&data->main->program.error, macro_fake_f(f_uint8s_increase)); + fake_print_error(&data->main->program.error, macro_fake_f(f_memory_array_increase)); return; } diff --git a/level_3/fake/c/main/common.h b/level_3/fake/c/main/common.h index 5933b3374..a8e8fdd36 100644 --- a/level_3/fake/c/main/common.h +++ b/level_3/fake/c/main/common.h @@ -30,19 +30,19 @@ extern "C" { * F_none on success. * * Errors (with error bit) from: f_console_parameter_process(). + * Errors (with error bit) from: f_memory_array_increase_by(). * Errors (with error bit) from: f_path_directory_cleanup(). * Errors (with error bit) from: f_string_dynamic_resize(). * Errors (with error bit) from: f_utf_is_word_dash_plus(). - * Errors (with error bit) from: f_uint8s_increase_by(). * Errors (with error bit) from: fll_program_parameter_additional_rip(). * Errors (with error bit) from: fll_program_parameter_process_context(). * Errors (with error bit) from: fll_program_parameter_process_verbosity_standard(). * * @see f_console_parameter_process() + * @see f_memory_array_increase_by() * @see f_path_directory_cleanup() * @see f_string_dynamic_resize() * @see f_utf_is_word_dash_plus() - * @see f_uint8s_increase_by() * @see fll_program_parameter_additional_rip() * @see fll_program_parameter_process_context() * @see fll_program_parameter_process_verbosity_standard() @@ -69,12 +69,13 @@ extern "C" { * F_none on success. * F_process on success, designating that processing should be performed (see f_console_parameter_process()). * - * Errors (with error bit) from: f_uint8s_increase(). + * Errors (with error bit) from: f_memory_array_increase(). + * * @param main * This must be of the type fake_main_t. * * @see f_console_parameter_process() - * @see f_uint8s_increase() + * @see f_memory_array_increase() */ #ifndef _di_fake_setting_load_parameter_callback_ extern void fake_setting_load_parameter_callback(const f_console_arguments_t arguments, void * const parameters, f_console_parameter_state_t * const parameter_state, void * const main); diff --git a/level_3/fake/c/main/common/print.c b/level_3/fake/c/main/common/print.c index cfcd165f9..1556a05a5 100644 --- a/level_3/fake/c/main/common/print.c +++ b/level_3/fake/c/main/common/print.c @@ -8,7 +8,6 @@ extern "C" { const f_string_t fake_f_a[] = { "f_account_group_id_by_name", "f_account_id_by_name", - "f_number_unsigneds_increase", "f_compare_dynamic_partial", "f_console_parameter_prioritize_right", "f_console_parameter_process", @@ -49,6 +48,8 @@ extern "C" { "f_file_write", "f_fss_apply_delimit", "f_fss_nameds_resize", + "f_memory_array_increase", + "f_memory_array_increase_by", "f_path_change", "f_path_current", "f_path_directory_cleanup", @@ -67,8 +68,6 @@ extern "C" { "f_string_dynamics_resize", "f_string_map_multis_resize", "f_thread_create", - "f_uint8s_increase", - "f_uint8s_increase_by", "f_utf_is_word_dash_plus", "fl_conversion_dynamic_to_unsigned_detect", "fl_directory_create", diff --git a/level_3/fake/c/main/common/print.h b/level_3/fake/c/main/common/print.h index 0391e798d..5b7565bdf 100644 --- a/level_3/fake/c/main/common/print.h +++ b/level_3/fake/c/main/common/print.h @@ -41,7 +41,6 @@ extern "C" { enum { fake_f_f_account_group_id_by_name_e, fake_f_f_account_id_by_name_e, - fake_f_f_number_unsigneds_increase_e, fake_f_f_compare_dynamic_partial_e, fake_f_f_console_parameter_prioritize_right_e, fake_f_f_console_parameter_process_e, @@ -82,6 +81,8 @@ extern "C" { fake_f_f_file_write_e, fake_f_f_fss_apply_delimit_e, fake_f_f_fss_nameds_resize_e, + fake_f_f_memory_array_increase_e, + fake_f_f_memory_array_increase_by_e, fake_f_f_path_change_e, fake_f_f_path_current_e, fake_f_f_path_directory_cleanup_e, @@ -100,8 +101,6 @@ extern "C" { fake_f_f_string_dynamics_resize_e, fake_f_f_string_map_multis_resize_e, fake_f_f_thread_create_e, - fake_f_f_uint8s_increase_e, - fake_f_f_uint8s_increase_by_e, fake_f_f_utf_is_word_dash_plus_e, fake_f_fl_conversion_dynamic_to_unsigned_detect_e, fake_f_fl_directory_create_e, diff --git a/level_3/fake/c/main/common/type.c b/level_3/fake/c/main/common/type.c index 786491a83..c7114c965 100644 --- a/level_3/fake/c/main/common/type.c +++ b/level_3/fake/c/main/common/type.c @@ -285,7 +285,7 @@ extern "C" { f_string_dynamics_resize(0, &setting->defines); f_string_dynamics_resize(0, &setting->modes); - f_uint8s_resize(0, &setting->operations); + f_memory_array_resize(0, sizeof(uint8_t), (void **) &setting->operations.array, &setting->operations.used, &setting->operations.size); } #endif // _di_fake_setting_delete_ diff --git a/level_3/fake/c/main/make/operate.c b/level_3/fake/c/main/make/operate.c index d31aa1c3e..90478d1ab 100644 --- a/level_3/fake/c/main/make/operate.c +++ b/level_3/fake/c/main/make/operate.c @@ -1248,10 +1248,10 @@ extern "C" { } // Add the operation id to the operation stack. - main->setting.state.status = f_number_unsigneds_increase(main->setting.state.step_small, section_stack); + main->setting.state.status = f_memory_array_increase(main->setting.state.step_small, sizeof(f_number_unsigned_t), (void **) §ion_stack->array, §ion_stack->used, §ion_stack->size); if (F_status_is_error(main->setting.state.status)) { - fake_print_error(&data_make->error, macro_fake_f(f_number_unsigneds_increase)); + fake_print_error(&data_make->error, macro_fake_f(f_memory_array_increase)); return 0; } diff --git a/level_3/fake/c/main/make/operate.h b/level_3/fake/c/main/make/operate.h index 4eab83644..7484e5bbf 100644 --- a/level_3/fake/c/main/make/operate.h +++ b/level_3/fake/c/main/make/operate.h @@ -206,7 +206,7 @@ extern "C" { * F_recurse (with error bit) is returned if unable to recurse to another operation section (usually max stack depth reached). * F_valid_not (with error bit) is returned if any part of the section is invalid, such as an invalid operation name. * - * Errors (with error bit) from: f_number_unsigneds_increase() + * Errors (with error bit) from: f_memory_array_increase() * * Errors (with error bit) from: fake_make_operate_block_postprocess() * Errors (with error bit) from: fake_make_operate_block_prepare() @@ -222,8 +222,7 @@ extern "C" { * The return code of the execution process. * This generally is only needed when F_child is returned, where this holds the return status of the child process. * - * @see f_number_unsigneds_increase() - * @see fll_program_print_signal_received() + * @see f_memory_array_increase() * * @see fake_make_operate_block_postprocess() * @see fake_make_operate_block_prepare() diff --git a/level_3/firewall/c/private-firewall.c b/level_3/firewall/c/private-firewall.c index 50245f4a5..54afad55f 100644 --- a/level_3/firewall/c/private-firewall.c +++ b/level_3/firewall/c/private-firewall.c @@ -800,7 +800,7 @@ f_status_t firewall_create_custom_chains(firewall_data_t * const data, firewall_ status = f_string_dynamics_resize(2, &arguments); if (F_status_is_error(status)) return status; - status = f_number_unsigneds_increase_by(local->chain_objects.used, &local->chain_ids); + status = f_memory_array_increase_by(local->chain_objects.used, sizeof(f_number_unsigned_t), (void **) &local->chain_ids.array, &local->chain_ids.used, &local->chain_ids.size); if (F_status_is_error(status)) return status; memset(local->chain_ids.array, 0, sizeof(f_number_unsigned_t) * local->chain_ids.used); diff --git a/level_3/fss_identify/c/main/common/type.c b/level_3/fss_identify/c/main/common/type.c index 940fd778e..e7647d890 100644 --- a/level_3/fss_identify/c/main/common/type.c +++ b/level_3/fss_identify/c/main/common/type.c @@ -21,7 +21,7 @@ extern "C" { f_string_dynamic_resize(0, &setting->buffer); - f_fll_ids_resize(0, &setting->ids); + f_memory_array_resize(0, sizeof(f_fll_id_t), (void **) &setting->ids.array, &setting->ids.used, &setting->ids.size); f_string_dynamics_resize(0, &setting->names); f_string_dynamics_resize(0, &setting->files); diff --git a/level_3/fss_read/c/main/common.c b/level_3/fss_read/c/main/common.c index c593ff5e1..3bc5669c5 100644 --- a/level_3/fss_read/c/main/common.c +++ b/level_3/fss_read/c/main/common.c @@ -11,7 +11,7 @@ extern "C" { f_number_unsigned_t j = 0; if (main->setting.quotes_object.used < main->setting.objects.used) { - main->setting.state.status = f_uint8s_resize(main->setting.objects.used, &main->setting.quotes_object); + main->setting.state.status = f_memory_array_resize(main->setting.objects.used, sizeof(uint8_t), (void **) &main->setting.quotes_object.array, &main->setting.quotes_object.used, &main->setting.quotes_object.size); if (F_status_is_error(main->setting.state.status)) return; for (i = main->setting.quotes_object.used; i < main->setting.objects.used; ++i) { @@ -20,12 +20,12 @@ extern "C" { } if (main->setting.quotes_content.used < main->setting.contents.used) { - main->setting.state.status = f_uint8ss_resize(main->setting.contents.used, &main->setting.quotes_content); + f_memory_arrays_resize(main->setting.contents.used, sizeof(f_uint8s_t), (void **) &main->setting.quotes_content.array, &main->setting.quotes_content.used, &main->setting.quotes_content.size, &f_uint8s_resize_callback); if (F_status_is_error(main->setting.state.status)) return; for (i = main->setting.quotes_content.used; i < main->setting.contents.used; ++i) { - main->setting.state.status = f_uint8s_resize(main->setting.contents.array[i].used, &main->setting.quotes_content.array[i]); + main->setting.state.status = f_memory_array_resize(main->setting.contents.array[i].used, sizeof(uint8_t), (void **) &main->setting.quotes_content.array[i].array, &main->setting.quotes_content.array[i].used, &main->setting.quotes_content.array[i].size); if (F_status_is_error(main->setting.state.status)) return; main->setting.quotes_content.array[i].used = 0; diff --git a/level_3/fss_read/c/main/common.h b/level_3/fss_read/c/main/common.h index ce47ccf01..16216d16b 100644 --- a/level_3/fss_read/c/main/common.h +++ b/level_3/fss_read/c/main/common.h @@ -25,11 +25,11 @@ extern "C" { * This alters main.setting.state.status: * F_none on success. * - * Errors (with error bit) from: f_uint8s_resize(). - * Errors (with error bit) from: f_uint8ss_resize(). + * Errors (with error bit) from: f_memory_array_resize(). + * Errors (with error bit) from: f_memory_arrays_resize(). * - * @see f_uint8s_resize() - * @see f_uint8ss_resize() + * @see f_memory_array_resize() + * @see f_memory_arrays_resize() */ #ifndef _di_fss_read_ensure_quotes_length_ extern void fss_read_ensure_quotes_length(fss_read_main_t * const main); diff --git a/level_3/fss_read/c/main/common/type.c b/level_3/fss_read/c/main/common/type.c index 6f25ac586..fbe4cea33 100644 --- a/level_3/fss_read/c/main/common/type.c +++ b/level_3/fss_read/c/main/common/type.c @@ -86,8 +86,8 @@ extern "C" { f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &setting->delimits_object.array, &setting->delimits_object.used, &setting->delimits_object.size); f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &setting->delimits_content.array, &setting->delimits_content.used, &setting->delimits_content.size); - f_uint8s_resize(0, &setting->quotes_object); - f_uint8ss_resize(0, &setting->quotes_content); + f_memory_array_resize(0, sizeof(uint8_t), (void **) &setting->quotes_object.array, &setting->quotes_object.used, &setting->quotes_object.size); + f_memory_arrays_resize(0, sizeof(f_uint8s_t), (void **) &setting->quotes_content.array, &setting->quotes_content.used, &setting->quotes_content.size, &f_uint8s_resize_callback); return F_none; }