From: Kevin Day Date: Tue, 15 Feb 2022 23:29:33 +0000 (-0600) Subject: Update: Add missing unit tests for f_type_array. X-Git-Tag: 0.5.8~47 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=d04f44413e75d988b695911216888bcad654b2b1;p=fll Update: Add missing unit tests for f_type_array. --- diff --git a/level_0/f_type_array/data/build/settings-tests b/level_0/f_type_array/data/build/settings-tests index 8a344c6..be71076 100644 --- a/level_0/f_type_array/data/build/settings-tests +++ b/level_0/f_type_array/data/build/settings-tests @@ -22,11 +22,31 @@ build_sources_program test-type_array-array_lengthss_adjust.c test-type_array-ar build_sources_program test-type_array-fll_ids_adjust.c test-type_array-fll_ids_append.c test-type_array-fll_ids_decimate_by.c test-type_array-fll_ids_decrease_by.c test-type_array-fll_ids_increase.c test-type_array-fll_ids_increase_by.c test-type_array-fll_ids_resize.c build_sources_program test-type_array-fll_idss_adjust.c test-type_array-fll_idss_append.c test-type_array-fll_idss_decimate_by.c test-type_array-fll_idss_decrease_by.c test-type_array-fll_idss_increase.c test-type_array-fll_idss_increase_by.c test-type_array-fll_idss_resize.c build_sources_program test-type_array-cells_adjust.c test-type_array-cells_append.c test-type_array-cells_decimate_by.c test-type_array-cells_decrease_by.c test-type_array-cells_increase.c test-type_array-cells_increase_by.c test-type_array-cells_resize.c +build_sources_program test-type_array-cellss_adjust.c test-type_array-cellss_append.c test-type_array-cellss_decimate_by.c test-type_array-cellss_decrease_by.c test-type_array-cellss_increase.c test-type_array-cellss_increase_by.c test-type_array-cellss_resize.c +build_sources_program test-type_array-int8s_adjust.c test-type_array-int8s_append.c test-type_array-int8s_decimate_by.c test-type_array-int8s_decrease_by.c test-type_array-int8s_increase.c test-type_array-int8s_increase_by.c test-type_array-int8s_resize.c +build_sources_program test-type_array-int8ss_adjust.c test-type_array-int8ss_append.c test-type_array-int8ss_decimate_by.c test-type_array-int8ss_decrease_by.c test-type_array-int8ss_increase.c test-type_array-int8ss_increase_by.c test-type_array-int8ss_resize.c +build_sources_program test-type_array-int16s_adjust.c test-type_array-int16s_append.c test-type_array-int16s_decimate_by.c test-type_array-int16s_decrease_by.c test-type_array-int16s_increase.c test-type_array-int16s_increase_by.c test-type_array-int16s_resize.c +build_sources_program test-type_array-int16ss_adjust.c test-type_array-int16ss_append.c test-type_array-int16ss_decimate_by.c test-type_array-int16ss_decrease_by.c test-type_array-int16ss_increase.c test-type_array-int16ss_increase_by.c test-type_array-int16ss_resize.c +build_sources_program test-type_array-int32s_adjust.c test-type_array-int32s_append.c test-type_array-int32s_decimate_by.c test-type_array-int32s_decrease_by.c test-type_array-int32s_increase.c test-type_array-int32s_increase_by.c test-type_array-int32s_resize.c +build_sources_program test-type_array-int32ss_adjust.c test-type_array-int32ss_append.c test-type_array-int32ss_decimate_by.c test-type_array-int32ss_decrease_by.c test-type_array-int32ss_increase.c test-type_array-int32ss_increase_by.c test-type_array-int32ss_resize.c +build_sources_program test-type_array-int64s_adjust.c test-type_array-int64s_append.c test-type_array-int64s_decimate_by.c test-type_array-int64s_decrease_by.c test-type_array-int64s_increase.c test-type_array-int64s_increase_by.c test-type_array-int64s_resize.c +build_sources_program test-type_array-int64ss_adjust.c test-type_array-int64ss_append.c test-type_array-int64ss_decimate_by.c test-type_array-int64ss_decrease_by.c test-type_array-int64ss_increase.c test-type_array-int64ss_increase_by.c test-type_array-int64ss_resize.c +build_sources_program test-type_array-int128s_adjust.c test-type_array-int128s_append.c test-type_array-int128s_decimate_by.c test-type_array-int128s_decrease_by.c test-type_array-int128s_increase.c test-type_array-int128s_increase_by.c test-type_array-int128s_resize.c +build_sources_program test-type_array-int128ss_adjust.c test-type_array-int128ss_append.c test-type_array-int128ss_decimate_by.c test-type_array-int128ss_decrease_by.c test-type_array-int128ss_increase.c test-type_array-int128ss_increase_by.c test-type_array-int128ss_resize.c build_sources_program test-type_array-states_adjust.c test-type_array-states_append.c test-type_array-states_decimate_by.c test-type_array-states_decrease_by.c test-type_array-states_increase.c test-type_array-states_increase_by.c test-type_array-states_resize.c build_sources_program test-type_array-statess_adjust.c test-type_array-statess_append.c test-type_array-statess_decimate_by.c test-type_array-statess_decrease_by.c test-type_array-statess_increase.c test-type_array-statess_increase_by.c test-type_array-statess_resize.c -build_sources_program test-type_array-cellss_adjust.c test-type_array-cellss_append.c test-type_array-cellss_decimate_by.c test-type_array-cellss_decrease_by.c test-type_array-cellss_increase.c test-type_array-cellss_increase_by.c test-type_array-cellss_resize.c build_sources_program test-type_array-statuss_adjust.c test-type_array-statuss_append.c test-type_array-statuss_decimate_by.c test-type_array-statuss_decrease_by.c test-type_array-statuss_increase.c test-type_array-statuss_increase_by.c test-type_array-statuss_resize.c build_sources_program test-type_array-statusss_adjust.c test-type_array-statusss_append.c test-type_array-statusss_decimate_by.c test-type_array-statusss_decrease_by.c test-type_array-statusss_increase.c test-type_array-statusss_increase_by.c test-type_array-statusss_resize.c +build_sources_program test-type_array-uint8s_adjust.c test-type_array-uint8s_append.c test-type_array-uint8s_decimate_by.c test-type_array-uint8s_decrease_by.c test-type_array-uint8s_increase.c test-type_array-uint8s_increase_by.c test-type_array-uint8s_resize.c +build_sources_program test-type_array-uint8ss_adjust.c test-type_array-uint8ss_append.c test-type_array-uint8ss_decimate_by.c test-type_array-uint8ss_decrease_by.c test-type_array-uint8ss_increase.c test-type_array-uint8ss_increase_by.c test-type_array-uint8ss_resize.c +build_sources_program test-type_array-uint16s_adjust.c test-type_array-uint16s_append.c test-type_array-uint16s_decimate_by.c test-type_array-uint16s_decrease_by.c test-type_array-uint16s_increase.c test-type_array-uint16s_increase_by.c test-type_array-uint16s_resize.c +build_sources_program test-type_array-uint16ss_adjust.c test-type_array-uint16ss_append.c test-type_array-uint16ss_decimate_by.c test-type_array-uint16ss_decrease_by.c test-type_array-uint16ss_increase.c test-type_array-uint16ss_increase_by.c test-type_array-uint16ss_resize.c +build_sources_program test-type_array-uint32s_adjust.c test-type_array-uint32s_append.c test-type_array-uint32s_decimate_by.c test-type_array-uint32s_decrease_by.c test-type_array-uint32s_increase.c test-type_array-uint32s_increase_by.c test-type_array-uint32s_resize.c +build_sources_program test-type_array-uint32ss_adjust.c test-type_array-uint32ss_append.c test-type_array-uint32ss_decimate_by.c test-type_array-uint32ss_decrease_by.c test-type_array-uint32ss_increase.c test-type_array-uint32ss_increase_by.c test-type_array-uint32ss_resize.c +build_sources_program test-type_array-uint64s_adjust.c test-type_array-uint64s_append.c test-type_array-uint64s_decimate_by.c test-type_array-uint64s_decrease_by.c test-type_array-uint64s_increase.c test-type_array-uint64s_increase_by.c test-type_array-uint64s_resize.c +build_sources_program test-type_array-uint64ss_adjust.c test-type_array-uint64ss_append.c test-type_array-uint64ss_decimate_by.c test-type_array-uint64ss_decrease_by.c test-type_array-uint64ss_increase.c test-type_array-uint64ss_increase_by.c test-type_array-uint64ss_resize.c +build_sources_program test-type_array-uint128s_adjust.c test-type_array-uint128s_append.c test-type_array-uint128s_decimate_by.c test-type_array-uint128s_decrease_by.c test-type_array-uint128s_increase.c test-type_array-uint128s_increase_by.c test-type_array-uint128s_resize.c +build_sources_program test-type_array-uint128ss_adjust.c test-type_array-uint128ss_append.c test-type_array-uint128ss_decimate_by.c test-type_array-uint128ss_decrease_by.c test-type_array-uint128ss_increase.c test-type_array-uint128ss_increase_by.c test-type_array-uint128ss_resize.c build_sources_program test-type_array.c build_script no 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 new file mode 100644 index 0000000..0c92b26 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_adjust.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-int128s_adjust.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int128s_adjust__works(void **state) { + + const int length = 5; + f_int128s_t data = f_int128s_t_initialize; + + { + const f_status_t status = f_int128s_adjust(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_int128s_adjust__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int128s_t data = f_int128s_t_initialize; + + { + const f_status_t status = f_int128s_adjust(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_adjust.h new file mode 100644 index 0000000..58bb505 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_adjust.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int128s_adjust +#define _TEST__F_type_array__int128s_adjust + +/** + * Test that the function works. + * + * @see f_type_array_int128s_adjust() + */ +extern void test__f_type_array_int128s_adjust__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int128s_adjust() + */ +extern void test__f_type_array_int128s_adjust__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..56f8057 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_append.c @@ -0,0 +1,87 @@ +#include "test-type_array.h" +#include "test-type_array-int128s_append.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int128s_append__works(void **state) { + + const int length = 5; + const int length_used = 2; + f_int128s_t source = f_int128s_t_initialize; + f_int128s_t destination = f_int128s_t_initialize; + + { + const f_status_t status = f_int128s_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + for (; source.used < length_used; ++source.used) { + source.array[source.used] = source.used + 1; + } // for + + { + const f_status_t status = f_int128s_append(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 + } + + free((void *) source.array); + free((void *) destination.array); +} + +void test__f_type_array_int128s_append__returns_data_not(void **state) { + + const int length = 5; + f_int128s_t source = f_int128s_t_initialize; + f_int128s_t destination = f_int128s_t_initialize; + + { + const f_status_t status = f_int128s_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + { + const f_status_t status = f_int128s_append(source, &destination); + + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + } + + free((void *) source.array); + assert_null(destination.array); +} + +void test__f_type_array_int128s_append__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int128s_t data = f_int128s_t_initialize; + + { + const f_status_t status = f_int128s_append(data, 0); + + assert_int_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_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_append.h new file mode 100644 index 0000000..95f3f1d --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_append.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int128s_append +#define _TEST__F_type_array__int128s_append + +/** + * Test that the function works. + * + * @see f_type_array_int128s_append() + */ +extern void test__f_type_array_int128s_append__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_int128s_append() + */ +extern void test__f_type_array_int128s_append__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int128s_append() + */ +extern void test__f_type_array_int128s_append__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__int128s_append 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 new file mode 100644 index 0000000..b2cc9e5 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_decimate_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-int128s_decimate_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int128s_decimate_by__works(void **state) { + + const int length = 5; + f_int128s_t data = f_int128s_t_initialize; + + { + const f_status_t status = f_int128s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_int128s_decimate_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_int128s_decimate_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int128s_t data = f_int128s_t_initialize; + + { + const f_status_t status = f_int128s_decimate_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_decimate_by.h new file mode 100644 index 0000000..b8d393a --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_decimate_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int128s_decimate_by +#define _TEST__F_type_array__int128s_decimate_by + +/** + * Test that the function works. + * + * @see f_type_array_int128s_decimate_by() + */ +extern void test__f_type_array_int128s_decimate_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int128s_decimate_by() + */ +extern void test__f_type_array_int128s_decimate_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..09b6760 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_decrease_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-int128s_decrease_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int128s_decrease_by__works(void **state) { + + const int length = 5; + f_int128s_t data = f_int128s_t_initialize; + + { + const f_status_t status = f_int128s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_int128s_decrease_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_int128s_decrease_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int128s_t data = f_int128s_t_initialize; + + { + const f_status_t status = f_int128s_decrease_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_decrease_by.h new file mode 100644 index 0000000..82a6108 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_decrease_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int128s_decrease_by +#define _TEST__F_type_array__int128s_decrease_by + +/** + * Test that the function works. + * + * @see f_type_array_int128s_decrease_by() + */ +extern void test__f_type_array_int128s_decrease_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int128s_decrease_by() + */ +extern void test__f_type_array_int128s_decrease_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..30b8d75 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_increase.c @@ -0,0 +1,76 @@ +#include "test-type_array.h" +#include "test-type_array-int128s_increase.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int128s_increase__works(void **state) { + + const int length = 5; + f_int128s_t data = f_int128s_t_initialize; + + { + const f_status_t status = f_int128s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_int128s_increase(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); +} + +void test__f_type_array_int128s_increase__returns_data_not(void **state) { + + const int length = 5; + f_int128s_t data = f_int128s_t_initialize; + + { + const f_status_t status = f_int128s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_int128s_increase(length, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_int128s_increase__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int128s_t data = f_int128s_t_initialize; + + { + const f_status_t status = f_int128s_increase(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + free((void *) data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_increase.h new file mode 100644 index 0000000..2ef2e4d --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_increase.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int128s_increase +#define _TEST__F_type_array__int128s_increase + +/** + * Test that the function works. + * + * @see f_type_array_int128s_increase() + */ +extern void test__f_type_array_int128s_increase__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_int128s_increase() + */ +extern void test__f_type_array_int128s_increase__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int128s_increase() + */ +extern void test__f_type_array_int128s_increase__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..48ff216 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_increase_by.c @@ -0,0 +1,52 @@ +#include "test-type_array.h" +#include "test-type_array-int128s_increase_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int128s_increase_by__works(void **state) { + + const int length = 5; + f_int128s_t data = f_int128s_t_initialize; + + { + const f_status_t status = f_int128s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_int128s_increase_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); +} + +void test__f_type_array_int128s_increase_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..e5b74b8 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_increase_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int128s_increase_by +#define _TEST__F_type_array__int128s_increase_by + +/** + * Test that the function works. + * + * @see f_type_array_int128s_increase_by() + */ +extern void test__f_type_array_int128s_increase_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int128s_increase_by() + */ +extern void test__f_type_array_int128s_increase_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..399d9b3 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_resize.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-int128s_resize.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int128s_resize__works(void **state) { + + const int length = 5; + f_int128s_t data = f_int128s_t_initialize; + + { + const f_status_t status = f_int128s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_int128s_resize__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int128s_t data = f_int128s_t_initialize; + + { + const f_status_t status = f_int128s_resize(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_resize.h new file mode 100644 index 0000000..4b1752d --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_resize.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int128s_resize +#define _TEST__F_type_array__int128s_resize + +/** + * Test that the function works. + * + * @see f_type_array_int128s_resize() + */ +extern void test__f_type_array_int128s_resize__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int128s_resize() + */ +extern void test__f_type_array_int128s_resize__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..dc07786 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_adjust.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-int128ss_adjust.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int128ss_adjust__works(void **state) { + + const int length = 5; + f_int128ss_t data = f_int128ss_t_initialize; + + { + const f_status_t status = f_int128ss_adjust(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_int128ss_adjust__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int128ss_t data = f_int128ss_t_initialize; + + { + const f_status_t status = f_int128ss_adjust(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_adjust.h new file mode 100644 index 0000000..9adcfba --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_adjust.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int128ss_adjust +#define _TEST__F_type_array__int128ss_adjust + +/** + * Test that the function works. + * + * @see f_type_array_int128ss_adjust() + */ +extern void test__f_type_array_int128ss_adjust__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int128ss_adjust() + */ +extern void test__f_type_array_int128ss_adjust__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..e38f4eb --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_append.c @@ -0,0 +1,110 @@ +#include "test-type_array.h" +#include "test-type_array-int128ss_append.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int128ss_append__works(void **state) { + + const int length = 5; + const int length_inner = 2; + f_int128ss_t source = f_int128s_t_initialize; + f_int128ss_t destination = f_int128s_t_initialize; + + { + const f_status_t status = f_int128ss_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + { + for (; source.used < length; ++source.used) { + + const f_status_t status = f_int128s_resize(length_inner, &source.array[source.used]); + + assert_int_equal(status, F_none); + + for (f_array_length_t i = 0; i < length_inner; ++i) { + source.array[source.used].array[source.array[source.used].used++] = i + 1; + } // for + } // for + } + + { + const f_status_t status = f_int128ss_append(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 < destination.used; ++i) { + + assert_int_equal(destination.array[i].used, length_inner); + assert_int_equal(destination.array[i].size, length_inner); + + for (f_array_length_t j = 0; j < length_inner; ++j) { + assert_int_equal(destination.array[i].array[j], j + 1); + } // for + } // for + } + + for (f_array_length_t i = 0; i < source.used; ++i) { + free((void *) source.array[i].array); + } // for + + 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) { + + const int length = 5; + f_int128ss_t source = f_int128s_t_initialize; + f_int128ss_t destination = f_int128s_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(source, &destination); + + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + } + + free((void *) source.array); + assert_null(destination.array); +} + +void test__f_type_array_int128ss_append__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int128ss_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)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_append.h new file mode 100644 index 0000000..ee97741 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_append.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int128ss_append +#define _TEST__F_type_array__int128ss_append + +/** + * Test that the function works. + * + * @see f_type_array_int128ss_append() + */ +extern void test__f_type_array_int128ss_append__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_int128ss_append() + */ +extern void test__f_type_array_int128ss_append__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int128ss_append() + */ +extern void test__f_type_array_int128ss_append__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__int128ss_append 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 new file mode 100644 index 0000000..6e082c8 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_decimate_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-int128ss_decimate_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int128ss_decimate_by__works(void **state) { + + const int length = 5; + f_int128ss_t data = f_int128s_t_initialize; + + { + const f_status_t status = f_int128ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_int128ss_decimate_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_int128ss_decimate_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int128ss_t data = f_int128s_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); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_decimate_by.h new file mode 100644 index 0000000..75aa4f2 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_decimate_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int128ss_decimate_by +#define _TEST__F_type_array__int128ss_decimate_by + +/** + * Test that the function works. + * + * @see f_type_array_int128ss_decimate_by() + */ +extern void test__f_type_array_int128ss_decimate_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int128ss_decimate_by() + */ +extern void test__f_type_array_int128ss_decimate_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..d622f36 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_decrease_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-int128ss_decrease_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int128ss_decrease_by__works(void **state) { + + const int length = 5; + f_int128ss_t data = f_int128s_t_initialize; + + { + const f_status_t status = f_int128ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_int128ss_decrease_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_int128ss_decrease_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int128ss_t data = f_int128s_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); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_decrease_by.h new file mode 100644 index 0000000..9afeb06 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_decrease_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int128ss_decrease_by +#define _TEST__F_type_array__int128ss_decrease_by + +/** + * Test that the function works. + * + * @see f_type_array_int128ss_decrease_by() + */ +extern void test__f_type_array_int128ss_decrease_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int128ss_decrease_by() + */ +extern void test__f_type_array_int128ss_decrease_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..c234ff5 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_increase.c @@ -0,0 +1,76 @@ +#include "test-type_array.h" +#include "test-type_array-int128ss_increase.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int128ss_increase__works(void **state) { + + const int length = 5; + f_int128ss_t data = f_int128s_t_initialize; + + { + const f_status_t status = f_int128ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_int128ss_increase(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); +} + +void test__f_type_array_int128ss_increase__returns_data_not(void **state) { + + const int length = 5; + f_int128ss_t data = f_int128s_t_initialize; + + { + const f_status_t status = f_int128ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_int128ss_increase(length, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_int128ss_increase__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int128ss_t data = f_int128s_t_initialize; + + { + const f_status_t status = f_int128ss_increase(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + free((void *) data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_increase.h new file mode 100644 index 0000000..97c4c28 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_increase.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int128ss_increase +#define _TEST__F_type_array__int128ss_increase + +/** + * Test that the function works. + * + * @see f_type_array_int128ss_increase() + */ +extern void test__f_type_array_int128ss_increase__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_int128ss_increase() + */ +extern void test__f_type_array_int128ss_increase__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int128ss_increase() + */ +extern void test__f_type_array_int128ss_increase__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..43e6d7b --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_increase_by.c @@ -0,0 +1,52 @@ +#include "test-type_array.h" +#include "test-type_array-int128ss_increase_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int128ss_increase_by__works(void **state) { + + const int length = 5; + f_int128ss_t data = f_int128s_t_initialize; + + { + const f_status_t status = f_int128ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_int128ss_increase_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); +} + +void test__f_type_array_int128ss_increase_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int128ss_t data = f_int128s_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); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_increase_by.h new file mode 100644 index 0000000..9844d55 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_increase_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int128ss_increase_by +#define _TEST__F_type_array__int128ss_increase_by + +/** + * Test that the function works. + * + * @see f_type_array_int128ss_increase_by() + */ +extern void test__f_type_array_int128ss_increase_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int128ss_increase_by() + */ +extern void test__f_type_array_int128ss_increase_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..149159b --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_resize.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-int128ss_resize.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int128ss_resize__works(void **state) { + + const int length = 5; + f_int128ss_t data = f_int128ss_t_initialize; + + { + const f_status_t status = f_int128ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_int128ss_resize__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int128ss_t data = f_int128ss_t_initialize; + + { + const f_status_t status = f_int128ss_resize(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_resize.h new file mode 100644 index 0000000..3760115 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_resize.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int128ss_resize +#define _TEST__F_type_array__int128ss_resize + +/** + * Test that the function works. + * + * @see f_type_array_int128ss_resize() + */ +extern void test__f_type_array_int128ss_resize__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int128ss_resize() + */ +extern void test__f_type_array_int128ss_resize__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..529453a --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_adjust.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-int16s_adjust.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int16s_adjust__works(void **state) { + + const int length = 5; + f_int16s_t data = f_int16s_t_initialize; + + { + const f_status_t status = f_int16s_adjust(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_int16s_adjust__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int16s_t data = f_int16s_t_initialize; + + { + const f_status_t status = f_int16s_adjust(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_adjust.h new file mode 100644 index 0000000..6fa6214 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_adjust.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int16s_adjust +#define _TEST__F_type_array__int16s_adjust + +/** + * Test that the function works. + * + * @see f_type_array_int16s_adjust() + */ +extern void test__f_type_array_int16s_adjust__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int16s_adjust() + */ +extern void test__f_type_array_int16s_adjust__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..d4133b9 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_append.c @@ -0,0 +1,87 @@ +#include "test-type_array.h" +#include "test-type_array-int16s_append.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int16s_append__works(void **state) { + + const int length = 5; + const int length_used = 2; + f_int16s_t source = f_int16s_t_initialize; + f_int16s_t destination = f_int16s_t_initialize; + + { + const f_status_t status = f_int16s_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + for (; source.used < length_used; ++source.used) { + source.array[source.used] = source.used + 1; + } // for + + { + const f_status_t status = f_int16s_append(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 + } + + free((void *) source.array); + free((void *) destination.array); +} + +void test__f_type_array_int16s_append__returns_data_not(void **state) { + + const int length = 5; + f_int16s_t source = f_int16s_t_initialize; + f_int16s_t destination = f_int16s_t_initialize; + + { + const f_status_t status = f_int16s_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + { + const f_status_t status = f_int16s_append(source, &destination); + + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + } + + free((void *) source.array); + assert_null(destination.array); +} + +void test__f_type_array_int16s_append__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int16s_t data = f_int16s_t_initialize; + + { + const f_status_t status = f_int16s_append(data, 0); + + assert_int_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_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_append.h new file mode 100644 index 0000000..98a2ddc --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_append.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int16s_append +#define _TEST__F_type_array__int16s_append + +/** + * Test that the function works. + * + * @see f_type_array_int16s_append() + */ +extern void test__f_type_array_int16s_append__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_int16s_append() + */ +extern void test__f_type_array_int16s_append__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int16s_append() + */ +extern void test__f_type_array_int16s_append__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__int16s_append 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 new file mode 100644 index 0000000..cb4452c --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_decimate_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-int16s_decimate_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int16s_decimate_by__works(void **state) { + + const int length = 5; + f_int16s_t data = f_int16s_t_initialize; + + { + const f_status_t status = f_int16s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_int16s_decimate_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_int16s_decimate_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int16s_t data = f_int16s_t_initialize; + + { + const f_status_t status = f_int16s_decimate_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_decimate_by.h new file mode 100644 index 0000000..80a5218 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_decimate_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int16s_decimate_by +#define _TEST__F_type_array__int16s_decimate_by + +/** + * Test that the function works. + * + * @see f_type_array_int16s_decimate_by() + */ +extern void test__f_type_array_int16s_decimate_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int16s_decimate_by() + */ +extern void test__f_type_array_int16s_decimate_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..e6cd758 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_decrease_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-int16s_decrease_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int16s_decrease_by__works(void **state) { + + const int length = 5; + f_int16s_t data = f_int16s_t_initialize; + + { + const f_status_t status = f_int16s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_int16s_decrease_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_int16s_decrease_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int16s_t data = f_int16s_t_initialize; + + { + const f_status_t status = f_int16s_decrease_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_decrease_by.h new file mode 100644 index 0000000..56bacd4 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_decrease_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int16s_decrease_by +#define _TEST__F_type_array__int16s_decrease_by + +/** + * Test that the function works. + * + * @see f_type_array_int16s_decrease_by() + */ +extern void test__f_type_array_int16s_decrease_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int16s_decrease_by() + */ +extern void test__f_type_array_int16s_decrease_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..26eaf90 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_increase.c @@ -0,0 +1,76 @@ +#include "test-type_array.h" +#include "test-type_array-int16s_increase.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int16s_increase__works(void **state) { + + const int length = 5; + f_int16s_t data = f_int16s_t_initialize; + + { + const f_status_t status = f_int16s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_int16s_increase(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); +} + +void test__f_type_array_int16s_increase__returns_data_not(void **state) { + + const int length = 5; + f_int16s_t data = f_int16s_t_initialize; + + { + const f_status_t status = f_int16s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_int16s_increase(length, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_int16s_increase__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int16s_t data = f_int16s_t_initialize; + + { + const f_status_t status = f_int16s_increase(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + free((void *) data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_increase.h new file mode 100644 index 0000000..e1c208e --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_increase.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int16s_increase +#define _TEST__F_type_array__int16s_increase + +/** + * Test that the function works. + * + * @see f_type_array_int16s_increase() + */ +extern void test__f_type_array_int16s_increase__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_int16s_increase() + */ +extern void test__f_type_array_int16s_increase__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int16s_increase() + */ +extern void test__f_type_array_int16s_increase__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..dbad485 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_increase_by.c @@ -0,0 +1,52 @@ +#include "test-type_array.h" +#include "test-type_array-int16s_increase_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int16s_increase_by__works(void **state) { + + const int length = 5; + f_int16s_t data = f_int16s_t_initialize; + + { + const f_status_t status = f_int16s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_int16s_increase_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); +} + +void test__f_type_array_int16s_increase_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..719c920 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_increase_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int16s_increase_by +#define _TEST__F_type_array__int16s_increase_by + +/** + * Test that the function works. + * + * @see f_type_array_int16s_increase_by() + */ +extern void test__f_type_array_int16s_increase_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int16s_increase_by() + */ +extern void test__f_type_array_int16s_increase_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..450e07d --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_resize.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-int16s_resize.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int16s_resize__works(void **state) { + + const int length = 5; + f_int16s_t data = f_int16s_t_initialize; + + { + const f_status_t status = f_int16s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_int16s_resize__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int16s_t data = f_int16s_t_initialize; + + { + const f_status_t status = f_int16s_resize(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_resize.h new file mode 100644 index 0000000..e1627b7 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_resize.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int16s_resize +#define _TEST__F_type_array__int16s_resize + +/** + * Test that the function works. + * + * @see f_type_array_int16s_resize() + */ +extern void test__f_type_array_int16s_resize__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int16s_resize() + */ +extern void test__f_type_array_int16s_resize__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..5bb4fc8 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_adjust.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-int16ss_adjust.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int16ss_adjust__works(void **state) { + + const int length = 5; + f_int16ss_t data = f_int16ss_t_initialize; + + { + const f_status_t status = f_int16ss_adjust(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_int16ss_adjust__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int16ss_t data = f_int16ss_t_initialize; + + { + const f_status_t status = f_int16ss_adjust(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_adjust.h new file mode 100644 index 0000000..efb8582 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_adjust.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int16ss_adjust +#define _TEST__F_type_array__int16ss_adjust + +/** + * Test that the function works. + * + * @see f_type_array_int16ss_adjust() + */ +extern void test__f_type_array_int16ss_adjust__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int16ss_adjust() + */ +extern void test__f_type_array_int16ss_adjust__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..f1e23dc --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_append.c @@ -0,0 +1,110 @@ +#include "test-type_array.h" +#include "test-type_array-int16ss_append.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int16ss_append__works(void **state) { + + const int length = 5; + const int length_inner = 2; + f_int16ss_t source = f_int16s_t_initialize; + f_int16ss_t destination = f_int16s_t_initialize; + + { + const f_status_t status = f_int16ss_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + { + for (; source.used < length; ++source.used) { + + const f_status_t status = f_int16s_resize(length_inner, &source.array[source.used]); + + assert_int_equal(status, F_none); + + for (f_array_length_t i = 0; i < length_inner; ++i) { + source.array[source.used].array[source.array[source.used].used++] = i + 1; + } // for + } // for + } + + { + const f_status_t status = f_int16ss_append(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 < destination.used; ++i) { + + assert_int_equal(destination.array[i].used, length_inner); + assert_int_equal(destination.array[i].size, length_inner); + + for (f_array_length_t j = 0; j < length_inner; ++j) { + assert_int_equal(destination.array[i].array[j], j + 1); + } // for + } // for + } + + for (f_array_length_t i = 0; i < source.used; ++i) { + free((void *) source.array[i].array); + } // for + + 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) { + + const int length = 5; + f_int16ss_t source = f_int16s_t_initialize; + f_int16ss_t destination = f_int16s_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(source, &destination); + + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + } + + free((void *) source.array); + assert_null(destination.array); +} + +void test__f_type_array_int16ss_append__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int16ss_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)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_append.h new file mode 100644 index 0000000..c40ed3b --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_append.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int16ss_append +#define _TEST__F_type_array__int16ss_append + +/** + * Test that the function works. + * + * @see f_type_array_int16ss_append() + */ +extern void test__f_type_array_int16ss_append__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_int16ss_append() + */ +extern void test__f_type_array_int16ss_append__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int16ss_append() + */ +extern void test__f_type_array_int16ss_append__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__int16ss_append 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 new file mode 100644 index 0000000..ac36f8d --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_decimate_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-int16ss_decimate_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int16ss_decimate_by__works(void **state) { + + const int length = 5; + f_int16ss_t data = f_int16s_t_initialize; + + { + const f_status_t status = f_int16ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_int16ss_decimate_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_int16ss_decimate_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int16ss_t data = f_int16s_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); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_decimate_by.h new file mode 100644 index 0000000..1384c68 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_decimate_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int16ss_decimate_by +#define _TEST__F_type_array__int16ss_decimate_by + +/** + * Test that the function works. + * + * @see f_type_array_int16ss_decimate_by() + */ +extern void test__f_type_array_int16ss_decimate_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int16ss_decimate_by() + */ +extern void test__f_type_array_int16ss_decimate_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..67ba87c --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_decrease_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-int16ss_decrease_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int16ss_decrease_by__works(void **state) { + + const int length = 5; + f_int16ss_t data = f_int16s_t_initialize; + + { + const f_status_t status = f_int16ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_int16ss_decrease_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_int16ss_decrease_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int16ss_t data = f_int16s_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); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_decrease_by.h new file mode 100644 index 0000000..a8813c9 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_decrease_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int16ss_decrease_by +#define _TEST__F_type_array__int16ss_decrease_by + +/** + * Test that the function works. + * + * @see f_type_array_int16ss_decrease_by() + */ +extern void test__f_type_array_int16ss_decrease_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int16ss_decrease_by() + */ +extern void test__f_type_array_int16ss_decrease_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..db43470 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_increase.c @@ -0,0 +1,76 @@ +#include "test-type_array.h" +#include "test-type_array-int16ss_increase.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int16ss_increase__works(void **state) { + + const int length = 5; + f_int16ss_t data = f_int16s_t_initialize; + + { + const f_status_t status = f_int16ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_int16ss_increase(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); +} + +void test__f_type_array_int16ss_increase__returns_data_not(void **state) { + + const int length = 5; + f_int16ss_t data = f_int16s_t_initialize; + + { + const f_status_t status = f_int16ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_int16ss_increase(length, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_int16ss_increase__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int16ss_t data = f_int16s_t_initialize; + + { + const f_status_t status = f_int16ss_increase(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + free((void *) data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_increase.h new file mode 100644 index 0000000..032a4bb --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_increase.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int16ss_increase +#define _TEST__F_type_array__int16ss_increase + +/** + * Test that the function works. + * + * @see f_type_array_int16ss_increase() + */ +extern void test__f_type_array_int16ss_increase__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_int16ss_increase() + */ +extern void test__f_type_array_int16ss_increase__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int16ss_increase() + */ +extern void test__f_type_array_int16ss_increase__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..ffccc6e --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_increase_by.c @@ -0,0 +1,52 @@ +#include "test-type_array.h" +#include "test-type_array-int16ss_increase_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int16ss_increase_by__works(void **state) { + + const int length = 5; + f_int16ss_t data = f_int16s_t_initialize; + + { + const f_status_t status = f_int16ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_int16ss_increase_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); +} + +void test__f_type_array_int16ss_increase_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int16ss_t data = f_int16s_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); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_increase_by.h new file mode 100644 index 0000000..0d02ffb --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_increase_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int16ss_increase_by +#define _TEST__F_type_array__int16ss_increase_by + +/** + * Test that the function works. + * + * @see f_type_array_int16ss_increase_by() + */ +extern void test__f_type_array_int16ss_increase_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int16ss_increase_by() + */ +extern void test__f_type_array_int16ss_increase_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..078b770 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_resize.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-int16ss_resize.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int16ss_resize__works(void **state) { + + const int length = 5; + f_int16ss_t data = f_int16ss_t_initialize; + + { + const f_status_t status = f_int16ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_int16ss_resize__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int16ss_t data = f_int16ss_t_initialize; + + { + const f_status_t status = f_int16ss_resize(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_resize.h new file mode 100644 index 0000000..b57993d --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_resize.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int16ss_resize +#define _TEST__F_type_array__int16ss_resize + +/** + * Test that the function works. + * + * @see f_type_array_int16ss_resize() + */ +extern void test__f_type_array_int16ss_resize__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int16ss_resize() + */ +extern void test__f_type_array_int16ss_resize__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..3cc76bf --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_adjust.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-int32s_adjust.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int32s_adjust__works(void **state) { + + const int length = 5; + f_int32s_t data = f_int32s_t_initialize; + + { + const f_status_t status = f_int32s_adjust(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_int32s_adjust__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int32s_t data = f_int32s_t_initialize; + + { + const f_status_t status = f_int32s_adjust(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_adjust.h new file mode 100644 index 0000000..cf4f06d --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_adjust.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int32s_adjust +#define _TEST__F_type_array__int32s_adjust + +/** + * Test that the function works. + * + * @see f_type_array_int32s_adjust() + */ +extern void test__f_type_array_int32s_adjust__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int32s_adjust() + */ +extern void test__f_type_array_int32s_adjust__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..596cddc --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_append.c @@ -0,0 +1,87 @@ +#include "test-type_array.h" +#include "test-type_array-int32s_append.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int32s_append__works(void **state) { + + const int length = 5; + const int length_used = 2; + f_int32s_t source = f_int32s_t_initialize; + f_int32s_t destination = f_int32s_t_initialize; + + { + const f_status_t status = f_int32s_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + for (; source.used < length_used; ++source.used) { + source.array[source.used] = source.used + 1; + } // for + + { + const f_status_t status = f_int32s_append(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 + } + + free((void *) source.array); + free((void *) destination.array); +} + +void test__f_type_array_int32s_append__returns_data_not(void **state) { + + const int length = 5; + f_int32s_t source = f_int32s_t_initialize; + f_int32s_t destination = f_int32s_t_initialize; + + { + const f_status_t status = f_int32s_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + { + const f_status_t status = f_int32s_append(source, &destination); + + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + } + + free((void *) source.array); + assert_null(destination.array); +} + +void test__f_type_array_int32s_append__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int32s_t data = f_int32s_t_initialize; + + { + const f_status_t status = f_int32s_append(data, 0); + + assert_int_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_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_append.h new file mode 100644 index 0000000..6133021 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_append.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int32s_append +#define _TEST__F_type_array__int32s_append + +/** + * Test that the function works. + * + * @see f_type_array_int32s_append() + */ +extern void test__f_type_array_int32s_append__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_int32s_append() + */ +extern void test__f_type_array_int32s_append__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int32s_append() + */ +extern void test__f_type_array_int32s_append__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__int32s_append 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 new file mode 100644 index 0000000..cd2d362 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_decimate_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-int32s_decimate_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int32s_decimate_by__works(void **state) { + + const int length = 5; + f_int32s_t data = f_int32s_t_initialize; + + { + const f_status_t status = f_int32s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_int32s_decimate_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_int32s_decimate_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int32s_t data = f_int32s_t_initialize; + + { + const f_status_t status = f_int32s_decimate_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_decimate_by.h new file mode 100644 index 0000000..6fbb447 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_decimate_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int32s_decimate_by +#define _TEST__F_type_array__int32s_decimate_by + +/** + * Test that the function works. + * + * @see f_type_array_int32s_decimate_by() + */ +extern void test__f_type_array_int32s_decimate_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int32s_decimate_by() + */ +extern void test__f_type_array_int32s_decimate_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..e0d167a --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_decrease_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-int32s_decrease_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int32s_decrease_by__works(void **state) { + + const int length = 5; + f_int32s_t data = f_int32s_t_initialize; + + { + const f_status_t status = f_int32s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_int32s_decrease_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_int32s_decrease_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int32s_t data = f_int32s_t_initialize; + + { + const f_status_t status = f_int32s_decrease_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_decrease_by.h new file mode 100644 index 0000000..fad9c5e --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_decrease_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int32s_decrease_by +#define _TEST__F_type_array__int32s_decrease_by + +/** + * Test that the function works. + * + * @see f_type_array_int32s_decrease_by() + */ +extern void test__f_type_array_int32s_decrease_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int32s_decrease_by() + */ +extern void test__f_type_array_int32s_decrease_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..a2d11f6 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_increase.c @@ -0,0 +1,76 @@ +#include "test-type_array.h" +#include "test-type_array-int32s_increase.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int32s_increase__works(void **state) { + + const int length = 5; + f_int32s_t data = f_int32s_t_initialize; + + { + const f_status_t status = f_int32s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_int32s_increase(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); +} + +void test__f_type_array_int32s_increase__returns_data_not(void **state) { + + const int length = 5; + f_int32s_t data = f_int32s_t_initialize; + + { + const f_status_t status = f_int32s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_int32s_increase(length, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_int32s_increase__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int32s_t data = f_int32s_t_initialize; + + { + const f_status_t status = f_int32s_increase(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + free((void *) data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_increase.h new file mode 100644 index 0000000..d7536cd --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_increase.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int32s_increase +#define _TEST__F_type_array__int32s_increase + +/** + * Test that the function works. + * + * @see f_type_array_int32s_increase() + */ +extern void test__f_type_array_int32s_increase__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_int32s_increase() + */ +extern void test__f_type_array_int32s_increase__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int32s_increase() + */ +extern void test__f_type_array_int32s_increase__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..4e4a8af --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_increase_by.c @@ -0,0 +1,52 @@ +#include "test-type_array.h" +#include "test-type_array-int32s_increase_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int32s_increase_by__works(void **state) { + + const int length = 5; + f_int32s_t data = f_int32s_t_initialize; + + { + const f_status_t status = f_int32s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_int32s_increase_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); +} + +void test__f_type_array_int32s_increase_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..95ed773 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_increase_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int32s_increase_by +#define _TEST__F_type_array__int32s_increase_by + +/** + * Test that the function works. + * + * @see f_type_array_int32s_increase_by() + */ +extern void test__f_type_array_int32s_increase_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int32s_increase_by() + */ +extern void test__f_type_array_int32s_increase_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..db4251d --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_resize.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-int32s_resize.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int32s_resize__works(void **state) { + + const int length = 5; + f_int32s_t data = f_int32s_t_initialize; + + { + const f_status_t status = f_int32s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_int32s_resize__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int32s_t data = f_int32s_t_initialize; + + { + const f_status_t status = f_int32s_resize(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_resize.h new file mode 100644 index 0000000..64fb507 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_resize.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int32s_resize +#define _TEST__F_type_array__int32s_resize + +/** + * Test that the function works. + * + * @see f_type_array_int32s_resize() + */ +extern void test__f_type_array_int32s_resize__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int32s_resize() + */ +extern void test__f_type_array_int32s_resize__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..c25b621 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_adjust.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-int32ss_adjust.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int32ss_adjust__works(void **state) { + + const int length = 5; + f_int32ss_t data = f_int32ss_t_initialize; + + { + const f_status_t status = f_int32ss_adjust(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_int32ss_adjust__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int32ss_t data = f_int32ss_t_initialize; + + { + const f_status_t status = f_int32ss_adjust(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_adjust.h new file mode 100644 index 0000000..8d9200c --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_adjust.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int32ss_adjust +#define _TEST__F_type_array__int32ss_adjust + +/** + * Test that the function works. + * + * @see f_type_array_int32ss_adjust() + */ +extern void test__f_type_array_int32ss_adjust__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int32ss_adjust() + */ +extern void test__f_type_array_int32ss_adjust__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..038ad3a --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_append.c @@ -0,0 +1,110 @@ +#include "test-type_array.h" +#include "test-type_array-int32ss_append.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int32ss_append__works(void **state) { + + const int length = 5; + const int length_inner = 2; + f_int32ss_t source = f_int32s_t_initialize; + f_int32ss_t destination = f_int32s_t_initialize; + + { + const f_status_t status = f_int32ss_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + { + for (; source.used < length; ++source.used) { + + const f_status_t status = f_int32s_resize(length_inner, &source.array[source.used]); + + assert_int_equal(status, F_none); + + for (f_array_length_t i = 0; i < length_inner; ++i) { + source.array[source.used].array[source.array[source.used].used++] = i + 1; + } // for + } // for + } + + { + const f_status_t status = f_int32ss_append(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 < destination.used; ++i) { + + assert_int_equal(destination.array[i].used, length_inner); + assert_int_equal(destination.array[i].size, length_inner); + + for (f_array_length_t j = 0; j < length_inner; ++j) { + assert_int_equal(destination.array[i].array[j], j + 1); + } // for + } // for + } + + for (f_array_length_t i = 0; i < source.used; ++i) { + free((void *) source.array[i].array); + } // for + + 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) { + + const int length = 5; + f_int32ss_t source = f_int32s_t_initialize; + f_int32ss_t destination = f_int32s_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(source, &destination); + + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + } + + free((void *) source.array); + assert_null(destination.array); +} + +void test__f_type_array_int32ss_append__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int32ss_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)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_append.h new file mode 100644 index 0000000..7caf1fe --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_append.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int32ss_append +#define _TEST__F_type_array__int32ss_append + +/** + * Test that the function works. + * + * @see f_type_array_int32ss_append() + */ +extern void test__f_type_array_int32ss_append__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_int32ss_append() + */ +extern void test__f_type_array_int32ss_append__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int32ss_append() + */ +extern void test__f_type_array_int32ss_append__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__int32ss_append 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 new file mode 100644 index 0000000..7e3f686 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_decimate_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-int32ss_decimate_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int32ss_decimate_by__works(void **state) { + + const int length = 5; + f_int32ss_t data = f_int32s_t_initialize; + + { + const f_status_t status = f_int32ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_int32ss_decimate_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_int32ss_decimate_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int32ss_t data = f_int32s_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); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_decimate_by.h new file mode 100644 index 0000000..722bb59 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_decimate_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int32ss_decimate_by +#define _TEST__F_type_array__int32ss_decimate_by + +/** + * Test that the function works. + * + * @see f_type_array_int32ss_decimate_by() + */ +extern void test__f_type_array_int32ss_decimate_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int32ss_decimate_by() + */ +extern void test__f_type_array_int32ss_decimate_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..688c10a --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_decrease_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-int32ss_decrease_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int32ss_decrease_by__works(void **state) { + + const int length = 5; + f_int32ss_t data = f_int32s_t_initialize; + + { + const f_status_t status = f_int32ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_int32ss_decrease_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_int32ss_decrease_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int32ss_t data = f_int32s_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); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_decrease_by.h new file mode 100644 index 0000000..1fc42cd --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_decrease_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int32ss_decrease_by +#define _TEST__F_type_array__int32ss_decrease_by + +/** + * Test that the function works. + * + * @see f_type_array_int32ss_decrease_by() + */ +extern void test__f_type_array_int32ss_decrease_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int32ss_decrease_by() + */ +extern void test__f_type_array_int32ss_decrease_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..35bfac7 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_increase.c @@ -0,0 +1,76 @@ +#include "test-type_array.h" +#include "test-type_array-int32ss_increase.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int32ss_increase__works(void **state) { + + const int length = 5; + f_int32ss_t data = f_int32s_t_initialize; + + { + const f_status_t status = f_int32ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_int32ss_increase(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); +} + +void test__f_type_array_int32ss_increase__returns_data_not(void **state) { + + const int length = 5; + f_int32ss_t data = f_int32s_t_initialize; + + { + const f_status_t status = f_int32ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_int32ss_increase(length, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_int32ss_increase__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int32ss_t data = f_int32s_t_initialize; + + { + const f_status_t status = f_int32ss_increase(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + free((void *) data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_increase.h new file mode 100644 index 0000000..8fdccb3 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_increase.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int32ss_increase +#define _TEST__F_type_array__int32ss_increase + +/** + * Test that the function works. + * + * @see f_type_array_int32ss_increase() + */ +extern void test__f_type_array_int32ss_increase__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_int32ss_increase() + */ +extern void test__f_type_array_int32ss_increase__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int32ss_increase() + */ +extern void test__f_type_array_int32ss_increase__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..30e121b --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_increase_by.c @@ -0,0 +1,52 @@ +#include "test-type_array.h" +#include "test-type_array-int32ss_increase_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int32ss_increase_by__works(void **state) { + + const int length = 5; + f_int32ss_t data = f_int32s_t_initialize; + + { + const f_status_t status = f_int32ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_int32ss_increase_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); +} + +void test__f_type_array_int32ss_increase_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int32ss_t data = f_int32s_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); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_increase_by.h new file mode 100644 index 0000000..09b2d95 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_increase_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int32ss_increase_by +#define _TEST__F_type_array__int32ss_increase_by + +/** + * Test that the function works. + * + * @see f_type_array_int32ss_increase_by() + */ +extern void test__f_type_array_int32ss_increase_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int32ss_increase_by() + */ +extern void test__f_type_array_int32ss_increase_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..8805d36 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_resize.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-int32ss_resize.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int32ss_resize__works(void **state) { + + const int length = 5; + f_int32ss_t data = f_int32ss_t_initialize; + + { + const f_status_t status = f_int32ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_int32ss_resize__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int32ss_t data = f_int32ss_t_initialize; + + { + const f_status_t status = f_int32ss_resize(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_resize.h new file mode 100644 index 0000000..aee14e1 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_resize.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int32ss_resize +#define _TEST__F_type_array__int32ss_resize + +/** + * Test that the function works. + * + * @see f_type_array_int32ss_resize() + */ +extern void test__f_type_array_int32ss_resize__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int32ss_resize() + */ +extern void test__f_type_array_int32ss_resize__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..fb63404 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_adjust.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-int64s_adjust.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int64s_adjust__works(void **state) { + + const int length = 5; + f_int64s_t data = f_int64s_t_initialize; + + { + const f_status_t status = f_int64s_adjust(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_int64s_adjust__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int64s_t data = f_int64s_t_initialize; + + { + const f_status_t status = f_int64s_adjust(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_adjust.h new file mode 100644 index 0000000..090b24d --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_adjust.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int64s_adjust +#define _TEST__F_type_array__int64s_adjust + +/** + * Test that the function works. + * + * @see f_type_array_int64s_adjust() + */ +extern void test__f_type_array_int64s_adjust__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int64s_adjust() + */ +extern void test__f_type_array_int64s_adjust__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..4bb91c6 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_append.c @@ -0,0 +1,87 @@ +#include "test-type_array.h" +#include "test-type_array-int64s_append.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int64s_append__works(void **state) { + + const int length = 5; + const int length_used = 2; + f_int64s_t source = f_int64s_t_initialize; + f_int64s_t destination = f_int64s_t_initialize; + + { + const f_status_t status = f_int64s_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + for (; source.used < length_used; ++source.used) { + source.array[source.used] = source.used + 1; + } // for + + { + const f_status_t status = f_int64s_append(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 + } + + free((void *) source.array); + free((void *) destination.array); +} + +void test__f_type_array_int64s_append__returns_data_not(void **state) { + + const int length = 5; + f_int64s_t source = f_int64s_t_initialize; + f_int64s_t destination = f_int64s_t_initialize; + + { + const f_status_t status = f_int64s_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + { + const f_status_t status = f_int64s_append(source, &destination); + + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + } + + free((void *) source.array); + assert_null(destination.array); +} + +void test__f_type_array_int64s_append__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int64s_t data = f_int64s_t_initialize; + + { + const f_status_t status = f_int64s_append(data, 0); + + assert_int_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_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_append.h new file mode 100644 index 0000000..8bec71b --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_append.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int64s_append +#define _TEST__F_type_array__int64s_append + +/** + * Test that the function works. + * + * @see f_type_array_int64s_append() + */ +extern void test__f_type_array_int64s_append__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_int64s_append() + */ +extern void test__f_type_array_int64s_append__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int64s_append() + */ +extern void test__f_type_array_int64s_append__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__int64s_append 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 new file mode 100644 index 0000000..c3ae4c9 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_decimate_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-int64s_decimate_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int64s_decimate_by__works(void **state) { + + const int length = 5; + f_int64s_t data = f_int64s_t_initialize; + + { + const f_status_t status = f_int64s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_int64s_decimate_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_int64s_decimate_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int64s_t data = f_int64s_t_initialize; + + { + const f_status_t status = f_int64s_decimate_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_decimate_by.h new file mode 100644 index 0000000..31123c6 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_decimate_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int64s_decimate_by +#define _TEST__F_type_array__int64s_decimate_by + +/** + * Test that the function works. + * + * @see f_type_array_int64s_decimate_by() + */ +extern void test__f_type_array_int64s_decimate_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int64s_decimate_by() + */ +extern void test__f_type_array_int64s_decimate_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..426014f --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_decrease_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-int64s_decrease_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int64s_decrease_by__works(void **state) { + + const int length = 5; + f_int64s_t data = f_int64s_t_initialize; + + { + const f_status_t status = f_int64s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_int64s_decrease_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_int64s_decrease_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int64s_t data = f_int64s_t_initialize; + + { + const f_status_t status = f_int64s_decrease_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_decrease_by.h new file mode 100644 index 0000000..e79a317 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_decrease_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int64s_decrease_by +#define _TEST__F_type_array__int64s_decrease_by + +/** + * Test that the function works. + * + * @see f_type_array_int64s_decrease_by() + */ +extern void test__f_type_array_int64s_decrease_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int64s_decrease_by() + */ +extern void test__f_type_array_int64s_decrease_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..90b472b --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_increase.c @@ -0,0 +1,76 @@ +#include "test-type_array.h" +#include "test-type_array-int64s_increase.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int64s_increase__works(void **state) { + + const int length = 5; + f_int64s_t data = f_int64s_t_initialize; + + { + const f_status_t status = f_int64s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_int64s_increase(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); +} + +void test__f_type_array_int64s_increase__returns_data_not(void **state) { + + const int length = 5; + f_int64s_t data = f_int64s_t_initialize; + + { + const f_status_t status = f_int64s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_int64s_increase(length, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_int64s_increase__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int64s_t data = f_int64s_t_initialize; + + { + const f_status_t status = f_int64s_increase(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + free((void *) data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_increase.h new file mode 100644 index 0000000..7538f33 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_increase.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int64s_increase +#define _TEST__F_type_array__int64s_increase + +/** + * Test that the function works. + * + * @see f_type_array_int64s_increase() + */ +extern void test__f_type_array_int64s_increase__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_int64s_increase() + */ +extern void test__f_type_array_int64s_increase__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int64s_increase() + */ +extern void test__f_type_array_int64s_increase__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..4e04bfc --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_increase_by.c @@ -0,0 +1,52 @@ +#include "test-type_array.h" +#include "test-type_array-int64s_increase_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int64s_increase_by__works(void **state) { + + const int length = 5; + f_int64s_t data = f_int64s_t_initialize; + + { + const f_status_t status = f_int64s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_int64s_increase_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); +} + +void test__f_type_array_int64s_increase_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..38dbd1a --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_increase_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int64s_increase_by +#define _TEST__F_type_array__int64s_increase_by + +/** + * Test that the function works. + * + * @see f_type_array_int64s_increase_by() + */ +extern void test__f_type_array_int64s_increase_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int64s_increase_by() + */ +extern void test__f_type_array_int64s_increase_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..da472e9 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_resize.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-int64s_resize.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int64s_resize__works(void **state) { + + const int length = 5; + f_int64s_t data = f_int64s_t_initialize; + + { + const f_status_t status = f_int64s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_int64s_resize__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int64s_t data = f_int64s_t_initialize; + + { + const f_status_t status = f_int64s_resize(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_resize.h new file mode 100644 index 0000000..a70d30f --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_resize.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int64s_resize +#define _TEST__F_type_array__int64s_resize + +/** + * Test that the function works. + * + * @see f_type_array_int64s_resize() + */ +extern void test__f_type_array_int64s_resize__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int64s_resize() + */ +extern void test__f_type_array_int64s_resize__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..0804f0a --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_adjust.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-int64ss_adjust.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int64ss_adjust__works(void **state) { + + const int length = 5; + f_int64ss_t data = f_int64ss_t_initialize; + + { + const f_status_t status = f_int64ss_adjust(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_int64ss_adjust__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int64ss_t data = f_int64ss_t_initialize; + + { + const f_status_t status = f_int64ss_adjust(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_adjust.h new file mode 100644 index 0000000..8c25372 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_adjust.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int64ss_adjust +#define _TEST__F_type_array__int64ss_adjust + +/** + * Test that the function works. + * + * @see f_type_array_int64ss_adjust() + */ +extern void test__f_type_array_int64ss_adjust__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int64ss_adjust() + */ +extern void test__f_type_array_int64ss_adjust__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..826772b --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_append.c @@ -0,0 +1,110 @@ +#include "test-type_array.h" +#include "test-type_array-int64ss_append.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int64ss_append__works(void **state) { + + const int length = 5; + const int length_inner = 2; + f_int64ss_t source = f_int64s_t_initialize; + f_int64ss_t destination = f_int64s_t_initialize; + + { + const f_status_t status = f_int64ss_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + { + for (; source.used < length; ++source.used) { + + const f_status_t status = f_int64s_resize(length_inner, &source.array[source.used]); + + assert_int_equal(status, F_none); + + for (f_array_length_t i = 0; i < length_inner; ++i) { + source.array[source.used].array[source.array[source.used].used++] = i + 1; + } // for + } // for + } + + { + const f_status_t status = f_int64ss_append(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 < destination.used; ++i) { + + assert_int_equal(destination.array[i].used, length_inner); + assert_int_equal(destination.array[i].size, length_inner); + + for (f_array_length_t j = 0; j < length_inner; ++j) { + assert_int_equal(destination.array[i].array[j], j + 1); + } // for + } // for + } + + for (f_array_length_t i = 0; i < source.used; ++i) { + free((void *) source.array[i].array); + } // for + + 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) { + + const int length = 5; + f_int64ss_t source = f_int64s_t_initialize; + f_int64ss_t destination = f_int64s_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(source, &destination); + + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + } + + free((void *) source.array); + assert_null(destination.array); +} + +void test__f_type_array_int64ss_append__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int64ss_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)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_append.h new file mode 100644 index 0000000..ea50420 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_append.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int64ss_append +#define _TEST__F_type_array__int64ss_append + +/** + * Test that the function works. + * + * @see f_type_array_int64ss_append() + */ +extern void test__f_type_array_int64ss_append__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_int64ss_append() + */ +extern void test__f_type_array_int64ss_append__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int64ss_append() + */ +extern void test__f_type_array_int64ss_append__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__int64ss_append 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 new file mode 100644 index 0000000..9e08407 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_decimate_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-int64ss_decimate_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int64ss_decimate_by__works(void **state) { + + const int length = 5; + f_int64ss_t data = f_int64s_t_initialize; + + { + const f_status_t status = f_int64ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_int64ss_decimate_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_int64ss_decimate_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int64ss_t data = f_int64s_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); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_decimate_by.h new file mode 100644 index 0000000..9636e80 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_decimate_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int64ss_decimate_by +#define _TEST__F_type_array__int64ss_decimate_by + +/** + * Test that the function works. + * + * @see f_type_array_int64ss_decimate_by() + */ +extern void test__f_type_array_int64ss_decimate_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int64ss_decimate_by() + */ +extern void test__f_type_array_int64ss_decimate_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..f49a6e5 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_decrease_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-int64ss_decrease_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int64ss_decrease_by__works(void **state) { + + const int length = 5; + f_int64ss_t data = f_int64s_t_initialize; + + { + const f_status_t status = f_int64ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_int64ss_decrease_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_int64ss_decrease_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int64ss_t data = f_int64s_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); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_decrease_by.h new file mode 100644 index 0000000..ef1adf1 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_decrease_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int64ss_decrease_by +#define _TEST__F_type_array__int64ss_decrease_by + +/** + * Test that the function works. + * + * @see f_type_array_int64ss_decrease_by() + */ +extern void test__f_type_array_int64ss_decrease_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int64ss_decrease_by() + */ +extern void test__f_type_array_int64ss_decrease_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..45159b1 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_increase.c @@ -0,0 +1,76 @@ +#include "test-type_array.h" +#include "test-type_array-int64ss_increase.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int64ss_increase__works(void **state) { + + const int length = 5; + f_int64ss_t data = f_int64s_t_initialize; + + { + const f_status_t status = f_int64ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_int64ss_increase(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); +} + +void test__f_type_array_int64ss_increase__returns_data_not(void **state) { + + const int length = 5; + f_int64ss_t data = f_int64s_t_initialize; + + { + const f_status_t status = f_int64ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_int64ss_increase(length, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_int64ss_increase__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int64ss_t data = f_int64s_t_initialize; + + { + const f_status_t status = f_int64ss_increase(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + free((void *) data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_increase.h new file mode 100644 index 0000000..ac70919 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_increase.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int64ss_increase +#define _TEST__F_type_array__int64ss_increase + +/** + * Test that the function works. + * + * @see f_type_array_int64ss_increase() + */ +extern void test__f_type_array_int64ss_increase__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_int64ss_increase() + */ +extern void test__f_type_array_int64ss_increase__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int64ss_increase() + */ +extern void test__f_type_array_int64ss_increase__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..f3e11f0 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_increase_by.c @@ -0,0 +1,52 @@ +#include "test-type_array.h" +#include "test-type_array-int64ss_increase_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int64ss_increase_by__works(void **state) { + + const int length = 5; + f_int64ss_t data = f_int64s_t_initialize; + + { + const f_status_t status = f_int64ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_int64ss_increase_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); +} + +void test__f_type_array_int64ss_increase_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int64ss_t data = f_int64s_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); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_increase_by.h new file mode 100644 index 0000000..3857a06 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_increase_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int64ss_increase_by +#define _TEST__F_type_array__int64ss_increase_by + +/** + * Test that the function works. + * + * @see f_type_array_int64ss_increase_by() + */ +extern void test__f_type_array_int64ss_increase_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int64ss_increase_by() + */ +extern void test__f_type_array_int64ss_increase_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..b2a5f35 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_resize.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-int64ss_resize.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int64ss_resize__works(void **state) { + + const int length = 5; + f_int64ss_t data = f_int64ss_t_initialize; + + { + const f_status_t status = f_int64ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_int64ss_resize__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int64ss_t data = f_int64ss_t_initialize; + + { + const f_status_t status = f_int64ss_resize(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_resize.h new file mode 100644 index 0000000..e1cee1d --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_resize.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int64ss_resize +#define _TEST__F_type_array__int64ss_resize + +/** + * Test that the function works. + * + * @see f_type_array_int64ss_resize() + */ +extern void test__f_type_array_int64ss_resize__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int64ss_resize() + */ +extern void test__f_type_array_int64ss_resize__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..46c1973 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_adjust.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-int8s_adjust.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int8s_adjust__works(void **state) { + + const int length = 5; + f_int8s_t data = f_int8s_t_initialize; + + { + const f_status_t status = f_int8s_adjust(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_int8s_adjust__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int8s_t data = f_int8s_t_initialize; + + { + const f_status_t status = f_int8s_adjust(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_adjust.h new file mode 100644 index 0000000..800cd33 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_adjust.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int8s_adjust +#define _TEST__F_type_array__int8s_adjust + +/** + * Test that the function works. + * + * @see f_type_array_int8s_adjust() + */ +extern void test__f_type_array_int8s_adjust__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int8s_adjust() + */ +extern void test__f_type_array_int8s_adjust__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..5d4ecb1 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_append.c @@ -0,0 +1,87 @@ +#include "test-type_array.h" +#include "test-type_array-int8s_append.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int8s_append__works(void **state) { + + const int length = 5; + const int length_used = 2; + f_int8s_t source = f_int8s_t_initialize; + f_int8s_t destination = f_int8s_t_initialize; + + { + const f_status_t status = f_int8s_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + for (; source.used < length_used; ++source.used) { + source.array[source.used] = source.used + 1; + } // for + + { + const f_status_t status = f_int8s_append(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 + } + + free((void *) source.array); + free((void *) destination.array); +} + +void test__f_type_array_int8s_append__returns_data_not(void **state) { + + const int length = 5; + f_int8s_t source = f_int8s_t_initialize; + f_int8s_t destination = f_int8s_t_initialize; + + { + const f_status_t status = f_int8s_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + { + const f_status_t status = f_int8s_append(source, &destination); + + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + } + + free((void *) source.array); + assert_null(destination.array); +} + +void test__f_type_array_int8s_append__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int8s_t data = f_int8s_t_initialize; + + { + const f_status_t status = f_int8s_append(data, 0); + + assert_int_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_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_append.h new file mode 100644 index 0000000..3bda741 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_append.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int8s_append +#define _TEST__F_type_array__int8s_append + +/** + * Test that the function works. + * + * @see f_type_array_int8s_append() + */ +extern void test__f_type_array_int8s_append__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_int8s_append() + */ +extern void test__f_type_array_int8s_append__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int8s_append() + */ +extern void test__f_type_array_int8s_append__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__int8s_append 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 new file mode 100644 index 0000000..744cb0d --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_decimate_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-int8s_decimate_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int8s_decimate_by__works(void **state) { + + const int length = 5; + f_int8s_t data = f_int8s_t_initialize; + + { + const f_status_t status = f_int8s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_int8s_decimate_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_int8s_decimate_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int8s_t data = f_int8s_t_initialize; + + { + const f_status_t status = f_int8s_decimate_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_decimate_by.h new file mode 100644 index 0000000..873be7f --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_decimate_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int8s_decimate_by +#define _TEST__F_type_array__int8s_decimate_by + +/** + * Test that the function works. + * + * @see f_type_array_int8s_decimate_by() + */ +extern void test__f_type_array_int8s_decimate_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int8s_decimate_by() + */ +extern void test__f_type_array_int8s_decimate_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..118d7e8 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_decrease_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-int8s_decrease_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int8s_decrease_by__works(void **state) { + + const int length = 5; + f_int8s_t data = f_int8s_t_initialize; + + { + const f_status_t status = f_int8s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_int8s_decrease_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_int8s_decrease_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int8s_t data = f_int8s_t_initialize; + + { + const f_status_t status = f_int8s_decrease_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_decrease_by.h new file mode 100644 index 0000000..de0ee34 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_decrease_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int8s_decrease_by +#define _TEST__F_type_array__int8s_decrease_by + +/** + * Test that the function works. + * + * @see f_type_array_int8s_decrease_by() + */ +extern void test__f_type_array_int8s_decrease_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int8s_decrease_by() + */ +extern void test__f_type_array_int8s_decrease_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..2d6de2a --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_increase.c @@ -0,0 +1,76 @@ +#include "test-type_array.h" +#include "test-type_array-int8s_increase.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int8s_increase__works(void **state) { + + const int length = 5; + f_int8s_t data = f_int8s_t_initialize; + + { + const f_status_t status = f_int8s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_int8s_increase(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); +} + +void test__f_type_array_int8s_increase__returns_data_not(void **state) { + + const int length = 5; + f_int8s_t data = f_int8s_t_initialize; + + { + const f_status_t status = f_int8s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_int8s_increase(length, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_int8s_increase__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int8s_t data = f_int8s_t_initialize; + + { + const f_status_t status = f_int8s_increase(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + free((void *) data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_increase.h new file mode 100644 index 0000000..cf688ba --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_increase.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int8s_increase +#define _TEST__F_type_array__int8s_increase + +/** + * Test that the function works. + * + * @see f_type_array_int8s_increase() + */ +extern void test__f_type_array_int8s_increase__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_int8s_increase() + */ +extern void test__f_type_array_int8s_increase__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int8s_increase() + */ +extern void test__f_type_array_int8s_increase__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..5fae4cd --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_increase_by.c @@ -0,0 +1,52 @@ +#include "test-type_array.h" +#include "test-type_array-int8s_increase_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int8s_increase_by__works(void **state) { + + const int length = 5; + f_int8s_t data = f_int8s_t_initialize; + + { + const f_status_t status = f_int8s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_int8s_increase_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); +} + +void test__f_type_array_int8s_increase_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..a0d242e --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_increase_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int8s_increase_by +#define _TEST__F_type_array__int8s_increase_by + +/** + * Test that the function works. + * + * @see f_type_array_int8s_increase_by() + */ +extern void test__f_type_array_int8s_increase_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int8s_increase_by() + */ +extern void test__f_type_array_int8s_increase_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..b182886 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_resize.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-int8s_resize.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int8s_resize__works(void **state) { + + const int length = 5; + f_int8s_t data = f_int8s_t_initialize; + + { + const f_status_t status = f_int8s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_int8s_resize__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int8s_t data = f_int8s_t_initialize; + + { + const f_status_t status = f_int8s_resize(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_resize.h new file mode 100644 index 0000000..df99311 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_resize.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int8s_resize +#define _TEST__F_type_array__int8s_resize + +/** + * Test that the function works. + * + * @see f_type_array_int8s_resize() + */ +extern void test__f_type_array_int8s_resize__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int8s_resize() + */ +extern void test__f_type_array_int8s_resize__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..2c185fe --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_adjust.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-int8ss_adjust.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int8ss_adjust__works(void **state) { + + const int length = 5; + f_int8ss_t data = f_int8ss_t_initialize; + + { + const f_status_t status = f_int8ss_adjust(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_int8ss_adjust__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int8ss_t data = f_int8ss_t_initialize; + + { + const f_status_t status = f_int8ss_adjust(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_adjust.h new file mode 100644 index 0000000..ba46d8b --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_adjust.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int8ss_adjust +#define _TEST__F_type_array__int8ss_adjust + +/** + * Test that the function works. + * + * @see f_type_array_int8ss_adjust() + */ +extern void test__f_type_array_int8ss_adjust__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int8ss_adjust() + */ +extern void test__f_type_array_int8ss_adjust__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..e6ed2aa --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_append.c @@ -0,0 +1,110 @@ +#include "test-type_array.h" +#include "test-type_array-int8ss_append.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int8ss_append__works(void **state) { + + const int length = 5; + const int length_inner = 2; + f_int8ss_t source = f_int8s_t_initialize; + f_int8ss_t destination = f_int8s_t_initialize; + + { + const f_status_t status = f_int8ss_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + { + for (; source.used < length; ++source.used) { + + const f_status_t status = f_int8s_resize(length_inner, &source.array[source.used]); + + assert_int_equal(status, F_none); + + for (f_array_length_t i = 0; i < length_inner; ++i) { + source.array[source.used].array[source.array[source.used].used++] = i + 1; + } // for + } // for + } + + { + const f_status_t status = f_int8ss_append(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 < destination.used; ++i) { + + assert_int_equal(destination.array[i].used, length_inner); + assert_int_equal(destination.array[i].size, length_inner); + + for (f_array_length_t j = 0; j < length_inner; ++j) { + assert_int_equal(destination.array[i].array[j], j + 1); + } // for + } // for + } + + for (f_array_length_t i = 0; i < source.used; ++i) { + free((void *) source.array[i].array); + } // for + + 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) { + + const int length = 5; + f_int8ss_t source = f_int8s_t_initialize; + f_int8ss_t destination = f_int8s_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(source, &destination); + + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + } + + free((void *) source.array); + assert_null(destination.array); +} + +void test__f_type_array_int8ss_append__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int8ss_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)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_append.h new file mode 100644 index 0000000..238c7de --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_append.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int8ss_append +#define _TEST__F_type_array__int8ss_append + +/** + * Test that the function works. + * + * @see f_type_array_int8ss_append() + */ +extern void test__f_type_array_int8ss_append__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_int8ss_append() + */ +extern void test__f_type_array_int8ss_append__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int8ss_append() + */ +extern void test__f_type_array_int8ss_append__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__int8ss_append 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 new file mode 100644 index 0000000..6523a9d --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_decimate_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-int8ss_decimate_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int8ss_decimate_by__works(void **state) { + + const int length = 5; + f_int8ss_t data = f_int8s_t_initialize; + + { + const f_status_t status = f_int8ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_int8ss_decimate_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_int8ss_decimate_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int8ss_t data = f_int8s_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); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_decimate_by.h new file mode 100644 index 0000000..19afd6c --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_decimate_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int8ss_decimate_by +#define _TEST__F_type_array__int8ss_decimate_by + +/** + * Test that the function works. + * + * @see f_type_array_int8ss_decimate_by() + */ +extern void test__f_type_array_int8ss_decimate_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int8ss_decimate_by() + */ +extern void test__f_type_array_int8ss_decimate_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..ae62dd7 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_decrease_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-int8ss_decrease_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int8ss_decrease_by__works(void **state) { + + const int length = 5; + f_int8ss_t data = f_int8s_t_initialize; + + { + const f_status_t status = f_int8ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_int8ss_decrease_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_int8ss_decrease_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int8ss_t data = f_int8s_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); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_decrease_by.h new file mode 100644 index 0000000..3944b7d --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_decrease_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int8ss_decrease_by +#define _TEST__F_type_array__int8ss_decrease_by + +/** + * Test that the function works. + * + * @see f_type_array_int8ss_decrease_by() + */ +extern void test__f_type_array_int8ss_decrease_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int8ss_decrease_by() + */ +extern void test__f_type_array_int8ss_decrease_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..009e260 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_increase.c @@ -0,0 +1,76 @@ +#include "test-type_array.h" +#include "test-type_array-int8ss_increase.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int8ss_increase__works(void **state) { + + const int length = 5; + f_int8ss_t data = f_int8s_t_initialize; + + { + const f_status_t status = f_int8ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_int8ss_increase(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); +} + +void test__f_type_array_int8ss_increase__returns_data_not(void **state) { + + const int length = 5; + f_int8ss_t data = f_int8s_t_initialize; + + { + const f_status_t status = f_int8ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_int8ss_increase(length, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_int8ss_increase__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int8ss_t data = f_int8s_t_initialize; + + { + const f_status_t status = f_int8ss_increase(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + free((void *) data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_increase.h new file mode 100644 index 0000000..5b08bab --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_increase.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int8ss_increase +#define _TEST__F_type_array__int8ss_increase + +/** + * Test that the function works. + * + * @see f_type_array_int8ss_increase() + */ +extern void test__f_type_array_int8ss_increase__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_int8ss_increase() + */ +extern void test__f_type_array_int8ss_increase__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int8ss_increase() + */ +extern void test__f_type_array_int8ss_increase__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..bb20da4 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_increase_by.c @@ -0,0 +1,52 @@ +#include "test-type_array.h" +#include "test-type_array-int8ss_increase_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int8ss_increase_by__works(void **state) { + + const int length = 5; + f_int8ss_t data = f_int8s_t_initialize; + + { + const f_status_t status = f_int8ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_int8ss_increase_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); +} + +void test__f_type_array_int8ss_increase_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int8ss_t data = f_int8s_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); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_increase_by.h new file mode 100644 index 0000000..5668e6f --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_increase_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int8ss_increase_by +#define _TEST__F_type_array__int8ss_increase_by + +/** + * Test that the function works. + * + * @see f_type_array_int8ss_increase_by() + */ +extern void test__f_type_array_int8ss_increase_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int8ss_increase_by() + */ +extern void test__f_type_array_int8ss_increase_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..7201880 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_resize.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-int8ss_resize.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_int8ss_resize__works(void **state) { + + const int length = 5; + f_int8ss_t data = f_int8ss_t_initialize; + + { + const f_status_t status = f_int8ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_int8ss_resize__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_int8ss_t data = f_int8ss_t_initialize; + + { + const f_status_t status = f_int8ss_resize(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_resize.h new file mode 100644 index 0000000..b3eaf47 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_resize.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__int8ss_resize +#define _TEST__F_type_array__int8ss_resize + +/** + * Test that the function works. + * + * @see f_type_array_int8ss_resize() + */ +extern void test__f_type_array_int8ss_resize__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_int8ss_resize() + */ +extern void test__f_type_array_int8ss_resize__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__int8ss_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 new file mode 100644 index 0000000..9f048e1 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_adjust.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-uint128s_adjust.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint128s_adjust__works(void **state) { + + const int length = 5; + f_uint128s_t data = f_uint128s_t_initialize; + + { + const f_status_t status = f_uint128s_adjust(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_uint128s_adjust__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_uint128s_t data = f_uint128s_t_initialize; + + { + const f_status_t status = f_uint128s_adjust(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_adjust.h new file mode 100644 index 0000000..44fc7db --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_adjust.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint128s_adjust +#define _TEST__F_type_array__uint128s_adjust + +/** + * Test that the function works. + * + * @see f_type_array_uint128s_adjust() + */ +extern void test__f_type_array_uint128s_adjust__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint128s_adjust() + */ +extern void test__f_type_array_uint128s_adjust__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..fcb4011 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_append.c @@ -0,0 +1,87 @@ +#include "test-type_array.h" +#include "test-type_array-uint128s_append.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint128s_append__works(void **state) { + + const int length = 5; + const int length_used = 2; + f_uint128s_t source = f_uint128s_t_initialize; + f_uint128s_t destination = f_uint128s_t_initialize; + + { + const f_status_t status = f_uint128s_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + for (; source.used < length_used; ++source.used) { + source.array[source.used] = source.used + 1; + } // for + + { + const f_status_t status = f_uint128s_append(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 + } + + free((void *) source.array); + free((void *) destination.array); +} + +void test__f_type_array_uint128s_append__returns_data_not(void **state) { + + const int length = 5; + f_uint128s_t source = f_uint128s_t_initialize; + f_uint128s_t destination = f_uint128s_t_initialize; + + { + const f_status_t status = f_uint128s_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + { + const f_status_t status = f_uint128s_append(source, &destination); + + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + } + + free((void *) source.array); + assert_null(destination.array); +} + +void test__f_type_array_uint128s_append__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_uint128s_t data = f_uint128s_t_initialize; + + { + const f_status_t status = f_uint128s_append(data, 0); + + assert_int_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_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_append.h new file mode 100644 index 0000000..ac82d7c --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_append.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint128s_append +#define _TEST__F_type_array__uint128s_append + +/** + * Test that the function works. + * + * @see f_type_array_uint128s_append() + */ +extern void test__f_type_array_uint128s_append__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_uint128s_append() + */ +extern void test__f_type_array_uint128s_append__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint128s_append() + */ +extern void test__f_type_array_uint128s_append__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__uint128s_append 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 new file mode 100644 index 0000000..2e60f42 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_decimate_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-uint128s_decimate_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint128s_decimate_by__works(void **state) { + + const int length = 5; + f_uint128s_t data = f_uint128s_t_initialize; + + { + const f_status_t status = f_uint128s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_uint128s_decimate_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_uint128s_decimate_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_uint128s_t data = f_uint128s_t_initialize; + + { + const f_status_t status = f_uint128s_decimate_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_decimate_by.h new file mode 100644 index 0000000..29fad70 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_decimate_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint128s_decimate_by +#define _TEST__F_type_array__uint128s_decimate_by + +/** + * Test that the function works. + * + * @see f_type_array_uint128s_decimate_by() + */ +extern void test__f_type_array_uint128s_decimate_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint128s_decimate_by() + */ +extern void test__f_type_array_uint128s_decimate_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..f12052c --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_decrease_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-uint128s_decrease_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint128s_decrease_by__works(void **state) { + + const int length = 5; + f_uint128s_t data = f_uint128s_t_initialize; + + { + const f_status_t status = f_uint128s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_uint128s_decrease_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_uint128s_decrease_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_uint128s_t data = f_uint128s_t_initialize; + + { + const f_status_t status = f_uint128s_decrease_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_decrease_by.h new file mode 100644 index 0000000..96ec7b1 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_decrease_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint128s_decrease_by +#define _TEST__F_type_array__uint128s_decrease_by + +/** + * Test that the function works. + * + * @see f_type_array_uint128s_decrease_by() + */ +extern void test__f_type_array_uint128s_decrease_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint128s_decrease_by() + */ +extern void test__f_type_array_uint128s_decrease_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..497c0f3 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_increase.c @@ -0,0 +1,76 @@ +#include "test-type_array.h" +#include "test-type_array-uint128s_increase.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint128s_increase__works(void **state) { + + const int length = 5; + f_uint128s_t data = f_uint128s_t_initialize; + + { + const f_status_t status = f_uint128s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_uint128s_increase(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); +} + +void test__f_type_array_uint128s_increase__returns_data_not(void **state) { + + const int length = 5; + f_uint128s_t data = f_uint128s_t_initialize; + + { + const f_status_t status = f_uint128s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_uint128s_increase(length, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_uint128s_increase__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_uint128s_t data = f_uint128s_t_initialize; + + { + const f_status_t status = f_uint128s_increase(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + free((void *) data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_increase.h new file mode 100644 index 0000000..ffd3b01 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_increase.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint128s_increase +#define _TEST__F_type_array__uint128s_increase + +/** + * Test that the function works. + * + * @see f_type_array_uint128s_increase() + */ +extern void test__f_type_array_uint128s_increase__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_uint128s_increase() + */ +extern void test__f_type_array_uint128s_increase__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint128s_increase() + */ +extern void test__f_type_array_uint128s_increase__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..4e95675 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_increase_by.c @@ -0,0 +1,52 @@ +#include "test-type_array.h" +#include "test-type_array-uint128s_increase_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint128s_increase_by__works(void **state) { + + const int length = 5; + f_uint128s_t data = f_uint128s_t_initialize; + + { + const f_status_t status = f_uint128s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_uint128s_increase_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); +} + +void test__f_type_array_uint128s_increase_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..fd71330 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_increase_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint128s_increase_by +#define _TEST__F_type_array__uint128s_increase_by + +/** + * Test that the function works. + * + * @see f_type_array_uint128s_increase_by() + */ +extern void test__f_type_array_uint128s_increase_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint128s_increase_by() + */ +extern void test__f_type_array_uint128s_increase_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..a44ec73 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_resize.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-uint128s_resize.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint128s_resize__works(void **state) { + + const int length = 5; + f_uint128s_t data = f_uint128s_t_initialize; + + { + const f_status_t status = f_uint128s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_uint128s_resize__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_uint128s_t data = f_uint128s_t_initialize; + + { + const f_status_t status = f_uint128s_resize(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_resize.h new file mode 100644 index 0000000..a1ab9bd --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_resize.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint128s_resize +#define _TEST__F_type_array__uint128s_resize + +/** + * Test that the function works. + * + * @see f_type_array_uint128s_resize() + */ +extern void test__f_type_array_uint128s_resize__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint128s_resize() + */ +extern void test__f_type_array_uint128s_resize__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..5e36340 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_adjust.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-uint128ss_adjust.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint128ss_adjust__works(void **state) { + + const int length = 5; + f_uint128ss_t data = f_uint128ss_t_initialize; + + { + const f_status_t status = f_uint128ss_adjust(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_uint128ss_adjust__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_uint128ss_t data = f_uint128ss_t_initialize; + + { + const f_status_t status = f_uint128ss_adjust(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_adjust.h new file mode 100644 index 0000000..60c4b99 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_adjust.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint128ss_adjust +#define _TEST__F_type_array__uint128ss_adjust + +/** + * Test that the function works. + * + * @see f_type_array_uint128ss_adjust() + */ +extern void test__f_type_array_uint128ss_adjust__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint128ss_adjust() + */ +extern void test__f_type_array_uint128ss_adjust__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..e294fd9 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_append.c @@ -0,0 +1,110 @@ +#include "test-type_array.h" +#include "test-type_array-uint128ss_append.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint128ss_append__works(void **state) { + + const int length = 5; + const int length_inner = 2; + f_uint128ss_t source = f_uint128s_t_initialize; + f_uint128ss_t destination = f_uint128s_t_initialize; + + { + const f_status_t status = f_uint128ss_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + { + for (; source.used < length; ++source.used) { + + const f_status_t status = f_uint128s_resize(length_inner, &source.array[source.used]); + + assert_int_equal(status, F_none); + + for (f_array_length_t i = 0; i < length_inner; ++i) { + source.array[source.used].array[source.array[source.used].used++] = i + 1; + } // for + } // for + } + + { + const f_status_t status = f_uint128ss_append(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 < destination.used; ++i) { + + assert_int_equal(destination.array[i].used, length_inner); + assert_int_equal(destination.array[i].size, length_inner); + + for (f_array_length_t j = 0; j < length_inner; ++j) { + assert_int_equal(destination.array[i].array[j], j + 1); + } // for + } // for + } + + for (f_array_length_t i = 0; i < source.used; ++i) { + free((void *) source.array[i].array); + } // for + + 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) { + + const int length = 5; + f_uint128ss_t source = f_uint128s_t_initialize; + f_uint128ss_t destination = f_uint128s_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(source, &destination); + + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + } + + free((void *) source.array); + assert_null(destination.array); +} + +void test__f_type_array_uint128ss_append__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_uint128ss_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)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_append.h new file mode 100644 index 0000000..1d666ac --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_append.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint128ss_append +#define _TEST__F_type_array__uint128ss_append + +/** + * Test that the function works. + * + * @see f_type_array_uint128ss_append() + */ +extern void test__f_type_array_uint128ss_append__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_uint128ss_append() + */ +extern void test__f_type_array_uint128ss_append__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint128ss_append() + */ +extern void test__f_type_array_uint128ss_append__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__uint128ss_append 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 new file mode 100644 index 0000000..106309a --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_decimate_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-uint128ss_decimate_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint128ss_decimate_by__works(void **state) { + + const int length = 5; + f_uint128ss_t data = f_uint128s_t_initialize; + + { + const f_status_t status = f_uint128ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_uint128ss_decimate_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_uint128ss_decimate_by__fails_on_invalid_parameter(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); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_decimate_by.h new file mode 100644 index 0000000..494d0fe --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_decimate_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint128ss_decimate_by +#define _TEST__F_type_array__uint128ss_decimate_by + +/** + * Test that the function works. + * + * @see f_type_array_uint128ss_decimate_by() + */ +extern void test__f_type_array_uint128ss_decimate_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint128ss_decimate_by() + */ +extern void test__f_type_array_uint128ss_decimate_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..8dfc0f1 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_decrease_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-uint128ss_decrease_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint128ss_decrease_by__works(void **state) { + + const int length = 5; + f_uint128ss_t data = f_uint128s_t_initialize; + + { + const f_status_t status = f_uint128ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_uint128ss_decrease_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_uint128ss_decrease_by__fails_on_invalid_parameter(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); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_decrease_by.h new file mode 100644 index 0000000..3a97b72 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_decrease_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint128ss_decrease_by +#define _TEST__F_type_array__uint128ss_decrease_by + +/** + * Test that the function works. + * + * @see f_type_array_uint128ss_decrease_by() + */ +extern void test__f_type_array_uint128ss_decrease_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint128ss_decrease_by() + */ +extern void test__f_type_array_uint128ss_decrease_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..6d5126b --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_increase.c @@ -0,0 +1,76 @@ +#include "test-type_array.h" +#include "test-type_array-uint128ss_increase.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint128ss_increase__works(void **state) { + + const int length = 5; + f_uint128ss_t data = f_uint128s_t_initialize; + + { + const f_status_t status = f_uint128ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_uint128ss_increase(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); +} + +void test__f_type_array_uint128ss_increase__returns_data_not(void **state) { + + const int length = 5; + f_uint128ss_t data = f_uint128s_t_initialize; + + { + const f_status_t status = f_uint128ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_uint128ss_increase(length, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_uint128ss_increase__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_uint128ss_t data = f_uint128s_t_initialize; + + { + const f_status_t status = f_uint128ss_increase(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + free((void *) data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_increase.h new file mode 100644 index 0000000..adffcfd --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_increase.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint128ss_increase +#define _TEST__F_type_array__uint128ss_increase + +/** + * Test that the function works. + * + * @see f_type_array_uint128ss_increase() + */ +extern void test__f_type_array_uint128ss_increase__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_uint128ss_increase() + */ +extern void test__f_type_array_uint128ss_increase__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint128ss_increase() + */ +extern void test__f_type_array_uint128ss_increase__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..7a99542 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_increase_by.c @@ -0,0 +1,52 @@ +#include "test-type_array.h" +#include "test-type_array-uint128ss_increase_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint128ss_increase_by__works(void **state) { + + const int length = 5; + f_uint128ss_t data = f_uint128s_t_initialize; + + { + const f_status_t status = f_uint128ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_uint128ss_increase_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); +} + +void test__f_type_array_uint128ss_increase_by__fails_on_invalid_parameter(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); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_increase_by.h new file mode 100644 index 0000000..0d2d290 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_increase_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint128ss_increase_by +#define _TEST__F_type_array__uint128ss_increase_by + +/** + * Test that the function works. + * + * @see f_type_array_uint128ss_increase_by() + */ +extern void test__f_type_array_uint128ss_increase_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint128ss_increase_by() + */ +extern void test__f_type_array_uint128ss_increase_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..83f6afa --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_resize.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-uint128ss_resize.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint128ss_resize__works(void **state) { + + const int length = 5; + f_uint128ss_t data = f_uint128ss_t_initialize; + + { + const f_status_t status = f_uint128ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_uint128ss_resize__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_uint128ss_t data = f_uint128ss_t_initialize; + + { + const f_status_t status = f_uint128ss_resize(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_resize.h new file mode 100644 index 0000000..db2f98f --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_resize.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint128ss_resize +#define _TEST__F_type_array__uint128ss_resize + +/** + * Test that the function works. + * + * @see f_type_array_uint128ss_resize() + */ +extern void test__f_type_array_uint128ss_resize__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint128ss_resize() + */ +extern void test__f_type_array_uint128ss_resize__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..6098400 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_adjust.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-uint16s_adjust.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint16s_adjust__works(void **state) { + + const int length = 5; + f_uint16s_t data = f_uint16s_t_initialize; + + { + const f_status_t status = f_uint16s_adjust(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_uint16s_adjust__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_uint16s_t data = f_uint16s_t_initialize; + + { + const f_status_t status = f_uint16s_adjust(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_adjust.h new file mode 100644 index 0000000..2012422 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_adjust.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint16s_adjust +#define _TEST__F_type_array__uint16s_adjust + +/** + * Test that the function works. + * + * @see f_type_array_uint16s_adjust() + */ +extern void test__f_type_array_uint16s_adjust__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint16s_adjust() + */ +extern void test__f_type_array_uint16s_adjust__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..f00fb0a --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_append.c @@ -0,0 +1,87 @@ +#include "test-type_array.h" +#include "test-type_array-uint16s_append.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint16s_append__works(void **state) { + + const int length = 5; + const int length_used = 2; + f_uint16s_t source = f_uint16s_t_initialize; + f_uint16s_t destination = f_uint16s_t_initialize; + + { + const f_status_t status = f_uint16s_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + for (; source.used < length_used; ++source.used) { + source.array[source.used] = source.used + 1; + } // for + + { + const f_status_t status = f_uint16s_append(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 + } + + free((void *) source.array); + free((void *) destination.array); +} + +void test__f_type_array_uint16s_append__returns_data_not(void **state) { + + const int length = 5; + f_uint16s_t source = f_uint16s_t_initialize; + f_uint16s_t destination = f_uint16s_t_initialize; + + { + const f_status_t status = f_uint16s_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + { + const f_status_t status = f_uint16s_append(source, &destination); + + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + } + + free((void *) source.array); + assert_null(destination.array); +} + +void test__f_type_array_uint16s_append__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_uint16s_t data = f_uint16s_t_initialize; + + { + const f_status_t status = f_uint16s_append(data, 0); + + assert_int_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_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_append.h new file mode 100644 index 0000000..a568c77 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_append.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint16s_append +#define _TEST__F_type_array__uint16s_append + +/** + * Test that the function works. + * + * @see f_type_array_uint16s_append() + */ +extern void test__f_type_array_uint16s_append__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_uint16s_append() + */ +extern void test__f_type_array_uint16s_append__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint16s_append() + */ +extern void test__f_type_array_uint16s_append__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__uint16s_append 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 new file mode 100644 index 0000000..f68ffec --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_decimate_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-uint16s_decimate_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint16s_decimate_by__works(void **state) { + + const int length = 5; + f_uint16s_t data = f_uint16s_t_initialize; + + { + const f_status_t status = f_uint16s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_uint16s_decimate_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_uint16s_decimate_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_uint16s_t data = f_uint16s_t_initialize; + + { + const f_status_t status = f_uint16s_decimate_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_decimate_by.h new file mode 100644 index 0000000..4dce396 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_decimate_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint16s_decimate_by +#define _TEST__F_type_array__uint16s_decimate_by + +/** + * Test that the function works. + * + * @see f_type_array_uint16s_decimate_by() + */ +extern void test__f_type_array_uint16s_decimate_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint16s_decimate_by() + */ +extern void test__f_type_array_uint16s_decimate_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..f3a24bb --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_decrease_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-uint16s_decrease_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint16s_decrease_by__works(void **state) { + + const int length = 5; + f_uint16s_t data = f_uint16s_t_initialize; + + { + const f_status_t status = f_uint16s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_uint16s_decrease_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_uint16s_decrease_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_uint16s_t data = f_uint16s_t_initialize; + + { + const f_status_t status = f_uint16s_decrease_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_decrease_by.h new file mode 100644 index 0000000..dae04f4 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_decrease_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint16s_decrease_by +#define _TEST__F_type_array__uint16s_decrease_by + +/** + * Test that the function works. + * + * @see f_type_array_uint16s_decrease_by() + */ +extern void test__f_type_array_uint16s_decrease_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint16s_decrease_by() + */ +extern void test__f_type_array_uint16s_decrease_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..7283669 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_increase.c @@ -0,0 +1,76 @@ +#include "test-type_array.h" +#include "test-type_array-uint16s_increase.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint16s_increase__works(void **state) { + + const int length = 5; + f_uint16s_t data = f_uint16s_t_initialize; + + { + const f_status_t status = f_uint16s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_uint16s_increase(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); +} + +void test__f_type_array_uint16s_increase__returns_data_not(void **state) { + + const int length = 5; + f_uint16s_t data = f_uint16s_t_initialize; + + { + const f_status_t status = f_uint16s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_uint16s_increase(length, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_uint16s_increase__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_uint16s_t data = f_uint16s_t_initialize; + + { + const f_status_t status = f_uint16s_increase(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + free((void *) data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_increase.h new file mode 100644 index 0000000..a8c7ef5 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_increase.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint16s_increase +#define _TEST__F_type_array__uint16s_increase + +/** + * Test that the function works. + * + * @see f_type_array_uint16s_increase() + */ +extern void test__f_type_array_uint16s_increase__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_uint16s_increase() + */ +extern void test__f_type_array_uint16s_increase__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint16s_increase() + */ +extern void test__f_type_array_uint16s_increase__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..1800849 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_increase_by.c @@ -0,0 +1,52 @@ +#include "test-type_array.h" +#include "test-type_array-uint16s_increase_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint16s_increase_by__works(void **state) { + + const int length = 5; + f_uint16s_t data = f_uint16s_t_initialize; + + { + const f_status_t status = f_uint16s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_uint16s_increase_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); +} + +void test__f_type_array_uint16s_increase_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..6a327db --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_increase_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint16s_increase_by +#define _TEST__F_type_array__uint16s_increase_by + +/** + * Test that the function works. + * + * @see f_type_array_uint16s_increase_by() + */ +extern void test__f_type_array_uint16s_increase_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint16s_increase_by() + */ +extern void test__f_type_array_uint16s_increase_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..73aab29 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_resize.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-uint16s_resize.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint16s_resize__works(void **state) { + + const int length = 5; + f_uint16s_t data = f_uint16s_t_initialize; + + { + const f_status_t status = f_uint16s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_uint16s_resize__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_uint16s_t data = f_uint16s_t_initialize; + + { + const f_status_t status = f_uint16s_resize(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_resize.h new file mode 100644 index 0000000..3bb8875 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_resize.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint16s_resize +#define _TEST__F_type_array__uint16s_resize + +/** + * Test that the function works. + * + * @see f_type_array_uint16s_resize() + */ +extern void test__f_type_array_uint16s_resize__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint16s_resize() + */ +extern void test__f_type_array_uint16s_resize__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..4aa80af --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_adjust.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-uint16ss_adjust.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint16ss_adjust__works(void **state) { + + const int length = 5; + f_uint16ss_t data = f_uint16ss_t_initialize; + + { + const f_status_t status = f_uint16ss_adjust(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_uint16ss_adjust__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_uint16ss_t data = f_uint16ss_t_initialize; + + { + const f_status_t status = f_uint16ss_adjust(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_adjust.h new file mode 100644 index 0000000..8d66d02 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_adjust.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint16ss_adjust +#define _TEST__F_type_array__uint16ss_adjust + +/** + * Test that the function works. + * + * @see f_type_array_uint16ss_adjust() + */ +extern void test__f_type_array_uint16ss_adjust__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint16ss_adjust() + */ +extern void test__f_type_array_uint16ss_adjust__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..70a2087 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_append.c @@ -0,0 +1,110 @@ +#include "test-type_array.h" +#include "test-type_array-uint16ss_append.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint16ss_append__works(void **state) { + + const int length = 5; + const int length_inner = 2; + f_uint16ss_t source = f_uint16s_t_initialize; + f_uint16ss_t destination = f_uint16s_t_initialize; + + { + const f_status_t status = f_uint16ss_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + { + for (; source.used < length; ++source.used) { + + const f_status_t status = f_uint16s_resize(length_inner, &source.array[source.used]); + + assert_int_equal(status, F_none); + + for (f_array_length_t i = 0; i < length_inner; ++i) { + source.array[source.used].array[source.array[source.used].used++] = i + 1; + } // for + } // for + } + + { + const f_status_t status = f_uint16ss_append(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 < destination.used; ++i) { + + assert_int_equal(destination.array[i].used, length_inner); + assert_int_equal(destination.array[i].size, length_inner); + + for (f_array_length_t j = 0; j < length_inner; ++j) { + assert_int_equal(destination.array[i].array[j], j + 1); + } // for + } // for + } + + for (f_array_length_t i = 0; i < source.used; ++i) { + free((void *) source.array[i].array); + } // for + + 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) { + + const int length = 5; + f_uint16ss_t source = f_uint16s_t_initialize; + f_uint16ss_t destination = f_uint16s_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(source, &destination); + + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + } + + free((void *) source.array); + assert_null(destination.array); +} + +void test__f_type_array_uint16ss_append__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_uint16ss_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)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_append.h new file mode 100644 index 0000000..8da5310 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_append.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint16ss_append +#define _TEST__F_type_array__uint16ss_append + +/** + * Test that the function works. + * + * @see f_type_array_uint16ss_append() + */ +extern void test__f_type_array_uint16ss_append__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_uint16ss_append() + */ +extern void test__f_type_array_uint16ss_append__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint16ss_append() + */ +extern void test__f_type_array_uint16ss_append__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__uint16ss_append 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 new file mode 100644 index 0000000..291cf94 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_decimate_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-uint16ss_decimate_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint16ss_decimate_by__works(void **state) { + + const int length = 5; + f_uint16ss_t data = f_uint16s_t_initialize; + + { + const f_status_t status = f_uint16ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_uint16ss_decimate_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_uint16ss_decimate_by__fails_on_invalid_parameter(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); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_decimate_by.h new file mode 100644 index 0000000..68c690f --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_decimate_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint16ss_decimate_by +#define _TEST__F_type_array__uint16ss_decimate_by + +/** + * Test that the function works. + * + * @see f_type_array_uint16ss_decimate_by() + */ +extern void test__f_type_array_uint16ss_decimate_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint16ss_decimate_by() + */ +extern void test__f_type_array_uint16ss_decimate_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..c789a8d --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_decrease_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-uint16ss_decrease_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint16ss_decrease_by__works(void **state) { + + const int length = 5; + f_uint16ss_t data = f_uint16s_t_initialize; + + { + const f_status_t status = f_uint16ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_uint16ss_decrease_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_uint16ss_decrease_by__fails_on_invalid_parameter(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); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_decrease_by.h new file mode 100644 index 0000000..c8bb169 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_decrease_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint16ss_decrease_by +#define _TEST__F_type_array__uint16ss_decrease_by + +/** + * Test that the function works. + * + * @see f_type_array_uint16ss_decrease_by() + */ +extern void test__f_type_array_uint16ss_decrease_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint16ss_decrease_by() + */ +extern void test__f_type_array_uint16ss_decrease_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..58330cf --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_increase.c @@ -0,0 +1,76 @@ +#include "test-type_array.h" +#include "test-type_array-uint16ss_increase.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint16ss_increase__works(void **state) { + + const int length = 5; + f_uint16ss_t data = f_uint16s_t_initialize; + + { + const f_status_t status = f_uint16ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_uint16ss_increase(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); +} + +void test__f_type_array_uint16ss_increase__returns_data_not(void **state) { + + const int length = 5; + f_uint16ss_t data = f_uint16s_t_initialize; + + { + const f_status_t status = f_uint16ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_uint16ss_increase(length, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_uint16ss_increase__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_uint16ss_t data = f_uint16s_t_initialize; + + { + const f_status_t status = f_uint16ss_increase(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + free((void *) data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_increase.h new file mode 100644 index 0000000..9f4472e --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_increase.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint16ss_increase +#define _TEST__F_type_array__uint16ss_increase + +/** + * Test that the function works. + * + * @see f_type_array_uint16ss_increase() + */ +extern void test__f_type_array_uint16ss_increase__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_uint16ss_increase() + */ +extern void test__f_type_array_uint16ss_increase__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint16ss_increase() + */ +extern void test__f_type_array_uint16ss_increase__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..0915379 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_increase_by.c @@ -0,0 +1,52 @@ +#include "test-type_array.h" +#include "test-type_array-uint16ss_increase_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint16ss_increase_by__works(void **state) { + + const int length = 5; + f_uint16ss_t data = f_uint16s_t_initialize; + + { + const f_status_t status = f_uint16ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_uint16ss_increase_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); +} + +void test__f_type_array_uint16ss_increase_by__fails_on_invalid_parameter(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); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_increase_by.h new file mode 100644 index 0000000..6a5d8b3 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_increase_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint16ss_increase_by +#define _TEST__F_type_array__uint16ss_increase_by + +/** + * Test that the function works. + * + * @see f_type_array_uint16ss_increase_by() + */ +extern void test__f_type_array_uint16ss_increase_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint16ss_increase_by() + */ +extern void test__f_type_array_uint16ss_increase_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..77a877c --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_resize.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-uint16ss_resize.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint16ss_resize__works(void **state) { + + const int length = 5; + f_uint16ss_t data = f_uint16ss_t_initialize; + + { + const f_status_t status = f_uint16ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_uint16ss_resize__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_uint16ss_t data = f_uint16ss_t_initialize; + + { + const f_status_t status = f_uint16ss_resize(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_resize.h new file mode 100644 index 0000000..c34e572 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_resize.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint16ss_resize +#define _TEST__F_type_array__uint16ss_resize + +/** + * Test that the function works. + * + * @see f_type_array_uint16ss_resize() + */ +extern void test__f_type_array_uint16ss_resize__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint16ss_resize() + */ +extern void test__f_type_array_uint16ss_resize__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..b2edc91 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_adjust.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-uint32s_adjust.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint32s_adjust__works(void **state) { + + const int length = 5; + f_uint32s_t data = f_uint32s_t_initialize; + + { + const f_status_t status = f_uint32s_adjust(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_uint32s_adjust__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_uint32s_t data = f_uint32s_t_initialize; + + { + const f_status_t status = f_uint32s_adjust(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_adjust.h new file mode 100644 index 0000000..b651183 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_adjust.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint32s_adjust +#define _TEST__F_type_array__uint32s_adjust + +/** + * Test that the function works. + * + * @see f_type_array_uint32s_adjust() + */ +extern void test__f_type_array_uint32s_adjust__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint32s_adjust() + */ +extern void test__f_type_array_uint32s_adjust__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..db0d482 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_append.c @@ -0,0 +1,87 @@ +#include "test-type_array.h" +#include "test-type_array-uint32s_append.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint32s_append__works(void **state) { + + const int length = 5; + const int length_used = 2; + f_uint32s_t source = f_uint32s_t_initialize; + f_uint32s_t destination = f_uint32s_t_initialize; + + { + const f_status_t status = f_uint32s_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + for (; source.used < length_used; ++source.used) { + source.array[source.used] = source.used + 1; + } // for + + { + const f_status_t status = f_uint32s_append(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 + } + + free((void *) source.array); + free((void *) destination.array); +} + +void test__f_type_array_uint32s_append__returns_data_not(void **state) { + + const int length = 5; + f_uint32s_t source = f_uint32s_t_initialize; + f_uint32s_t destination = f_uint32s_t_initialize; + + { + const f_status_t status = f_uint32s_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + { + const f_status_t status = f_uint32s_append(source, &destination); + + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + } + + free((void *) source.array); + assert_null(destination.array); +} + +void test__f_type_array_uint32s_append__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_uint32s_t data = f_uint32s_t_initialize; + + { + const f_status_t status = f_uint32s_append(data, 0); + + assert_int_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_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_append.h new file mode 100644 index 0000000..dbf57e9 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_append.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint32s_append +#define _TEST__F_type_array__uint32s_append + +/** + * Test that the function works. + * + * @see f_type_array_uint32s_append() + */ +extern void test__f_type_array_uint32s_append__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_uint32s_append() + */ +extern void test__f_type_array_uint32s_append__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint32s_append() + */ +extern void test__f_type_array_uint32s_append__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__uint32s_append 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 new file mode 100644 index 0000000..57ad5a0 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_decimate_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-uint32s_decimate_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint32s_decimate_by__works(void **state) { + + const int length = 5; + f_uint32s_t data = f_uint32s_t_initialize; + + { + const f_status_t status = f_uint32s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_uint32s_decimate_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_uint32s_decimate_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_uint32s_t data = f_uint32s_t_initialize; + + { + const f_status_t status = f_uint32s_decimate_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_decimate_by.h new file mode 100644 index 0000000..a4cd42a --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_decimate_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint32s_decimate_by +#define _TEST__F_type_array__uint32s_decimate_by + +/** + * Test that the function works. + * + * @see f_type_array_uint32s_decimate_by() + */ +extern void test__f_type_array_uint32s_decimate_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint32s_decimate_by() + */ +extern void test__f_type_array_uint32s_decimate_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..4c9be8b --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_decrease_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-uint32s_decrease_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint32s_decrease_by__works(void **state) { + + const int length = 5; + f_uint32s_t data = f_uint32s_t_initialize; + + { + const f_status_t status = f_uint32s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_uint32s_decrease_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_uint32s_decrease_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_uint32s_t data = f_uint32s_t_initialize; + + { + const f_status_t status = f_uint32s_decrease_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_decrease_by.h new file mode 100644 index 0000000..d0fa5da --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_decrease_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint32s_decrease_by +#define _TEST__F_type_array__uint32s_decrease_by + +/** + * Test that the function works. + * + * @see f_type_array_uint32s_decrease_by() + */ +extern void test__f_type_array_uint32s_decrease_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint32s_decrease_by() + */ +extern void test__f_type_array_uint32s_decrease_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..bc65739 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_increase.c @@ -0,0 +1,76 @@ +#include "test-type_array.h" +#include "test-type_array-uint32s_increase.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint32s_increase__works(void **state) { + + const int length = 5; + f_uint32s_t data = f_uint32s_t_initialize; + + { + const f_status_t status = f_uint32s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_uint32s_increase(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); +} + +void test__f_type_array_uint32s_increase__returns_data_not(void **state) { + + const int length = 5; + f_uint32s_t data = f_uint32s_t_initialize; + + { + const f_status_t status = f_uint32s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_uint32s_increase(length, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_uint32s_increase__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_uint32s_t data = f_uint32s_t_initialize; + + { + const f_status_t status = f_uint32s_increase(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + free((void *) data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_increase.h new file mode 100644 index 0000000..842a5b9 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_increase.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint32s_increase +#define _TEST__F_type_array__uint32s_increase + +/** + * Test that the function works. + * + * @see f_type_array_uint32s_increase() + */ +extern void test__f_type_array_uint32s_increase__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_uint32s_increase() + */ +extern void test__f_type_array_uint32s_increase__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint32s_increase() + */ +extern void test__f_type_array_uint32s_increase__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..f9ab277 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_increase_by.c @@ -0,0 +1,52 @@ +#include "test-type_array.h" +#include "test-type_array-uint32s_increase_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint32s_increase_by__works(void **state) { + + const int length = 5; + f_uint32s_t data = f_uint32s_t_initialize; + + { + const f_status_t status = f_uint32s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_uint32s_increase_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); +} + +void test__f_type_array_uint32s_increase_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..dda9416 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_increase_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint32s_increase_by +#define _TEST__F_type_array__uint32s_increase_by + +/** + * Test that the function works. + * + * @see f_type_array_uint32s_increase_by() + */ +extern void test__f_type_array_uint32s_increase_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint32s_increase_by() + */ +extern void test__f_type_array_uint32s_increase_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..70694db --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_resize.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-uint32s_resize.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint32s_resize__works(void **state) { + + const int length = 5; + f_uint32s_t data = f_uint32s_t_initialize; + + { + const f_status_t status = f_uint32s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_uint32s_resize__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_uint32s_t data = f_uint32s_t_initialize; + + { + const f_status_t status = f_uint32s_resize(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_resize.h new file mode 100644 index 0000000..b16a714 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_resize.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint32s_resize +#define _TEST__F_type_array__uint32s_resize + +/** + * Test that the function works. + * + * @see f_type_array_uint32s_resize() + */ +extern void test__f_type_array_uint32s_resize__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint32s_resize() + */ +extern void test__f_type_array_uint32s_resize__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..5b59bd9 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_adjust.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-uint32ss_adjust.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint32ss_adjust__works(void **state) { + + const int length = 5; + f_uint32ss_t data = f_uint32ss_t_initialize; + + { + const f_status_t status = f_uint32ss_adjust(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_uint32ss_adjust__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_uint32ss_t data = f_uint32ss_t_initialize; + + { + const f_status_t status = f_uint32ss_adjust(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_adjust.h new file mode 100644 index 0000000..5846110 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_adjust.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint32ss_adjust +#define _TEST__F_type_array__uint32ss_adjust + +/** + * Test that the function works. + * + * @see f_type_array_uint32ss_adjust() + */ +extern void test__f_type_array_uint32ss_adjust__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint32ss_adjust() + */ +extern void test__f_type_array_uint32ss_adjust__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..03e3de4 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_append.c @@ -0,0 +1,110 @@ +#include "test-type_array.h" +#include "test-type_array-uint32ss_append.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint32ss_append__works(void **state) { + + const int length = 5; + const int length_inner = 2; + f_uint32ss_t source = f_uint32s_t_initialize; + f_uint32ss_t destination = f_uint32s_t_initialize; + + { + const f_status_t status = f_uint32ss_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + { + for (; source.used < length; ++source.used) { + + const f_status_t status = f_uint32s_resize(length_inner, &source.array[source.used]); + + assert_int_equal(status, F_none); + + for (f_array_length_t i = 0; i < length_inner; ++i) { + source.array[source.used].array[source.array[source.used].used++] = i + 1; + } // for + } // for + } + + { + const f_status_t status = f_uint32ss_append(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 < destination.used; ++i) { + + assert_int_equal(destination.array[i].used, length_inner); + assert_int_equal(destination.array[i].size, length_inner); + + for (f_array_length_t j = 0; j < length_inner; ++j) { + assert_int_equal(destination.array[i].array[j], j + 1); + } // for + } // for + } + + for (f_array_length_t i = 0; i < source.used; ++i) { + free((void *) source.array[i].array); + } // for + + 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) { + + const int length = 5; + f_uint32ss_t source = f_uint32s_t_initialize; + f_uint32ss_t destination = f_uint32s_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(source, &destination); + + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + } + + free((void *) source.array); + assert_null(destination.array); +} + +void test__f_type_array_uint32ss_append__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_uint32ss_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)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_append.h new file mode 100644 index 0000000..e5ce496 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_append.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint32ss_append +#define _TEST__F_type_array__uint32ss_append + +/** + * Test that the function works. + * + * @see f_type_array_uint32ss_append() + */ +extern void test__f_type_array_uint32ss_append__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_uint32ss_append() + */ +extern void test__f_type_array_uint32ss_append__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint32ss_append() + */ +extern void test__f_type_array_uint32ss_append__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__uint32ss_append 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 new file mode 100644 index 0000000..c3a2a44 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_decimate_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-uint32ss_decimate_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint32ss_decimate_by__works(void **state) { + + const int length = 5; + f_uint32ss_t data = f_uint32s_t_initialize; + + { + const f_status_t status = f_uint32ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_uint32ss_decimate_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_uint32ss_decimate_by__fails_on_invalid_parameter(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); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_decimate_by.h new file mode 100644 index 0000000..fb792ee --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_decimate_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint32ss_decimate_by +#define _TEST__F_type_array__uint32ss_decimate_by + +/** + * Test that the function works. + * + * @see f_type_array_uint32ss_decimate_by() + */ +extern void test__f_type_array_uint32ss_decimate_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint32ss_decimate_by() + */ +extern void test__f_type_array_uint32ss_decimate_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..58c0ccd --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_decrease_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-uint32ss_decrease_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint32ss_decrease_by__works(void **state) { + + const int length = 5; + f_uint32ss_t data = f_uint32s_t_initialize; + + { + const f_status_t status = f_uint32ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_uint32ss_decrease_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_uint32ss_decrease_by__fails_on_invalid_parameter(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); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_decrease_by.h new file mode 100644 index 0000000..5789def --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_decrease_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint32ss_decrease_by +#define _TEST__F_type_array__uint32ss_decrease_by + +/** + * Test that the function works. + * + * @see f_type_array_uint32ss_decrease_by() + */ +extern void test__f_type_array_uint32ss_decrease_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint32ss_decrease_by() + */ +extern void test__f_type_array_uint32ss_decrease_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..4ecb41b --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_increase.c @@ -0,0 +1,76 @@ +#include "test-type_array.h" +#include "test-type_array-uint32ss_increase.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint32ss_increase__works(void **state) { + + const int length = 5; + f_uint32ss_t data = f_uint32s_t_initialize; + + { + const f_status_t status = f_uint32ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_uint32ss_increase(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); +} + +void test__f_type_array_uint32ss_increase__returns_data_not(void **state) { + + const int length = 5; + f_uint32ss_t data = f_uint32s_t_initialize; + + { + const f_status_t status = f_uint32ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_uint32ss_increase(length, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_uint32ss_increase__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_uint32ss_t data = f_uint32s_t_initialize; + + { + const f_status_t status = f_uint32ss_increase(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + free((void *) data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_increase.h new file mode 100644 index 0000000..1fcb7e7 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_increase.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint32ss_increase +#define _TEST__F_type_array__uint32ss_increase + +/** + * Test that the function works. + * + * @see f_type_array_uint32ss_increase() + */ +extern void test__f_type_array_uint32ss_increase__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_uint32ss_increase() + */ +extern void test__f_type_array_uint32ss_increase__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint32ss_increase() + */ +extern void test__f_type_array_uint32ss_increase__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..77c6ba8 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_increase_by.c @@ -0,0 +1,52 @@ +#include "test-type_array.h" +#include "test-type_array-uint32ss_increase_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint32ss_increase_by__works(void **state) { + + const int length = 5; + f_uint32ss_t data = f_uint32s_t_initialize; + + { + const f_status_t status = f_uint32ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_uint32ss_increase_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); +} + +void test__f_type_array_uint32ss_increase_by__fails_on_invalid_parameter(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); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_increase_by.h new file mode 100644 index 0000000..64578c4 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_increase_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint32ss_increase_by +#define _TEST__F_type_array__uint32ss_increase_by + +/** + * Test that the function works. + * + * @see f_type_array_uint32ss_increase_by() + */ +extern void test__f_type_array_uint32ss_increase_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint32ss_increase_by() + */ +extern void test__f_type_array_uint32ss_increase_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..a0e2145 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_resize.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-uint32ss_resize.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint32ss_resize__works(void **state) { + + const int length = 5; + f_uint32ss_t data = f_uint32ss_t_initialize; + + { + const f_status_t status = f_uint32ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_uint32ss_resize__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_uint32ss_t data = f_uint32ss_t_initialize; + + { + const f_status_t status = f_uint32ss_resize(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_resize.h new file mode 100644 index 0000000..1d523b8 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_resize.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint32ss_resize +#define _TEST__F_type_array__uint32ss_resize + +/** + * Test that the function works. + * + * @see f_type_array_uint32ss_resize() + */ +extern void test__f_type_array_uint32ss_resize__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint32ss_resize() + */ +extern void test__f_type_array_uint32ss_resize__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..6620d3a --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_adjust.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-uint64s_adjust.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint64s_adjust__works(void **state) { + + const int length = 5; + f_uint64s_t data = f_uint64s_t_initialize; + + { + const f_status_t status = f_uint64s_adjust(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_uint64s_adjust__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_uint64s_t data = f_uint64s_t_initialize; + + { + const f_status_t status = f_uint64s_adjust(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_adjust.h new file mode 100644 index 0000000..729ce1e --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_adjust.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint64s_adjust +#define _TEST__F_type_array__uint64s_adjust + +/** + * Test that the function works. + * + * @see f_type_array_uint64s_adjust() + */ +extern void test__f_type_array_uint64s_adjust__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint64s_adjust() + */ +extern void test__f_type_array_uint64s_adjust__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..ebd7dd2 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_append.c @@ -0,0 +1,87 @@ +#include "test-type_array.h" +#include "test-type_array-uint64s_append.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint64s_append__works(void **state) { + + const int length = 5; + const int length_used = 2; + f_uint64s_t source = f_uint64s_t_initialize; + f_uint64s_t destination = f_uint64s_t_initialize; + + { + const f_status_t status = f_uint64s_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + for (; source.used < length_used; ++source.used) { + source.array[source.used] = source.used + 1; + } // for + + { + const f_status_t status = f_uint64s_append(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 + } + + free((void *) source.array); + free((void *) destination.array); +} + +void test__f_type_array_uint64s_append__returns_data_not(void **state) { + + const int length = 5; + f_uint64s_t source = f_uint64s_t_initialize; + f_uint64s_t destination = f_uint64s_t_initialize; + + { + const f_status_t status = f_uint64s_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + { + const f_status_t status = f_uint64s_append(source, &destination); + + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + } + + free((void *) source.array); + assert_null(destination.array); +} + +void test__f_type_array_uint64s_append__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_uint64s_t data = f_uint64s_t_initialize; + + { + const f_status_t status = f_uint64s_append(data, 0); + + assert_int_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_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_append.h new file mode 100644 index 0000000..052d08c --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_append.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint64s_append +#define _TEST__F_type_array__uint64s_append + +/** + * Test that the function works. + * + * @see f_type_array_uint64s_append() + */ +extern void test__f_type_array_uint64s_append__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_uint64s_append() + */ +extern void test__f_type_array_uint64s_append__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint64s_append() + */ +extern void test__f_type_array_uint64s_append__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__uint64s_append 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 new file mode 100644 index 0000000..10980dc --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_decimate_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-uint64s_decimate_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint64s_decimate_by__works(void **state) { + + const int length = 5; + f_uint64s_t data = f_uint64s_t_initialize; + + { + const f_status_t status = f_uint64s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_uint64s_decimate_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_uint64s_decimate_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_uint64s_t data = f_uint64s_t_initialize; + + { + const f_status_t status = f_uint64s_decimate_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_decimate_by.h new file mode 100644 index 0000000..6ea01a5 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_decimate_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint64s_decimate_by +#define _TEST__F_type_array__uint64s_decimate_by + +/** + * Test that the function works. + * + * @see f_type_array_uint64s_decimate_by() + */ +extern void test__f_type_array_uint64s_decimate_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint64s_decimate_by() + */ +extern void test__f_type_array_uint64s_decimate_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..6b072d2 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_decrease_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-uint64s_decrease_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint64s_decrease_by__works(void **state) { + + const int length = 5; + f_uint64s_t data = f_uint64s_t_initialize; + + { + const f_status_t status = f_uint64s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_uint64s_decrease_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_uint64s_decrease_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_uint64s_t data = f_uint64s_t_initialize; + + { + const f_status_t status = f_uint64s_decrease_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_decrease_by.h new file mode 100644 index 0000000..0706759 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_decrease_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint64s_decrease_by +#define _TEST__F_type_array__uint64s_decrease_by + +/** + * Test that the function works. + * + * @see f_type_array_uint64s_decrease_by() + */ +extern void test__f_type_array_uint64s_decrease_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint64s_decrease_by() + */ +extern void test__f_type_array_uint64s_decrease_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..b97928b --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_increase.c @@ -0,0 +1,76 @@ +#include "test-type_array.h" +#include "test-type_array-uint64s_increase.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint64s_increase__works(void **state) { + + const int length = 5; + f_uint64s_t data = f_uint64s_t_initialize; + + { + const f_status_t status = f_uint64s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_uint64s_increase(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); +} + +void test__f_type_array_uint64s_increase__returns_data_not(void **state) { + + const int length = 5; + f_uint64s_t data = f_uint64s_t_initialize; + + { + const f_status_t status = f_uint64s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_uint64s_increase(length, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_uint64s_increase__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_uint64s_t data = f_uint64s_t_initialize; + + { + const f_status_t status = f_uint64s_increase(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + free((void *) data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_increase.h new file mode 100644 index 0000000..5fb5e7b --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_increase.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint64s_increase +#define _TEST__F_type_array__uint64s_increase + +/** + * Test that the function works. + * + * @see f_type_array_uint64s_increase() + */ +extern void test__f_type_array_uint64s_increase__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_uint64s_increase() + */ +extern void test__f_type_array_uint64s_increase__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint64s_increase() + */ +extern void test__f_type_array_uint64s_increase__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..0c96224 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_increase_by.c @@ -0,0 +1,52 @@ +#include "test-type_array.h" +#include "test-type_array-uint64s_increase_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint64s_increase_by__works(void **state) { + + const int length = 5; + f_uint64s_t data = f_uint64s_t_initialize; + + { + const f_status_t status = f_uint64s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_uint64s_increase_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); +} + +void test__f_type_array_uint64s_increase_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..2115798 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_increase_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint64s_increase_by +#define _TEST__F_type_array__uint64s_increase_by + +/** + * Test that the function works. + * + * @see f_type_array_uint64s_increase_by() + */ +extern void test__f_type_array_uint64s_increase_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint64s_increase_by() + */ +extern void test__f_type_array_uint64s_increase_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..862bd4a --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_resize.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-uint64s_resize.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint64s_resize__works(void **state) { + + const int length = 5; + f_uint64s_t data = f_uint64s_t_initialize; + + { + const f_status_t status = f_uint64s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_uint64s_resize__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_uint64s_t data = f_uint64s_t_initialize; + + { + const f_status_t status = f_uint64s_resize(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_resize.h new file mode 100644 index 0000000..22e96d0 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_resize.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint64s_resize +#define _TEST__F_type_array__uint64s_resize + +/** + * Test that the function works. + * + * @see f_type_array_uint64s_resize() + */ +extern void test__f_type_array_uint64s_resize__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint64s_resize() + */ +extern void test__f_type_array_uint64s_resize__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..bf51ef6 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_adjust.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-uint64ss_adjust.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint64ss_adjust__works(void **state) { + + const int length = 5; + f_uint64ss_t data = f_uint64ss_t_initialize; + + { + const f_status_t status = f_uint64ss_adjust(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_uint64ss_adjust__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_uint64ss_t data = f_uint64ss_t_initialize; + + { + const f_status_t status = f_uint64ss_adjust(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_adjust.h new file mode 100644 index 0000000..b93e170 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_adjust.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint64ss_adjust +#define _TEST__F_type_array__uint64ss_adjust + +/** + * Test that the function works. + * + * @see f_type_array_uint64ss_adjust() + */ +extern void test__f_type_array_uint64ss_adjust__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint64ss_adjust() + */ +extern void test__f_type_array_uint64ss_adjust__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..69c4a41 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_append.c @@ -0,0 +1,110 @@ +#include "test-type_array.h" +#include "test-type_array-uint64ss_append.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint64ss_append__works(void **state) { + + const int length = 5; + const int length_inner = 2; + f_uint64ss_t source = f_uint64s_t_initialize; + f_uint64ss_t destination = f_uint64s_t_initialize; + + { + const f_status_t status = f_uint64ss_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + { + for (; source.used < length; ++source.used) { + + const f_status_t status = f_uint64s_resize(length_inner, &source.array[source.used]); + + assert_int_equal(status, F_none); + + for (f_array_length_t i = 0; i < length_inner; ++i) { + source.array[source.used].array[source.array[source.used].used++] = i + 1; + } // for + } // for + } + + { + const f_status_t status = f_uint64ss_append(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 < destination.used; ++i) { + + assert_int_equal(destination.array[i].used, length_inner); + assert_int_equal(destination.array[i].size, length_inner); + + for (f_array_length_t j = 0; j < length_inner; ++j) { + assert_int_equal(destination.array[i].array[j], j + 1); + } // for + } // for + } + + for (f_array_length_t i = 0; i < source.used; ++i) { + free((void *) source.array[i].array); + } // for + + 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) { + + const int length = 5; + f_uint64ss_t source = f_uint64s_t_initialize; + f_uint64ss_t destination = f_uint64s_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(source, &destination); + + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + } + + free((void *) source.array); + assert_null(destination.array); +} + +void test__f_type_array_uint64ss_append__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_uint64ss_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)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_append.h new file mode 100644 index 0000000..64913fc --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_append.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint64ss_append +#define _TEST__F_type_array__uint64ss_append + +/** + * Test that the function works. + * + * @see f_type_array_uint64ss_append() + */ +extern void test__f_type_array_uint64ss_append__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_uint64ss_append() + */ +extern void test__f_type_array_uint64ss_append__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint64ss_append() + */ +extern void test__f_type_array_uint64ss_append__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__uint64ss_append 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 new file mode 100644 index 0000000..4bed12f --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_decimate_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-uint64ss_decimate_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint64ss_decimate_by__works(void **state) { + + const int length = 5; + f_uint64ss_t data = f_uint64s_t_initialize; + + { + const f_status_t status = f_uint64ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_uint64ss_decimate_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_uint64ss_decimate_by__fails_on_invalid_parameter(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); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_decimate_by.h new file mode 100644 index 0000000..b3ed09f --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_decimate_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint64ss_decimate_by +#define _TEST__F_type_array__uint64ss_decimate_by + +/** + * Test that the function works. + * + * @see f_type_array_uint64ss_decimate_by() + */ +extern void test__f_type_array_uint64ss_decimate_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint64ss_decimate_by() + */ +extern void test__f_type_array_uint64ss_decimate_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..7fddf9f --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_decrease_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-uint64ss_decrease_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint64ss_decrease_by__works(void **state) { + + const int length = 5; + f_uint64ss_t data = f_uint64s_t_initialize; + + { + const f_status_t status = f_uint64ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_uint64ss_decrease_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_uint64ss_decrease_by__fails_on_invalid_parameter(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); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_decrease_by.h new file mode 100644 index 0000000..0cabd05 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_decrease_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint64ss_decrease_by +#define _TEST__F_type_array__uint64ss_decrease_by + +/** + * Test that the function works. + * + * @see f_type_array_uint64ss_decrease_by() + */ +extern void test__f_type_array_uint64ss_decrease_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint64ss_decrease_by() + */ +extern void test__f_type_array_uint64ss_decrease_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..b08052e --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_increase.c @@ -0,0 +1,76 @@ +#include "test-type_array.h" +#include "test-type_array-uint64ss_increase.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint64ss_increase__works(void **state) { + + const int length = 5; + f_uint64ss_t data = f_uint64s_t_initialize; + + { + const f_status_t status = f_uint64ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_uint64ss_increase(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); +} + +void test__f_type_array_uint64ss_increase__returns_data_not(void **state) { + + const int length = 5; + f_uint64ss_t data = f_uint64s_t_initialize; + + { + const f_status_t status = f_uint64ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_uint64ss_increase(length, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_uint64ss_increase__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_uint64ss_t data = f_uint64s_t_initialize; + + { + const f_status_t status = f_uint64ss_increase(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + free((void *) data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_increase.h new file mode 100644 index 0000000..faa336d --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_increase.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint64ss_increase +#define _TEST__F_type_array__uint64ss_increase + +/** + * Test that the function works. + * + * @see f_type_array_uint64ss_increase() + */ +extern void test__f_type_array_uint64ss_increase__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_uint64ss_increase() + */ +extern void test__f_type_array_uint64ss_increase__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint64ss_increase() + */ +extern void test__f_type_array_uint64ss_increase__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..0ffde43 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_increase_by.c @@ -0,0 +1,52 @@ +#include "test-type_array.h" +#include "test-type_array-uint64ss_increase_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint64ss_increase_by__works(void **state) { + + const int length = 5; + f_uint64ss_t data = f_uint64s_t_initialize; + + { + const f_status_t status = f_uint64ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_uint64ss_increase_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); +} + +void test__f_type_array_uint64ss_increase_by__fails_on_invalid_parameter(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); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_increase_by.h new file mode 100644 index 0000000..d187b23 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_increase_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint64ss_increase_by +#define _TEST__F_type_array__uint64ss_increase_by + +/** + * Test that the function works. + * + * @see f_type_array_uint64ss_increase_by() + */ +extern void test__f_type_array_uint64ss_increase_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint64ss_increase_by() + */ +extern void test__f_type_array_uint64ss_increase_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..94e43db --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_resize.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-uint64ss_resize.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint64ss_resize__works(void **state) { + + const int length = 5; + f_uint64ss_t data = f_uint64ss_t_initialize; + + { + const f_status_t status = f_uint64ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_uint64ss_resize__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_uint64ss_t data = f_uint64ss_t_initialize; + + { + const f_status_t status = f_uint64ss_resize(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_resize.h new file mode 100644 index 0000000..5f22166 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_resize.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint64ss_resize +#define _TEST__F_type_array__uint64ss_resize + +/** + * Test that the function works. + * + * @see f_type_array_uint64ss_resize() + */ +extern void test__f_type_array_uint64ss_resize__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint64ss_resize() + */ +extern void test__f_type_array_uint64ss_resize__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..67fd00d --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_adjust.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-uint8s_adjust.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint8s_adjust__works(void **state) { + + const int length = 5; + f_uint8s_t data = f_uint8s_t_initialize; + + { + const f_status_t status = f_uint8s_adjust(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_uint8s_adjust__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_uint8s_t data = f_uint8s_t_initialize; + + { + const f_status_t status = f_uint8s_adjust(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_adjust.h new file mode 100644 index 0000000..dee94c0 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_adjust.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint8s_adjust +#define _TEST__F_type_array__uint8s_adjust + +/** + * Test that the function works. + * + * @see f_type_array_uint8s_adjust() + */ +extern void test__f_type_array_uint8s_adjust__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint8s_adjust() + */ +extern void test__f_type_array_uint8s_adjust__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..f8ad96d --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_append.c @@ -0,0 +1,87 @@ +#include "test-type_array.h" +#include "test-type_array-uint8s_append.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint8s_append__works(void **state) { + + const int length = 5; + const int length_used = 2; + f_uint8s_t source = f_uint8s_t_initialize; + f_uint8s_t destination = f_uint8s_t_initialize; + + { + const f_status_t status = f_uint8s_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + for (; source.used < length_used; ++source.used) { + source.array[source.used] = source.used + 1; + } // for + + { + const f_status_t status = f_uint8s_append(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 + } + + free((void *) source.array); + free((void *) destination.array); +} + +void test__f_type_array_uint8s_append__returns_data_not(void **state) { + + const int length = 5; + f_uint8s_t source = f_uint8s_t_initialize; + f_uint8s_t destination = f_uint8s_t_initialize; + + { + const f_status_t status = f_uint8s_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + { + const f_status_t status = f_uint8s_append(source, &destination); + + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + } + + free((void *) source.array); + assert_null(destination.array); +} + +void test__f_type_array_uint8s_append__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_uint8s_t data = f_uint8s_t_initialize; + + { + const f_status_t status = f_uint8s_append(data, 0); + + assert_int_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_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_append.h new file mode 100644 index 0000000..e0b062a --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_append.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint8s_append +#define _TEST__F_type_array__uint8s_append + +/** + * Test that the function works. + * + * @see f_type_array_uint8s_append() + */ +extern void test__f_type_array_uint8s_append__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_uint8s_append() + */ +extern void test__f_type_array_uint8s_append__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint8s_append() + */ +extern void test__f_type_array_uint8s_append__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__uint8s_append 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 new file mode 100644 index 0000000..434e3b3 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_decimate_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-uint8s_decimate_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint8s_decimate_by__works(void **state) { + + const int length = 5; + f_uint8s_t data = f_uint8s_t_initialize; + + { + const f_status_t status = f_uint8s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_uint8s_decimate_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_uint8s_decimate_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_uint8s_t data = f_uint8s_t_initialize; + + { + const f_status_t status = f_uint8s_decimate_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_decimate_by.h new file mode 100644 index 0000000..5575c3a --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_decimate_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint8s_decimate_by +#define _TEST__F_type_array__uint8s_decimate_by + +/** + * Test that the function works. + * + * @see f_type_array_uint8s_decimate_by() + */ +extern void test__f_type_array_uint8s_decimate_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint8s_decimate_by() + */ +extern void test__f_type_array_uint8s_decimate_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..5559b38 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_decrease_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-uint8s_decrease_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint8s_decrease_by__works(void **state) { + + const int length = 5; + f_uint8s_t data = f_uint8s_t_initialize; + + { + const f_status_t status = f_uint8s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_uint8s_decrease_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_uint8s_decrease_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_uint8s_t data = f_uint8s_t_initialize; + + { + const f_status_t status = f_uint8s_decrease_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_decrease_by.h new file mode 100644 index 0000000..5fcb7a4 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_decrease_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint8s_decrease_by +#define _TEST__F_type_array__uint8s_decrease_by + +/** + * Test that the function works. + * + * @see f_type_array_uint8s_decrease_by() + */ +extern void test__f_type_array_uint8s_decrease_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint8s_decrease_by() + */ +extern void test__f_type_array_uint8s_decrease_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..1667118 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_increase.c @@ -0,0 +1,76 @@ +#include "test-type_array.h" +#include "test-type_array-uint8s_increase.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint8s_increase__works(void **state) { + + const int length = 5; + f_uint8s_t data = f_uint8s_t_initialize; + + { + const f_status_t status = f_uint8s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_uint8s_increase(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); +} + +void test__f_type_array_uint8s_increase__returns_data_not(void **state) { + + const int length = 5; + f_uint8s_t data = f_uint8s_t_initialize; + + { + const f_status_t status = f_uint8s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_uint8s_increase(length, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_uint8s_increase__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_uint8s_t data = f_uint8s_t_initialize; + + { + const f_status_t status = f_uint8s_increase(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + free((void *) data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_increase.h new file mode 100644 index 0000000..18cf514 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_increase.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint8s_increase +#define _TEST__F_type_array__uint8s_increase + +/** + * Test that the function works. + * + * @see f_type_array_uint8s_increase() + */ +extern void test__f_type_array_uint8s_increase__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_uint8s_increase() + */ +extern void test__f_type_array_uint8s_increase__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint8s_increase() + */ +extern void test__f_type_array_uint8s_increase__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..8fb4be5 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_increase_by.c @@ -0,0 +1,52 @@ +#include "test-type_array.h" +#include "test-type_array-uint8s_increase_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint8s_increase_by__works(void **state) { + + const int length = 5; + f_uint8s_t data = f_uint8s_t_initialize; + + { + const f_status_t status = f_uint8s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_uint8s_increase_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); +} + +void test__f_type_array_uint8s_increase_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..34783da --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_increase_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint8s_increase_by +#define _TEST__F_type_array__uint8s_increase_by + +/** + * Test that the function works. + * + * @see f_type_array_uint8s_increase_by() + */ +extern void test__f_type_array_uint8s_increase_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint8s_increase_by() + */ +extern void test__f_type_array_uint8s_increase_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..86d997e --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_resize.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-uint8s_resize.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint8s_resize__works(void **state) { + + const int length = 5; + f_uint8s_t data = f_uint8s_t_initialize; + + { + const f_status_t status = f_uint8s_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_uint8s_resize__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_uint8s_t data = f_uint8s_t_initialize; + + { + const f_status_t status = f_uint8s_resize(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_resize.h new file mode 100644 index 0000000..a19fa0f --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_resize.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint8s_resize +#define _TEST__F_type_array__uint8s_resize + +/** + * Test that the function works. + * + * @see f_type_array_uint8s_resize() + */ +extern void test__f_type_array_uint8s_resize__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint8s_resize() + */ +extern void test__f_type_array_uint8s_resize__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..8d4d4a5 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_adjust.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-uint8ss_adjust.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint8ss_adjust__works(void **state) { + + const int length = 5; + f_uint8ss_t data = f_uint8ss_t_initialize; + + { + const f_status_t status = f_uint8ss_adjust(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_uint8ss_adjust__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_uint8ss_t data = f_uint8ss_t_initialize; + + { + const f_status_t status = f_uint8ss_adjust(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_adjust.h new file mode 100644 index 0000000..223dce3 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_adjust.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint8ss_adjust +#define _TEST__F_type_array__uint8ss_adjust + +/** + * Test that the function works. + * + * @see f_type_array_uint8ss_adjust() + */ +extern void test__f_type_array_uint8ss_adjust__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint8ss_adjust() + */ +extern void test__f_type_array_uint8ss_adjust__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..e9c6fed --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_append.c @@ -0,0 +1,110 @@ +#include "test-type_array.h" +#include "test-type_array-uint8ss_append.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint8ss_append__works(void **state) { + + const int length = 5; + const int length_inner = 2; + f_uint8ss_t source = f_uint8s_t_initialize; + f_uint8ss_t destination = f_uint8s_t_initialize; + + { + const f_status_t status = f_uint8ss_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + { + for (; source.used < length; ++source.used) { + + const f_status_t status = f_uint8s_resize(length_inner, &source.array[source.used]); + + assert_int_equal(status, F_none); + + for (f_array_length_t i = 0; i < length_inner; ++i) { + source.array[source.used].array[source.array[source.used].used++] = i + 1; + } // for + } // for + } + + { + const f_status_t status = f_uint8ss_append(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 < destination.used; ++i) { + + assert_int_equal(destination.array[i].used, length_inner); + assert_int_equal(destination.array[i].size, length_inner); + + for (f_array_length_t j = 0; j < length_inner; ++j) { + assert_int_equal(destination.array[i].array[j], j + 1); + } // for + } // for + } + + for (f_array_length_t i = 0; i < source.used; ++i) { + free((void *) source.array[i].array); + } // for + + 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) { + + const int length = 5; + f_uint8ss_t source = f_uint8s_t_initialize; + f_uint8ss_t destination = f_uint8s_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(source, &destination); + + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + } + + free((void *) source.array); + assert_null(destination.array); +} + +void test__f_type_array_uint8ss_append__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_uint8ss_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)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_append.h new file mode 100644 index 0000000..62e2451 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_append.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint8ss_append +#define _TEST__F_type_array__uint8ss_append + +/** + * Test that the function works. + * + * @see f_type_array_uint8ss_append() + */ +extern void test__f_type_array_uint8ss_append__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_uint8ss_append() + */ +extern void test__f_type_array_uint8ss_append__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint8ss_append() + */ +extern void test__f_type_array_uint8ss_append__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__uint8ss_append 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 new file mode 100644 index 0000000..c8418fb --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_decimate_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-uint8ss_decimate_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint8ss_decimate_by__works(void **state) { + + const int length = 5; + f_uint8ss_t data = f_uint8s_t_initialize; + + { + const f_status_t status = f_uint8ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_uint8ss_decimate_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_uint8ss_decimate_by__fails_on_invalid_parameter(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); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_decimate_by.h new file mode 100644 index 0000000..70c6812 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_decimate_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint8ss_decimate_by +#define _TEST__F_type_array__uint8ss_decimate_by + +/** + * Test that the function works. + * + * @see f_type_array_uint8ss_decimate_by() + */ +extern void test__f_type_array_uint8ss_decimate_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint8ss_decimate_by() + */ +extern void test__f_type_array_uint8ss_decimate_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..9c5fac8 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_decrease_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-uint8ss_decrease_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint8ss_decrease_by__works(void **state) { + + const int length = 5; + f_uint8ss_t data = f_uint8s_t_initialize; + + { + const f_status_t status = f_uint8ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_uint8ss_decrease_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_uint8ss_decrease_by__fails_on_invalid_parameter(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); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_decrease_by.h new file mode 100644 index 0000000..21c4271 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_decrease_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint8ss_decrease_by +#define _TEST__F_type_array__uint8ss_decrease_by + +/** + * Test that the function works. + * + * @see f_type_array_uint8ss_decrease_by() + */ +extern void test__f_type_array_uint8ss_decrease_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint8ss_decrease_by() + */ +extern void test__f_type_array_uint8ss_decrease_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..1f608f7 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_increase.c @@ -0,0 +1,76 @@ +#include "test-type_array.h" +#include "test-type_array-uint8ss_increase.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint8ss_increase__works(void **state) { + + const int length = 5; + f_uint8ss_t data = f_uint8s_t_initialize; + + { + const f_status_t status = f_uint8ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_uint8ss_increase(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); +} + +void test__f_type_array_uint8ss_increase__returns_data_not(void **state) { + + const int length = 5; + f_uint8ss_t data = f_uint8s_t_initialize; + + { + const f_status_t status = f_uint8ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_uint8ss_increase(length, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_uint8ss_increase__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_uint8ss_t data = f_uint8s_t_initialize; + + { + const f_status_t status = f_uint8ss_increase(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + free((void *) data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_increase.h new file mode 100644 index 0000000..88b7ac1 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_increase.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint8ss_increase +#define _TEST__F_type_array__uint8ss_increase + +/** + * Test that the function works. + * + * @see f_type_array_uint8ss_increase() + */ +extern void test__f_type_array_uint8ss_increase__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_uint8ss_increase() + */ +extern void test__f_type_array_uint8ss_increase__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint8ss_increase() + */ +extern void test__f_type_array_uint8ss_increase__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..8bb2b87 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_increase_by.c @@ -0,0 +1,52 @@ +#include "test-type_array.h" +#include "test-type_array-uint8ss_increase_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint8ss_increase_by__works(void **state) { + + const int length = 5; + f_uint8ss_t data = f_uint8s_t_initialize; + + { + const f_status_t status = f_uint8ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_uint8ss_increase_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); +} + +void test__f_type_array_uint8ss_increase_by__fails_on_invalid_parameter(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); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_increase_by.h new file mode 100644 index 0000000..0ab8779 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_increase_by.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint8ss_increase_by +#define _TEST__F_type_array__uint8ss_increase_by + +/** + * Test that the function works. + * + * @see f_type_array_uint8ss_increase_by() + */ +extern void test__f_type_array_uint8ss_increase_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint8ss_increase_by() + */ +extern void test__f_type_array_uint8ss_increase_by__fails_on_invalid_parameter(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 new file mode 100644 index 0000000..c0f346b --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_resize.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-uint8ss_resize.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_uint8ss_resize__works(void **state) { + + const int length = 5; + f_uint8ss_t data = f_uint8ss_t_initialize; + + { + const f_status_t status = f_uint8ss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_uint8ss_resize__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_uint8ss_t data = f_uint8ss_t_initialize; + + { + const f_status_t status = f_uint8ss_resize(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_resize.h new file mode 100644 index 0000000..b018049 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_resize.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__uint8ss_resize +#define _TEST__F_type_array__uint8ss_resize + +/** + * Test that the function works. + * + * @see f_type_array_uint8ss_resize() + */ +extern void test__f_type_array_uint8ss_resize__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_uint8ss_resize() + */ +extern void test__f_type_array_uint8ss_resize__fails_on_invalid_parameter(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 836026c..ce1c7cf 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 @@ -119,6 +119,176 @@ int main(void) { cmocka_unit_test(test__f_type_array_fll_idss_resize__works), cmocka_unit_test(test__f_type_array_fll_idss_resize__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_int8s_adjust__works), + cmocka_unit_test(test__f_type_array_int8s_adjust__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_int8s_append__works), + cmocka_unit_test(test__f_type_array_int8s_append__returns_data_not), + cmocka_unit_test(test__f_type_array_int8s_append__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_int8s_decimate_by__works), + cmocka_unit_test(test__f_type_array_int8s_decimate_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_int8s_decrease_by__works), + cmocka_unit_test(test__f_type_array_int8s_decrease_by__fails_on_invalid_parameter), + 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__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_int8s_increase_by__works), + cmocka_unit_test(test__f_type_array_int8s_increase_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_int8s_resize__works), + cmocka_unit_test(test__f_type_array_int8s_resize__fails_on_invalid_parameter), + + cmocka_unit_test(test__f_type_array_int8ss_adjust__works), + cmocka_unit_test(test__f_type_array_int8ss_adjust__fails_on_invalid_parameter), + 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__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_int8ss_decimate_by__works), + cmocka_unit_test(test__f_type_array_int8ss_decimate_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_int8ss_decrease_by__works), + cmocka_unit_test(test__f_type_array_int8ss_decrease_by__fails_on_invalid_parameter), + 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__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_int8ss_increase_by__works), + cmocka_unit_test(test__f_type_array_int8ss_increase_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_int8ss_resize__works), + cmocka_unit_test(test__f_type_array_int8ss_resize__fails_on_invalid_parameter), + + cmocka_unit_test(test__f_type_array_int16s_adjust__works), + cmocka_unit_test(test__f_type_array_int16s_adjust__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_int16s_append__works), + cmocka_unit_test(test__f_type_array_int16s_append__returns_data_not), + cmocka_unit_test(test__f_type_array_int16s_append__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_int16s_decimate_by__works), + cmocka_unit_test(test__f_type_array_int16s_decimate_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_int16s_decrease_by__works), + cmocka_unit_test(test__f_type_array_int16s_decrease_by__fails_on_invalid_parameter), + 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__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_int16s_increase_by__works), + cmocka_unit_test(test__f_type_array_int16s_increase_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_int16s_resize__works), + cmocka_unit_test(test__f_type_array_int16s_resize__fails_on_invalid_parameter), + + cmocka_unit_test(test__f_type_array_int16ss_adjust__works), + cmocka_unit_test(test__f_type_array_int16ss_adjust__fails_on_invalid_parameter), + 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__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_int16ss_decimate_by__works), + cmocka_unit_test(test__f_type_array_int16ss_decimate_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_int16ss_decrease_by__works), + cmocka_unit_test(test__f_type_array_int16ss_decrease_by__fails_on_invalid_parameter), + 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__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_int16ss_increase_by__works), + cmocka_unit_test(test__f_type_array_int16ss_increase_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_int16ss_resize__works), + cmocka_unit_test(test__f_type_array_int16ss_resize__fails_on_invalid_parameter), + + cmocka_unit_test(test__f_type_array_int32s_adjust__works), + cmocka_unit_test(test__f_type_array_int32s_adjust__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_int32s_append__works), + cmocka_unit_test(test__f_type_array_int32s_append__returns_data_not), + cmocka_unit_test(test__f_type_array_int32s_append__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_int32s_decimate_by__works), + cmocka_unit_test(test__f_type_array_int32s_decimate_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_int32s_decrease_by__works), + cmocka_unit_test(test__f_type_array_int32s_decrease_by__fails_on_invalid_parameter), + 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__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_int32s_increase_by__works), + cmocka_unit_test(test__f_type_array_int32s_increase_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_int32s_resize__works), + cmocka_unit_test(test__f_type_array_int32s_resize__fails_on_invalid_parameter), + + cmocka_unit_test(test__f_type_array_int32ss_adjust__works), + cmocka_unit_test(test__f_type_array_int32ss_adjust__fails_on_invalid_parameter), + 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__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_int32ss_decimate_by__works), + cmocka_unit_test(test__f_type_array_int32ss_decimate_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_int32ss_decrease_by__works), + cmocka_unit_test(test__f_type_array_int32ss_decrease_by__fails_on_invalid_parameter), + 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__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_int32ss_increase_by__works), + cmocka_unit_test(test__f_type_array_int32ss_increase_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_int32ss_resize__works), + cmocka_unit_test(test__f_type_array_int32ss_resize__fails_on_invalid_parameter), + + cmocka_unit_test(test__f_type_array_int64s_adjust__works), + cmocka_unit_test(test__f_type_array_int64s_adjust__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_int64s_append__works), + cmocka_unit_test(test__f_type_array_int64s_append__returns_data_not), + cmocka_unit_test(test__f_type_array_int64s_append__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_int64s_decimate_by__works), + cmocka_unit_test(test__f_type_array_int64s_decimate_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_int64s_decrease_by__works), + cmocka_unit_test(test__f_type_array_int64s_decrease_by__fails_on_invalid_parameter), + 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__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_int64s_increase_by__works), + cmocka_unit_test(test__f_type_array_int64s_increase_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_int64s_resize__works), + cmocka_unit_test(test__f_type_array_int64s_resize__fails_on_invalid_parameter), + + cmocka_unit_test(test__f_type_array_int64ss_adjust__works), + cmocka_unit_test(test__f_type_array_int64ss_adjust__fails_on_invalid_parameter), + 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__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_int64ss_decimate_by__works), + cmocka_unit_test(test__f_type_array_int64ss_decimate_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_int64ss_decrease_by__works), + cmocka_unit_test(test__f_type_array_int64ss_decrease_by__fails_on_invalid_parameter), + 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__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_int64ss_increase_by__works), + cmocka_unit_test(test__f_type_array_int64ss_increase_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_int64ss_resize__works), + cmocka_unit_test(test__f_type_array_int64ss_resize__fails_on_invalid_parameter), + + cmocka_unit_test(test__f_type_array_int128s_adjust__works), + cmocka_unit_test(test__f_type_array_int128s_adjust__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_int128s_append__works), + cmocka_unit_test(test__f_type_array_int128s_append__returns_data_not), + cmocka_unit_test(test__f_type_array_int128s_append__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_int128s_decimate_by__works), + cmocka_unit_test(test__f_type_array_int128s_decimate_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_int128s_decrease_by__works), + cmocka_unit_test(test__f_type_array_int128s_decrease_by__fails_on_invalid_parameter), + 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__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_int128s_increase_by__works), + cmocka_unit_test(test__f_type_array_int128s_increase_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_int128s_resize__works), + cmocka_unit_test(test__f_type_array_int128s_resize__fails_on_invalid_parameter), + + cmocka_unit_test(test__f_type_array_int128ss_adjust__works), + cmocka_unit_test(test__f_type_array_int128ss_adjust__fails_on_invalid_parameter), + 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__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_int128ss_decimate_by__works), + cmocka_unit_test(test__f_type_array_int128ss_decimate_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_int128ss_decrease_by__works), + cmocka_unit_test(test__f_type_array_int128ss_decrease_by__fails_on_invalid_parameter), + 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__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_int128ss_increase_by__works), + cmocka_unit_test(test__f_type_array_int128ss_increase_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_int128ss_resize__works), + cmocka_unit_test(test__f_type_array_int128ss_resize__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_states_adjust__works), cmocka_unit_test(test__f_type_array_states_adjust__fails_on_invalid_parameter), cmocka_unit_test(test__f_type_array_states_append__works), @@ -186,6 +356,176 @@ int main(void) { cmocka_unit_test(test__f_type_array_statusss_increase_by__fails_on_invalid_parameter), cmocka_unit_test(test__f_type_array_statusss_resize__works), cmocka_unit_test(test__f_type_array_statusss_resize__fails_on_invalid_parameter), + + cmocka_unit_test(test__f_type_array_uint8s_adjust__works), + cmocka_unit_test(test__f_type_array_uint8s_adjust__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_uint8s_append__works), + cmocka_unit_test(test__f_type_array_uint8s_append__returns_data_not), + cmocka_unit_test(test__f_type_array_uint8s_append__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_uint8s_decimate_by__works), + cmocka_unit_test(test__f_type_array_uint8s_decimate_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_uint8s_decrease_by__works), + cmocka_unit_test(test__f_type_array_uint8s_decrease_by__fails_on_invalid_parameter), + 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__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_uint8s_increase_by__works), + cmocka_unit_test(test__f_type_array_uint8s_increase_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_uint8s_resize__works), + cmocka_unit_test(test__f_type_array_uint8s_resize__fails_on_invalid_parameter), + + cmocka_unit_test(test__f_type_array_uint8ss_adjust__works), + cmocka_unit_test(test__f_type_array_uint8ss_adjust__fails_on_invalid_parameter), + 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__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_uint8ss_decimate_by__works), + cmocka_unit_test(test__f_type_array_uint8ss_decimate_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_uint8ss_decrease_by__works), + cmocka_unit_test(test__f_type_array_uint8ss_decrease_by__fails_on_invalid_parameter), + 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__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_uint8ss_increase_by__works), + cmocka_unit_test(test__f_type_array_uint8ss_increase_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_uint8ss_resize__works), + cmocka_unit_test(test__f_type_array_uint8ss_resize__fails_on_invalid_parameter), + + cmocka_unit_test(test__f_type_array_uint16s_adjust__works), + cmocka_unit_test(test__f_type_array_uint16s_adjust__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_uint16s_append__works), + cmocka_unit_test(test__f_type_array_uint16s_append__returns_data_not), + cmocka_unit_test(test__f_type_array_uint16s_append__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_uint16s_decimate_by__works), + cmocka_unit_test(test__f_type_array_uint16s_decimate_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_uint16s_decrease_by__works), + cmocka_unit_test(test__f_type_array_uint16s_decrease_by__fails_on_invalid_parameter), + 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__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_uint16s_increase_by__works), + cmocka_unit_test(test__f_type_array_uint16s_increase_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_uint16s_resize__works), + cmocka_unit_test(test__f_type_array_uint16s_resize__fails_on_invalid_parameter), + + cmocka_unit_test(test__f_type_array_uint16ss_adjust__works), + cmocka_unit_test(test__f_type_array_uint16ss_adjust__fails_on_invalid_parameter), + 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__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_uint16ss_decimate_by__works), + cmocka_unit_test(test__f_type_array_uint16ss_decimate_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_uint16ss_decrease_by__works), + cmocka_unit_test(test__f_type_array_uint16ss_decrease_by__fails_on_invalid_parameter), + 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__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_uint16ss_increase_by__works), + cmocka_unit_test(test__f_type_array_uint16ss_increase_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_uint16ss_resize__works), + cmocka_unit_test(test__f_type_array_uint16ss_resize__fails_on_invalid_parameter), + + cmocka_unit_test(test__f_type_array_uint32s_adjust__works), + cmocka_unit_test(test__f_type_array_uint32s_adjust__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_uint32s_append__works), + cmocka_unit_test(test__f_type_array_uint32s_append__returns_data_not), + cmocka_unit_test(test__f_type_array_uint32s_append__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_uint32s_decimate_by__works), + cmocka_unit_test(test__f_type_array_uint32s_decimate_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_uint32s_decrease_by__works), + cmocka_unit_test(test__f_type_array_uint32s_decrease_by__fails_on_invalid_parameter), + 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__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_uint32s_increase_by__works), + cmocka_unit_test(test__f_type_array_uint32s_increase_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_uint32s_resize__works), + cmocka_unit_test(test__f_type_array_uint32s_resize__fails_on_invalid_parameter), + + cmocka_unit_test(test__f_type_array_uint32ss_adjust__works), + cmocka_unit_test(test__f_type_array_uint32ss_adjust__fails_on_invalid_parameter), + 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__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_uint32ss_decimate_by__works), + cmocka_unit_test(test__f_type_array_uint32ss_decimate_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_uint32ss_decrease_by__works), + cmocka_unit_test(test__f_type_array_uint32ss_decrease_by__fails_on_invalid_parameter), + 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__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_uint32ss_increase_by__works), + cmocka_unit_test(test__f_type_array_uint32ss_increase_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_uint32ss_resize__works), + cmocka_unit_test(test__f_type_array_uint32ss_resize__fails_on_invalid_parameter), + + cmocka_unit_test(test__f_type_array_uint64s_adjust__works), + cmocka_unit_test(test__f_type_array_uint64s_adjust__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_uint64s_append__works), + cmocka_unit_test(test__f_type_array_uint64s_append__returns_data_not), + cmocka_unit_test(test__f_type_array_uint64s_append__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_uint64s_decimate_by__works), + cmocka_unit_test(test__f_type_array_uint64s_decimate_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_uint64s_decrease_by__works), + cmocka_unit_test(test__f_type_array_uint64s_decrease_by__fails_on_invalid_parameter), + 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__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_uint64s_increase_by__works), + cmocka_unit_test(test__f_type_array_uint64s_increase_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_uint64s_resize__works), + cmocka_unit_test(test__f_type_array_uint64s_resize__fails_on_invalid_parameter), + + cmocka_unit_test(test__f_type_array_uint64ss_adjust__works), + cmocka_unit_test(test__f_type_array_uint64ss_adjust__fails_on_invalid_parameter), + 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__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_uint64ss_decimate_by__works), + cmocka_unit_test(test__f_type_array_uint64ss_decimate_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_uint64ss_decrease_by__works), + cmocka_unit_test(test__f_type_array_uint64ss_decrease_by__fails_on_invalid_parameter), + 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__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_uint64ss_increase_by__works), + cmocka_unit_test(test__f_type_array_uint64ss_increase_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_uint64ss_resize__works), + cmocka_unit_test(test__f_type_array_uint64ss_resize__fails_on_invalid_parameter), + + cmocka_unit_test(test__f_type_array_uint128s_adjust__works), + cmocka_unit_test(test__f_type_array_uint128s_adjust__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_uint128s_append__works), + cmocka_unit_test(test__f_type_array_uint128s_append__returns_data_not), + cmocka_unit_test(test__f_type_array_uint128s_append__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_uint128s_decimate_by__works), + cmocka_unit_test(test__f_type_array_uint128s_decimate_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_uint128s_decrease_by__works), + cmocka_unit_test(test__f_type_array_uint128s_decrease_by__fails_on_invalid_parameter), + 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__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_uint128s_increase_by__works), + cmocka_unit_test(test__f_type_array_uint128s_increase_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_uint128s_resize__works), + cmocka_unit_test(test__f_type_array_uint128s_resize__fails_on_invalid_parameter), + + cmocka_unit_test(test__f_type_array_uint128ss_adjust__works), + cmocka_unit_test(test__f_type_array_uint128ss_adjust__fails_on_invalid_parameter), + 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__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_uint128ss_decimate_by__works), + cmocka_unit_test(test__f_type_array_uint128ss_decimate_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_uint128ss_decrease_by__works), + cmocka_unit_test(test__f_type_array_uint128ss_decrease_by__fails_on_invalid_parameter), + 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__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_uint128ss_increase_by__works), + cmocka_unit_test(test__f_type_array_uint128ss_increase_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_uint128ss_resize__works), + cmocka_unit_test(test__f_type_array_uint128ss_resize__fails_on_invalid_parameter), }; return cmocka_run_group_tests(tests, setup, setdown); diff --git a/level_0/f_type_array/tests/unit/c/test-type_array.h b/level_0/f_type_array/tests/unit/c/test-type_array.h index 21eb60b..aedad9c 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array.h @@ -67,6 +67,76 @@ #include "test-type_array-fll_idss_increase.h" #include "test-type_array-fll_idss_increase_by.h" #include "test-type_array-fll_idss_resize.h" +#include "test-type_array-int8s_adjust.h" +#include "test-type_array-int8s_append.h" +#include "test-type_array-int8s_decimate_by.h" +#include "test-type_array-int8s_decrease_by.h" +#include "test-type_array-int8s_increase.h" +#include "test-type_array-int8s_increase_by.h" +#include "test-type_array-int8s_resize.h" +#include "test-type_array-int8ss_adjust.h" +#include "test-type_array-int8ss_append.h" +#include "test-type_array-int8ss_decimate_by.h" +#include "test-type_array-int8ss_decrease_by.h" +#include "test-type_array-int8ss_increase.h" +#include "test-type_array-int8ss_increase_by.h" +#include "test-type_array-int8ss_resize.h" +#include "test-type_array-int16s_adjust.h" +#include "test-type_array-int16s_append.h" +#include "test-type_array-int16s_decimate_by.h" +#include "test-type_array-int16s_decrease_by.h" +#include "test-type_array-int16s_increase.h" +#include "test-type_array-int16s_increase_by.h" +#include "test-type_array-int16s_resize.h" +#include "test-type_array-int16ss_adjust.h" +#include "test-type_array-int16ss_append.h" +#include "test-type_array-int16ss_decimate_by.h" +#include "test-type_array-int16ss_decrease_by.h" +#include "test-type_array-int16ss_increase.h" +#include "test-type_array-int16ss_increase_by.h" +#include "test-type_array-int16ss_resize.h" +#include "test-type_array-int32s_adjust.h" +#include "test-type_array-int32s_append.h" +#include "test-type_array-int32s_decimate_by.h" +#include "test-type_array-int32s_decrease_by.h" +#include "test-type_array-int32s_increase.h" +#include "test-type_array-int32s_increase_by.h" +#include "test-type_array-int32s_resize.h" +#include "test-type_array-int32ss_adjust.h" +#include "test-type_array-int32ss_append.h" +#include "test-type_array-int32ss_decimate_by.h" +#include "test-type_array-int32ss_decrease_by.h" +#include "test-type_array-int32ss_increase.h" +#include "test-type_array-int32ss_increase_by.h" +#include "test-type_array-int32ss_resize.h" +#include "test-type_array-int64s_adjust.h" +#include "test-type_array-int64s_append.h" +#include "test-type_array-int64s_decimate_by.h" +#include "test-type_array-int64s_decrease_by.h" +#include "test-type_array-int64s_increase.h" +#include "test-type_array-int64s_increase_by.h" +#include "test-type_array-int64s_resize.h" +#include "test-type_array-int64ss_adjust.h" +#include "test-type_array-int64ss_append.h" +#include "test-type_array-int64ss_decimate_by.h" +#include "test-type_array-int64ss_decrease_by.h" +#include "test-type_array-int64ss_increase.h" +#include "test-type_array-int64ss_increase_by.h" +#include "test-type_array-int64ss_resize.h" +#include "test-type_array-int128s_adjust.h" +#include "test-type_array-int128s_append.h" +#include "test-type_array-int128s_decimate_by.h" +#include "test-type_array-int128s_decrease_by.h" +#include "test-type_array-int128s_increase.h" +#include "test-type_array-int128s_increase_by.h" +#include "test-type_array-int128s_resize.h" +#include "test-type_array-int128ss_adjust.h" +#include "test-type_array-int128ss_append.h" +#include "test-type_array-int128ss_decimate_by.h" +#include "test-type_array-int128ss_decrease_by.h" +#include "test-type_array-int128ss_increase.h" +#include "test-type_array-int128ss_increase_by.h" +#include "test-type_array-int128ss_resize.h" #include "test-type_array-states_adjust.h" #include "test-type_array-states_append.h" #include "test-type_array-states_decimate_by.h" @@ -95,6 +165,76 @@ #include "test-type_array-statusss_increase.h" #include "test-type_array-statusss_increase_by.h" #include "test-type_array-statusss_resize.h" +#include "test-type_array-uint8s_adjust.h" +#include "test-type_array-uint8s_append.h" +#include "test-type_array-uint8s_decimate_by.h" +#include "test-type_array-uint8s_decrease_by.h" +#include "test-type_array-uint8s_increase.h" +#include "test-type_array-uint8s_increase_by.h" +#include "test-type_array-uint8s_resize.h" +#include "test-type_array-uint8ss_adjust.h" +#include "test-type_array-uint8ss_append.h" +#include "test-type_array-uint8ss_decimate_by.h" +#include "test-type_array-uint8ss_decrease_by.h" +#include "test-type_array-uint8ss_increase.h" +#include "test-type_array-uint8ss_increase_by.h" +#include "test-type_array-uint8ss_resize.h" +#include "test-type_array-uint16s_adjust.h" +#include "test-type_array-uint16s_append.h" +#include "test-type_array-uint16s_decimate_by.h" +#include "test-type_array-uint16s_decrease_by.h" +#include "test-type_array-uint16s_increase.h" +#include "test-type_array-uint16s_increase_by.h" +#include "test-type_array-uint16s_resize.h" +#include "test-type_array-uint16ss_adjust.h" +#include "test-type_array-uint16ss_append.h" +#include "test-type_array-uint16ss_decimate_by.h" +#include "test-type_array-uint16ss_decrease_by.h" +#include "test-type_array-uint16ss_increase.h" +#include "test-type_array-uint16ss_increase_by.h" +#include "test-type_array-uint16ss_resize.h" +#include "test-type_array-uint32s_adjust.h" +#include "test-type_array-uint32s_append.h" +#include "test-type_array-uint32s_decimate_by.h" +#include "test-type_array-uint32s_decrease_by.h" +#include "test-type_array-uint32s_increase.h" +#include "test-type_array-uint32s_increase_by.h" +#include "test-type_array-uint32s_resize.h" +#include "test-type_array-uint32ss_adjust.h" +#include "test-type_array-uint32ss_append.h" +#include "test-type_array-uint32ss_decimate_by.h" +#include "test-type_array-uint32ss_decrease_by.h" +#include "test-type_array-uint32ss_increase.h" +#include "test-type_array-uint32ss_increase_by.h" +#include "test-type_array-uint32ss_resize.h" +#include "test-type_array-uint64s_adjust.h" +#include "test-type_array-uint64s_append.h" +#include "test-type_array-uint64s_decimate_by.h" +#include "test-type_array-uint64s_decrease_by.h" +#include "test-type_array-uint64s_increase.h" +#include "test-type_array-uint64s_increase_by.h" +#include "test-type_array-uint64s_resize.h" +#include "test-type_array-uint64ss_adjust.h" +#include "test-type_array-uint64ss_append.h" +#include "test-type_array-uint64ss_decimate_by.h" +#include "test-type_array-uint64ss_decrease_by.h" +#include "test-type_array-uint64ss_increase.h" +#include "test-type_array-uint64ss_increase_by.h" +#include "test-type_array-uint64ss_resize.h" +#include "test-type_array-uint128s_adjust.h" +#include "test-type_array-uint128s_append.h" +#include "test-type_array-uint128s_decimate_by.h" +#include "test-type_array-uint128s_decrease_by.h" +#include "test-type_array-uint128s_increase.h" +#include "test-type_array-uint128s_increase_by.h" +#include "test-type_array-uint128s_resize.h" +#include "test-type_array-uint128ss_adjust.h" +#include "test-type_array-uint128ss_append.h" +#include "test-type_array-uint128ss_decimate_by.h" +#include "test-type_array-uint128ss_decrease_by.h" +#include "test-type_array-uint128ss_increase.h" +#include "test-type_array-uint128ss_increase_by.h" +#include "test-type_array-uint128ss_resize.h" #ifdef __cplusplus extern "C" {