From 0469e4f9d8d797eba868f706637bb29f940da6f8 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Thu, 23 Dec 2021 11:38:21 -0600 Subject: [PATCH] Update: Add tests for f_type_array. Given the size of the task and my relative inexperience with cmocka, I opted to keep the tests as simple as possible. This means that my tests are likely not thorough. These are intended to be good enough for a first pass tests. After all, I have the entire rest of the FLL projects to write tests for (as well as for the programs). --- level_0/f_type_array/data/build/dependencies-tests | 3 + level_0/f_type_array/data/build/settings-tests | 54 ++++++ level_0/f_type_array/data/build/testfile | 27 +++ .../tests/c/test-type_array-array_lengths_adjust.c | 42 +++++ .../tests/c/test-type_array-array_lengths_adjust.h | 27 +++ .../tests/c/test-type_array-array_lengths_append.c | 87 +++++++++ .../tests/c/test-type_array-array_lengths_append.h | 34 ++++ .../c/test-type_array-array_lengths_decimate_by.c | 50 ++++++ .../c/test-type_array-array_lengths_decimate_by.h | 27 +++ .../c/test-type_array-array_lengths_decrease_by.c | 50 ++++++ .../c/test-type_array-array_lengths_decrease_by.h | 27 +++ .../c/test-type_array-array_lengths_increase.c | 76 ++++++++ .../c/test-type_array-array_lengths_increase.h | 34 ++++ .../c/test-type_array-array_lengths_increase_by.c | 52 ++++++ .../c/test-type_array-array_lengths_increase_by.h | 27 +++ .../tests/c/test-type_array-array_lengths_resize.c | 42 +++++ .../tests/c/test-type_array-array_lengths_resize.h | 27 +++ .../c/test-type_array-array_lengthss_adjust.c | 42 +++++ .../c/test-type_array-array_lengthss_adjust.h | 27 +++ .../c/test-type_array-array_lengthss_append.c | 110 ++++++++++++ .../c/test-type_array-array_lengthss_append.h | 34 ++++ .../c/test-type_array-array_lengthss_decimate_by.c | 50 ++++++ .../c/test-type_array-array_lengthss_decimate_by.h | 27 +++ .../c/test-type_array-array_lengthss_decrease_by.c | 50 ++++++ .../c/test-type_array-array_lengthss_decrease_by.h | 27 +++ .../c/test-type_array-array_lengthss_increase.c | 76 ++++++++ .../c/test-type_array-array_lengthss_increase.h | 34 ++++ .../c/test-type_array-array_lengthss_increase_by.c | 52 ++++++ .../c/test-type_array-array_lengthss_increase_by.h | 27 +++ .../c/test-type_array-array_lengthss_resize.c | 42 +++++ .../c/test-type_array-array_lengthss_resize.h | 27 +++ .../tests/c/test-type_array-cells_adjust.c | 42 +++++ .../tests/c/test-type_array-cells_adjust.h | 27 +++ .../tests/c/test-type_array-cells_append.c | 90 ++++++++++ .../tests/c/test-type_array-cells_append.h | 34 ++++ .../tests/c/test-type_array-cells_decimate_by.c | 50 ++++++ .../tests/c/test-type_array-cells_decimate_by.h | 27 +++ .../tests/c/test-type_array-cells_decrease_by.c | 50 ++++++ .../tests/c/test-type_array-cells_decrease_by.h | 27 +++ .../tests/c/test-type_array-cells_increase.c | 76 ++++++++ .../tests/c/test-type_array-cells_increase.h | 34 ++++ .../tests/c/test-type_array-cells_increase_by.c | 52 ++++++ .../tests/c/test-type_array-cells_increase_by.h | 27 +++ .../tests/c/test-type_array-cells_resize.c | 42 +++++ .../tests/c/test-type_array-cells_resize.h | 27 +++ .../tests/c/test-type_array-cellss_adjust.c | 42 +++++ .../tests/c/test-type_array-cellss_adjust.h | 27 +++ .../tests/c/test-type_array-cellss_append.c | 114 ++++++++++++ .../tests/c/test-type_array-cellss_append.h | 34 ++++ .../tests/c/test-type_array-cellss_decimate_by.c | 50 ++++++ .../tests/c/test-type_array-cellss_decimate_by.h | 27 +++ .../tests/c/test-type_array-cellss_decrease_by.c | 50 ++++++ .../tests/c/test-type_array-cellss_decrease_by.h | 27 +++ .../tests/c/test-type_array-cellss_increase.c | 76 ++++++++ .../tests/c/test-type_array-cellss_increase.h | 34 ++++ .../tests/c/test-type_array-cellss_increase_by.c | 52 ++++++ .../tests/c/test-type_array-cellss_increase_by.h | 27 +++ .../tests/c/test-type_array-cellss_resize.c | 42 +++++ .../tests/c/test-type_array-cellss_resize.h | 27 +++ .../tests/c/test-type_array-fll_ids_adjust.c | 42 +++++ .../tests/c/test-type_array-fll_ids_adjust.h | 27 +++ .../tests/c/test-type_array-fll_ids_append.c | 92 ++++++++++ .../tests/c/test-type_array-fll_ids_append.h | 34 ++++ .../tests/c/test-type_array-fll_ids_decimate_by.c | 50 ++++++ .../tests/c/test-type_array-fll_ids_decimate_by.h | 27 +++ .../tests/c/test-type_array-fll_ids_decrease_by.c | 50 ++++++ .../tests/c/test-type_array-fll_ids_decrease_by.h | 27 +++ .../tests/c/test-type_array-fll_ids_increase.c | 76 ++++++++ .../tests/c/test-type_array-fll_ids_increase.h | 34 ++++ .../tests/c/test-type_array-fll_ids_increase_by.c | 52 ++++++ .../tests/c/test-type_array-fll_ids_increase_by.h | 27 +++ .../tests/c/test-type_array-fll_ids_resize.c | 42 +++++ .../tests/c/test-type_array-fll_ids_resize.h | 27 +++ .../tests/c/test-type_array-fll_idss_adjust.c | 42 +++++ .../tests/c/test-type_array-fll_idss_adjust.h | 27 +++ .../tests/c/test-type_array-fll_idss_append.c | 116 ++++++++++++ .../tests/c/test-type_array-fll_idss_append.h | 34 ++++ .../tests/c/test-type_array-fll_idss_decimate_by.c | 50 ++++++ .../tests/c/test-type_array-fll_idss_decimate_by.h | 27 +++ .../tests/c/test-type_array-fll_idss_decrease_by.c | 50 ++++++ .../tests/c/test-type_array-fll_idss_decrease_by.h | 27 +++ .../tests/c/test-type_array-fll_idss_increase.c | 76 ++++++++ .../tests/c/test-type_array-fll_idss_increase.h | 34 ++++ .../tests/c/test-type_array-fll_idss_increase_by.c | 52 ++++++ .../tests/c/test-type_array-fll_idss_increase_by.h | 27 +++ .../tests/c/test-type_array-fll_idss_resize.c | 42 +++++ .../tests/c/test-type_array-fll_idss_resize.h | 27 +++ .../tests/c/test-type_array-states_adjust.c | 42 +++++ .../tests/c/test-type_array-states_adjust.h | 27 +++ .../tests/c/test-type_array-states_append.c | 100 +++++++++++ .../tests/c/test-type_array-states_append.h | 34 ++++ .../tests/c/test-type_array-states_decimate_by.c | 50 ++++++ .../tests/c/test-type_array-states_decimate_by.h | 27 +++ .../tests/c/test-type_array-states_decrease_by.c | 50 ++++++ .../tests/c/test-type_array-states_decrease_by.h | 27 +++ .../tests/c/test-type_array-states_increase.c | 76 ++++++++ .../tests/c/test-type_array-states_increase.h | 34 ++++ .../tests/c/test-type_array-states_increase_by.c | 52 ++++++ .../tests/c/test-type_array-states_increase_by.h | 27 +++ .../tests/c/test-type_array-states_resize.c | 42 +++++ .../tests/c/test-type_array-states_resize.h | 27 +++ .../tests/c/test-type_array-statess_adjust.c | 42 +++++ .../tests/c/test-type_array-statess_adjust.h | 27 +++ .../tests/c/test-type_array-statess_append.c | 124 +++++++++++++ .../tests/c/test-type_array-statess_append.h | 34 ++++ .../tests/c/test-type_array-statess_decimate_by.c | 50 ++++++ .../tests/c/test-type_array-statess_decimate_by.h | 27 +++ .../tests/c/test-type_array-statess_decrease_by.c | 50 ++++++ .../tests/c/test-type_array-statess_decrease_by.h | 27 +++ .../tests/c/test-type_array-statess_increase.c | 76 ++++++++ .../tests/c/test-type_array-statess_increase.h | 34 ++++ .../tests/c/test-type_array-statess_increase_by.c | 52 ++++++ .../tests/c/test-type_array-statess_increase_by.h | 27 +++ .../tests/c/test-type_array-statess_resize.c | 42 +++++ .../tests/c/test-type_array-statess_resize.h | 27 +++ .../tests/c/test-type_array-statuss_adjust.c | 42 +++++ .../tests/c/test-type_array-statuss_adjust.h | 27 +++ .../tests/c/test-type_array-statuss_append.c | 87 +++++++++ .../tests/c/test-type_array-statuss_append.h | 34 ++++ .../tests/c/test-type_array-statuss_decimate_by.c | 50 ++++++ .../tests/c/test-type_array-statuss_decimate_by.h | 27 +++ .../tests/c/test-type_array-statuss_decrease_by.c | 50 ++++++ .../tests/c/test-type_array-statuss_decrease_by.h | 27 +++ .../tests/c/test-type_array-statuss_increase.c | 76 ++++++++ .../tests/c/test-type_array-statuss_increase.h | 34 ++++ .../tests/c/test-type_array-statuss_increase_by.c | 52 ++++++ .../tests/c/test-type_array-statuss_increase_by.h | 27 +++ .../tests/c/test-type_array-statuss_resize.c | 42 +++++ .../tests/c/test-type_array-statuss_resize.h | 27 +++ .../tests/c/test-type_array-statusss_adjust.c | 42 +++++ .../tests/c/test-type_array-statusss_adjust.h | 27 +++ .../tests/c/test-type_array-statusss_append.c | 110 ++++++++++++ .../tests/c/test-type_array-statusss_append.h | 34 ++++ .../tests/c/test-type_array-statusss_decimate_by.c | 50 ++++++ .../tests/c/test-type_array-statusss_decimate_by.h | 27 +++ .../tests/c/test-type_array-statusss_decrease_by.c | 50 ++++++ .../tests/c/test-type_array-statusss_decrease_by.h | 27 +++ .../tests/c/test-type_array-statusss_increase.c | 76 ++++++++ .../tests/c/test-type_array-statusss_increase.h | 34 ++++ .../tests/c/test-type_array-statusss_increase_by.c | 52 ++++++ .../tests/c/test-type_array-statusss_increase_by.h | 27 +++ .../tests/c/test-type_array-statusss_resize.c | 42 +++++ .../tests/c/test-type_array-statusss_resize.h | 27 +++ level_0/f_type_array/tests/c/test-type_array.c | 196 +++++++++++++++++++++ level_0/f_type_array/tests/c/test-type_array.h | 140 +++++++++++++++ 145 files changed, 6600 insertions(+) create mode 100644 level_0/f_type_array/data/build/dependencies-tests create mode 100644 level_0/f_type_array/data/build/settings-tests create mode 100644 level_0/f_type_array/data/build/testfile create mode 100644 level_0/f_type_array/tests/c/test-type_array-array_lengths_adjust.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-array_lengths_adjust.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-array_lengths_append.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-array_lengths_append.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-array_lengths_decimate_by.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-array_lengths_decimate_by.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-array_lengths_decrease_by.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-array_lengths_decrease_by.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-array_lengths_increase.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-array_lengths_increase.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-array_lengths_increase_by.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-array_lengths_increase_by.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-array_lengths_resize.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-array_lengths_resize.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-array_lengthss_adjust.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-array_lengthss_adjust.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-array_lengthss_append.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-array_lengthss_append.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-array_lengthss_decimate_by.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-array_lengthss_decimate_by.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-array_lengthss_decrease_by.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-array_lengthss_decrease_by.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-array_lengthss_increase.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-array_lengthss_increase.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-array_lengthss_increase_by.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-array_lengthss_increase_by.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-array_lengthss_resize.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-array_lengthss_resize.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-cells_adjust.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-cells_adjust.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-cells_append.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-cells_append.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-cells_decimate_by.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-cells_decimate_by.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-cells_decrease_by.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-cells_decrease_by.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-cells_increase.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-cells_increase.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-cells_increase_by.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-cells_increase_by.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-cells_resize.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-cells_resize.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-cellss_adjust.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-cellss_adjust.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-cellss_append.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-cellss_append.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-cellss_decimate_by.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-cellss_decimate_by.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-cellss_decrease_by.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-cellss_decrease_by.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-cellss_increase.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-cellss_increase.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-cellss_increase_by.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-cellss_increase_by.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-cellss_resize.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-cellss_resize.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-fll_ids_adjust.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-fll_ids_adjust.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-fll_ids_append.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-fll_ids_append.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-fll_ids_decimate_by.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-fll_ids_decimate_by.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-fll_ids_decrease_by.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-fll_ids_decrease_by.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-fll_ids_increase.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-fll_ids_increase.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-fll_ids_increase_by.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-fll_ids_increase_by.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-fll_ids_resize.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-fll_ids_resize.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-fll_idss_adjust.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-fll_idss_adjust.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-fll_idss_append.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-fll_idss_append.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-fll_idss_decimate_by.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-fll_idss_decimate_by.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-fll_idss_decrease_by.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-fll_idss_decrease_by.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-fll_idss_increase.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-fll_idss_increase.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-fll_idss_increase_by.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-fll_idss_increase_by.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-fll_idss_resize.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-fll_idss_resize.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-states_adjust.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-states_adjust.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-states_append.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-states_append.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-states_decimate_by.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-states_decimate_by.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-states_decrease_by.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-states_decrease_by.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-states_increase.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-states_increase.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-states_increase_by.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-states_increase_by.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-states_resize.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-states_resize.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-statess_adjust.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-statess_adjust.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-statess_append.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-statess_append.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-statess_decimate_by.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-statess_decimate_by.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-statess_decrease_by.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-statess_decrease_by.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-statess_increase.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-statess_increase.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-statess_increase_by.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-statess_increase_by.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-statess_resize.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-statess_resize.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-statuss_adjust.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-statuss_adjust.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-statuss_append.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-statuss_append.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-statuss_decimate_by.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-statuss_decimate_by.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-statuss_decrease_by.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-statuss_decrease_by.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-statuss_increase.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-statuss_increase.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-statuss_increase_by.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-statuss_increase_by.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-statuss_resize.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-statuss_resize.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-statusss_adjust.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-statusss_adjust.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-statusss_append.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-statusss_append.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-statusss_decimate_by.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-statusss_decimate_by.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-statusss_decrease_by.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-statusss_decrease_by.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-statusss_increase.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-statusss_increase.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-statusss_increase_by.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-statusss_increase_by.h create mode 100644 level_0/f_type_array/tests/c/test-type_array-statusss_resize.c create mode 100644 level_0/f_type_array/tests/c/test-type_array-statusss_resize.h create mode 100644 level_0/f_type_array/tests/c/test-type_array.c create mode 100644 level_0/f_type_array/tests/c/test-type_array.h diff --git a/level_0/f_type_array/data/build/dependencies-tests b/level_0/f_type_array/data/build/dependencies-tests new file mode 100644 index 0000000..ef33c6a --- /dev/null +++ b/level_0/f_type_array/data/build/dependencies-tests @@ -0,0 +1,3 @@ +# fss-0000 + +cmocka 1.* diff --git a/level_0/f_type_array/data/build/settings-tests b/level_0/f_type_array/data/build/settings-tests new file mode 100644 index 0000000..dad2630 --- /dev/null +++ b/level_0/f_type_array/data/build/settings-tests @@ -0,0 +1,54 @@ +# fss-0001 + +project_name test-f_type_array + +version_major 0 +version_file major +version_target major + +modes individual level monolithic +modes_default individual + +build_compiler gcc +build_indexer ar +build_indexer_arguments rcs +build_language c +build_libraries -lc -lcmocka +build_libraries-individual -lf_memory -lf_type_array +build_libraries-level -lfll_0 +build_libraries-monolithic -lfll +build_sources_program test-type_array-array_lengths_adjust.c test-type_array-array_lengths_append.c test-type_array-array_lengths_decimate_by.c test-type_array-array_lengths_decrease_by.c test-type_array-array_lengths_increase.c test-type_array-array_lengths_increase_by.c test-type_array-array_lengths_resize.c +build_sources_program test-type_array-array_lengthss_adjust.c test-type_array-array_lengthss_append.c test-type_array-array_lengthss_decimate_by.c test-type_array-array_lengthss_decrease_by.c test-type_array-array_lengthss_increase.c test-type_array-array_lengthss_increase_by.c test-type_array-array_lengthss_resize.c +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-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.c +build_script no +build_shared yes +build_static no + +path_headers tests/c +path_headers_preserve no +path_sources tests/c +path_standard no + +search_exclusive yes +search_shared yes +search_static yes + +defines -Ibuild/includes +defines_static -Lbuild/libraries/static +defines_shared -Lbuild/libraries/shared + +flags -O2 -z now -g -fdiagnostics-color=always -Wno-logical-not-parentheses -Wno-logical-op-parentheses -Wno-parentheses +flags_program -fPIE +flags_program_shared +flags_program_static +flags_shared +flags_static diff --git a/level_0/f_type_array/data/build/testfile b/level_0/f_type_array/data/build/testfile new file mode 100644 index 0000000..11ea717 --- /dev/null +++ b/level_0/f_type_array/data/build/testfile @@ -0,0 +1,27 @@ +# fss-0005 iki-0002 + +settings: + load_build yes + fail exit + + environment LD_LIBRARY_PATH + +main: + build settings + build settings-tests + + if exists build/programs/shared/test-f_type_array + shell build/programs/shared/test-f_type_array + + if exists build/programs/static/test-f_type_array + run build/programs/static/test-f_type_array + + if not exists build/programs/shared/test-f_type_array + and not exists build/programs/static/test-f_type_array + operate not_created + +not_created: + print + print Faled to test due to being unable to find either a shared or static test binary to perform tests. + + exit failure diff --git a/level_0/f_type_array/tests/c/test-type_array-array_lengths_adjust.c b/level_0/f_type_array/tests/c/test-type_array-array_lengths_adjust.c new file mode 100644 index 0000000..2e24ad6 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-array_lengths_adjust.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-array_lengths_adjust.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_array_lengths_adjust__works(void **state) { + + const int length = 5; + f_array_lengths_t data = f_array_lengths_t_initialize; + + { + const f_status_t status = f_type_array_lengths_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_array_lengths_adjust__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_array_lengths_t data = f_array_lengths_t_initialize; + + { + const f_status_t status = f_type_array_lengths_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/c/test-type_array-array_lengths_adjust.h b/level_0/f_type_array/tests/c/test-type_array-array_lengths_adjust.h new file mode 100644 index 0000000..431fa82 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-array_lengths_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__array_lengths_adjust +#define _TEST__F_type_array__array_lengths_adjust + +/** + * Test that the function works. + * + * @see f_type_array_array_lengths_adjust() + */ +extern void test__f_type_array_array_lengths_adjust__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_array_lengths_adjust() + */ +extern void test__f_type_array_array_lengths_adjust__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__array_lengths_adjust diff --git a/level_0/f_type_array/tests/c/test-type_array-array_lengths_append.c b/level_0/f_type_array/tests/c/test-type_array-array_lengths_append.c new file mode 100644 index 0000000..e64448b --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-array_lengths_append.c @@ -0,0 +1,87 @@ +#include "test-type_array.h" +#include "test-type_array-array_lengths_append.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_array_lengths_append__works(void **state) { + + const int length = 5; + const int length_used = 2; + f_array_lengths_t source = f_array_lengths_t_initialize; + f_array_lengths_t destination = f_array_lengths_t_initialize; + + { + const f_status_t status = f_type_array_lengths_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_type_array_lengths_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_array_lengths_append__returns_data_not(void **state) { + + const int length = 5; + f_array_lengths_t source = f_array_lengths_t_initialize; + f_array_lengths_t destination = f_array_lengths_t_initialize; + + { + const f_status_t status = f_type_array_lengths_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_type_array_lengths_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_array_lengths_append__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_array_lengths_t data = f_array_lengths_t_initialize; + + { + const f_status_t status = f_type_array_lengths_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/c/test-type_array-array_lengths_append.h b/level_0/f_type_array/tests/c/test-type_array-array_lengths_append.h new file mode 100644 index 0000000..366669e --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-array_lengths_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__array_lengths_append +#define _TEST__F_type_array__array_lengths_append + +/** + * Test that the function works. + * + * @see f_type_array_array_lengths_append() + */ +extern void test__f_type_array_array_lengths_append__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_array_lengths_append() + */ +extern void test__f_type_array_array_lengths_append__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_array_lengths_append() + */ +extern void test__f_type_array_array_lengths_append__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__array_lengths_append diff --git a/level_0/f_type_array/tests/c/test-type_array-array_lengths_decimate_by.c b/level_0/f_type_array/tests/c/test-type_array-array_lengths_decimate_by.c new file mode 100644 index 0000000..943628d --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-array_lengths_decimate_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-array_lengths_decimate_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_array_lengths_decimate_by__works(void **state) { + + const int length = 5; + f_array_lengths_t data = f_array_lengths_t_initialize; + + { + const f_status_t status = f_type_array_lengths_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_type_array_lengths_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_array_lengths_decimate_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_array_lengths_t data = f_array_lengths_t_initialize; + + { + const f_status_t status = f_type_array_lengths_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/c/test-type_array-array_lengths_decimate_by.h b/level_0/f_type_array/tests/c/test-type_array-array_lengths_decimate_by.h new file mode 100644 index 0000000..ae95997 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-array_lengths_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__array_lengths_decimate_by +#define _TEST__F_type_array__array_lengths_decimate_by + +/** + * Test that the function works. + * + * @see f_type_array_array_lengths_decimate_by() + */ +extern void test__f_type_array_array_lengths_decimate_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_array_lengths_decimate_by() + */ +extern void test__f_type_array_array_lengths_decimate_by__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__array_lengths_decimate_by diff --git a/level_0/f_type_array/tests/c/test-type_array-array_lengths_decrease_by.c b/level_0/f_type_array/tests/c/test-type_array-array_lengths_decrease_by.c new file mode 100644 index 0000000..6f38eab --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-array_lengths_decrease_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-array_lengths_decrease_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_array_lengths_decrease_by__works(void **state) { + + const int length = 5; + f_array_lengths_t data = f_array_lengths_t_initialize; + + { + const f_status_t status = f_type_array_lengths_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_type_array_lengths_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_array_lengths_decrease_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_array_lengths_t data = f_array_lengths_t_initialize; + + { + const f_status_t status = f_type_array_lengths_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/c/test-type_array-array_lengths_decrease_by.h b/level_0/f_type_array/tests/c/test-type_array-array_lengths_decrease_by.h new file mode 100644 index 0000000..3197742 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-array_lengths_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__array_lengths_decrease_by +#define _TEST__F_type_array__array_lengths_decrease_by + +/** + * Test that the function works. + * + * @see f_type_array_array_lengths_decrease_by() + */ +extern void test__f_type_array_array_lengths_decrease_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_array_lengths_decrease_by() + */ +extern void test__f_type_array_array_lengths_decrease_by__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__array_lengths_decrease_by diff --git a/level_0/f_type_array/tests/c/test-type_array-array_lengths_increase.c b/level_0/f_type_array/tests/c/test-type_array-array_lengths_increase.c new file mode 100644 index 0000000..56d7e99 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-array_lengths_increase.c @@ -0,0 +1,76 @@ +#include "test-type_array.h" +#include "test-type_array-array_lengths_increase.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_array_lengths_increase__works(void **state) { + + const int length = 5; + f_array_lengths_t data = f_array_lengths_t_initialize; + + { + const f_status_t status = f_type_array_lengths_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_type_array_lengths_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_array_lengths_increase__returns_data_not(void **state) { + + const int length = 5; + f_array_lengths_t data = f_array_lengths_t_initialize; + + { + const f_status_t status = f_type_array_lengths_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_type_array_lengths_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_array_lengths_increase__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_array_lengths_t data = f_array_lengths_t_initialize; + + { + const f_status_t status = f_type_array_lengths_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/c/test-type_array-array_lengths_increase.h b/level_0/f_type_array/tests/c/test-type_array-array_lengths_increase.h new file mode 100644 index 0000000..9e5d4c1 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-array_lengths_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__array_lengths_increase +#define _TEST__F_type_array__array_lengths_increase + +/** + * Test that the function works. + * + * @see f_type_array_array_lengths_increase() + */ +extern void test__f_type_array_array_lengths_increase__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_array_lengths_increase() + */ +extern void test__f_type_array_array_lengths_increase__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_array_lengths_increase() + */ +extern void test__f_type_array_array_lengths_increase__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__array_lengths_increase diff --git a/level_0/f_type_array/tests/c/test-type_array-array_lengths_increase_by.c b/level_0/f_type_array/tests/c/test-type_array-array_lengths_increase_by.c new file mode 100644 index 0000000..b0e6ec1 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-array_lengths_increase_by.c @@ -0,0 +1,52 @@ +#include "test-type_array.h" +#include "test-type_array-array_lengths_increase_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_array_lengths_increase_by__works(void **state) { + + const int length = 5; + f_array_lengths_t data = f_array_lengths_t_initialize; + + { + const f_status_t status = f_type_array_lengths_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_type_array_lengths_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_array_lengths_increase_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_array_lengths_t data = f_array_lengths_t_initialize; + + { + const f_status_t status = f_type_array_lengths_increase_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/c/test-type_array-array_lengths_increase_by.h b/level_0/f_type_array/tests/c/test-type_array-array_lengths_increase_by.h new file mode 100644 index 0000000..99cfc30 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-array_lengths_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__array_lengths_increase_by +#define _TEST__F_type_array__array_lengths_increase_by + +/** + * Test that the function works. + * + * @see f_type_array_array_lengths_increase_by() + */ +extern void test__f_type_array_array_lengths_increase_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_array_lengths_increase_by() + */ +extern void test__f_type_array_array_lengths_increase_by__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__array_lengths_increase_by diff --git a/level_0/f_type_array/tests/c/test-type_array-array_lengths_resize.c b/level_0/f_type_array/tests/c/test-type_array-array_lengths_resize.c new file mode 100644 index 0000000..dcdf799 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-array_lengths_resize.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-array_lengths_resize.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_array_lengths_resize__works(void **state) { + + const int length = 5; + f_array_lengths_t data = f_array_lengths_t_initialize; + + { + const f_status_t status = f_type_array_lengths_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_array_lengths_resize__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_array_lengths_t data = f_array_lengths_t_initialize; + + { + const f_status_t status = f_type_array_lengths_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/c/test-type_array-array_lengths_resize.h b/level_0/f_type_array/tests/c/test-type_array-array_lengths_resize.h new file mode 100644 index 0000000..297f223 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-array_lengths_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__array_lengths_resize +#define _TEST__F_type_array__array_lengths_resize + +/** + * Test that the function works. + * + * @see f_type_array_array_lengths_resize() + */ +extern void test__f_type_array_array_lengths_resize__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_array_lengths_resize() + */ +extern void test__f_type_array_array_lengths_resize__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__array_lengths_resize diff --git a/level_0/f_type_array/tests/c/test-type_array-array_lengthss_adjust.c b/level_0/f_type_array/tests/c/test-type_array-array_lengthss_adjust.c new file mode 100644 index 0000000..e806c1c --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-array_lengthss_adjust.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-array_lengthss_adjust.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_array_lengthss_adjust__works(void **state) { + + const int length = 5; + f_array_lengthss_t data = f_array_lengthss_t_initialize; + + { + const f_status_t status = f_type_array_lengthss_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_array_lengthss_adjust__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_array_lengthss_t data = f_array_lengthss_t_initialize; + + { + const f_status_t status = f_type_array_lengthss_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/c/test-type_array-array_lengthss_adjust.h b/level_0/f_type_array/tests/c/test-type_array-array_lengthss_adjust.h new file mode 100644 index 0000000..c75c5ae --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-array_lengthss_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__array_lengthss_adjust +#define _TEST__F_type_array__array_lengthss_adjust + +/** + * Test that the function works. + * + * @see f_type_array_array_lengthss_adjust() + */ +extern void test__f_type_array_array_lengthss_adjust__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_array_lengthss_adjust() + */ +extern void test__f_type_array_array_lengthss_adjust__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__array_lengthss_adjust diff --git a/level_0/f_type_array/tests/c/test-type_array-array_lengthss_append.c b/level_0/f_type_array/tests/c/test-type_array-array_lengthss_append.c new file mode 100644 index 0000000..012a173 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-array_lengthss_append.c @@ -0,0 +1,110 @@ +#include "test-type_array.h" +#include "test-type_array-array_lengthss_append.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_array_lengthss_append__works(void **state) { + + const int length = 5; + const int length_inner = 2; + f_array_lengthss_t source = f_array_lengths_t_initialize; + f_array_lengthss_t destination = f_array_lengths_t_initialize; + + { + const f_status_t status = f_type_array_lengthss_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_type_array_lengths_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_type_array_lengthss_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_array_lengthss_append__returns_data_not(void **state) { + + const int length = 5; + f_array_lengthss_t source = f_array_lengths_t_initialize; + f_array_lengthss_t destination = f_array_lengths_t_initialize; + + { + const f_status_t status = f_type_array_lengthss_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + { + const f_status_t status = f_type_array_lengthss_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_array_lengthss_append__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_array_lengthss_t data = f_array_lengths_t_initialize; + + { + const f_status_t status = f_type_array_lengthss_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/c/test-type_array-array_lengthss_append.h b/level_0/f_type_array/tests/c/test-type_array-array_lengthss_append.h new file mode 100644 index 0000000..451b2e0 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-array_lengthss_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__array_lengthss_append +#define _TEST__F_type_array__array_lengthss_append + +/** + * Test that the function works. + * + * @see f_type_array_array_lengthss_append() + */ +extern void test__f_type_array_array_lengthss_append__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_array_lengthss_append() + */ +extern void test__f_type_array_array_lengthss_append__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_array_lengthss_append() + */ +extern void test__f_type_array_array_lengthss_append__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__array_lengthss_append diff --git a/level_0/f_type_array/tests/c/test-type_array-array_lengthss_decimate_by.c b/level_0/f_type_array/tests/c/test-type_array-array_lengthss_decimate_by.c new file mode 100644 index 0000000..6033e39 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-array_lengthss_decimate_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-array_lengthss_decimate_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_array_lengthss_decimate_by__works(void **state) { + + const int length = 5; + f_array_lengthss_t data = f_array_lengths_t_initialize; + + { + const f_status_t status = f_type_array_lengthss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_type_array_lengthss_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_array_lengthss_decimate_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_array_lengthss_t data = f_array_lengths_t_initialize; + + { + const f_status_t status = f_type_array_lengthss_decimate_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/c/test-type_array-array_lengthss_decimate_by.h b/level_0/f_type_array/tests/c/test-type_array-array_lengthss_decimate_by.h new file mode 100644 index 0000000..f1ca465 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-array_lengthss_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__array_lengthss_decimate_by +#define _TEST__F_type_array__array_lengthss_decimate_by + +/** + * Test that the function works. + * + * @see f_type_array_array_lengthss_decimate_by() + */ +extern void test__f_type_array_array_lengthss_decimate_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_array_lengthss_decimate_by() + */ +extern void test__f_type_array_array_lengthss_decimate_by__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__array_lengthss_decimate_by diff --git a/level_0/f_type_array/tests/c/test-type_array-array_lengthss_decrease_by.c b/level_0/f_type_array/tests/c/test-type_array-array_lengthss_decrease_by.c new file mode 100644 index 0000000..5ecacda --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-array_lengthss_decrease_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-array_lengthss_decrease_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_array_lengthss_decrease_by__works(void **state) { + + const int length = 5; + f_array_lengthss_t data = f_array_lengths_t_initialize; + + { + const f_status_t status = f_type_array_lengthss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_type_array_lengthss_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_array_lengthss_decrease_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_array_lengthss_t data = f_array_lengths_t_initialize; + + { + const f_status_t status = f_type_array_lengthss_decrease_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/c/test-type_array-array_lengthss_decrease_by.h b/level_0/f_type_array/tests/c/test-type_array-array_lengthss_decrease_by.h new file mode 100644 index 0000000..02b5980 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-array_lengthss_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__array_lengthss_decrease_by +#define _TEST__F_type_array__array_lengthss_decrease_by + +/** + * Test that the function works. + * + * @see f_type_array_array_lengthss_decrease_by() + */ +extern void test__f_type_array_array_lengthss_decrease_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_array_lengthss_decrease_by() + */ +extern void test__f_type_array_array_lengthss_decrease_by__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__array_lengthss_decrease_by diff --git a/level_0/f_type_array/tests/c/test-type_array-array_lengthss_increase.c b/level_0/f_type_array/tests/c/test-type_array-array_lengthss_increase.c new file mode 100644 index 0000000..57b944e --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-array_lengthss_increase.c @@ -0,0 +1,76 @@ +#include "test-type_array.h" +#include "test-type_array-array_lengthss_increase.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_array_lengthss_increase__works(void **state) { + + const int length = 5; + f_array_lengthss_t data = f_array_lengths_t_initialize; + + { + const f_status_t status = f_type_array_lengthss_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_type_array_lengthss_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_array_lengthss_increase__returns_data_not(void **state) { + + const int length = 5; + f_array_lengthss_t data = f_array_lengths_t_initialize; + + { + const f_status_t status = f_type_array_lengthss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_type_array_lengthss_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_array_lengthss_increase__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_array_lengthss_t data = f_array_lengths_t_initialize; + + { + const f_status_t status = f_type_array_lengthss_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/c/test-type_array-array_lengthss_increase.h b/level_0/f_type_array/tests/c/test-type_array-array_lengthss_increase.h new file mode 100644 index 0000000..88a71cb --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-array_lengthss_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__array_lengthss_increase +#define _TEST__F_type_array__array_lengthss_increase + +/** + * Test that the function works. + * + * @see f_type_array_array_lengthss_increase() + */ +extern void test__f_type_array_array_lengthss_increase__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_array_lengthss_increase() + */ +extern void test__f_type_array_array_lengthss_increase__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_array_lengthss_increase() + */ +extern void test__f_type_array_array_lengthss_increase__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__array_lengthss_increase diff --git a/level_0/f_type_array/tests/c/test-type_array-array_lengthss_increase_by.c b/level_0/f_type_array/tests/c/test-type_array-array_lengthss_increase_by.c new file mode 100644 index 0000000..45d1c8a --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-array_lengthss_increase_by.c @@ -0,0 +1,52 @@ +#include "test-type_array.h" +#include "test-type_array-array_lengthss_increase_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_array_lengthss_increase_by__works(void **state) { + + const int length = 5; + f_array_lengthss_t data = f_array_lengths_t_initialize; + + { + const f_status_t status = f_type_array_lengthss_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_type_array_lengthss_increase_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); +} + +void test__f_type_array_array_lengthss_increase_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_array_lengthss_t data = f_array_lengths_t_initialize; + + { + const f_status_t status = f_type_array_lengthss_increase_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/c/test-type_array-array_lengthss_increase_by.h b/level_0/f_type_array/tests/c/test-type_array-array_lengthss_increase_by.h new file mode 100644 index 0000000..05eb526 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-array_lengthss_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__array_lengthss_increase_by +#define _TEST__F_type_array__array_lengthss_increase_by + +/** + * Test that the function works. + * + * @see f_type_array_array_lengthss_increase_by() + */ +extern void test__f_type_array_array_lengthss_increase_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_array_lengthss_increase_by() + */ +extern void test__f_type_array_array_lengthss_increase_by__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__array_lengthss_increase_by diff --git a/level_0/f_type_array/tests/c/test-type_array-array_lengthss_resize.c b/level_0/f_type_array/tests/c/test-type_array-array_lengthss_resize.c new file mode 100644 index 0000000..7346c5e --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-array_lengthss_resize.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-array_lengthss_resize.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_array_lengthss_resize__works(void **state) { + + const int length = 5; + f_array_lengthss_t data = f_array_lengthss_t_initialize; + + { + const f_status_t status = f_type_array_lengthss_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_array_lengthss_resize__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_array_lengthss_t data = f_array_lengthss_t_initialize; + + { + const f_status_t status = f_type_array_lengthss_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/c/test-type_array-array_lengthss_resize.h b/level_0/f_type_array/tests/c/test-type_array-array_lengthss_resize.h new file mode 100644 index 0000000..a8fd772 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-array_lengthss_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__array_lengthss_resize +#define _TEST__F_type_array__array_lengthss_resize + +/** + * Test that the function works. + * + * @see f_type_array_array_lengthss_resize() + */ +extern void test__f_type_array_array_lengthss_resize__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_array_lengthss_resize() + */ +extern void test__f_type_array_array_lengthss_resize__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__array_lengthss_resize diff --git a/level_0/f_type_array/tests/c/test-type_array-cells_adjust.c b/level_0/f_type_array/tests/c/test-type_array-cells_adjust.c new file mode 100644 index 0000000..9202e42 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-cells_adjust.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-cells_adjust.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_cells_adjust__works(void **state) { + + const int length = 5; + f_cells_t data = f_cells_t_initialize; + + { + const f_status_t status = f_type_cells_adjust(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_cells_adjust__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_cells_t data = f_cells_t_initialize; + + { + const f_status_t status = f_type_cells_adjust(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/c/test-type_array-cells_adjust.h b/level_0/f_type_array/tests/c/test-type_array-cells_adjust.h new file mode 100644 index 0000000..49443d3 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-cells_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__cells_adjust +#define _TEST__F_type_array__cells_adjust + +/** + * Test that the function works. + * + * @see f_type_array_cells_adjust() + */ +extern void test__f_type_array_cells_adjust__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_cells_adjust() + */ +extern void test__f_type_array_cells_adjust__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__cells_adjust diff --git a/level_0/f_type_array/tests/c/test-type_array-cells_append.c b/level_0/f_type_array/tests/c/test-type_array-cells_append.c new file mode 100644 index 0000000..d8155b9 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-cells_append.c @@ -0,0 +1,90 @@ +#include "test-type_array.h" +#include "test-type_array-cells_append.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_cells_append__works(void **state) { + + const int length = 5; + f_cells_t source = f_cells_t_initialize; + f_cells_t destination = f_cells_t_initialize; + + const f_cell_t cell_0 = { row: 1, column: 2 }; + const f_cell_t cell_1 = { row: 3, column: 4 }; + + { + const f_status_t status = f_type_cells_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + memcpy(&source.array[source.used++], (void *) &cell_0, sizeof(f_cell_t)); + memcpy(&source.array[source.used++], (void *) &cell_1, sizeof(f_cell_t)); + + { + const f_status_t status = f_type_cells_append(source, &destination); + + assert_int_equal(status, F_none); + assert_int_equal(destination.used, source.used); + assert_int_equal(destination.size, source.used); + + assert_int_equal(destination.array[0].row, cell_0.row); + assert_int_equal(destination.array[0].column, cell_0.column); + + assert_int_equal(destination.array[1].row, cell_1.row); + assert_int_equal(destination.array[1].column, cell_1.column); + } + + free((void *) source.array); + free((void *) destination.array); +} + +void test__f_type_array_cells_append__returns_data_not(void **state) { + + const int length = 5; + f_cells_t source = f_cells_t_initialize; + f_cells_t destination = f_cells_t_initialize; + + { + const f_status_t status = f_type_cells_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + { + const f_status_t status = f_type_cells_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_cells_append__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_cells_t data = f_cells_t_initialize; + + { + const f_status_t status = f_type_cells_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/c/test-type_array-cells_append.h b/level_0/f_type_array/tests/c/test-type_array-cells_append.h new file mode 100644 index 0000000..e514584 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-cells_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__cells_append +#define _TEST__F_type_array__cells_append + +/** + * Test that the function works. + * + * @see f_type_array_cells_append() + */ +extern void test__f_type_array_cells_append__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_cells_append() + */ +extern void test__f_type_array_cells_append__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_cells_append() + */ +extern void test__f_type_array_cells_append__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__cells_append diff --git a/level_0/f_type_array/tests/c/test-type_array-cells_decimate_by.c b/level_0/f_type_array/tests/c/test-type_array-cells_decimate_by.c new file mode 100644 index 0000000..5a19814 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-cells_decimate_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-cells_decimate_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_cells_decimate_by__works(void **state) { + + const int length = 5; + f_cells_t data = f_cells_t_initialize; + + { + const f_status_t status = f_type_cells_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_type_cells_decimate_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_cells_decimate_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_cells_t data = f_cells_t_initialize; + + { + const f_status_t status = f_type_cells_decimate_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/c/test-type_array-cells_decimate_by.h b/level_0/f_type_array/tests/c/test-type_array-cells_decimate_by.h new file mode 100644 index 0000000..0d3fcbc --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-cells_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__cells_decimate_by +#define _TEST__F_type_array__cells_decimate_by + +/** + * Test that the function works. + * + * @see f_type_array_cells_decimate_by() + */ +extern void test__f_type_array_cells_decimate_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_cells_decimate_by() + */ +extern void test__f_type_array_cells_decimate_by__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__cells_decimate_by diff --git a/level_0/f_type_array/tests/c/test-type_array-cells_decrease_by.c b/level_0/f_type_array/tests/c/test-type_array-cells_decrease_by.c new file mode 100644 index 0000000..4117992 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-cells_decrease_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-cells_decrease_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_cells_decrease_by__works(void **state) { + + const int length = 5; + f_cells_t data = f_cells_t_initialize; + + { + const f_status_t status = f_type_cells_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_type_cells_decrease_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_cells_decrease_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_cells_t data = f_cells_t_initialize; + + { + const f_status_t status = f_type_cells_decrease_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/c/test-type_array-cells_decrease_by.h b/level_0/f_type_array/tests/c/test-type_array-cells_decrease_by.h new file mode 100644 index 0000000..abb091e --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-cells_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__cells_decrease_by +#define _TEST__F_type_array__cells_decrease_by + +/** + * Test that the function works. + * + * @see f_type_array_cells_decrease_by() + */ +extern void test__f_type_array_cells_decrease_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_cells_decrease_by() + */ +extern void test__f_type_array_cells_decrease_by__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__cells_decrease_by diff --git a/level_0/f_type_array/tests/c/test-type_array-cells_increase.c b/level_0/f_type_array/tests/c/test-type_array-cells_increase.c new file mode 100644 index 0000000..806dde0 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-cells_increase.c @@ -0,0 +1,76 @@ +#include "test-type_array.h" +#include "test-type_array-cells_increase.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_cells_increase__works(void **state) { + + const int length = 5; + f_cells_t data = f_cells_t_initialize; + + { + const f_status_t status = f_type_cells_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_type_cells_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_cells_increase__returns_data_not(void **state) { + + const int length = 5; + f_cells_t data = f_cells_t_initialize; + + { + const f_status_t status = f_type_cells_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_type_cells_increase(length, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_cells_increase__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_cells_t data = f_cells_t_initialize; + + { + const f_status_t status = f_type_cells_increase(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + free((void *) data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/c/test-type_array-cells_increase.h b/level_0/f_type_array/tests/c/test-type_array-cells_increase.h new file mode 100644 index 0000000..cf7d408 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-cells_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__cells_increase +#define _TEST__F_type_array__cells_increase + +/** + * Test that the function works. + * + * @see f_type_array_cells_increase() + */ +extern void test__f_type_array_cells_increase__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_cells_increase() + */ +extern void test__f_type_array_cells_increase__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_cells_increase() + */ +extern void test__f_type_array_cells_increase__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__cells_increase diff --git a/level_0/f_type_array/tests/c/test-type_array-cells_increase_by.c b/level_0/f_type_array/tests/c/test-type_array-cells_increase_by.c new file mode 100644 index 0000000..a5abfab --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-cells_increase_by.c @@ -0,0 +1,52 @@ +#include "test-type_array.h" +#include "test-type_array-cells_increase_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_cells_increase_by__works(void **state) { + + const int length = 5; + f_cells_t data = f_cells_t_initialize; + + { + const f_status_t status = f_type_cells_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_type_cells_increase_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); +} + +void test__f_type_array_cells_increase_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_cells_t data = f_cells_t_initialize; + + { + const f_status_t status = f_type_cells_increase_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/c/test-type_array-cells_increase_by.h b/level_0/f_type_array/tests/c/test-type_array-cells_increase_by.h new file mode 100644 index 0000000..b55f081 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-cells_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__cells_increase_by +#define _TEST__F_type_array__cells_increase_by + +/** + * Test that the function works. + * + * @see f_type_array_cells_increase_by() + */ +extern void test__f_type_array_cells_increase_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_cells_increase_by() + */ +extern void test__f_type_array_cells_increase_by__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__cells_increase_by diff --git a/level_0/f_type_array/tests/c/test-type_array-cells_resize.c b/level_0/f_type_array/tests/c/test-type_array-cells_resize.c new file mode 100644 index 0000000..dccdd82 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-cells_resize.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-cells_resize.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_cells_resize__works(void **state) { + + const int length = 5; + f_cells_t data = f_cells_t_initialize; + + { + const f_status_t status = f_type_cells_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_cells_resize__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_cells_t data = f_cells_t_initialize; + + { + const f_status_t status = f_type_cells_resize(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/c/test-type_array-cells_resize.h b/level_0/f_type_array/tests/c/test-type_array-cells_resize.h new file mode 100644 index 0000000..f263e6b --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-cells_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__cells_resize +#define _TEST__F_type_array__cells_resize + +/** + * Test that the function works. + * + * @see f_type_array_cells_resize() + */ +extern void test__f_type_array_cells_resize__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_cells_resize() + */ +extern void test__f_type_array_cells_resize__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__cells_resize diff --git a/level_0/f_type_array/tests/c/test-type_array-cellss_adjust.c b/level_0/f_type_array/tests/c/test-type_array-cellss_adjust.c new file mode 100644 index 0000000..840dbd7 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-cellss_adjust.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-cellss_adjust.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_cellss_adjust__works(void **state) { + + const int length = 5; + f_cellss_t data = f_cellss_t_initialize; + + { + const f_status_t status = f_type_cellss_adjust(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_cellss_adjust__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_cellss_t data = f_cellss_t_initialize; + + { + const f_status_t status = f_type_cellss_adjust(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/c/test-type_array-cellss_adjust.h b/level_0/f_type_array/tests/c/test-type_array-cellss_adjust.h new file mode 100644 index 0000000..1111bdc --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-cellss_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__cellss_adjust +#define _TEST__F_type_array__cellss_adjust + +/** + * Test that the function works. + * + * @see f_type_array_cellss_adjust() + */ +extern void test__f_type_array_cellss_adjust__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_cellss_adjust() + */ +extern void test__f_type_array_cellss_adjust__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__cellss_adjust diff --git a/level_0/f_type_array/tests/c/test-type_array-cellss_append.c b/level_0/f_type_array/tests/c/test-type_array-cellss_append.c new file mode 100644 index 0000000..97aacc3 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-cellss_append.c @@ -0,0 +1,114 @@ +#include "test-type_array.h" +#include "test-type_array-cellss_append.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_cellss_append__works(void **state) { + + const int length = 5; + const int length_inner = 2; + f_cellss_t source = f_cells_t_initialize; + f_cellss_t destination = f_cells_t_initialize; + + const f_cell_t cell_0 = { row: 1, column: 2 }; + const f_cell_t cell_1 = { row: 3, column: 4 }; + + { + const f_status_t status = f_type_cellss_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + { + for (; source.used < length; ++source.used) { + + const f_status_t status = f_type_cells_resize(length_inner, &source.array[source.used]); + + assert_int_equal(status, F_none); + + memcpy(&source.array[source.used].array[source.array[source.used].used++], (void *) &cell_0, sizeof(f_cell_t)); + memcpy(&source.array[source.used].array[source.array[source.used].used++], (void *) &cell_1, sizeof(f_cell_t)); + } // for + } + + { + const f_status_t status = f_type_cellss_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); + + assert_int_equal(destination.array[i].array[0].row, cell_0.row); + assert_int_equal(destination.array[i].array[0].column, cell_0.column); + + assert_int_equal(destination.array[i].array[1].row, cell_1.row); + assert_int_equal(destination.array[i].array[1].column, cell_1.column); + } // for + } + + for (f_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_cellss_append__returns_data_not(void **state) { + + const int length = 5; + f_cellss_t source = f_cells_t_initialize; + f_cellss_t destination = f_cells_t_initialize; + + { + const f_status_t status = f_type_cellss_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + { + const f_status_t status = f_type_cellss_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_cellss_append__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_cellss_t data = f_cells_t_initialize; + + { + const f_status_t status = f_type_cellss_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/c/test-type_array-cellss_append.h b/level_0/f_type_array/tests/c/test-type_array-cellss_append.h new file mode 100644 index 0000000..74f4c78 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-cellss_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__cellss_append +#define _TEST__F_type_array__cellss_append + +/** + * Test that the function works. + * + * @see f_type_array_cellss_append() + */ +extern void test__f_type_array_cellss_append__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_cellss_append() + */ +extern void test__f_type_array_cellss_append__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_cellss_append() + */ +extern void test__f_type_array_cellss_append__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__cellss_append diff --git a/level_0/f_type_array/tests/c/test-type_array-cellss_decimate_by.c b/level_0/f_type_array/tests/c/test-type_array-cellss_decimate_by.c new file mode 100644 index 0000000..ded28e4 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-cellss_decimate_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-cellss_decimate_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_cellss_decimate_by__works(void **state) { + + const int length = 5; + f_cellss_t data = f_cells_t_initialize; + + { + const f_status_t status = f_type_cellss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_type_cellss_decimate_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_cellss_decimate_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_cellss_t data = f_cells_t_initialize; + + { + const f_status_t status = f_type_cellss_decimate_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/c/test-type_array-cellss_decimate_by.h b/level_0/f_type_array/tests/c/test-type_array-cellss_decimate_by.h new file mode 100644 index 0000000..93509ee --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-cellss_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__cellss_decimate_by +#define _TEST__F_type_array__cellss_decimate_by + +/** + * Test that the function works. + * + * @see f_type_array_cellss_decimate_by() + */ +extern void test__f_type_array_cellss_decimate_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_cellss_decimate_by() + */ +extern void test__f_type_array_cellss_decimate_by__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__cellss_decimate_by diff --git a/level_0/f_type_array/tests/c/test-type_array-cellss_decrease_by.c b/level_0/f_type_array/tests/c/test-type_array-cellss_decrease_by.c new file mode 100644 index 0000000..3d2c626 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-cellss_decrease_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-cellss_decrease_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_cellss_decrease_by__works(void **state) { + + const int length = 5; + f_cellss_t data = f_cells_t_initialize; + + { + const f_status_t status = f_type_cellss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_type_cellss_decrease_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_cellss_decrease_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_cellss_t data = f_cells_t_initialize; + + { + const f_status_t status = f_type_cellss_decrease_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/c/test-type_array-cellss_decrease_by.h b/level_0/f_type_array/tests/c/test-type_array-cellss_decrease_by.h new file mode 100644 index 0000000..b3cdd0a --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-cellss_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__cellss_decrease_by +#define _TEST__F_type_array__cellss_decrease_by + +/** + * Test that the function works. + * + * @see f_type_array_cellss_decrease_by() + */ +extern void test__f_type_array_cellss_decrease_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_cellss_decrease_by() + */ +extern void test__f_type_array_cellss_decrease_by__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__cellss_decrease_by diff --git a/level_0/f_type_array/tests/c/test-type_array-cellss_increase.c b/level_0/f_type_array/tests/c/test-type_array-cellss_increase.c new file mode 100644 index 0000000..8018519 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-cellss_increase.c @@ -0,0 +1,76 @@ +#include "test-type_array.h" +#include "test-type_array-cellss_increase.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_cellss_increase__works(void **state) { + + const int length = 5; + f_cellss_t data = f_cells_t_initialize; + + { + const f_status_t status = f_type_cellss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_type_cellss_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_cellss_increase__returns_data_not(void **state) { + + const int length = 5; + f_cellss_t data = f_cells_t_initialize; + + { + const f_status_t status = f_type_cellss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_type_cellss_increase(length, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_cellss_increase__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_cellss_t data = f_cells_t_initialize; + + { + const f_status_t status = f_type_cellss_increase(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + free((void *) data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/c/test-type_array-cellss_increase.h b/level_0/f_type_array/tests/c/test-type_array-cellss_increase.h new file mode 100644 index 0000000..e5ce06b --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-cellss_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__cellss_increase +#define _TEST__F_type_array__cellss_increase + +/** + * Test that the function works. + * + * @see f_type_array_cellss_increase() + */ +extern void test__f_type_array_cellss_increase__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_cellss_increase() + */ +extern void test__f_type_array_cellss_increase__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_cellss_increase() + */ +extern void test__f_type_array_cellss_increase__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__cellss_increase diff --git a/level_0/f_type_array/tests/c/test-type_array-cellss_increase_by.c b/level_0/f_type_array/tests/c/test-type_array-cellss_increase_by.c new file mode 100644 index 0000000..897f0c6 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-cellss_increase_by.c @@ -0,0 +1,52 @@ +#include "test-type_array.h" +#include "test-type_array-cellss_increase_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_cellss_increase_by__works(void **state) { + + const int length = 5; + f_cellss_t data = f_cells_t_initialize; + + { + const f_status_t status = f_type_cellss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_type_cellss_increase_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); +} + +void test__f_type_array_cellss_increase_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_cellss_t data = f_cells_t_initialize; + + { + const f_status_t status = f_type_cellss_increase_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/c/test-type_array-cellss_increase_by.h b/level_0/f_type_array/tests/c/test-type_array-cellss_increase_by.h new file mode 100644 index 0000000..16267cf --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-cellss_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__cellss_increase_by +#define _TEST__F_type_array__cellss_increase_by + +/** + * Test that the function works. + * + * @see f_type_array_cellss_increase_by() + */ +extern void test__f_type_array_cellss_increase_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_cellss_increase_by() + */ +extern void test__f_type_array_cellss_increase_by__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__cellss_increase_by diff --git a/level_0/f_type_array/tests/c/test-type_array-cellss_resize.c b/level_0/f_type_array/tests/c/test-type_array-cellss_resize.c new file mode 100644 index 0000000..6aa0bf8 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-cellss_resize.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-cellss_resize.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_cellss_resize__works(void **state) { + + const int length = 5; + f_cellss_t data = f_cellss_t_initialize; + + { + const f_status_t status = f_type_cellss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_cellss_resize__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_cellss_t data = f_cellss_t_initialize; + + { + const f_status_t status = f_type_cellss_resize(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/c/test-type_array-cellss_resize.h b/level_0/f_type_array/tests/c/test-type_array-cellss_resize.h new file mode 100644 index 0000000..03c7df1 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-cellss_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__cellss_resize +#define _TEST__F_type_array__cellss_resize + +/** + * Test that the function works. + * + * @see f_type_array_cellss_resize() + */ +extern void test__f_type_array_cellss_resize__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_cellss_resize() + */ +extern void test__f_type_array_cellss_resize__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__cellss_resize diff --git a/level_0/f_type_array/tests/c/test-type_array-fll_ids_adjust.c b/level_0/f_type_array/tests/c/test-type_array-fll_ids_adjust.c new file mode 100644 index 0000000..ba3d8e0 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-fll_ids_adjust.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-fll_ids_adjust.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_fll_ids_adjust__works(void **state) { + + const int length = 5; + f_fll_ids_t data = f_fll_ids_t_initialize; + + { + const f_status_t status = f_type_fll_ids_adjust(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_fll_ids_adjust__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_fll_ids_t data = f_fll_ids_t_initialize; + + { + const f_status_t status = f_type_fll_ids_adjust(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/c/test-type_array-fll_ids_adjust.h b/level_0/f_type_array/tests/c/test-type_array-fll_ids_adjust.h new file mode 100644 index 0000000..d63264d --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-fll_ids_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__fll_ids_adjust +#define _TEST__F_type_array__fll_ids_adjust + +/** + * Test that the function works. + * + * @see f_type_array_fll_ids_adjust() + */ +extern void test__f_type_array_fll_ids_adjust__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_fll_ids_adjust() + */ +extern void test__f_type_array_fll_ids_adjust__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__fll_ids_adjust diff --git a/level_0/f_type_array/tests/c/test-type_array-fll_ids_append.c b/level_0/f_type_array/tests/c/test-type_array-fll_ids_append.c new file mode 100644 index 0000000..90b06bc --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-fll_ids_append.c @@ -0,0 +1,92 @@ +#include "test-type_array.h" +#include "test-type_array-fll_ids_append.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_fll_ids_append__works(void **state) { + + const int length = 5; + f_fll_ids_t source = f_fll_ids_t_initialize; + f_fll_ids_t destination = f_fll_ids_t_initialize; + + const f_fll_id_t fll_id_0 = { name: "test", type: 1, used: 4 }; + const f_fll_id_t fll_id_1 = { name: "other", type: 2, used: 5 }; + + { + const f_status_t status = f_type_fll_ids_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + memcpy(&source.array[source.used++], (void *) &fll_id_0, sizeof(f_fll_id_t)); + memcpy(&source.array[source.used++], (void *) &fll_id_1, sizeof(f_fll_id_t)); + + { + const f_status_t status = f_type_fll_ids_append(source, &destination); + + assert_int_equal(status, F_none); + assert_int_equal(destination.used, source.used); + assert_int_equal(destination.size, source.used); + + assert_string_equal(destination.array[0].name, fll_id_0.name); + assert_int_equal(destination.array[0].type, fll_id_0.type); + assert_int_equal(destination.array[0].used, fll_id_0.used); + + assert_string_equal(destination.array[1].name, fll_id_1.name); + assert_int_equal(destination.array[1].type, fll_id_1.type); + assert_int_equal(destination.array[1].used, fll_id_1.used); + } + + free((void *) source.array); + free((void *) destination.array); +} + +void test__f_type_array_fll_ids_append__returns_data_not(void **state) { + + const int length = 5; + f_fll_ids_t source = f_fll_ids_t_initialize; + f_fll_ids_t destination = f_fll_ids_t_initialize; + + { + const f_status_t status = f_type_fll_ids_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + { + const f_status_t status = f_type_fll_ids_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_fll_ids_append__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_fll_ids_t data = f_fll_ids_t_initialize; + + { + const f_status_t status = f_type_fll_ids_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/c/test-type_array-fll_ids_append.h b/level_0/f_type_array/tests/c/test-type_array-fll_ids_append.h new file mode 100644 index 0000000..3b051fd --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-fll_ids_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__fll_ids_append +#define _TEST__F_type_array__fll_ids_append + +/** + * Test that the function works. + * + * @see f_type_array_fll_ids_append() + */ +extern void test__f_type_array_fll_ids_append__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_fll_ids_append() + */ +extern void test__f_type_array_fll_ids_append__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_fll_ids_append() + */ +extern void test__f_type_array_fll_ids_append__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__fll_ids_append diff --git a/level_0/f_type_array/tests/c/test-type_array-fll_ids_decimate_by.c b/level_0/f_type_array/tests/c/test-type_array-fll_ids_decimate_by.c new file mode 100644 index 0000000..3efedb4 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-fll_ids_decimate_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-fll_ids_decimate_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_fll_ids_decimate_by__works(void **state) { + + const int length = 5; + f_fll_ids_t data = f_fll_ids_t_initialize; + + { + const f_status_t status = f_type_fll_ids_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_type_fll_ids_decimate_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_fll_ids_decimate_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_fll_ids_t data = f_fll_ids_t_initialize; + + { + const f_status_t status = f_type_fll_ids_decimate_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/c/test-type_array-fll_ids_decimate_by.h b/level_0/f_type_array/tests/c/test-type_array-fll_ids_decimate_by.h new file mode 100644 index 0000000..36a0149 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-fll_ids_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__fll_ids_decimate_by +#define _TEST__F_type_array__fll_ids_decimate_by + +/** + * Test that the function works. + * + * @see f_type_array_fll_ids_decimate_by() + */ +extern void test__f_type_array_fll_ids_decimate_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_fll_ids_decimate_by() + */ +extern void test__f_type_array_fll_ids_decimate_by__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__fll_ids_decimate_by diff --git a/level_0/f_type_array/tests/c/test-type_array-fll_ids_decrease_by.c b/level_0/f_type_array/tests/c/test-type_array-fll_ids_decrease_by.c new file mode 100644 index 0000000..bf484d1 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-fll_ids_decrease_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-fll_ids_decrease_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_fll_ids_decrease_by__works(void **state) { + + const int length = 5; + f_fll_ids_t data = f_fll_ids_t_initialize; + + { + const f_status_t status = f_type_fll_ids_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_type_fll_ids_decrease_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_fll_ids_decrease_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_fll_ids_t data = f_fll_ids_t_initialize; + + { + const f_status_t status = f_type_fll_ids_decrease_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/c/test-type_array-fll_ids_decrease_by.h b/level_0/f_type_array/tests/c/test-type_array-fll_ids_decrease_by.h new file mode 100644 index 0000000..8d47fe0 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-fll_ids_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__fll_ids_decrease_by +#define _TEST__F_type_array__fll_ids_decrease_by + +/** + * Test that the function works. + * + * @see f_type_array_fll_ids_decrease_by() + */ +extern void test__f_type_array_fll_ids_decrease_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_fll_ids_decrease_by() + */ +extern void test__f_type_array_fll_ids_decrease_by__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__fll_ids_decrease_by diff --git a/level_0/f_type_array/tests/c/test-type_array-fll_ids_increase.c b/level_0/f_type_array/tests/c/test-type_array-fll_ids_increase.c new file mode 100644 index 0000000..0058686 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-fll_ids_increase.c @@ -0,0 +1,76 @@ +#include "test-type_array.h" +#include "test-type_array-fll_ids_increase.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_fll_ids_increase__works(void **state) { + + const int length = 5; + f_fll_ids_t data = f_fll_ids_t_initialize; + + { + const f_status_t status = f_type_fll_ids_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_type_fll_ids_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_fll_ids_increase__returns_data_not(void **state) { + + const int length = 5; + f_fll_ids_t data = f_fll_ids_t_initialize; + + { + const f_status_t status = f_type_fll_ids_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_type_fll_ids_increase(length, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_fll_ids_increase__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_fll_ids_t data = f_fll_ids_t_initialize; + + { + const f_status_t status = f_type_fll_ids_increase(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + free((void *) data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/c/test-type_array-fll_ids_increase.h b/level_0/f_type_array/tests/c/test-type_array-fll_ids_increase.h new file mode 100644 index 0000000..313b6d6 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-fll_ids_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__fll_ids_increase +#define _TEST__F_type_array__fll_ids_increase + +/** + * Test that the function works. + * + * @see f_type_array_fll_ids_increase() + */ +extern void test__f_type_array_fll_ids_increase__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_fll_ids_increase() + */ +extern void test__f_type_array_fll_ids_increase__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_fll_ids_increase() + */ +extern void test__f_type_array_fll_ids_increase__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__fll_ids_increase diff --git a/level_0/f_type_array/tests/c/test-type_array-fll_ids_increase_by.c b/level_0/f_type_array/tests/c/test-type_array-fll_ids_increase_by.c new file mode 100644 index 0000000..e78e351 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-fll_ids_increase_by.c @@ -0,0 +1,52 @@ +#include "test-type_array.h" +#include "test-type_array-fll_ids_increase_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_fll_ids_increase_by__works(void **state) { + + const int length = 5; + f_fll_ids_t data = f_fll_ids_t_initialize; + + { + const f_status_t status = f_type_fll_ids_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_type_fll_ids_increase_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); +} + +void test__f_type_array_fll_ids_increase_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_fll_ids_t data = f_fll_ids_t_initialize; + + { + const f_status_t status = f_type_fll_ids_increase_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/c/test-type_array-fll_ids_increase_by.h b/level_0/f_type_array/tests/c/test-type_array-fll_ids_increase_by.h new file mode 100644 index 0000000..5a98667 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-fll_ids_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__fll_ids_increase_by +#define _TEST__F_type_array__fll_ids_increase_by + +/** + * Test that the function works. + * + * @see f_type_array_fll_ids_increase_by() + */ +extern void test__f_type_array_fll_ids_increase_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_fll_ids_increase_by() + */ +extern void test__f_type_array_fll_ids_increase_by__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__fll_ids_increase_by diff --git a/level_0/f_type_array/tests/c/test-type_array-fll_ids_resize.c b/level_0/f_type_array/tests/c/test-type_array-fll_ids_resize.c new file mode 100644 index 0000000..73e15be --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-fll_ids_resize.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-fll_ids_resize.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_fll_ids_resize__works(void **state) { + + const int length = 5; + f_fll_ids_t data = f_fll_ids_t_initialize; + + { + const f_status_t status = f_type_fll_ids_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_fll_ids_resize__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_fll_ids_t data = f_fll_ids_t_initialize; + + { + const f_status_t status = f_type_fll_ids_resize(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/c/test-type_array-fll_ids_resize.h b/level_0/f_type_array/tests/c/test-type_array-fll_ids_resize.h new file mode 100644 index 0000000..7f034bb --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-fll_ids_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__fll_ids_resize +#define _TEST__F_type_array__fll_ids_resize + +/** + * Test that the function works. + * + * @see f_type_array_fll_ids_resize() + */ +extern void test__f_type_array_fll_ids_resize__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_fll_ids_resize() + */ +extern void test__f_type_array_fll_ids_resize__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__fll_ids_resize diff --git a/level_0/f_type_array/tests/c/test-type_array-fll_idss_adjust.c b/level_0/f_type_array/tests/c/test-type_array-fll_idss_adjust.c new file mode 100644 index 0000000..4cffd3b --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-fll_idss_adjust.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-fll_idss_adjust.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_fll_idss_adjust__works(void **state) { + + const int length = 5; + f_fll_idss_t data = f_fll_idss_t_initialize; + + { + const f_status_t status = f_type_fll_idss_adjust(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_fll_idss_adjust__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_fll_idss_t data = f_fll_idss_t_initialize; + + { + const f_status_t status = f_type_fll_idss_adjust(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/c/test-type_array-fll_idss_adjust.h b/level_0/f_type_array/tests/c/test-type_array-fll_idss_adjust.h new file mode 100644 index 0000000..98f5d37 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-fll_idss_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__fll_idss_adjust +#define _TEST__F_type_array__fll_idss_adjust + +/** + * Test that the function works. + * + * @see f_type_array_fll_idss_adjust() + */ +extern void test__f_type_array_fll_idss_adjust__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_fll_idss_adjust() + */ +extern void test__f_type_array_fll_idss_adjust__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__fll_idss_adjust diff --git a/level_0/f_type_array/tests/c/test-type_array-fll_idss_append.c b/level_0/f_type_array/tests/c/test-type_array-fll_idss_append.c new file mode 100644 index 0000000..a78e885 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-fll_idss_append.c @@ -0,0 +1,116 @@ +#include "test-type_array.h" +#include "test-type_array-fll_idss_append.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_fll_idss_append__works(void **state) { + + const int length = 5; + const int length_inner = 2; + f_fll_idss_t source = f_fll_ids_t_initialize; + f_fll_idss_t destination = f_fll_ids_t_initialize; + + const f_fll_id_t fll_id_0 = { name: "test", type: 1, used: 4 }; + const f_fll_id_t fll_id_1 = { name: "other", type: 2, used: 5 }; + + { + const f_status_t status = f_type_fll_idss_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + { + for (; source.used < length; ++source.used) { + + const f_status_t status = f_type_fll_ids_resize(length_inner, &source.array[source.used]); + + assert_int_equal(status, F_none); + + memcpy(&source.array[source.used].array[source.array[source.used].used++], (void *) &fll_id_0, sizeof(f_fll_id_t)); + memcpy(&source.array[source.used].array[source.array[source.used].used++], (void *) &fll_id_1, sizeof(f_fll_id_t)); + } // for + } + + { + const f_status_t status = f_type_fll_idss_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); + + assert_string_equal(destination.array[i].array[0].name, fll_id_0.name); + assert_int_equal(destination.array[i].array[0].type, fll_id_0.type); + assert_int_equal(destination.array[i].array[0].used, fll_id_0.used); + + assert_string_equal(destination.array[i].array[1].name, fll_id_1.name); + assert_int_equal(destination.array[i].array[1].type, fll_id_1.type); + assert_int_equal(destination.array[i].array[1].used, fll_id_1.used); + } // for + } + + for (f_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_fll_idss_append__returns_data_not(void **state) { + + const int length = 5; + f_fll_idss_t source = f_fll_ids_t_initialize; + f_fll_idss_t destination = f_fll_ids_t_initialize; + + { + const f_status_t status = f_type_fll_idss_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + { + const f_status_t status = f_type_fll_idss_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_fll_idss_append__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_fll_idss_t data = f_fll_ids_t_initialize; + + { + const f_status_t status = f_type_fll_idss_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/c/test-type_array-fll_idss_append.h b/level_0/f_type_array/tests/c/test-type_array-fll_idss_append.h new file mode 100644 index 0000000..43a851e --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-fll_idss_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__fll_idss_append +#define _TEST__F_type_array__fll_idss_append + +/** + * Test that the function works. + * + * @see f_type_array_fll_idss_append() + */ +extern void test__f_type_array_fll_idss_append__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_fll_idss_append() + */ +extern void test__f_type_array_fll_idss_append__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_fll_idss_append() + */ +extern void test__f_type_array_fll_idss_append__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__fll_idss_append diff --git a/level_0/f_type_array/tests/c/test-type_array-fll_idss_decimate_by.c b/level_0/f_type_array/tests/c/test-type_array-fll_idss_decimate_by.c new file mode 100644 index 0000000..75ecc98 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-fll_idss_decimate_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-fll_idss_decimate_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_fll_idss_decimate_by__works(void **state) { + + const int length = 5; + f_fll_idss_t data = f_fll_ids_t_initialize; + + { + const f_status_t status = f_type_fll_idss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_type_fll_idss_decimate_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_fll_idss_decimate_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_fll_idss_t data = f_fll_ids_t_initialize; + + { + const f_status_t status = f_type_fll_idss_decimate_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/c/test-type_array-fll_idss_decimate_by.h b/level_0/f_type_array/tests/c/test-type_array-fll_idss_decimate_by.h new file mode 100644 index 0000000..30f011e --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-fll_idss_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__fll_idss_decimate_by +#define _TEST__F_type_array__fll_idss_decimate_by + +/** + * Test that the function works. + * + * @see f_type_array_fll_idss_decimate_by() + */ +extern void test__f_type_array_fll_idss_decimate_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_fll_idss_decimate_by() + */ +extern void test__f_type_array_fll_idss_decimate_by__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__fll_idss_decimate_by diff --git a/level_0/f_type_array/tests/c/test-type_array-fll_idss_decrease_by.c b/level_0/f_type_array/tests/c/test-type_array-fll_idss_decrease_by.c new file mode 100644 index 0000000..e382d2d --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-fll_idss_decrease_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-fll_idss_decrease_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_fll_idss_decrease_by__works(void **state) { + + const int length = 5; + f_fll_idss_t data = f_fll_ids_t_initialize; + + { + const f_status_t status = f_type_fll_idss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_type_fll_idss_decrease_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_fll_idss_decrease_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_fll_idss_t data = f_fll_ids_t_initialize; + + { + const f_status_t status = f_type_fll_idss_decrease_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/c/test-type_array-fll_idss_decrease_by.h b/level_0/f_type_array/tests/c/test-type_array-fll_idss_decrease_by.h new file mode 100644 index 0000000..21fa831 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-fll_idss_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__fll_idss_decrease_by +#define _TEST__F_type_array__fll_idss_decrease_by + +/** + * Test that the function works. + * + * @see f_type_array_fll_idss_decrease_by() + */ +extern void test__f_type_array_fll_idss_decrease_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_fll_idss_decrease_by() + */ +extern void test__f_type_array_fll_idss_decrease_by__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__fll_idss_decrease_by diff --git a/level_0/f_type_array/tests/c/test-type_array-fll_idss_increase.c b/level_0/f_type_array/tests/c/test-type_array-fll_idss_increase.c new file mode 100644 index 0000000..d16f586 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-fll_idss_increase.c @@ -0,0 +1,76 @@ +#include "test-type_array.h" +#include "test-type_array-fll_idss_increase.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_fll_idss_increase__works(void **state) { + + const int length = 5; + f_fll_idss_t data = f_fll_ids_t_initialize; + + { + const f_status_t status = f_type_fll_idss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_type_fll_idss_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_fll_idss_increase__returns_data_not(void **state) { + + const int length = 5; + f_fll_idss_t data = f_fll_ids_t_initialize; + + { + const f_status_t status = f_type_fll_idss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_type_fll_idss_increase(length, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_fll_idss_increase__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_fll_idss_t data = f_fll_ids_t_initialize; + + { + const f_status_t status = f_type_fll_idss_increase(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + free((void *) data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/c/test-type_array-fll_idss_increase.h b/level_0/f_type_array/tests/c/test-type_array-fll_idss_increase.h new file mode 100644 index 0000000..5a9773a --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-fll_idss_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__fll_idss_increase +#define _TEST__F_type_array__fll_idss_increase + +/** + * Test that the function works. + * + * @see f_type_array_fll_idss_increase() + */ +extern void test__f_type_array_fll_idss_increase__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_fll_idss_increase() + */ +extern void test__f_type_array_fll_idss_increase__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_fll_idss_increase() + */ +extern void test__f_type_array_fll_idss_increase__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__fll_idss_increase diff --git a/level_0/f_type_array/tests/c/test-type_array-fll_idss_increase_by.c b/level_0/f_type_array/tests/c/test-type_array-fll_idss_increase_by.c new file mode 100644 index 0000000..8c671dc --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-fll_idss_increase_by.c @@ -0,0 +1,52 @@ +#include "test-type_array.h" +#include "test-type_array-fll_idss_increase_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_fll_idss_increase_by__works(void **state) { + + const int length = 5; + f_fll_idss_t data = f_fll_ids_t_initialize; + + { + const f_status_t status = f_type_fll_idss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_type_fll_idss_increase_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); +} + +void test__f_type_array_fll_idss_increase_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_fll_idss_t data = f_fll_ids_t_initialize; + + { + const f_status_t status = f_type_fll_idss_increase_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/c/test-type_array-fll_idss_increase_by.h b/level_0/f_type_array/tests/c/test-type_array-fll_idss_increase_by.h new file mode 100644 index 0000000..0636d44 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-fll_idss_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__fll_idss_increase_by +#define _TEST__F_type_array__fll_idss_increase_by + +/** + * Test that the function works. + * + * @see f_type_array_fll_idss_increase_by() + */ +extern void test__f_type_array_fll_idss_increase_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_fll_idss_increase_by() + */ +extern void test__f_type_array_fll_idss_increase_by__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__fll_idss_increase_by diff --git a/level_0/f_type_array/tests/c/test-type_array-fll_idss_resize.c b/level_0/f_type_array/tests/c/test-type_array-fll_idss_resize.c new file mode 100644 index 0000000..6db6835 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-fll_idss_resize.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-fll_idss_resize.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_fll_idss_resize__works(void **state) { + + const int length = 5; + f_fll_idss_t data = f_fll_idss_t_initialize; + + { + const f_status_t status = f_type_fll_idss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_fll_idss_resize__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_fll_idss_t data = f_fll_idss_t_initialize; + + { + const f_status_t status = f_type_fll_idss_resize(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/c/test-type_array-fll_idss_resize.h b/level_0/f_type_array/tests/c/test-type_array-fll_idss_resize.h new file mode 100644 index 0000000..9d8db27 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-fll_idss_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__fll_idss_resize +#define _TEST__F_type_array__fll_idss_resize + +/** + * Test that the function works. + * + * @see f_type_array_fll_idss_resize() + */ +extern void test__f_type_array_fll_idss_resize__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_fll_idss_resize() + */ +extern void test__f_type_array_fll_idss_resize__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__fll_idss_resize diff --git a/level_0/f_type_array/tests/c/test-type_array-states_adjust.c b/level_0/f_type_array/tests/c/test-type_array-states_adjust.c new file mode 100644 index 0000000..84e533b --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-states_adjust.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-states_adjust.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_states_adjust__works(void **state) { + + const int length = 5; + f_states_t data = f_states_t_initialize; + + { + const f_status_t status = f_type_states_adjust(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_states_adjust__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_states_t data = f_states_t_initialize; + + { + const f_status_t status = f_type_states_adjust(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/c/test-type_array-states_adjust.h b/level_0/f_type_array/tests/c/test-type_array-states_adjust.h new file mode 100644 index 0000000..ef92edc --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-states_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__states_adjust +#define _TEST__F_type_array__states_adjust + +/** + * Test that the function works. + * + * @see f_type_array_states_adjust() + */ +extern void test__f_type_array_states_adjust__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_states_adjust() + */ +extern void test__f_type_array_states_adjust__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__states_adjust diff --git a/level_0/f_type_array/tests/c/test-type_array-states_append.c b/level_0/f_type_array/tests/c/test-type_array-states_append.c new file mode 100644 index 0000000..ddd375d --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-states_append.c @@ -0,0 +1,100 @@ +#include "test-type_array.h" +#include "test-type_array-states_append.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_states_append__works(void **state) { + + const int length = 5; + f_states_t source = f_states_t_initialize; + f_states_t destination = f_states_t_initialize; + + const f_state_t state_0 = { step_large: 10, step_small: 1, handle: 0, interrupt: 0, callbacks: 0, custom: 0, data: 0 }; + const f_state_t state_1 = { step_large: 20, step_small: 2, handle: 0, interrupt: 0, callbacks: 0, custom: 0, data: 0 }; + + { + const f_status_t status = f_type_states_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + memcpy(&source.array[source.used++], (void *) &state_0, sizeof(f_state_t)); + memcpy(&source.array[source.used++], (void *) &state_1, sizeof(f_state_t)); + + { + const f_status_t status = f_type_states_append(source, &destination); + + assert_int_equal(status, F_none); + assert_int_equal(destination.used, source.used); + assert_int_equal(destination.size, source.used); + + assert_int_equal(destination.array[0].step_large, state_0.step_large); + assert_int_equal(destination.array[0].step_small, state_0.step_small); + assert_null(destination.array[0].handle); + assert_null(destination.array[0].interrupt); + assert_null(destination.array[0].callbacks); + assert_null(destination.array[0].custom); + assert_null(destination.array[0].data); + + assert_int_equal(destination.array[1].step_large, state_1.step_large); + assert_int_equal(destination.array[1].step_small, state_1.step_small); + assert_null(destination.array[1].handle); + assert_null(destination.array[1].interrupt); + assert_null(destination.array[1].callbacks); + assert_null(destination.array[1].custom); + assert_null(destination.array[1].data); + } + + free((void *) source.array); + free((void *) destination.array); +} + +void test__f_type_array_states_append__returns_data_not(void **state) { + + const int length = 5; + f_states_t source = f_states_t_initialize; + f_states_t destination = f_states_t_initialize; + + { + const f_status_t status = f_type_states_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + { + const f_status_t status = f_type_states_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_states_append__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_states_t data = f_states_t_initialize; + + { + const f_status_t status = f_type_states_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/c/test-type_array-states_append.h b/level_0/f_type_array/tests/c/test-type_array-states_append.h new file mode 100644 index 0000000..7afc0e0 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-states_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__states_append +#define _TEST__F_type_array__states_append + +/** + * Test that the function works. + * + * @see f_type_array_states_append() + */ +extern void test__f_type_array_states_append__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_states_append() + */ +extern void test__f_type_array_states_append__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_states_append() + */ +extern void test__f_type_array_states_append__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__states_append diff --git a/level_0/f_type_array/tests/c/test-type_array-states_decimate_by.c b/level_0/f_type_array/tests/c/test-type_array-states_decimate_by.c new file mode 100644 index 0000000..026c954 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-states_decimate_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-states_decimate_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_states_decimate_by__works(void **state) { + + const int length = 5; + f_states_t data = f_states_t_initialize; + + { + const f_status_t status = f_type_states_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_type_states_decimate_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_states_decimate_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_states_t data = f_states_t_initialize; + + { + const f_status_t status = f_type_states_decimate_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/c/test-type_array-states_decimate_by.h b/level_0/f_type_array/tests/c/test-type_array-states_decimate_by.h new file mode 100644 index 0000000..4b397ba --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-states_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__states_decimate_by +#define _TEST__F_type_array__states_decimate_by + +/** + * Test that the function works. + * + * @see f_type_array_states_decimate_by() + */ +extern void test__f_type_array_states_decimate_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_states_decimate_by() + */ +extern void test__f_type_array_states_decimate_by__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__states_decimate_by diff --git a/level_0/f_type_array/tests/c/test-type_array-states_decrease_by.c b/level_0/f_type_array/tests/c/test-type_array-states_decrease_by.c new file mode 100644 index 0000000..218c8c6 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-states_decrease_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-states_decrease_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_states_decrease_by__works(void **state) { + + const int length = 5; + f_states_t data = f_states_t_initialize; + + { + const f_status_t status = f_type_states_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_type_states_decrease_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_states_decrease_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_states_t data = f_states_t_initialize; + + { + const f_status_t status = f_type_states_decrease_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/c/test-type_array-states_decrease_by.h b/level_0/f_type_array/tests/c/test-type_array-states_decrease_by.h new file mode 100644 index 0000000..04cf75b --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-states_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__states_decrease_by +#define _TEST__F_type_array__states_decrease_by + +/** + * Test that the function works. + * + * @see f_type_array_states_decrease_by() + */ +extern void test__f_type_array_states_decrease_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_states_decrease_by() + */ +extern void test__f_type_array_states_decrease_by__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__states_decrease_by diff --git a/level_0/f_type_array/tests/c/test-type_array-states_increase.c b/level_0/f_type_array/tests/c/test-type_array-states_increase.c new file mode 100644 index 0000000..857f47e --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-states_increase.c @@ -0,0 +1,76 @@ +#include "test-type_array.h" +#include "test-type_array-states_increase.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_states_increase__works(void **state) { + + const int length = 5; + f_states_t data = f_states_t_initialize; + + { + const f_status_t status = f_type_states_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_type_states_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_states_increase__returns_data_not(void **state) { + + const int length = 5; + f_states_t data = f_states_t_initialize; + + { + const f_status_t status = f_type_states_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_type_states_increase(length, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_states_increase__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_states_t data = f_states_t_initialize; + + { + const f_status_t status = f_type_states_increase(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + free((void *) data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/c/test-type_array-states_increase.h b/level_0/f_type_array/tests/c/test-type_array-states_increase.h new file mode 100644 index 0000000..a653df2 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-states_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__states_increase +#define _TEST__F_type_array__states_increase + +/** + * Test that the function works. + * + * @see f_type_array_states_increase() + */ +extern void test__f_type_array_states_increase__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_states_increase() + */ +extern void test__f_type_array_states_increase__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_states_increase() + */ +extern void test__f_type_array_states_increase__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__states_increase diff --git a/level_0/f_type_array/tests/c/test-type_array-states_increase_by.c b/level_0/f_type_array/tests/c/test-type_array-states_increase_by.c new file mode 100644 index 0000000..711944e --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-states_increase_by.c @@ -0,0 +1,52 @@ +#include "test-type_array.h" +#include "test-type_array-states_increase_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_states_increase_by__works(void **state) { + + const int length = 5; + f_states_t data = f_states_t_initialize; + + { + const f_status_t status = f_type_states_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_type_states_increase_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); +} + +void test__f_type_array_states_increase_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_states_t data = f_states_t_initialize; + + { + const f_status_t status = f_type_states_increase_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/c/test-type_array-states_increase_by.h b/level_0/f_type_array/tests/c/test-type_array-states_increase_by.h new file mode 100644 index 0000000..34a8cb0 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-states_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__states_increase_by +#define _TEST__F_type_array__states_increase_by + +/** + * Test that the function works. + * + * @see f_type_array_states_increase_by() + */ +extern void test__f_type_array_states_increase_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_states_increase_by() + */ +extern void test__f_type_array_states_increase_by__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__states_increase_by diff --git a/level_0/f_type_array/tests/c/test-type_array-states_resize.c b/level_0/f_type_array/tests/c/test-type_array-states_resize.c new file mode 100644 index 0000000..1366ba4 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-states_resize.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-states_resize.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_states_resize__works(void **state) { + + const int length = 5; + f_states_t data = f_states_t_initialize; + + { + const f_status_t status = f_type_states_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_states_resize__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_states_t data = f_states_t_initialize; + + { + const f_status_t status = f_type_states_resize(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/c/test-type_array-states_resize.h b/level_0/f_type_array/tests/c/test-type_array-states_resize.h new file mode 100644 index 0000000..9b8e35b --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-states_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__states_resize +#define _TEST__F_type_array__states_resize + +/** + * Test that the function works. + * + * @see f_type_array_states_resize() + */ +extern void test__f_type_array_states_resize__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_states_resize() + */ +extern void test__f_type_array_states_resize__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__states_resize diff --git a/level_0/f_type_array/tests/c/test-type_array-statess_adjust.c b/level_0/f_type_array/tests/c/test-type_array-statess_adjust.c new file mode 100644 index 0000000..ceb323d --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-statess_adjust.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-statess_adjust.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_statess_adjust__works(void **state) { + + const int length = 5; + f_statess_t data = f_statess_t_initialize; + + { + const f_status_t status = f_type_statess_adjust(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_statess_adjust__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_statess_t data = f_statess_t_initialize; + + { + const f_status_t status = f_type_statess_adjust(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/c/test-type_array-statess_adjust.h b/level_0/f_type_array/tests/c/test-type_array-statess_adjust.h new file mode 100644 index 0000000..6537c77 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-statess_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__statess_adjust +#define _TEST__F_type_array__statess_adjust + +/** + * Test that the function works. + * + * @see f_type_array_statess_adjust() + */ +extern void test__f_type_array_statess_adjust__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_statess_adjust() + */ +extern void test__f_type_array_statess_adjust__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__statess_adjust diff --git a/level_0/f_type_array/tests/c/test-type_array-statess_append.c b/level_0/f_type_array/tests/c/test-type_array-statess_append.c new file mode 100644 index 0000000..216dc0f --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-statess_append.c @@ -0,0 +1,124 @@ +#include "test-type_array.h" +#include "test-type_array-statess_append.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_statess_append__works(void **state) { + + const int length = 5; + const int length_inner = 2; + f_statess_t source = f_states_t_initialize; + f_statess_t destination = f_states_t_initialize; + + const f_state_t state_0 = { step_large: 10, step_small: 1, handle: 0, interrupt: 0, callbacks: 0, custom: 0, data: 0 }; + const f_state_t state_1 = { step_large: 20, step_small: 2, handle: 0, interrupt: 0, callbacks: 0, custom: 0, data: 0 }; + + { + const f_status_t status = f_type_statess_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + { + for (; source.used < length; ++source.used) { + + const f_status_t status = f_type_states_resize(length_inner, &source.array[source.used]); + + assert_int_equal(status, F_none); + + memcpy(&source.array[source.used].array[source.array[source.used].used++], (void *) &state_0, sizeof(f_state_t)); + memcpy(&source.array[source.used].array[source.array[source.used].used++], (void *) &state_1, sizeof(f_state_t)); + } // for + } + + { + const f_status_t status = f_type_statess_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); + + assert_int_equal(destination.array[i].array[0].step_large, state_0.step_large); + assert_int_equal(destination.array[i].array[0].step_small, state_0.step_small); + assert_null(destination.array[i].array[0].handle); + assert_null(destination.array[i].array[0].interrupt); + assert_null(destination.array[i].array[0].callbacks); + assert_null(destination.array[i].array[0].custom); + assert_null(destination.array[i].array[0].data); + + assert_int_equal(destination.array[i].array[1].step_large, state_1.step_large); + assert_int_equal(destination.array[i].array[1].step_small, state_1.step_small); + assert_null(destination.array[i].array[1].handle); + assert_null(destination.array[i].array[1].interrupt); + assert_null(destination.array[i].array[1].callbacks); + assert_null(destination.array[i].array[1].custom); + assert_null(destination.array[i].array[1].data); + } // for + } + + for (f_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_statess_append__returns_data_not(void **state) { + + const int length = 5; + f_statess_t source = f_states_t_initialize; + f_statess_t destination = f_states_t_initialize; + + { + const f_status_t status = f_type_statess_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + { + const f_status_t status = f_type_statess_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_statess_append__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_statess_t data = f_states_t_initialize; + + { + const f_status_t status = f_type_statess_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/c/test-type_array-statess_append.h b/level_0/f_type_array/tests/c/test-type_array-statess_append.h new file mode 100644 index 0000000..7aca8b8 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-statess_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__statess_append +#define _TEST__F_type_array__statess_append + +/** + * Test that the function works. + * + * @see f_type_array_statess_append() + */ +extern void test__f_type_array_statess_append__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_statess_append() + */ +extern void test__f_type_array_statess_append__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_statess_append() + */ +extern void test__f_type_array_statess_append__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__statess_append diff --git a/level_0/f_type_array/tests/c/test-type_array-statess_decimate_by.c b/level_0/f_type_array/tests/c/test-type_array-statess_decimate_by.c new file mode 100644 index 0000000..3f41a47 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-statess_decimate_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-statess_decimate_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_statess_decimate_by__works(void **state) { + + const int length = 5; + f_statess_t data = f_states_t_initialize; + + { + const f_status_t status = f_type_statess_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_type_statess_decimate_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_statess_decimate_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_statess_t data = f_states_t_initialize; + + { + const f_status_t status = f_type_statess_decimate_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/c/test-type_array-statess_decimate_by.h b/level_0/f_type_array/tests/c/test-type_array-statess_decimate_by.h new file mode 100644 index 0000000..56f8d03 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-statess_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__statess_decimate_by +#define _TEST__F_type_array__statess_decimate_by + +/** + * Test that the function works. + * + * @see f_type_array_statess_decimate_by() + */ +extern void test__f_type_array_statess_decimate_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_statess_decimate_by() + */ +extern void test__f_type_array_statess_decimate_by__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__statess_decimate_by diff --git a/level_0/f_type_array/tests/c/test-type_array-statess_decrease_by.c b/level_0/f_type_array/tests/c/test-type_array-statess_decrease_by.c new file mode 100644 index 0000000..cd39f4e --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-statess_decrease_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-statess_decrease_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_statess_decrease_by__works(void **state) { + + const int length = 5; + f_statess_t data = f_states_t_initialize; + + { + const f_status_t status = f_type_statess_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_type_statess_decrease_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_statess_decrease_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_statess_t data = f_states_t_initialize; + + { + const f_status_t status = f_type_statess_decrease_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/c/test-type_array-statess_decrease_by.h b/level_0/f_type_array/tests/c/test-type_array-statess_decrease_by.h new file mode 100644 index 0000000..6b6d36f --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-statess_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__statess_decrease_by +#define _TEST__F_type_array__statess_decrease_by + +/** + * Test that the function works. + * + * @see f_type_array_statess_decrease_by() + */ +extern void test__f_type_array_statess_decrease_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_statess_decrease_by() + */ +extern void test__f_type_array_statess_decrease_by__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__statess_decrease_by diff --git a/level_0/f_type_array/tests/c/test-type_array-statess_increase.c b/level_0/f_type_array/tests/c/test-type_array-statess_increase.c new file mode 100644 index 0000000..8c674ef --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-statess_increase.c @@ -0,0 +1,76 @@ +#include "test-type_array.h" +#include "test-type_array-statess_increase.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_statess_increase__works(void **state) { + + const int length = 5; + f_statess_t data = f_states_t_initialize; + + { + const f_status_t status = f_type_statess_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_type_statess_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_statess_increase__returns_data_not(void **state) { + + const int length = 5; + f_statess_t data = f_states_t_initialize; + + { + const f_status_t status = f_type_statess_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_type_statess_increase(length, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_statess_increase__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_statess_t data = f_states_t_initialize; + + { + const f_status_t status = f_type_statess_increase(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + free((void *) data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/c/test-type_array-statess_increase.h b/level_0/f_type_array/tests/c/test-type_array-statess_increase.h new file mode 100644 index 0000000..fa39f7e --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-statess_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__statess_increase +#define _TEST__F_type_array__statess_increase + +/** + * Test that the function works. + * + * @see f_type_array_statess_increase() + */ +extern void test__f_type_array_statess_increase__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_statess_increase() + */ +extern void test__f_type_array_statess_increase__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_statess_increase() + */ +extern void test__f_type_array_statess_increase__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__statess_increase diff --git a/level_0/f_type_array/tests/c/test-type_array-statess_increase_by.c b/level_0/f_type_array/tests/c/test-type_array-statess_increase_by.c new file mode 100644 index 0000000..f33af78 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-statess_increase_by.c @@ -0,0 +1,52 @@ +#include "test-type_array.h" +#include "test-type_array-statess_increase_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_statess_increase_by__works(void **state) { + + const int length = 5; + f_statess_t data = f_states_t_initialize; + + { + const f_status_t status = f_type_statess_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_type_statess_increase_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); +} + +void test__f_type_array_statess_increase_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_statess_t data = f_states_t_initialize; + + { + const f_status_t status = f_type_statess_increase_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/c/test-type_array-statess_increase_by.h b/level_0/f_type_array/tests/c/test-type_array-statess_increase_by.h new file mode 100644 index 0000000..fca473b --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-statess_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__statess_increase_by +#define _TEST__F_type_array__statess_increase_by + +/** + * Test that the function works. + * + * @see f_type_array_statess_increase_by() + */ +extern void test__f_type_array_statess_increase_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_statess_increase_by() + */ +extern void test__f_type_array_statess_increase_by__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__statess_increase_by diff --git a/level_0/f_type_array/tests/c/test-type_array-statess_resize.c b/level_0/f_type_array/tests/c/test-type_array-statess_resize.c new file mode 100644 index 0000000..57daa38 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-statess_resize.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-statess_resize.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_statess_resize__works(void **state) { + + const int length = 5; + f_statess_t data = f_statess_t_initialize; + + { + const f_status_t status = f_type_statess_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_statess_resize__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_statess_t data = f_statess_t_initialize; + + { + const f_status_t status = f_type_statess_resize(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/c/test-type_array-statess_resize.h b/level_0/f_type_array/tests/c/test-type_array-statess_resize.h new file mode 100644 index 0000000..5ec1007 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-statess_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__statess_resize +#define _TEST__F_type_array__statess_resize + +/** + * Test that the function works. + * + * @see f_type_array_statess_resize() + */ +extern void test__f_type_array_statess_resize__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_statess_resize() + */ +extern void test__f_type_array_statess_resize__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__statess_resize diff --git a/level_0/f_type_array/tests/c/test-type_array-statuss_adjust.c b/level_0/f_type_array/tests/c/test-type_array-statuss_adjust.c new file mode 100644 index 0000000..f7b6a3a --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-statuss_adjust.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-statuss_adjust.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_statuss_adjust__works(void **state) { + + const int length = 5; + f_statuss_t data = f_statuss_t_initialize; + + { + const f_status_t status = f_type_statuss_adjust(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_statuss_adjust__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_statuss_t data = f_statuss_t_initialize; + + { + const f_status_t status = f_type_statuss_adjust(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/c/test-type_array-statuss_adjust.h b/level_0/f_type_array/tests/c/test-type_array-statuss_adjust.h new file mode 100644 index 0000000..412065f --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-statuss_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__statuss_adjust +#define _TEST__F_type_array__statuss_adjust + +/** + * Test that the function works. + * + * @see f_type_array_statuss_adjust() + */ +extern void test__f_type_array_statuss_adjust__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_statuss_adjust() + */ +extern void test__f_type_array_statuss_adjust__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__statuss_adjust diff --git a/level_0/f_type_array/tests/c/test-type_array-statuss_append.c b/level_0/f_type_array/tests/c/test-type_array-statuss_append.c new file mode 100644 index 0000000..2130d8c --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-statuss_append.c @@ -0,0 +1,87 @@ +#include "test-type_array.h" +#include "test-type_array-statuss_append.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_statuss_append__works(void **state) { + + const int length = 5; + const int length_used = 2; + f_statuss_t source = f_statuss_t_initialize; + f_statuss_t destination = f_statuss_t_initialize; + + { + const f_status_t status = f_type_statuss_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + for (; source.used < length_used; ++source.used) { + source.array[source.used] = source.used + 1; + } // for + + { + const f_status_t status = f_type_statuss_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_statuss_append__returns_data_not(void **state) { + + const int length = 5; + f_statuss_t source = f_statuss_t_initialize; + f_statuss_t destination = f_statuss_t_initialize; + + { + const f_status_t status = f_type_statuss_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + { + const f_status_t status = f_type_statuss_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_statuss_append__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_statuss_t data = f_statuss_t_initialize; + + { + const f_status_t status = f_type_statuss_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/c/test-type_array-statuss_append.h b/level_0/f_type_array/tests/c/test-type_array-statuss_append.h new file mode 100644 index 0000000..e4d1d99 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-statuss_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__statuss_append +#define _TEST__F_type_array__statuss_append + +/** + * Test that the function works. + * + * @see f_type_array_statuss_append() + */ +extern void test__f_type_array_statuss_append__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_statuss_append() + */ +extern void test__f_type_array_statuss_append__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_statuss_append() + */ +extern void test__f_type_array_statuss_append__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__statuss_append diff --git a/level_0/f_type_array/tests/c/test-type_array-statuss_decimate_by.c b/level_0/f_type_array/tests/c/test-type_array-statuss_decimate_by.c new file mode 100644 index 0000000..7aa762b --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-statuss_decimate_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-statuss_decimate_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_statuss_decimate_by__works(void **state) { + + const int length = 5; + f_statuss_t data = f_statuss_t_initialize; + + { + const f_status_t status = f_type_statuss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_type_statuss_decimate_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_statuss_decimate_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_statuss_t data = f_statuss_t_initialize; + + { + const f_status_t status = f_type_statuss_decimate_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/c/test-type_array-statuss_decimate_by.h b/level_0/f_type_array/tests/c/test-type_array-statuss_decimate_by.h new file mode 100644 index 0000000..f6e8bb2 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-statuss_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__statuss_decimate_by +#define _TEST__F_type_array__statuss_decimate_by + +/** + * Test that the function works. + * + * @see f_type_array_statuss_decimate_by() + */ +extern void test__f_type_array_statuss_decimate_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_statuss_decimate_by() + */ +extern void test__f_type_array_statuss_decimate_by__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__statuss_decimate_by diff --git a/level_0/f_type_array/tests/c/test-type_array-statuss_decrease_by.c b/level_0/f_type_array/tests/c/test-type_array-statuss_decrease_by.c new file mode 100644 index 0000000..d8818b3 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-statuss_decrease_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-statuss_decrease_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_statuss_decrease_by__works(void **state) { + + const int length = 5; + f_statuss_t data = f_statuss_t_initialize; + + { + const f_status_t status = f_type_statuss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_type_statuss_decrease_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_statuss_decrease_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_statuss_t data = f_statuss_t_initialize; + + { + const f_status_t status = f_type_statuss_decrease_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/c/test-type_array-statuss_decrease_by.h b/level_0/f_type_array/tests/c/test-type_array-statuss_decrease_by.h new file mode 100644 index 0000000..8b8f43b --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-statuss_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__statuss_decrease_by +#define _TEST__F_type_array__statuss_decrease_by + +/** + * Test that the function works. + * + * @see f_type_array_statuss_decrease_by() + */ +extern void test__f_type_array_statuss_decrease_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_statuss_decrease_by() + */ +extern void test__f_type_array_statuss_decrease_by__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__statuss_decrease_by diff --git a/level_0/f_type_array/tests/c/test-type_array-statuss_increase.c b/level_0/f_type_array/tests/c/test-type_array-statuss_increase.c new file mode 100644 index 0000000..fde1b77 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-statuss_increase.c @@ -0,0 +1,76 @@ +#include "test-type_array.h" +#include "test-type_array-statuss_increase.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_statuss_increase__works(void **state) { + + const int length = 5; + f_statuss_t data = f_statuss_t_initialize; + + { + const f_status_t status = f_type_statuss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_type_statuss_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_statuss_increase__returns_data_not(void **state) { + + const int length = 5; + f_statuss_t data = f_statuss_t_initialize; + + { + const f_status_t status = f_type_statuss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_type_statuss_increase(length, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_statuss_increase__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_statuss_t data = f_statuss_t_initialize; + + { + const f_status_t status = f_type_statuss_increase(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + free((void *) data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/c/test-type_array-statuss_increase.h b/level_0/f_type_array/tests/c/test-type_array-statuss_increase.h new file mode 100644 index 0000000..6c30bf0 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-statuss_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__statuss_increase +#define _TEST__F_type_array__statuss_increase + +/** + * Test that the function works. + * + * @see f_type_array_statuss_increase() + */ +extern void test__f_type_array_statuss_increase__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_statuss_increase() + */ +extern void test__f_type_array_statuss_increase__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_statuss_increase() + */ +extern void test__f_type_array_statuss_increase__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__statuss_increase diff --git a/level_0/f_type_array/tests/c/test-type_array-statuss_increase_by.c b/level_0/f_type_array/tests/c/test-type_array-statuss_increase_by.c new file mode 100644 index 0000000..1ea2da2 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-statuss_increase_by.c @@ -0,0 +1,52 @@ +#include "test-type_array.h" +#include "test-type_array-statuss_increase_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_statuss_increase_by__works(void **state) { + + const int length = 5; + f_statuss_t data = f_statuss_t_initialize; + + { + const f_status_t status = f_type_statuss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_type_statuss_increase_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); +} + +void test__f_type_array_statuss_increase_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_statuss_t data = f_statuss_t_initialize; + + { + const f_status_t status = f_type_statuss_increase_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/c/test-type_array-statuss_increase_by.h b/level_0/f_type_array/tests/c/test-type_array-statuss_increase_by.h new file mode 100644 index 0000000..0f410bf --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-statuss_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__statuss_increase_by +#define _TEST__F_type_array__statuss_increase_by + +/** + * Test that the function works. + * + * @see f_type_array_statuss_increase_by() + */ +extern void test__f_type_array_statuss_increase_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_statuss_increase_by() + */ +extern void test__f_type_array_statuss_increase_by__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__statuss_increase_by diff --git a/level_0/f_type_array/tests/c/test-type_array-statuss_resize.c b/level_0/f_type_array/tests/c/test-type_array-statuss_resize.c new file mode 100644 index 0000000..d290859 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-statuss_resize.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-statuss_resize.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_statuss_resize__works(void **state) { + + const int length = 5; + f_statuss_t data = f_statuss_t_initialize; + + { + const f_status_t status = f_type_statuss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_statuss_resize__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_statuss_t data = f_statuss_t_initialize; + + { + const f_status_t status = f_type_statuss_resize(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/c/test-type_array-statuss_resize.h b/level_0/f_type_array/tests/c/test-type_array-statuss_resize.h new file mode 100644 index 0000000..e4e7ec1 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-statuss_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__statuss_resize +#define _TEST__F_type_array__statuss_resize + +/** + * Test that the function works. + * + * @see f_type_array_statuss_resize() + */ +extern void test__f_type_array_statuss_resize__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_statuss_resize() + */ +extern void test__f_type_array_statuss_resize__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__statuss_resize diff --git a/level_0/f_type_array/tests/c/test-type_array-statusss_adjust.c b/level_0/f_type_array/tests/c/test-type_array-statusss_adjust.c new file mode 100644 index 0000000..e08608e --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-statusss_adjust.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-statusss_adjust.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_statusss_adjust__works(void **state) { + + const int length = 5; + f_statusss_t data = f_statusss_t_initialize; + + { + const f_status_t status = f_type_statusss_adjust(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_statusss_adjust__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_statusss_t data = f_statusss_t_initialize; + + { + const f_status_t status = f_type_statusss_adjust(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/c/test-type_array-statusss_adjust.h b/level_0/f_type_array/tests/c/test-type_array-statusss_adjust.h new file mode 100644 index 0000000..9dfb7ca --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-statusss_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__statusss_adjust +#define _TEST__F_type_array__statusss_adjust + +/** + * Test that the function works. + * + * @see f_type_array_statusss_adjust() + */ +extern void test__f_type_array_statusss_adjust__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_statusss_adjust() + */ +extern void test__f_type_array_statusss_adjust__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__statusss_adjust diff --git a/level_0/f_type_array/tests/c/test-type_array-statusss_append.c b/level_0/f_type_array/tests/c/test-type_array-statusss_append.c new file mode 100644 index 0000000..5e01690 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-statusss_append.c @@ -0,0 +1,110 @@ +#include "test-type_array.h" +#include "test-type_array-statusss_append.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_statusss_append__works(void **state) { + + const int length = 5; + const int length_inner = 2; + f_statusss_t source = f_statuss_t_initialize; + f_statusss_t destination = f_statuss_t_initialize; + + { + const f_status_t status = f_type_statusss_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + { + for (; source.used < length; ++source.used) { + + const f_status_t status = f_type_statuss_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_type_statusss_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_statusss_append__returns_data_not(void **state) { + + const int length = 5; + f_statusss_t source = f_statuss_t_initialize; + f_statusss_t destination = f_statuss_t_initialize; + + { + const f_status_t status = f_type_statusss_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + { + const f_status_t status = f_type_statusss_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_statusss_append__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_statusss_t data = f_statuss_t_initialize; + + { + const f_status_t status = f_type_statusss_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/c/test-type_array-statusss_append.h b/level_0/f_type_array/tests/c/test-type_array-statusss_append.h new file mode 100644 index 0000000..f67a8b5 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-statusss_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__statusss_append +#define _TEST__F_type_array__statusss_append + +/** + * Test that the function works. + * + * @see f_type_array_statusss_append() + */ +extern void test__f_type_array_statusss_append__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_statusss_append() + */ +extern void test__f_type_array_statusss_append__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_statusss_append() + */ +extern void test__f_type_array_statusss_append__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__statusss_append diff --git a/level_0/f_type_array/tests/c/test-type_array-statusss_decimate_by.c b/level_0/f_type_array/tests/c/test-type_array-statusss_decimate_by.c new file mode 100644 index 0000000..9f97b4e --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-statusss_decimate_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-statusss_decimate_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_statusss_decimate_by__works(void **state) { + + const int length = 5; + f_statusss_t data = f_statuss_t_initialize; + + { + const f_status_t status = f_type_statusss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_type_statusss_decimate_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_statusss_decimate_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_statusss_t data = f_statuss_t_initialize; + + { + const f_status_t status = f_type_statusss_decimate_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/c/test-type_array-statusss_decimate_by.h b/level_0/f_type_array/tests/c/test-type_array-statusss_decimate_by.h new file mode 100644 index 0000000..87d1f3c --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-statusss_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__statusss_decimate_by +#define _TEST__F_type_array__statusss_decimate_by + +/** + * Test that the function works. + * + * @see f_type_array_statusss_decimate_by() + */ +extern void test__f_type_array_statusss_decimate_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_statusss_decimate_by() + */ +extern void test__f_type_array_statusss_decimate_by__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__statusss_decimate_by diff --git a/level_0/f_type_array/tests/c/test-type_array-statusss_decrease_by.c b/level_0/f_type_array/tests/c/test-type_array-statusss_decrease_by.c new file mode 100644 index 0000000..8e10ea4 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-statusss_decrease_by.c @@ -0,0 +1,50 @@ +#include "test-type_array.h" +#include "test-type_array-statusss_decrease_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_statusss_decrease_by__works(void **state) { + + const int length = 5; + f_statusss_t data = f_statuss_t_initialize; + + { + const f_status_t status = f_type_statusss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_type_statusss_decrease_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_statusss_decrease_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_statusss_t data = f_statuss_t_initialize; + + { + const f_status_t status = f_type_statusss_decrease_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/c/test-type_array-statusss_decrease_by.h b/level_0/f_type_array/tests/c/test-type_array-statusss_decrease_by.h new file mode 100644 index 0000000..deaa87a --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-statusss_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__statusss_decrease_by +#define _TEST__F_type_array__statusss_decrease_by + +/** + * Test that the function works. + * + * @see f_type_array_statusss_decrease_by() + */ +extern void test__f_type_array_statusss_decrease_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_statusss_decrease_by() + */ +extern void test__f_type_array_statusss_decrease_by__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__statusss_decrease_by diff --git a/level_0/f_type_array/tests/c/test-type_array-statusss_increase.c b/level_0/f_type_array/tests/c/test-type_array-statusss_increase.c new file mode 100644 index 0000000..a90fde6 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-statusss_increase.c @@ -0,0 +1,76 @@ +#include "test-type_array.h" +#include "test-type_array-statusss_increase.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_statusss_increase__works(void **state) { + + const int length = 5; + f_statusss_t data = f_statuss_t_initialize; + + { + const f_status_t status = f_type_statusss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_type_statusss_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_statusss_increase__returns_data_not(void **state) { + + const int length = 5; + f_statusss_t data = f_statuss_t_initialize; + + { + const f_status_t status = f_type_statusss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_type_statusss_increase(length, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_statusss_increase__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_statusss_t data = f_statuss_t_initialize; + + { + const f_status_t status = f_type_statusss_increase(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + free((void *) data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/c/test-type_array-statusss_increase.h b/level_0/f_type_array/tests/c/test-type_array-statusss_increase.h new file mode 100644 index 0000000..faa511e --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-statusss_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__statusss_increase +#define _TEST__F_type_array__statusss_increase + +/** + * Test that the function works. + * + * @see f_type_array_statusss_increase() + */ +extern void test__f_type_array_statusss_increase__works(void **state); + +/** + * Test that the function returns F_data_not when asked to copy an empty structure. + * + * @see f_type_array_statusss_increase() + */ +extern void test__f_type_array_statusss_increase__returns_data_not(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_statusss_increase() + */ +extern void test__f_type_array_statusss_increase__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__statusss_increase diff --git a/level_0/f_type_array/tests/c/test-type_array-statusss_increase_by.c b/level_0/f_type_array/tests/c/test-type_array-statusss_increase_by.c new file mode 100644 index 0000000..83ef55d --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-statusss_increase_by.c @@ -0,0 +1,52 @@ +#include "test-type_array.h" +#include "test-type_array-statusss_increase_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_statusss_increase_by__works(void **state) { + + const int length = 5; + f_statusss_t data = f_statuss_t_initialize; + + { + const f_status_t status = f_type_statusss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_type_statusss_increase_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); +} + +void test__f_type_array_statusss_increase_by__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_statusss_t data = f_statuss_t_initialize; + + { + const f_status_t status = f_type_statusss_increase_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/c/test-type_array-statusss_increase_by.h b/level_0/f_type_array/tests/c/test-type_array-statusss_increase_by.h new file mode 100644 index 0000000..934a1d3 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-statusss_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__statusss_increase_by +#define _TEST__F_type_array__statusss_increase_by + +/** + * Test that the function works. + * + * @see f_type_array_statusss_increase_by() + */ +extern void test__f_type_array_statusss_increase_by__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_statusss_increase_by() + */ +extern void test__f_type_array_statusss_increase_by__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__statusss_increase_by diff --git a/level_0/f_type_array/tests/c/test-type_array-statusss_resize.c b/level_0/f_type_array/tests/c/test-type_array-statusss_resize.c new file mode 100644 index 0000000..2e1d22a --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-statusss_resize.c @@ -0,0 +1,42 @@ +#include "test-type_array.h" +#include "test-type_array-statusss_resize.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_statusss_resize__works(void **state) { + + const int length = 5; + f_statusss_t data = f_statusss_t_initialize; + + { + const f_status_t status = f_type_statusss_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_statusss_resize__fails_on_invalid_parameter(void **state) { + + const int length = 5; + f_statusss_t data = f_statusss_t_initialize; + + { + const f_status_t status = f_type_statusss_resize(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/c/test-type_array-statusss_resize.h b/level_0/f_type_array/tests/c/test-type_array-statusss_resize.h new file mode 100644 index 0000000..e893fd2 --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array-statusss_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__statusss_resize +#define _TEST__F_type_array__statusss_resize + +/** + * Test that the function works. + * + * @see f_type_array_statusss_resize() + */ +extern void test__f_type_array_statusss_resize__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_type_array_statusss_resize() + */ +extern void test__f_type_array_statusss_resize__fails_on_invalid_parameter(void **state); + +#endif // _TEST__F_type_array__statusss_resize diff --git a/level_0/f_type_array/tests/c/test-type_array.c b/level_0/f_type_array/tests/c/test-type_array.c new file mode 100644 index 0000000..836026c --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array.c @@ -0,0 +1,196 @@ +#include "test-type_array.h" + +#ifdef __cplusplus +extern "C" { +#endif + +int setup(void **state) { + + return 0; +} + +int setdown(void **state) { + + return 0; +} + +int main(void) { + + const struct CMUnitTest tests[] = { + cmocka_unit_test(test__f_type_array_array_lengths_adjust__works), + cmocka_unit_test(test__f_type_array_array_lengths_adjust__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_array_lengths_append__works), + cmocka_unit_test(test__f_type_array_array_lengths_append__returns_data_not), + cmocka_unit_test(test__f_type_array_array_lengths_append__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_array_lengths_decimate_by__works), + cmocka_unit_test(test__f_type_array_array_lengths_decimate_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_array_lengths_decrease_by__works), + cmocka_unit_test(test__f_type_array_array_lengths_decrease_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_array_lengths_increase__works), + cmocka_unit_test(test__f_type_array_array_lengths_increase__returns_data_not), + cmocka_unit_test(test__f_type_array_array_lengths_increase__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_array_lengths_increase_by__works), + cmocka_unit_test(test__f_type_array_array_lengths_increase_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_array_lengths_resize__works), + cmocka_unit_test(test__f_type_array_array_lengths_resize__fails_on_invalid_parameter), + + cmocka_unit_test(test__f_type_array_array_lengthss_adjust__works), + cmocka_unit_test(test__f_type_array_array_lengthss_adjust__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_array_lengthss_append__works), + cmocka_unit_test(test__f_type_array_array_lengthss_append__returns_data_not), + cmocka_unit_test(test__f_type_array_array_lengthss_append__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_array_lengthss_decimate_by__works), + cmocka_unit_test(test__f_type_array_array_lengthss_decimate_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_array_lengthss_decrease_by__works), + cmocka_unit_test(test__f_type_array_array_lengthss_decrease_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_array_lengthss_increase__works), + cmocka_unit_test(test__f_type_array_array_lengthss_increase__returns_data_not), + cmocka_unit_test(test__f_type_array_array_lengthss_increase__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_array_lengthss_increase_by__works), + cmocka_unit_test(test__f_type_array_array_lengthss_increase_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_array_lengthss_resize__works), + cmocka_unit_test(test__f_type_array_array_lengthss_resize__fails_on_invalid_parameter), + + cmocka_unit_test(test__f_type_array_cells_adjust__works), + cmocka_unit_test(test__f_type_array_cells_adjust__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_cells_append__works), + cmocka_unit_test(test__f_type_array_cells_append__returns_data_not), + cmocka_unit_test(test__f_type_array_cells_append__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_cells_decimate_by__works), + cmocka_unit_test(test__f_type_array_cells_decimate_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_cells_decrease_by__works), + cmocka_unit_test(test__f_type_array_cells_decrease_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_cells_increase__works), + cmocka_unit_test(test__f_type_array_cells_increase__returns_data_not), + cmocka_unit_test(test__f_type_array_cells_increase__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_cells_increase_by__works), + cmocka_unit_test(test__f_type_array_cells_increase_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_cells_resize__works), + cmocka_unit_test(test__f_type_array_cells_resize__fails_on_invalid_parameter), + + cmocka_unit_test(test__f_type_array_cellss_adjust__works), + cmocka_unit_test(test__f_type_array_cellss_adjust__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_cellss_append__works), + cmocka_unit_test(test__f_type_array_cellss_append__returns_data_not), + cmocka_unit_test(test__f_type_array_cellss_append__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_cellss_decimate_by__works), + cmocka_unit_test(test__f_type_array_cellss_decimate_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_cellss_decrease_by__works), + cmocka_unit_test(test__f_type_array_cellss_decrease_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_cellss_increase__works), + cmocka_unit_test(test__f_type_array_cellss_increase__returns_data_not), + cmocka_unit_test(test__f_type_array_cellss_increase__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_cellss_increase_by__works), + cmocka_unit_test(test__f_type_array_cellss_increase_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_cellss_resize__works), + cmocka_unit_test(test__f_type_array_cellss_resize__fails_on_invalid_parameter), + + cmocka_unit_test(test__f_type_array_fll_ids_adjust__works), + cmocka_unit_test(test__f_type_array_fll_ids_adjust__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_fll_ids_append__works), + cmocka_unit_test(test__f_type_array_fll_ids_append__returns_data_not), + cmocka_unit_test(test__f_type_array_fll_ids_append__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_fll_ids_decimate_by__works), + cmocka_unit_test(test__f_type_array_fll_ids_decimate_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_fll_ids_decrease_by__works), + cmocka_unit_test(test__f_type_array_fll_ids_decrease_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_fll_ids_increase__works), + cmocka_unit_test(test__f_type_array_fll_ids_increase__returns_data_not), + cmocka_unit_test(test__f_type_array_fll_ids_increase__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_fll_ids_increase_by__works), + cmocka_unit_test(test__f_type_array_fll_ids_increase_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_fll_ids_resize__works), + cmocka_unit_test(test__f_type_array_fll_ids_resize__fails_on_invalid_parameter), + + cmocka_unit_test(test__f_type_array_fll_idss_adjust__works), + cmocka_unit_test(test__f_type_array_fll_idss_adjust__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_fll_idss_append__works), + cmocka_unit_test(test__f_type_array_fll_idss_append__returns_data_not), + cmocka_unit_test(test__f_type_array_fll_idss_append__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_fll_idss_decimate_by__works), + cmocka_unit_test(test__f_type_array_fll_idss_decimate_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_fll_idss_decrease_by__works), + cmocka_unit_test(test__f_type_array_fll_idss_decrease_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_fll_idss_increase__works), + cmocka_unit_test(test__f_type_array_fll_idss_increase__returns_data_not), + cmocka_unit_test(test__f_type_array_fll_idss_increase__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_fll_idss_increase_by__works), + cmocka_unit_test(test__f_type_array_fll_idss_increase_by__fails_on_invalid_parameter), + 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_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), + cmocka_unit_test(test__f_type_array_states_append__returns_data_not), + cmocka_unit_test(test__f_type_array_states_append__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_states_decimate_by__works), + cmocka_unit_test(test__f_type_array_states_decimate_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_states_decrease_by__works), + cmocka_unit_test(test__f_type_array_states_decrease_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_states_increase__works), + cmocka_unit_test(test__f_type_array_states_increase__returns_data_not), + cmocka_unit_test(test__f_type_array_states_increase__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_states_increase_by__works), + cmocka_unit_test(test__f_type_array_states_increase_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_states_resize__works), + cmocka_unit_test(test__f_type_array_states_resize__fails_on_invalid_parameter), + + cmocka_unit_test(test__f_type_array_statess_adjust__works), + cmocka_unit_test(test__f_type_array_statess_adjust__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_statess_append__works), + cmocka_unit_test(test__f_type_array_statess_append__returns_data_not), + cmocka_unit_test(test__f_type_array_statess_append__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_statess_decimate_by__works), + cmocka_unit_test(test__f_type_array_statess_decimate_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_statess_decrease_by__works), + cmocka_unit_test(test__f_type_array_statess_decrease_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_statess_increase__works), + cmocka_unit_test(test__f_type_array_statess_increase__returns_data_not), + cmocka_unit_test(test__f_type_array_statess_increase__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_statess_increase_by__works), + cmocka_unit_test(test__f_type_array_statess_increase_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_statess_resize__works), + cmocka_unit_test(test__f_type_array_statess_resize__fails_on_invalid_parameter), + + cmocka_unit_test(test__f_type_array_statuss_adjust__works), + cmocka_unit_test(test__f_type_array_statuss_adjust__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_statuss_append__works), + cmocka_unit_test(test__f_type_array_statuss_append__returns_data_not), + cmocka_unit_test(test__f_type_array_statuss_append__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_statuss_decimate_by__works), + cmocka_unit_test(test__f_type_array_statuss_decimate_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_statuss_decrease_by__works), + cmocka_unit_test(test__f_type_array_statuss_decrease_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_statuss_increase__works), + cmocka_unit_test(test__f_type_array_statuss_increase__returns_data_not), + cmocka_unit_test(test__f_type_array_statuss_increase__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_statuss_increase_by__works), + cmocka_unit_test(test__f_type_array_statuss_increase_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_statuss_resize__works), + cmocka_unit_test(test__f_type_array_statuss_resize__fails_on_invalid_parameter), + + cmocka_unit_test(test__f_type_array_statusss_adjust__works), + cmocka_unit_test(test__f_type_array_statusss_adjust__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_statusss_append__works), + cmocka_unit_test(test__f_type_array_statusss_append__returns_data_not), + cmocka_unit_test(test__f_type_array_statusss_append__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_statusss_decimate_by__works), + cmocka_unit_test(test__f_type_array_statusss_decimate_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_statusss_decrease_by__works), + cmocka_unit_test(test__f_type_array_statusss_decrease_by__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_statusss_increase__works), + cmocka_unit_test(test__f_type_array_statusss_increase__returns_data_not), + cmocka_unit_test(test__f_type_array_statusss_increase__fails_on_invalid_parameter), + cmocka_unit_test(test__f_type_array_statusss_increase_by__works), + 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), + }; + + return cmocka_run_group_tests(tests, setup, setdown); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/c/test-type_array.h b/level_0/f_type_array/tests/c/test-type_array.h new file mode 100644 index 0000000..21eb60b --- /dev/null +++ b/level_0/f_type_array/tests/c/test-type_array.h @@ -0,0 +1,140 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the type arrays in the project. + */ +#ifndef _TEST__F_type_array_h +#define _TEST__F_type_array_h + +// libc includes. +#include +#include +#include +#include + +// cmocka includes. +#include + +// fll-0 includes. +#include +#include +#include + +// test includes. +#include "test-type_array-array_lengths_adjust.h" +#include "test-type_array-array_lengths_append.h" +#include "test-type_array-array_lengths_decimate_by.h" +#include "test-type_array-array_lengths_decrease_by.h" +#include "test-type_array-array_lengths_increase.h" +#include "test-type_array-array_lengths_increase_by.h" +#include "test-type_array-array_lengths_resize.h" +#include "test-type_array-array_lengthss_adjust.h" +#include "test-type_array-array_lengthss_append.h" +#include "test-type_array-array_lengthss_decimate_by.h" +#include "test-type_array-array_lengthss_decrease_by.h" +#include "test-type_array-array_lengthss_increase.h" +#include "test-type_array-array_lengthss_increase_by.h" +#include "test-type_array-array_lengthss_resize.h" +#include "test-type_array-cells_adjust.h" +#include "test-type_array-cells_append.h" +#include "test-type_array-cells_decimate_by.h" +#include "test-type_array-cells_decrease_by.h" +#include "test-type_array-cells_increase.h" +#include "test-type_array-cells_increase_by.h" +#include "test-type_array-cells_resize.h" +#include "test-type_array-cellss_adjust.h" +#include "test-type_array-cellss_append.h" +#include "test-type_array-cellss_decimate_by.h" +#include "test-type_array-cellss_decrease_by.h" +#include "test-type_array-cellss_increase.h" +#include "test-type_array-cellss_increase_by.h" +#include "test-type_array-cellss_resize.h" +#include "test-type_array-fll_ids_adjust.h" +#include "test-type_array-fll_ids_append.h" +#include "test-type_array-fll_ids_decimate_by.h" +#include "test-type_array-fll_ids_decrease_by.h" +#include "test-type_array-fll_ids_increase.h" +#include "test-type_array-fll_ids_increase_by.h" +#include "test-type_array-fll_ids_resize.h" +#include "test-type_array-fll_idss_adjust.h" +#include "test-type_array-fll_idss_append.h" +#include "test-type_array-fll_idss_decimate_by.h" +#include "test-type_array-fll_idss_decrease_by.h" +#include "test-type_array-fll_idss_increase.h" +#include "test-type_array-fll_idss_increase_by.h" +#include "test-type_array-fll_idss_resize.h" +#include "test-type_array-states_adjust.h" +#include "test-type_array-states_append.h" +#include "test-type_array-states_decimate_by.h" +#include "test-type_array-states_decrease_by.h" +#include "test-type_array-states_increase.h" +#include "test-type_array-states_increase_by.h" +#include "test-type_array-states_resize.h" +#include "test-type_array-statess_adjust.h" +#include "test-type_array-statess_append.h" +#include "test-type_array-statess_decimate_by.h" +#include "test-type_array-statess_decrease_by.h" +#include "test-type_array-statess_increase.h" +#include "test-type_array-statess_increase_by.h" +#include "test-type_array-statess_resize.h" +#include "test-type_array-statuss_adjust.h" +#include "test-type_array-statuss_append.h" +#include "test-type_array-statuss_decimate_by.h" +#include "test-type_array-statuss_decrease_by.h" +#include "test-type_array-statuss_increase.h" +#include "test-type_array-statuss_increase_by.h" +#include "test-type_array-statuss_resize.h" +#include "test-type_array-statusss_adjust.h" +#include "test-type_array-statusss_append.h" +#include "test-type_array-statusss_decimate_by.h" +#include "test-type_array-statusss_decrease_by.h" +#include "test-type_array-statusss_increase.h" +#include "test-type_array-statusss_increase_by.h" +#include "test-type_array-statusss_resize.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Perform any setup operations. + * + * @param state + * The test state. + * + * @return + * The status of this function, where 0 means success. + */ +extern int setup(void **state); + +/** + * Peform any setdown operations. + * + * @param state + * The test state. + * + * @return + * The status of this function, where 0 means success. + */ +extern int setdown(void **state); + +/** + * Run all tests. + * + * @return + * The final result of the tests. + * + * @see cmocka_run_group_tests() + * @see cmocka_unit_test() + */ +extern int main(void); + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _TEST__F_type_array_h -- 1.8.3.1