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 8a344c646..be7107631 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 000000000..0c92b26be --- /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 000000000..58bb505d8 --- /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 000000000..56f80578d --- /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 000000000..95f3f1d77 --- /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 000000000..b2cc9e547 --- /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 000000000..b8d393a45 --- /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 000000000..09b67604a --- /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 000000000..82a61084d --- /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 000000000..30b8d758f --- /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 000000000..2ef2e4dbb --- /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 000000000..48ff216e1 --- /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 000000000..e5b74b8ef --- /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 000000000..399d9b365 --- /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 000000000..4b1752d15 --- /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 000000000..dc07786b5 --- /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 000000000..9adcfba8d --- /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 000000000..e38f4ebc8 --- /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 000000000..ee9774100 --- /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 000000000..6e082c80d --- /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 000000000..75aa4f2ad --- /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 000000000..d622f362e --- /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 000000000..9afeb069b --- /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 000000000..c234ff513 --- /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 000000000..97c4c286c --- /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 000000000..43e6d7b26 --- /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 000000000..9844d5537 --- /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 000000000..149159b99 --- /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 000000000..37601156e --- /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 000000000..529453aa6 --- /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 000000000..6fa621409 --- /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 000000000..d4133b959 --- /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 000000000..98a2ddcd9 --- /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 000000000..cb4452c71 --- /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 000000000..80a521863 --- /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 000000000..e6cd758af --- /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 000000000..56bacd433 --- /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 000000000..26eaf9099 --- /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 000000000..e1c208ebb --- /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 000000000..dbad4856a --- /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 000000000..719c9205c --- /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 000000000..450e07d81 --- /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 000000000..e1627b712 --- /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 000000000..5bb4fc8b5 --- /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 000000000..efb8582d7 --- /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 000000000..f1e23dc98 --- /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 000000000..c40ed3b00 --- /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 000000000..ac36f8d99 --- /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 000000000..1384c682f --- /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 000000000..67ba87cd0 --- /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 000000000..a8813c98d --- /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 000000000..db4347046 --- /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 000000000..032a4bb05 --- /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 000000000..ffccc6eb8 --- /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 000000000..0d02ffb80 --- /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 000000000..078b770ec --- /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 000000000..b57993d71 --- /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 000000000..3cc76bf8c --- /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 000000000..cf4f06dcc --- /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 000000000..596cddc56 --- /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 000000000..61330219d --- /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 000000000..cd2d362fa --- /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 000000000..6fbb447dd --- /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 000000000..e0d167a33 --- /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 000000000..fad9c5e2e --- /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 000000000..a2d11f63d --- /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 000000000..d7536cda1 --- /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 000000000..4e4a8af47 --- /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 000000000..95ed773a4 --- /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 000000000..db4251dd7 --- /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 000000000..64fb507e4 --- /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 000000000..c25b621aa --- /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 000000000..8d9200cd9 --- /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 000000000..038ad3a49 --- /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 000000000..7caf1fea5 --- /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 000000000..7e3f68639 --- /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 000000000..722bb5981 --- /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 000000000..688c10a83 --- /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 000000000..1fc42cda0 --- /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 000000000..35bfac7b7 --- /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 000000000..8fdccb367 --- /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 000000000..30e121bf5 --- /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 000000000..09b2d956d --- /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 000000000..8805d36da --- /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 000000000..aee14e10a --- /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 000000000..fb63404d8 --- /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 000000000..090b24d44 --- /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 000000000..4bb91c66e --- /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 000000000..8bec71ba6 --- /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 000000000..c3ae4c9fd --- /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 000000000..31123c675 --- /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 000000000..426014f0d --- /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 000000000..e79a31779 --- /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 000000000..90b472bba --- /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 000000000..7538f33ab --- /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 000000000..4e04bfc55 --- /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 000000000..38dbd1a35 --- /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 000000000..da472e93d --- /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 000000000..a70d30fd4 --- /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 000000000..0804f0a89 --- /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 000000000..8c25372c0 --- /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 000000000..826772ba9 --- /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 000000000..ea50420c1 --- /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 000000000..9e08407f3 --- /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 000000000..9636e802e --- /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 000000000..f49a6e5b3 --- /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 000000000..ef1adf1f0 --- /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 000000000..45159b1b7 --- /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 000000000..ac70919a2 --- /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 000000000..f3e11f056 --- /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 000000000..3857a061f --- /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 000000000..b2a5f3567 --- /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 000000000..e1cee1d48 --- /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 000000000..46c197322 --- /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 000000000..800cd3330 --- /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 000000000..5d4ecb156 --- /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 000000000..3bda741f5 --- /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 000000000..744cb0da6 --- /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 000000000..873be7f8a --- /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 000000000..118d7e801 --- /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 000000000..de0ee3415 --- /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 000000000..2d6de2a61 --- /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 000000000..cf688badc --- /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 000000000..5fae4cdc4 --- /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 000000000..a0d242e6a --- /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 000000000..b18288611 --- /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 000000000..df99311ea --- /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 000000000..2c185fe8b --- /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 000000000..ba46d8bf1 --- /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 000000000..e6ed2aab5 --- /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 000000000..238c7de1b --- /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 000000000..6523a9df1 --- /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 000000000..19afd6c34 --- /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 000000000..ae62dd78c --- /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 000000000..3944b7d06 --- /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 000000000..009e260aa --- /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 000000000..5b08baba1 --- /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 000000000..bb20da4a3 --- /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 000000000..5668e6fb7 --- /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 000000000..72018800a --- /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 000000000..b3eaf4704 --- /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 000000000..9f048e12a --- /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 000000000..44fc7db2c --- /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 000000000..fcb4011e9 --- /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 000000000..ac82d7c93 --- /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 000000000..2e60f42c3 --- /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 000000000..29fad70e2 --- /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 000000000..f12052c10 --- /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 000000000..96ec7b185 --- /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 000000000..497c0f39c --- /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 000000000..ffd3b01cd --- /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 000000000..4e9567544 --- /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 000000000..fd71330ee --- /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 000000000..a44ec733c --- /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 000000000..a1ab9bd52 --- /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 000000000..5e36340a3 --- /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 000000000..60c4b99b9 --- /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 000000000..e294fd9c0 --- /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 000000000..1d666ac90 --- /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 000000000..106309aa9 --- /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 000000000..494d0fee9 --- /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 000000000..8dfc0f1f4 --- /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 000000000..3a97b72e6 --- /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 000000000..6d5126bed --- /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 000000000..adffcfdeb --- /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 000000000..7a9954293 --- /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 000000000..0d2d29028 --- /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 000000000..83f6afa80 --- /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 000000000..db2f98fb0 --- /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 000000000..6098400bb --- /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 000000000..2012422fd --- /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 000000000..f00fb0a25 --- /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 000000000..a568c77b8 --- /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 000000000..f68ffec34 --- /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 000000000..4dce39657 --- /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 000000000..f3a24bb55 --- /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 000000000..dae04f426 --- /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 000000000..728366955 --- /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 000000000..a8c7ef5fb --- /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 000000000..180084978 --- /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 000000000..6a327db55 --- /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 000000000..73aab2980 --- /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 000000000..3bb8875d9 --- /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 000000000..4aa80afdd --- /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 000000000..8d66d02b1 --- /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 000000000..70a2087b9 --- /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 000000000..8da5310cf --- /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 000000000..291cf945f --- /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 000000000..68c690fb5 --- /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 000000000..c789a8d90 --- /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 000000000..c8bb16997 --- /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 000000000..58330cf63 --- /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 000000000..9f4472ea9 --- /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 000000000..091537981 --- /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 000000000..6a5d8b3d2 --- /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 000000000..77a877c0b --- /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 000000000..c34e57295 --- /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 000000000..b2edc91e4 --- /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 000000000..b6511831c --- /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 000000000..db0d48211 --- /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 000000000..dbf57e988 --- /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 000000000..57ad5a011 --- /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 000000000..a4cd42a16 --- /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 000000000..4c9be8b17 --- /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 000000000..d0fa5da0a --- /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 000000000..bc65739bd --- /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 000000000..842a5b921 --- /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 000000000..f9ab27748 --- /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 000000000..dda9416c3 --- /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 000000000..70694db6c --- /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 000000000..b16a71402 --- /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 000000000..5b59bd9ec --- /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 000000000..584611035 --- /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 000000000..03e3de445 --- /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 000000000..e5ce496b7 --- /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 000000000..c3a2a4461 --- /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 000000000..fb792ee83 --- /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 000000000..58c0ccd61 --- /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 000000000..5789def64 --- /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 000000000..4ecb41bb6 --- /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 000000000..1fcb7e7a3 --- /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 000000000..77c6ba894 --- /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 000000000..64578c44e --- /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 000000000..a0e214556 --- /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 000000000..1d523b8ac --- /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 000000000..6620d3a2a --- /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 000000000..729ce1e50 --- /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 000000000..ebd7dd29c --- /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 000000000..052d08c44 --- /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 000000000..10980dc4a --- /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 000000000..6ea01a527 --- /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 000000000..6b072d24b --- /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 000000000..0706759b0 --- /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 000000000..b97928b81 --- /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 000000000..5fb5e7b3e --- /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 000000000..0c96224dc --- /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 000000000..2115798d9 --- /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 000000000..862bd4abc --- /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 000000000..22e96d0b7 --- /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 000000000..bf51ef632 --- /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 000000000..b93e170a5 --- /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 000000000..69c4a41e4 --- /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 000000000..64913fc95 --- /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 000000000..4bed12f3b --- /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 000000000..b3ed09f33 --- /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 000000000..7fddf9f7f --- /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 000000000..0cabd0537 --- /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 000000000..b08052e0b --- /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 000000000..faa336d93 --- /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 000000000..0ffde43e6 --- /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 000000000..d187b23d9 --- /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 000000000..94e43db88 --- /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 000000000..5f221661c --- /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 000000000..67fd00d39 --- /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 000000000..dee94c0ab --- /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 000000000..f8ad96dfd --- /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 000000000..e0b062aa2 --- /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 000000000..434e3b3dd --- /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 000000000..5575c3a5a --- /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 000000000..5559b3817 --- /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 000000000..5fcb7a445 --- /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 000000000..16671188c --- /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 000000000..18cf51442 --- /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 000000000..8fb4be53b --- /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 000000000..34783da4f --- /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 000000000..86d997e9b --- /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 000000000..a19fa0f34 --- /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 000000000..8d4d4a550 --- /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 000000000..223dce3ee --- /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 000000000..e9c6fed43 --- /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 000000000..62e245177 --- /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 000000000..c8418fbb8 --- /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 000000000..70c6812c2 --- /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 000000000..9c5fac8d8 --- /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 000000000..21c4271a6 --- /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 000000000..1f608f782 --- /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 000000000..88b7ac1c5 --- /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 000000000..8bb2b87ee --- /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 000000000..0ab87795a --- /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 000000000..c0f346b83 --- /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 000000000..b0180491b --- /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 836026c25..ce1c7cf73 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 21eb60b54..aedad9ca1 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" {