From: Kevin Day Date: Sun, 15 May 2022 03:19:50 +0000 (-0500) Subject: Update: Unit tests, fixing minor mistakes and add missing tests. X-Git-Tag: 0.5.10~130 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=49bb2808541652d999172af6bf63654a3bd859bd;p=fll Update: Unit tests, fixing minor mistakes and add missing tests. While these tests are not expected to be thorough at this time, there are several checks that should still be and can easily be made. Some of the test files have incorrect comments. Order test functions alphabetically. --- diff --git a/level_0/f_limit/tests/unit/c/test-limit-sets_append_all.h b/level_0/f_limit/tests/unit/c/test-limit-sets_append_all.h index dcf55a5..6371ff7 100644 --- a/level_0/f_limit/tests/unit/c/test-limit-sets_append_all.h +++ b/level_0/f_limit/tests/unit/c/test-limit-sets_append_all.h @@ -18,7 +18,7 @@ extern void test__f_limit_sets_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * * @see f_limit_sets_append_all() */ diff --git a/level_0/f_limit/tests/unit/c/test-limit-sets_increase.h b/level_0/f_limit/tests/unit/c/test-limit-sets_increase.h index 8d90cb2..96387ff 100644 --- a/level_0/f_limit/tests/unit/c/test-limit-sets_increase.h +++ b/level_0/f_limit/tests/unit/c/test-limit-sets_increase.h @@ -18,7 +18,7 @@ extern void test__f_limit_sets_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * * @see f_limit_sets_increase() */ diff --git a/level_0/f_limit/tests/unit/c/test-limit-setss_append.h b/level_0/f_limit/tests/unit/c/test-limit-setss_append.h index a113b17..a29fed8 100644 --- a/level_0/f_limit/tests/unit/c/test-limit-setss_append.h +++ b/level_0/f_limit/tests/unit/c/test-limit-setss_append.h @@ -18,7 +18,7 @@ extern void test__f_limit_setss_append__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * * @see f_limit_setss_append() */ diff --git a/level_0/f_limit/tests/unit/c/test-limit-setss_append_all.h b/level_0/f_limit/tests/unit/c/test-limit-setss_append_all.h index 575e9fe..696e35e 100644 --- a/level_0/f_limit/tests/unit/c/test-limit-setss_append_all.h +++ b/level_0/f_limit/tests/unit/c/test-limit-setss_append_all.h @@ -18,7 +18,7 @@ extern void test__f_limit_setss_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * * @see f_limit_setss_append_all() */ diff --git a/level_0/f_limit/tests/unit/c/test-limit-setss_decimate_by.h b/level_0/f_limit/tests/unit/c/test-limit-setss_decimate_by.h index 62e46e4..265644c 100644 --- a/level_0/f_limit/tests/unit/c/test-limit-setss_decimate_by.h +++ b/level_0/f_limit/tests/unit/c/test-limit-setss_decimate_by.h @@ -18,7 +18,7 @@ extern void test__f_limit_setss_decimate_by__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * * @see f_limit_setss_decimate_by() */ diff --git a/level_0/f_limit/tests/unit/c/test-limit-setss_decrease_by.h b/level_0/f_limit/tests/unit/c/test-limit-setss_decrease_by.h index 52266c5..3098948 100644 --- a/level_0/f_limit/tests/unit/c/test-limit-setss_decrease_by.h +++ b/level_0/f_limit/tests/unit/c/test-limit-setss_decrease_by.h @@ -18,7 +18,7 @@ extern void test__f_limit_setss_decrease_by__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * * @see f_limit_setss_decrease_by() */ diff --git a/level_0/f_limit/tests/unit/c/test-limit-setss_increase.h b/level_0/f_limit/tests/unit/c/test-limit-setss_increase.h index a4ba142..121d271 100644 --- a/level_0/f_limit/tests/unit/c/test-limit-setss_increase.h +++ b/level_0/f_limit/tests/unit/c/test-limit-setss_increase.h @@ -18,7 +18,7 @@ extern void test__f_limit_setss_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * * @see f_limit_setss_increase() */ diff --git a/level_0/f_limit/tests/unit/c/test-limit-setss_increase_by.h b/level_0/f_limit/tests/unit/c/test-limit-setss_increase_by.h index 06f3612..320fa11 100644 --- a/level_0/f_limit/tests/unit/c/test-limit-setss_increase_by.h +++ b/level_0/f_limit/tests/unit/c/test-limit-setss_increase_by.h @@ -18,7 +18,7 @@ extern void test__f_limit_setss_increase_by__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * * @see f_limit_setss_increase_by() */ diff --git a/level_0/f_limit/tests/unit/c/test-limit-values_append_all.h b/level_0/f_limit/tests/unit/c/test-limit-values_append_all.h index 0dd4ba6..a9e5942 100644 --- a/level_0/f_limit/tests/unit/c/test-limit-values_append_all.h +++ b/level_0/f_limit/tests/unit/c/test-limit-values_append_all.h @@ -18,7 +18,7 @@ extern void test__f_limit_values_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * * @see f_limit_values_append_all() */ diff --git a/level_0/f_limit/tests/unit/c/test-limit-values_increase.h b/level_0/f_limit/tests/unit/c/test-limit-values_increase.h index bbe0450..fd7a1f1 100644 --- a/level_0/f_limit/tests/unit/c/test-limit-values_increase.h +++ b/level_0/f_limit/tests/unit/c/test-limit-values_increase.h @@ -18,7 +18,7 @@ extern void test__f_limit_values_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * * @see f_limit_values_increase() */ diff --git a/level_0/f_limit/tests/unit/c/test-limit-valuess_append.h b/level_0/f_limit/tests/unit/c/test-limit-valuess_append.h index 611e95f..da69f38 100644 --- a/level_0/f_limit/tests/unit/c/test-limit-valuess_append.h +++ b/level_0/f_limit/tests/unit/c/test-limit-valuess_append.h @@ -18,7 +18,7 @@ extern void test__f_limit_valuess_append__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * * @see f_limit_valuess_append() */ diff --git a/level_0/f_limit/tests/unit/c/test-limit-valuess_append_all.h b/level_0/f_limit/tests/unit/c/test-limit-valuess_append_all.h index c80dcbc..1bd9b93 100644 --- a/level_0/f_limit/tests/unit/c/test-limit-valuess_append_all.h +++ b/level_0/f_limit/tests/unit/c/test-limit-valuess_append_all.h @@ -18,7 +18,7 @@ extern void test__f_limit_valuess_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * * @see f_limit_valuess_append_all() */ diff --git a/level_0/f_limit/tests/unit/c/test-limit-valuess_decimate_by.h b/level_0/f_limit/tests/unit/c/test-limit-valuess_decimate_by.h index c6cd257..fe73544 100644 --- a/level_0/f_limit/tests/unit/c/test-limit-valuess_decimate_by.h +++ b/level_0/f_limit/tests/unit/c/test-limit-valuess_decimate_by.h @@ -18,7 +18,7 @@ extern void test__f_limit_valuess_decimate_by__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * * @see f_limit_valuess_decimate_by() */ diff --git a/level_0/f_limit/tests/unit/c/test-limit-valuess_decrease_by.h b/level_0/f_limit/tests/unit/c/test-limit-valuess_decrease_by.h index 3592fc3..e969828 100644 --- a/level_0/f_limit/tests/unit/c/test-limit-valuess_decrease_by.h +++ b/level_0/f_limit/tests/unit/c/test-limit-valuess_decrease_by.h @@ -18,7 +18,7 @@ extern void test__f_limit_valuess_decrease_by__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * * @see f_limit_valuess_decrease_by() */ diff --git a/level_0/f_limit/tests/unit/c/test-limit-valuess_increase.h b/level_0/f_limit/tests/unit/c/test-limit-valuess_increase.h index acf0d69..7d58fdd 100644 --- a/level_0/f_limit/tests/unit/c/test-limit-valuess_increase.h +++ b/level_0/f_limit/tests/unit/c/test-limit-valuess_increase.h @@ -18,7 +18,7 @@ extern void test__f_limit_valuess_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * * @see f_limit_valuess_increase() */ diff --git a/level_0/f_limit/tests/unit/c/test-limit-valuess_increase_by.h b/level_0/f_limit/tests/unit/c/test-limit-valuess_increase_by.h index 8819fd8..11c2f71 100644 --- a/level_0/f_limit/tests/unit/c/test-limit-valuess_increase_by.h +++ b/level_0/f_limit/tests/unit/c/test-limit-valuess_increase_by.h @@ -18,7 +18,7 @@ extern void test__f_limit_valuess_increase_by__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * * @see f_limit_valuess_increase_by() */ diff --git a/level_0/f_path/tests/unit/c/test-path-current.h b/level_0/f_path/tests/unit/c/test-path-current.h index 0f3acb8..a9ff7d3 100644 --- a/level_0/f_path/tests/unit/c/test-path-current.h +++ b/level_0/f_path/tests/unit/c/test-path-current.h @@ -11,6 +11,13 @@ #define _TEST__F_path_current_h /** + * Test that function fails. + * + * @see f_path_current() + */ +extern void test__f_path_current__fails(void **state); + +/** * Test that parameter checking works as expected. * * @see f_path_current() @@ -19,4 +26,11 @@ extern void test__f_path_current__parameter_checking(void **state); #endif // _di_level_0_parameter_checking_ +/** + * Test that function works. + * + * @see f_path_current() + */ +extern void test__f_path_current__works(void **state); + #endif // _TEST__F_path_current_h diff --git a/level_0/f_pipe/tests/unit/c/mock-pipe.h b/level_0/f_pipe/tests/unit/c/mock-pipe.h index f6b44fe..2b42a61 100644 --- a/level_0/f_pipe/tests/unit/c/mock-pipe.h +++ b/level_0/f_pipe/tests/unit/c/mock-pipe.h @@ -1,7 +1,7 @@ /** * FLL - Level 0 * - * Project: Path + * Project: Pipe * API Version: 0.5 * Licenses: lgpl-2.1-or-later * diff --git a/level_0/f_pipe/tests/unit/c/test-pipe.h b/level_0/f_pipe/tests/unit/c/test-pipe.h index 1d0e9d6..ee9bb51 100644 --- a/level_0/f_pipe/tests/unit/c/test-pipe.h +++ b/level_0/f_pipe/tests/unit/c/test-pipe.h @@ -1,7 +1,7 @@ /** * FLL - Level 0 * - * Project: IKI + * Project: Pipe * API Version: 0.5 * Licenses: lgpl-2.1-or-later * diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_adjust.c index d58020d..d2fdf68 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_adjust.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_adjust.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_array_lengths_adjust__works(void **state) { +void test__f_type_array_array_lengths_adjust__parameter_checking(void **state) { const int length = 5; f_array_lengths_t data = f_array_lengths_t_initialize; { - const f_status_t status = f_array_lengths_adjust(length, &data); + const f_status_t status = f_array_lengths_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_array_lengths_adjust__parameter_checking(void **state) { +void test__f_type_array_array_lengths_adjust__works(void **state) { const int length = 5; f_array_lengths_t data = f_array_lengths_t_initialize; { - const f_status_t status = f_array_lengths_adjust(length, 0); + const f_status_t status = f_array_lengths_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_adjust.h index f59c7d3..c9330bd 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_adjust.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_adjust.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__array_lengths_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_array_lengths_adjust() + * @see f_array_lengths_adjust() */ -extern void test__f_type_array_array_lengths_adjust__works(void **state); +extern void test__f_type_array_array_lengths_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_array_lengths_adjust() + * @see f_array_lengths_adjust() */ -extern void test__f_type_array_array_lengths_adjust__parameter_checking(void **state); +extern void test__f_type_array_array_lengths_adjust__works(void **state); #endif // _TEST__F_type_array__array_lengths_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_append.c index 8e63f94..b3bf49cf 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_append.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_append.c @@ -5,6 +5,17 @@ extern "C" { #endif +void test__f_type_array_array_lengths_append__parameter_checking(void **state) { + + const f_array_length_t data = f_array_length_t_initialize; + + { + const f_status_t status = f_array_lengths_append(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + void test__f_type_array_array_lengths_append__works(void **state) { const f_array_length_t source = 3; @@ -21,17 +32,6 @@ void test__f_type_array_array_lengths_append__works(void **state) { free((void *) destination.array); } -void test__f_type_array_array_lengths_append__parameter_checking(void **state) { - - const f_array_length_t data = f_array_length_t_initialize; - - { - const f_status_t status = f_array_lengths_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_append.h index de1290c..33369c0 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_append.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_append.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__array_lengths_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_array_lengths_append() + * @see f_array_lengths_append() */ -extern void test__f_type_array_array_lengths_append__works(void **state); +extern void test__f_type_array_array_lengths_append__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_array_lengths_append() + * @see f_array_lengths_append() */ -extern void test__f_type_array_array_lengths_append__parameter_checking(void **state); +extern void test__f_type_array_array_lengths_append__works(void **state); #endif // _TEST__F_type_array__array_lengths_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_append_all.c index 144a80d..fae08df 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_append_all.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_append_all.c @@ -5,10 +5,20 @@ extern "C" { #endif -void test__f_type_array_array_lengths_append_all__works(void **state) { +void test__f_type_array_array_lengths_append_all__parameter_checking(void **state) { + + const f_array_lengths_t data = f_array_lengths_t_initialize; + + { + const f_status_t status = f_array_lengths_append_all(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +void test__f_type_array_array_lengths_append_all__returns_data_not(void **state) { const int length = 5; - const int length_used = 2; f_array_lengths_t source = f_array_lengths_t_initialize; f_array_lengths_t destination = f_array_lengths_t_initialize; @@ -20,29 +30,22 @@ void test__f_type_array_array_lengths_append_all__works(void **state) { 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_array_lengths_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_array_length_t i = 0; i < source.used; ++i) { - assert_int_equal(destination.array[i], i + 1); - } // for + 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); - free((void *) destination.array); } -void test__f_type_array_array_lengths_append_all__returns_data_not(void **state) { +void test__f_type_array_array_lengths_append_all__works(void **state) { const int length = 5; + const int length_used = 2; f_array_lengths_t source = f_array_lengths_t_initialize; f_array_lengths_t destination = f_array_lengths_t_initialize; @@ -54,27 +57,24 @@ void test__f_type_array_array_lengths_append_all__returns_data_not(void **state) 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_array_lengths_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); + assert_int_equal(status, F_none); + assert_int_equal(destination.used, source.used); + assert_int_equal(destination.size, source.used); + + for (f_array_length_t i = 0; i < source.used; ++i) { + assert_int_equal(destination.array[i], i + 1); + } // for } free((void *) source.array); -} - -void test__f_type_array_array_lengths_append_all__parameter_checking(void **state) { - - const f_array_lengths_t data = f_array_lengths_t_initialize; - - { - const f_status_t status = f_array_lengths_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } + free((void *) destination.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_append_all.h index 0cf641b..8b128fd 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_append_all.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_append_all.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__array_lengths_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_array_lengths_append_all() + * @see f_array_lengths_append_all() */ -extern void test__f_type_array_array_lengths_append_all__works(void **state); +extern void test__f_type_array_array_lengths_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_array_lengths_append_all() + * @see f_array_lengths_append_all() */ extern void test__f_type_array_array_lengths_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_array_lengths_append_all() + * @see f_array_lengths_append_all() */ -extern void test__f_type_array_array_lengths_append_all__parameter_checking(void **state); +extern void test__f_type_array_array_lengths_append_all__works(void **state); #endif // _TEST__F_type_array__array_lengths_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_decimate_by.c index 5150b8f..1472bbe 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_decimate_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_decimate_by.c @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_array_lengths_decimate_by__works(void **state) { +void test__f_type_array_array_lengths_decimate_by__parameter_checking(void **state) { const int length = 5; f_array_lengths_t data = f_array_lengths_t_initialize; { - const f_status_t status = f_array_lengths_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_array_lengths_decimate_by(length, &data); + const f_status_t status = f_array_lengths_decimate_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_array_lengths_decimate_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_array_lengths_decimate_by__parameter_checking(void **state) { +void test__f_type_array_array_lengths_decimate_by__works(void **state) { const int length = 5; f_array_lengths_t data = f_array_lengths_t_initialize; { - const f_status_t status = f_array_lengths_decimate_by(length, 0); + const f_status_t status = f_array_lengths_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_array_lengths_decimate_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_decimate_by.h index 84d569f..7816c60 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_decimate_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_decimate_by.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__array_lengths_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_array_lengths_decimate_by() + * @see f_array_lengths_decimate_by() */ -extern void test__f_type_array_array_lengths_decimate_by__works(void **state); +extern void test__f_type_array_array_lengths_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_array_lengths_decimate_by() + * @see f_array_lengths_decimate_by() */ -extern void test__f_type_array_array_lengths_decimate_by__parameter_checking(void **state); +extern void test__f_type_array_array_lengths_decimate_by__works(void **state); #endif // _TEST__F_type_array__array_lengths_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_decrease_by.c index 92f4366..0ea8d05 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_decrease_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_decrease_by.c @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_array_lengths_decrease_by__works(void **state) { +void test__f_type_array_array_lengths_decrease_by__parameter_checking(void **state) { const int length = 5; f_array_lengths_t data = f_array_lengths_t_initialize; { - const f_status_t status = f_array_lengths_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_array_lengths_decrease_by(length, &data); + const f_status_t status = f_array_lengths_decrease_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_array_lengths_decrease_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_array_lengths_decrease_by__parameter_checking(void **state) { +void test__f_type_array_array_lengths_decrease_by__works(void **state) { const int length = 5; f_array_lengths_t data = f_array_lengths_t_initialize; { - const f_status_t status = f_array_lengths_decrease_by(length, 0); + const f_status_t status = f_array_lengths_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_array_lengths_decrease_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_decrease_by.h index 131b6d9..cb533dd 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_decrease_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_decrease_by.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__array_lengths_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_array_lengths_decrease_by() + * @see f_array_lengths_decrease_by() */ -extern void test__f_type_array_array_lengths_decrease_by__works(void **state); +extern void test__f_type_array_array_lengths_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_array_lengths_decrease_by() + * @see f_array_lengths_decrease_by() */ -extern void test__f_type_array_array_lengths_decrease_by__parameter_checking(void **state); +extern void test__f_type_array_array_lengths_decrease_by__works(void **state); #endif // _TEST__F_type_array__array_lengths_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_increase.c index 5b88f60..02f2385 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_increase.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_increase.c @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_array_lengths_increase__works(void **state) { +void test__f_type_array_array_lengths_increase__parameter_checking(void **state) { const int length = 5; f_array_lengths_t data = f_array_lengths_t_initialize; { - const f_status_t status = f_array_lengths_resize(length, &data); + const f_status_t status = f_array_lengths_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_array_lengths_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); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -55,17 +45,27 @@ void test__f_type_array_array_lengths_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_array_lengths_increase__parameter_checking(void **state) { +void test__f_type_array_array_lengths_increase__works(void **state) { const int length = 5; f_array_lengths_t data = f_array_lengths_t_initialize; { - const f_status_t status = f_array_lengths_increase(length, 0); + const f_status_t status = f_array_lengths_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_array_lengths_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); diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_increase.h index bf89633..667f977 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_increase.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_increase.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__array_lengths_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_array_lengths_increase() + * @see f_array_lengths_increase() */ -extern void test__f_type_array_array_lengths_increase__works(void **state); +extern void test__f_type_array_array_lengths_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_array_lengths_increase() + * @see f_array_lengths_increase() */ extern void test__f_type_array_array_lengths_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_array_lengths_increase() + * @see f_array_lengths_increase() */ -extern void test__f_type_array_array_lengths_increase__parameter_checking(void **state); +extern void test__f_type_array_array_lengths_increase__works(void **state); #endif // _TEST__F_type_array__array_lengths_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_increase_by.c index bb83dce..6ffff45 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_increase_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_increase_by.c @@ -5,6 +5,22 @@ extern "C" { #endif +void test__f_type_array_array_lengths_increase_by__parameter_checking(void **state) { + + const int length = 5; + f_array_lengths_t data = f_array_lengths_t_initialize; + + { + const f_status_t status = f_array_lengths_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_array_lengths_increase_by__works(void **state) { const int length = 5; @@ -31,22 +47,6 @@ void test__f_type_array_array_lengths_increase_by__works(void **state) { free((void *) data.array); } -void test__f_type_array_array_lengths_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_array_lengths_t data = f_array_lengths_t_initialize; - - { - const f_status_t status = f_array_lengths_increase_by(length, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_increase_by.h index 820cfa3..9f9daaf 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_increase_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_increase_by.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__array_lengths_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_array_lengths_increase_by() + * @see f_array_lengths_increase_by() */ -extern void test__f_type_array_array_lengths_increase_by__works(void **state); +extern void test__f_type_array_array_lengths_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_array_lengths_increase_by() + * @see f_array_lengths_increase_by() */ -extern void test__f_type_array_array_lengths_increase_by__parameter_checking(void **state); +extern void test__f_type_array_array_lengths_increase_by__works(void **state); #endif // _TEST__F_type_array__array_lengths_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_resize.c index 1c655c4..37232c2 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_resize.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_resize.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_array_lengths_resize__works(void **state) { +void test__f_type_array_array_lengths_resize__parameter_checking(void **state) { const int length = 5; f_array_lengths_t data = f_array_lengths_t_initialize; { - const f_status_t status = f_array_lengths_resize(length, &data); + const f_status_t status = f_array_lengths_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_array_lengths_resize__parameter_checking(void **state) { +void test__f_type_array_array_lengths_resize__works(void **state) { const int length = 5; f_array_lengths_t data = f_array_lengths_t_initialize; { - const f_status_t status = f_array_lengths_resize(length, 0); + const f_status_t status = f_array_lengths_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_resize.h index 648b40f..51453f3 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_resize.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_resize.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__array_lengths_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_array_lengths_resize() + * @see f_array_lengths_resize() */ -extern void test__f_type_array_array_lengths_resize__works(void **state); +extern void test__f_type_array_array_lengths_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_array_lengths_resize() + * @see f_array_lengths_resize() */ -extern void test__f_type_array_array_lengths_resize__parameter_checking(void **state); +extern void test__f_type_array_array_lengths_resize__works(void **state); #endif // _TEST__F_type_array__array_lengths_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_adjust.c index a691c7e..3b1733b 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_adjust.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_adjust.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_array_lengthss_adjust__works(void **state) { +void test__f_type_array_array_lengthss_adjust__parameter_checking(void **state) { const int length = 5; f_array_lengthss_t data = f_array_lengthss_t_initialize; { - const f_status_t status = f_array_lengthss_adjust(length, &data); + const f_status_t status = f_array_lengthss_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_array_lengthss_adjust__parameter_checking(void **state) { +void test__f_type_array_array_lengthss_adjust__works(void **state) { const int length = 5; f_array_lengthss_t data = f_array_lengthss_t_initialize; { - const f_status_t status = f_array_lengthss_adjust(length, 0); + const f_status_t status = f_array_lengthss_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_adjust.h index 49ac75a..306ba24 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_adjust.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_adjust.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__array_lengthss_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_array_lengthss_adjust() + * @see f_array_lengthss_adjust() */ -extern void test__f_type_array_array_lengthss_adjust__works(void **state); +extern void test__f_type_array_array_lengthss_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_array_lengthss_adjust() + * @see f_array_lengthss_adjust() */ -extern void test__f_type_array_array_lengthss_adjust__parameter_checking(void **state); +extern void test__f_type_array_array_lengthss_adjust__works(void **state); #endif // _TEST__F_type_array__array_lengthss_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_append.c index 5235bc1..d3cf215 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_append.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_append.c @@ -5,7 +5,18 @@ extern "C" { #endif -void test__f_type_array_array_lengthss_append__works(void **state) { +void test__f_type_array_array_lengthss_append__parameter_checking(void **state) { + + const f_array_lengths_t data = f_array_lengths_t_initialize; + + { + const f_status_t status = f_array_lengthss_append(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +void test__f_type_array_array_lengthss_append__returns_data_not(void **state) { const int length = 5; f_array_lengths_t source = f_array_lengths_t_initialize; @@ -19,32 +30,19 @@ void test__f_type_array_array_lengthss_append__works(void **state) { 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_array_lengthss_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_array_length_t i = 0; i < destination.array[0].used; ++i) { - assert_int_equal(destination.array[0].array[i], i + 1); - } // for + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + assert_null(destination.array); } - for (f_array_length_t i = 0; i < destination.used; ++i) { - free((void *) destination.array[i].array); - } // for - free((void *) source.array); - free((void *) destination.array); } -void test__f_type_array_array_lengthss_append__returns_data_not(void **state) { +void test__f_type_array_array_lengthss_append__works(void **state) { const int length = 5; f_array_lengths_t source = f_array_lengths_t_initialize; @@ -58,27 +56,29 @@ void test__f_type_array_array_lengthss_append__returns_data_not(void **state) { 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_array_lengthss_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_array_lengthss_append__parameter_checking(void **state) { + 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); - const f_array_lengths_t data = f_array_lengths_t_initialize; + for (f_array_length_t i = 0; i < destination.array[0].used; ++i) { + assert_int_equal(destination.array[0].array[i], i + 1); + } // for + } - { - const f_status_t status = f_array_lengthss_append(data, 0); + for (f_array_length_t i = 0; i < destination.used; ++i) { + free((void *) destination.array[i].array); + } // for - assert_int_equal(status, F_status_set_error(F_parameter)); - } + free((void *) source.array); + free((void *) destination.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_append.h index 26855d6..b562cb3 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_append.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_append.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__array_lengthss_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_array_lengthss_append() + * @see f_array_lengthss_append() */ -extern void test__f_type_array_array_lengthss_append__works(void **state); +extern void test__f_type_array_array_lengthss_append__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_array_lengthss_append() + * @see f_array_lengthss_append() */ extern void test__f_type_array_array_lengthss_append__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_array_lengthss_append() + * @see f_array_lengthss_append() */ -extern void test__f_type_array_array_lengthss_append__parameter_checking(void **state); +extern void test__f_type_array_array_lengthss_append__works(void **state); #endif // _TEST__F_type_array__array_lengthss_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_append_all.c index 213257b..08e089d 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_append_all.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_append_all.c @@ -5,6 +5,43 @@ extern "C" { #endif +void test__f_type_array_array_lengthss_append_all__parameter_checking(void **state) { + + const f_array_lengthss_t data = f_array_lengthss_t_initialize; + + { + const f_status_t status = f_array_lengthss_append_all(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +void test__f_type_array_array_lengthss_append_all__returns_data_not(void **state) { + + const int length = 5; + f_array_lengthss_t source = f_array_lengthss_t_initialize; + f_array_lengthss_t destination = f_array_lengthss_t_initialize; + + { + const f_status_t status = f_array_lengthss_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_array_lengthss_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_array_lengthss_append_all__works(void **state) { const int length = 5; @@ -63,43 +100,6 @@ void test__f_type_array_array_lengthss_append_all__works(void **state) { free((void *) destination.array); } -void test__f_type_array_array_lengthss_append_all__returns_data_not(void **state) { - - const int length = 5; - f_array_lengthss_t source = f_array_lengthss_t_initialize; - f_array_lengthss_t destination = f_array_lengthss_t_initialize; - - { - const f_status_t status = f_array_lengthss_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_array_lengthss_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_array_lengthss_append_all__parameter_checking(void **state) { - - const f_array_lengthss_t data = f_array_lengthss_t_initialize; - - { - const f_status_t status = f_array_lengthss_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_append_all.h index 497d99c..2224113 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_append_all.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_append_all.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__array_lengthss_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_array_lengthss_append_all() + * @see f_array_lengthss_append_all() */ -extern void test__f_type_array_array_lengthss_append_all__works(void **state); +extern void test__f_type_array_array_lengthss_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_array_lengthss_append_all() + * @see f_array_lengthss_append_all() */ extern void test__f_type_array_array_lengthss_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_array_lengthss_append_all() + * @see f_array_lengthss_append_all() */ -extern void test__f_type_array_array_lengthss_append_all__parameter_checking(void **state); +extern void test__f_type_array_array_lengthss_append_all__works(void **state); #endif // _TEST__F_type_array__array_lengthss_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_decimate_by.c index 911307f..b98d6f6 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_decimate_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_decimate_by.c @@ -5,12 +5,28 @@ extern "C" { #endif -void test__f_type_array_array_lengthss_decimate_by__works(void **state) { +void test__f_type_array_array_lengthss_decimate_by__parameter_checking(void **state) { const int length = 5; f_array_lengthss_t data = f_array_lengths_t_initialize; { + const f_status_t status = f_array_lengthss_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_array_lengthss_decimate_by__returns_data_not(void **state) { + + const int length = 5; + f_array_lengthss_t data = f_array_lengthss_t_initialize; + + { const f_status_t status = f_array_lengthss_resize(length, &data); assert_int_equal(status, F_none); @@ -19,25 +35,33 @@ void test__f_type_array_array_lengthss_decimate_by__works(void **state) { } { - const f_status_t status = f_array_lengthss_decimate_by(length, &data); + const f_status_t status = f_array_lengthss_decimate_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_array_lengthss_decimate_by__parameter_checking(void **state) { +void test__f_type_array_array_lengthss_decimate_by__works(void **state) { const int length = 5; f_array_lengthss_t data = f_array_lengths_t_initialize; { - const f_status_t status = f_array_lengthss_decimate_by(length, 0); + const f_status_t status = f_array_lengthss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_array_lengthss_decimate_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_decimate_by.h index b424803..fd3dc6e 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_decimate_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_decimate_by.h @@ -11,17 +11,24 @@ #define _TEST__F_type_array__array_lengthss_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_array_lengthss_decimate_by() + * @see f_array_lengthss_decimate_by() */ -extern void test__f_type_array_array_lengthss_decimate_by__works(void **state); +extern void test__f_type_array_array_lengthss_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * * @see f_type_array_array_lengthss_decimate_by() */ -extern void test__f_type_array_array_lengthss_decimate_by__parameter_checking(void **state); +extern void test__f_type_array_array_lengthss_decimate_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_array_lengthss_decimate_by() + */ +extern void test__f_type_array_array_lengthss_decimate_by__works(void **state); #endif // _TEST__F_type_array__array_lengthss_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_decrease_by.c index 0a092ad..349cc1f 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_decrease_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_decrease_by.c @@ -5,12 +5,28 @@ extern "C" { #endif -void test__f_type_array_array_lengthss_decrease_by__works(void **state) { +void test__f_type_array_array_lengthss_decrease_by__parameter_checking(void **state) { const int length = 5; f_array_lengthss_t data = f_array_lengths_t_initialize; { + const f_status_t status = f_array_lengthss_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_array_lengthss_decrease_by__returns_data_not(void **state) { + + const int length = 5; + f_array_lengthss_t data = f_array_lengthss_t_initialize; + + { const f_status_t status = f_array_lengthss_resize(length, &data); assert_int_equal(status, F_none); @@ -19,25 +35,33 @@ void test__f_type_array_array_lengthss_decrease_by__works(void **state) { } { - const f_status_t status = f_array_lengthss_decrease_by(length, &data); + const f_status_t status = f_array_lengthss_decrease_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_array_lengthss_decrease_by__parameter_checking(void **state) { +void test__f_type_array_array_lengthss_decrease_by__works(void **state) { const int length = 5; f_array_lengthss_t data = f_array_lengths_t_initialize; { - const f_status_t status = f_array_lengthss_decrease_by(length, 0); + const f_status_t status = f_array_lengthss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_array_lengthss_decrease_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_decrease_by.h index 75c840d..88c814b 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_decrease_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_decrease_by.h @@ -11,17 +11,24 @@ #define _TEST__F_type_array__array_lengthss_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_array_lengthss_decrease_by() + * @see f_array_lengthss_decrease_by() */ -extern void test__f_type_array_array_lengthss_decrease_by__works(void **state); +extern void test__f_type_array_array_lengthss_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_array_lengthss_decrease_by() + * @see f_array_lengthss_decrease_by() */ -extern void test__f_type_array_array_lengthss_decrease_by__parameter_checking(void **state); +extern void test__f_type_array_array_lengthss_decrease_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_array_lengthss_decrease_by() + */ +extern void test__f_type_array_array_lengthss_decrease_by__works(void **state); #endif // _TEST__F_type_array__array_lengthss_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_increase.c index d5ada76..08be366 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_increase.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_increase.c @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_array_lengthss_increase__works(void **state) { +void test__f_type_array_array_lengthss_increase__parameter_checking(void **state) { const int length = 5; f_array_lengthss_t data = f_array_lengths_t_initialize; { - const f_status_t status = f_array_lengthss_resize(length, &data); + const f_status_t status = f_array_lengthss_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_array_lengthss_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); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -55,17 +45,27 @@ void test__f_type_array_array_lengthss_increase__returns_data_not(void **state) free((void *) data.array); } -void test__f_type_array_array_lengthss_increase__parameter_checking(void **state) { +void test__f_type_array_array_lengthss_increase__works(void **state) { const int length = 5; f_array_lengthss_t data = f_array_lengths_t_initialize; { - const f_status_t status = f_array_lengthss_increase(length, 0); + const f_status_t status = f_array_lengthss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_array_lengthss_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); diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_increase.h index 6788793..df78d8f 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_increase.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_increase.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__array_lengthss_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_array_lengthss_increase() + * @see f_array_lengthss_increase() */ -extern void test__f_type_array_array_lengthss_increase__works(void **state); +extern void test__f_type_array_array_lengthss_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_array_lengthss_increase() + * @see f_array_lengthss_increase() */ extern void test__f_type_array_array_lengthss_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_array_lengthss_increase() + * @see f_array_lengthss_increase() */ -extern void test__f_type_array_array_lengthss_increase__parameter_checking(void **state); +extern void test__f_type_array_array_lengthss_increase__works(void **state); #endif // _TEST__F_type_array__array_lengthss_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_increase_by.c index 5bbbbf1..fca240b 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_increase_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_increase_by.c @@ -5,12 +5,28 @@ extern "C" { #endif -void test__f_type_array_array_lengthss_increase_by__works(void **state) { +void test__f_type_array_array_lengthss_increase_by__parameter_checking(void **state) { const int length = 5; f_array_lengthss_t data = f_array_lengths_t_initialize; { + const f_status_t status = f_array_lengthss_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_array_lengthss_increase_by__returns_data_not(void **state) { + + const int length = 5; + f_array_lengthss_t data = f_array_lengthss_t_initialize; + + { const f_status_t status = f_array_lengthss_resize(length, &data); assert_int_equal(status, F_none); @@ -19,32 +35,48 @@ void test__f_type_array_array_lengthss_increase_by__works(void **state) { } { - data.used = length; + const f_status_t status = f_array_lengthss_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_array_lengthss_increase_by(length, &data); - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); + 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_array_lengthss_increase_by__parameter_checking(void **state) { +void test__f_type_array_array_lengthss_increase_by__works(void **state) { const int length = 5; f_array_lengthss_t data = f_array_lengths_t_initialize; { - const f_status_t status = f_array_lengthss_increase_by(length, 0); + const f_status_t status = f_array_lengthss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + { + data.used = length; + + const f_status_t status = f_array_lengthss_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 diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_increase_by.h index 789f8e1..cead637 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_increase_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_increase_by.h @@ -11,17 +11,24 @@ #define _TEST__F_type_array__array_lengthss_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_array_lengthss_increase_by() + * @see f_array_lengthss_increase_by() */ -extern void test__f_type_array_array_lengthss_increase_by__works(void **state); +extern void test__f_type_array_array_lengthss_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_array_lengthss_increase_by() + * @see f_array_lengthss_increase_by() */ -extern void test__f_type_array_array_lengthss_increase_by__parameter_checking(void **state); +extern void test__f_type_array_array_lengthss_increase_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_array_lengthss_increase_by() + */ +extern void test__f_type_array_array_lengthss_increase_by__works(void **state); #endif // _TEST__F_type_array__array_lengthss_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_resize.c index a2d030f..2e8fdc8 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_resize.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_resize.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_array_lengthss_resize__works(void **state) { +void test__f_type_array_array_lengthss_resize__parameter_checking(void **state) { const int length = 5; f_array_lengthss_t data = f_array_lengthss_t_initialize; { - const f_status_t status = f_array_lengthss_resize(length, &data); + const f_status_t status = f_array_lengthss_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_array_lengthss_resize__parameter_checking(void **state) { +void test__f_type_array_array_lengthss_resize__works(void **state) { const int length = 5; f_array_lengthss_t data = f_array_lengthss_t_initialize; { - const f_status_t status = f_array_lengthss_resize(length, 0); + const f_status_t status = f_array_lengthss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_resize.h index 0011f32..5d7ab80 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_resize.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_resize.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__array_lengthss_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_array_lengthss_resize() + * @see f_array_lengthss_resize() */ -extern void test__f_type_array_array_lengthss_resize__works(void **state); +extern void test__f_type_array_array_lengthss_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_array_lengthss_resize() + * @see f_array_lengthss_resize() */ -extern void test__f_type_array_array_lengthss_resize__parameter_checking(void **state); +extern void test__f_type_array_array_lengthss_resize__works(void **state); #endif // _TEST__F_type_array__array_lengthss_resize 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 index 4dbf3a4..fc8809e 100644 --- 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 @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_cells_adjust__works(void **state) { +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, &data); + const f_status_t status = f_cells_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_cells_adjust__parameter_checking(void **state) { +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, 0); + const f_status_t status = f_cells_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus 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 index 53d4c63..f908d42 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__cells_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_cells_adjust() + * @see f_cells_adjust() */ -extern void test__f_type_array_cells_adjust__works(void **state); +extern void test__f_type_array_cells_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_cells_adjust() + * @see f_cells_adjust() */ -extern void test__f_type_array_cells_adjust__parameter_checking(void **state); +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_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-cells_append.c index 1951456..d0afa08 100644 --- 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 @@ -5,6 +5,17 @@ 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 }; @@ -22,17 +33,6 @@ void test__f_type_array_cells_append__works(void **state) { free((void *) destination.array); } -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)); - } -} - #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 index ba16169..f80d2ba 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__cells_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_cells_append() + * @see f_cells_append() */ -extern void test__f_type_array_cells_append__works(void **state); +extern void test__f_type_array_cells_append__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_cells_append() + * @see f_cells_append() */ -extern void test__f_type_array_cells_append__parameter_checking(void **state); +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 index 071c2b1..322ff81 100644 --- 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 @@ -5,15 +5,23 @@ extern "C" { #endif -void test__f_type_array_cells_append_all__works(void **state) { +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_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); @@ -22,33 +30,27 @@ void test__f_type_array_cells_append_all__works(void **state) { 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); + 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); - free((void *) destination.array); } -void test__f_type_array_cells_append_all__returns_data_not(void **state) { +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); @@ -57,27 +59,25 @@ void test__f_type_array_cells_append_all__returns_data_not(void **state) { 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_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__parameter_checking(void **state) { - - const f_cells_t data = f_cells_t_initialize; + assert_int_equal(status, F_none); + assert_int_equal(destination.used, source.used); + assert_int_equal(destination.size, source.used); - { - const f_status_t status = f_cells_append_all(data, 0); + assert_int_equal(destination.array[0].row, cell_0.row); + assert_int_equal(destination.array[0].column, cell_0.column); - assert_int_equal(status, F_status_set_error(F_parameter)); + 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 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 index 31cd259..b4ecbe7 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__cells_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_cells_append_all() + * @see f_cells_append_all() */ -extern void test__f_type_array_cells_append_all__works(void **state); +extern void test__f_type_array_cells_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_cells_append_all() + * @see f_cells_append_all() */ extern void test__f_type_array_cells_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_cells_append_all() + * @see f_cells_append_all() */ -extern void test__f_type_array_cells_append_all__parameter_checking(void **state); +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 index a9bf7b0..45cf6e9 100644 --- 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 @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_cells_decimate_by__works(void **state) { +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_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); + const f_status_t status = f_cells_decimate_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_cells_decimate_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_cells_decimate_by__parameter_checking(void **state) { +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_decimate_by(length, 0); + const f_status_t status = f_cells_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + 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); } 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 index b689fff..a3abba2 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__cells_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_cells_decimate_by() + * @see f_cells_decimate_by() */ -extern void test__f_type_array_cells_decimate_by__works(void **state); +extern void test__f_type_array_cells_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_cells_decimate_by() + * @see f_cells_decimate_by() */ -extern void test__f_type_array_cells_decimate_by__parameter_checking(void **state); +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 index bd44d1b..7cd12b1 100644 --- 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 @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_cells_decrease_by__works(void **state) { +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_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); + const f_status_t status = f_cells_decrease_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_cells_decrease_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_cells_decrease_by__parameter_checking(void **state) { +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_decrease_by(length, 0); + const f_status_t status = f_cells_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + 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); } 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 index 09d89d3..71c3e23 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__cells_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_cells_decrease_by() + * @see f_cells_decrease_by() */ -extern void test__f_type_array_cells_decrease_by__works(void **state); +extern void test__f_type_array_cells_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_cells_decrease_by() + * @see f_cells_decrease_by() */ -extern void test__f_type_array_cells_decrease_by__parameter_checking(void **state); +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 index 7842295..ef18ec2 100644 --- 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 @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_cells_increase__works(void **state) { +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_resize(length, &data); + const f_status_t status = f_cells_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); 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); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -55,17 +45,27 @@ void test__f_type_array_cells_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_cells_increase__parameter_checking(void **state) { +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_increase(length, 0); + const f_status_t status = f_cells_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 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); 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 index 81964f4..80623ff 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__cells_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_cells_increase() + * @see f_cells_increase() */ -extern void test__f_type_array_cells_increase__works(void **state); +extern void test__f_type_array_cells_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_cells_increase() + * @see f_cells_increase() */ extern void test__f_type_array_cells_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_cells_increase() + * @see f_cells_increase() */ -extern void test__f_type_array_cells_increase__parameter_checking(void **state); +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 index ed71d46..debeb96 100644 --- 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 @@ -5,6 +5,22 @@ 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__works(void **state) { const int length = 5; @@ -31,22 +47,6 @@ void test__f_type_array_cells_increase_by__works(void **state) { free((void *) data.array); } -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); -} - #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 index f3daa78..896175e 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__cells_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_cells_increase_by() + * @see f_cells_increase_by() */ -extern void test__f_type_array_cells_increase_by__works(void **state); +extern void test__f_type_array_cells_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_cells_increase_by() + * @see f_cells_increase_by() */ -extern void test__f_type_array_cells_increase_by__parameter_checking(void **state); +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 index 35e6699..3ef50ce 100644 --- 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 @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_cells_resize__works(void **state) { +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, &data); + const f_status_t status = f_cells_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_cells_resize__parameter_checking(void **state) { +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, 0); + const f_status_t status = f_cells_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus 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 index b89bdf8..44be5c3 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__cells_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_cells_resize() + * @see f_cells_resize() */ -extern void test__f_type_array_cells_resize__works(void **state); +extern void test__f_type_array_cells_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_cells_resize() + * @see f_cells_resize() */ -extern void test__f_type_array_cells_resize__parameter_checking(void **state); +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-cellss_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-cellss_adjust.c index b44fcf2..2eb1c8f 100644 --- 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 @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_cellss_adjust__works(void **state) { +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, &data); + const f_status_t status = f_cellss_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_cellss_adjust__parameter_checking(void **state) { +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, 0); + const f_status_t status = f_cellss_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus 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 index b4d07e7..dc12694 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__cellss_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_cellss_adjust() + * @see f_cellss_adjust() */ -extern void test__f_type_array_cellss_adjust__works(void **state); +extern void test__f_type_array_cellss_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_cellss_adjust() + * @see f_cellss_adjust() */ -extern void test__f_type_array_cellss_adjust__parameter_checking(void **state); +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 index 9cbefbd..444dfec 100644 --- 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 @@ -5,6 +5,43 @@ 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; @@ -48,43 +85,6 @@ void test__f_type_array_cellss_append__works(void **state) { free((void *) destination.array); } -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__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)); - } -} - #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 index cc48725..7244b40 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__cellss_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_cellss_append() + * @see f_cellss_append() */ -extern void test__f_type_array_cellss_append__works(void **state); +extern void test__f_type_array_cellss_append__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_cellss_append() + * @see f_cellss_append() */ extern void test__f_type_array_cellss_append__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_cellss_append() + * @see f_cellss_append() */ -extern void test__f_type_array_cellss_append__parameter_checking(void **state); +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 index b7a1932..8ffe297 100644 --- 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 @@ -5,6 +5,43 @@ extern "C" { #endif +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__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__works(void **state) { const int length = 5; @@ -67,43 +104,6 @@ void test__f_type_array_cellss_append_all__works(void **state) { free((void *) destination.array); } -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__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)); - } -} - #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 index 2721cdd..4422b6f 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__cellss_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_cellss_append_all() + * @see f_cellss_append_all() */ -extern void test__f_type_array_cellss_append_all__works(void **state); +extern void test__f_type_array_cellss_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_cellss_append_all() + * @see f_cellss_append_all() */ extern void test__f_type_array_cellss_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_cellss_append_all() + * @see f_cellss_append_all() */ -extern void test__f_type_array_cellss_append_all__parameter_checking(void **state); +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 index abc400c..12aebed 100644 --- 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 @@ -5,12 +5,28 @@ extern "C" { #endif -void test__f_type_array_cellss_decimate_by__works(void **state) { +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); @@ -19,25 +35,33 @@ void test__f_type_array_cellss_decimate_by__works(void **state) { } { - const f_status_t status = f_cellss_decimate_by(length, &data); + const f_status_t status = f_cellss_decimate_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_cellss_decimate_by__parameter_checking(void **state) { +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_decimate_by(length, 0); + const f_status_t status = f_cellss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + 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); } 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 index 3f43825..a0ea73d 100644 --- 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 @@ -11,17 +11,24 @@ #define _TEST__F_type_array__cellss_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_cellss_decimate_by() + * @see f_cellss_decimate_by() */ -extern void test__f_type_array_cellss_decimate_by__works(void **state); +extern void test__f_type_array_cellss_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * * @see f_type_array_cellss_decimate_by() */ -extern void test__f_type_array_cellss_decimate_by__parameter_checking(void **state); +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 index 8fe429d..ae118f0 100644 --- 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 @@ -5,12 +5,28 @@ extern "C" { #endif -void test__f_type_array_cellss_decrease_by__works(void **state) { +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); @@ -19,25 +35,33 @@ void test__f_type_array_cellss_decrease_by__works(void **state) { } { - const f_status_t status = f_cellss_decrease_by(length, &data); + const f_status_t status = f_cellss_decrease_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_cellss_decrease_by__parameter_checking(void **state) { +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_decrease_by(length, 0); + const f_status_t status = f_cellss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + 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); } 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 index 9b5e4b0..ead2366 100644 --- 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 @@ -11,17 +11,24 @@ #define _TEST__F_type_array__cellss_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_cellss_decrease_by() + * @see f_cellss_decrease_by() */ -extern void test__f_type_array_cellss_decrease_by__works(void **state); +extern void test__f_type_array_cellss_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_cellss_decrease_by() + * @see f_cellss_decrease_by() */ -extern void test__f_type_array_cellss_decrease_by__parameter_checking(void **state); +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 index 577bd62..bba4c27 100644 --- 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 @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_cellss_increase__works(void **state) { +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_resize(length, &data); + const f_status_t status = f_cellss_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); 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); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -55,17 +45,27 @@ void test__f_type_array_cellss_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_cellss_increase__parameter_checking(void **state) { +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_increase(length, 0); + const f_status_t status = f_cellss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 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); 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 index 74ca065..c0c14b7 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__cellss_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_cellss_increase() + * @see f_cellss_increase() */ -extern void test__f_type_array_cellss_increase__works(void **state); +extern void test__f_type_array_cellss_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_cellss_increase() + * @see f_cellss_increase() */ extern void test__f_type_array_cellss_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_cellss_increase() + * @see f_cellss_increase() */ -extern void test__f_type_array_cellss_increase__parameter_checking(void **state); +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 index 07e7c37..2a866d0 100644 --- 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 @@ -5,12 +5,28 @@ extern "C" { #endif -void test__f_type_array_cellss_increase_by__works(void **state) { +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); @@ -19,32 +35,72 @@ void test__f_type_array_cellss_increase_by__works(void **state) { } { - data.used = 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, length); - assert_int_equal(data.size, length * 2); + 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__parameter_checking(void **state) { +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_increase_by(length, 0); + const f_status_t status = f_cellss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + { + 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 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 index 9152f1d..e226bc9 100644 --- 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 @@ -11,17 +11,24 @@ #define _TEST__F_type_array__cellss_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_cellss_increase_by() + * @see f_cellss_increase_by() */ -extern void test__f_type_array_cellss_increase_by__works(void **state); +extern void test__f_type_array_cellss_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_cellss_increase_by() + * @see f_cellss_increase_by() */ -extern void test__f_type_array_cellss_increase_by__parameter_checking(void **state); +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 index 79fb875..41d8132 100644 --- 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 @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_cellss_resize__works(void **state) { +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, &data); + const f_status_t status = f_cellss_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_cellss_resize__parameter_checking(void **state) { +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, 0); + const f_status_t status = f_cellss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus 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 index a0977f0..c5356f1 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__cellss_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_cellss_resize() + * @see f_cellss_resize() */ -extern void test__f_type_array_cellss_resize__works(void **state); +extern void test__f_type_array_cellss_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_cellss_resize() + * @see f_cellss_resize() */ -extern void test__f_type_array_cellss_resize__parameter_checking(void **state); +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-fll_ids_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_adjust.c index 658031e..62e20eb 100644 --- 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 @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_fll_ids_adjust__works(void **state) { +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, &data); + const f_status_t status = f_fll_ids_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_fll_ids_adjust__parameter_checking(void **state) { +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, 0); + const f_status_t status = f_fll_ids_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus 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 index 486be6f..93f69b3 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__fll_ids_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_fll_ids_adjust() + * @see f_fll_ids_adjust() */ -extern void test__f_type_array_fll_ids_adjust__works(void **state); +extern void test__f_type_array_fll_ids_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_fll_ids_adjust() + * @see f_fll_ids_adjust() */ -extern void test__f_type_array_fll_ids_adjust__parameter_checking(void **state); +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_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_append.c index 8804203..d0905db 100644 --- 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 @@ -5,6 +5,17 @@ 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 }; @@ -23,17 +34,6 @@ void test__f_type_array_fll_ids_append__works(void **state) { free((void *) destination.array); } -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)); - } -} - #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 index a665436..01fac84 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__fll_ids_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_fll_ids_append() + * @see f_fll_ids_append() */ -extern void test__f_type_array_fll_ids_append__works(void **state); +extern void test__f_type_array_fll_ids_append__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_fll_ids_append() + * @see f_fll_ids_append() */ -extern void test__f_type_array_fll_ids_append__parameter_checking(void **state); +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 index 1b12eb0..c087020 100644 --- 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 @@ -5,15 +5,23 @@ extern "C" { #endif -void test__f_type_array_fll_ids_append_all__works(void **state) { +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_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); @@ -22,35 +30,27 @@ void test__f_type_array_fll_ids_append_all__works(void **state) { 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); + 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); - free((void *) destination.array); } -void test__f_type_array_fll_ids_append_all__returns_data_not(void **state) { +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); @@ -59,27 +59,27 @@ void test__f_type_array_fll_ids_append_all__returns_data_not(void **state) { 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_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__parameter_checking(void **state) { - - const f_fll_ids_t data = f_fll_ids_t_initialize; + assert_int_equal(status, F_none); + assert_int_equal(destination.used, source.used); + assert_int_equal(destination.size, source.used); - { - const f_status_t status = f_fll_ids_append_all(data, 0); + 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_int_equal(status, F_status_set_error(F_parameter)); + 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 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 index 4093df1..a719d82 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__fll_ids_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_fll_ids_append_all() + * @see f_fll_ids_append_all() */ -extern void test__f_type_array_fll_ids_append_all__works(void **state); +extern void test__f_type_array_fll_ids_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_fll_ids_append_all() + * @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 correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_fll_ids_append_all() + * @see f_fll_ids_append_all() */ -extern void test__f_type_array_fll_ids_append_all__parameter_checking(void **state); +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 index fa796a4..fdc5138 100644 --- 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 @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_fll_ids_decimate_by__works(void **state) { +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_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); + const f_status_t status = f_fll_ids_decimate_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_fll_ids_decimate_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_fll_ids_decimate_by__parameter_checking(void **state) { +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_decimate_by(length, 0); + const f_status_t status = f_fll_ids_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + 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); } 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 index cd4471d..81a721f 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__fll_ids_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_fll_ids_decimate_by() + * @see f_fll_ids_decimate_by() */ -extern void test__f_type_array_fll_ids_decimate_by__works(void **state); +extern void test__f_type_array_fll_ids_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_fll_ids_decimate_by() + * @see f_fll_ids_decimate_by() */ -extern void test__f_type_array_fll_ids_decimate_by__parameter_checking(void **state); +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 index a60e139..a55df2d 100644 --- 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 @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_fll_ids_decrease_by__works(void **state) { +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_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); + const f_status_t status = f_fll_ids_decrease_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_fll_ids_decrease_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_fll_ids_decrease_by__parameter_checking(void **state) { +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_decrease_by(length, 0); + const f_status_t status = f_fll_ids_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + 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); } 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 index 9506bca..568cd13 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__fll_ids_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_fll_ids_decrease_by() + * @see f_fll_ids_decrease_by() */ -extern void test__f_type_array_fll_ids_decrease_by__works(void **state); +extern void test__f_type_array_fll_ids_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_fll_ids_decrease_by() + * @see f_fll_ids_decrease_by() */ -extern void test__f_type_array_fll_ids_decrease_by__parameter_checking(void **state); +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 index a359f31..d49fda5 100644 --- 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 @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_fll_ids_increase__works(void **state) { +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_resize(length, &data); + const f_status_t status = f_fll_ids_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); 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); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -55,17 +45,27 @@ void test__f_type_array_fll_ids_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_fll_ids_increase__parameter_checking(void **state) { +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_increase(length, 0); + const f_status_t status = f_fll_ids_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 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); 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 index f5e8d87..6748abb 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__fll_ids_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_fll_ids_increase() + * @see f_fll_ids_increase() */ -extern void test__f_type_array_fll_ids_increase__works(void **state); +extern void test__f_type_array_fll_ids_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_fll_ids_increase() + * @see f_fll_ids_increase() */ extern void test__f_type_array_fll_ids_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_fll_ids_increase() + * @see f_fll_ids_increase() */ -extern void test__f_type_array_fll_ids_increase__parameter_checking(void **state); +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 index e3b60b6..9faef89 100644 --- 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 @@ -5,6 +5,22 @@ 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__works(void **state) { const int length = 5; @@ -31,22 +47,6 @@ void test__f_type_array_fll_ids_increase_by__works(void **state) { free((void *) data.array); } -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); -} - #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 index 159d816..c60ae68 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__fll_ids_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_fll_ids_increase_by() + * @see f_fll_ids_increase_by() */ -extern void test__f_type_array_fll_ids_increase_by__works(void **state); +extern void test__f_type_array_fll_ids_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_fll_ids_increase_by() + * @see f_fll_ids_increase_by() */ -extern void test__f_type_array_fll_ids_increase_by__parameter_checking(void **state); +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 index a5b56ed..519a625 100644 --- 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 @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_fll_ids_resize__works(void **state) { +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, &data); + const f_status_t status = f_fll_ids_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_fll_ids_resize__parameter_checking(void **state) { +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, 0); + const f_status_t status = f_fll_ids_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus 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 index 7ae4f84..619b2e1 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__fll_ids_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_fll_ids_resize() + * @see f_fll_ids_resize() */ -extern void test__f_type_array_fll_ids_resize__works(void **state); +extern void test__f_type_array_fll_ids_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_fll_ids_resize() + * @see f_fll_ids_resize() */ -extern void test__f_type_array_fll_ids_resize__parameter_checking(void **state); +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_idss_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_adjust.c index 979b56d..fe2d8ec 100644 --- 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 @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_fll_idss_adjust__works(void **state) { +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, &data); + const f_status_t status = f_fll_idss_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_fll_idss_adjust__parameter_checking(void **state) { +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, 0); + const f_status_t status = f_fll_idss_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus 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 index 6dfdf95..8cd03e0 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__fll_idss_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_fll_idss_adjust() + * @see f_fll_idss_adjust() */ -extern void test__f_type_array_fll_idss_adjust__works(void **state); +extern void test__f_type_array_fll_idss_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_fll_idss_adjust() + * @see f_fll_idss_adjust() */ -extern void test__f_type_array_fll_idss_adjust__parameter_checking(void **state); +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 index a08c604..6f86af9 100644 --- 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 @@ -5,6 +5,43 @@ 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; @@ -49,43 +86,6 @@ void test__f_type_array_fll_idss_append__works(void **state) { free((void *) destination.array); } -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__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)); - } -} - #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 index 9cbc569..3c6d390 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__fll_idss_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_fll_idss_append() + * @see f_fll_idss_append() */ -extern void test__f_type_array_fll_idss_append__works(void **state); +extern void test__f_type_array_fll_idss_append__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_fll_idss_append() + * @see f_fll_idss_append() */ extern void test__f_type_array_fll_idss_append__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_fll_idss_append() + * @see f_fll_idss_append() */ -extern void test__f_type_array_fll_idss_append__parameter_checking(void **state); +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 index 774d9c7..868bdce 100644 --- 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 @@ -5,6 +5,43 @@ 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; @@ -69,43 +106,6 @@ void test__f_type_array_fll_idss_append_all__works(void **state) { free((void *) destination.array); } -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__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)); - } -} - #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 index baa023d..2bd8ad6 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__fll_idss_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_fll_idss_append_all() + * @see f_fll_idss_append_all() */ -extern void test__f_type_array_fll_idss_append_all__works(void **state); +extern void test__f_type_array_fll_idss_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_fll_idss_append_all() + * @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 correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_fll_idss_append_all() + * @see f_fll_idss_append_all() */ -extern void test__f_type_array_fll_idss_append_all__parameter_checking(void **state); +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 index 168f7d4..14a0083 100644 --- 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 @@ -5,12 +5,28 @@ extern "C" { #endif -void test__f_type_array_fll_idss_decimate_by__works(void **state) { +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); @@ -19,25 +35,33 @@ void test__f_type_array_fll_idss_decimate_by__works(void **state) { } { - const f_status_t status = f_fll_idss_decimate_by(length, &data); + const f_status_t status = f_fll_idss_decimate_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_fll_idss_decimate_by__parameter_checking(void **state) { +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_decimate_by(length, 0); + const f_status_t status = f_fll_idss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + 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); } 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 index c4edbe3..004145e 100644 --- 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 @@ -11,17 +11,24 @@ #define _TEST__F_type_array__fll_idss_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_fll_idss_decimate_by() + * @see f_fll_idss_decimate_by() */ -extern void test__f_type_array_fll_idss_decimate_by__works(void **state); +extern void test__f_type_array_fll_idss_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * 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__parameter_checking(void **state); +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 index 3f7f826..bd7a7d5 100644 --- 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 @@ -5,12 +5,28 @@ extern "C" { #endif -void test__f_type_array_fll_idss_decrease_by__works(void **state) { +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); @@ -19,25 +35,33 @@ void test__f_type_array_fll_idss_decrease_by__works(void **state) { } { - const f_status_t status = f_fll_idss_decrease_by(length, &data); + const f_status_t status = f_fll_idss_decrease_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_fll_idss_decrease_by__parameter_checking(void **state) { +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_decrease_by(length, 0); + const f_status_t status = f_fll_idss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + 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); } 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 index 35a43c3..ccca0ac 100644 --- 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 @@ -11,17 +11,24 @@ #define _TEST__F_type_array__fll_idss_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_fll_idss_decrease_by() + * @see f_fll_idss_decrease_by() */ -extern void test__f_type_array_fll_idss_decrease_by__works(void **state); +extern void test__f_type_array_fll_idss_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_fll_idss_decrease_by() + * @see f_fll_idss_decrease_by() */ -extern void test__f_type_array_fll_idss_decrease_by__parameter_checking(void **state); +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 index d7e5a57..a6ac668 100644 --- 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 @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_fll_idss_increase__works(void **state) { +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_resize(length, &data); + const f_status_t status = f_fll_idss_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); 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); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -55,17 +45,27 @@ void test__f_type_array_fll_idss_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_fll_idss_increase__parameter_checking(void **state) { +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_increase(length, 0); + const f_status_t status = f_fll_idss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 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); 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 index 358ba3e..50b431c 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__fll_idss_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_fll_idss_increase() + * @see f_fll_idss_increase() */ -extern void test__f_type_array_fll_idss_increase__works(void **state); +extern void test__f_type_array_fll_idss_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_fll_idss_increase() + * @see f_fll_idss_increase() */ extern void test__f_type_array_fll_idss_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_fll_idss_increase() + * @see f_fll_idss_increase() */ -extern void test__f_type_array_fll_idss_increase__parameter_checking(void **state); +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 index 05ba92e..523a852 100644 --- 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 @@ -5,12 +5,28 @@ extern "C" { #endif -void test__f_type_array_fll_idss_increase_by__works(void **state) { +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); @@ -19,32 +35,48 @@ void test__f_type_array_fll_idss_increase_by__works(void **state) { } { - data.used = 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_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); + 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__parameter_checking(void **state) { +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_increase_by(length, 0); + const f_status_t status = f_fll_idss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + { + 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 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 index cf8687e..e97fe41 100644 --- 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 @@ -11,17 +11,24 @@ #define _TEST__F_type_array__fll_idss_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_fll_idss_increase_by() + * @see f_fll_idss_increase_by() */ -extern void test__f_type_array_fll_idss_increase_by__works(void **state); +extern void test__f_type_array_fll_idss_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_fll_idss_increase_by() + * @see f_fll_idss_increase_by() */ -extern void test__f_type_array_fll_idss_increase_by__parameter_checking(void **state); +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 index e0891ee..5b031af 100644 --- 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 @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_fll_idss_resize__works(void **state) { +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, &data); + const f_status_t status = f_fll_idss_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_fll_idss_resize__parameter_checking(void **state) { +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, 0); + const f_status_t status = f_fll_idss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus 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 index 4284015..5c2ca18 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__fll_idss_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_fll_idss_resize() + * @see f_fll_idss_resize() */ -extern void test__f_type_array_fll_idss_resize__works(void **state); +extern void test__f_type_array_fll_idss_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_fll_idss_resize() + * @see f_fll_idss_resize() */ -extern void test__f_type_array_fll_idss_resize__parameter_checking(void **state); +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 index 3463b16..eb2f97d 100644 --- 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 @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_int128s_adjust__works(void **state) { +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, &data); + const f_status_t status = f_int128s_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_int128s_adjust__parameter_checking(void **state) { +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, 0); + const f_status_t status = f_int128s_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus 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 index 467b522..8d86069 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int128s_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int128s_adjust() + * @see f_int128s_adjust() */ -extern void test__f_type_array_int128s_adjust__works(void **state); +extern void test__f_type_array_int128s_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int128s_adjust() + * @see f_int128s_adjust() */ -extern void test__f_type_array_int128s_adjust__parameter_checking(void **state); +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_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_append.c index b905964..239ecb6 100644 --- 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 @@ -5,6 +5,17 @@ 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; @@ -21,17 +32,6 @@ void test__f_type_array_int128s_append__works(void **state) { free((void *) destination.array); } -void test__f_type_array_int128s_append__parameter_checking(void **state) { - - const uint128_t data = 0; - - { - const f_status_t status = f_int128s_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - #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 index 0ad1cba..9672524 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int128s_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int128s_append() + * @see f_int128s_append() */ -extern void test__f_type_array_int128s_append__works(void **state); +extern void test__f_type_array_int128s_append__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int128s_append() + * @see f_int128s_append() */ -extern void test__f_type_array_int128s_append__parameter_checking(void **state); +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 index 281f207..6bc5aa0 100644 --- 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 @@ -5,10 +5,20 @@ extern "C" { #endif -void test__f_type_array_int128s_append_all__works(void **state) { +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; - const int length_used = 2; f_int128s_t source = f_int128s_t_initialize; f_int128s_t destination = f_int128s_t_initialize; @@ -20,29 +30,22 @@ void test__f_type_array_int128s_append_all__works(void **state) { 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_array_length_t i = 0; i < source.used; ++i) { - assert_int_equal(destination.array[i], i + 1); - } // for + 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); - free((void *) destination.array); } -void test__f_type_array_int128s_append_all__returns_data_not(void **state) { +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; @@ -54,27 +57,24 @@ void test__f_type_array_int128s_append_all__returns_data_not(void **state) { 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_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); + assert_int_equal(status, F_none); + assert_int_equal(destination.used, source.used); + assert_int_equal(destination.size, source.used); + + for (f_array_length_t i = 0; i < source.used; ++i) { + assert_int_equal(destination.array[i], i + 1); + } // for } free((void *) source.array); -} - -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)); - } + free((void *) destination.array); } #ifdef __cplusplus 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 index a63f610..17e6a57 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__int128s_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int128s_append_all() + * @see f_int128s_append_all() */ -extern void test__f_type_array_int128s_append_all__works(void **state); +extern void test__f_type_array_int128s_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_int128s_append_all() + * @see f_int128s_append_all() */ extern void test__f_type_array_int128s_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int128s_append_all() + * @see f_int128s_append_all() */ -extern void test__f_type_array_int128s_append_all__parameter_checking(void **state); +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 index f9276b0..3d4ed91 100644 --- 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 @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_int128s_decimate_by__works(void **state) { +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_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); + const f_status_t status = f_int128s_decimate_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_int128s_decimate_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_int128s_decimate_by__parameter_checking(void **state) { +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_decimate_by(length, 0); + const f_status_t status = f_int128s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + 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); } 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 index 27c95e5..62689ba 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int128s_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int128s_decimate_by() + * @see f_int128s_decimate_by() */ -extern void test__f_type_array_int128s_decimate_by__works(void **state); +extern void test__f_type_array_int128s_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int128s_decimate_by() + * @see f_int128s_decimate_by() */ -extern void test__f_type_array_int128s_decimate_by__parameter_checking(void **state); +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 index af81902..bc7831b 100644 --- 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 @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_int128s_decrease_by__works(void **state) { +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_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); + const f_status_t status = f_int128s_decrease_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_int128s_decrease_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_int128s_decrease_by__parameter_checking(void **state) { +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_decrease_by(length, 0); + const f_status_t status = f_int128s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + 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); } 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 index 614d3b5..3dd881a 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int128s_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int128s_decrease_by() + * @see f_int128s_decrease_by() */ -extern void test__f_type_array_int128s_decrease_by__works(void **state); +extern void test__f_type_array_int128s_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int128s_decrease_by() + * @see f_int128s_decrease_by() */ -extern void test__f_type_array_int128s_decrease_by__parameter_checking(void **state); +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 index 35aa7ad..9a4e425 100644 --- 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 @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_int128s_increase__works(void **state) { +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_resize(length, &data); + const f_status_t status = f_int128s_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); 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); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -55,17 +45,27 @@ void test__f_type_array_int128s_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_int128s_increase__parameter_checking(void **state) { +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_increase(length, 0); + const f_status_t status = f_int128s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 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); 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 index daf6bdb..cb7cce3 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__int128s_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int128s_increase() + * @see f_int128s_increase() */ -extern void test__f_type_array_int128s_increase__works(void **state); +extern void test__f_type_array_int128s_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_int128s_increase() + * @see f_int128s_increase() */ extern void test__f_type_array_int128s_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int128s_increase() + * @see f_int128s_increase() */ -extern void test__f_type_array_int128s_increase__parameter_checking(void **state); +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 index 37583da..059d196 100644 --- 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 @@ -5,6 +5,22 @@ 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__works(void **state) { const int length = 5; @@ -31,22 +47,6 @@ void test__f_type_array_int128s_increase_by__works(void **state) { free((void *) data.array); } -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); -} - #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 index b1c35bf..77c8b26 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int128s_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int128s_increase_by() + * @see f_int128s_increase_by() */ -extern void test__f_type_array_int128s_increase_by__works(void **state); +extern void test__f_type_array_int128s_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int128s_increase_by() + * @see f_int128s_increase_by() */ -extern void test__f_type_array_int128s_increase_by__parameter_checking(void **state); +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 index 19b6c13..092258d 100644 --- 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 @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_int128s_resize__works(void **state) { +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, &data); + const f_status_t status = f_int128s_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_int128s_resize__parameter_checking(void **state) { +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, 0); + const f_status_t status = f_int128s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus 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 index 4d4c60d..211b6d5 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int128s_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int128s_resize() + * @see f_int128s_resize() */ -extern void test__f_type_array_int128s_resize__works(void **state); +extern void test__f_type_array_int128s_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int128s_resize() + * @see f_int128s_resize() */ -extern void test__f_type_array_int128s_resize__parameter_checking(void **state); +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-int128ss_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_adjust.c index 7bdd283..7ad575a 100644 --- 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 @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_int128ss_adjust__works(void **state) { +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, &data); + const f_status_t status = f_int128ss_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_int128ss_adjust__parameter_checking(void **state) { +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, 0); + const f_status_t status = f_int128ss_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus 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 index 21c0fa8..3f90bfe 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int128ss_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int128ss_adjust() + * @see f_int128ss_adjust() */ -extern void test__f_type_array_int128ss_adjust__works(void **state); +extern void test__f_type_array_int128ss_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int128ss_adjust() + * @see f_int128ss_adjust() */ -extern void test__f_type_array_int128ss_adjust__parameter_checking(void **state); +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 index c67b66d..47f6e33 100644 --- 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 @@ -5,7 +5,18 @@ extern "C" { #endif -void test__f_type_array_int128ss_append__works(void **state) { +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; @@ -19,32 +30,19 @@ void test__f_type_array_int128ss_append__works(void **state) { 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_array_length_t i = 0; i < destination.array[0].used; ++i) { - assert_int_equal(destination.array[0].array[i], i + 1); - } // for + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + assert_null(destination.array); } - for (f_array_length_t i = 0; i < destination.used; ++i) { - free((void *) destination.array[i].array); - } // for - free((void *) source.array); - free((void *) destination.array); } -void test__f_type_array_int128ss_append__returns_data_not(void **state) { +void test__f_type_array_int128ss_append__works(void **state) { const int length = 5; f_int128s_t source = f_int128s_t_initialize; @@ -58,27 +56,29 @@ void test__f_type_array_int128ss_append__returns_data_not(void **state) { 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_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__parameter_checking(void **state) { + 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); - f_int128s_t data = f_int128s_t_initialize; + for (f_array_length_t i = 0; i < destination.array[0].used; ++i) { + assert_int_equal(destination.array[0].array[i], i + 1); + } // for + } - { - const f_status_t status = f_int128ss_append(data, 0); + for (f_array_length_t i = 0; i < destination.used; ++i) { + free((void *) destination.array[i].array); + } // for - assert_int_equal(status, F_status_set_error(F_parameter)); - } + free((void *) source.array); + free((void *) destination.array); } #ifdef __cplusplus 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 index e27c025..3196ce4 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__int128ss_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int128ss_append() + * @see f_int128ss_append() */ -extern void test__f_type_array_int128ss_append__works(void **state); +extern void test__f_type_array_int128ss_append__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_int128ss_append() + * @see f_int128ss_append() */ extern void test__f_type_array_int128ss_append__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int128ss_append() + * @see f_int128ss_append() */ -extern void test__f_type_array_int128ss_append__parameter_checking(void **state); +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 index 26f33bc..f793a63 100644 --- 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 @@ -5,6 +5,43 @@ 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; @@ -63,43 +100,6 @@ void test__f_type_array_int128ss_append_all__works(void **state) { free((void *) destination.array); } -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__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)); - } -} - #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 index 8c0339f..94a9874 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__int128ss_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int128ss_append_all() + * @see f_int128ss_append_all() */ -extern void test__f_type_array_int128ss_append_all__works(void **state); +extern void test__f_type_array_int128ss_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_int128ss_append_all() + * @see f_int128ss_append_all() */ extern void test__f_type_array_int128ss_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int128ss_append_all() + * @see f_int128ss_append_all() */ -extern void test__f_type_array_int128ss_append_all__parameter_checking(void **state); +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 index 1a6c370..e46fc9e 100644 --- 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 @@ -5,10 +5,26 @@ extern "C" { #endif -void test__f_type_array_int128ss_decimate_by__works(void **state) { +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_int128s_t_initialize; + f_int128ss_t data = f_int128ss_t_initialize; { const f_status_t status = f_int128ss_resize(length, &data); @@ -19,25 +35,33 @@ void test__f_type_array_int128ss_decimate_by__works(void **state) { } { - const f_status_t status = f_int128ss_decimate_by(length, &data); + const f_status_t status = f_int128ss_decimate_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_int128ss_decimate_by__parameter_checking(void **state) { +void test__f_type_array_int128ss_decimate_by__works(void **state) { const int length = 5; - f_int128ss_t data = f_int128s_t_initialize; + f_int128ss_t data = f_int128ss_t_initialize; { - const f_status_t status = f_int128ss_decimate_by(length, 0); + const f_status_t status = f_int128ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + 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); } 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 index b4a3647..ebd4ad5 100644 --- 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 @@ -11,17 +11,24 @@ #define _TEST__F_type_array__int128ss_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int128ss_decimate_by() + * @see f_int128ss_decimate_by() */ -extern void test__f_type_array_int128ss_decimate_by__works(void **state); +extern void test__f_type_array_int128ss_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * * @see f_type_array_int128ss_decimate_by() */ -extern void test__f_type_array_int128ss_decimate_by__parameter_checking(void **state); +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 index a8ac1f4..62b909e 100644 --- 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 @@ -5,10 +5,26 @@ extern "C" { #endif -void test__f_type_array_int128ss_decrease_by__works(void **state) { +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_int128s_t_initialize; + f_int128ss_t data = f_int128ss_t_initialize; { const f_status_t status = f_int128ss_resize(length, &data); @@ -19,25 +35,33 @@ void test__f_type_array_int128ss_decrease_by__works(void **state) { } { - const f_status_t status = f_int128ss_decrease_by(length, &data); + const f_status_t status = f_int128ss_decrease_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_int128ss_decrease_by__parameter_checking(void **state) { +void test__f_type_array_int128ss_decrease_by__works(void **state) { const int length = 5; - f_int128ss_t data = f_int128s_t_initialize; + f_int128ss_t data = f_int128ss_t_initialize; { - const f_status_t status = f_int128ss_decrease_by(length, 0); + const f_status_t status = f_int128ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + 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); } 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 index f7f4da9..324a4b2 100644 --- 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 @@ -11,17 +11,24 @@ #define _TEST__F_type_array__int128ss_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int128ss_decrease_by() + * @see f_int128ss_decrease_by() */ -extern void test__f_type_array_int128ss_decrease_by__works(void **state); +extern void test__f_type_array_int128ss_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_int128ss_decrease_by() + * @see f_int128ss_decrease_by() */ -extern void test__f_type_array_int128ss_decrease_by__parameter_checking(void **state); +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 index d0cfcc1..048b461 100644 --- 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 @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_int128ss_increase__works(void **state) { +void test__f_type_array_int128ss_increase__parameter_checking(void **state) { const int length = 5; - f_int128ss_t data = f_int128s_t_initialize; + f_int128ss_t data = f_int128ss_t_initialize; { - const f_status_t status = f_int128ss_resize(length, &data); + const f_status_t status = f_int128ss_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); 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); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -34,7 +24,7 @@ void test__f_type_array_int128ss_increase__works(void **state) { void test__f_type_array_int128ss_increase__returns_data_not(void **state) { const int length = 5; - f_int128ss_t data = f_int128s_t_initialize; + f_int128ss_t data = f_int128ss_t_initialize; { const f_status_t status = f_int128ss_resize(length, &data); @@ -55,17 +45,27 @@ void test__f_type_array_int128ss_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_int128ss_increase__parameter_checking(void **state) { +void test__f_type_array_int128ss_increase__works(void **state) { const int length = 5; - f_int128ss_t data = f_int128s_t_initialize; + f_int128ss_t data = f_int128ss_t_initialize; { - const f_status_t status = f_int128ss_increase(length, 0); + const f_status_t status = f_int128ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 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); 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 index 5751599..3972fc7 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__int128ss_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int128ss_increase() + * @see f_int128ss_increase() */ -extern void test__f_type_array_int128ss_increase__works(void **state); +extern void test__f_type_array_int128ss_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_int128ss_increase() + * @see f_int128ss_increase() */ extern void test__f_type_array_int128ss_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int128ss_increase() + * @see f_int128ss_increase() */ -extern void test__f_type_array_int128ss_increase__parameter_checking(void **state); +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 index 8588735..f8da919 100644 --- 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 @@ -5,10 +5,26 @@ extern "C" { #endif -void test__f_type_array_int128ss_increase_by__works(void **state) { +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_int128s_t_initialize; + f_int128ss_t data = f_int128ss_t_initialize; { const f_status_t status = f_int128ss_resize(length, &data); @@ -19,32 +35,48 @@ void test__f_type_array_int128ss_increase_by__works(void **state) { } { - data.used = 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_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); + 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__parameter_checking(void **state) { +void test__f_type_array_int128ss_increase_by__works(void **state) { const int length = 5; - f_int128ss_t data = f_int128s_t_initialize; + f_int128ss_t data = f_int128ss_t_initialize; { - const f_status_t status = f_int128ss_increase_by(length, 0); + const f_status_t status = f_int128ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + { + 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 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 index dbb6090..6f2af95 100644 --- 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 @@ -11,17 +11,24 @@ #define _TEST__F_type_array__int128ss_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int128ss_increase_by() + * @see f_int128ss_increase_by() */ -extern void test__f_type_array_int128ss_increase_by__works(void **state); +extern void test__f_type_array_int128ss_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_int128ss_increase_by() + * @see f_int128ss_increase_by() */ -extern void test__f_type_array_int128ss_increase_by__parameter_checking(void **state); +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 index 72eaa3f..cabbb02 100644 --- 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 @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_int128ss_resize__works(void **state) { +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, &data); + const f_status_t status = f_int128ss_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_int128ss_resize__parameter_checking(void **state) { +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, 0); + const f_status_t status = f_int128ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus 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 index 821daa2..24a5ae2 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int128ss_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int128ss_resize() + * @see f_int128ss_resize() */ -extern void test__f_type_array_int128ss_resize__works(void **state); +extern void test__f_type_array_int128ss_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int128ss_resize() + * @see f_int128ss_resize() */ -extern void test__f_type_array_int128ss_resize__parameter_checking(void **state); +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 index 3f0931e..3c4f279 100644 --- 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 @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_int16s_adjust__works(void **state) { +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, &data); + const f_status_t status = f_int16s_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_int16s_adjust__parameter_checking(void **state) { +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, 0); + const f_status_t status = f_int16s_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus 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 index 9376cd3..086ffc7 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int16s_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int16s_adjust() + * @see f_int16s_adjust() */ -extern void test__f_type_array_int16s_adjust__works(void **state); +extern void test__f_type_array_int16s_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int16s_adjust() + * @see f_int16s_adjust() */ -extern void test__f_type_array_int16s_adjust__parameter_checking(void **state); +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_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_append.c index 163f197..2057196 100644 --- 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 @@ -5,9 +5,20 @@ 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 uint16_t source = 3; + const int16_t source = 3; f_int16s_t destination = f_int16s_t_initialize; { @@ -21,17 +32,6 @@ void test__f_type_array_int16s_append__works(void **state) { free((void *) destination.array); } -void test__f_type_array_int16s_append__parameter_checking(void **state) { - - const uint16_t data = 0; - - { - const f_status_t status = f_int16s_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - #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 index 173530c..7b4a601 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int16s_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int16s_append() + * @see f_int16s_append() */ -extern void test__f_type_array_int16s_append__works(void **state); +extern void test__f_type_array_int16s_append__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int16s_append() + * @see f_int16s_append() */ -extern void test__f_type_array_int16s_append__parameter_checking(void **state); +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 index 19506b0..dd2ad4d 100644 --- 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 @@ -5,10 +5,20 @@ extern "C" { #endif -void test__f_type_array_int16s_append_all__works(void **state) { +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; - const int length_used = 2; f_int16s_t source = f_int16s_t_initialize; f_int16s_t destination = f_int16s_t_initialize; @@ -20,29 +30,22 @@ void test__f_type_array_int16s_append_all__works(void **state) { 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_array_length_t i = 0; i < source.used; ++i) { - assert_int_equal(destination.array[i], i + 1); - } // for + 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); - free((void *) destination.array); } -void test__f_type_array_int16s_append_all__returns_data_not(void **state) { +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; @@ -54,27 +57,24 @@ void test__f_type_array_int16s_append_all__returns_data_not(void **state) { 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_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); + assert_int_equal(status, F_none); + assert_int_equal(destination.used, source.used); + assert_int_equal(destination.size, source.used); + + for (f_array_length_t i = 0; i < source.used; ++i) { + assert_int_equal(destination.array[i], i + 1); + } // for } free((void *) source.array); -} - -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)); - } + free((void *) destination.array); } #ifdef __cplusplus 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 index 2a4637c..fb15fff 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__int16s_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int16s_append_all() + * @see f_int16s_append_all() */ -extern void test__f_type_array_int16s_append_all__works(void **state); +extern void test__f_type_array_int16s_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_int16s_append_all() + * @see f_int16s_append_all() */ extern void test__f_type_array_int16s_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int16s_append_all() + * @see f_int16s_append_all() */ -extern void test__f_type_array_int16s_append_all__parameter_checking(void **state); +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 index 9fff75d..fc67c90 100644 --- 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 @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_int16s_decimate_by__works(void **state) { +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_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); + const f_status_t status = f_int16s_decimate_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_int16s_decimate_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_int16s_decimate_by__parameter_checking(void **state) { +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_decimate_by(length, 0); + const f_status_t status = f_int16s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + 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); } 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 index f77b1ae..4341b06 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int16s_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int16s_decimate_by() + * @see f_int16s_decimate_by() */ -extern void test__f_type_array_int16s_decimate_by__works(void **state); +extern void test__f_type_array_int16s_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int16s_decimate_by() + * @see f_int16s_decimate_by() */ -extern void test__f_type_array_int16s_decimate_by__parameter_checking(void **state); +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 index 3d30dc1..b4ac659 100644 --- 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 @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_int16s_decrease_by__works(void **state) { +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_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); + const f_status_t status = f_int16s_decrease_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_int16s_decrease_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_int16s_decrease_by__parameter_checking(void **state) { +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_decrease_by(length, 0); + const f_status_t status = f_int16s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + 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); } 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 index b7a215d..695b227 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int16s_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int16s_decrease_by() + * @see f_int16s_decrease_by() */ -extern void test__f_type_array_int16s_decrease_by__works(void **state); +extern void test__f_type_array_int16s_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int16s_decrease_by() + * @see f_int16s_decrease_by() */ -extern void test__f_type_array_int16s_decrease_by__parameter_checking(void **state); +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 index 0d7fe4b..a10f868 100644 --- 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 @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_int16s_increase__works(void **state) { +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_resize(length, &data); + const f_status_t status = f_int16s_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); 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); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -55,17 +45,27 @@ void test__f_type_array_int16s_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_int16s_increase__parameter_checking(void **state) { +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_increase(length, 0); + const f_status_t status = f_int16s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 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); 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 index 8a9c1cb..9ffab14 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__int16s_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int16s_increase() + * @see f_int16s_increase() */ -extern void test__f_type_array_int16s_increase__works(void **state); +extern void test__f_type_array_int16s_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_int16s_increase() + * @see f_int16s_increase() */ extern void test__f_type_array_int16s_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int16s_increase() + * @see f_int16s_increase() */ -extern void test__f_type_array_int16s_increase__parameter_checking(void **state); +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 index 2f717ae..e33b5a4 100644 --- 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 @@ -5,6 +5,22 @@ 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__works(void **state) { const int length = 5; @@ -31,22 +47,6 @@ void test__f_type_array_int16s_increase_by__works(void **state) { free((void *) data.array); } -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); -} - #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 index 37e7b4d..575753f 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int16s_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int16s_increase_by() + * @see f_int16s_increase_by() */ -extern void test__f_type_array_int16s_increase_by__works(void **state); +extern void test__f_type_array_int16s_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int16s_increase_by() + * @see f_int16s_increase_by() */ -extern void test__f_type_array_int16s_increase_by__parameter_checking(void **state); +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 index c632a9e..9b5c14b 100644 --- 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 @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_int16s_resize__works(void **state) { +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, &data); + const f_status_t status = f_int16s_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_int16s_resize__parameter_checking(void **state) { +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, 0); + const f_status_t status = f_int16s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus 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 index 5f2933e..8fea4d6 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int16s_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int16s_resize() + * @see f_int16s_resize() */ -extern void test__f_type_array_int16s_resize__works(void **state); +extern void test__f_type_array_int16s_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int16s_resize() + * @see f_int16s_resize() */ -extern void test__f_type_array_int16s_resize__parameter_checking(void **state); +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-int16ss_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_adjust.c index 3055b17..336011b 100644 --- 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 @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_int16ss_adjust__works(void **state) { +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, &data); + const f_status_t status = f_int16ss_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_int16ss_adjust__parameter_checking(void **state) { +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, 0); + const f_status_t status = f_int16ss_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus 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 index c241255..d7df551 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int16ss_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int16ss_adjust() + * @see f_int16ss_adjust() */ -extern void test__f_type_array_int16ss_adjust__works(void **state); +extern void test__f_type_array_int16ss_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int16ss_adjust() + * @see f_int16ss_adjust() */ -extern void test__f_type_array_int16ss_adjust__parameter_checking(void **state); +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 index 36ee09d..15eada4 100644 --- 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 @@ -5,7 +5,18 @@ extern "C" { #endif -void test__f_type_array_int16ss_append__works(void **state) { +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; @@ -19,32 +30,19 @@ void test__f_type_array_int16ss_append__works(void **state) { 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_array_length_t i = 0; i < destination.array[0].used; ++i) { - assert_int_equal(destination.array[0].array[i], i + 1); - } // for + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + assert_null(destination.array); } - for (f_array_length_t i = 0; i < destination.used; ++i) { - free((void *) destination.array[i].array); - } // for - free((void *) source.array); - free((void *) destination.array); } -void test__f_type_array_int16ss_append__returns_data_not(void **state) { +void test__f_type_array_int16ss_append__works(void **state) { const int length = 5; f_int16s_t source = f_int16s_t_initialize; @@ -58,27 +56,29 @@ void test__f_type_array_int16ss_append__returns_data_not(void **state) { 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_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__parameter_checking(void **state) { + 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); - f_int16s_t data = f_int16s_t_initialize; + for (f_array_length_t i = 0; i < destination.array[0].used; ++i) { + assert_int_equal(destination.array[0].array[i], i + 1); + } // for + } - { - const f_status_t status = f_int16ss_append(data, 0); + for (f_array_length_t i = 0; i < destination.used; ++i) { + free((void *) destination.array[i].array); + } // for - assert_int_equal(status, F_status_set_error(F_parameter)); - } + free((void *) source.array); + free((void *) destination.array); } #ifdef __cplusplus 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 index 7bab07f..1947eca 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__int16ss_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int16ss_append() + * @see f_int16ss_append() */ -extern void test__f_type_array_int16ss_append__works(void **state); +extern void test__f_type_array_int16ss_append__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_int16ss_append() + * @see f_int16ss_append() */ extern void test__f_type_array_int16ss_append__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int16ss_append() + * @see f_int16ss_append() */ -extern void test__f_type_array_int16ss_append__parameter_checking(void **state); +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 index 08d3123..272af4b 100644 --- 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 @@ -5,6 +5,43 @@ 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; @@ -63,43 +100,6 @@ void test__f_type_array_int16ss_append_all__works(void **state) { free((void *) destination.array); } -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__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)); - } -} - #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 index 8d9fe34..0987037 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__int16ss_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int16ss_append_all() + * @see f_int16ss_append_all() */ -extern void test__f_type_array_int16ss_append_all__works(void **state); +extern void test__f_type_array_int16ss_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_int16ss_append_all() + * @see f_int16ss_append_all() */ extern void test__f_type_array_int16ss_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int16ss_append_all() + * @see f_int16ss_append_all() */ -extern void test__f_type_array_int16ss_append_all__parameter_checking(void **state); +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 index fd7040e..94f8c52 100644 --- 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 @@ -5,10 +5,26 @@ extern "C" { #endif -void test__f_type_array_int16ss_decimate_by__works(void **state) { +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_int16s_t_initialize; + f_int16ss_t data = f_int16ss_t_initialize; { const f_status_t status = f_int16ss_resize(length, &data); @@ -19,25 +35,33 @@ void test__f_type_array_int16ss_decimate_by__works(void **state) { } { - const f_status_t status = f_int16ss_decimate_by(length, &data); + const f_status_t status = f_int16ss_decimate_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_int16ss_decimate_by__parameter_checking(void **state) { +void test__f_type_array_int16ss_decimate_by__works(void **state) { const int length = 5; - f_int16ss_t data = f_int16s_t_initialize; + f_int16ss_t data = f_int16ss_t_initialize; { - const f_status_t status = f_int16ss_decimate_by(length, 0); + const f_status_t status = f_int16ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + 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); } 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 index 2bd7c2f..2fd1103 100644 --- 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 @@ -11,17 +11,24 @@ #define _TEST__F_type_array__int16ss_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int16ss_decimate_by() + * @see f_int16ss_decimate_by() */ -extern void test__f_type_array_int16ss_decimate_by__works(void **state); +extern void test__f_type_array_int16ss_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * * @see f_type_array_int16ss_decimate_by() */ -extern void test__f_type_array_int16ss_decimate_by__parameter_checking(void **state); +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 index ed3a454..e733e00 100644 --- 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 @@ -5,10 +5,26 @@ extern "C" { #endif -void test__f_type_array_int16ss_decrease_by__works(void **state) { +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_int16s_t_initialize; + f_int16ss_t data = f_int16ss_t_initialize; { const f_status_t status = f_int16ss_resize(length, &data); @@ -19,25 +35,33 @@ void test__f_type_array_int16ss_decrease_by__works(void **state) { } { - const f_status_t status = f_int16ss_decrease_by(length, &data); + const f_status_t status = f_int16ss_decrease_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_int16ss_decrease_by__parameter_checking(void **state) { +void test__f_type_array_int16ss_decrease_by__works(void **state) { const int length = 5; - f_int16ss_t data = f_int16s_t_initialize; + f_int16ss_t data = f_int16ss_t_initialize; { - const f_status_t status = f_int16ss_decrease_by(length, 0); + const f_status_t status = f_int16ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + 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); } 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 index f5d687a..e63f6db 100644 --- 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 @@ -11,17 +11,24 @@ #define _TEST__F_type_array__int16ss_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int16ss_decrease_by() + * @see f_int16ss_decrease_by() */ -extern void test__f_type_array_int16ss_decrease_by__works(void **state); +extern void test__f_type_array_int16ss_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_int16ss_decrease_by() + * @see f_int16ss_decrease_by() */ -extern void test__f_type_array_int16ss_decrease_by__parameter_checking(void **state); +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 index f1d8273..a9b2ea9 100644 --- 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 @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_int16ss_increase__works(void **state) { +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_resize(length, &data); + const f_status_t status = f_int16ss_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); 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); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -34,7 +24,7 @@ void test__f_type_array_int16ss_increase__works(void **state) { void test__f_type_array_int16ss_increase__returns_data_not(void **state) { const int length = 5; - f_int16ss_t data = f_int16s_t_initialize; + f_int16ss_t data = f_int16ss_t_initialize; { const f_status_t status = f_int16ss_resize(length, &data); @@ -55,17 +45,27 @@ void test__f_type_array_int16ss_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_int16ss_increase__parameter_checking(void **state) { +void test__f_type_array_int16ss_increase__works(void **state) { const int length = 5; - f_int16ss_t data = f_int16s_t_initialize; + f_int16ss_t data = f_int16ss_t_initialize; { - const f_status_t status = f_int16ss_increase(length, 0); + const f_status_t status = f_int16ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 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); 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 index c0b275d..9824f00 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__int16ss_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int16ss_increase() + * @see f_int16ss_increase() */ -extern void test__f_type_array_int16ss_increase__works(void **state); +extern void test__f_type_array_int16ss_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_int16ss_increase() + * @see f_int16ss_increase() */ extern void test__f_type_array_int16ss_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int16ss_increase() + * @see f_int16ss_increase() */ -extern void test__f_type_array_int16ss_increase__parameter_checking(void **state); +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 index cbb4a29..290ac70 100644 --- 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 @@ -5,10 +5,26 @@ extern "C" { #endif -void test__f_type_array_int16ss_increase_by__works(void **state) { +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_int16s_t_initialize; + f_int16ss_t data = f_int16ss_t_initialize; { const f_status_t status = f_int16ss_resize(length, &data); @@ -19,32 +35,72 @@ void test__f_type_array_int16ss_increase_by__works(void **state) { } { - data.used = 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_array_length_decrease_by__returns_data_not(void **state) { + + const int length = 5; + f_array_lengthss_t data = f_array_lengthss_t_initialize; + + { + const f_status_t status = f_array_lengthss_resize(length, &data); + assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_array_lengthss_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_increase_by__parameter_checking(void **state) { +void test__f_type_array_int16ss_increase_by__works(void **state) { const int length = 5; - f_int16ss_t data = f_int16s_t_initialize; + f_int16ss_t data = f_int16ss_t_initialize; { - const f_status_t status = f_int16ss_increase_by(length, 0); + const f_status_t status = f_int16ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + { + 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 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 index 78956ec..854d907 100644 --- 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 @@ -11,17 +11,24 @@ #define _TEST__F_type_array__int16ss_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int16ss_increase_by() + * @see f_int16ss_increase_by() */ -extern void test__f_type_array_int16ss_increase_by__works(void **state); +extern void test__f_type_array_int16ss_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_int16ss_increase_by() + * @see f_int16ss_increase_by() */ -extern void test__f_type_array_int16ss_increase_by__parameter_checking(void **state); +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 index 7a4e892..c5ce865 100644 --- 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 @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_int16ss_resize__works(void **state) { +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, &data); + const f_status_t status = f_int16ss_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_int16ss_resize__parameter_checking(void **state) { +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, 0); + const f_status_t status = f_int16ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus 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 index 6f962b7..3c2d839 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int16ss_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int16ss_resize() + * @see f_int16ss_resize() */ -extern void test__f_type_array_int16ss_resize__works(void **state); +extern void test__f_type_array_int16ss_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int16ss_resize() + * @see f_int16ss_resize() */ -extern void test__f_type_array_int16ss_resize__parameter_checking(void **state); +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 index 8aafe65..7f0012e 100644 --- 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 @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_int32s_adjust__works(void **state) { +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, &data); + const f_status_t status = f_int32s_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_int32s_adjust__parameter_checking(void **state) { +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, 0); + const f_status_t status = f_int32s_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus 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 index 913daa8..e731821 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int32s_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int32s_adjust() + * @see f_int32s_adjust() */ -extern void test__f_type_array_int32s_adjust__works(void **state); +extern void test__f_type_array_int32s_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int32s_adjust() + * @see f_int32s_adjust() */ -extern void test__f_type_array_int32s_adjust__parameter_checking(void **state); +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_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_append.c index c384176..9cd73cf 100644 --- 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 @@ -5,6 +5,17 @@ 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; @@ -21,17 +32,6 @@ void test__f_type_array_int32s_append__works(void **state) { free((void *) destination.array); } -void test__f_type_array_int32s_append__parameter_checking(void **state) { - - const uint32_t data = 0; - - { - const f_status_t status = f_int32s_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - #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 index 4c22e28..dd22e01 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int32s_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int32s_append() + * @see f_int32s_append() */ -extern void test__f_type_array_int32s_append__works(void **state); +extern void test__f_type_array_int32s_append__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int32s_append() + * @see f_int32s_append() */ -extern void test__f_type_array_int32s_append__parameter_checking(void **state); +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 index dc8bfbc..6801fba 100644 --- 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 @@ -5,10 +5,20 @@ extern "C" { #endif -void test__f_type_array_int32s_append_all__works(void **state) { +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; - const int length_used = 2; f_int32s_t source = f_int32s_t_initialize; f_int32s_t destination = f_int32s_t_initialize; @@ -20,29 +30,22 @@ void test__f_type_array_int32s_append_all__works(void **state) { 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_array_length_t i = 0; i < source.used; ++i) { - assert_int_equal(destination.array[i], i + 1); - } // for + 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); - free((void *) destination.array); } -void test__f_type_array_int32s_append_all__returns_data_not(void **state) { +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; @@ -54,27 +57,24 @@ void test__f_type_array_int32s_append_all__returns_data_not(void **state) { 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_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); + assert_int_equal(status, F_none); + assert_int_equal(destination.used, source.used); + assert_int_equal(destination.size, source.used); + + for (f_array_length_t i = 0; i < source.used; ++i) { + assert_int_equal(destination.array[i], i + 1); + } // for } free((void *) source.array); -} - -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)); - } + free((void *) destination.array); } #ifdef __cplusplus 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 index ed79d51..d45982d 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__int32s_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int32s_append_all() + * @see f_int32s_append_all() */ -extern void test__f_type_array_int32s_append_all__works(void **state); +extern void test__f_type_array_int32s_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_int32s_append_all() + * @see f_int32s_append_all() */ extern void test__f_type_array_int32s_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int32s_append_all() + * @see f_int32s_append_all() */ -extern void test__f_type_array_int32s_append_all__parameter_checking(void **state); +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 index d6b5032..c7ad479 100644 --- 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 @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_int32s_decimate_by__works(void **state) { +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_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); + const f_status_t status = f_int32s_decimate_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_int32s_decimate_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_int32s_decimate_by__parameter_checking(void **state) { +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_decimate_by(length, 0); + const f_status_t status = f_int32s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + 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); } 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 index ee9a6af..f6e6e0d 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int32s_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int32s_decimate_by() + * @see f_int32s_decimate_by() */ -extern void test__f_type_array_int32s_decimate_by__works(void **state); +extern void test__f_type_array_int32s_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int32s_decimate_by() + * @see f_int32s_decimate_by() */ -extern void test__f_type_array_int32s_decimate_by__parameter_checking(void **state); +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 index 71279a4..0eec161 100644 --- 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 @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_int32s_decrease_by__works(void **state) { +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_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); + const f_status_t status = f_int32s_decrease_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_int32s_decrease_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_int32s_decrease_by__parameter_checking(void **state) { +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_decrease_by(length, 0); + const f_status_t status = f_int32s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + 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); } 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 index ed428af..93be3e1 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int32s_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int32s_decrease_by() + * @see f_int32s_decrease_by() */ -extern void test__f_type_array_int32s_decrease_by__works(void **state); +extern void test__f_type_array_int32s_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int32s_decrease_by() + * @see f_int32s_decrease_by() */ -extern void test__f_type_array_int32s_decrease_by__parameter_checking(void **state); +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 index a6d4022..a21f42b 100644 --- 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 @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_int32s_increase__works(void **state) { +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_resize(length, &data); + const f_status_t status = f_int32s_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); 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); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -55,17 +45,27 @@ void test__f_type_array_int32s_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_int32s_increase__parameter_checking(void **state) { +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_increase(length, 0); + const f_status_t status = f_int32s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 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); 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 index 7fe8cf5..95ca4c5 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__int32s_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int32s_increase() + * @see f_int32s_increase() */ -extern void test__f_type_array_int32s_increase__works(void **state); +extern void test__f_type_array_int32s_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_int32s_increase() + * @see f_int32s_increase() */ extern void test__f_type_array_int32s_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int32s_increase() + * @see f_int32s_increase() */ -extern void test__f_type_array_int32s_increase__parameter_checking(void **state); +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 index c89ce82..2f609af 100644 --- 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 @@ -5,6 +5,22 @@ 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__works(void **state) { const int length = 5; @@ -31,22 +47,6 @@ void test__f_type_array_int32s_increase_by__works(void **state) { free((void *) data.array); } -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); -} - #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 index 8be454e..0f7ea16 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int32s_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int32s_increase_by() + * @see f_int32s_increase_by() */ -extern void test__f_type_array_int32s_increase_by__works(void **state); +extern void test__f_type_array_int32s_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int32s_increase_by() + * @see f_int32s_increase_by() */ -extern void test__f_type_array_int32s_increase_by__parameter_checking(void **state); +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 index fdc0204..eca19f6 100644 --- 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 @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_int32s_resize__works(void **state) { +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, &data); + const f_status_t status = f_int32s_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_int32s_resize__parameter_checking(void **state) { +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, 0); + const f_status_t status = f_int32s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus 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 index 82f054e..a878c6b 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int32s_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int32s_resize() + * @see f_int32s_resize() */ -extern void test__f_type_array_int32s_resize__works(void **state); +extern void test__f_type_array_int32s_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int32s_resize() + * @see f_int32s_resize() */ -extern void test__f_type_array_int32s_resize__parameter_checking(void **state); +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-int32ss_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_adjust.c index a973a03..33de391 100644 --- 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 @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_int32ss_adjust__works(void **state) { +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, &data); + const f_status_t status = f_int32ss_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_int32ss_adjust__parameter_checking(void **state) { +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, 0); + const f_status_t status = f_int32ss_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus 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 index a105b7b..782bbf2 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int32ss_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int32ss_adjust() + * @see f_int32ss_adjust() */ -extern void test__f_type_array_int32ss_adjust__works(void **state); +extern void test__f_type_array_int32ss_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int32ss_adjust() + * @see f_int32ss_adjust() */ -extern void test__f_type_array_int32ss_adjust__parameter_checking(void **state); +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 index b4d67f9..6f1696b 100644 --- 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 @@ -5,7 +5,18 @@ extern "C" { #endif -void test__f_type_array_int32ss_append__works(void **state) { +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; @@ -19,32 +30,19 @@ void test__f_type_array_int32ss_append__works(void **state) { 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_array_length_t i = 0; i < destination.array[0].used; ++i) { - assert_int_equal(destination.array[0].array[i], i + 1); - } // for + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + assert_null(destination.array); } - for (f_array_length_t i = 0; i < destination.used; ++i) { - free((void *) destination.array[i].array); - } // for - free((void *) source.array); - free((void *) destination.array); } -void test__f_type_array_int32ss_append__returns_data_not(void **state) { +void test__f_type_array_int32ss_append__works(void **state) { const int length = 5; f_int32s_t source = f_int32s_t_initialize; @@ -58,27 +56,29 @@ void test__f_type_array_int32ss_append__returns_data_not(void **state) { 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_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__parameter_checking(void **state) { + 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); - f_int32s_t data = f_int32s_t_initialize; + for (f_array_length_t i = 0; i < destination.array[0].used; ++i) { + assert_int_equal(destination.array[0].array[i], i + 1); + } // for + } - { - const f_status_t status = f_int32ss_append(data, 0); + for (f_array_length_t i = 0; i < destination.used; ++i) { + free((void *) destination.array[i].array); + } // for - assert_int_equal(status, F_status_set_error(F_parameter)); - } + free((void *) source.array); + free((void *) destination.array); } #ifdef __cplusplus 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 index 5d56e68..4358695 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__int32ss_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int32ss_append() + * @see f_int32ss_append() */ -extern void test__f_type_array_int32ss_append__works(void **state); +extern void test__f_type_array_int32ss_append__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_int32ss_append() + * @see f_int32ss_append() */ extern void test__f_type_array_int32ss_append__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int32ss_append() + * @see f_int32ss_append() */ -extern void test__f_type_array_int32ss_append__parameter_checking(void **state); +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 index c002afa..f7a5201 100644 --- 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 @@ -5,6 +5,43 @@ 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; @@ -63,43 +100,6 @@ void test__f_type_array_int32ss_append_all__works(void **state) { free((void *) destination.array); } -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__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)); - } -} - #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 index 8aaeae7..66b63aa 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__int32ss_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int32ss_append_all() + * @see f_int32ss_append_all() */ -extern void test__f_type_array_int32ss_append_all__works(void **state); +extern void test__f_type_array_int32ss_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_int32ss_append_all() + * @see f_int32ss_append_all() */ extern void test__f_type_array_int32ss_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int32ss_append_all() + * @see f_int32ss_append_all() */ -extern void test__f_type_array_int32ss_append_all__parameter_checking(void **state); +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 index 0fdb7e5..2b16cc7 100644 --- 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 @@ -5,10 +5,26 @@ extern "C" { #endif -void test__f_type_array_int32ss_decimate_by__works(void **state) { +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_int32s_t_initialize; + f_int32ss_t data = f_int32ss_t_initialize; { const f_status_t status = f_int32ss_resize(length, &data); @@ -19,25 +35,33 @@ void test__f_type_array_int32ss_decimate_by__works(void **state) { } { - const f_status_t status = f_int32ss_decimate_by(length, &data); + const f_status_t status = f_int32ss_decimate_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_int32ss_decimate_by__parameter_checking(void **state) { +void test__f_type_array_int32ss_decimate_by__works(void **state) { const int length = 5; - f_int32ss_t data = f_int32s_t_initialize; + f_int32ss_t data = f_int32ss_t_initialize; { - const f_status_t status = f_int32ss_decimate_by(length, 0); + const f_status_t status = f_int32ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + 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); } 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 index 2fc576d..ac363c4 100644 --- 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 @@ -11,17 +11,24 @@ #define _TEST__F_type_array__int32ss_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int32ss_decimate_by() + * @see f_int32ss_decimate_by() */ -extern void test__f_type_array_int32ss_decimate_by__works(void **state); +extern void test__f_type_array_int32ss_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * * @see f_type_array_int32ss_decimate_by() */ -extern void test__f_type_array_int32ss_decimate_by__parameter_checking(void **state); +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 index 99a0826..575bd12 100644 --- 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 @@ -5,10 +5,26 @@ extern "C" { #endif -void test__f_type_array_int32ss_decrease_by__works(void **state) { +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_int32s_t_initialize; + f_int32ss_t data = f_int32ss_t_initialize; { const f_status_t status = f_int32ss_resize(length, &data); @@ -19,25 +35,33 @@ void test__f_type_array_int32ss_decrease_by__works(void **state) { } { - const f_status_t status = f_int32ss_decrease_by(length, &data); + const f_status_t status = f_int32ss_decrease_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_int32ss_decrease_by__parameter_checking(void **state) { +void test__f_type_array_int32ss_decrease_by__works(void **state) { const int length = 5; - f_int32ss_t data = f_int32s_t_initialize; + f_int32ss_t data = f_int32ss_t_initialize; { - const f_status_t status = f_int32ss_decrease_by(length, 0); + const f_status_t status = f_int32ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + 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); } 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 index 9fa8247..186c1da 100644 --- 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 @@ -11,17 +11,24 @@ #define _TEST__F_type_array__int32ss_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int32ss_decrease_by() + * @see f_int32ss_decrease_by() */ -extern void test__f_type_array_int32ss_decrease_by__works(void **state); +extern void test__f_type_array_int32ss_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_int32ss_decrease_by() + * @see f_int32ss_decrease_by() */ -extern void test__f_type_array_int32ss_decrease_by__parameter_checking(void **state); +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 index a3160a4..cf6c381 100644 --- 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 @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_int32ss_increase__works(void **state) { +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_resize(length, &data); + const f_status_t status = f_int32ss_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); 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); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -34,7 +24,7 @@ void test__f_type_array_int32ss_increase__works(void **state) { void test__f_type_array_int32ss_increase__returns_data_not(void **state) { const int length = 5; - f_int32ss_t data = f_int32s_t_initialize; + f_int32ss_t data = f_int32ss_t_initialize; { const f_status_t status = f_int32ss_resize(length, &data); @@ -55,17 +45,27 @@ void test__f_type_array_int32ss_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_int32ss_increase__parameter_checking(void **state) { +void test__f_type_array_int32ss_increase__works(void **state) { const int length = 5; - f_int32ss_t data = f_int32s_t_initialize; + f_int32ss_t data = f_int32ss_t_initialize; { - const f_status_t status = f_int32ss_increase(length, 0); + const f_status_t status = f_int32ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 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); 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 index ae844df..38440e7 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__int32ss_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int32ss_increase() + * @see f_int32ss_increase() */ -extern void test__f_type_array_int32ss_increase__works(void **state); +extern void test__f_type_array_int32ss_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_int32ss_increase() + * @see f_int32ss_increase() */ extern void test__f_type_array_int32ss_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int32ss_increase() + * @see f_int32ss_increase() */ -extern void test__f_type_array_int32ss_increase__parameter_checking(void **state); +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 index 47f49fd..ac607fa 100644 --- 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 @@ -5,10 +5,26 @@ extern "C" { #endif -void test__f_type_array_int32ss_increase_by__works(void **state) { +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_int32s_t_initialize; + f_int32ss_t data = f_int32ss_t_initialize; { const f_status_t status = f_int32ss_resize(length, &data); @@ -19,32 +35,48 @@ void test__f_type_array_int32ss_increase_by__works(void **state) { } { - data.used = 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_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); + 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__parameter_checking(void **state) { +void test__f_type_array_int32ss_increase_by__works(void **state) { const int length = 5; - f_int32ss_t data = f_int32s_t_initialize; + f_int32ss_t data = f_int32ss_t_initialize; { - const f_status_t status = f_int32ss_increase_by(length, 0); + const f_status_t status = f_int32ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + { + 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 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 index e2ec6e5..f89d2d1 100644 --- 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 @@ -11,17 +11,24 @@ #define _TEST__F_type_array__int32ss_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int32ss_increase_by() + * @see f_int32ss_increase_by() */ -extern void test__f_type_array_int32ss_increase_by__works(void **state); +extern void test__f_type_array_int32ss_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_int32ss_increase_by() + * @see f_int32ss_increase_by() */ -extern void test__f_type_array_int32ss_increase_by__parameter_checking(void **state); +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 index c53d81e..64b38cf 100644 --- 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 @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_int32ss_resize__works(void **state) { +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, &data); + const f_status_t status = f_int32ss_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_int32ss_resize__parameter_checking(void **state) { +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, 0); + const f_status_t status = f_int32ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus 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 index 32e26a8..1a5aa07 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int32ss_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int32ss_resize() + * @see f_int32ss_resize() */ -extern void test__f_type_array_int32ss_resize__works(void **state); +extern void test__f_type_array_int32ss_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int32ss_resize() + * @see f_int32ss_resize() */ -extern void test__f_type_array_int32ss_resize__parameter_checking(void **state); +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 index 252565b..5e0237e 100644 --- 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 @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_int64s_adjust__works(void **state) { +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, &data); + const f_status_t status = f_int64s_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_int64s_adjust__parameter_checking(void **state) { +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, 0); + const f_status_t status = f_int64s_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus 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 index fca10f4..e9b25fa 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int64s_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int64s_adjust() + * @see f_int64s_adjust() */ -extern void test__f_type_array_int64s_adjust__works(void **state); +extern void test__f_type_array_int64s_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int64s_adjust() + * @see f_int64s_adjust() */ -extern void test__f_type_array_int64s_adjust__parameter_checking(void **state); +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_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_append.c index 2515eeb..0600e9d 100644 --- 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 @@ -5,6 +5,17 @@ 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; @@ -21,17 +32,6 @@ void test__f_type_array_int64s_append__works(void **state) { free((void *) destination.array); } -void test__f_type_array_int64s_append__parameter_checking(void **state) { - - const uint64_t data = 0; - - { - const f_status_t status = f_int64s_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - #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 index 050b258..73de0dc 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int64s_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int64s_append() + * @see f_int64s_append() */ -extern void test__f_type_array_int64s_append__works(void **state); +extern void test__f_type_array_int64s_append__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int64s_append() + * @see f_int64s_append() */ -extern void test__f_type_array_int64s_append__parameter_checking(void **state); +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 index dae1f31..90183c9 100644 --- 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 @@ -5,10 +5,20 @@ extern "C" { #endif -void test__f_type_array_int64s_append_all__works(void **state) { +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; - const int length_used = 2; f_int64s_t source = f_int64s_t_initialize; f_int64s_t destination = f_int64s_t_initialize; @@ -20,29 +30,22 @@ void test__f_type_array_int64s_append_all__works(void **state) { 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_array_length_t i = 0; i < source.used; ++i) { - assert_int_equal(destination.array[i], i + 1); - } // for + 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); - free((void *) destination.array); } -void test__f_type_array_int64s_append_all__returns_data_not(void **state) { +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; @@ -54,27 +57,24 @@ void test__f_type_array_int64s_append_all__returns_data_not(void **state) { 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_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); + assert_int_equal(status, F_none); + assert_int_equal(destination.used, source.used); + assert_int_equal(destination.size, source.used); + + for (f_array_length_t i = 0; i < source.used; ++i) { + assert_int_equal(destination.array[i], i + 1); + } // for } free((void *) source.array); -} - -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)); - } + free((void *) destination.array); } #ifdef __cplusplus 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 index ae20d0c..3171f1c 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__int64s_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int64s_append_all() + * @see f_int64s_append_all() */ -extern void test__f_type_array_int64s_append_all__works(void **state); +extern void test__f_type_array_int64s_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_int64s_append_all() + * @see f_int64s_append_all() */ extern void test__f_type_array_int64s_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int64s_append_all() + * @see f_int64s_append_all() */ -extern void test__f_type_array_int64s_append_all__parameter_checking(void **state); +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 index 18cb0f7..a5be8d8 100644 --- 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 @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_int64s_decimate_by__works(void **state) { +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_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); + const f_status_t status = f_int64s_decimate_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_int64s_decimate_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_int64s_decimate_by__parameter_checking(void **state) { +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_decimate_by(length, 0); + const f_status_t status = f_int64s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + 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); } 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 index 3cd695b..feeb67d 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int64s_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int64s_decimate_by() + * @see f_int64s_decimate_by() */ -extern void test__f_type_array_int64s_decimate_by__works(void **state); +extern void test__f_type_array_int64s_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int64s_decimate_by() + * @see f_int64s_decimate_by() */ -extern void test__f_type_array_int64s_decimate_by__parameter_checking(void **state); +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 index 93d4de8..581f31e 100644 --- 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 @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_int64s_decrease_by__works(void **state) { +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_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); + const f_status_t status = f_int64s_decrease_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_int64s_decrease_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_int64s_decrease_by__parameter_checking(void **state) { +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_decrease_by(length, 0); + const f_status_t status = f_int64s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + 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); } 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 index 9f7fcdc..4c3511c 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int64s_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int64s_decrease_by() + * @see f_int64s_decrease_by() */ -extern void test__f_type_array_int64s_decrease_by__works(void **state); +extern void test__f_type_array_int64s_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int64s_decrease_by() + * @see f_int64s_decrease_by() */ -extern void test__f_type_array_int64s_decrease_by__parameter_checking(void **state); +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 index 2aaf4f5..bd4cab6 100644 --- 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 @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_int64s_increase__works(void **state) { +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_resize(length, &data); + const f_status_t status = f_int64s_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); 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); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -55,17 +45,27 @@ void test__f_type_array_int64s_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_int64s_increase__parameter_checking(void **state) { +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_increase(length, 0); + const f_status_t status = f_int64s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 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); 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 index ec62ee0..be94a2b 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__int64s_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int64s_increase() + * @see f_int64s_increase() */ -extern void test__f_type_array_int64s_increase__works(void **state); +extern void test__f_type_array_int64s_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_int64s_increase() + * @see f_int64s_increase() */ extern void test__f_type_array_int64s_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int64s_increase() + * @see f_int64s_increase() */ -extern void test__f_type_array_int64s_increase__parameter_checking(void **state); +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 index 7749300..2ce8ad6 100644 --- 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 @@ -5,6 +5,22 @@ 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__works(void **state) { const int length = 5; @@ -31,22 +47,6 @@ void test__f_type_array_int64s_increase_by__works(void **state) { free((void *) data.array); } -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); -} - #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 index f8bd91a..fa02bad 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int64s_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int64s_increase_by() + * @see f_int64s_increase_by() */ -extern void test__f_type_array_int64s_increase_by__works(void **state); +extern void test__f_type_array_int64s_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int64s_increase_by() + * @see f_int64s_increase_by() */ -extern void test__f_type_array_int64s_increase_by__parameter_checking(void **state); +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 index f2cf58d..1286b86 100644 --- 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 @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_int64s_resize__works(void **state) { +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, &data); + const f_status_t status = f_int64s_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_int64s_resize__parameter_checking(void **state) { +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, 0); + const f_status_t status = f_int64s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus 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 index 7de4876..e4b5604 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int64s_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int64s_resize() + * @see f_int64s_resize() */ -extern void test__f_type_array_int64s_resize__works(void **state); +extern void test__f_type_array_int64s_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int64s_resize() + * @see f_int64s_resize() */ -extern void test__f_type_array_int64s_resize__parameter_checking(void **state); +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-int64ss_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_adjust.c index 5bb533e..92a11fa 100644 --- 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 @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_int64ss_adjust__works(void **state) { +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, &data); + const f_status_t status = f_int64ss_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_int64ss_adjust__parameter_checking(void **state) { +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, 0); + const f_status_t status = f_int64ss_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus 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 index af32364..8b26926 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int64ss_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int64ss_adjust() + * @see f_int64ss_adjust() */ -extern void test__f_type_array_int64ss_adjust__works(void **state); +extern void test__f_type_array_int64ss_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int64ss_adjust() + * @see f_int64ss_adjust() */ -extern void test__f_type_array_int64ss_adjust__parameter_checking(void **state); +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 index f0bba2e..c69dc5a 100644 --- 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 @@ -5,7 +5,18 @@ extern "C" { #endif -void test__f_type_array_int64ss_append__works(void **state) { +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; @@ -19,32 +30,19 @@ void test__f_type_array_int64ss_append__works(void **state) { 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_array_length_t i = 0; i < destination.array[0].used; ++i) { - assert_int_equal(destination.array[0].array[i], i + 1); - } // for + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + assert_null(destination.array); } - for (f_array_length_t i = 0; i < destination.used; ++i) { - free((void *) destination.array[i].array); - } // for - free((void *) source.array); - free((void *) destination.array); } -void test__f_type_array_int64ss_append__returns_data_not(void **state) { +void test__f_type_array_int64ss_append__works(void **state) { const int length = 5; f_int64s_t source = f_int64s_t_initialize; @@ -58,27 +56,29 @@ void test__f_type_array_int64ss_append__returns_data_not(void **state) { 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_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__parameter_checking(void **state) { + 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); - f_int64s_t data = f_int64s_t_initialize; + for (f_array_length_t i = 0; i < destination.array[0].used; ++i) { + assert_int_equal(destination.array[0].array[i], i + 1); + } // for + } - { - const f_status_t status = f_int64ss_append(data, 0); + for (f_array_length_t i = 0; i < destination.used; ++i) { + free((void *) destination.array[i].array); + } // for - assert_int_equal(status, F_status_set_error(F_parameter)); - } + free((void *) source.array); + free((void *) destination.array); } #ifdef __cplusplus 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 index 69065b9..d60a6e9 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__int64ss_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int64ss_append() + * @see f_int64ss_append() */ -extern void test__f_type_array_int64ss_append__works(void **state); +extern void test__f_type_array_int64ss_append__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_int64ss_append() + * @see f_int64ss_append() */ extern void test__f_type_array_int64ss_append__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int64ss_append() + * @see f_int64ss_append() */ -extern void test__f_type_array_int64ss_append__parameter_checking(void **state); +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 index bd4b667..f2f53e6 100644 --- 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 @@ -5,6 +5,43 @@ 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; @@ -63,43 +100,6 @@ void test__f_type_array_int64ss_append_all__works(void **state) { free((void *) destination.array); } -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__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)); - } -} - #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 index 6052ec5..abc9284 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__int64ss_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int64ss_append_all() + * @see f_int64ss_append_all() */ -extern void test__f_type_array_int64ss_append_all__works(void **state); +extern void test__f_type_array_int64ss_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_int64ss_append_all() + * @see f_int64ss_append_all() */ extern void test__f_type_array_int64ss_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int64ss_append_all() + * @see f_int64ss_append_all() */ -extern void test__f_type_array_int64ss_append_all__parameter_checking(void **state); +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 index 03567e8..cf0e34d 100644 --- 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 @@ -5,10 +5,26 @@ extern "C" { #endif -void test__f_type_array_int64ss_decimate_by__works(void **state) { +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_int64s_t_initialize; + f_int64ss_t data = f_int64ss_t_initialize; { const f_status_t status = f_int64ss_resize(length, &data); @@ -19,25 +35,33 @@ void test__f_type_array_int64ss_decimate_by__works(void **state) { } { - const f_status_t status = f_int64ss_decimate_by(length, &data); + const f_status_t status = f_int64ss_decimate_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_int64ss_decimate_by__parameter_checking(void **state) { +void test__f_type_array_int64ss_decimate_by__works(void **state) { const int length = 5; - f_int64ss_t data = f_int64s_t_initialize; + f_int64ss_t data = f_int64ss_t_initialize; { - const f_status_t status = f_int64ss_decimate_by(length, 0); + const f_status_t status = f_int64ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + 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); } 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 index a813fff..00445e7 100644 --- 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 @@ -11,17 +11,24 @@ #define _TEST__F_type_array__int64ss_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int64ss_decimate_by() + * @see f_int64ss_decimate_by() */ -extern void test__f_type_array_int64ss_decimate_by__works(void **state); +extern void test__f_type_array_int64ss_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * * @see f_type_array_int64ss_decimate_by() */ -extern void test__f_type_array_int64ss_decimate_by__parameter_checking(void **state); +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 index f2909c0..d93f5e2 100644 --- 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 @@ -5,10 +5,26 @@ extern "C" { #endif -void test__f_type_array_int64ss_decrease_by__works(void **state) { +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_int64s_t_initialize; + f_int64ss_t data = f_int64ss_t_initialize; { const f_status_t status = f_int64ss_resize(length, &data); @@ -19,25 +35,33 @@ void test__f_type_array_int64ss_decrease_by__works(void **state) { } { - const f_status_t status = f_int64ss_decrease_by(length, &data); + const f_status_t status = f_int64ss_decrease_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_int64ss_decrease_by__parameter_checking(void **state) { +void test__f_type_array_int64ss_decrease_by__works(void **state) { const int length = 5; - f_int64ss_t data = f_int64s_t_initialize; + f_int64ss_t data = f_int64ss_t_initialize; { - const f_status_t status = f_int64ss_decrease_by(length, 0); + const f_status_t status = f_int64ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + 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); } 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 index 966ce27..b318681 100644 --- 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 @@ -11,17 +11,24 @@ #define _TEST__F_type_array__int64ss_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int64ss_decrease_by() + * @see f_int64ss_decrease_by() */ -extern void test__f_type_array_int64ss_decrease_by__works(void **state); +extern void test__f_type_array_int64ss_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_int64ss_decrease_by() + * @see f_int64ss_decrease_by() */ -extern void test__f_type_array_int64ss_decrease_by__parameter_checking(void **state); +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 index b0e7054..f252134 100644 --- 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 @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_int64ss_increase__works(void **state) { +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_resize(length, &data); + const f_status_t status = f_int64ss_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); 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); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -34,7 +24,7 @@ void test__f_type_array_int64ss_increase__works(void **state) { void test__f_type_array_int64ss_increase__returns_data_not(void **state) { const int length = 5; - f_int64ss_t data = f_int64s_t_initialize; + f_int64ss_t data = f_int64ss_t_initialize; { const f_status_t status = f_int64ss_resize(length, &data); @@ -55,17 +45,27 @@ void test__f_type_array_int64ss_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_int64ss_increase__parameter_checking(void **state) { +void test__f_type_array_int64ss_increase__works(void **state) { const int length = 5; - f_int64ss_t data = f_int64s_t_initialize; + f_int64ss_t data = f_int64ss_t_initialize; { - const f_status_t status = f_int64ss_increase(length, 0); + const f_status_t status = f_int64ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 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); 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 index 2549016..a1e802a 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__int64ss_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int64ss_increase() + * @see f_int64ss_increase() */ -extern void test__f_type_array_int64ss_increase__works(void **state); +extern void test__f_type_array_int64ss_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_int64ss_increase() + * @see f_int64ss_increase() */ extern void test__f_type_array_int64ss_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int64ss_increase() + * @see f_int64ss_increase() */ -extern void test__f_type_array_int64ss_increase__parameter_checking(void **state); +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 index 206def8..27238ba 100644 --- 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 @@ -5,10 +5,26 @@ extern "C" { #endif -void test__f_type_array_int64ss_increase_by__works(void **state) { +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_int64s_t_initialize; + f_int64ss_t data = f_int64ss_t_initialize; { const f_status_t status = f_int64ss_resize(length, &data); @@ -19,32 +35,48 @@ void test__f_type_array_int64ss_increase_by__works(void **state) { } { - data.used = 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_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); + 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__parameter_checking(void **state) { +void test__f_type_array_int64ss_increase_by__works(void **state) { const int length = 5; - f_int64ss_t data = f_int64s_t_initialize; + f_int64ss_t data = f_int64ss_t_initialize; { - const f_status_t status = f_int64ss_increase_by(length, 0); + const f_status_t status = f_int64ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + { + 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 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 index 689f658..62fe611 100644 --- 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 @@ -11,17 +11,24 @@ #define _TEST__F_type_array__int64ss_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int64ss_increase_by() + * @see f_int64ss_increase_by() */ -extern void test__f_type_array_int64ss_increase_by__works(void **state); +extern void test__f_type_array_int64ss_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_int64ss_increase_by() + * @see f_int64ss_increase_by() */ -extern void test__f_type_array_int64ss_increase_by__parameter_checking(void **state); +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 index cceffaf..65b19ea 100644 --- 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 @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_int64ss_resize__works(void **state) { +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, &data); + const f_status_t status = f_int64ss_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_int64ss_resize__parameter_checking(void **state) { +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, 0); + const f_status_t status = f_int64ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus 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 index 4d85702..16eaef9 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int64ss_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int64ss_resize() + * @see f_int64ss_resize() */ -extern void test__f_type_array_int64ss_resize__works(void **state); +extern void test__f_type_array_int64ss_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int64ss_resize() + * @see f_int64ss_resize() */ -extern void test__f_type_array_int64ss_resize__parameter_checking(void **state); +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 index f857eb0..ff4db01 100644 --- 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 @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_int8s_adjust__works(void **state) { +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, &data); + const f_status_t status = f_int8s_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_int8s_adjust__parameter_checking(void **state) { +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, 0); + const f_status_t status = f_int8s_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus 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 index 6fea315..cd772f5 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int8s_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int8s_adjust() + * @see f_int8s_adjust() */ -extern void test__f_type_array_int8s_adjust__works(void **state); +extern void test__f_type_array_int8s_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int8s_adjust() + * @see f_int8s_adjust() */ -extern void test__f_type_array_int8s_adjust__parameter_checking(void **state); +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_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_append.c index 8412a3e..1eef1ea 100644 --- 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 @@ -5,6 +5,17 @@ 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; @@ -21,17 +32,6 @@ void test__f_type_array_int8s_append__works(void **state) { free((void *) destination.array); } -void test__f_type_array_int8s_append__parameter_checking(void **state) { - - const uint8_t data = 0; - - { - const f_status_t status = f_int8s_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - #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 index 221938d..fd718cd 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int8s_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int8s_append() + * @see f_int8s_append() */ -extern void test__f_type_array_int8s_append__works(void **state); +extern void test__f_type_array_int8s_append__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int8s_append() + * @see f_int8s_append() */ -extern void test__f_type_array_int8s_append__parameter_checking(void **state); +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 index 79279e3..1246f59 100644 --- 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 @@ -5,10 +5,20 @@ extern "C" { #endif -void test__f_type_array_int8s_append_all__works(void **state) { +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; - const int length_used = 2; f_int8s_t source = f_int8s_t_initialize; f_int8s_t destination = f_int8s_t_initialize; @@ -20,29 +30,22 @@ void test__f_type_array_int8s_append_all__works(void **state) { 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_array_length_t i = 0; i < source.used; ++i) { - assert_int_equal(destination.array[i], i + 1); - } // for + 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); - free((void *) destination.array); } -void test__f_type_array_int8s_append_all__returns_data_not(void **state) { +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; @@ -54,27 +57,24 @@ void test__f_type_array_int8s_append_all__returns_data_not(void **state) { 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_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); + assert_int_equal(status, F_none); + assert_int_equal(destination.used, source.used); + assert_int_equal(destination.size, source.used); + + for (f_array_length_t i = 0; i < source.used; ++i) { + assert_int_equal(destination.array[i], i + 1); + } // for } free((void *) source.array); -} - -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)); - } + free((void *) destination.array); } #ifdef __cplusplus 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 index 28e46c8..ce99af9 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__int8s_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int8s_append_all() + * @see f_int8s_append_all() */ -extern void test__f_type_array_int8s_append_all__works(void **state); +extern void test__f_type_array_int8s_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_int8s_append_all() + * @see f_int8s_append_all() */ extern void test__f_type_array_int8s_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int8s_append_all() + * @see f_int8s_append_all() */ -extern void test__f_type_array_int8s_append_all__parameter_checking(void **state); +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 index 388ed49..19cd308 100644 --- 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 @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_int8s_decimate_by__works(void **state) { +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_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); + const f_status_t status = f_int8s_decimate_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_int8s_decimate_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_int8s_decimate_by__parameter_checking(void **state) { +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_decimate_by(length, 0); + const f_status_t status = f_int8s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + 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); } 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 index 269b5d7..a73804b 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int8s_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int8s_decimate_by() + * @see f_int8s_decimate_by() */ -extern void test__f_type_array_int8s_decimate_by__works(void **state); +extern void test__f_type_array_int8s_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int8s_decimate_by() + * @see f_int8s_decimate_by() */ -extern void test__f_type_array_int8s_decimate_by__parameter_checking(void **state); +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 index e5cfb1e..1565014 100644 --- 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 @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_int8s_decrease_by__works(void **state) { +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_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); + const f_status_t status = f_int8s_decrease_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_int8s_decrease_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_int8s_decrease_by__parameter_checking(void **state) { +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_decrease_by(length, 0); + const f_status_t status = f_int8s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + 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); } 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 index 61b3b84..edba0a3 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int8s_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int8s_decrease_by() + * @see f_int8s_decrease_by() */ -extern void test__f_type_array_int8s_decrease_by__works(void **state); +extern void test__f_type_array_int8s_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int8s_decrease_by() + * @see f_int8s_decrease_by() */ -extern void test__f_type_array_int8s_decrease_by__parameter_checking(void **state); +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 index 37d9220..b79827a 100644 --- 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 @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_int8s_increase__works(void **state) { +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_resize(length, &data); + const f_status_t status = f_int8s_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); 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); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -55,17 +45,27 @@ void test__f_type_array_int8s_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_int8s_increase__parameter_checking(void **state) { +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_increase(length, 0); + const f_status_t status = f_int8s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 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); 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 index 99012ea..0842e98 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__int8s_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int8s_increase() + * @see f_int8s_increase() */ -extern void test__f_type_array_int8s_increase__works(void **state); +extern void test__f_type_array_int8s_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_int8s_increase() + * @see f_int8s_increase() */ extern void test__f_type_array_int8s_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int8s_increase() + * @see f_int8s_increase() */ -extern void test__f_type_array_int8s_increase__parameter_checking(void **state); +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 index d847d52..6b02221 100644 --- 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 @@ -5,6 +5,22 @@ 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__works(void **state) { const int length = 5; @@ -31,22 +47,6 @@ void test__f_type_array_int8s_increase_by__works(void **state) { free((void *) data.array); } -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); -} - #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 index 0b903ac..9934fed 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int8s_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int8s_increase_by() + * @see f_int8s_increase_by() */ -extern void test__f_type_array_int8s_increase_by__works(void **state); +extern void test__f_type_array_int8s_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int8s_increase_by() + * @see f_int8s_increase_by() */ -extern void test__f_type_array_int8s_increase_by__parameter_checking(void **state); +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 index c367b73..c6ec662 100644 --- 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 @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_int8s_resize__works(void **state) { +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, &data); + const f_status_t status = f_int8s_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_int8s_resize__parameter_checking(void **state) { +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, 0); + const f_status_t status = f_int8s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus 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 index bf0e9ce..175dfdb 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int8s_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int8s_resize() + * @see f_int8s_resize() */ -extern void test__f_type_array_int8s_resize__works(void **state); +extern void test__f_type_array_int8s_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int8s_resize() + * @see f_int8s_resize() */ -extern void test__f_type_array_int8s_resize__parameter_checking(void **state); +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-int8ss_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_adjust.c index d230abd..bbba3cd 100644 --- 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 @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_int8ss_adjust__works(void **state) { +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, &data); + const f_status_t status = f_int8ss_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_int8ss_adjust__parameter_checking(void **state) { +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, 0); + const f_status_t status = f_int8ss_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus 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 index 6e982b8..7829380 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int8ss_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int8ss_adjust() + * @see f_int8ss_adjust() */ -extern void test__f_type_array_int8ss_adjust__works(void **state); +extern void test__f_type_array_int8ss_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int8ss_adjust() + * @see f_int8ss_adjust() */ -extern void test__f_type_array_int8ss_adjust__parameter_checking(void **state); +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 index 5372566..f97a83b 100644 --- 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 @@ -5,7 +5,18 @@ extern "C" { #endif -void test__f_type_array_int8ss_append__works(void **state) { +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; @@ -19,32 +30,19 @@ void test__f_type_array_int8ss_append__works(void **state) { 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_array_length_t i = 0; i < destination.array[0].used; ++i) { - assert_int_equal(destination.array[0].array[i], i + 1); - } // for + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + assert_null(destination.array); } - for (f_array_length_t i = 0; i < destination.used; ++i) { - free((void *) destination.array[i].array); - } // for - free((void *) source.array); - free((void *) destination.array); } -void test__f_type_array_int8ss_append__returns_data_not(void **state) { +void test__f_type_array_int8ss_append__works(void **state) { const int length = 5; f_int8s_t source = f_int8s_t_initialize; @@ -58,27 +56,29 @@ void test__f_type_array_int8ss_append__returns_data_not(void **state) { 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_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__parameter_checking(void **state) { + 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); - f_int8s_t data = f_int8s_t_initialize; + for (f_array_length_t i = 0; i < destination.array[0].used; ++i) { + assert_int_equal(destination.array[0].array[i], i + 1); + } // for + } - { - const f_status_t status = f_int8ss_append(data, 0); + for (f_array_length_t i = 0; i < destination.used; ++i) { + free((void *) destination.array[i].array); + } // for - assert_int_equal(status, F_status_set_error(F_parameter)); - } + free((void *) source.array); + free((void *) destination.array); } #ifdef __cplusplus 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 index 57a27ab..10734ea 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__int8ss_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int8ss_append() + * @see f_int8ss_append() */ -extern void test__f_type_array_int8ss_append__works(void **state); +extern void test__f_type_array_int8ss_append__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_int8ss_append() + * @see f_int8ss_append() */ extern void test__f_type_array_int8ss_append__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int8ss_append() + * @see f_int8ss_append() */ -extern void test__f_type_array_int8ss_append__parameter_checking(void **state); +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 index 6aeb35f..ea4b2db 100644 --- 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 @@ -5,6 +5,43 @@ 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; @@ -63,43 +100,6 @@ void test__f_type_array_int8ss_append_all__works(void **state) { free((void *) destination.array); } -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__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)); - } -} - #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 index 2ce922d..5cd3b49 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__int8ss_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int8ss_append_all() + * @see f_int8ss_append_all() */ -extern void test__f_type_array_int8ss_append_all__works(void **state); +extern void test__f_type_array_int8ss_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_int8ss_append_all() + * @see f_int8ss_append_all() */ extern void test__f_type_array_int8ss_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int8ss_append_all() + * @see f_int8ss_append_all() */ -extern void test__f_type_array_int8ss_append_all__parameter_checking(void **state); +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 index 373da63..0488223 100644 --- 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 @@ -5,10 +5,26 @@ extern "C" { #endif -void test__f_type_array_int8ss_decimate_by__works(void **state) { +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_int8s_t_initialize; + f_int8ss_t data = f_int8ss_t_initialize; { const f_status_t status = f_int8ss_resize(length, &data); @@ -19,25 +35,33 @@ void test__f_type_array_int8ss_decimate_by__works(void **state) { } { - const f_status_t status = f_int8ss_decimate_by(length, &data); + const f_status_t status = f_int8ss_decimate_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_int8ss_decimate_by__parameter_checking(void **state) { +void test__f_type_array_int8ss_decimate_by__works(void **state) { const int length = 5; - f_int8ss_t data = f_int8s_t_initialize; + f_int8ss_t data = f_int8ss_t_initialize; { - const f_status_t status = f_int8ss_decimate_by(length, 0); + const f_status_t status = f_int8ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + 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); } 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 index aba8411..a1a415f 100644 --- 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 @@ -11,17 +11,24 @@ #define _TEST__F_type_array__int8ss_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int8ss_decimate_by() + * @see f_int8ss_decimate_by() */ -extern void test__f_type_array_int8ss_decimate_by__works(void **state); +extern void test__f_type_array_int8ss_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * * @see f_type_array_int8ss_decimate_by() */ -extern void test__f_type_array_int8ss_decimate_by__parameter_checking(void **state); +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 index 67e3342..d6dc68e 100644 --- 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 @@ -5,10 +5,26 @@ extern "C" { #endif -void test__f_type_array_int8ss_decrease_by__works(void **state) { +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_int8s_t_initialize; + f_int8ss_t data = f_int8ss_t_initialize; { const f_status_t status = f_int8ss_resize(length, &data); @@ -19,25 +35,33 @@ void test__f_type_array_int8ss_decrease_by__works(void **state) { } { - const f_status_t status = f_int8ss_decrease_by(length, &data); + const f_status_t status = f_int8ss_decrease_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_int8ss_decrease_by__parameter_checking(void **state) { +void test__f_type_array_int8ss_decrease_by__works(void **state) { const int length = 5; - f_int8ss_t data = f_int8s_t_initialize; + f_int8ss_t data = f_int8ss_t_initialize; { - const f_status_t status = f_int8ss_decrease_by(length, 0); + const f_status_t status = f_int8ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + 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); } 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 index 2925c24..a216a85 100644 --- 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 @@ -11,17 +11,24 @@ #define _TEST__F_type_array__int8ss_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int8ss_decrease_by() + * @see f_int8ss_decrease_by() */ -extern void test__f_type_array_int8ss_decrease_by__works(void **state); +extern void test__f_type_array_int8ss_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_int8ss_decrease_by() + * @see f_int8ss_decrease_by() */ -extern void test__f_type_array_int8ss_decrease_by__parameter_checking(void **state); +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 index 39445e0..0cc0c50 100644 --- 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 @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_int8ss_increase__works(void **state) { +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_resize(length, &data); + const f_status_t status = f_int8ss_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); 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); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -34,7 +24,7 @@ void test__f_type_array_int8ss_increase__works(void **state) { void test__f_type_array_int8ss_increase__returns_data_not(void **state) { const int length = 5; - f_int8ss_t data = f_int8s_t_initialize; + f_int8ss_t data = f_int8ss_t_initialize; { const f_status_t status = f_int8ss_resize(length, &data); @@ -55,17 +45,27 @@ void test__f_type_array_int8ss_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_int8ss_increase__parameter_checking(void **state) { +void test__f_type_array_int8ss_increase__works(void **state) { const int length = 5; - f_int8ss_t data = f_int8s_t_initialize; + f_int8ss_t data = f_int8ss_t_initialize; { - const f_status_t status = f_int8ss_increase(length, 0); + const f_status_t status = f_int8ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 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); 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 index 1d18bb6..4f496a9 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__int8ss_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int8ss_increase() + * @see f_int8ss_increase() */ -extern void test__f_type_array_int8ss_increase__works(void **state); +extern void test__f_type_array_int8ss_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_int8ss_increase() + * @see f_int8ss_increase() */ extern void test__f_type_array_int8ss_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int8ss_increase() + * @see f_int8ss_increase() */ -extern void test__f_type_array_int8ss_increase__parameter_checking(void **state); +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 index dc4f64e..f37b14b 100644 --- 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 @@ -5,10 +5,26 @@ extern "C" { #endif -void test__f_type_array_int8ss_increase_by__works(void **state) { +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_int8s_t_initialize; + f_int8ss_t data = f_int8ss_t_initialize; { const f_status_t status = f_int8ss_resize(length, &data); @@ -19,32 +35,48 @@ void test__f_type_array_int8ss_increase_by__works(void **state) { } { - data.used = 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_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); + 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__parameter_checking(void **state) { +void test__f_type_array_int8ss_increase_by__works(void **state) { const int length = 5; - f_int8ss_t data = f_int8s_t_initialize; + f_int8ss_t data = f_int8ss_t_initialize; { - const f_status_t status = f_int8ss_increase_by(length, 0); + const f_status_t status = f_int8ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + { + 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 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 index 1c80719..0975dea 100644 --- 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 @@ -11,17 +11,24 @@ #define _TEST__F_type_array__int8ss_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int8ss_increase_by() + * @see f_int8ss_increase_by() */ -extern void test__f_type_array_int8ss_increase_by__works(void **state); +extern void test__f_type_array_int8ss_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_int8ss_increase_by() + * @see f_int8ss_increase_by() */ -extern void test__f_type_array_int8ss_increase_by__parameter_checking(void **state); +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 index 49b9f42..b3ef69c 100644 --- 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 @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_int8ss_resize__works(void **state) { +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, &data); + const f_status_t status = f_int8ss_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_int8ss_resize__parameter_checking(void **state) { +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, 0); + const f_status_t status = f_int8ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus 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 index 42dda37..ba5ab36 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int8ss_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int8ss_resize() + * @see f_int8ss_resize() */ -extern void test__f_type_array_int8ss_resize__works(void **state); +extern void test__f_type_array_int8ss_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int8ss_resize() + * @see f_int8ss_resize() */ -extern void test__f_type_array_int8ss_resize__parameter_checking(void **state); +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-states_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-states_adjust.c index 4337c99..3ec4727 100644 --- 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 @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_states_adjust__works(void **state) { +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, &data); + const f_status_t status = f_states_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_states_adjust__parameter_checking(void **state) { +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, 0); + const f_status_t status = f_states_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus 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 index dbc993a..33e083f 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__states_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_states_adjust() + * @see f_states_adjust() */ -extern void test__f_type_array_states_adjust__works(void **state); +extern void test__f_type_array_states_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_states_adjust() + * @see f_states_adjust() */ -extern void test__f_type_array_states_adjust__parameter_checking(void **state); +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 index e142cfa..11d2fe4 100644 --- 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 @@ -5,6 +5,17 @@ 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; @@ -31,17 +42,6 @@ void test__f_type_array_states_append__works(void **state) { free((void *) destination.array); } -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)); - } -} - #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 index 43d227d..57c23ab 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__states_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_states_append() + * @see f_states_append() */ -extern void test__f_type_array_states_append__works(void **state); +extern void test__f_type_array_states_append__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_states_append() + * @see f_states_append() */ -extern void test__f_type_array_states_append__parameter_checking(void **state); +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 index 0c7938c..9616d75 100644 --- 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 @@ -5,6 +5,43 @@ 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; @@ -53,43 +90,6 @@ void test__f_type_array_states_append_all__works(void **state) { free((void *) destination.array); } -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__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)); - } -} - #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 index a1f2bab..68cb6a5 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__states_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_states_append_all() + * @see f_states_append_all() */ -extern void test__f_type_array_states_append_all__works(void **state); +extern void test__f_type_array_states_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_states_append_all() + * @see f_states_append_all() */ extern void test__f_type_array_states_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_states_append_all() + * @see f_states_append_all() */ -extern void test__f_type_array_states_append_all__parameter_checking(void **state); +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 index 0594ff3..e74f0b7 100644 --- 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 @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_states_decimate_by__works(void **state) { +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_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); + const f_status_t status = f_states_decimate_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_states_decimate_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_states_decimate_by__parameter_checking(void **state) { +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_decimate_by(length, 0); + const f_status_t status = f_states_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + 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); } 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 index a12f3ce..7c983cd 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__states_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_states_decimate_by() + * @see f_states_decimate_by() */ -extern void test__f_type_array_states_decimate_by__works(void **state); +extern void test__f_type_array_states_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_states_decimate_by() + * @see f_states_decimate_by() */ -extern void test__f_type_array_states_decimate_by__parameter_checking(void **state); +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 index 69f02f3..1b15b17 100644 --- 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 @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_states_decrease_by__works(void **state) { +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_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); + const f_status_t status = f_states_decrease_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_states_decrease_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_states_decrease_by__parameter_checking(void **state) { +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_decrease_by(length, 0); + const f_status_t status = f_states_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + 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); } 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 index 6b0e7da..d79921a 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__states_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_states_decrease_by() + * @see f_states_decrease_by() */ -extern void test__f_type_array_states_decrease_by__works(void **state); +extern void test__f_type_array_states_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_states_decrease_by() + * @see f_states_decrease_by() */ -extern void test__f_type_array_states_decrease_by__parameter_checking(void **state); +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 index 36bd2cb..cacd401 100644 --- 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 @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_states_increase__works(void **state) { +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_resize(length, &data); + const f_status_t status = f_states_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); 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); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -55,17 +45,27 @@ void test__f_type_array_states_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_states_increase__parameter_checking(void **state) { +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_increase(length, 0); + const f_status_t status = f_states_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 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); 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 index f3443ab..d82fa0a 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__states_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_states_increase() + * @see f_states_increase() */ -extern void test__f_type_array_states_increase__works(void **state); +extern void test__f_type_array_states_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_states_increase() + * @see f_states_increase() */ extern void test__f_type_array_states_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_states_increase() + * @see f_states_increase() */ -extern void test__f_type_array_states_increase__parameter_checking(void **state); +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 index 7fa61bd..3cfc0b9 100644 --- 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 @@ -5,6 +5,22 @@ 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__works(void **state) { const int length = 5; @@ -31,22 +47,6 @@ void test__f_type_array_states_increase_by__works(void **state) { free((void *) data.array); } -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); -} - #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 index e78e99e..1b1011f 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__states_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_states_increase_by() + * @see f_states_increase_by() */ -extern void test__f_type_array_states_increase_by__works(void **state); +extern void test__f_type_array_states_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_states_increase_by() + * @see f_states_increase_by() */ -extern void test__f_type_array_states_increase_by__parameter_checking(void **state); +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 index ada5a9b..3751188 100644 --- 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 @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_states_resize__works(void **state) { +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, &data); + const f_status_t status = f_states_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_states_resize__parameter_checking(void **state) { +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, 0); + const f_status_t status = f_states_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus 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 index 79e7979..5a86821 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__states_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_states_resize() + * @see f_states_resize() */ -extern void test__f_type_array_states_resize__works(void **state); +extern void test__f_type_array_states_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_states_resize() + * @see f_states_resize() */ -extern void test__f_type_array_states_resize__parameter_checking(void **state); +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 index 61b28e3..883bd1d 100644 --- 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 @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_statess_adjust__works(void **state) { +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, &data); + const f_status_t status = f_statess_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_statess_adjust__parameter_checking(void **state) { +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, 0); + const f_status_t status = f_statess_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus 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 index 5cb604e..0fa2318 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__statess_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_statess_adjust() + * @see f_statess_adjust() */ -extern void test__f_type_array_statess_adjust__works(void **state); +extern void test__f_type_array_statess_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_statess_adjust() + * @see f_statess_adjust() */ -extern void test__f_type_array_statess_adjust__parameter_checking(void **state); +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 index 2f471e3..600d61a 100644 --- 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 @@ -5,6 +5,43 @@ 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; @@ -57,43 +94,6 @@ void test__f_type_array_statess_append__works(void **state) { free((void *) destination.array); } -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__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)); - } -} - #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 index 54f6bf4..655f573 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__statess_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_statess_append() + * @see f_statess_append() */ -extern void test__f_type_array_statess_append__works(void **state); +extern void test__f_type_array_statess_append__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_statess_append() + * @see f_statess_append() */ extern void test__f_type_array_statess_append__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_statess_append() + * @see f_statess_append() */ -extern void test__f_type_array_statess_append__parameter_checking(void **state); +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 index 9146356..d78b522 100644 --- 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 @@ -5,6 +5,43 @@ 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; @@ -77,43 +114,6 @@ void test__f_type_array_statess_append_all__works(void **state) { free((void *) destination.array); } -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__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)); - } -} - #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 index b8a72ea..b57c1f0 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__statess_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_statess_append_all() + * @see f_statess_append_all() */ -extern void test__f_type_array_statess_append_all__works(void **state); +extern void test__f_type_array_statess_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_statess_append_all() + * @see f_statess_append_all() */ extern void test__f_type_array_statess_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_statess_append_all() + * @see f_statess_append_all() */ -extern void test__f_type_array_statess_append_all__parameter_checking(void **state); +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 index 0375502..911c7e4 100644 --- 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 @@ -5,12 +5,28 @@ extern "C" { #endif -void test__f_type_array_statess_decimate_by__works(void **state) { +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); @@ -19,25 +35,33 @@ void test__f_type_array_statess_decimate_by__works(void **state) { } { - const f_status_t status = f_statess_decimate_by(length, &data); + const f_status_t status = f_statess_decimate_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_statess_decimate_by__parameter_checking(void **state) { +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_decimate_by(length, 0); + const f_status_t status = f_statess_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + 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); } 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 index dae8b9d..d8c960c 100644 --- 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 @@ -11,17 +11,24 @@ #define _TEST__F_type_array__statess_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_statess_decimate_by() + * @see f_statess_decimate_by() */ -extern void test__f_type_array_statess_decimate_by__works(void **state); +extern void test__f_type_array_statess_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * * @see f_type_array_statess_decimate_by() */ -extern void test__f_type_array_statess_decimate_by__parameter_checking(void **state); +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 index 753ff19..4990d95 100644 --- 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 @@ -5,12 +5,28 @@ extern "C" { #endif -void test__f_type_array_statess_decrease_by__works(void **state) { +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); @@ -19,25 +35,33 @@ void test__f_type_array_statess_decrease_by__works(void **state) { } { - const f_status_t status = f_statess_decrease_by(length, &data); + const f_status_t status = f_statess_decrease_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_statess_decrease_by__parameter_checking(void **state) { +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_decrease_by(length, 0); + const f_status_t status = f_statess_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + 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); } 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 index b855d49..f8b0622 100644 --- 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 @@ -11,17 +11,24 @@ #define _TEST__F_type_array__statess_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_statess_decrease_by() + * @see f_statess_decrease_by() */ -extern void test__f_type_array_statess_decrease_by__works(void **state); +extern void test__f_type_array_statess_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_statess_decrease_by() + * @see f_statess_decrease_by() */ -extern void test__f_type_array_statess_decrease_by__parameter_checking(void **state); +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 index 367d9a5..e187d56 100644 --- 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 @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_statess_increase__works(void **state) { +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_resize(length, &data); + const f_status_t status = f_statess_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); 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); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -55,17 +45,27 @@ void test__f_type_array_statess_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_statess_increase__parameter_checking(void **state) { +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_increase(length, 0); + const f_status_t status = f_statess_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 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); 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 index d015d5d..1758a79 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__statess_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_statess_increase() + * @see f_statess_increase() */ -extern void test__f_type_array_statess_increase__works(void **state); +extern void test__f_type_array_statess_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_statess_increase() + * @see f_statess_increase() */ extern void test__f_type_array_statess_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_statess_increase() + * @see f_statess_increase() */ -extern void test__f_type_array_statess_increase__parameter_checking(void **state); +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 index 77070d2..57251b0 100644 --- 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 @@ -5,12 +5,28 @@ extern "C" { #endif -void test__f_type_array_statess_increase_by__works(void **state) { +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); @@ -19,32 +35,48 @@ void test__f_type_array_statess_increase_by__works(void **state) { } { - data.used = 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_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); + 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__parameter_checking(void **state) { +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_increase_by(length, 0); + const f_status_t status = f_statess_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + { + 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 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 index a93ffba..13d0608 100644 --- 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 @@ -11,17 +11,24 @@ #define _TEST__F_type_array__statess_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_statess_increase_by() + * @see f_statess_increase_by() */ -extern void test__f_type_array_statess_increase_by__works(void **state); +extern void test__f_type_array_statess_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_statess_increase_by() + * @see f_statess_increase_by() */ -extern void test__f_type_array_statess_increase_by__parameter_checking(void **state); +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 index a953b94..b30e2a0 100644 --- 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 @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_statess_resize__works(void **state) { +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, &data); + const f_status_t status = f_statess_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_statess_resize__parameter_checking(void **state) { +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, 0); + const f_status_t status = f_statess_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus 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 index 448f6d8..17d6e40 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__statess_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_statess_resize() + * @see f_statess_resize() */ -extern void test__f_type_array_statess_resize__works(void **state); +extern void test__f_type_array_statess_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_statess_resize() + * @see f_statess_resize() */ -extern void test__f_type_array_statess_resize__parameter_checking(void **state); +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 index ba7dcc6..0862cf6 100644 --- 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 @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_statuss_adjust__works(void **state) { +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, &data); + const f_status_t status = f_statuss_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_statuss_adjust__parameter_checking(void **state) { +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, 0); + const f_status_t status = f_statuss_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus 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 index 24e5d53..e28e5d6 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__statuss_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_statuss_adjust() + * @see f_statuss_adjust() */ -extern void test__f_type_array_statuss_adjust__works(void **state); +extern void test__f_type_array_statuss_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_statuss_adjust() + * @see f_statuss_adjust() */ -extern void test__f_type_array_statuss_adjust__parameter_checking(void **state); +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 index fb8d905..454ebaa 100644 --- 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 @@ -5,6 +5,17 @@ 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; @@ -21,17 +32,6 @@ void test__f_type_array_statuss_append__works(void **state) { free((void *) destination.array); } -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)); - } -} - #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 index 6fb277f..48a5dc9 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__statuss_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_statuss_append() + * @see f_statuss_append() */ -extern void test__f_type_array_statuss_append__works(void **state); +extern void test__f_type_array_statuss_append__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_statuss_append() + * @see f_statuss_append() */ -extern void test__f_type_array_statuss_append__parameter_checking(void **state); +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 index 07b1a06..19e6fe1 100644 --- 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 @@ -5,10 +5,20 @@ extern "C" { #endif -void test__f_type_array_statuss_append_all__works(void **state) { +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; - const int length_used = 2; f_statuss_t source = f_statuss_t_initialize; f_statuss_t destination = f_statuss_t_initialize; @@ -20,29 +30,22 @@ void test__f_type_array_statuss_append_all__works(void **state) { 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_array_length_t i = 0; i < source.used; ++i) { - assert_int_equal(destination.array[i], i + 1); - } // for + 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); - free((void *) destination.array); } -void test__f_type_array_statuss_append_all__returns_data_not(void **state) { +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; @@ -54,27 +57,24 @@ void test__f_type_array_statuss_append_all__returns_data_not(void **state) { 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_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); + assert_int_equal(status, F_none); + assert_int_equal(destination.used, source.used); + assert_int_equal(destination.size, source.used); + + for (f_array_length_t i = 0; i < source.used; ++i) { + assert_int_equal(destination.array[i], i + 1); + } // for } free((void *) source.array); -} - -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)); - } + free((void *) destination.array); } #ifdef __cplusplus 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 index c870109..509bdee 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__statuss_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_statuss_append_all() + * @see f_statuss_append_all() */ -extern void test__f_type_array_statuss_append_all__works(void **state); +extern void test__f_type_array_statuss_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_statuss_append_all() + * @see f_statuss_append_all() */ extern void test__f_type_array_statuss_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_statuss_append_all() + * @see f_statuss_append_all() */ -extern void test__f_type_array_statuss_append_all__parameter_checking(void **state); +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 index 962080c..479f129 100644 --- 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 @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_statuss_decimate_by__works(void **state) { +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_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); + const f_status_t status = f_statuss_decimate_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_statuss_decimate_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_statuss_decimate_by__parameter_checking(void **state) { +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_decimate_by(length, 0); + const f_status_t status = f_statuss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + 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); } 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 index cd317d3..f999d0c 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__statuss_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_statuss_decimate_by() + * @see f_statuss_decimate_by() */ -extern void test__f_type_array_statuss_decimate_by__works(void **state); +extern void test__f_type_array_statuss_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_statuss_decimate_by() + * @see f_statuss_decimate_by() */ -extern void test__f_type_array_statuss_decimate_by__parameter_checking(void **state); +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 index 24bcde4..1c92e8d 100644 --- 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 @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_statuss_decrease_by__works(void **state) { +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_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); + const f_status_t status = f_statuss_decrease_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_statuss_decrease_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_statuss_decrease_by__parameter_checking(void **state) { +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_decrease_by(length, 0); + const f_status_t status = f_statuss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + 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); } 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 index 52aef54..523c47c 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__statuss_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_statuss_decrease_by() + * @see f_statuss_decrease_by() */ -extern void test__f_type_array_statuss_decrease_by__works(void **state); +extern void test__f_type_array_statuss_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_statuss_decrease_by() + * @see f_statuss_decrease_by() */ -extern void test__f_type_array_statuss_decrease_by__parameter_checking(void **state); +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 index 5d68d7a..a07eb6c 100644 --- 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 @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_statuss_increase__works(void **state) { +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_resize(length, &data); + const f_status_t status = f_statuss_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); 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); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -55,17 +45,27 @@ void test__f_type_array_statuss_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_statuss_increase__parameter_checking(void **state) { +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_increase(length, 0); + const f_status_t status = f_statuss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 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); 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 index 65a9252..79e9302 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__statuss_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_statuss_increase() + * @see f_statuss_increase() */ -extern void test__f_type_array_statuss_increase__works(void **state); +extern void test__f_type_array_statuss_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_statuss_increase() + * @see f_statuss_increase() */ extern void test__f_type_array_statuss_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_statuss_increase() + * @see f_statuss_increase() */ -extern void test__f_type_array_statuss_increase__parameter_checking(void **state); +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 index f828eaa..5cc7bd6 100644 --- 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 @@ -5,6 +5,23 @@ 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__works(void **state) { const int length = 5; @@ -31,22 +48,6 @@ void test__f_type_array_statuss_increase_by__works(void **state) { free((void *) data.array); } -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); -} - #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 index bdf0fb1..0bed939 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__statuss_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_statuss_increase_by() + * @see f_statuss_increase_by() */ -extern void test__f_type_array_statuss_increase_by__works(void **state); +extern void test__f_type_array_statuss_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_statuss_increase_by() + * @see f_statuss_increase_by() */ -extern void test__f_type_array_statuss_increase_by__parameter_checking(void **state); +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 index 2ecb2a4..94d097d 100644 --- 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 @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_statuss_resize__works(void **state) { +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, &data); + const f_status_t status = f_statuss_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_statuss_resize__parameter_checking(void **state) { +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, 0); + const f_status_t status = f_statuss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus 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 index 4ce5181..7a884ae 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__statuss_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_statuss_resize() + * @see f_statuss_resize() */ -extern void test__f_type_array_statuss_resize__works(void **state); +extern void test__f_type_array_statuss_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_statuss_resize() + * @see f_statuss_resize() */ -extern void test__f_type_array_statuss_resize__parameter_checking(void **state); +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 index d715069..80c7899 100644 --- 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 @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_statusss_adjust__works(void **state) { +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, &data); + const f_status_t status = f_statusss_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_statusss_adjust__parameter_checking(void **state) { +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, 0); + const f_status_t status = f_statusss_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus 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 index 2e7f4e8..b57ba17 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__statusss_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_statusss_adjust() + * @see f_statusss_adjust() */ -extern void test__f_type_array_statusss_adjust__works(void **state); +extern void test__f_type_array_statusss_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_statusss_adjust() + * @see f_statusss_adjust() */ -extern void test__f_type_array_statusss_adjust__parameter_checking(void **state); +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 index a0ddc42..a713c2c 100644 --- 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 @@ -5,7 +5,18 @@ extern "C" { #endif -void test__f_type_array_statusss_append__works(void **state) { +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; @@ -19,32 +30,19 @@ void test__f_type_array_statusss_append__works(void **state) { 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_array_length_t i = 0; i < destination.array[0].used; ++i) { - assert_int_equal(destination.array[0].array[i], i + 1); - } // for + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + assert_null(destination.array); } - for (f_array_length_t i = 0; i < destination.used; ++i) { - free((void *) destination.array[i].array); - } // for - free((void *) source.array); - free((void *) destination.array); } -void test__f_type_array_statusss_append__returns_data_not(void **state) { +void test__f_type_array_statusss_append__works(void **state) { const int length = 5; f_statuss_t source = f_statuss_t_initialize; @@ -58,27 +56,29 @@ void test__f_type_array_statusss_append__returns_data_not(void **state) { 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_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__parameter_checking(void **state) { + 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); - f_statuss_t data = f_statuss_t_initialize; + for (f_array_length_t i = 0; i < destination.array[0].used; ++i) { + assert_int_equal(destination.array[0].array[i], i + 1); + } // for + } - { - const f_status_t status = f_statusss_append(data, 0); + for (f_array_length_t i = 0; i < destination.used; ++i) { + free((void *) destination.array[i].array); + } // for - assert_int_equal(status, F_status_set_error(F_parameter)); - } + free((void *) source.array); + free((void *) destination.array); } #ifdef __cplusplus 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 index 89b921e..e7e8782 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__statusss_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_statusss_append() + * @see f_statusss_append() */ -extern void test__f_type_array_statusss_append__works(void **state); +extern void test__f_type_array_statusss_append__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_statusss_append() + * @see f_statusss_append() */ extern void test__f_type_array_statusss_append__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_statusss_append() + * @see f_statusss_append() */ -extern void test__f_type_array_statusss_append__parameter_checking(void **state); +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 index b0b13a1..213074a 100644 --- 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 @@ -5,6 +5,43 @@ 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; @@ -63,43 +100,6 @@ void test__f_type_array_statusss_append_all__works(void **state) { free((void *) destination.array); } -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__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)); - } -} - #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 index 54ac1cf..bcbcd20 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__statusss_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_statusss_append_all() + * @see f_statusss_append_all() */ -extern void test__f_type_array_statusss_append_all__works(void **state); +extern void test__f_type_array_statusss_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_statusss_append_all() + * @see f_statusss_append_all() */ extern void test__f_type_array_statusss_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_statusss_append_all() + * @see f_statusss_append_all() */ -extern void test__f_type_array_statusss_append_all__parameter_checking(void **state); +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 index 8a7b041..7265fd4 100644 --- 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 @@ -5,12 +5,28 @@ extern "C" { #endif -void test__f_type_array_statusss_decimate_by__works(void **state) { +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); @@ -19,25 +35,33 @@ void test__f_type_array_statusss_decimate_by__works(void **state) { } { - const f_status_t status = f_statusss_decimate_by(length, &data); + const f_status_t status = f_statusss_decimate_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_statusss_decimate_by__parameter_checking(void **state) { +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_decimate_by(length, 0); + const f_status_t status = f_statusss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + 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); } 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 index 79428b9..41fb24d 100644 --- 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 @@ -11,17 +11,24 @@ #define _TEST__F_type_array__statusss_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_statusss_decimate_by() + * @see f_statusss_decimate_by() */ -extern void test__f_type_array_statusss_decimate_by__works(void **state); +extern void test__f_type_array_statusss_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * * @see f_type_array_statusss_decimate_by() */ -extern void test__f_type_array_statusss_decimate_by__parameter_checking(void **state); +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 index 19b69ce..43e408c 100644 --- 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 @@ -5,12 +5,28 @@ extern "C" { #endif -void test__f_type_array_statusss_decrease_by__works(void **state) { +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); @@ -19,25 +35,33 @@ void test__f_type_array_statusss_decrease_by__works(void **state) { } { - const f_status_t status = f_statusss_decrease_by(length, &data); + const f_status_t status = f_statusss_decrease_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_statusss_decrease_by__parameter_checking(void **state) { +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_decrease_by(length, 0); + const f_status_t status = f_statusss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + 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); } 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 index e780d3f..987d771 100644 --- 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 @@ -11,17 +11,24 @@ #define _TEST__F_type_array__statusss_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_statusss_decrease_by() + * @see f_statusss_decrease_by() */ -extern void test__f_type_array_statusss_decrease_by__works(void **state); +extern void test__f_type_array_statusss_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_statusss_decrease_by() + * @see f_statusss_decrease_by() */ -extern void test__f_type_array_statusss_decrease_by__parameter_checking(void **state); +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 index b0476ae..ec29f02 100644 --- 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 @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_statusss_increase__works(void **state) { +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_resize(length, &data); + const f_status_t status = f_statusss_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); 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); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -55,17 +45,27 @@ void test__f_type_array_statusss_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_statusss_increase__parameter_checking(void **state) { +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_increase(length, 0); + const f_status_t status = f_statusss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 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); 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 index 18a1cab..3c925ee 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__statusss_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_statusss_increase() + * @see f_statusss_increase() */ -extern void test__f_type_array_statusss_increase__works(void **state); +extern void test__f_type_array_statusss_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_statusss_increase() + * @see f_statusss_increase() */ extern void test__f_type_array_statusss_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_statusss_increase() + * @see f_statusss_increase() */ -extern void test__f_type_array_statusss_increase__parameter_checking(void **state); +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 index 0e98033..5a12068 100644 --- 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 @@ -5,12 +5,28 @@ extern "C" { #endif -void test__f_type_array_statusss_increase_by__works(void **state) { +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); @@ -19,32 +35,48 @@ void test__f_type_array_statusss_increase_by__works(void **state) { } { - data.used = 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_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); + 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__parameter_checking(void **state) { +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_increase_by(length, 0); + const f_status_t status = f_statusss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + { + 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 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 index 203c72a..da2d85d 100644 --- 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 @@ -11,17 +11,24 @@ #define _TEST__F_type_array__statusss_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_statusss_increase_by() + * @see f_statusss_increase_by() */ -extern void test__f_type_array_statusss_increase_by__works(void **state); +extern void test__f_type_array_statusss_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_statusss_increase_by() + * @see f_statusss_increase_by() */ -extern void test__f_type_array_statusss_increase_by__parameter_checking(void **state); +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 index b3ecfda..39aa72d 100644 --- 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 @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_statusss_resize__works(void **state) { +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, &data); + const f_status_t status = f_statusss_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_statusss_resize__parameter_checking(void **state) { +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, 0); + const f_status_t status = f_statusss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus 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 index e95a2de..d76761c 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__statusss_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_statusss_resize() + * @see f_statusss_resize() */ -extern void test__f_type_array_statusss_resize__works(void **state); +extern void test__f_type_array_statusss_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_statusss_resize() + * @see f_statusss_resize() */ -extern void test__f_type_array_statusss_resize__parameter_checking(void **state); +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 index 37025d7..ffe2937 100644 --- 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 @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_uint128s_adjust__works(void **state) { +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, &data); + const f_status_t status = f_uint128s_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_uint128s_adjust__parameter_checking(void **state) { +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, 0); + const f_status_t status = f_uint128s_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus 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 index 6315a5d..251a1d4 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint128s_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint128s_adjust() + * @see f_uint128s_adjust() */ -extern void test__f_type_array_uint128s_adjust__works(void **state); +extern void test__f_type_array_uint128s_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint128s_adjust() + * @see f_uint128s_adjust() */ -extern void test__f_type_array_uint128s_adjust__parameter_checking(void **state); +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_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_append.c index 516e450..e460075 100644 --- 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 @@ -5,6 +5,17 @@ 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; @@ -21,17 +32,6 @@ void test__f_type_array_uint128s_append__works(void **state) { free((void *) destination.array); } -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)); - } -} - #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 index 93ccaf1..1580565 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint128s_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint128s_append() + * @see f_uint128s_append() */ -extern void test__f_type_array_uint128s_append__works(void **state); +extern void test__f_type_array_uint128s_append__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint128s_append() + * @see f_uint128s_append() */ -extern void test__f_type_array_uint128s_append__parameter_checking(void **state); +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 index afbad49..65226e5 100644 --- 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 @@ -5,10 +5,20 @@ extern "C" { #endif -void test__f_type_array_uint128s_append_all__works(void **state) { +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; - const int length_used = 2; f_uint128s_t source = f_uint128s_t_initialize; f_uint128s_t destination = f_uint128s_t_initialize; @@ -20,29 +30,22 @@ void test__f_type_array_uint128s_append_all__works(void **state) { 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_array_length_t i = 0; i < source.used; ++i) { - assert_int_equal(destination.array[i], i + 1); - } // for + 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); - free((void *) destination.array); } -void test__f_type_array_uint128s_append_all__returns_data_not(void **state) { +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; @@ -54,27 +57,24 @@ void test__f_type_array_uint128s_append_all__returns_data_not(void **state) { 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_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); + assert_int_equal(status, F_none); + assert_int_equal(destination.used, source.used); + assert_int_equal(destination.size, source.used); + + for (f_array_length_t i = 0; i < source.used; ++i) { + assert_int_equal(destination.array[i], i + 1); + } // for } free((void *) source.array); -} - -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)); - } + free((void *) destination.array); } #ifdef __cplusplus 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 index 40d61c7..8fcbcf7 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__uint128s_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint128s_append_all() + * @see f_uint128s_append_all() */ -extern void test__f_type_array_uint128s_append_all__works(void **state); +extern void test__f_type_array_uint128s_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_uint128s_append_all() + * @see f_uint128s_append_all() */ extern void test__f_type_array_uint128s_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint128s_append_all() + * @see f_uint128s_append_all() */ -extern void test__f_type_array_uint128s_append_all__parameter_checking(void **state); +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 index d082f43..256d110 100644 --- 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 @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_uint128s_decimate_by__works(void **state) { +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_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); + const f_status_t status = f_uint128s_decimate_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_uint128s_decimate_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_uint128s_decimate_by__parameter_checking(void **state) { +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_decimate_by(length, 0); + const f_status_t status = f_uint128s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + 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); } 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 index a4f4356..bccbada 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint128s_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint128s_decimate_by() + * @see f_uint128s_decimate_by() */ -extern void test__f_type_array_uint128s_decimate_by__works(void **state); +extern void test__f_type_array_uint128s_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint128s_decimate_by() + * @see f_uint128s_decimate_by() */ -extern void test__f_type_array_uint128s_decimate_by__parameter_checking(void **state); +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 index 1d6b42e..a632272 100644 --- 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 @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_uint128s_decrease_by__works(void **state) { +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_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); + const f_status_t status = f_uint128s_decrease_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_uint128s_decrease_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_uint128s_decrease_by__parameter_checking(void **state) { +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_decrease_by(length, 0); + const f_status_t status = f_uint128s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + 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); } 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 index 9c21df0..a3e3b81 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint128s_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint128s_decrease_by() + * @see f_uint128s_decrease_by() */ -extern void test__f_type_array_uint128s_decrease_by__works(void **state); +extern void test__f_type_array_uint128s_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint128s_decrease_by() + * @see f_uint128s_decrease_by() */ -extern void test__f_type_array_uint128s_decrease_by__parameter_checking(void **state); +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 index 5a8143f..8987e36 100644 --- 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 @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_uint128s_increase__works(void **state) { +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_resize(length, &data); + const f_status_t status = f_uint128s_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); 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); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -55,17 +45,27 @@ void test__f_type_array_uint128s_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_uint128s_increase__parameter_checking(void **state) { +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_increase(length, 0); + const f_status_t status = f_uint128s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 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); 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 index 94e7079..600a18a 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__uint128s_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint128s_increase() + * @see f_uint128s_increase() */ -extern void test__f_type_array_uint128s_increase__works(void **state); +extern void test__f_type_array_uint128s_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_uint128s_increase() + * @see f_uint128s_increase() */ extern void test__f_type_array_uint128s_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint128s_increase() + * @see f_uint128s_increase() */ -extern void test__f_type_array_uint128s_increase__parameter_checking(void **state); +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 index 0cd3697..8a3424d 100644 --- 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 @@ -5,6 +5,22 @@ 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__works(void **state) { const int length = 5; @@ -31,22 +47,6 @@ void test__f_type_array_uint128s_increase_by__works(void **state) { free((void *) data.array); } -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); -} - #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 index 90317ac..9200183 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint128s_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint128s_increase_by() + * @see f_uint128s_increase_by() */ -extern void test__f_type_array_uint128s_increase_by__works(void **state); +extern void test__f_type_array_uint128s_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint128s_increase_by() + * @see f_uint128s_increase_by() */ -extern void test__f_type_array_uint128s_increase_by__parameter_checking(void **state); +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 index 65dcf29..b9bac74 100644 --- 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 @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_uint128s_resize__works(void **state) { +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, &data); + const f_status_t status = f_uint128s_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_uint128s_resize__parameter_checking(void **state) { +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, 0); + const f_status_t status = f_uint128s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus 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 index e21448d..50cf77a 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint128s_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint128s_resize() + * @see f_uint128s_resize() */ -extern void test__f_type_array_uint128s_resize__works(void **state); +extern void test__f_type_array_uint128s_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint128s_resize() + * @see f_uint128s_resize() */ -extern void test__f_type_array_uint128s_resize__parameter_checking(void **state); +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-uint128ss_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_adjust.c index 224e635..d42630b 100644 --- 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 @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_uint128ss_adjust__works(void **state) { +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, &data); + const f_status_t status = f_uint128ss_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_uint128ss_adjust__parameter_checking(void **state) { +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, 0); + const f_status_t status = f_uint128ss_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus 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 index 3a0bcde..75f000a 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint128ss_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint128ss_adjust() + * @see f_uint128ss_adjust() */ -extern void test__f_type_array_uint128ss_adjust__works(void **state); +extern void test__f_type_array_uint128ss_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint128ss_adjust() + * @see f_uint128ss_adjust() */ -extern void test__f_type_array_uint128ss_adjust__parameter_checking(void **state); +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 index 50ba45d..3887a22 100644 --- 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 @@ -5,7 +5,18 @@ extern "C" { #endif -void test__f_type_array_uint128ss_append__works(void **state) { +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; @@ -19,32 +30,19 @@ void test__f_type_array_uint128ss_append__works(void **state) { 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_array_length_t i = 0; i < destination.array[0].used; ++i) { - assert_int_equal(destination.array[0].array[i], i + 1); - } // for + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + assert_null(destination.array); } - for (f_array_length_t i = 0; i < destination.used; ++i) { - free((void *) destination.array[i].array); - } // for - free((void *) source.array); - free((void *) destination.array); } -void test__f_type_array_uint128ss_append__returns_data_not(void **state) { +void test__f_type_array_uint128ss_append__works(void **state) { const int length = 5; f_uint128s_t source = f_uint128s_t_initialize; @@ -58,27 +56,29 @@ void test__f_type_array_uint128ss_append__returns_data_not(void **state) { 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_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__parameter_checking(void **state) { + 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); - f_uint128s_t data = f_uint128s_t_initialize; + for (f_array_length_t i = 0; i < destination.array[0].used; ++i) { + assert_int_equal(destination.array[0].array[i], i + 1); + } // for + } - { - const f_status_t status = f_uint128ss_append(data, 0); + for (f_array_length_t i = 0; i < destination.used; ++i) { + free((void *) destination.array[i].array); + } // for - assert_int_equal(status, F_status_set_error(F_parameter)); - } + free((void *) source.array); + free((void *) destination.array); } #ifdef __cplusplus 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 index d019beb..2a0af89 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__uint128ss_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint128ss_append() + * @see f_uint128ss_append() */ -extern void test__f_type_array_uint128ss_append__works(void **state); +extern void test__f_type_array_uint128ss_append__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_uint128ss_append() + * @see f_uint128ss_append() */ extern void test__f_type_array_uint128ss_append__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint128ss_append() + * @see f_uint128ss_append() */ -extern void test__f_type_array_uint128ss_append__parameter_checking(void **state); +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 index a3ca3c0..7db1546 100644 --- 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 @@ -5,6 +5,43 @@ 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; @@ -63,43 +100,6 @@ void test__f_type_array_uint128ss_append_all__works(void **state) { free((void *) destination.array); } -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__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)); - } -} - #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 index 0b10466..f727d4c 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__uint128ss_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint128ss_append_all() + * @see f_uint128ss_append_all() */ -extern void test__f_type_array_uint128ss_append_all__works(void **state); +extern void test__f_type_array_uint128ss_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_uint128ss_append_all() + * @see f_uint128ss_append_all() */ extern void test__f_type_array_uint128ss_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint128ss_append_all() + * @see f_uint128ss_append_all() */ -extern void test__f_type_array_uint128ss_append_all__parameter_checking(void **state); +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 index c5f8994..71e42e2 100644 --- 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 @@ -5,12 +5,28 @@ extern "C" { #endif -void test__f_type_array_uint128ss_decimate_by__works(void **state) { +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); @@ -19,25 +35,33 @@ void test__f_type_array_uint128ss_decimate_by__works(void **state) { } { - const f_status_t status = f_uint128ss_decimate_by(length, &data); + const f_status_t status = f_uint128ss_decimate_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_uint128ss_decimate_by__parameter_checking(void **state) { +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_decimate_by(length, 0); + const f_status_t status = f_uint128ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + 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); } 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 index 763184e..67ed15a 100644 --- 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 @@ -11,17 +11,24 @@ #define _TEST__F_type_array__uint128ss_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint128ss_decimate_by() + * @see f_uint128ss_decimate_by() */ -extern void test__f_type_array_uint128ss_decimate_by__works(void **state); +extern void test__f_type_array_uint128ss_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * * @see f_type_array_uint128ss_decimate_by() */ -extern void test__f_type_array_uint128ss_decimate_by__parameter_checking(void **state); +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 index e8d7ee5..59f7298 100644 --- 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 @@ -5,12 +5,28 @@ extern "C" { #endif -void test__f_type_array_uint128ss_decrease_by__works(void **state) { +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); @@ -19,25 +35,33 @@ void test__f_type_array_uint128ss_decrease_by__works(void **state) { } { - const f_status_t status = f_uint128ss_decrease_by(length, &data); + const f_status_t status = f_uint128ss_decrease_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_uint128ss_decrease_by__parameter_checking(void **state) { +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_decrease_by(length, 0); + const f_status_t status = f_uint128ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + 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); } 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 index f6787bc..2ebace3 100644 --- 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 @@ -11,17 +11,24 @@ #define _TEST__F_type_array__uint128ss_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint128ss_decrease_by() + * @see f_uint128ss_decrease_by() */ -extern void test__f_type_array_uint128ss_decrease_by__works(void **state); +extern void test__f_type_array_uint128ss_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_uint128ss_decrease_by() + * @see f_uint128ss_decrease_by() */ -extern void test__f_type_array_uint128ss_decrease_by__parameter_checking(void **state); +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 index 85cb58e..cc5daad 100644 --- 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 @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_uint128ss_increase__works(void **state) { +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_resize(length, &data); + const f_status_t status = f_uint128ss_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); 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); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -55,17 +45,27 @@ void test__f_type_array_uint128ss_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_uint128ss_increase__parameter_checking(void **state) { +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_increase(length, 0); + const f_status_t status = f_uint128ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 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); 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 index 98a2cce..b564164 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__uint128ss_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint128ss_increase() + * @see f_uint128ss_increase() */ -extern void test__f_type_array_uint128ss_increase__works(void **state); +extern void test__f_type_array_uint128ss_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_uint128ss_increase() + * @see f_uint128ss_increase() */ extern void test__f_type_array_uint128ss_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint128ss_increase() + * @see f_uint128ss_increase() */ -extern void test__f_type_array_uint128ss_increase__parameter_checking(void **state); +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 index 90ee4a9..af14f4a 100644 --- 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 @@ -5,12 +5,28 @@ extern "C" { #endif -void test__f_type_array_uint128ss_increase_by__works(void **state) { +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); @@ -19,32 +35,48 @@ void test__f_type_array_uint128ss_increase_by__works(void **state) { } { - data.used = 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_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); + 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__parameter_checking(void **state) { +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_increase_by(length, 0); + const f_status_t status = f_uint128ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + { + 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 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 index c1950d8..c49f802 100644 --- 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 @@ -11,17 +11,24 @@ #define _TEST__F_type_array__uint128ss_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint128ss_increase_by() + * @see f_uint128ss_increase_by() */ -extern void test__f_type_array_uint128ss_increase_by__works(void **state); +extern void test__f_type_array_uint128ss_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_uint128ss_increase_by() + * @see f_uint128ss_increase_by() */ -extern void test__f_type_array_uint128ss_increase_by__parameter_checking(void **state); +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 index b4999f1..52a3c4a 100644 --- 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 @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_uint128ss_resize__works(void **state) { +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, &data); + const f_status_t status = f_uint128ss_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_uint128ss_resize__parameter_checking(void **state) { +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, 0); + const f_status_t status = f_uint128ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus 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 index be44630..30ad697 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint128ss_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint128ss_resize() + * @see f_uint128ss_resize() */ -extern void test__f_type_array_uint128ss_resize__works(void **state); +extern void test__f_type_array_uint128ss_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint128ss_resize() + * @see f_uint128ss_resize() */ -extern void test__f_type_array_uint128ss_resize__parameter_checking(void **state); +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 index e5845d1..c9c6b44 100644 --- 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 @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_uint16s_adjust__works(void **state) { +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, &data); + const f_status_t status = f_uint16s_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_uint16s_adjust__parameter_checking(void **state) { +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, 0); + const f_status_t status = f_uint16s_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus 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 index ba5c21f..41d3418 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint16s_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint16s_adjust() + * @see f_uint16s_adjust() */ -extern void test__f_type_array_uint16s_adjust__works(void **state); +extern void test__f_type_array_uint16s_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint16s_adjust() + * @see f_uint16s_adjust() */ -extern void test__f_type_array_uint16s_adjust__parameter_checking(void **state); +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_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_append.c index 62f6a65..0fc4291 100644 --- 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 @@ -5,6 +5,17 @@ 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; @@ -21,17 +32,6 @@ void test__f_type_array_uint16s_append__works(void **state) { free((void *) destination.array); } -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)); - } -} - #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 index 3a111c6..46aa1c8 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint16s_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint16s_append() + * @see f_uint16s_append() */ -extern void test__f_type_array_uint16s_append__works(void **state); +extern void test__f_type_array_uint16s_append__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint16s_append() + * @see f_uint16s_append() */ -extern void test__f_type_array_uint16s_append__parameter_checking(void **state); +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 index 519411b..a6d6339 100644 --- 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 @@ -5,10 +5,20 @@ extern "C" { #endif -void test__f_type_array_uint16s_append_all__works(void **state) { +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; - const int length_used = 2; f_uint16s_t source = f_uint16s_t_initialize; f_uint16s_t destination = f_uint16s_t_initialize; @@ -20,29 +30,22 @@ void test__f_type_array_uint16s_append_all__works(void **state) { 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_array_length_t i = 0; i < source.used; ++i) { - assert_int_equal(destination.array[i], i + 1); - } // for + 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); - free((void *) destination.array); } -void test__f_type_array_uint16s_append_all__returns_data_not(void **state) { +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; @@ -54,27 +57,24 @@ void test__f_type_array_uint16s_append_all__returns_data_not(void **state) { 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_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); + assert_int_equal(status, F_none); + assert_int_equal(destination.used, source.used); + assert_int_equal(destination.size, source.used); + + for (f_array_length_t i = 0; i < source.used; ++i) { + assert_int_equal(destination.array[i], i + 1); + } // for } free((void *) source.array); -} - -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)); - } + free((void *) destination.array); } #ifdef __cplusplus 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 index db4a986..b61b3d2 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__uint16s_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint16s_append_all() + * @see f_uint16s_append_all() */ -extern void test__f_type_array_uint16s_append_all__works(void **state); +extern void test__f_type_array_uint16s_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_uint16s_append_all() + * @see f_uint16s_append_all() */ extern void test__f_type_array_uint16s_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint16s_append_all() + * @see f_uint16s_append_all() */ -extern void test__f_type_array_uint16s_append_all__parameter_checking(void **state); +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 index 6dbfbd3..7a9020b 100644 --- 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 @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_uint16s_decimate_by__works(void **state) { +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_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); + const f_status_t status = f_uint16s_decimate_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_uint16s_decimate_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_uint16s_decimate_by__parameter_checking(void **state) { +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_decimate_by(length, 0); + const f_status_t status = f_uint16s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + 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); } 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 index 1a76948..90ab5fd 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint16s_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint16s_decimate_by() + * @see f_uint16s_decimate_by() */ -extern void test__f_type_array_uint16s_decimate_by__works(void **state); +extern void test__f_type_array_uint16s_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint16s_decimate_by() + * @see f_uint16s_decimate_by() */ -extern void test__f_type_array_uint16s_decimate_by__parameter_checking(void **state); +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 index bc68694..00979b4 100644 --- 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 @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_uint16s_decrease_by__works(void **state) { +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_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); + const f_status_t status = f_uint16s_decrease_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_uint16s_decrease_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_uint16s_decrease_by__parameter_checking(void **state) { +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_decrease_by(length, 0); + const f_status_t status = f_uint16s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + 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); } 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 index 144eda0..c2ab789 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint16s_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint16s_decrease_by() + * @see f_uint16s_decrease_by() */ -extern void test__f_type_array_uint16s_decrease_by__works(void **state); +extern void test__f_type_array_uint16s_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint16s_decrease_by() + * @see f_uint16s_decrease_by() */ -extern void test__f_type_array_uint16s_decrease_by__parameter_checking(void **state); +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 index 065a40a..95342c8 100644 --- 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 @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_uint16s_increase__works(void **state) { +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_resize(length, &data); + const f_status_t status = f_uint16s_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); 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); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -55,17 +45,27 @@ void test__f_type_array_uint16s_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_uint16s_increase__parameter_checking(void **state) { +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_increase(length, 0); + const f_status_t status = f_uint16s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 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); 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 index a754c56..0c6612e 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__uint16s_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint16s_increase() + * @see f_uint16s_increase() */ -extern void test__f_type_array_uint16s_increase__works(void **state); +extern void test__f_type_array_uint16s_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_uint16s_increase() + * @see f_uint16s_increase() */ extern void test__f_type_array_uint16s_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint16s_increase() + * @see f_uint16s_increase() */ -extern void test__f_type_array_uint16s_increase__parameter_checking(void **state); +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 index ca07bdc..1784d06 100644 --- 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 @@ -5,6 +5,22 @@ 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__works(void **state) { const int length = 5; @@ -31,22 +47,6 @@ void test__f_type_array_uint16s_increase_by__works(void **state) { free((void *) data.array); } -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); -} - #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 index 61a7e0f..5d7f3e2 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint16s_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint16s_increase_by() + * @see f_uint16s_increase_by() */ -extern void test__f_type_array_uint16s_increase_by__works(void **state); +extern void test__f_type_array_uint16s_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint16s_increase_by() + * @see f_uint16s_increase_by() */ -extern void test__f_type_array_uint16s_increase_by__parameter_checking(void **state); +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 index 5357df0..048ff5e 100644 --- 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 @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_uint16s_resize__works(void **state) { +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, &data); + const f_status_t status = f_uint16s_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_uint16s_resize__parameter_checking(void **state) { +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, 0); + const f_status_t status = f_uint16s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus 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 index d34513e..a545df4 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint16s_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint16s_resize() + * @see f_uint16s_resize() */ -extern void test__f_type_array_uint16s_resize__works(void **state); +extern void test__f_type_array_uint16s_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint16s_resize() + * @see f_uint16s_resize() */ -extern void test__f_type_array_uint16s_resize__parameter_checking(void **state); +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-uint16ss_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_adjust.c index 58dce85..c1c2285 100644 --- 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 @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_uint16ss_adjust__works(void **state) { +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, &data); + const f_status_t status = f_uint16ss_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_uint16ss_adjust__parameter_checking(void **state) { +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, 0); + const f_status_t status = f_uint16ss_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus 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 index 427d558..e27a25a 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint16ss_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint16ss_adjust() + * @see f_uint16ss_adjust() */ -extern void test__f_type_array_uint16ss_adjust__works(void **state); +extern void test__f_type_array_uint16ss_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint16ss_adjust() + * @see f_uint16ss_adjust() */ -extern void test__f_type_array_uint16ss_adjust__parameter_checking(void **state); +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 index a89594f..e10b0ea 100644 --- 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 @@ -5,7 +5,18 @@ extern "C" { #endif -void test__f_type_array_uint16ss_append__works(void **state) { +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; @@ -19,32 +30,19 @@ void test__f_type_array_uint16ss_append__works(void **state) { 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_array_length_t i = 0; i < destination.array[0].used; ++i) { - assert_int_equal(destination.array[0].array[i], i + 1); - } // for + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + assert_null(destination.array); } - for (f_array_length_t i = 0; i < destination.used; ++i) { - free((void *) destination.array[i].array); - } // for - free((void *) source.array); - free((void *) destination.array); } -void test__f_type_array_uint16ss_append__returns_data_not(void **state) { +void test__f_type_array_uint16ss_append__works(void **state) { const int length = 5; f_uint16s_t source = f_uint16s_t_initialize; @@ -58,27 +56,29 @@ void test__f_type_array_uint16ss_append__returns_data_not(void **state) { 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_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__parameter_checking(void **state) { + 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); - f_uint16s_t data = f_uint16s_t_initialize; + for (f_array_length_t i = 0; i < destination.array[0].used; ++i) { + assert_int_equal(destination.array[0].array[i], i + 1); + } // for + } - { - const f_status_t status = f_uint16ss_append(data, 0); + for (f_array_length_t i = 0; i < destination.used; ++i) { + free((void *) destination.array[i].array); + } // for - assert_int_equal(status, F_status_set_error(F_parameter)); - } + free((void *) source.array); + free((void *) destination.array); } #ifdef __cplusplus 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 index 3ddc590..c9daf1c 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__uint16ss_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint16ss_append() + * @see f_uint16ss_append() */ -extern void test__f_type_array_uint16ss_append__works(void **state); +extern void test__f_type_array_uint16ss_append__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_uint16ss_append() + * @see f_uint16ss_append() */ extern void test__f_type_array_uint16ss_append__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint16ss_append() + * @see f_uint16ss_append() */ -extern void test__f_type_array_uint16ss_append__parameter_checking(void **state); +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 index 4f1f37c..7480db0 100644 --- 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 @@ -5,6 +5,43 @@ 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; @@ -63,43 +100,6 @@ void test__f_type_array_uint16ss_append_all__works(void **state) { free((void *) destination.array); } -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__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)); - } -} - #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 index 2048169..0453a7f 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__uint16ss_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint16ss_append_all() + * @see f_uint16ss_append_all() */ -extern void test__f_type_array_uint16ss_append_all__works(void **state); +extern void test__f_type_array_uint16ss_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_uint16ss_append_all() + * @see f_uint16ss_append_all() */ extern void test__f_type_array_uint16ss_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint16ss_append_all() + * @see f_uint16ss_append_all() */ -extern void test__f_type_array_uint16ss_append_all__parameter_checking(void **state); +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 index f02ea0d..bc1bf20 100644 --- 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 @@ -5,12 +5,28 @@ extern "C" { #endif -void test__f_type_array_uint16ss_decimate_by__works(void **state) { +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); @@ -19,25 +35,33 @@ void test__f_type_array_uint16ss_decimate_by__works(void **state) { } { - const f_status_t status = f_uint16ss_decimate_by(length, &data); + const f_status_t status = f_uint16ss_decimate_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_uint16ss_decimate_by__parameter_checking(void **state) { +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_decimate_by(length, 0); + const f_status_t status = f_uint16ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + 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); } 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 index 08b335d..5802d7e 100644 --- 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 @@ -11,17 +11,24 @@ #define _TEST__F_type_array__uint16ss_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint16ss_decimate_by() + * @see f_uint16ss_decimate_by() */ -extern void test__f_type_array_uint16ss_decimate_by__works(void **state); +extern void test__f_type_array_uint16ss_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * * @see f_type_array_uint16ss_decimate_by() */ -extern void test__f_type_array_uint16ss_decimate_by__parameter_checking(void **state); +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 index 4a547ab..2b9c955 100644 --- 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 @@ -5,12 +5,28 @@ extern "C" { #endif -void test__f_type_array_uint16ss_decrease_by__works(void **state) { +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); @@ -19,25 +35,33 @@ void test__f_type_array_uint16ss_decrease_by__works(void **state) { } { - const f_status_t status = f_uint16ss_decrease_by(length, &data); + const f_status_t status = f_uint16ss_decrease_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_uint16ss_decrease_by__parameter_checking(void **state) { +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_decrease_by(length, 0); + const f_status_t status = f_uint16ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + 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); } 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 index e9c46e396..c30671d 100644 --- 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 @@ -11,17 +11,24 @@ #define _TEST__F_type_array__uint16ss_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint16ss_decrease_by() + * @see f_uint16ss_decrease_by() */ -extern void test__f_type_array_uint16ss_decrease_by__works(void **state); +extern void test__f_type_array_uint16ss_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_uint16ss_decrease_by() + * @see f_uint16ss_decrease_by() */ -extern void test__f_type_array_uint16ss_decrease_by__parameter_checking(void **state); +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 index b47b0d2..8808da3 100644 --- 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 @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_uint16ss_increase__works(void **state) { +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_resize(length, &data); + const f_status_t status = f_uint16ss_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); 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); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -55,17 +45,27 @@ void test__f_type_array_uint16ss_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_uint16ss_increase__parameter_checking(void **state) { +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_increase(length, 0); + const f_status_t status = f_uint16ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 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); 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 index df1cbf2..c464fae 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__uint16ss_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint16ss_increase() + * @see f_uint16ss_increase() */ -extern void test__f_type_array_uint16ss_increase__works(void **state); +extern void test__f_type_array_uint16ss_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_uint16ss_increase() + * @see f_uint16ss_increase() */ extern void test__f_type_array_uint16ss_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint16ss_increase() + * @see f_uint16ss_increase() */ -extern void test__f_type_array_uint16ss_increase__parameter_checking(void **state); +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 index 4ad84b6..79b0900 100644 --- 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 @@ -5,12 +5,28 @@ extern "C" { #endif -void test__f_type_array_uint16ss_increase_by__works(void **state) { +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); @@ -19,32 +35,48 @@ void test__f_type_array_uint16ss_increase_by__works(void **state) { } { - data.used = 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_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); + 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__parameter_checking(void **state) { +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_increase_by(length, 0); + const f_status_t status = f_uint16ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + { + 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 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 index 54cc5a3..4aa8fa9 100644 --- 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 @@ -11,17 +11,24 @@ #define _TEST__F_type_array__uint16ss_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint16ss_increase_by() + * @see f_uint16ss_increase_by() */ -extern void test__f_type_array_uint16ss_increase_by__works(void **state); +extern void test__f_type_array_uint16ss_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_uint16ss_increase_by() + * @see f_uint16ss_increase_by() */ -extern void test__f_type_array_uint16ss_increase_by__parameter_checking(void **state); +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 index 4936f1b..b087228 100644 --- 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 @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_uint16ss_resize__works(void **state) { +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, &data); + const f_status_t status = f_uint16ss_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_uint16ss_resize__parameter_checking(void **state) { +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, 0); + const f_status_t status = f_uint16ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus 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 index 5f1af71..4f4a2ae 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint16ss_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint16ss_resize() + * @see f_uint16ss_resize() */ -extern void test__f_type_array_uint16ss_resize__works(void **state); +extern void test__f_type_array_uint16ss_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint16ss_resize() + * @see f_uint16ss_resize() */ -extern void test__f_type_array_uint16ss_resize__parameter_checking(void **state); +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 index 70af090..2e732db 100644 --- 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 @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_uint32s_adjust__works(void **state) { +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, &data); + const f_status_t status = f_uint32s_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_uint32s_adjust__parameter_checking(void **state) { +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, 0); + const f_status_t status = f_uint32s_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus 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 index 4b85870..a3f4cd0 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint32s_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint32s_adjust() + * @see f_uint32s_adjust() */ -extern void test__f_type_array_uint32s_adjust__works(void **state); +extern void test__f_type_array_uint32s_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint32s_adjust() + * @see f_uint32s_adjust() */ -extern void test__f_type_array_uint32s_adjust__parameter_checking(void **state); +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_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_append.c index 723abf7..7188790 100644 --- 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 @@ -5,6 +5,17 @@ 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; @@ -21,17 +32,6 @@ void test__f_type_array_uint32s_append__works(void **state) { free((void *) destination.array); } -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)); - } -} - #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 index 884e11e..d8b5808 100644 --- 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 @@ -9,19 +9,19 @@ */ #ifndef _TEST__F_type_array__uint32s_append #define _TEST__F_type_array__uint32s_append - /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint32s_append() + * @see f_uint32s_append() */ -extern void test__f_type_array_uint32s_append__works(void **state); +extern void test__f_type_array_uint32s_append__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint32s_append() + * @see f_uint32s_append() */ -extern void test__f_type_array_uint32s_append__parameter_checking(void **state); +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 index 43529a0..1caea4e 100644 --- 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 @@ -5,10 +5,20 @@ extern "C" { #endif -void test__f_type_array_uint32s_append_all__works(void **state) { +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; - const int length_used = 2; f_uint32s_t source = f_uint32s_t_initialize; f_uint32s_t destination = f_uint32s_t_initialize; @@ -20,29 +30,22 @@ void test__f_type_array_uint32s_append_all__works(void **state) { 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_array_length_t i = 0; i < source.used; ++i) { - assert_int_equal(destination.array[i], i + 1); - } // for + 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); - free((void *) destination.array); } -void test__f_type_array_uint32s_append_all__returns_data_not(void **state) { +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; @@ -54,27 +57,24 @@ void test__f_type_array_uint32s_append_all__returns_data_not(void **state) { 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_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); + assert_int_equal(status, F_none); + assert_int_equal(destination.used, source.used); + assert_int_equal(destination.size, source.used); + + for (f_array_length_t i = 0; i < source.used; ++i) { + assert_int_equal(destination.array[i], i + 1); + } // for } free((void *) source.array); -} - -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)); - } + free((void *) destination.array); } #ifdef __cplusplus 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 index 521e499..a4f9181 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__uint32s_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint32s_append_all() + * @see f_uint32s_append_all() */ -extern void test__f_type_array_uint32s_append_all__works(void **state); +extern void test__f_type_array_uint32s_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_uint32s_append_all() + * @see f_uint32s_append_all() */ extern void test__f_type_array_uint32s_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint32s_append_all() + * @see f_uint32s_append_all() */ -extern void test__f_type_array_uint32s_append_all__parameter_checking(void **state); +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 index 950d1b0..5fc0dc4 100644 --- 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 @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_uint32s_decimate_by__works(void **state) { +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_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); + const f_status_t status = f_uint32s_decimate_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_uint32s_decimate_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_uint32s_decimate_by__parameter_checking(void **state) { +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_decimate_by(length, 0); + const f_status_t status = f_uint32s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + 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); } 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 index f549ca6..e76bc60 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint32s_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint32s_decimate_by() + * @see f_uint32s_decimate_by() */ -extern void test__f_type_array_uint32s_decimate_by__works(void **state); +extern void test__f_type_array_uint32s_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint32s_decimate_by() + * @see f_uint32s_decimate_by() */ -extern void test__f_type_array_uint32s_decimate_by__parameter_checking(void **state); +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 index 392052b..207d384 100644 --- 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 @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_uint32s_decrease_by__works(void **state) { +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_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); + const f_status_t status = f_uint32s_decrease_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_uint32s_decrease_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_uint32s_decrease_by__parameter_checking(void **state) { +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_decrease_by(length, 0); + const f_status_t status = f_uint32s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + 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); } 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 index 35f03bb..bf74dcb 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint32s_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint32s_decrease_by() + * @see f_uint32s_decrease_by() */ -extern void test__f_type_array_uint32s_decrease_by__works(void **state); +extern void test__f_type_array_uint32s_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint32s_decrease_by() + * @see f_uint32s_decrease_by() */ -extern void test__f_type_array_uint32s_decrease_by__parameter_checking(void **state); +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 index d77df7f..378ae00 100644 --- 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 @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_uint32s_increase__works(void **state) { +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_resize(length, &data); + const f_status_t status = f_uint32s_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); 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); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -55,17 +45,27 @@ void test__f_type_array_uint32s_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_uint32s_increase__parameter_checking(void **state) { +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_increase(length, 0); + const f_status_t status = f_uint32s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 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); 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 index e0db8f3..059cb05 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__uint32s_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint32s_increase() + * @see f_uint32s_increase() */ -extern void test__f_type_array_uint32s_increase__works(void **state); +extern void test__f_type_array_uint32s_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_uint32s_increase() + * @see f_uint32s_increase() */ extern void test__f_type_array_uint32s_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint32s_increase() + * @see f_uint32s_increase() */ -extern void test__f_type_array_uint32s_increase__parameter_checking(void **state); +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 index f165f04..8d42d04 100644 --- 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 @@ -5,6 +5,22 @@ 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__works(void **state) { const int length = 5; @@ -31,22 +47,6 @@ void test__f_type_array_uint32s_increase_by__works(void **state) { free((void *) data.array); } -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); -} - #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 index 6afbf5d..9b6dd45 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint32s_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint32s_increase_by() + * @see f_uint32s_increase_by() */ -extern void test__f_type_array_uint32s_increase_by__works(void **state); +extern void test__f_type_array_uint32s_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint32s_increase_by() + * @see f_uint32s_increase_by() */ -extern void test__f_type_array_uint32s_increase_by__parameter_checking(void **state); +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 index 4006ef2..54d8457 100644 --- 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 @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_uint32s_resize__works(void **state) { +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, &data); + const f_status_t status = f_uint32s_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_uint32s_resize__parameter_checking(void **state) { +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, 0); + const f_status_t status = f_uint32s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus 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 index 26a116d..6d1377d 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint32s_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint32s_resize() + * @see f_uint32s_resize() */ -extern void test__f_type_array_uint32s_resize__works(void **state); +extern void test__f_type_array_uint32s_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint32s_resize() + * @see f_uint32s_resize() */ -extern void test__f_type_array_uint32s_resize__parameter_checking(void **state); +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-uint32ss_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_adjust.c index d180809..89bf16c 100644 --- 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 @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_uint32ss_adjust__works(void **state) { +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, &data); + const f_status_t status = f_uint32ss_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_uint32ss_adjust__parameter_checking(void **state) { +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, 0); + const f_status_t status = f_uint32ss_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus 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 index 5d27154..875a950 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint32ss_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint32ss_adjust() + * @see f_uint32ss_adjust() */ -extern void test__f_type_array_uint32ss_adjust__works(void **state); +extern void test__f_type_array_uint32ss_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint32ss_adjust() + * @see f_uint32ss_adjust() */ -extern void test__f_type_array_uint32ss_adjust__parameter_checking(void **state); +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 index 32cd338..c88d473 100644 --- 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 @@ -5,7 +5,18 @@ extern "C" { #endif -void test__f_type_array_uint32ss_append__works(void **state) { +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; @@ -19,32 +30,19 @@ void test__f_type_array_uint32ss_append__works(void **state) { 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_array_length_t i = 0; i < destination.array[0].used; ++i) { - assert_int_equal(destination.array[0].array[i], i + 1); - } // for + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + assert_null(destination.array); } - for (f_array_length_t i = 0; i < destination.used; ++i) { - free((void *) destination.array[i].array); - } // for - free((void *) source.array); - free((void *) destination.array); } -void test__f_type_array_uint32ss_append__returns_data_not(void **state) { +void test__f_type_array_uint32ss_append__works(void **state) { const int length = 5; f_uint32s_t source = f_uint32s_t_initialize; @@ -58,27 +56,29 @@ void test__f_type_array_uint32ss_append__returns_data_not(void **state) { 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_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__parameter_checking(void **state) { + 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); - f_uint32s_t data = f_uint32s_t_initialize; + for (f_array_length_t i = 0; i < destination.array[0].used; ++i) { + assert_int_equal(destination.array[0].array[i], i + 1); + } // for + } - { - const f_status_t status = f_uint32ss_append(data, 0); + for (f_array_length_t i = 0; i < destination.used; ++i) { + free((void *) destination.array[i].array); + } // for - assert_int_equal(status, F_status_set_error(F_parameter)); - } + free((void *) source.array); + free((void *) destination.array); } #ifdef __cplusplus 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 index fd2cf40..58480ad 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__uint32ss_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint32ss_append() + * @see f_uint32ss_append() */ -extern void test__f_type_array_uint32ss_append__works(void **state); +extern void test__f_type_array_uint32ss_append__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_uint32ss_append() + * @see f_uint32ss_append() */ extern void test__f_type_array_uint32ss_append__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint32ss_append() + * @see f_uint32ss_append() */ -extern void test__f_type_array_uint32ss_append__parameter_checking(void **state); +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 index 032593a..41b482f 100644 --- 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 @@ -5,6 +5,43 @@ 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; @@ -63,43 +100,6 @@ void test__f_type_array_uint32ss_append_all__works(void **state) { free((void *) destination.array); } -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__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)); - } -} - #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 index 8ca0605..0135f4a 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__uint32ss_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint32ss_append_all() + * @see f_uint32ss_append_all() */ -extern void test__f_type_array_uint32ss_append_all__works(void **state); +extern void test__f_type_array_uint32ss_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_uint32ss_append_all() + * @see f_uint32ss_append_all() */ extern void test__f_type_array_uint32ss_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint32ss_append_all() + * @see f_uint32ss_append_all() */ -extern void test__f_type_array_uint32ss_append_all__parameter_checking(void **state); +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 index d941d02..5219c96 100644 --- 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 @@ -5,12 +5,28 @@ extern "C" { #endif -void test__f_type_array_uint32ss_decimate_by__works(void **state) { +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); @@ -19,25 +35,33 @@ void test__f_type_array_uint32ss_decimate_by__works(void **state) { } { - const f_status_t status = f_uint32ss_decimate_by(length, &data); + const f_status_t status = f_uint32ss_decimate_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_uint32ss_decimate_by__parameter_checking(void **state) { +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_decimate_by(length, 0); + const f_status_t status = f_uint32ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + 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); } 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 index 50380ba..7955129 100644 --- 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 @@ -11,17 +11,24 @@ #define _TEST__F_type_array__uint32ss_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint32ss_decimate_by() + * @see f_uint32ss_decimate_by() */ -extern void test__f_type_array_uint32ss_decimate_by__works(void **state); +extern void test__f_type_array_uint32ss_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * * @see f_type_array_uint32ss_decimate_by() */ -extern void test__f_type_array_uint32ss_decimate_by__parameter_checking(void **state); +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 index f7fd550..2751273 100644 --- 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 @@ -5,12 +5,28 @@ extern "C" { #endif -void test__f_type_array_uint32ss_decrease_by__works(void **state) { +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); @@ -19,25 +35,33 @@ void test__f_type_array_uint32ss_decrease_by__works(void **state) { } { - const f_status_t status = f_uint32ss_decrease_by(length, &data); + const f_status_t status = f_uint32ss_decrease_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_uint32ss_decrease_by__parameter_checking(void **state) { +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_decrease_by(length, 0); + const f_status_t status = f_uint32ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + 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); } 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 index 695a5c9..ae170aa 100644 --- 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 @@ -11,17 +11,24 @@ #define _TEST__F_type_array__uint32ss_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint32ss_decrease_by() + * @see f_uint32ss_decrease_by() */ -extern void test__f_type_array_uint32ss_decrease_by__works(void **state); +extern void test__f_type_array_uint32ss_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_uint32ss_decrease_by() + * @see f_uint32ss_decrease_by() */ -extern void test__f_type_array_uint32ss_decrease_by__parameter_checking(void **state); +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 index 432b362..344012e 100644 --- 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 @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_uint32ss_increase__works(void **state) { +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_resize(length, &data); + const f_status_t status = f_uint32ss_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); 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); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -55,17 +45,27 @@ void test__f_type_array_uint32ss_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_uint32ss_increase__parameter_checking(void **state) { +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_increase(length, 0); + const f_status_t status = f_uint32ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 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); 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 index 18beac0..754a1ba 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__uint32ss_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint32ss_increase() + * @see f_uint32ss_increase() */ -extern void test__f_type_array_uint32ss_increase__works(void **state); +extern void test__f_type_array_uint32ss_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_uint32ss_increase() + * @see f_uint32ss_increase() */ extern void test__f_type_array_uint32ss_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint32ss_increase() + * @see f_uint32ss_increase() */ -extern void test__f_type_array_uint32ss_increase__parameter_checking(void **state); +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 index 07000c3..449e2b2 100644 --- 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 @@ -5,12 +5,28 @@ extern "C" { #endif -void test__f_type_array_uint32ss_increase_by__works(void **state) { +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); @@ -19,32 +35,48 @@ void test__f_type_array_uint32ss_increase_by__works(void **state) { } { - data.used = 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_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); + 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__parameter_checking(void **state) { +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_increase_by(length, 0); + const f_status_t status = f_uint32ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + { + 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 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 index c05511d..cfbe2c5 100644 --- 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 @@ -11,17 +11,24 @@ #define _TEST__F_type_array__uint32ss_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint32ss_increase_by() + * @see f_uint32ss_increase_by() */ -extern void test__f_type_array_uint32ss_increase_by__works(void **state); +extern void test__f_type_array_uint32ss_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_uint32ss_increase_by() + * @see f_uint32ss_increase_by() */ -extern void test__f_type_array_uint32ss_increase_by__parameter_checking(void **state); +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 index 16b522e..27209a4 100644 --- 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 @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_uint32ss_resize__works(void **state) { +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, &data); + const f_status_t status = f_uint32ss_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_uint32ss_resize__parameter_checking(void **state) { +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, 0); + const f_status_t status = f_uint32ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus 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 index fd1ed4c..e5e6c9f 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint32ss_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint32ss_resize() + * @see f_uint32ss_resize() */ -extern void test__f_type_array_uint32ss_resize__works(void **state); +extern void test__f_type_array_uint32ss_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint32ss_resize() + * @see f_uint32ss_resize() */ -extern void test__f_type_array_uint32ss_resize__parameter_checking(void **state); +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 index 4336952..fd65031 100644 --- 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 @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_uint64s_adjust__works(void **state) { +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, &data); + const f_status_t status = f_uint64s_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_uint64s_adjust__parameter_checking(void **state) { +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, 0); + const f_status_t status = f_uint64s_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus 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 index 90f6b34..1a26284 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint64s_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint64s_adjust() + * @see f_uint64s_adjust() */ -extern void test__f_type_array_uint64s_adjust__works(void **state); +extern void test__f_type_array_uint64s_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint64s_adjust() + * @see f_uint64s_adjust() */ -extern void test__f_type_array_uint64s_adjust__parameter_checking(void **state); +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_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_append.c index 243e230..a4490fb 100644 --- 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 @@ -5,6 +5,17 @@ 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; @@ -21,17 +32,6 @@ void test__f_type_array_uint64s_append__works(void **state) { free((void *) destination.array); } -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)); - } -} - #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 index 2cc3a26..d912854 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint64s_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint64s_append() + * @see f_uint64s_append() */ -extern void test__f_type_array_uint64s_append__works(void **state); +extern void test__f_type_array_uint64s_append__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint64s_append() + * @see f_uint64s_append() */ -extern void test__f_type_array_uint64s_append__parameter_checking(void **state); +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 index 7b8902c..33db407 100644 --- 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 @@ -5,10 +5,20 @@ extern "C" { #endif -void test__f_type_array_uint64s_append_all__works(void **state) { +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; - const int length_used = 2; f_uint64s_t source = f_uint64s_t_initialize; f_uint64s_t destination = f_uint64s_t_initialize; @@ -20,29 +30,22 @@ void test__f_type_array_uint64s_append_all__works(void **state) { 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_array_length_t i = 0; i < source.used; ++i) { - assert_int_equal(destination.array[i], i + 1); - } // for + 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); - free((void *) destination.array); } -void test__f_type_array_uint64s_append_all__returns_data_not(void **state) { +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; @@ -54,27 +57,24 @@ void test__f_type_array_uint64s_append_all__returns_data_not(void **state) { 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_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); + assert_int_equal(status, F_none); + assert_int_equal(destination.used, source.used); + assert_int_equal(destination.size, source.used); + + for (f_array_length_t i = 0; i < source.used; ++i) { + assert_int_equal(destination.array[i], i + 1); + } // for } free((void *) source.array); -} - -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)); - } + free((void *) destination.array); } #ifdef __cplusplus 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 index 0a43b51..677529d 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__uint64s_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint64s_append_all() + * @see f_uint64s_append_all() */ -extern void test__f_type_array_uint64s_append_all__works(void **state); +extern void test__f_type_array_uint64s_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_uint64s_append_all() + * @see f_uint64s_append_all() */ extern void test__f_type_array_uint64s_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint64s_append_all() + * @see f_uint64s_append_all() */ -extern void test__f_type_array_uint64s_append_all__parameter_checking(void **state); +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 index f2e2f70..0353292 100644 --- 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 @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_uint64s_decimate_by__works(void **state) { +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_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); + const f_status_t status = f_uint64s_decimate_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_uint64s_decimate_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_uint64s_decimate_by__parameter_checking(void **state) { +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_decimate_by(length, 0); + const f_status_t status = f_uint64s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + 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); } 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 index 46c9b01..6ab6f11 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint64s_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint64s_decimate_by() + * @see f_uint64s_decimate_by() */ -extern void test__f_type_array_uint64s_decimate_by__works(void **state); +extern void test__f_type_array_uint64s_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint64s_decimate_by() + * @see f_uint64s_decimate_by() */ -extern void test__f_type_array_uint64s_decimate_by__parameter_checking(void **state); +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 index 09d1858..35d7845 100644 --- 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 @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_uint64s_decrease_by__works(void **state) { +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_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); + const f_status_t status = f_uint64s_decrease_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_uint64s_decrease_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_uint64s_decrease_by__parameter_checking(void **state) { +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_decrease_by(length, 0); + const f_status_t status = f_uint64s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + 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); } 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 index 69cdf74..c862c30 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint64s_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint64s_decrease_by() + * @see f_uint64s_decrease_by() */ -extern void test__f_type_array_uint64s_decrease_by__works(void **state); +extern void test__f_type_array_uint64s_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint64s_decrease_by() + * @see f_uint64s_decrease_by() */ -extern void test__f_type_array_uint64s_decrease_by__parameter_checking(void **state); +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 index 5f4e3d0..1a48211 100644 --- 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 @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_uint64s_increase__works(void **state) { +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_resize(length, &data); + const f_status_t status = f_uint64s_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); 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); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -55,17 +45,27 @@ void test__f_type_array_uint64s_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_uint64s_increase__parameter_checking(void **state) { +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_increase(length, 0); + const f_status_t status = f_uint64s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 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); 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 index 76a95f8..6337280 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__uint64s_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint64s_increase() + * @see f_uint64s_increase() */ -extern void test__f_type_array_uint64s_increase__works(void **state); +extern void test__f_type_array_uint64s_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_uint64s_increase() + * @see f_uint64s_increase() */ extern void test__f_type_array_uint64s_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint64s_increase() + * @see f_uint64s_increase() */ -extern void test__f_type_array_uint64s_increase__parameter_checking(void **state); +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 index 89c33b0..f3ef9ea 100644 --- 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 @@ -5,6 +5,22 @@ 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__works(void **state) { const int length = 5; @@ -31,22 +47,6 @@ void test__f_type_array_uint64s_increase_by__works(void **state) { free((void *) data.array); } -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); -} - #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 index e039521..60e4e77 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint64s_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint64s_increase_by() + * @see f_uint64s_increase_by() */ -extern void test__f_type_array_uint64s_increase_by__works(void **state); +extern void test__f_type_array_uint64s_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint64s_increase_by() + * @see f_uint64s_increase_by() */ -extern void test__f_type_array_uint64s_increase_by__parameter_checking(void **state); +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 index 53e459a..ee48739 100644 --- 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 @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_uint64s_resize__works(void **state) { +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, &data); + const f_status_t status = f_uint64s_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_uint64s_resize__parameter_checking(void **state) { +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, 0); + const f_status_t status = f_uint64s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus 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 index f28ff4b..405b16e 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint64s_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint64s_resize() + * @see f_uint64s_resize() */ -extern void test__f_type_array_uint64s_resize__works(void **state); +extern void test__f_type_array_uint64s_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint64s_resize() + * @see f_uint64s_resize() */ -extern void test__f_type_array_uint64s_resize__parameter_checking(void **state); +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-uint64ss_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_adjust.c index a069aa3..162a7b7 100644 --- 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 @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_uint64ss_adjust__works(void **state) { +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, &data); + const f_status_t status = f_uint64ss_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_uint64ss_adjust__parameter_checking(void **state) { +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, 0); + const f_status_t status = f_uint64ss_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus 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 index 66269a7..80705b2 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint64ss_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint64ss_adjust() + * @see f_uint64ss_adjust() */ -extern void test__f_type_array_uint64ss_adjust__works(void **state); +extern void test__f_type_array_uint64ss_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint64ss_adjust() + * @see f_uint64ss_adjust() */ -extern void test__f_type_array_uint64ss_adjust__parameter_checking(void **state); +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 index 1e54484..80a085c 100644 --- 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 @@ -5,7 +5,18 @@ extern "C" { #endif -void test__f_type_array_uint64ss_append__works(void **state) { +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; @@ -19,32 +30,19 @@ void test__f_type_array_uint64ss_append__works(void **state) { 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_array_length_t i = 0; i < destination.array[0].used; ++i) { - assert_int_equal(destination.array[0].array[i], i + 1); - } // for + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + assert_null(destination.array); } - for (f_array_length_t i = 0; i < destination.used; ++i) { - free((void *) destination.array[i].array); - } // for - free((void *) source.array); - free((void *) destination.array); } -void test__f_type_array_uint64ss_append__returns_data_not(void **state) { +void test__f_type_array_uint64ss_append__works(void **state) { const int length = 5; f_uint64s_t source = f_uint64s_t_initialize; @@ -58,27 +56,29 @@ void test__f_type_array_uint64ss_append__returns_data_not(void **state) { 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_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__parameter_checking(void **state) { + 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); - f_uint64s_t data = f_uint64s_t_initialize; + for (f_array_length_t i = 0; i < destination.array[0].used; ++i) { + assert_int_equal(destination.array[0].array[i], i + 1); + } // for + } - { - const f_status_t status = f_uint64ss_append(data, 0); + for (f_array_length_t i = 0; i < destination.used; ++i) { + free((void *) destination.array[i].array); + } // for - assert_int_equal(status, F_status_set_error(F_parameter)); - } + free((void *) source.array); + free((void *) destination.array); } #ifdef __cplusplus 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 index 071d13a..f10b1cb 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__uint64ss_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint64ss_append() + * @see f_uint64ss_append() */ -extern void test__f_type_array_uint64ss_append__works(void **state); +extern void test__f_type_array_uint64ss_append__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_uint64ss_append() + * @see f_uint64ss_append() */ extern void test__f_type_array_uint64ss_append__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint64ss_append() + * @see f_uint64ss_append() */ -extern void test__f_type_array_uint64ss_append__parameter_checking(void **state); +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 index 80edb1f..242c8e5 100644 --- 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 @@ -5,6 +5,43 @@ 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; @@ -63,43 +100,6 @@ void test__f_type_array_uint64ss_append_all__works(void **state) { free((void *) destination.array); } -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__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)); - } -} - #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 index 0bc11ed..9ea4309 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__uint64ss_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint64ss_append_all() + * @see f_uint64ss_append_all() */ -extern void test__f_type_array_uint64ss_append_all__works(void **state); +extern void test__f_type_array_uint64ss_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_uint64ss_append_all() + * @see f_uint64ss_append_all() */ extern void test__f_type_array_uint64ss_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint64ss_append_all() + * @see f_uint64ss_append_all() */ -extern void test__f_type_array_uint64ss_append_all__parameter_checking(void **state); +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 index 53edea2..889e2b9 100644 --- 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 @@ -5,12 +5,28 @@ extern "C" { #endif -void test__f_type_array_uint64ss_decimate_by__works(void **state) { +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); @@ -19,25 +35,33 @@ void test__f_type_array_uint64ss_decimate_by__works(void **state) { } { - const f_status_t status = f_uint64ss_decimate_by(length, &data); + const f_status_t status = f_uint64ss_decimate_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_uint64ss_decimate_by__parameter_checking(void **state) { +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_decimate_by(length, 0); + const f_status_t status = f_uint64ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + 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); } 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 index 97a969e..1be9c0c 100644 --- 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 @@ -11,17 +11,24 @@ #define _TEST__F_type_array__uint64ss_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint64ss_decimate_by() + * @see f_uint64ss_decimate_by() */ -extern void test__f_type_array_uint64ss_decimate_by__works(void **state); +extern void test__f_type_array_uint64ss_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * * @see f_type_array_uint64ss_decimate_by() */ -extern void test__f_type_array_uint64ss_decimate_by__parameter_checking(void **state); +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 index a5d8132..0240f3d 100644 --- 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 @@ -5,12 +5,28 @@ extern "C" { #endif -void test__f_type_array_uint64ss_decrease_by__works(void **state) { +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); @@ -19,25 +35,33 @@ void test__f_type_array_uint64ss_decrease_by__works(void **state) { } { - const f_status_t status = f_uint64ss_decrease_by(length, &data); + const f_status_t status = f_uint64ss_decrease_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_uint64ss_decrease_by__parameter_checking(void **state) { +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_decrease_by(length, 0); + const f_status_t status = f_uint64ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + 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); } 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 index 9927a94..83a3170 100644 --- 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 @@ -11,17 +11,24 @@ #define _TEST__F_type_array__uint64ss_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint64ss_decrease_by() + * @see f_uint64ss_decrease_by() */ -extern void test__f_type_array_uint64ss_decrease_by__works(void **state); +extern void test__f_type_array_uint64ss_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_uint64ss_decrease_by() + * @see f_uint64ss_decrease_by() */ -extern void test__f_type_array_uint64ss_decrease_by__parameter_checking(void **state); +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 index 8338db8..622dd67 100644 --- 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 @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_uint64ss_increase__works(void **state) { +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_resize(length, &data); + const f_status_t status = f_uint64ss_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); 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); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -55,17 +45,27 @@ void test__f_type_array_uint64ss_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_uint64ss_increase__parameter_checking(void **state) { +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_increase(length, 0); + const f_status_t status = f_uint64ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 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); 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 index ad9671b..35f50eb 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__uint64ss_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint64ss_increase() + * @see f_uint64ss_increase() */ -extern void test__f_type_array_uint64ss_increase__works(void **state); +extern void test__f_type_array_uint64ss_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_uint64ss_increase() + * @see f_uint64ss_increase() */ extern void test__f_type_array_uint64ss_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint64ss_increase() + * @see f_uint64ss_increase() */ -extern void test__f_type_array_uint64ss_increase__parameter_checking(void **state); +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 index ae5192f..d6e0bc5 100644 --- 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 @@ -5,12 +5,28 @@ extern "C" { #endif -void test__f_type_array_uint64ss_increase_by__works(void **state) { +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); @@ -19,32 +35,48 @@ void test__f_type_array_uint64ss_increase_by__works(void **state) { } { - data.used = 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_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); + 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__parameter_checking(void **state) { +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_increase_by(length, 0); + const f_status_t status = f_uint64ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + { + 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 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 index 3173268..6c275a3 100644 --- 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 @@ -11,17 +11,24 @@ #define _TEST__F_type_array__uint64ss_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint64ss_increase_by() + * @see f_uint64ss_increase_by() */ -extern void test__f_type_array_uint64ss_increase_by__works(void **state); +extern void test__f_type_array_uint64ss_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_uint64ss_increase_by() + * @see f_uint64ss_increase_by() */ -extern void test__f_type_array_uint64ss_increase_by__parameter_checking(void **state); +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 index c471785..f08eb18 100644 --- 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 @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_uint64ss_resize__works(void **state) { +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, &data); + const f_status_t status = f_uint64ss_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_uint64ss_resize__parameter_checking(void **state) { +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, 0); + const f_status_t status = f_uint64ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus 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 index acd18bc..9d67a21 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint64ss_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint64ss_resize() + * @see f_uint64ss_resize() */ -extern void test__f_type_array_uint64ss_resize__works(void **state); +extern void test__f_type_array_uint64ss_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint64ss_resize() + * @see f_uint64ss_resize() */ -extern void test__f_type_array_uint64ss_resize__parameter_checking(void **state); +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 index 33440e2..3817a51 100644 --- 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 @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_uint8s_adjust__works(void **state) { +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, &data); + const f_status_t status = f_uint8s_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_uint8s_adjust__parameter_checking(void **state) { +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, 0); + const f_status_t status = f_uint8s_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus 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 index d5afab2..bcdfa76 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint8s_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint8s_adjust() + * @see f_uint8s_adjust() */ -extern void test__f_type_array_uint8s_adjust__works(void **state); +extern void test__f_type_array_uint8s_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint8s_adjust() + * @see f_uint8s_adjust() */ -extern void test__f_type_array_uint8s_adjust__parameter_checking(void **state); +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_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_append.c index d039c47..caca1cc 100644 --- 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 @@ -5,6 +5,17 @@ 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; @@ -21,17 +32,6 @@ void test__f_type_array_uint8s_append__works(void **state) { free((void *) destination.array); } -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)); - } -} - #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 index 02968f7..5a933e3 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint8s_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint8s_append() + * @see f_uint8s_append() */ -extern void test__f_type_array_uint8s_append__works(void **state); +extern void test__f_type_array_uint8s_append__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint8s_append() + * @see f_uint8s_append() */ -extern void test__f_type_array_uint8s_append__parameter_checking(void **state); +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 index a94ae53..2922008 100644 --- 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 @@ -5,10 +5,20 @@ extern "C" { #endif -void test__f_type_array_uint8s_append_all__works(void **state) { +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; - const int length_used = 2; f_uint8s_t source = f_uint8s_t_initialize; f_uint8s_t destination = f_uint8s_t_initialize; @@ -20,29 +30,22 @@ void test__f_type_array_uint8s_append_all__works(void **state) { 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_array_length_t i = 0; i < source.used; ++i) { - assert_int_equal(destination.array[i], i + 1); - } // for + 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); - free((void *) destination.array); } -void test__f_type_array_uint8s_append_all__returns_data_not(void **state) { +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; @@ -54,27 +57,24 @@ void test__f_type_array_uint8s_append_all__returns_data_not(void **state) { 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_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); + assert_int_equal(status, F_none); + assert_int_equal(destination.used, source.used); + assert_int_equal(destination.size, source.used); + + for (f_array_length_t i = 0; i < source.used; ++i) { + assert_int_equal(destination.array[i], i + 1); + } // for } free((void *) source.array); -} - -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)); - } + free((void *) destination.array); } #ifdef __cplusplus 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 index 039bf1f..88654ec 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__uint8s_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint8s_append_all() + * @see f_uint8s_append_all() */ -extern void test__f_type_array_uint8s_append_all__works(void **state); +extern void test__f_type_array_uint8s_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_uint8s_append_all() + * @see f_uint8s_append_all() */ extern void test__f_type_array_uint8s_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint8s_append_all() + * @see f_uint8s_append_all() */ -extern void test__f_type_array_uint8s_append_all__parameter_checking(void **state); +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 index 40ceac0..2d3a21a 100644 --- 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 @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_uint8s_decimate_by__works(void **state) { +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_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); + const f_status_t status = f_uint8s_decimate_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_uint8s_decimate_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_uint8s_decimate_by__parameter_checking(void **state) { +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_decimate_by(length, 0); + const f_status_t status = f_uint8s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + 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); } 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 index fe4247b..709cec4 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint8s_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint8s_decimate_by() + * @see f_uint8s_decimate_by() */ -extern void test__f_type_array_uint8s_decimate_by__works(void **state); +extern void test__f_type_array_uint8s_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint8s_decimate_by() + * @see f_uint8s_decimate_by() */ -extern void test__f_type_array_uint8s_decimate_by__parameter_checking(void **state); +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 index a2baa1b..7b12e59 100644 --- 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 @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_uint8s_decrease_by__works(void **state) { +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_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); + const f_status_t status = f_uint8s_decrease_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_uint8s_decrease_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_uint8s_decrease_by__parameter_checking(void **state) { +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_decrease_by(length, 0); + const f_status_t status = f_uint8s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + 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); } 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 index 6157173..c73f24e 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint8s_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint8s_decrease_by() + * @see f_uint8s_decrease_by() */ -extern void test__f_type_array_uint8s_decrease_by__works(void **state); +extern void test__f_type_array_uint8s_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint8s_decrease_by() + * @see f_uint8s_decrease_by() */ -extern void test__f_type_array_uint8s_decrease_by__parameter_checking(void **state); +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 index 690bbaf..b5b8ccb 100644 --- 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 @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_uint8s_increase__works(void **state) { +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_resize(length, &data); + const f_status_t status = f_uint8s_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); 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); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -55,17 +45,27 @@ void test__f_type_array_uint8s_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_uint8s_increase__parameter_checking(void **state) { +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_increase(length, 0); + const f_status_t status = f_uint8s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 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); 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 index 77be554..99ff20b 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__uint8s_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint8s_increase() + * @see f_uint8s_increase() */ -extern void test__f_type_array_uint8s_increase__works(void **state); +extern void test__f_type_array_uint8s_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_uint8s_increase() + * @see f_uint8s_increase() */ extern void test__f_type_array_uint8s_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint8s_increase() + * @see f_uint8s_increase() */ -extern void test__f_type_array_uint8s_increase__parameter_checking(void **state); +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 index f507bd1..98a32b2 100644 --- 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 @@ -5,6 +5,22 @@ 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__works(void **state) { const int length = 5; @@ -31,22 +47,6 @@ void test__f_type_array_uint8s_increase_by__works(void **state) { free((void *) data.array); } -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); -} - #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 index 7c8206f..7ac98eb 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint8s_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint8s_increase_by() + * @see f_uint8s_increase_by() */ -extern void test__f_type_array_uint8s_increase_by__works(void **state); +extern void test__f_type_array_uint8s_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint8s_increase_by() + * @see f_uint8s_increase_by() */ -extern void test__f_type_array_uint8s_increase_by__parameter_checking(void **state); +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 index 83b457a..5c2d172 100644 --- 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 @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_uint8s_resize__works(void **state) { +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, &data); + const f_status_t status = f_uint8s_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_uint8s_resize__parameter_checking(void **state) { +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, 0); + const f_status_t status = f_uint8s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus 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 index 8f258e3..53997a6 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint8s_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint8s_resize() + * @see f_uint8s_resize() */ -extern void test__f_type_array_uint8s_resize__works(void **state); +extern void test__f_type_array_uint8s_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint8s_resize() + * @see f_uint8s_resize() */ -extern void test__f_type_array_uint8s_resize__parameter_checking(void **state); +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-uint8ss_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_adjust.c index ec3eed9..45ace00 100644 --- 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 @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_uint8ss_adjust__works(void **state) { +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, &data); + const f_status_t status = f_uint8ss_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_uint8ss_adjust__parameter_checking(void **state) { +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, 0); + const f_status_t status = f_uint8ss_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus 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 index b6d8dfb..7fc1ba8 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint8ss_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint8ss_adjust() + * @see f_uint8ss_adjust() */ -extern void test__f_type_array_uint8ss_adjust__works(void **state); +extern void test__f_type_array_uint8ss_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint8ss_adjust() + * @see f_uint8ss_adjust() */ -extern void test__f_type_array_uint8ss_adjust__parameter_checking(void **state); +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 index 650d761..1db489a 100644 --- 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 @@ -5,7 +5,18 @@ extern "C" { #endif -void test__f_type_array_uint8ss_append__works(void **state) { +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; @@ -19,32 +30,19 @@ void test__f_type_array_uint8ss_append__works(void **state) { 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_array_length_t i = 0; i < destination.array[0].used; ++i) { - assert_int_equal(destination.array[0].array[i], i + 1); - } // for + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + assert_null(destination.array); } - for (f_array_length_t i = 0; i < destination.used; ++i) { - free((void *) destination.array[i].array); - } // for - free((void *) source.array); - free((void *) destination.array); } -void test__f_type_array_uint8ss_append__returns_data_not(void **state) { +void test__f_type_array_uint8ss_append__works(void **state) { const int length = 5; f_uint8s_t source = f_uint8s_t_initialize; @@ -58,27 +56,29 @@ void test__f_type_array_uint8ss_append__returns_data_not(void **state) { 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_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__parameter_checking(void **state) { + 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); - f_uint8s_t data = f_uint8s_t_initialize; + for (f_array_length_t i = 0; i < destination.array[0].used; ++i) { + assert_int_equal(destination.array[0].array[i], i + 1); + } // for + } - { - const f_status_t status = f_uint8ss_append(data, 0); + for (f_array_length_t i = 0; i < destination.used; ++i) { + free((void *) destination.array[i].array); + } // for - assert_int_equal(status, F_status_set_error(F_parameter)); - } + free((void *) source.array); + free((void *) destination.array); } #ifdef __cplusplus 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 index c7f6633..0514099 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__uint8ss_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint8ss_append() + * @see f_uint8ss_append() */ -extern void test__f_type_array_uint8ss_append__works(void **state); +extern void test__f_type_array_uint8ss_append__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_uint8ss_append() + * @see f_uint8ss_append() */ extern void test__f_type_array_uint8ss_append__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint8ss_append() + * @see f_uint8ss_append() */ -extern void test__f_type_array_uint8ss_append__parameter_checking(void **state); +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 index 5a4d14d..ba70201 100644 --- 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 @@ -5,6 +5,43 @@ 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; @@ -63,43 +100,6 @@ void test__f_type_array_uint8ss_append_all__works(void **state) { free((void *) destination.array); } -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__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)); - } -} - #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 index 8ec2cb0..f22a969 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__uint8ss_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint8ss_append_all() + * @see f_uint8ss_append_all() */ -extern void test__f_type_array_uint8ss_append_all__works(void **state); +extern void test__f_type_array_uint8ss_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_uint8ss_append_all() + * @see f_uint8ss_append_all() */ extern void test__f_type_array_uint8ss_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint8ss_append_all() + * @see f_uint8ss_append_all() */ -extern void test__f_type_array_uint8ss_append_all__parameter_checking(void **state); +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 index b9cca5d..271c780 100644 --- 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 @@ -5,12 +5,28 @@ extern "C" { #endif -void test__f_type_array_uint8ss_decimate_by__works(void **state) { +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); @@ -19,25 +35,33 @@ void test__f_type_array_uint8ss_decimate_by__works(void **state) { } { - const f_status_t status = f_uint8ss_decimate_by(length, &data); + const f_status_t status = f_uint8ss_decimate_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_uint8ss_decimate_by__parameter_checking(void **state) { +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_decimate_by(length, 0); + const f_status_t status = f_uint8ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + 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); } 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 index f92c294..524ee08 100644 --- 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 @@ -11,17 +11,24 @@ #define _TEST__F_type_array__uint8ss_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint8ss_decimate_by() + * @see f_uint8ss_decimate_by() */ -extern void test__f_type_array_uint8ss_decimate_by__works(void **state); +extern void test__f_type_array_uint8ss_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * * @see f_type_array_uint8ss_decimate_by() */ -extern void test__f_type_array_uint8ss_decimate_by__parameter_checking(void **state); +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 index 61a91cb..8ec5815 100644 --- 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 @@ -5,12 +5,28 @@ extern "C" { #endif -void test__f_type_array_uint8ss_decrease_by__works(void **state) { +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); @@ -19,25 +35,33 @@ void test__f_type_array_uint8ss_decrease_by__works(void **state) { } { - const f_status_t status = f_uint8ss_decrease_by(length, &data); + const f_status_t status = f_uint8ss_decrease_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_uint8ss_decrease_by__parameter_checking(void **state) { +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_decrease_by(length, 0); + const f_status_t status = f_uint8ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + 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); } 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 index d78af8d..6ce4697 100644 --- 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 @@ -11,17 +11,24 @@ #define _TEST__F_type_array__uint8ss_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint8ss_decrease_by() + * @see f_uint8ss_decrease_by() */ -extern void test__f_type_array_uint8ss_decrease_by__works(void **state); +extern void test__f_type_array_uint8ss_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_uint8ss_decrease_by() + * @see f_uint8ss_decrease_by() */ -extern void test__f_type_array_uint8ss_decrease_by__parameter_checking(void **state); +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 index 99f7612..5775dd4 100644 --- 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 @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_uint8ss_increase__works(void **state) { +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_resize(length, &data); + const f_status_t status = f_uint8ss_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); 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); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -55,17 +45,27 @@ void test__f_type_array_uint8ss_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_uint8ss_increase__parameter_checking(void **state) { +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_increase(length, 0); + const f_status_t status = f_uint8ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 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); 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 index a82b67d..8670276 100644 --- 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 @@ -11,24 +11,24 @@ #define _TEST__F_type_array__uint8ss_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint8ss_increase() + * @see f_uint8ss_increase() */ -extern void test__f_type_array_uint8ss_increase__works(void **state); +extern void test__f_type_array_uint8ss_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_uint8ss_increase() + * @see f_uint8ss_increase() */ extern void test__f_type_array_uint8ss_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint8ss_increase() + * @see f_uint8ss_increase() */ -extern void test__f_type_array_uint8ss_increase__parameter_checking(void **state); +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 index 2d6e55c..93481c7 100644 --- 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 @@ -5,12 +5,28 @@ extern "C" { #endif -void test__f_type_array_uint8ss_increase_by__works(void **state) { +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); @@ -19,32 +35,48 @@ void test__f_type_array_uint8ss_increase_by__works(void **state) { } { - data.used = 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_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); + 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__parameter_checking(void **state) { +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_increase_by(length, 0); + const f_status_t status = f_uint8ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + { + 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 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 index e0bc0ec..1f4db68 100644 --- 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 @@ -11,17 +11,24 @@ #define _TEST__F_type_array__uint8ss_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint8ss_increase_by() + * @see f_uint8ss_increase_by() */ -extern void test__f_type_array_uint8ss_increase_by__works(void **state); +extern void test__f_type_array_uint8ss_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_uint8ss_increase_by() + * @see f_uint8ss_increase_by() */ -extern void test__f_type_array_uint8ss_increase_by__parameter_checking(void **state); +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 index 251db75..667b3fe 100644 --- 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 @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_uint8ss_resize__works(void **state) { +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, &data); + const f_status_t status = f_uint8ss_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_uint8ss_resize__parameter_checking(void **state) { +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, 0); + const f_status_t status = f_uint8ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus 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 index 69a4718..6710c17 100644 --- 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 @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint8ss_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint8ss_resize() + * @see f_uint8ss_resize() */ -extern void test__f_type_array_uint8ss_resize__works(void **state); +extern void test__f_type_array_uint8ss_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint8ss_resize() + * @see f_uint8ss_resize() */ -extern void test__f_type_array_uint8ss_resize__parameter_checking(void **state); +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 fded1e5..15ee245 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 @@ -20,345 +20,375 @@ int main(void) { cmocka_unit_test(test__f_type_array_array_lengths_adjust__works), cmocka_unit_test(test__f_type_array_array_lengths_append__works), cmocka_unit_test(test__f_type_array_array_lengths_append_all__works), - cmocka_unit_test(test__f_type_array_array_lengths_append_all__returns_data_not), cmocka_unit_test(test__f_type_array_array_lengths_decimate_by__works), cmocka_unit_test(test__f_type_array_array_lengths_decrease_by__works), cmocka_unit_test(test__f_type_array_array_lengths_increase__works), - cmocka_unit_test(test__f_type_array_array_lengths_increase__returns_data_not), cmocka_unit_test(test__f_type_array_array_lengths_increase_by__works), cmocka_unit_test(test__f_type_array_array_lengths_resize__works), + cmocka_unit_test(test__f_type_array_array_lengthss_append__returns_data_not), + cmocka_unit_test(test__f_type_array_array_lengthss_append_all__returns_data_not), + cmocka_unit_test(test__f_type_array_array_lengthss_decimate_by__returns_data_not), + cmocka_unit_test(test__f_type_array_array_lengthss_decrease_by__returns_data_not), + cmocka_unit_test(test__f_type_array_array_lengthss_increase__returns_data_not), + cmocka_unit_test(test__f_type_array_array_lengthss_increase_by__returns_data_not), + cmocka_unit_test(test__f_type_array_array_lengthss_adjust__works), cmocka_unit_test(test__f_type_array_array_lengthss_append__works), - cmocka_unit_test(test__f_type_array_array_lengthss_append__returns_data_not), cmocka_unit_test(test__f_type_array_array_lengthss_append_all__works), - cmocka_unit_test(test__f_type_array_array_lengthss_append_all__returns_data_not), cmocka_unit_test(test__f_type_array_array_lengthss_decimate_by__works), cmocka_unit_test(test__f_type_array_array_lengthss_decrease_by__works), cmocka_unit_test(test__f_type_array_array_lengthss_increase__works), - cmocka_unit_test(test__f_type_array_array_lengthss_increase__returns_data_not), cmocka_unit_test(test__f_type_array_array_lengthss_increase_by__works), cmocka_unit_test(test__f_type_array_array_lengthss_resize__works), 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_append_all__returns_data_not), 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__returns_data_not), 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__returns_data_not), cmocka_unit_test(test__f_type_array_cellss_append_all__works), - cmocka_unit_test(test__f_type_array_cellss_append_all__returns_data_not), 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__returns_data_not), 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_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_append_all__returns_data_not), 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__returns_data_not), 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__returns_data_not), cmocka_unit_test(test__f_type_array_fll_idss_append_all__works), - 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__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__returns_data_not), 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_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_append_all__returns_data_not), 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__returns_data_not), 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__returns_data_not), cmocka_unit_test(test__f_type_array_int8ss_append_all__works), - cmocka_unit_test(test__f_type_array_int8ss_append_all__returns_data_not), 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__returns_data_not), 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_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_append_all__returns_data_not), 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__returns_data_not), 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__returns_data_not), cmocka_unit_test(test__f_type_array_int16ss_append_all__works), - cmocka_unit_test(test__f_type_array_int16ss_append_all__returns_data_not), 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__returns_data_not), 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_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_append_all__returns_data_not), 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__returns_data_not), 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__returns_data_not), cmocka_unit_test(test__f_type_array_int32ss_append_all__works), - cmocka_unit_test(test__f_type_array_int32ss_append_all__returns_data_not), 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__returns_data_not), 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_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_append_all__returns_data_not), 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__returns_data_not), 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__returns_data_not), cmocka_unit_test(test__f_type_array_int64ss_append_all__works), - cmocka_unit_test(test__f_type_array_int64ss_append_all__returns_data_not), 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__returns_data_not), 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_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_append_all__returns_data_not), 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__returns_data_not), 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_int128ss_adjust__works), cmocka_unit_test(test__f_type_array_int128ss_append__works), - cmocka_unit_test(test__f_type_array_int128ss_append__returns_data_not), cmocka_unit_test(test__f_type_array_int128ss_append_all__works), - cmocka_unit_test(test__f_type_array_int128ss_append_all__returns_data_not), 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__returns_data_not), 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_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_append_all__returns_data_not), 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__returns_data_not), 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__returns_data_not), cmocka_unit_test(test__f_type_array_statess_append_all__works), - cmocka_unit_test(test__f_type_array_statess_append_all__returns_data_not), 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__returns_data_not), 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_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_append_all__returns_data_not), 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__returns_data_not), 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__returns_data_not), cmocka_unit_test(test__f_type_array_statusss_append_all__works), - cmocka_unit_test(test__f_type_array_statusss_append_all__returns_data_not), 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__returns_data_not), 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_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_append_all__returns_data_not), 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__returns_data_not), 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__returns_data_not), cmocka_unit_test(test__f_type_array_uint8ss_append_all__works), - cmocka_unit_test(test__f_type_array_uint8ss_append_all__returns_data_not), 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__returns_data_not), 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_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_append_all__returns_data_not), 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__returns_data_not), 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__returns_data_not), cmocka_unit_test(test__f_type_array_uint16ss_append_all__works), - cmocka_unit_test(test__f_type_array_uint16ss_append_all__returns_data_not), 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__returns_data_not), 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_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_append_all__returns_data_not), 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__returns_data_not), 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__returns_data_not), cmocka_unit_test(test__f_type_array_uint32ss_append_all__works), - cmocka_unit_test(test__f_type_array_uint32ss_append_all__returns_data_not), 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__returns_data_not), 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_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_append_all__returns_data_not), 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__returns_data_not), 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__returns_data_not), cmocka_unit_test(test__f_type_array_uint64ss_append_all__works), - cmocka_unit_test(test__f_type_array_uint64ss_append_all__returns_data_not), 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__returns_data_not), 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_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_append_all__returns_data_not), 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__returns_data_not), 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__returns_data_not), cmocka_unit_test(test__f_type_array_uint128ss_append_all__works), - cmocka_unit_test(test__f_type_array_uint128ss_append_all__returns_data_not), 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__returns_data_not), cmocka_unit_test(test__f_type_array_uint128ss_increase_by__works), cmocka_unit_test(test__f_type_array_uint128ss_resize__works),