From 49bb2808541652d999172af6bf63654a3bd859bd Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Sat, 14 May 2022 22:19:50 -0500 Subject: [PATCH] Update: Unit tests, fixing minor mistakes and add missing tests. While these tests are not expected to be thorough at this time, there are several checks that should still be and can easily be made. Some of the test files have incorrect comments. Order test functions alphabetically. --- .../tests/unit/c/test-limit-sets_append_all.h | 2 +- .../tests/unit/c/test-limit-sets_increase.h | 2 +- .../tests/unit/c/test-limit-setss_append.h | 2 +- .../unit/c/test-limit-setss_append_all.h | 2 +- .../unit/c/test-limit-setss_decimate_by.h | 2 +- .../unit/c/test-limit-setss_decrease_by.h | 2 +- .../tests/unit/c/test-limit-setss_increase.h | 2 +- .../unit/c/test-limit-setss_increase_by.h | 2 +- .../unit/c/test-limit-values_append_all.h | 2 +- .../tests/unit/c/test-limit-values_increase.h | 2 +- .../tests/unit/c/test-limit-valuess_append.h | 2 +- .../unit/c/test-limit-valuess_append_all.h | 2 +- .../unit/c/test-limit-valuess_decimate_by.h | 2 +- .../unit/c/test-limit-valuess_decrease_by.h | 2 +- .../unit/c/test-limit-valuess_increase.h | 2 +- .../unit/c/test-limit-valuess_increase_by.h | 2 +- .../f_path/tests/unit/c/test-path-current.h | 14 ++ level_0/f_pipe/tests/unit/c/mock-pipe.h | 2 +- level_0/f_pipe/tests/unit/c/test-pipe.h | 2 +- .../c/test-type_array-array_lengths_adjust.c | 20 +- .../c/test-type_array-array_lengths_adjust.h | 12 +- .../c/test-type_array-array_lengths_append.c | 22 +-- .../c/test-type_array-array_lengths_append.h | 12 +- ...test-type_array-array_lengths_append_all.c | 60 +++--- ...test-type_array-array_lengths_append_all.h | 16 +- ...est-type_array-array_lengths_decimate_by.c | 28 +-- ...est-type_array-array_lengths_decimate_by.h | 12 +- ...est-type_array-array_lengths_decrease_by.c | 28 +-- ...est-type_array-array_lengths_decrease_by.h | 12 +- .../test-type_array-array_lengths_increase.c | 36 ++-- .../test-type_array-array_lengths_increase.h | 16 +- ...est-type_array-array_lengths_increase_by.c | 32 ++-- ...est-type_array-array_lengths_increase_by.h | 12 +- .../c/test-type_array-array_lengths_resize.c | 20 +- .../c/test-type_array-array_lengths_resize.h | 12 +- .../c/test-type_array-array_lengthss_adjust.c | 20 +- .../c/test-type_array-array_lengthss_adjust.h | 12 +- .../c/test-type_array-array_lengthss_append.c | 68 +++---- .../c/test-type_array-array_lengthss_append.h | 16 +- ...est-type_array-array_lengthss_append_all.c | 74 +++---- ...est-type_array-array_lengthss_append_all.h | 16 +- ...st-type_array-array_lengthss_decimate_by.c | 40 +++- ...st-type_array-array_lengthss_decimate_by.h | 17 +- ...st-type_array-array_lengthss_decrease_by.c | 40 +++- ...st-type_array-array_lengthss_decrease_by.h | 19 +- .../test-type_array-array_lengthss_increase.c | 36 ++-- .../test-type_array-array_lengthss_increase.h | 16 +- ...st-type_array-array_lengthss_increase_by.c | 52 ++++- ...st-type_array-array_lengthss_increase_by.h | 19 +- .../c/test-type_array-array_lengthss_resize.c | 20 +- .../c/test-type_array-array_lengthss_resize.h | 12 +- .../unit/c/test-type_array-cells_adjust.c | 20 +- .../unit/c/test-type_array-cells_adjust.h | 12 +- .../unit/c/test-type_array-cells_append.c | 22 +-- .../unit/c/test-type_array-cells_append.h | 12 +- .../unit/c/test-type_array-cells_append_all.c | 66 +++---- .../unit/c/test-type_array-cells_append_all.h | 16 +- .../c/test-type_array-cells_decimate_by.c | 28 +-- .../c/test-type_array-cells_decimate_by.h | 12 +- .../c/test-type_array-cells_decrease_by.c | 28 +-- .../c/test-type_array-cells_decrease_by.h | 12 +- .../unit/c/test-type_array-cells_increase.c | 36 ++-- .../unit/c/test-type_array-cells_increase.h | 16 +- .../c/test-type_array-cells_increase_by.c | 32 ++-- .../c/test-type_array-cells_increase_by.h | 12 +- .../unit/c/test-type_array-cells_resize.c | 20 +- .../unit/c/test-type_array-cells_resize.h | 12 +- .../unit/c/test-type_array-cellss_adjust.c | 20 +- .../unit/c/test-type_array-cellss_adjust.h | 12 +- .../unit/c/test-type_array-cellss_append.c | 74 +++---- .../unit/c/test-type_array-cellss_append.h | 16 +- .../c/test-type_array-cellss_append_all.c | 74 +++---- .../c/test-type_array-cellss_append_all.h | 16 +- .../c/test-type_array-cellss_decimate_by.c | 40 +++- .../c/test-type_array-cellss_decimate_by.h | 17 +- .../c/test-type_array-cellss_decrease_by.c | 40 +++- .../c/test-type_array-cellss_decrease_by.h | 19 +- .../unit/c/test-type_array-cellss_increase.c | 36 ++-- .../unit/c/test-type_array-cellss_increase.h | 16 +- .../c/test-type_array-cellss_increase_by.c | 74 ++++++- .../c/test-type_array-cellss_increase_by.h | 19 +- .../unit/c/test-type_array-cellss_resize.c | 20 +- .../unit/c/test-type_array-cellss_resize.h | 12 +- .../unit/c/test-type_array-fll_ids_adjust.c | 20 +- .../unit/c/test-type_array-fll_ids_adjust.h | 12 +- .../unit/c/test-type_array-fll_ids_append.c | 22 +-- .../unit/c/test-type_array-fll_ids_append.h | 12 +- .../c/test-type_array-fll_ids_append_all.c | 70 +++---- .../c/test-type_array-fll_ids_append_all.h | 16 +- .../c/test-type_array-fll_ids_decimate_by.c | 28 +-- .../c/test-type_array-fll_ids_decimate_by.h | 12 +- .../c/test-type_array-fll_ids_decrease_by.c | 28 +-- .../c/test-type_array-fll_ids_decrease_by.h | 12 +- .../unit/c/test-type_array-fll_ids_increase.c | 36 ++-- .../unit/c/test-type_array-fll_ids_increase.h | 16 +- .../c/test-type_array-fll_ids_increase_by.c | 32 ++-- .../c/test-type_array-fll_ids_increase_by.h | 12 +- .../unit/c/test-type_array-fll_ids_resize.c | 20 +- .../unit/c/test-type_array-fll_ids_resize.h | 12 +- .../unit/c/test-type_array-fll_idss_adjust.c | 20 +- .../unit/c/test-type_array-fll_idss_adjust.h | 12 +- .../unit/c/test-type_array-fll_idss_append.c | 74 +++---- .../unit/c/test-type_array-fll_idss_append.h | 16 +- .../c/test-type_array-fll_idss_append_all.c | 74 +++---- .../c/test-type_array-fll_idss_append_all.h | 16 +- .../c/test-type_array-fll_idss_decimate_by.c | 40 +++- .../c/test-type_array-fll_idss_decimate_by.h | 17 +- .../c/test-type_array-fll_idss_decrease_by.c | 40 +++- .../c/test-type_array-fll_idss_decrease_by.h | 19 +- .../c/test-type_array-fll_idss_increase.c | 36 ++-- .../c/test-type_array-fll_idss_increase.h | 16 +- .../c/test-type_array-fll_idss_increase_by.c | 52 ++++- .../c/test-type_array-fll_idss_increase_by.h | 19 +- .../unit/c/test-type_array-fll_idss_resize.c | 20 +- .../unit/c/test-type_array-fll_idss_resize.h | 12 +- .../unit/c/test-type_array-int128s_adjust.c | 20 +- .../unit/c/test-type_array-int128s_adjust.h | 12 +- .../unit/c/test-type_array-int128s_append.c | 22 +-- .../unit/c/test-type_array-int128s_append.h | 12 +- .../c/test-type_array-int128s_append_all.c | 60 +++--- .../c/test-type_array-int128s_append_all.h | 16 +- .../c/test-type_array-int128s_decimate_by.c | 28 +-- .../c/test-type_array-int128s_decimate_by.h | 12 +- .../c/test-type_array-int128s_decrease_by.c | 28 +-- .../c/test-type_array-int128s_decrease_by.h | 12 +- .../unit/c/test-type_array-int128s_increase.c | 36 ++-- .../unit/c/test-type_array-int128s_increase.h | 16 +- .../c/test-type_array-int128s_increase_by.c | 32 ++-- .../c/test-type_array-int128s_increase_by.h | 12 +- .../unit/c/test-type_array-int128s_resize.c | 20 +- .../unit/c/test-type_array-int128s_resize.h | 12 +- .../unit/c/test-type_array-int128ss_adjust.c | 20 +- .../unit/c/test-type_array-int128ss_adjust.h | 12 +- .../unit/c/test-type_array-int128ss_append.c | 68 +++---- .../unit/c/test-type_array-int128ss_append.h | 16 +- .../c/test-type_array-int128ss_append_all.c | 74 +++---- .../c/test-type_array-int128ss_append_all.h | 16 +- .../c/test-type_array-int128ss_decimate_by.c | 44 ++++- .../c/test-type_array-int128ss_decimate_by.h | 17 +- .../c/test-type_array-int128ss_decrease_by.c | 44 ++++- .../c/test-type_array-int128ss_decrease_by.h | 19 +- .../c/test-type_array-int128ss_increase.c | 42 ++-- .../c/test-type_array-int128ss_increase.h | 16 +- .../c/test-type_array-int128ss_increase_by.c | 56 ++++-- .../c/test-type_array-int128ss_increase_by.h | 19 +- .../unit/c/test-type_array-int128ss_resize.c | 20 +- .../unit/c/test-type_array-int128ss_resize.h | 12 +- .../unit/c/test-type_array-int16s_adjust.c | 20 +- .../unit/c/test-type_array-int16s_adjust.h | 12 +- .../unit/c/test-type_array-int16s_append.c | 24 +-- .../unit/c/test-type_array-int16s_append.h | 12 +- .../c/test-type_array-int16s_append_all.c | 60 +++--- .../c/test-type_array-int16s_append_all.h | 16 +- .../c/test-type_array-int16s_decimate_by.c | 28 +-- .../c/test-type_array-int16s_decimate_by.h | 12 +- .../c/test-type_array-int16s_decrease_by.c | 28 +-- .../c/test-type_array-int16s_decrease_by.h | 12 +- .../unit/c/test-type_array-int16s_increase.c | 36 ++-- .../unit/c/test-type_array-int16s_increase.h | 16 +- .../c/test-type_array-int16s_increase_by.c | 32 ++-- .../c/test-type_array-int16s_increase_by.h | 12 +- .../unit/c/test-type_array-int16s_resize.c | 20 +- .../unit/c/test-type_array-int16s_resize.h | 12 +- .../unit/c/test-type_array-int16ss_adjust.c | 20 +- .../unit/c/test-type_array-int16ss_adjust.h | 12 +- .../unit/c/test-type_array-int16ss_append.c | 68 +++---- .../unit/c/test-type_array-int16ss_append.h | 16 +- .../c/test-type_array-int16ss_append_all.c | 74 +++---- .../c/test-type_array-int16ss_append_all.h | 16 +- .../c/test-type_array-int16ss_decimate_by.c | 44 ++++- .../c/test-type_array-int16ss_decimate_by.h | 17 +- .../c/test-type_array-int16ss_decrease_by.c | 44 ++++- .../c/test-type_array-int16ss_decrease_by.h | 19 +- .../unit/c/test-type_array-int16ss_increase.c | 40 ++-- .../unit/c/test-type_array-int16ss_increase.h | 16 +- .../c/test-type_array-int16ss_increase_by.c | 78 ++++++-- .../c/test-type_array-int16ss_increase_by.h | 19 +- .../unit/c/test-type_array-int16ss_resize.c | 20 +- .../unit/c/test-type_array-int16ss_resize.h | 12 +- .../unit/c/test-type_array-int32s_adjust.c | 20 +- .../unit/c/test-type_array-int32s_adjust.h | 12 +- .../unit/c/test-type_array-int32s_append.c | 22 +-- .../unit/c/test-type_array-int32s_append.h | 12 +- .../c/test-type_array-int32s_append_all.c | 60 +++--- .../c/test-type_array-int32s_append_all.h | 16 +- .../c/test-type_array-int32s_decimate_by.c | 28 +-- .../c/test-type_array-int32s_decimate_by.h | 12 +- .../c/test-type_array-int32s_decrease_by.c | 28 +-- .../c/test-type_array-int32s_decrease_by.h | 12 +- .../unit/c/test-type_array-int32s_increase.c | 36 ++-- .../unit/c/test-type_array-int32s_increase.h | 16 +- .../c/test-type_array-int32s_increase_by.c | 32 ++-- .../c/test-type_array-int32s_increase_by.h | 12 +- .../unit/c/test-type_array-int32s_resize.c | 20 +- .../unit/c/test-type_array-int32s_resize.h | 12 +- .../unit/c/test-type_array-int32ss_adjust.c | 20 +- .../unit/c/test-type_array-int32ss_adjust.h | 12 +- .../unit/c/test-type_array-int32ss_append.c | 68 +++---- .../unit/c/test-type_array-int32ss_append.h | 16 +- .../c/test-type_array-int32ss_append_all.c | 74 +++---- .../c/test-type_array-int32ss_append_all.h | 16 +- .../c/test-type_array-int32ss_decimate_by.c | 44 ++++- .../c/test-type_array-int32ss_decimate_by.h | 17 +- .../c/test-type_array-int32ss_decrease_by.c | 44 ++++- .../c/test-type_array-int32ss_decrease_by.h | 19 +- .../unit/c/test-type_array-int32ss_increase.c | 40 ++-- .../unit/c/test-type_array-int32ss_increase.h | 16 +- .../c/test-type_array-int32ss_increase_by.c | 56 ++++-- .../c/test-type_array-int32ss_increase_by.h | 19 +- .../unit/c/test-type_array-int32ss_resize.c | 20 +- .../unit/c/test-type_array-int32ss_resize.h | 12 +- .../unit/c/test-type_array-int64s_adjust.c | 20 +- .../unit/c/test-type_array-int64s_adjust.h | 12 +- .../unit/c/test-type_array-int64s_append.c | 22 +-- .../unit/c/test-type_array-int64s_append.h | 12 +- .../c/test-type_array-int64s_append_all.c | 60 +++--- .../c/test-type_array-int64s_append_all.h | 16 +- .../c/test-type_array-int64s_decimate_by.c | 28 +-- .../c/test-type_array-int64s_decimate_by.h | 12 +- .../c/test-type_array-int64s_decrease_by.c | 28 +-- .../c/test-type_array-int64s_decrease_by.h | 12 +- .../unit/c/test-type_array-int64s_increase.c | 36 ++-- .../unit/c/test-type_array-int64s_increase.h | 16 +- .../c/test-type_array-int64s_increase_by.c | 32 ++-- .../c/test-type_array-int64s_increase_by.h | 12 +- .../unit/c/test-type_array-int64s_resize.c | 20 +- .../unit/c/test-type_array-int64s_resize.h | 12 +- .../unit/c/test-type_array-int64ss_adjust.c | 20 +- .../unit/c/test-type_array-int64ss_adjust.h | 12 +- .../unit/c/test-type_array-int64ss_append.c | 68 +++---- .../unit/c/test-type_array-int64ss_append.h | 16 +- .../c/test-type_array-int64ss_append_all.c | 74 +++---- .../c/test-type_array-int64ss_append_all.h | 16 +- .../c/test-type_array-int64ss_decimate_by.c | 44 ++++- .../c/test-type_array-int64ss_decimate_by.h | 17 +- .../c/test-type_array-int64ss_decrease_by.c | 44 ++++- .../c/test-type_array-int64ss_decrease_by.h | 19 +- .../unit/c/test-type_array-int64ss_increase.c | 40 ++-- .../unit/c/test-type_array-int64ss_increase.h | 16 +- .../c/test-type_array-int64ss_increase_by.c | 56 ++++-- .../c/test-type_array-int64ss_increase_by.h | 19 +- .../unit/c/test-type_array-int64ss_resize.c | 20 +- .../unit/c/test-type_array-int64ss_resize.h | 12 +- .../unit/c/test-type_array-int8s_adjust.c | 20 +- .../unit/c/test-type_array-int8s_adjust.h | 12 +- .../unit/c/test-type_array-int8s_append.c | 22 +-- .../unit/c/test-type_array-int8s_append.h | 12 +- .../unit/c/test-type_array-int8s_append_all.c | 60 +++--- .../unit/c/test-type_array-int8s_append_all.h | 16 +- .../c/test-type_array-int8s_decimate_by.c | 28 +-- .../c/test-type_array-int8s_decimate_by.h | 12 +- .../c/test-type_array-int8s_decrease_by.c | 28 +-- .../c/test-type_array-int8s_decrease_by.h | 12 +- .../unit/c/test-type_array-int8s_increase.c | 36 ++-- .../unit/c/test-type_array-int8s_increase.h | 16 +- .../c/test-type_array-int8s_increase_by.c | 32 ++-- .../c/test-type_array-int8s_increase_by.h | 12 +- .../unit/c/test-type_array-int8s_resize.c | 20 +- .../unit/c/test-type_array-int8s_resize.h | 12 +- .../unit/c/test-type_array-int8ss_adjust.c | 20 +- .../unit/c/test-type_array-int8ss_adjust.h | 12 +- .../unit/c/test-type_array-int8ss_append.c | 68 +++---- .../unit/c/test-type_array-int8ss_append.h | 16 +- .../c/test-type_array-int8ss_append_all.c | 74 +++---- .../c/test-type_array-int8ss_append_all.h | 16 +- .../c/test-type_array-int8ss_decimate_by.c | 44 ++++- .../c/test-type_array-int8ss_decimate_by.h | 17 +- .../c/test-type_array-int8ss_decrease_by.c | 44 ++++- .../c/test-type_array-int8ss_decrease_by.h | 19 +- .../unit/c/test-type_array-int8ss_increase.c | 40 ++-- .../unit/c/test-type_array-int8ss_increase.h | 16 +- .../c/test-type_array-int8ss_increase_by.c | 56 ++++-- .../c/test-type_array-int8ss_increase_by.h | 19 +- .../unit/c/test-type_array-int8ss_resize.c | 20 +- .../unit/c/test-type_array-int8ss_resize.h | 12 +- .../unit/c/test-type_array-states_adjust.c | 20 +- .../unit/c/test-type_array-states_adjust.h | 12 +- .../unit/c/test-type_array-states_append.c | 22 +-- .../unit/c/test-type_array-states_append.h | 12 +- .../c/test-type_array-states_append_all.c | 74 +++---- .../c/test-type_array-states_append_all.h | 16 +- .../c/test-type_array-states_decimate_by.c | 28 +-- .../c/test-type_array-states_decimate_by.h | 12 +- .../c/test-type_array-states_decrease_by.c | 28 +-- .../c/test-type_array-states_decrease_by.h | 12 +- .../unit/c/test-type_array-states_increase.c | 36 ++-- .../unit/c/test-type_array-states_increase.h | 16 +- .../c/test-type_array-states_increase_by.c | 32 ++-- .../c/test-type_array-states_increase_by.h | 12 +- .../unit/c/test-type_array-states_resize.c | 20 +- .../unit/c/test-type_array-states_resize.h | 12 +- .../unit/c/test-type_array-statess_adjust.c | 20 +- .../unit/c/test-type_array-statess_adjust.h | 12 +- .../unit/c/test-type_array-statess_append.c | 74 +++---- .../unit/c/test-type_array-statess_append.h | 16 +- .../c/test-type_array-statess_append_all.c | 74 +++---- .../c/test-type_array-statess_append_all.h | 16 +- .../c/test-type_array-statess_decimate_by.c | 40 +++- .../c/test-type_array-statess_decimate_by.h | 17 +- .../c/test-type_array-statess_decrease_by.c | 40 +++- .../c/test-type_array-statess_decrease_by.h | 19 +- .../unit/c/test-type_array-statess_increase.c | 36 ++-- .../unit/c/test-type_array-statess_increase.h | 16 +- .../c/test-type_array-statess_increase_by.c | 52 ++++- .../c/test-type_array-statess_increase_by.h | 19 +- .../unit/c/test-type_array-statess_resize.c | 20 +- .../unit/c/test-type_array-statess_resize.h | 12 +- .../unit/c/test-type_array-statuss_adjust.c | 20 +- .../unit/c/test-type_array-statuss_adjust.h | 12 +- .../unit/c/test-type_array-statuss_append.c | 22 +-- .../unit/c/test-type_array-statuss_append.h | 12 +- .../c/test-type_array-statuss_append_all.c | 60 +++--- .../c/test-type_array-statuss_append_all.h | 16 +- .../c/test-type_array-statuss_decimate_by.c | 28 +-- .../c/test-type_array-statuss_decimate_by.h | 12 +- .../c/test-type_array-statuss_decrease_by.c | 28 +-- .../c/test-type_array-statuss_decrease_by.h | 12 +- .../unit/c/test-type_array-statuss_increase.c | 36 ++-- .../unit/c/test-type_array-statuss_increase.h | 16 +- .../c/test-type_array-statuss_increase_by.c | 33 ++-- .../c/test-type_array-statuss_increase_by.h | 12 +- .../unit/c/test-type_array-statuss_resize.c | 20 +- .../unit/c/test-type_array-statuss_resize.h | 12 +- .../unit/c/test-type_array-statusss_adjust.c | 20 +- .../unit/c/test-type_array-statusss_adjust.h | 12 +- .../unit/c/test-type_array-statusss_append.c | 68 +++---- .../unit/c/test-type_array-statusss_append.h | 16 +- .../c/test-type_array-statusss_append_all.c | 74 +++---- .../c/test-type_array-statusss_append_all.h | 16 +- .../c/test-type_array-statusss_decimate_by.c | 40 +++- .../c/test-type_array-statusss_decimate_by.h | 17 +- .../c/test-type_array-statusss_decrease_by.c | 40 +++- .../c/test-type_array-statusss_decrease_by.h | 19 +- .../c/test-type_array-statusss_increase.c | 36 ++-- .../c/test-type_array-statusss_increase.h | 16 +- .../c/test-type_array-statusss_increase_by.c | 52 ++++- .../c/test-type_array-statusss_increase_by.h | 19 +- .../unit/c/test-type_array-statusss_resize.c | 20 +- .../unit/c/test-type_array-statusss_resize.h | 12 +- .../unit/c/test-type_array-uint128s_adjust.c | 20 +- .../unit/c/test-type_array-uint128s_adjust.h | 12 +- .../unit/c/test-type_array-uint128s_append.c | 22 +-- .../unit/c/test-type_array-uint128s_append.h | 12 +- .../c/test-type_array-uint128s_append_all.c | 60 +++--- .../c/test-type_array-uint128s_append_all.h | 16 +- .../c/test-type_array-uint128s_decimate_by.c | 28 +-- .../c/test-type_array-uint128s_decimate_by.h | 12 +- .../c/test-type_array-uint128s_decrease_by.c | 28 +-- .../c/test-type_array-uint128s_decrease_by.h | 12 +- .../c/test-type_array-uint128s_increase.c | 36 ++-- .../c/test-type_array-uint128s_increase.h | 16 +- .../c/test-type_array-uint128s_increase_by.c | 32 ++-- .../c/test-type_array-uint128s_increase_by.h | 12 +- .../unit/c/test-type_array-uint128s_resize.c | 20 +- .../unit/c/test-type_array-uint128s_resize.h | 12 +- .../unit/c/test-type_array-uint128ss_adjust.c | 20 +- .../unit/c/test-type_array-uint128ss_adjust.h | 12 +- .../unit/c/test-type_array-uint128ss_append.c | 68 +++---- .../unit/c/test-type_array-uint128ss_append.h | 16 +- .../c/test-type_array-uint128ss_append_all.c | 74 +++---- .../c/test-type_array-uint128ss_append_all.h | 16 +- .../c/test-type_array-uint128ss_decimate_by.c | 40 +++- .../c/test-type_array-uint128ss_decimate_by.h | 17 +- .../c/test-type_array-uint128ss_decrease_by.c | 40 +++- .../c/test-type_array-uint128ss_decrease_by.h | 19 +- .../c/test-type_array-uint128ss_increase.c | 36 ++-- .../c/test-type_array-uint128ss_increase.h | 16 +- .../c/test-type_array-uint128ss_increase_by.c | 52 ++++- .../c/test-type_array-uint128ss_increase_by.h | 19 +- .../unit/c/test-type_array-uint128ss_resize.c | 20 +- .../unit/c/test-type_array-uint128ss_resize.h | 12 +- .../unit/c/test-type_array-uint16s_adjust.c | 20 +- .../unit/c/test-type_array-uint16s_adjust.h | 12 +- .../unit/c/test-type_array-uint16s_append.c | 22 +-- .../unit/c/test-type_array-uint16s_append.h | 12 +- .../c/test-type_array-uint16s_append_all.c | 60 +++--- .../c/test-type_array-uint16s_append_all.h | 16 +- .../c/test-type_array-uint16s_decimate_by.c | 28 +-- .../c/test-type_array-uint16s_decimate_by.h | 12 +- .../c/test-type_array-uint16s_decrease_by.c | 28 +-- .../c/test-type_array-uint16s_decrease_by.h | 12 +- .../unit/c/test-type_array-uint16s_increase.c | 36 ++-- .../unit/c/test-type_array-uint16s_increase.h | 16 +- .../c/test-type_array-uint16s_increase_by.c | 32 ++-- .../c/test-type_array-uint16s_increase_by.h | 12 +- .../unit/c/test-type_array-uint16s_resize.c | 20 +- .../unit/c/test-type_array-uint16s_resize.h | 12 +- .../unit/c/test-type_array-uint16ss_adjust.c | 20 +- .../unit/c/test-type_array-uint16ss_adjust.h | 12 +- .../unit/c/test-type_array-uint16ss_append.c | 68 +++---- .../unit/c/test-type_array-uint16ss_append.h | 16 +- .../c/test-type_array-uint16ss_append_all.c | 74 +++---- .../c/test-type_array-uint16ss_append_all.h | 16 +- .../c/test-type_array-uint16ss_decimate_by.c | 40 +++- .../c/test-type_array-uint16ss_decimate_by.h | 17 +- .../c/test-type_array-uint16ss_decrease_by.c | 40 +++- .../c/test-type_array-uint16ss_decrease_by.h | 19 +- .../c/test-type_array-uint16ss_increase.c | 36 ++-- .../c/test-type_array-uint16ss_increase.h | 16 +- .../c/test-type_array-uint16ss_increase_by.c | 52 ++++- .../c/test-type_array-uint16ss_increase_by.h | 19 +- .../unit/c/test-type_array-uint16ss_resize.c | 20 +- .../unit/c/test-type_array-uint16ss_resize.h | 12 +- .../unit/c/test-type_array-uint32s_adjust.c | 20 +- .../unit/c/test-type_array-uint32s_adjust.h | 12 +- .../unit/c/test-type_array-uint32s_append.c | 22 +-- .../unit/c/test-type_array-uint32s_append.h | 14 +- .../c/test-type_array-uint32s_append_all.c | 60 +++--- .../c/test-type_array-uint32s_append_all.h | 16 +- .../c/test-type_array-uint32s_decimate_by.c | 28 +-- .../c/test-type_array-uint32s_decimate_by.h | 12 +- .../c/test-type_array-uint32s_decrease_by.c | 28 +-- .../c/test-type_array-uint32s_decrease_by.h | 12 +- .../unit/c/test-type_array-uint32s_increase.c | 36 ++-- .../unit/c/test-type_array-uint32s_increase.h | 16 +- .../c/test-type_array-uint32s_increase_by.c | 32 ++-- .../c/test-type_array-uint32s_increase_by.h | 12 +- .../unit/c/test-type_array-uint32s_resize.c | 20 +- .../unit/c/test-type_array-uint32s_resize.h | 12 +- .../unit/c/test-type_array-uint32ss_adjust.c | 20 +- .../unit/c/test-type_array-uint32ss_adjust.h | 12 +- .../unit/c/test-type_array-uint32ss_append.c | 68 +++---- .../unit/c/test-type_array-uint32ss_append.h | 16 +- .../c/test-type_array-uint32ss_append_all.c | 74 +++---- .../c/test-type_array-uint32ss_append_all.h | 16 +- .../c/test-type_array-uint32ss_decimate_by.c | 40 +++- .../c/test-type_array-uint32ss_decimate_by.h | 17 +- .../c/test-type_array-uint32ss_decrease_by.c | 40 +++- .../c/test-type_array-uint32ss_decrease_by.h | 19 +- .../c/test-type_array-uint32ss_increase.c | 36 ++-- .../c/test-type_array-uint32ss_increase.h | 16 +- .../c/test-type_array-uint32ss_increase_by.c | 52 ++++- .../c/test-type_array-uint32ss_increase_by.h | 19 +- .../unit/c/test-type_array-uint32ss_resize.c | 20 +- .../unit/c/test-type_array-uint32ss_resize.h | 12 +- .../unit/c/test-type_array-uint64s_adjust.c | 20 +- .../unit/c/test-type_array-uint64s_adjust.h | 12 +- .../unit/c/test-type_array-uint64s_append.c | 22 +-- .../unit/c/test-type_array-uint64s_append.h | 12 +- .../c/test-type_array-uint64s_append_all.c | 60 +++--- .../c/test-type_array-uint64s_append_all.h | 16 +- .../c/test-type_array-uint64s_decimate_by.c | 28 +-- .../c/test-type_array-uint64s_decimate_by.h | 12 +- .../c/test-type_array-uint64s_decrease_by.c | 28 +-- .../c/test-type_array-uint64s_decrease_by.h | 12 +- .../unit/c/test-type_array-uint64s_increase.c | 36 ++-- .../unit/c/test-type_array-uint64s_increase.h | 16 +- .../c/test-type_array-uint64s_increase_by.c | 32 ++-- .../c/test-type_array-uint64s_increase_by.h | 12 +- .../unit/c/test-type_array-uint64s_resize.c | 20 +- .../unit/c/test-type_array-uint64s_resize.h | 12 +- .../unit/c/test-type_array-uint64ss_adjust.c | 20 +- .../unit/c/test-type_array-uint64ss_adjust.h | 12 +- .../unit/c/test-type_array-uint64ss_append.c | 68 +++---- .../unit/c/test-type_array-uint64ss_append.h | 16 +- .../c/test-type_array-uint64ss_append_all.c | 74 +++---- .../c/test-type_array-uint64ss_append_all.h | 16 +- .../c/test-type_array-uint64ss_decimate_by.c | 40 +++- .../c/test-type_array-uint64ss_decimate_by.h | 17 +- .../c/test-type_array-uint64ss_decrease_by.c | 40 +++- .../c/test-type_array-uint64ss_decrease_by.h | 19 +- .../c/test-type_array-uint64ss_increase.c | 36 ++-- .../c/test-type_array-uint64ss_increase.h | 16 +- .../c/test-type_array-uint64ss_increase_by.c | 52 ++++- .../c/test-type_array-uint64ss_increase_by.h | 19 +- .../unit/c/test-type_array-uint64ss_resize.c | 20 +- .../unit/c/test-type_array-uint64ss_resize.h | 12 +- .../unit/c/test-type_array-uint8s_adjust.c | 20 +- .../unit/c/test-type_array-uint8s_adjust.h | 12 +- .../unit/c/test-type_array-uint8s_append.c | 22 +-- .../unit/c/test-type_array-uint8s_append.h | 12 +- .../c/test-type_array-uint8s_append_all.c | 60 +++--- .../c/test-type_array-uint8s_append_all.h | 16 +- .../c/test-type_array-uint8s_decimate_by.c | 28 +-- .../c/test-type_array-uint8s_decimate_by.h | 12 +- .../c/test-type_array-uint8s_decrease_by.c | 28 +-- .../c/test-type_array-uint8s_decrease_by.h | 12 +- .../unit/c/test-type_array-uint8s_increase.c | 36 ++-- .../unit/c/test-type_array-uint8s_increase.h | 16 +- .../c/test-type_array-uint8s_increase_by.c | 32 ++-- .../c/test-type_array-uint8s_increase_by.h | 12 +- .../unit/c/test-type_array-uint8s_resize.c | 20 +- .../unit/c/test-type_array-uint8s_resize.h | 12 +- .../unit/c/test-type_array-uint8ss_adjust.c | 20 +- .../unit/c/test-type_array-uint8ss_adjust.h | 12 +- .../unit/c/test-type_array-uint8ss_append.c | 68 +++---- .../unit/c/test-type_array-uint8ss_append.h | 16 +- .../c/test-type_array-uint8ss_append_all.c | 74 +++---- .../c/test-type_array-uint8ss_append_all.h | 16 +- .../c/test-type_array-uint8ss_decimate_by.c | 40 +++- .../c/test-type_array-uint8ss_decimate_by.h | 17 +- .../c/test-type_array-uint8ss_decrease_by.c | 40 +++- .../c/test-type_array-uint8ss_decrease_by.h | 19 +- .../unit/c/test-type_array-uint8ss_increase.c | 36 ++-- .../unit/c/test-type_array-uint8ss_increase.h | 16 +- .../c/test-type_array-uint8ss_increase_by.c | 52 ++++- .../c/test-type_array-uint8ss_increase_by.h | 19 +- .../unit/c/test-type_array-uint8ss_resize.c | 20 +- .../unit/c/test-type_array-uint8ss_resize.h | 12 +- .../tests/unit/c/test-type_array.c | 180 ++++++++++-------- 500 files changed, 7211 insertions(+), 5603 deletions(-) diff --git a/level_0/f_limit/tests/unit/c/test-limit-sets_append_all.h b/level_0/f_limit/tests/unit/c/test-limit-sets_append_all.h index dcf55a509..6371ff760 100644 --- a/level_0/f_limit/tests/unit/c/test-limit-sets_append_all.h +++ b/level_0/f_limit/tests/unit/c/test-limit-sets_append_all.h @@ -18,7 +18,7 @@ extern void test__f_limit_sets_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * * @see f_limit_sets_append_all() */ diff --git a/level_0/f_limit/tests/unit/c/test-limit-sets_increase.h b/level_0/f_limit/tests/unit/c/test-limit-sets_increase.h index 8d90cb270..96387ff44 100644 --- a/level_0/f_limit/tests/unit/c/test-limit-sets_increase.h +++ b/level_0/f_limit/tests/unit/c/test-limit-sets_increase.h @@ -18,7 +18,7 @@ extern void test__f_limit_sets_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * * @see f_limit_sets_increase() */ diff --git a/level_0/f_limit/tests/unit/c/test-limit-setss_append.h b/level_0/f_limit/tests/unit/c/test-limit-setss_append.h index a113b17e9..a29fed8df 100644 --- a/level_0/f_limit/tests/unit/c/test-limit-setss_append.h +++ b/level_0/f_limit/tests/unit/c/test-limit-setss_append.h @@ -18,7 +18,7 @@ extern void test__f_limit_setss_append__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * * @see f_limit_setss_append() */ diff --git a/level_0/f_limit/tests/unit/c/test-limit-setss_append_all.h b/level_0/f_limit/tests/unit/c/test-limit-setss_append_all.h index 575e9feec..696e35ea6 100644 --- a/level_0/f_limit/tests/unit/c/test-limit-setss_append_all.h +++ b/level_0/f_limit/tests/unit/c/test-limit-setss_append_all.h @@ -18,7 +18,7 @@ extern void test__f_limit_setss_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * * @see f_limit_setss_append_all() */ diff --git a/level_0/f_limit/tests/unit/c/test-limit-setss_decimate_by.h b/level_0/f_limit/tests/unit/c/test-limit-setss_decimate_by.h index 62e46e46f..265644c34 100644 --- a/level_0/f_limit/tests/unit/c/test-limit-setss_decimate_by.h +++ b/level_0/f_limit/tests/unit/c/test-limit-setss_decimate_by.h @@ -18,7 +18,7 @@ extern void test__f_limit_setss_decimate_by__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * * @see f_limit_setss_decimate_by() */ diff --git a/level_0/f_limit/tests/unit/c/test-limit-setss_decrease_by.h b/level_0/f_limit/tests/unit/c/test-limit-setss_decrease_by.h index 52266c560..30989487c 100644 --- a/level_0/f_limit/tests/unit/c/test-limit-setss_decrease_by.h +++ b/level_0/f_limit/tests/unit/c/test-limit-setss_decrease_by.h @@ -18,7 +18,7 @@ extern void test__f_limit_setss_decrease_by__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * * @see f_limit_setss_decrease_by() */ diff --git a/level_0/f_limit/tests/unit/c/test-limit-setss_increase.h b/level_0/f_limit/tests/unit/c/test-limit-setss_increase.h index a4ba14225..121d2710d 100644 --- a/level_0/f_limit/tests/unit/c/test-limit-setss_increase.h +++ b/level_0/f_limit/tests/unit/c/test-limit-setss_increase.h @@ -18,7 +18,7 @@ extern void test__f_limit_setss_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * * @see f_limit_setss_increase() */ diff --git a/level_0/f_limit/tests/unit/c/test-limit-setss_increase_by.h b/level_0/f_limit/tests/unit/c/test-limit-setss_increase_by.h index 06f361274..320fa11b3 100644 --- a/level_0/f_limit/tests/unit/c/test-limit-setss_increase_by.h +++ b/level_0/f_limit/tests/unit/c/test-limit-setss_increase_by.h @@ -18,7 +18,7 @@ extern void test__f_limit_setss_increase_by__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * * @see f_limit_setss_increase_by() */ diff --git a/level_0/f_limit/tests/unit/c/test-limit-values_append_all.h b/level_0/f_limit/tests/unit/c/test-limit-values_append_all.h index 0dd4ba629..a9e5942fa 100644 --- a/level_0/f_limit/tests/unit/c/test-limit-values_append_all.h +++ b/level_0/f_limit/tests/unit/c/test-limit-values_append_all.h @@ -18,7 +18,7 @@ extern void test__f_limit_values_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * * @see f_limit_values_append_all() */ diff --git a/level_0/f_limit/tests/unit/c/test-limit-values_increase.h b/level_0/f_limit/tests/unit/c/test-limit-values_increase.h index bbe04508d..fd7a1f1ac 100644 --- a/level_0/f_limit/tests/unit/c/test-limit-values_increase.h +++ b/level_0/f_limit/tests/unit/c/test-limit-values_increase.h @@ -18,7 +18,7 @@ extern void test__f_limit_values_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * * @see f_limit_values_increase() */ diff --git a/level_0/f_limit/tests/unit/c/test-limit-valuess_append.h b/level_0/f_limit/tests/unit/c/test-limit-valuess_append.h index 611e95f4d..da69f38ff 100644 --- a/level_0/f_limit/tests/unit/c/test-limit-valuess_append.h +++ b/level_0/f_limit/tests/unit/c/test-limit-valuess_append.h @@ -18,7 +18,7 @@ extern void test__f_limit_valuess_append__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * * @see f_limit_valuess_append() */ diff --git a/level_0/f_limit/tests/unit/c/test-limit-valuess_append_all.h b/level_0/f_limit/tests/unit/c/test-limit-valuess_append_all.h index c80dcbce8..1bd9b93f6 100644 --- a/level_0/f_limit/tests/unit/c/test-limit-valuess_append_all.h +++ b/level_0/f_limit/tests/unit/c/test-limit-valuess_append_all.h @@ -18,7 +18,7 @@ extern void test__f_limit_valuess_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * * @see f_limit_valuess_append_all() */ diff --git a/level_0/f_limit/tests/unit/c/test-limit-valuess_decimate_by.h b/level_0/f_limit/tests/unit/c/test-limit-valuess_decimate_by.h index c6cd25774..fe735442c 100644 --- a/level_0/f_limit/tests/unit/c/test-limit-valuess_decimate_by.h +++ b/level_0/f_limit/tests/unit/c/test-limit-valuess_decimate_by.h @@ -18,7 +18,7 @@ extern void test__f_limit_valuess_decimate_by__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * * @see f_limit_valuess_decimate_by() */ diff --git a/level_0/f_limit/tests/unit/c/test-limit-valuess_decrease_by.h b/level_0/f_limit/tests/unit/c/test-limit-valuess_decrease_by.h index 3592fc3dd..e969828cb 100644 --- a/level_0/f_limit/tests/unit/c/test-limit-valuess_decrease_by.h +++ b/level_0/f_limit/tests/unit/c/test-limit-valuess_decrease_by.h @@ -18,7 +18,7 @@ extern void test__f_limit_valuess_decrease_by__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * * @see f_limit_valuess_decrease_by() */ diff --git a/level_0/f_limit/tests/unit/c/test-limit-valuess_increase.h b/level_0/f_limit/tests/unit/c/test-limit-valuess_increase.h index acf0d69da..7d58fdd19 100644 --- a/level_0/f_limit/tests/unit/c/test-limit-valuess_increase.h +++ b/level_0/f_limit/tests/unit/c/test-limit-valuess_increase.h @@ -18,7 +18,7 @@ extern void test__f_limit_valuess_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * * @see f_limit_valuess_increase() */ diff --git a/level_0/f_limit/tests/unit/c/test-limit-valuess_increase_by.h b/level_0/f_limit/tests/unit/c/test-limit-valuess_increase_by.h index 8819fd88b..11c2f71dc 100644 --- a/level_0/f_limit/tests/unit/c/test-limit-valuess_increase_by.h +++ b/level_0/f_limit/tests/unit/c/test-limit-valuess_increase_by.h @@ -18,7 +18,7 @@ extern void test__f_limit_valuess_increase_by__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * * @see f_limit_valuess_increase_by() */ diff --git a/level_0/f_path/tests/unit/c/test-path-current.h b/level_0/f_path/tests/unit/c/test-path-current.h index 0f3acb863..a9ff7d308 100644 --- a/level_0/f_path/tests/unit/c/test-path-current.h +++ b/level_0/f_path/tests/unit/c/test-path-current.h @@ -10,6 +10,13 @@ #ifndef _TEST__F_path_current_h #define _TEST__F_path_current_h +/** + * Test that function fails. + * + * @see f_path_current() + */ +extern void test__f_path_current__fails(void **state); + /** * Test that parameter checking works as expected. * @@ -19,4 +26,11 @@ extern void test__f_path_current__parameter_checking(void **state); #endif // _di_level_0_parameter_checking_ +/** + * Test that function works. + * + * @see f_path_current() + */ +extern void test__f_path_current__works(void **state); + #endif // _TEST__F_path_current_h diff --git a/level_0/f_pipe/tests/unit/c/mock-pipe.h b/level_0/f_pipe/tests/unit/c/mock-pipe.h index f6b44fe72..2b42a617d 100644 --- a/level_0/f_pipe/tests/unit/c/mock-pipe.h +++ b/level_0/f_pipe/tests/unit/c/mock-pipe.h @@ -1,7 +1,7 @@ /** * FLL - Level 0 * - * Project: Path + * Project: Pipe * API Version: 0.5 * Licenses: lgpl-2.1-or-later * diff --git a/level_0/f_pipe/tests/unit/c/test-pipe.h b/level_0/f_pipe/tests/unit/c/test-pipe.h index 1d0e9d646..ee9bb51ac 100644 --- a/level_0/f_pipe/tests/unit/c/test-pipe.h +++ b/level_0/f_pipe/tests/unit/c/test-pipe.h @@ -1,7 +1,7 @@ /** * FLL - Level 0 * - * Project: IKI + * Project: Pipe * API Version: 0.5 * Licenses: lgpl-2.1-or-later * diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_adjust.c index d58020d47..d2fdf68af 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_adjust.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_adjust.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_array_lengths_adjust__works(void **state) { +void test__f_type_array_array_lengths_adjust__parameter_checking(void **state) { const int length = 5; f_array_lengths_t data = f_array_lengths_t_initialize; { - const f_status_t status = f_array_lengths_adjust(length, &data); + const f_status_t status = f_array_lengths_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_array_lengths_adjust__parameter_checking(void **state) { +void test__f_type_array_array_lengths_adjust__works(void **state) { const int length = 5; f_array_lengths_t data = f_array_lengths_t_initialize; { - const f_status_t status = f_array_lengths_adjust(length, 0); + const f_status_t status = f_array_lengths_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_adjust.h index f59c7d317..c9330bda4 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_adjust.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_adjust.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__array_lengths_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_array_lengths_adjust() + * @see f_array_lengths_adjust() */ -extern void test__f_type_array_array_lengths_adjust__works(void **state); +extern void test__f_type_array_array_lengths_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_array_lengths_adjust() + * @see f_array_lengths_adjust() */ -extern void test__f_type_array_array_lengths_adjust__parameter_checking(void **state); +extern void test__f_type_array_array_lengths_adjust__works(void **state); #endif // _TEST__F_type_array__array_lengths_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_append.c index 8e63f9473..b3bf49cf1 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_append.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_append.c @@ -5,6 +5,17 @@ extern "C" { #endif +void test__f_type_array_array_lengths_append__parameter_checking(void **state) { + + const f_array_length_t data = f_array_length_t_initialize; + + { + const f_status_t status = f_array_lengths_append(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + void test__f_type_array_array_lengths_append__works(void **state) { const f_array_length_t source = 3; @@ -21,17 +32,6 @@ void test__f_type_array_array_lengths_append__works(void **state) { free((void *) destination.array); } -void test__f_type_array_array_lengths_append__parameter_checking(void **state) { - - const f_array_length_t data = f_array_length_t_initialize; - - { - const f_status_t status = f_array_lengths_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_append.h index de1290cee..33369c0b3 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_append.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_append.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__array_lengths_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_array_lengths_append() + * @see f_array_lengths_append() */ -extern void test__f_type_array_array_lengths_append__works(void **state); +extern void test__f_type_array_array_lengths_append__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_array_lengths_append() + * @see f_array_lengths_append() */ -extern void test__f_type_array_array_lengths_append__parameter_checking(void **state); +extern void test__f_type_array_array_lengths_append__works(void **state); #endif // _TEST__F_type_array__array_lengths_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_append_all.c index 144a80d84..fae08df89 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_append_all.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_append_all.c @@ -5,10 +5,20 @@ extern "C" { #endif -void test__f_type_array_array_lengths_append_all__works(void **state) { +void test__f_type_array_array_lengths_append_all__parameter_checking(void **state) { + + const f_array_lengths_t data = f_array_lengths_t_initialize; + + { + const f_status_t status = f_array_lengths_append_all(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +void test__f_type_array_array_lengths_append_all__returns_data_not(void **state) { const int length = 5; - const int length_used = 2; f_array_lengths_t source = f_array_lengths_t_initialize; f_array_lengths_t destination = f_array_lengths_t_initialize; @@ -20,29 +30,22 @@ void test__f_type_array_array_lengths_append_all__works(void **state) { assert_int_equal(source.size, length); } - for (; source.used < length_used; ++source.used) { - source.array[source.used] = source.used + 1; - } // for - { const f_status_t status = f_array_lengths_append_all(source, &destination); - assert_int_equal(status, F_none); - assert_int_equal(destination.used, source.used); - assert_int_equal(destination.size, source.used); - - for (f_array_length_t i = 0; i < source.used; ++i) { - assert_int_equal(destination.array[i], i + 1); - } // for + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + assert_null(destination.array); } free((void *) source.array); - free((void *) destination.array); } -void test__f_type_array_array_lengths_append_all__returns_data_not(void **state) { +void test__f_type_array_array_lengths_append_all__works(void **state) { const int length = 5; + const int length_used = 2; f_array_lengths_t source = f_array_lengths_t_initialize; f_array_lengths_t destination = f_array_lengths_t_initialize; @@ -54,27 +57,24 @@ void test__f_type_array_array_lengths_append_all__returns_data_not(void **state) assert_int_equal(source.size, length); } + for (; source.used < length_used; ++source.used) { + source.array[source.used] = source.used + 1; + } // for + { const f_status_t status = f_array_lengths_append_all(source, &destination); - assert_int_equal(status, F_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); + assert_int_equal(status, F_none); + assert_int_equal(destination.used, source.used); + assert_int_equal(destination.size, source.used); + + for (f_array_length_t i = 0; i < source.used; ++i) { + assert_int_equal(destination.array[i], i + 1); + } // for } free((void *) source.array); -} - -void test__f_type_array_array_lengths_append_all__parameter_checking(void **state) { - - const f_array_lengths_t data = f_array_lengths_t_initialize; - - { - const f_status_t status = f_array_lengths_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } + free((void *) destination.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_append_all.h index 0cf641ba7..8b128fdf8 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_append_all.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_append_all.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__array_lengths_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_array_lengths_append_all() + * @see f_array_lengths_append_all() */ -extern void test__f_type_array_array_lengths_append_all__works(void **state); +extern void test__f_type_array_array_lengths_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_array_lengths_append_all() + * @see f_array_lengths_append_all() */ extern void test__f_type_array_array_lengths_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_array_lengths_append_all() + * @see f_array_lengths_append_all() */ -extern void test__f_type_array_array_lengths_append_all__parameter_checking(void **state); +extern void test__f_type_array_array_lengths_append_all__works(void **state); #endif // _TEST__F_type_array__array_lengths_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_decimate_by.c index 5150b8f90..1472bbeba 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_decimate_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_decimate_by.c @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_array_lengths_decimate_by__works(void **state) { +void test__f_type_array_array_lengths_decimate_by__parameter_checking(void **state) { const int length = 5; f_array_lengths_t data = f_array_lengths_t_initialize; { - const f_status_t status = f_array_lengths_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_array_lengths_decimate_by(length, &data); + const f_status_t status = f_array_lengths_decimate_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_array_lengths_decimate_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_array_lengths_decimate_by__parameter_checking(void **state) { +void test__f_type_array_array_lengths_decimate_by__works(void **state) { const int length = 5; f_array_lengths_t data = f_array_lengths_t_initialize; { - const f_status_t status = f_array_lengths_decimate_by(length, 0); + const f_status_t status = f_array_lengths_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_array_lengths_decimate_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_decimate_by.h index 84d569fc2..7816c6004 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_decimate_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_decimate_by.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__array_lengths_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_array_lengths_decimate_by() + * @see f_array_lengths_decimate_by() */ -extern void test__f_type_array_array_lengths_decimate_by__works(void **state); +extern void test__f_type_array_array_lengths_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_array_lengths_decimate_by() + * @see f_array_lengths_decimate_by() */ -extern void test__f_type_array_array_lengths_decimate_by__parameter_checking(void **state); +extern void test__f_type_array_array_lengths_decimate_by__works(void **state); #endif // _TEST__F_type_array__array_lengths_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_decrease_by.c index 92f43662b..0ea8d0539 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_decrease_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_decrease_by.c @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_array_lengths_decrease_by__works(void **state) { +void test__f_type_array_array_lengths_decrease_by__parameter_checking(void **state) { const int length = 5; f_array_lengths_t data = f_array_lengths_t_initialize; { - const f_status_t status = f_array_lengths_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_array_lengths_decrease_by(length, &data); + const f_status_t status = f_array_lengths_decrease_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_array_lengths_decrease_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_array_lengths_decrease_by__parameter_checking(void **state) { +void test__f_type_array_array_lengths_decrease_by__works(void **state) { const int length = 5; f_array_lengths_t data = f_array_lengths_t_initialize; { - const f_status_t status = f_array_lengths_decrease_by(length, 0); + const f_status_t status = f_array_lengths_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_array_lengths_decrease_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_decrease_by.h index 131b6d9cc..cb533dd68 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_decrease_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_decrease_by.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__array_lengths_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_array_lengths_decrease_by() + * @see f_array_lengths_decrease_by() */ -extern void test__f_type_array_array_lengths_decrease_by__works(void **state); +extern void test__f_type_array_array_lengths_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_array_lengths_decrease_by() + * @see f_array_lengths_decrease_by() */ -extern void test__f_type_array_array_lengths_decrease_by__parameter_checking(void **state); +extern void test__f_type_array_array_lengths_decrease_by__works(void **state); #endif // _TEST__F_type_array__array_lengths_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_increase.c index 5b88f6026..02f2385e8 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_increase.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_increase.c @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_array_lengths_increase__works(void **state) { +void test__f_type_array_array_lengths_increase__parameter_checking(void **state) { const int length = 5; f_array_lengths_t data = f_array_lengths_t_initialize; { - const f_status_t status = f_array_lengths_resize(length, &data); + const f_status_t status = f_array_lengths_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_array_lengths_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -55,17 +45,27 @@ void test__f_type_array_array_lengths_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_array_lengths_increase__parameter_checking(void **state) { +void test__f_type_array_array_lengths_increase__works(void **state) { const int length = 5; f_array_lengths_t data = f_array_lengths_t_initialize; { - const f_status_t status = f_array_lengths_increase(length, 0); + const f_status_t status = f_array_lengths_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_array_lengths_increase(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); } free((void *) data.array); diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_increase.h index bf89633b2..667f9771c 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_increase.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_increase.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__array_lengths_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_array_lengths_increase() + * @see f_array_lengths_increase() */ -extern void test__f_type_array_array_lengths_increase__works(void **state); +extern void test__f_type_array_array_lengths_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_array_lengths_increase() + * @see f_array_lengths_increase() */ extern void test__f_type_array_array_lengths_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_array_lengths_increase() + * @see f_array_lengths_increase() */ -extern void test__f_type_array_array_lengths_increase__parameter_checking(void **state); +extern void test__f_type_array_array_lengths_increase__works(void **state); #endif // _TEST__F_type_array__array_lengths_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_increase_by.c index bb83dce59..6ffff45e6 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_increase_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_increase_by.c @@ -5,6 +5,22 @@ extern "C" { #endif +void test__f_type_array_array_lengths_increase_by__parameter_checking(void **state) { + + const int length = 5; + f_array_lengths_t data = f_array_lengths_t_initialize; + + { + const f_status_t status = f_array_lengths_increase_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + void test__f_type_array_array_lengths_increase_by__works(void **state) { const int length = 5; @@ -31,22 +47,6 @@ void test__f_type_array_array_lengths_increase_by__works(void **state) { free((void *) data.array); } -void test__f_type_array_array_lengths_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_array_lengths_t data = f_array_lengths_t_initialize; - - { - const f_status_t status = f_array_lengths_increase_by(length, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_increase_by.h index 820cfa38b..9f9daafef 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_increase_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_increase_by.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__array_lengths_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_array_lengths_increase_by() + * @see f_array_lengths_increase_by() */ -extern void test__f_type_array_array_lengths_increase_by__works(void **state); +extern void test__f_type_array_array_lengths_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_array_lengths_increase_by() + * @see f_array_lengths_increase_by() */ -extern void test__f_type_array_array_lengths_increase_by__parameter_checking(void **state); +extern void test__f_type_array_array_lengths_increase_by__works(void **state); #endif // _TEST__F_type_array__array_lengths_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_resize.c index 1c655c4ce..37232c24d 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_resize.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_resize.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_array_lengths_resize__works(void **state) { +void test__f_type_array_array_lengths_resize__parameter_checking(void **state) { const int length = 5; f_array_lengths_t data = f_array_lengths_t_initialize; { - const f_status_t status = f_array_lengths_resize(length, &data); + const f_status_t status = f_array_lengths_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_array_lengths_resize__parameter_checking(void **state) { +void test__f_type_array_array_lengths_resize__works(void **state) { const int length = 5; f_array_lengths_t data = f_array_lengths_t_initialize; { - const f_status_t status = f_array_lengths_resize(length, 0); + const f_status_t status = f_array_lengths_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_resize.h index 648b40fa5..51453f3ab 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_resize.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengths_resize.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__array_lengths_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_array_lengths_resize() + * @see f_array_lengths_resize() */ -extern void test__f_type_array_array_lengths_resize__works(void **state); +extern void test__f_type_array_array_lengths_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_array_lengths_resize() + * @see f_array_lengths_resize() */ -extern void test__f_type_array_array_lengths_resize__parameter_checking(void **state); +extern void test__f_type_array_array_lengths_resize__works(void **state); #endif // _TEST__F_type_array__array_lengths_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_adjust.c index a691c7eb5..3b1733b49 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_adjust.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_adjust.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_array_lengthss_adjust__works(void **state) { +void test__f_type_array_array_lengthss_adjust__parameter_checking(void **state) { const int length = 5; f_array_lengthss_t data = f_array_lengthss_t_initialize; { - const f_status_t status = f_array_lengthss_adjust(length, &data); + const f_status_t status = f_array_lengthss_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_array_lengthss_adjust__parameter_checking(void **state) { +void test__f_type_array_array_lengthss_adjust__works(void **state) { const int length = 5; f_array_lengthss_t data = f_array_lengthss_t_initialize; { - const f_status_t status = f_array_lengthss_adjust(length, 0); + const f_status_t status = f_array_lengthss_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_adjust.h index 49ac75a8c..306ba246d 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_adjust.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_adjust.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__array_lengthss_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_array_lengthss_adjust() + * @see f_array_lengthss_adjust() */ -extern void test__f_type_array_array_lengthss_adjust__works(void **state); +extern void test__f_type_array_array_lengthss_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_array_lengthss_adjust() + * @see f_array_lengthss_adjust() */ -extern void test__f_type_array_array_lengthss_adjust__parameter_checking(void **state); +extern void test__f_type_array_array_lengthss_adjust__works(void **state); #endif // _TEST__F_type_array__array_lengthss_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_append.c index 5235bc15e..d3cf215d1 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_append.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_append.c @@ -5,7 +5,18 @@ extern "C" { #endif -void test__f_type_array_array_lengthss_append__works(void **state) { +void test__f_type_array_array_lengthss_append__parameter_checking(void **state) { + + const f_array_lengths_t data = f_array_lengths_t_initialize; + + { + const f_status_t status = f_array_lengthss_append(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +void test__f_type_array_array_lengthss_append__returns_data_not(void **state) { const int length = 5; f_array_lengths_t source = f_array_lengths_t_initialize; @@ -19,32 +30,19 @@ void test__f_type_array_array_lengthss_append__works(void **state) { assert_int_equal(source.size, length); } - for (; source.used < length; ++source.used) { - source.array[source.used] = source.used + 1; - } // for - { const f_status_t status = f_array_lengthss_append(source, &destination); - assert_int_equal(status, F_none); - assert_int_equal(destination.used, 1); - assert_int_equal(destination.array[0].used, source.used); - assert_int_equal(destination.array[0].size, source.used); - - for (f_array_length_t i = 0; i < destination.array[0].used; ++i) { - assert_int_equal(destination.array[0].array[i], i + 1); - } // for + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + assert_null(destination.array); } - for (f_array_length_t i = 0; i < destination.used; ++i) { - free((void *) destination.array[i].array); - } // for - free((void *) source.array); - free((void *) destination.array); } -void test__f_type_array_array_lengthss_append__returns_data_not(void **state) { +void test__f_type_array_array_lengthss_append__works(void **state) { const int length = 5; f_array_lengths_t source = f_array_lengths_t_initialize; @@ -58,27 +56,29 @@ void test__f_type_array_array_lengthss_append__returns_data_not(void **state) { assert_int_equal(source.size, length); } + for (; source.used < length; ++source.used) { + source.array[source.used] = source.used + 1; + } // for + { const f_status_t status = f_array_lengthss_append(source, &destination); - assert_int_equal(status, F_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); - } - - free((void *) source.array); -} - -void test__f_type_array_array_lengthss_append__parameter_checking(void **state) { + assert_int_equal(status, F_none); + assert_int_equal(destination.used, 1); + assert_int_equal(destination.array[0].used, source.used); + assert_int_equal(destination.array[0].size, source.used); - const f_array_lengths_t data = f_array_lengths_t_initialize; + for (f_array_length_t i = 0; i < destination.array[0].used; ++i) { + assert_int_equal(destination.array[0].array[i], i + 1); + } // for + } - { - const f_status_t status = f_array_lengthss_append(data, 0); + for (f_array_length_t i = 0; i < destination.used; ++i) { + free((void *) destination.array[i].array); + } // for - assert_int_equal(status, F_status_set_error(F_parameter)); - } + free((void *) source.array); + free((void *) destination.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_append.h index 26855d6fa..b562cb3c7 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_append.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_append.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__array_lengthss_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_array_lengthss_append() + * @see f_array_lengthss_append() */ -extern void test__f_type_array_array_lengthss_append__works(void **state); +extern void test__f_type_array_array_lengthss_append__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_array_lengthss_append() + * @see f_array_lengthss_append() */ extern void test__f_type_array_array_lengthss_append__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_array_lengthss_append() + * @see f_array_lengthss_append() */ -extern void test__f_type_array_array_lengthss_append__parameter_checking(void **state); +extern void test__f_type_array_array_lengthss_append__works(void **state); #endif // _TEST__F_type_array__array_lengthss_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_append_all.c index 213257b64..08e089d3c 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_append_all.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_append_all.c @@ -5,6 +5,43 @@ extern "C" { #endif +void test__f_type_array_array_lengthss_append_all__parameter_checking(void **state) { + + const f_array_lengthss_t data = f_array_lengthss_t_initialize; + + { + const f_status_t status = f_array_lengthss_append_all(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +void test__f_type_array_array_lengthss_append_all__returns_data_not(void **state) { + + const int length = 5; + f_array_lengthss_t source = f_array_lengthss_t_initialize; + f_array_lengthss_t destination = f_array_lengthss_t_initialize; + + { + const f_status_t status = f_array_lengthss_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + { + const f_status_t status = f_array_lengthss_append_all(source, &destination); + + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + assert_null(destination.array); + } + + free((void *) source.array); +} + void test__f_type_array_array_lengthss_append_all__works(void **state) { const int length = 5; @@ -63,43 +100,6 @@ void test__f_type_array_array_lengthss_append_all__works(void **state) { free((void *) destination.array); } -void test__f_type_array_array_lengthss_append_all__returns_data_not(void **state) { - - const int length = 5; - f_array_lengthss_t source = f_array_lengthss_t_initialize; - f_array_lengthss_t destination = f_array_lengthss_t_initialize; - - { - const f_status_t status = f_array_lengthss_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_array_lengthss_append_all(source, &destination); - - assert_int_equal(status, F_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); - } - - free((void *) source.array); -} - -void test__f_type_array_array_lengthss_append_all__parameter_checking(void **state) { - - const f_array_lengthss_t data = f_array_lengthss_t_initialize; - - { - const f_status_t status = f_array_lengthss_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_append_all.h index 497d99c17..22241133b 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_append_all.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_append_all.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__array_lengthss_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_array_lengthss_append_all() + * @see f_array_lengthss_append_all() */ -extern void test__f_type_array_array_lengthss_append_all__works(void **state); +extern void test__f_type_array_array_lengthss_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_array_lengthss_append_all() + * @see f_array_lengthss_append_all() */ extern void test__f_type_array_array_lengthss_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_array_lengthss_append_all() + * @see f_array_lengthss_append_all() */ -extern void test__f_type_array_array_lengthss_append_all__parameter_checking(void **state); +extern void test__f_type_array_array_lengthss_append_all__works(void **state); #endif // _TEST__F_type_array__array_lengthss_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_decimate_by.c index 911307f31..b98d6f69e 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_decimate_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_decimate_by.c @@ -5,11 +5,27 @@ extern "C" { #endif -void test__f_type_array_array_lengthss_decimate_by__works(void **state) { +void test__f_type_array_array_lengthss_decimate_by__parameter_checking(void **state) { const int length = 5; f_array_lengthss_t data = f_array_lengths_t_initialize; + { + const f_status_t status = f_array_lengthss_decimate_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_array_lengthss_decimate_by__returns_data_not(void **state) { + + const int length = 5; + f_array_lengthss_t data = f_array_lengthss_t_initialize; + { const f_status_t status = f_array_lengthss_resize(length, &data); @@ -19,25 +35,33 @@ void test__f_type_array_array_lengthss_decimate_by__works(void **state) { } { - const f_status_t status = f_array_lengthss_decimate_by(length, &data); + const f_status_t status = f_array_lengthss_decimate_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_array_lengthss_decimate_by__parameter_checking(void **state) { +void test__f_type_array_array_lengthss_decimate_by__works(void **state) { const int length = 5; f_array_lengthss_t data = f_array_lengths_t_initialize; { - const f_status_t status = f_array_lengthss_decimate_by(length, 0); + const f_status_t status = f_array_lengthss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_array_lengthss_decimate_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_decimate_by.h index b4248034a..fd3dc6e49 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_decimate_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_decimate_by.h @@ -11,17 +11,24 @@ #define _TEST__F_type_array__array_lengthss_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_array_lengthss_decimate_by() + * @see f_array_lengthss_decimate_by() */ -extern void test__f_type_array_array_lengthss_decimate_by__works(void **state); +extern void test__f_type_array_array_lengthss_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * * @see f_type_array_array_lengthss_decimate_by() */ -extern void test__f_type_array_array_lengthss_decimate_by__parameter_checking(void **state); +extern void test__f_type_array_array_lengthss_decimate_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_array_lengthss_decimate_by() + */ +extern void test__f_type_array_array_lengthss_decimate_by__works(void **state); #endif // _TEST__F_type_array__array_lengthss_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_decrease_by.c index 0a092ad39..349cc1f16 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_decrease_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_decrease_by.c @@ -5,11 +5,27 @@ extern "C" { #endif -void test__f_type_array_array_lengthss_decrease_by__works(void **state) { +void test__f_type_array_array_lengthss_decrease_by__parameter_checking(void **state) { const int length = 5; f_array_lengthss_t data = f_array_lengths_t_initialize; + { + const f_status_t status = f_array_lengthss_decrease_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_array_lengthss_decrease_by__returns_data_not(void **state) { + + const int length = 5; + f_array_lengthss_t data = f_array_lengthss_t_initialize; + { const f_status_t status = f_array_lengthss_resize(length, &data); @@ -19,25 +35,33 @@ void test__f_type_array_array_lengthss_decrease_by__works(void **state) { } { - const f_status_t status = f_array_lengthss_decrease_by(length, &data); + const f_status_t status = f_array_lengthss_decrease_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_array_lengthss_decrease_by__parameter_checking(void **state) { +void test__f_type_array_array_lengthss_decrease_by__works(void **state) { const int length = 5; f_array_lengthss_t data = f_array_lengths_t_initialize; { - const f_status_t status = f_array_lengthss_decrease_by(length, 0); + const f_status_t status = f_array_lengthss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_array_lengthss_decrease_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_decrease_by.h index 75c840d29..88c814b0e 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_decrease_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_decrease_by.h @@ -11,17 +11,24 @@ #define _TEST__F_type_array__array_lengthss_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_array_lengthss_decrease_by() + * @see f_array_lengthss_decrease_by() */ -extern void test__f_type_array_array_lengthss_decrease_by__works(void **state); +extern void test__f_type_array_array_lengthss_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_array_lengthss_decrease_by() + * @see f_array_lengthss_decrease_by() */ -extern void test__f_type_array_array_lengthss_decrease_by__parameter_checking(void **state); +extern void test__f_type_array_array_lengthss_decrease_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_array_lengthss_decrease_by() + */ +extern void test__f_type_array_array_lengthss_decrease_by__works(void **state); #endif // _TEST__F_type_array__array_lengthss_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_increase.c index d5ada76cd..08be366da 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_increase.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_increase.c @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_array_lengthss_increase__works(void **state) { +void test__f_type_array_array_lengthss_increase__parameter_checking(void **state) { const int length = 5; f_array_lengthss_t data = f_array_lengths_t_initialize; { - const f_status_t status = f_array_lengthss_resize(length, &data); + const f_status_t status = f_array_lengthss_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_array_lengthss_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -55,17 +45,27 @@ void test__f_type_array_array_lengthss_increase__returns_data_not(void **state) free((void *) data.array); } -void test__f_type_array_array_lengthss_increase__parameter_checking(void **state) { +void test__f_type_array_array_lengthss_increase__works(void **state) { const int length = 5; f_array_lengthss_t data = f_array_lengths_t_initialize; { - const f_status_t status = f_array_lengthss_increase(length, 0); + const f_status_t status = f_array_lengthss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_array_lengthss_increase(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); } free((void *) data.array); diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_increase.h index 678879300..df78d8f41 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_increase.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_increase.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__array_lengthss_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_array_lengthss_increase() + * @see f_array_lengthss_increase() */ -extern void test__f_type_array_array_lengthss_increase__works(void **state); +extern void test__f_type_array_array_lengthss_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_array_lengthss_increase() + * @see f_array_lengthss_increase() */ extern void test__f_type_array_array_lengthss_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_array_lengthss_increase() + * @see f_array_lengthss_increase() */ -extern void test__f_type_array_array_lengthss_increase__parameter_checking(void **state); +extern void test__f_type_array_array_lengthss_increase__works(void **state); #endif // _TEST__F_type_array__array_lengthss_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_increase_by.c index 5bbbbf17d..fca240b03 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_increase_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_increase_by.c @@ -5,11 +5,27 @@ extern "C" { #endif -void test__f_type_array_array_lengthss_increase_by__works(void **state) { +void test__f_type_array_array_lengthss_increase_by__parameter_checking(void **state) { const int length = 5; f_array_lengthss_t data = f_array_lengths_t_initialize; + { + const f_status_t status = f_array_lengthss_increase_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_array_lengthss_increase_by__returns_data_not(void **state) { + + const int length = 5; + f_array_lengthss_t data = f_array_lengthss_t_initialize; + { const f_status_t status = f_array_lengthss_resize(length, &data); @@ -19,32 +35,48 @@ void test__f_type_array_array_lengthss_increase_by__works(void **state) { } { - data.used = length; + const f_status_t status = f_array_lengthss_increase_by(0, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + { const f_status_t status = f_array_lengthss_increase_by(length, &data); - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); } free((void *) data.array); } -void test__f_type_array_array_lengthss_increase_by__parameter_checking(void **state) { +void test__f_type_array_array_lengthss_increase_by__works(void **state) { const int length = 5; f_array_lengthss_t data = f_array_lengths_t_initialize; { - const f_status_t status = f_array_lengthss_increase_by(length, 0); + const f_status_t status = f_array_lengthss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + { + data.used = length; + + const f_status_t status = f_array_lengthss_increase_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_increase_by.h index 789f8e12b..cead63756 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_increase_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_increase_by.h @@ -11,17 +11,24 @@ #define _TEST__F_type_array__array_lengthss_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_array_lengthss_increase_by() + * @see f_array_lengthss_increase_by() */ -extern void test__f_type_array_array_lengthss_increase_by__works(void **state); +extern void test__f_type_array_array_lengthss_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_array_lengthss_increase_by() + * @see f_array_lengthss_increase_by() */ -extern void test__f_type_array_array_lengthss_increase_by__parameter_checking(void **state); +extern void test__f_type_array_array_lengthss_increase_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_array_lengthss_increase_by() + */ +extern void test__f_type_array_array_lengthss_increase_by__works(void **state); #endif // _TEST__F_type_array__array_lengthss_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_resize.c index a2d030f7b..2e8fdc87f 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_resize.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_resize.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_array_lengthss_resize__works(void **state) { +void test__f_type_array_array_lengthss_resize__parameter_checking(void **state) { const int length = 5; f_array_lengthss_t data = f_array_lengthss_t_initialize; { - const f_status_t status = f_array_lengthss_resize(length, &data); + const f_status_t status = f_array_lengthss_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_array_lengthss_resize__parameter_checking(void **state) { +void test__f_type_array_array_lengthss_resize__works(void **state) { const int length = 5; f_array_lengthss_t data = f_array_lengthss_t_initialize; { - const f_status_t status = f_array_lengthss_resize(length, 0); + const f_status_t status = f_array_lengthss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_resize.h index 0011f3276..5d7ab806a 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_resize.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-array_lengthss_resize.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__array_lengthss_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_array_lengthss_resize() + * @see f_array_lengthss_resize() */ -extern void test__f_type_array_array_lengthss_resize__works(void **state); +extern void test__f_type_array_array_lengthss_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_array_lengthss_resize() + * @see f_array_lengthss_resize() */ -extern void test__f_type_array_array_lengthss_resize__parameter_checking(void **state); +extern void test__f_type_array_array_lengthss_resize__works(void **state); #endif // _TEST__F_type_array__array_lengthss_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cells_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-cells_adjust.c index 4dbf3a401..fc8809eaa 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cells_adjust.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-cells_adjust.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_cells_adjust__works(void **state) { +void test__f_type_array_cells_adjust__parameter_checking(void **state) { const int length = 5; f_cells_t data = f_cells_t_initialize; { - const f_status_t status = f_cells_adjust(length, &data); + const f_status_t status = f_cells_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_cells_adjust__parameter_checking(void **state) { +void test__f_type_array_cells_adjust__works(void **state) { const int length = 5; f_cells_t data = f_cells_t_initialize; { - const f_status_t status = f_cells_adjust(length, 0); + const f_status_t status = f_cells_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cells_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-cells_adjust.h index 53d4c6344..f908d4200 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cells_adjust.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-cells_adjust.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__cells_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_cells_adjust() + * @see f_cells_adjust() */ -extern void test__f_type_array_cells_adjust__works(void **state); +extern void test__f_type_array_cells_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_cells_adjust() + * @see f_cells_adjust() */ -extern void test__f_type_array_cells_adjust__parameter_checking(void **state); +extern void test__f_type_array_cells_adjust__works(void **state); #endif // _TEST__F_type_array__cells_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cells_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-cells_append.c index 195145612..d0afa08cd 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cells_append.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-cells_append.c @@ -5,6 +5,17 @@ extern "C" { #endif +void test__f_type_array_cells_append__parameter_checking(void **state) { + + const f_cell_t data = f_cell_t_initialize; + + { + const f_status_t status = f_cells_append(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + void test__f_type_array_cells_append__works(void **state) { const f_cell_t source = { .row = 1, .column = 2 }; @@ -22,17 +33,6 @@ void test__f_type_array_cells_append__works(void **state) { free((void *) destination.array); } -void test__f_type_array_cells_append__parameter_checking(void **state) { - - const f_cell_t data = f_cell_t_initialize; - - { - const f_status_t status = f_cells_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cells_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-cells_append.h index ba16169cb..f80d2badf 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cells_append.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-cells_append.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__cells_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_cells_append() + * @see f_cells_append() */ -extern void test__f_type_array_cells_append__works(void **state); +extern void test__f_type_array_cells_append__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_cells_append() + * @see f_cells_append() */ -extern void test__f_type_array_cells_append__parameter_checking(void **state); +extern void test__f_type_array_cells_append__works(void **state); #endif // _TEST__F_type_array__cells_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cells_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-cells_append_all.c index 071c2b10e..322ff81f3 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cells_append_all.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-cells_append_all.c @@ -5,15 +5,23 @@ extern "C" { #endif -void test__f_type_array_cells_append_all__works(void **state) { +void test__f_type_array_cells_append_all__parameter_checking(void **state) { + + const f_cells_t data = f_cells_t_initialize; + + { + const f_status_t status = f_cells_append_all(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +void test__f_type_array_cells_append_all__returns_data_not(void **state) { const int length = 5; f_cells_t source = f_cells_t_initialize; f_cells_t destination = f_cells_t_initialize; - const f_cell_t cell_0 = { .row = 1, .column = 2 }; - const f_cell_t cell_1 = { .row = 3, .column = 4 }; - { const f_status_t status = f_cells_resize(length, &source); @@ -22,33 +30,27 @@ void test__f_type_array_cells_append_all__works(void **state) { assert_int_equal(source.size, length); } - memcpy(&source.array[source.used++], (void *) &cell_0, sizeof(f_cell_t)); - memcpy(&source.array[source.used++], (void *) &cell_1, sizeof(f_cell_t)); - { const f_status_t status = f_cells_append_all(source, &destination); - assert_int_equal(status, F_none); - assert_int_equal(destination.used, source.used); - assert_int_equal(destination.size, source.used); - - assert_int_equal(destination.array[0].row, cell_0.row); - assert_int_equal(destination.array[0].column, cell_0.column); - - assert_int_equal(destination.array[1].row, cell_1.row); - assert_int_equal(destination.array[1].column, cell_1.column); + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + assert_null(destination.array); } free((void *) source.array); - free((void *) destination.array); } -void test__f_type_array_cells_append_all__returns_data_not(void **state) { +void test__f_type_array_cells_append_all__works(void **state) { const int length = 5; f_cells_t source = f_cells_t_initialize; f_cells_t destination = f_cells_t_initialize; + const f_cell_t cell_0 = { .row = 1, .column = 2 }; + const f_cell_t cell_1 = { .row = 3, .column = 4 }; + { const f_status_t status = f_cells_resize(length, &source); @@ -57,27 +59,25 @@ void test__f_type_array_cells_append_all__returns_data_not(void **state) { assert_int_equal(source.size, length); } + memcpy(&source.array[source.used++], (void *) &cell_0, sizeof(f_cell_t)); + memcpy(&source.array[source.used++], (void *) &cell_1, sizeof(f_cell_t)); + { const f_status_t status = f_cells_append_all(source, &destination); - assert_int_equal(status, F_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); - } - - free((void *) source.array); -} - -void test__f_type_array_cells_append_all__parameter_checking(void **state) { - - const f_cells_t data = f_cells_t_initialize; + assert_int_equal(status, F_none); + assert_int_equal(destination.used, source.used); + assert_int_equal(destination.size, source.used); - { - const f_status_t status = f_cells_append_all(data, 0); + assert_int_equal(destination.array[0].row, cell_0.row); + assert_int_equal(destination.array[0].column, cell_0.column); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(destination.array[1].row, cell_1.row); + assert_int_equal(destination.array[1].column, cell_1.column); } + + free((void *) source.array); + free((void *) destination.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cells_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-cells_append_all.h index 31cd25913..b4ecbe764 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cells_append_all.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-cells_append_all.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__cells_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_cells_append_all() + * @see f_cells_append_all() */ -extern void test__f_type_array_cells_append_all__works(void **state); +extern void test__f_type_array_cells_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_cells_append_all() + * @see f_cells_append_all() */ extern void test__f_type_array_cells_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_cells_append_all() + * @see f_cells_append_all() */ -extern void test__f_type_array_cells_append_all__parameter_checking(void **state); +extern void test__f_type_array_cells_append_all__works(void **state); #endif // _TEST__F_type_array__cells_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cells_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-cells_decimate_by.c index a9bf7b06d..45cf6e979 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cells_decimate_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-cells_decimate_by.c @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_cells_decimate_by__works(void **state) { +void test__f_type_array_cells_decimate_by__parameter_checking(void **state) { const int length = 5; f_cells_t data = f_cells_t_initialize; { - const f_status_t status = f_cells_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_cells_decimate_by(length, &data); + const f_status_t status = f_cells_decimate_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_cells_decimate_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_cells_decimate_by__parameter_checking(void **state) { +void test__f_type_array_cells_decimate_by__works(void **state) { const int length = 5; f_cells_t data = f_cells_t_initialize; { - const f_status_t status = f_cells_decimate_by(length, 0); + const f_status_t status = f_cells_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_cells_decimate_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cells_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-cells_decimate_by.h index b689fff2a..a3abba22a 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cells_decimate_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-cells_decimate_by.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__cells_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_cells_decimate_by() + * @see f_cells_decimate_by() */ -extern void test__f_type_array_cells_decimate_by__works(void **state); +extern void test__f_type_array_cells_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_cells_decimate_by() + * @see f_cells_decimate_by() */ -extern void test__f_type_array_cells_decimate_by__parameter_checking(void **state); +extern void test__f_type_array_cells_decimate_by__works(void **state); #endif // _TEST__F_type_array__cells_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cells_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-cells_decrease_by.c index bd44d1b30..7cd12b15c 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cells_decrease_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-cells_decrease_by.c @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_cells_decrease_by__works(void **state) { +void test__f_type_array_cells_decrease_by__parameter_checking(void **state) { const int length = 5; f_cells_t data = f_cells_t_initialize; { - const f_status_t status = f_cells_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_cells_decrease_by(length, &data); + const f_status_t status = f_cells_decrease_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_cells_decrease_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_cells_decrease_by__parameter_checking(void **state) { +void test__f_type_array_cells_decrease_by__works(void **state) { const int length = 5; f_cells_t data = f_cells_t_initialize; { - const f_status_t status = f_cells_decrease_by(length, 0); + const f_status_t status = f_cells_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_cells_decrease_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cells_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-cells_decrease_by.h index 09d89d339..71c3e2377 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cells_decrease_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-cells_decrease_by.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__cells_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_cells_decrease_by() + * @see f_cells_decrease_by() */ -extern void test__f_type_array_cells_decrease_by__works(void **state); +extern void test__f_type_array_cells_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_cells_decrease_by() + * @see f_cells_decrease_by() */ -extern void test__f_type_array_cells_decrease_by__parameter_checking(void **state); +extern void test__f_type_array_cells_decrease_by__works(void **state); #endif // _TEST__F_type_array__cells_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cells_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-cells_increase.c index 7842295d6..ef18ec2a8 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cells_increase.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-cells_increase.c @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_cells_increase__works(void **state) { +void test__f_type_array_cells_increase__parameter_checking(void **state) { const int length = 5; f_cells_t data = f_cells_t_initialize; { - const f_status_t status = f_cells_resize(length, &data); + const f_status_t status = f_cells_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_cells_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -55,17 +45,27 @@ void test__f_type_array_cells_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_cells_increase__parameter_checking(void **state) { +void test__f_type_array_cells_increase__works(void **state) { const int length = 5; f_cells_t data = f_cells_t_initialize; { - const f_status_t status = f_cells_increase(length, 0); + const f_status_t status = f_cells_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_cells_increase(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); } free((void *) data.array); diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cells_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-cells_increase.h index 81964f4e3..80623ff99 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cells_increase.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-cells_increase.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__cells_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_cells_increase() + * @see f_cells_increase() */ -extern void test__f_type_array_cells_increase__works(void **state); +extern void test__f_type_array_cells_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_cells_increase() + * @see f_cells_increase() */ extern void test__f_type_array_cells_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_cells_increase() + * @see f_cells_increase() */ -extern void test__f_type_array_cells_increase__parameter_checking(void **state); +extern void test__f_type_array_cells_increase__works(void **state); #endif // _TEST__F_type_array__cells_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cells_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-cells_increase_by.c index ed71d469d..debeb96db 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cells_increase_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-cells_increase_by.c @@ -5,6 +5,22 @@ extern "C" { #endif +void test__f_type_array_cells_increase_by__parameter_checking(void **state) { + + const int length = 5; + f_cells_t data = f_cells_t_initialize; + + { + const f_status_t status = f_cells_increase_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + void test__f_type_array_cells_increase_by__works(void **state) { const int length = 5; @@ -31,22 +47,6 @@ void test__f_type_array_cells_increase_by__works(void **state) { free((void *) data.array); } -void test__f_type_array_cells_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_cells_t data = f_cells_t_initialize; - - { - const f_status_t status = f_cells_increase_by(length, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cells_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-cells_increase_by.h index f3daa7817..896175e43 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cells_increase_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-cells_increase_by.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__cells_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_cells_increase_by() + * @see f_cells_increase_by() */ -extern void test__f_type_array_cells_increase_by__works(void **state); +extern void test__f_type_array_cells_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_cells_increase_by() + * @see f_cells_increase_by() */ -extern void test__f_type_array_cells_increase_by__parameter_checking(void **state); +extern void test__f_type_array_cells_increase_by__works(void **state); #endif // _TEST__F_type_array__cells_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cells_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-cells_resize.c index 35e6699c1..3ef50cea1 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cells_resize.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-cells_resize.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_cells_resize__works(void **state) { +void test__f_type_array_cells_resize__parameter_checking(void **state) { const int length = 5; f_cells_t data = f_cells_t_initialize; { - const f_status_t status = f_cells_resize(length, &data); + const f_status_t status = f_cells_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_cells_resize__parameter_checking(void **state) { +void test__f_type_array_cells_resize__works(void **state) { const int length = 5; f_cells_t data = f_cells_t_initialize; { - const f_status_t status = f_cells_resize(length, 0); + const f_status_t status = f_cells_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cells_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-cells_resize.h index b89bdf8a7..44be5c32e 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cells_resize.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-cells_resize.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__cells_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_cells_resize() + * @see f_cells_resize() */ -extern void test__f_type_array_cells_resize__works(void **state); +extern void test__f_type_array_cells_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_cells_resize() + * @see f_cells_resize() */ -extern void test__f_type_array_cells_resize__parameter_checking(void **state); +extern void test__f_type_array_cells_resize__works(void **state); #endif // _TEST__F_type_array__cells_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-cellss_adjust.c index b44fcf28e..2eb1c8ffa 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_adjust.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-cellss_adjust.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_cellss_adjust__works(void **state) { +void test__f_type_array_cellss_adjust__parameter_checking(void **state) { const int length = 5; f_cellss_t data = f_cellss_t_initialize; { - const f_status_t status = f_cellss_adjust(length, &data); + const f_status_t status = f_cellss_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_cellss_adjust__parameter_checking(void **state) { +void test__f_type_array_cellss_adjust__works(void **state) { const int length = 5; f_cellss_t data = f_cellss_t_initialize; { - const f_status_t status = f_cellss_adjust(length, 0); + const f_status_t status = f_cellss_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-cellss_adjust.h index b4d07e758..dc126940e 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_adjust.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-cellss_adjust.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__cellss_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_cellss_adjust() + * @see f_cellss_adjust() */ -extern void test__f_type_array_cellss_adjust__works(void **state); +extern void test__f_type_array_cellss_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_cellss_adjust() + * @see f_cellss_adjust() */ -extern void test__f_type_array_cellss_adjust__parameter_checking(void **state); +extern void test__f_type_array_cellss_adjust__works(void **state); #endif // _TEST__F_type_array__cellss_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-cellss_append.c index 9cbefbd7e..444dfec31 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_append.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-cellss_append.c @@ -5,6 +5,43 @@ extern "C" { #endif +void test__f_type_array_cellss_append__parameter_checking(void **state) { + + f_cells_t data = f_cells_t_initialize; + + { + const f_status_t status = f_cellss_append(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +void test__f_type_array_cellss_append__returns_data_not(void **state) { + + const int length = 5; + f_cells_t source = f_cellss_t_initialize; + f_cellss_t destination = f_cellss_t_initialize; + + { + const f_status_t status = f_cells_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + { + const f_status_t status = f_cellss_append(source, &destination); + + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + assert_null(destination.array); + } + + free((void *) source.array); +} + void test__f_type_array_cellss_append__works(void **state) { const int length = 5; @@ -48,43 +85,6 @@ void test__f_type_array_cellss_append__works(void **state) { free((void *) destination.array); } -void test__f_type_array_cellss_append__returns_data_not(void **state) { - - const int length = 5; - f_cells_t source = f_cellss_t_initialize; - f_cellss_t destination = f_cellss_t_initialize; - - { - const f_status_t status = f_cells_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_cellss_append(source, &destination); - - assert_int_equal(status, F_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); - } - - free((void *) source.array); -} - -void test__f_type_array_cellss_append__parameter_checking(void **state) { - - f_cells_t data = f_cells_t_initialize; - - { - const f_status_t status = f_cellss_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-cellss_append.h index cc487251d..7244b4071 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_append.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-cellss_append.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__cellss_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_cellss_append() + * @see f_cellss_append() */ -extern void test__f_type_array_cellss_append__works(void **state); +extern void test__f_type_array_cellss_append__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_cellss_append() + * @see f_cellss_append() */ extern void test__f_type_array_cellss_append__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_cellss_append() + * @see f_cellss_append() */ -extern void test__f_type_array_cellss_append__parameter_checking(void **state); +extern void test__f_type_array_cellss_append__works(void **state); #endif // _TEST__F_type_array__cellss_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-cellss_append_all.c index b7a193259..8ffe29740 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_append_all.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-cellss_append_all.c @@ -5,6 +5,43 @@ extern "C" { #endif +void test__f_type_array_cellss_append_all__returns_data_not(void **state) { + + const int length = 5; + f_cellss_t source = f_cellss_t_initialize; + f_cellss_t destination = f_cellss_t_initialize; + + { + const f_status_t status = f_cellss_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + { + const f_status_t status = f_cellss_append_all(source, &destination); + + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + assert_null(destination.array); + } + + free((void *) source.array); +} + +void test__f_type_array_cellss_append_all__parameter_checking(void **state) { + + const f_cellss_t data = f_cellss_t_initialize; + + { + const f_status_t status = f_cellss_append_all(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + void test__f_type_array_cellss_append_all__works(void **state) { const int length = 5; @@ -67,43 +104,6 @@ void test__f_type_array_cellss_append_all__works(void **state) { free((void *) destination.array); } -void test__f_type_array_cellss_append_all__returns_data_not(void **state) { - - const int length = 5; - f_cellss_t source = f_cellss_t_initialize; - f_cellss_t destination = f_cellss_t_initialize; - - { - const f_status_t status = f_cellss_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_cellss_append_all(source, &destination); - - assert_int_equal(status, F_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); - } - - free((void *) source.array); -} - -void test__f_type_array_cellss_append_all__parameter_checking(void **state) { - - const f_cellss_t data = f_cellss_t_initialize; - - { - const f_status_t status = f_cellss_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-cellss_append_all.h index 2721cddef..4422b6f01 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_append_all.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-cellss_append_all.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__cellss_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_cellss_append_all() + * @see f_cellss_append_all() */ -extern void test__f_type_array_cellss_append_all__works(void **state); +extern void test__f_type_array_cellss_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_cellss_append_all() + * @see f_cellss_append_all() */ extern void test__f_type_array_cellss_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_cellss_append_all() + * @see f_cellss_append_all() */ -extern void test__f_type_array_cellss_append_all__parameter_checking(void **state); +extern void test__f_type_array_cellss_append_all__works(void **state); #endif // _TEST__F_type_array__cellss_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-cellss_decimate_by.c index abc400c21..12aebeddf 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_decimate_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-cellss_decimate_by.c @@ -5,11 +5,27 @@ extern "C" { #endif -void test__f_type_array_cellss_decimate_by__works(void **state) { +void test__f_type_array_cellss_decimate_by__parameter_checking(void **state) { const int length = 5; f_cellss_t data = f_cells_t_initialize; + { + const f_status_t status = f_cellss_decimate_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_cellss_decimate_by__returns_data_not(void **state) { + + const int length = 5; + f_cellss_t data = f_cellss_t_initialize; + { const f_status_t status = f_cellss_resize(length, &data); @@ -19,25 +35,33 @@ void test__f_type_array_cellss_decimate_by__works(void **state) { } { - const f_status_t status = f_cellss_decimate_by(length, &data); + const f_status_t status = f_cellss_decimate_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_cellss_decimate_by__parameter_checking(void **state) { +void test__f_type_array_cellss_decimate_by__works(void **state) { const int length = 5; f_cellss_t data = f_cells_t_initialize; { - const f_status_t status = f_cellss_decimate_by(length, 0); + const f_status_t status = f_cellss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_cellss_decimate_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-cellss_decimate_by.h index 3f4382528..a0ea73d4e 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_decimate_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-cellss_decimate_by.h @@ -11,17 +11,24 @@ #define _TEST__F_type_array__cellss_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_cellss_decimate_by() + * @see f_cellss_decimate_by() */ -extern void test__f_type_array_cellss_decimate_by__works(void **state); +extern void test__f_type_array_cellss_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * * @see f_type_array_cellss_decimate_by() */ -extern void test__f_type_array_cellss_decimate_by__parameter_checking(void **state); +extern void test__f_type_array_cellss_decimate_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_cellss_decimate_by() + */ +extern void test__f_type_array_cellss_decimate_by__works(void **state); #endif // _TEST__F_type_array__cellss_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-cellss_decrease_by.c index 8fe429d4a..ae118f0ae 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_decrease_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-cellss_decrease_by.c @@ -5,11 +5,27 @@ extern "C" { #endif -void test__f_type_array_cellss_decrease_by__works(void **state) { +void test__f_type_array_cellss_decrease_by__parameter_checking(void **state) { const int length = 5; f_cellss_t data = f_cells_t_initialize; + { + const f_status_t status = f_cellss_decrease_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_cellss_decrease_by__returns_data_not(void **state) { + + const int length = 5; + f_cellss_t data = f_cellss_t_initialize; + { const f_status_t status = f_cellss_resize(length, &data); @@ -19,25 +35,33 @@ void test__f_type_array_cellss_decrease_by__works(void **state) { } { - const f_status_t status = f_cellss_decrease_by(length, &data); + const f_status_t status = f_cellss_decrease_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_cellss_decrease_by__parameter_checking(void **state) { +void test__f_type_array_cellss_decrease_by__works(void **state) { const int length = 5; f_cellss_t data = f_cells_t_initialize; { - const f_status_t status = f_cellss_decrease_by(length, 0); + const f_status_t status = f_cellss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_cellss_decrease_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-cellss_decrease_by.h index 9b5e4b07a..ead2366ef 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_decrease_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-cellss_decrease_by.h @@ -11,17 +11,24 @@ #define _TEST__F_type_array__cellss_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_cellss_decrease_by() + * @see f_cellss_decrease_by() */ -extern void test__f_type_array_cellss_decrease_by__works(void **state); +extern void test__f_type_array_cellss_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_cellss_decrease_by() + * @see f_cellss_decrease_by() */ -extern void test__f_type_array_cellss_decrease_by__parameter_checking(void **state); +extern void test__f_type_array_cellss_decrease_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_cellss_decrease_by() + */ +extern void test__f_type_array_cellss_decrease_by__works(void **state); #endif // _TEST__F_type_array__cellss_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-cellss_increase.c index 577bd627b..bba4c27f9 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_increase.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-cellss_increase.c @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_cellss_increase__works(void **state) { +void test__f_type_array_cellss_increase__parameter_checking(void **state) { const int length = 5; f_cellss_t data = f_cells_t_initialize; { - const f_status_t status = f_cellss_resize(length, &data); + const f_status_t status = f_cellss_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_cellss_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -55,17 +45,27 @@ void test__f_type_array_cellss_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_cellss_increase__parameter_checking(void **state) { +void test__f_type_array_cellss_increase__works(void **state) { const int length = 5; f_cellss_t data = f_cells_t_initialize; { - const f_status_t status = f_cellss_increase(length, 0); + const f_status_t status = f_cellss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_cellss_increase(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); } free((void *) data.array); diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-cellss_increase.h index 74ca065c7..c0c14b766 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_increase.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-cellss_increase.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__cellss_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_cellss_increase() + * @see f_cellss_increase() */ -extern void test__f_type_array_cellss_increase__works(void **state); +extern void test__f_type_array_cellss_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_cellss_increase() + * @see f_cellss_increase() */ extern void test__f_type_array_cellss_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_cellss_increase() + * @see f_cellss_increase() */ -extern void test__f_type_array_cellss_increase__parameter_checking(void **state); +extern void test__f_type_array_cellss_increase__works(void **state); #endif // _TEST__F_type_array__cellss_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-cellss_increase_by.c index 07e7c3707..2a866d050 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_increase_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-cellss_increase_by.c @@ -5,11 +5,27 @@ extern "C" { #endif -void test__f_type_array_cellss_increase_by__works(void **state) { +void test__f_type_array_cellss_increase_by__parameter_checking(void **state) { const int length = 5; f_cellss_t data = f_cells_t_initialize; + { + const f_status_t status = f_cellss_increase_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_cellss_increase_by__returns_data_not(void **state) { + + const int length = 5; + f_cellss_t data = f_cellss_t_initialize; + { const f_status_t status = f_cellss_resize(length, &data); @@ -19,32 +35,72 @@ void test__f_type_array_cellss_increase_by__works(void **state) { } { - data.used = length; + const f_status_t status = f_cellss_increase_by(0, &data); + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { const f_status_t status = f_cellss_increase_by(length, &data); + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_cell_decrease_by__returns_data_not(void **state) { + + const int length = 5; + f_cellss_t data = f_cellss_t_initialize; + + { + const f_status_t status = f_cellss_resize(length, &data); + assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_cellss_decrease_by(0, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); } free((void *) data.array); } -void test__f_type_array_cellss_increase_by__parameter_checking(void **state) { +void test__f_type_array_cellss_increase_by__works(void **state) { const int length = 5; f_cellss_t data = f_cells_t_initialize; { - const f_status_t status = f_cellss_increase_by(length, 0); + const f_status_t status = f_cellss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + { + data.used = length; + + const f_status_t status = f_cellss_increase_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-cellss_increase_by.h index 9152f1dca..e226bc9f1 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_increase_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-cellss_increase_by.h @@ -11,17 +11,24 @@ #define _TEST__F_type_array__cellss_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_cellss_increase_by() + * @see f_cellss_increase_by() */ -extern void test__f_type_array_cellss_increase_by__works(void **state); +extern void test__f_type_array_cellss_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_cellss_increase_by() + * @see f_cellss_increase_by() */ -extern void test__f_type_array_cellss_increase_by__parameter_checking(void **state); +extern void test__f_type_array_cellss_increase_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_cellss_increase_by() + */ +extern void test__f_type_array_cellss_increase_by__works(void **state); #endif // _TEST__F_type_array__cellss_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-cellss_resize.c index 79fb87520..41d81326d 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_resize.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-cellss_resize.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_cellss_resize__works(void **state) { +void test__f_type_array_cellss_resize__parameter_checking(void **state) { const int length = 5; f_cellss_t data = f_cellss_t_initialize; { - const f_status_t status = f_cellss_resize(length, &data); + const f_status_t status = f_cellss_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_cellss_resize__parameter_checking(void **state) { +void test__f_type_array_cellss_resize__works(void **state) { const int length = 5; f_cellss_t data = f_cellss_t_initialize; { - const f_status_t status = f_cellss_resize(length, 0); + const f_status_t status = f_cellss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-cellss_resize.h index a0977f0c3..c5356f1c0 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-cellss_resize.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-cellss_resize.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__cellss_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_cellss_resize() + * @see f_cellss_resize() */ -extern void test__f_type_array_cellss_resize__works(void **state); +extern void test__f_type_array_cellss_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_cellss_resize() + * @see f_cellss_resize() */ -extern void test__f_type_array_cellss_resize__parameter_checking(void **state); +extern void test__f_type_array_cellss_resize__works(void **state); #endif // _TEST__F_type_array__cellss_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_adjust.c index 658031ed1..62e20eb21 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_adjust.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_adjust.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_fll_ids_adjust__works(void **state) { +void test__f_type_array_fll_ids_adjust__parameter_checking(void **state) { const int length = 5; f_fll_ids_t data = f_fll_ids_t_initialize; { - const f_status_t status = f_fll_ids_adjust(length, &data); + const f_status_t status = f_fll_ids_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_fll_ids_adjust__parameter_checking(void **state) { +void test__f_type_array_fll_ids_adjust__works(void **state) { const int length = 5; f_fll_ids_t data = f_fll_ids_t_initialize; { - const f_status_t status = f_fll_ids_adjust(length, 0); + const f_status_t status = f_fll_ids_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_adjust.h index 486be6fef..93f69b34e 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_adjust.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_adjust.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__fll_ids_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_fll_ids_adjust() + * @see f_fll_ids_adjust() */ -extern void test__f_type_array_fll_ids_adjust__works(void **state); +extern void test__f_type_array_fll_ids_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_fll_ids_adjust() + * @see f_fll_ids_adjust() */ -extern void test__f_type_array_fll_ids_adjust__parameter_checking(void **state); +extern void test__f_type_array_fll_ids_adjust__works(void **state); #endif // _TEST__F_type_array__fll_ids_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_append.c index 880420302..d0905dbdf 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_append.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_append.c @@ -5,6 +5,17 @@ extern "C" { #endif +void test__f_type_array_fll_ids_append__parameter_checking(void **state) { + + const f_fll_id_t data = f_fll_id_t_initialize; + + { + const f_status_t status = f_fll_ids_append(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + void test__f_type_array_fll_ids_append__works(void **state) { const f_fll_id_t source = { .name = "test", .type = 1, .used = 4 }; @@ -23,17 +34,6 @@ void test__f_type_array_fll_ids_append__works(void **state) { free((void *) destination.array); } -void test__f_type_array_fll_ids_append__parameter_checking(void **state) { - - const f_fll_id_t data = f_fll_id_t_initialize; - - { - const f_status_t status = f_fll_ids_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_append.h index a665436d9..01fac847d 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_append.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_append.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__fll_ids_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_fll_ids_append() + * @see f_fll_ids_append() */ -extern void test__f_type_array_fll_ids_append__works(void **state); +extern void test__f_type_array_fll_ids_append__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_fll_ids_append() + * @see f_fll_ids_append() */ -extern void test__f_type_array_fll_ids_append__parameter_checking(void **state); +extern void test__f_type_array_fll_ids_append__works(void **state); #endif // _TEST__F_type_array__fll_ids_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_append_all.c index 1b12eb0ef..c087020b9 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_append_all.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_append_all.c @@ -5,15 +5,23 @@ extern "C" { #endif -void test__f_type_array_fll_ids_append_all__works(void **state) { +void test__f_type_array_fll_ids_append_all__parameter_checking(void **state) { + + const f_fll_ids_t data = f_fll_ids_t_initialize; + + { + const f_status_t status = f_fll_ids_append_all(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +void test__f_type_array_fll_ids_append_all__returns_data_not(void **state) { const int length = 5; f_fll_ids_t source = f_fll_ids_t_initialize; f_fll_ids_t destination = f_fll_ids_t_initialize; - const f_fll_id_t fll_id_0 = { .name = "test", .type = 1, .used = 4 }; - const f_fll_id_t fll_id_1 = { .name = "other", .type = 2, .used = 5 }; - { const f_status_t status = f_fll_ids_resize(length, &source); @@ -22,35 +30,27 @@ void test__f_type_array_fll_ids_append_all__works(void **state) { assert_int_equal(source.size, length); } - memcpy(&source.array[source.used++], (void *) &fll_id_0, sizeof(f_fll_id_t)); - memcpy(&source.array[source.used++], (void *) &fll_id_1, sizeof(f_fll_id_t)); - { const f_status_t status = f_fll_ids_append_all(source, &destination); - assert_int_equal(status, F_none); - assert_int_equal(destination.used, source.used); - assert_int_equal(destination.size, source.used); - - assert_string_equal(destination.array[0].name, fll_id_0.name); - assert_int_equal(destination.array[0].type, fll_id_0.type); - assert_int_equal(destination.array[0].used, fll_id_0.used); - - assert_string_equal(destination.array[1].name, fll_id_1.name); - assert_int_equal(destination.array[1].type, fll_id_1.type); - assert_int_equal(destination.array[1].used, fll_id_1.used); + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + assert_null(destination.array); } free((void *) source.array); - free((void *) destination.array); } -void test__f_type_array_fll_ids_append_all__returns_data_not(void **state) { +void test__f_type_array_fll_ids_append_all__works(void **state) { const int length = 5; f_fll_ids_t source = f_fll_ids_t_initialize; f_fll_ids_t destination = f_fll_ids_t_initialize; + const f_fll_id_t fll_id_0 = { .name = "test", .type = 1, .used = 4 }; + const f_fll_id_t fll_id_1 = { .name = "other", .type = 2, .used = 5 }; + { const f_status_t status = f_fll_ids_resize(length, &source); @@ -59,27 +59,27 @@ void test__f_type_array_fll_ids_append_all__returns_data_not(void **state) { assert_int_equal(source.size, length); } + memcpy(&source.array[source.used++], (void *) &fll_id_0, sizeof(f_fll_id_t)); + memcpy(&source.array[source.used++], (void *) &fll_id_1, sizeof(f_fll_id_t)); + { const f_status_t status = f_fll_ids_append_all(source, &destination); - assert_int_equal(status, F_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); - } - - free((void *) source.array); -} - -void test__f_type_array_fll_ids_append_all__parameter_checking(void **state) { - - const f_fll_ids_t data = f_fll_ids_t_initialize; + assert_int_equal(status, F_none); + assert_int_equal(destination.used, source.used); + assert_int_equal(destination.size, source.used); - { - const f_status_t status = f_fll_ids_append_all(data, 0); + assert_string_equal(destination.array[0].name, fll_id_0.name); + assert_int_equal(destination.array[0].type, fll_id_0.type); + assert_int_equal(destination.array[0].used, fll_id_0.used); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_string_equal(destination.array[1].name, fll_id_1.name); + assert_int_equal(destination.array[1].type, fll_id_1.type); + assert_int_equal(destination.array[1].used, fll_id_1.used); } + + free((void *) source.array); + free((void *) destination.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_append_all.h index 4093df151..a719d829c 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_append_all.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_append_all.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__fll_ids_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_fll_ids_append_all() + * @see f_fll_ids_append_all() */ -extern void test__f_type_array_fll_ids_append_all__works(void **state); +extern void test__f_type_array_fll_ids_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_fll_ids_append_all() + * @see f_fll_ids_append_all() */ extern void test__f_type_array_fll_ids_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_fll_ids_append_all() + * @see f_fll_ids_append_all() */ -extern void test__f_type_array_fll_ids_append_all__parameter_checking(void **state); +extern void test__f_type_array_fll_ids_append_all__works(void **state); #endif // _TEST__F_type_array__fll_ids_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_decimate_by.c index fa796a462..fdc51380a 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_decimate_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_decimate_by.c @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_fll_ids_decimate_by__works(void **state) { +void test__f_type_array_fll_ids_decimate_by__parameter_checking(void **state) { const int length = 5; f_fll_ids_t data = f_fll_ids_t_initialize; { - const f_status_t status = f_fll_ids_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_fll_ids_decimate_by(length, &data); + const f_status_t status = f_fll_ids_decimate_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_fll_ids_decimate_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_fll_ids_decimate_by__parameter_checking(void **state) { +void test__f_type_array_fll_ids_decimate_by__works(void **state) { const int length = 5; f_fll_ids_t data = f_fll_ids_t_initialize; { - const f_status_t status = f_fll_ids_decimate_by(length, 0); + const f_status_t status = f_fll_ids_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_fll_ids_decimate_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_decimate_by.h index cd4471d2e..81a721fe8 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_decimate_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_decimate_by.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__fll_ids_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_fll_ids_decimate_by() + * @see f_fll_ids_decimate_by() */ -extern void test__f_type_array_fll_ids_decimate_by__works(void **state); +extern void test__f_type_array_fll_ids_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_fll_ids_decimate_by() + * @see f_fll_ids_decimate_by() */ -extern void test__f_type_array_fll_ids_decimate_by__parameter_checking(void **state); +extern void test__f_type_array_fll_ids_decimate_by__works(void **state); #endif // _TEST__F_type_array__fll_ids_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_decrease_by.c index a60e13936..a55df2d16 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_decrease_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_decrease_by.c @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_fll_ids_decrease_by__works(void **state) { +void test__f_type_array_fll_ids_decrease_by__parameter_checking(void **state) { const int length = 5; f_fll_ids_t data = f_fll_ids_t_initialize; { - const f_status_t status = f_fll_ids_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_fll_ids_decrease_by(length, &data); + const f_status_t status = f_fll_ids_decrease_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_fll_ids_decrease_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_fll_ids_decrease_by__parameter_checking(void **state) { +void test__f_type_array_fll_ids_decrease_by__works(void **state) { const int length = 5; f_fll_ids_t data = f_fll_ids_t_initialize; { - const f_status_t status = f_fll_ids_decrease_by(length, 0); + const f_status_t status = f_fll_ids_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_fll_ids_decrease_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_decrease_by.h index 9506bcad4..568cd1397 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_decrease_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_decrease_by.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__fll_ids_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_fll_ids_decrease_by() + * @see f_fll_ids_decrease_by() */ -extern void test__f_type_array_fll_ids_decrease_by__works(void **state); +extern void test__f_type_array_fll_ids_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_fll_ids_decrease_by() + * @see f_fll_ids_decrease_by() */ -extern void test__f_type_array_fll_ids_decrease_by__parameter_checking(void **state); +extern void test__f_type_array_fll_ids_decrease_by__works(void **state); #endif // _TEST__F_type_array__fll_ids_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_increase.c index a359f318d..d49fda557 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_increase.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_increase.c @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_fll_ids_increase__works(void **state) { +void test__f_type_array_fll_ids_increase__parameter_checking(void **state) { const int length = 5; f_fll_ids_t data = f_fll_ids_t_initialize; { - const f_status_t status = f_fll_ids_resize(length, &data); + const f_status_t status = f_fll_ids_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_fll_ids_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -55,17 +45,27 @@ void test__f_type_array_fll_ids_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_fll_ids_increase__parameter_checking(void **state) { +void test__f_type_array_fll_ids_increase__works(void **state) { const int length = 5; f_fll_ids_t data = f_fll_ids_t_initialize; { - const f_status_t status = f_fll_ids_increase(length, 0); + const f_status_t status = f_fll_ids_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_fll_ids_increase(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); } free((void *) data.array); diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_increase.h index f5e8d8760..6748abb14 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_increase.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_increase.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__fll_ids_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_fll_ids_increase() + * @see f_fll_ids_increase() */ -extern void test__f_type_array_fll_ids_increase__works(void **state); +extern void test__f_type_array_fll_ids_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_fll_ids_increase() + * @see f_fll_ids_increase() */ extern void test__f_type_array_fll_ids_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_fll_ids_increase() + * @see f_fll_ids_increase() */ -extern void test__f_type_array_fll_ids_increase__parameter_checking(void **state); +extern void test__f_type_array_fll_ids_increase__works(void **state); #endif // _TEST__F_type_array__fll_ids_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_increase_by.c index e3b60b6be..9faef8973 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_increase_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_increase_by.c @@ -5,6 +5,22 @@ extern "C" { #endif +void test__f_type_array_fll_ids_increase_by__parameter_checking(void **state) { + + const int length = 5; + f_fll_ids_t data = f_fll_ids_t_initialize; + + { + const f_status_t status = f_fll_ids_increase_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + void test__f_type_array_fll_ids_increase_by__works(void **state) { const int length = 5; @@ -31,22 +47,6 @@ void test__f_type_array_fll_ids_increase_by__works(void **state) { free((void *) data.array); } -void test__f_type_array_fll_ids_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_fll_ids_t data = f_fll_ids_t_initialize; - - { - const f_status_t status = f_fll_ids_increase_by(length, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_increase_by.h index 159d816f6..c60ae6876 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_increase_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_increase_by.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__fll_ids_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_fll_ids_increase_by() + * @see f_fll_ids_increase_by() */ -extern void test__f_type_array_fll_ids_increase_by__works(void **state); +extern void test__f_type_array_fll_ids_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_fll_ids_increase_by() + * @see f_fll_ids_increase_by() */ -extern void test__f_type_array_fll_ids_increase_by__parameter_checking(void **state); +extern void test__f_type_array_fll_ids_increase_by__works(void **state); #endif // _TEST__F_type_array__fll_ids_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_resize.c index a5b56ed1f..519a625f2 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_resize.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_resize.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_fll_ids_resize__works(void **state) { +void test__f_type_array_fll_ids_resize__parameter_checking(void **state) { const int length = 5; f_fll_ids_t data = f_fll_ids_t_initialize; { - const f_status_t status = f_fll_ids_resize(length, &data); + const f_status_t status = f_fll_ids_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_fll_ids_resize__parameter_checking(void **state) { +void test__f_type_array_fll_ids_resize__works(void **state) { const int length = 5; f_fll_ids_t data = f_fll_ids_t_initialize; { - const f_status_t status = f_fll_ids_resize(length, 0); + const f_status_t status = f_fll_ids_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_resize.h index 7ae4f8408..619b2e14b 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_resize.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-fll_ids_resize.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__fll_ids_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_fll_ids_resize() + * @see f_fll_ids_resize() */ -extern void test__f_type_array_fll_ids_resize__works(void **state); +extern void test__f_type_array_fll_ids_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_fll_ids_resize() + * @see f_fll_ids_resize() */ -extern void test__f_type_array_fll_ids_resize__parameter_checking(void **state); +extern void test__f_type_array_fll_ids_resize__works(void **state); #endif // _TEST__F_type_array__fll_ids_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_adjust.c index 979b56da9..fe2d8ecfb 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_adjust.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_adjust.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_fll_idss_adjust__works(void **state) { +void test__f_type_array_fll_idss_adjust__parameter_checking(void **state) { const int length = 5; f_fll_idss_t data = f_fll_idss_t_initialize; { - const f_status_t status = f_fll_idss_adjust(length, &data); + const f_status_t status = f_fll_idss_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_fll_idss_adjust__parameter_checking(void **state) { +void test__f_type_array_fll_idss_adjust__works(void **state) { const int length = 5; f_fll_idss_t data = f_fll_idss_t_initialize; { - const f_status_t status = f_fll_idss_adjust(length, 0); + const f_status_t status = f_fll_idss_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_adjust.h index 6dfdf9536..8cd03e0ae 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_adjust.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_adjust.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__fll_idss_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_fll_idss_adjust() + * @see f_fll_idss_adjust() */ -extern void test__f_type_array_fll_idss_adjust__works(void **state); +extern void test__f_type_array_fll_idss_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_fll_idss_adjust() + * @see f_fll_idss_adjust() */ -extern void test__f_type_array_fll_idss_adjust__parameter_checking(void **state); +extern void test__f_type_array_fll_idss_adjust__works(void **state); #endif // _TEST__F_type_array__fll_idss_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_append.c index a08c60404..6f86af936 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_append.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_append.c @@ -5,6 +5,43 @@ extern "C" { #endif +void test__f_type_array_fll_idss_append__parameter_checking(void **state) { + + f_fll_ids_t data = f_fll_ids_t_initialize; + + { + const f_status_t status = f_fll_idss_append(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +void test__f_type_array_fll_idss_append__returns_data_not(void **state) { + + const int length = 5; + f_fll_ids_t source = f_fll_idss_t_initialize; + f_fll_idss_t destination = f_fll_idss_t_initialize; + + { + const f_status_t status = f_fll_ids_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + { + const f_status_t status = f_fll_idss_append(source, &destination); + + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + assert_null(destination.array); + } + + free((void *) source.array); +} + void test__f_type_array_fll_idss_append__works(void **state) { const int length = 5; @@ -49,43 +86,6 @@ void test__f_type_array_fll_idss_append__works(void **state) { free((void *) destination.array); } -void test__f_type_array_fll_idss_append__returns_data_not(void **state) { - - const int length = 5; - f_fll_ids_t source = f_fll_idss_t_initialize; - f_fll_idss_t destination = f_fll_idss_t_initialize; - - { - const f_status_t status = f_fll_ids_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_fll_idss_append(source, &destination); - - assert_int_equal(status, F_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); - } - - free((void *) source.array); -} - -void test__f_type_array_fll_idss_append__parameter_checking(void **state) { - - f_fll_ids_t data = f_fll_ids_t_initialize; - - { - const f_status_t status = f_fll_idss_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_append.h index 9cbc569fb..3c6d390e5 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_append.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_append.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__fll_idss_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_fll_idss_append() + * @see f_fll_idss_append() */ -extern void test__f_type_array_fll_idss_append__works(void **state); +extern void test__f_type_array_fll_idss_append__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_fll_idss_append() + * @see f_fll_idss_append() */ extern void test__f_type_array_fll_idss_append__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_fll_idss_append() + * @see f_fll_idss_append() */ -extern void test__f_type_array_fll_idss_append__parameter_checking(void **state); +extern void test__f_type_array_fll_idss_append__works(void **state); #endif // _TEST__F_type_array__fll_idss_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_append_all.c index 774d9c716..868bdce9b 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_append_all.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_append_all.c @@ -5,6 +5,43 @@ extern "C" { #endif +void test__f_type_array_fll_idss_append_all__parameter_checking(void **state) { + + const f_fll_idss_t data = f_fll_idss_t_initialize; + + { + const f_status_t status = f_fll_idss_append_all(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +void test__f_type_array_fll_idss_append_all__returns_data_not(void **state) { + + const int length = 5; + f_fll_idss_t source = f_fll_idss_t_initialize; + f_fll_idss_t destination = f_fll_idss_t_initialize; + + { + const f_status_t status = f_fll_idss_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + { + const f_status_t status = f_fll_idss_append_all(source, &destination); + + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + assert_null(destination.array); + } + + free((void *) source.array); +} + void test__f_type_array_fll_idss_append_all__works(void **state) { const int length = 5; @@ -69,43 +106,6 @@ void test__f_type_array_fll_idss_append_all__works(void **state) { free((void *) destination.array); } -void test__f_type_array_fll_idss_append_all__returns_data_not(void **state) { - - const int length = 5; - f_fll_idss_t source = f_fll_idss_t_initialize; - f_fll_idss_t destination = f_fll_idss_t_initialize; - - { - const f_status_t status = f_fll_idss_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_fll_idss_append_all(source, &destination); - - assert_int_equal(status, F_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); - } - - free((void *) source.array); -} - -void test__f_type_array_fll_idss_append_all__parameter_checking(void **state) { - - const f_fll_idss_t data = f_fll_idss_t_initialize; - - { - const f_status_t status = f_fll_idss_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_append_all.h index baa023d90..2bd8ad63d 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_append_all.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_append_all.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__fll_idss_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_fll_idss_append_all() + * @see f_fll_idss_append_all() */ -extern void test__f_type_array_fll_idss_append_all__works(void **state); +extern void test__f_type_array_fll_idss_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_fll_idss_append_all() + * @see f_fll_idss_append_all() */ extern void test__f_type_array_fll_idss_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_fll_idss_append_all() + * @see f_fll_idss_append_all() */ -extern void test__f_type_array_fll_idss_append_all__parameter_checking(void **state); +extern void test__f_type_array_fll_idss_append_all__works(void **state); #endif // _TEST__F_type_array__fll_idss_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_decimate_by.c index 168f7d428..14a0083e1 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_decimate_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_decimate_by.c @@ -5,11 +5,27 @@ extern "C" { #endif -void test__f_type_array_fll_idss_decimate_by__works(void **state) { +void test__f_type_array_fll_idss_decimate_by__parameter_checking(void **state) { const int length = 5; f_fll_idss_t data = f_fll_ids_t_initialize; + { + const f_status_t status = f_fll_idss_decimate_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_fll_idss_decimate_by__returns_data_not(void **state) { + + const int length = 5; + f_fll_idss_t data = f_fll_idss_t_initialize; + { const f_status_t status = f_fll_idss_resize(length, &data); @@ -19,25 +35,33 @@ void test__f_type_array_fll_idss_decimate_by__works(void **state) { } { - const f_status_t status = f_fll_idss_decimate_by(length, &data); + const f_status_t status = f_fll_idss_decimate_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_fll_idss_decimate_by__parameter_checking(void **state) { +void test__f_type_array_fll_idss_decimate_by__works(void **state) { const int length = 5; f_fll_idss_t data = f_fll_ids_t_initialize; { - const f_status_t status = f_fll_idss_decimate_by(length, 0); + const f_status_t status = f_fll_idss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_fll_idss_decimate_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_decimate_by.h index c4edbe325..004145e5b 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_decimate_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_decimate_by.h @@ -11,17 +11,24 @@ #define _TEST__F_type_array__fll_idss_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_fll_idss_decimate_by() + * @see f_fll_idss_decimate_by() */ -extern void test__f_type_array_fll_idss_decimate_by__works(void **state); +extern void test__f_type_array_fll_idss_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * * @see f_type_array_fll_idss_decimate_by() */ -extern void test__f_type_array_fll_idss_decimate_by__parameter_checking(void **state); +extern void test__f_type_array_fll_idss_decimate_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_fll_idss_decimate_by() + */ +extern void test__f_type_array_fll_idss_decimate_by__works(void **state); #endif // _TEST__F_type_array__fll_idss_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_decrease_by.c index 3f7f82667..bd7a7d5fe 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_decrease_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_decrease_by.c @@ -5,11 +5,27 @@ extern "C" { #endif -void test__f_type_array_fll_idss_decrease_by__works(void **state) { +void test__f_type_array_fll_idss_decrease_by__parameter_checking(void **state) { const int length = 5; f_fll_idss_t data = f_fll_ids_t_initialize; + { + const f_status_t status = f_fll_idss_decrease_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_fll_idss_decrease_by__returns_data_not(void **state) { + + const int length = 5; + f_fll_idss_t data = f_fll_idss_t_initialize; + { const f_status_t status = f_fll_idss_resize(length, &data); @@ -19,25 +35,33 @@ void test__f_type_array_fll_idss_decrease_by__works(void **state) { } { - const f_status_t status = f_fll_idss_decrease_by(length, &data); + const f_status_t status = f_fll_idss_decrease_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_fll_idss_decrease_by__parameter_checking(void **state) { +void test__f_type_array_fll_idss_decrease_by__works(void **state) { const int length = 5; f_fll_idss_t data = f_fll_ids_t_initialize; { - const f_status_t status = f_fll_idss_decrease_by(length, 0); + const f_status_t status = f_fll_idss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_fll_idss_decrease_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_decrease_by.h index 35a43c333..ccca0acc7 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_decrease_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_decrease_by.h @@ -11,17 +11,24 @@ #define _TEST__F_type_array__fll_idss_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_fll_idss_decrease_by() + * @see f_fll_idss_decrease_by() */ -extern void test__f_type_array_fll_idss_decrease_by__works(void **state); +extern void test__f_type_array_fll_idss_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_fll_idss_decrease_by() + * @see f_fll_idss_decrease_by() */ -extern void test__f_type_array_fll_idss_decrease_by__parameter_checking(void **state); +extern void test__f_type_array_fll_idss_decrease_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_fll_idss_decrease_by() + */ +extern void test__f_type_array_fll_idss_decrease_by__works(void **state); #endif // _TEST__F_type_array__fll_idss_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_increase.c index d7e5a57a8..a6ac66860 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_increase.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_increase.c @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_fll_idss_increase__works(void **state) { +void test__f_type_array_fll_idss_increase__parameter_checking(void **state) { const int length = 5; f_fll_idss_t data = f_fll_ids_t_initialize; { - const f_status_t status = f_fll_idss_resize(length, &data); + const f_status_t status = f_fll_idss_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_fll_idss_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -55,17 +45,27 @@ void test__f_type_array_fll_idss_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_fll_idss_increase__parameter_checking(void **state) { +void test__f_type_array_fll_idss_increase__works(void **state) { const int length = 5; f_fll_idss_t data = f_fll_ids_t_initialize; { - const f_status_t status = f_fll_idss_increase(length, 0); + const f_status_t status = f_fll_idss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_fll_idss_increase(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); } free((void *) data.array); diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_increase.h index 358ba3e86..50b431c1b 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_increase.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_increase.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__fll_idss_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_fll_idss_increase() + * @see f_fll_idss_increase() */ -extern void test__f_type_array_fll_idss_increase__works(void **state); +extern void test__f_type_array_fll_idss_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_fll_idss_increase() + * @see f_fll_idss_increase() */ extern void test__f_type_array_fll_idss_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_fll_idss_increase() + * @see f_fll_idss_increase() */ -extern void test__f_type_array_fll_idss_increase__parameter_checking(void **state); +extern void test__f_type_array_fll_idss_increase__works(void **state); #endif // _TEST__F_type_array__fll_idss_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_increase_by.c index 05ba92e35..523a85258 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_increase_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_increase_by.c @@ -5,11 +5,27 @@ extern "C" { #endif -void test__f_type_array_fll_idss_increase_by__works(void **state) { +void test__f_type_array_fll_idss_increase_by__parameter_checking(void **state) { const int length = 5; f_fll_idss_t data = f_fll_ids_t_initialize; + { + const f_status_t status = f_fll_idss_increase_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_fll_idss_increase_by__returns_data_not(void **state) { + + const int length = 5; + f_fll_idss_t data = f_fll_idss_t_initialize; + { const f_status_t status = f_fll_idss_resize(length, &data); @@ -19,32 +35,48 @@ void test__f_type_array_fll_idss_increase_by__works(void **state) { } { - data.used = length; + const f_status_t status = f_fll_idss_increase_by(0, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + { const f_status_t status = f_fll_idss_increase_by(length, &data); - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); } free((void *) data.array); } -void test__f_type_array_fll_idss_increase_by__parameter_checking(void **state) { +void test__f_type_array_fll_idss_increase_by__works(void **state) { const int length = 5; f_fll_idss_t data = f_fll_ids_t_initialize; { - const f_status_t status = f_fll_idss_increase_by(length, 0); + const f_status_t status = f_fll_idss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + { + data.used = length; + + const f_status_t status = f_fll_idss_increase_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_increase_by.h index cf8687e95..e97fe418d 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_increase_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_increase_by.h @@ -11,17 +11,24 @@ #define _TEST__F_type_array__fll_idss_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_fll_idss_increase_by() + * @see f_fll_idss_increase_by() */ -extern void test__f_type_array_fll_idss_increase_by__works(void **state); +extern void test__f_type_array_fll_idss_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_fll_idss_increase_by() + * @see f_fll_idss_increase_by() */ -extern void test__f_type_array_fll_idss_increase_by__parameter_checking(void **state); +extern void test__f_type_array_fll_idss_increase_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_fll_idss_increase_by() + */ +extern void test__f_type_array_fll_idss_increase_by__works(void **state); #endif // _TEST__F_type_array__fll_idss_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_resize.c index e0891ee1d..5b031af40 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_resize.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_resize.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_fll_idss_resize__works(void **state) { +void test__f_type_array_fll_idss_resize__parameter_checking(void **state) { const int length = 5; f_fll_idss_t data = f_fll_idss_t_initialize; { - const f_status_t status = f_fll_idss_resize(length, &data); + const f_status_t status = f_fll_idss_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_fll_idss_resize__parameter_checking(void **state) { +void test__f_type_array_fll_idss_resize__works(void **state) { const int length = 5; f_fll_idss_t data = f_fll_idss_t_initialize; { - const f_status_t status = f_fll_idss_resize(length, 0); + const f_status_t status = f_fll_idss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_resize.h index 42840151f..5c2ca18f5 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_resize.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-fll_idss_resize.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__fll_idss_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_fll_idss_resize() + * @see f_fll_idss_resize() */ -extern void test__f_type_array_fll_idss_resize__works(void **state); +extern void test__f_type_array_fll_idss_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_fll_idss_resize() + * @see f_fll_idss_resize() */ -extern void test__f_type_array_fll_idss_resize__parameter_checking(void **state); +extern void test__f_type_array_fll_idss_resize__works(void **state); #endif // _TEST__F_type_array__fll_idss_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_adjust.c index 3463b16b5..eb2f97d4c 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_adjust.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_adjust.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_int128s_adjust__works(void **state) { +void test__f_type_array_int128s_adjust__parameter_checking(void **state) { const int length = 5; f_int128s_t data = f_int128s_t_initialize; { - const f_status_t status = f_int128s_adjust(length, &data); + const f_status_t status = f_int128s_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_int128s_adjust__parameter_checking(void **state) { +void test__f_type_array_int128s_adjust__works(void **state) { const int length = 5; f_int128s_t data = f_int128s_t_initialize; { - const f_status_t status = f_int128s_adjust(length, 0); + const f_status_t status = f_int128s_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_adjust.h index 467b52224..8d86069fe 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_adjust.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_adjust.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int128s_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int128s_adjust() + * @see f_int128s_adjust() */ -extern void test__f_type_array_int128s_adjust__works(void **state); +extern void test__f_type_array_int128s_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int128s_adjust() + * @see f_int128s_adjust() */ -extern void test__f_type_array_int128s_adjust__parameter_checking(void **state); +extern void test__f_type_array_int128s_adjust__works(void **state); #endif // _TEST__F_type_array__int128s_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_append.c index b90596457..239ecb649 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_append.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_append.c @@ -5,6 +5,17 @@ extern "C" { #endif +void test__f_type_array_int128s_append__parameter_checking(void **state) { + + const int128_t data = 0; + + { + const f_status_t status = f_int128s_append(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + void test__f_type_array_int128s_append__works(void **state) { const int128_t source = 3; @@ -21,17 +32,6 @@ void test__f_type_array_int128s_append__works(void **state) { free((void *) destination.array); } -void test__f_type_array_int128s_append__parameter_checking(void **state) { - - const uint128_t data = 0; - - { - const f_status_t status = f_int128s_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_append.h index 0ad1cba9e..96725243d 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_append.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_append.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int128s_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int128s_append() + * @see f_int128s_append() */ -extern void test__f_type_array_int128s_append__works(void **state); +extern void test__f_type_array_int128s_append__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int128s_append() + * @see f_int128s_append() */ -extern void test__f_type_array_int128s_append__parameter_checking(void **state); +extern void test__f_type_array_int128s_append__works(void **state); #endif // _TEST__F_type_array__int128s_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_append_all.c index 281f2077a..6bc5aa0d7 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_append_all.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_append_all.c @@ -5,10 +5,20 @@ extern "C" { #endif -void test__f_type_array_int128s_append_all__works(void **state) { +void test__f_type_array_int128s_append_all__parameter_checking(void **state) { + + const f_int128s_t data = f_int128s_t_initialize; + + { + const f_status_t status = f_int128s_append_all(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +void test__f_type_array_int128s_append_all__returns_data_not(void **state) { const int length = 5; - const int length_used = 2; f_int128s_t source = f_int128s_t_initialize; f_int128s_t destination = f_int128s_t_initialize; @@ -20,29 +30,22 @@ void test__f_type_array_int128s_append_all__works(void **state) { assert_int_equal(source.size, length); } - for (; source.used < length_used; ++source.used) { - source.array[source.used] = source.used + 1; - } // for - { const f_status_t status = f_int128s_append_all(source, &destination); - assert_int_equal(status, F_none); - assert_int_equal(destination.used, source.used); - assert_int_equal(destination.size, source.used); - - for (f_array_length_t i = 0; i < source.used; ++i) { - assert_int_equal(destination.array[i], i + 1); - } // for + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + assert_null(destination.array); } free((void *) source.array); - free((void *) destination.array); } -void test__f_type_array_int128s_append_all__returns_data_not(void **state) { +void test__f_type_array_int128s_append_all__works(void **state) { const int length = 5; + const int length_used = 2; f_int128s_t source = f_int128s_t_initialize; f_int128s_t destination = f_int128s_t_initialize; @@ -54,27 +57,24 @@ void test__f_type_array_int128s_append_all__returns_data_not(void **state) { assert_int_equal(source.size, length); } + for (; source.used < length_used; ++source.used) { + source.array[source.used] = source.used + 1; + } // for + { const f_status_t status = f_int128s_append_all(source, &destination); - assert_int_equal(status, F_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); + assert_int_equal(status, F_none); + assert_int_equal(destination.used, source.used); + assert_int_equal(destination.size, source.used); + + for (f_array_length_t i = 0; i < source.used; ++i) { + assert_int_equal(destination.array[i], i + 1); + } // for } free((void *) source.array); -} - -void test__f_type_array_int128s_append_all__parameter_checking(void **state) { - - const f_int128s_t data = f_int128s_t_initialize; - - { - const f_status_t status = f_int128s_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } + free((void *) destination.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_append_all.h index a63f610cc..17e6a573b 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_append_all.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_append_all.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__int128s_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int128s_append_all() + * @see f_int128s_append_all() */ -extern void test__f_type_array_int128s_append_all__works(void **state); +extern void test__f_type_array_int128s_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_int128s_append_all() + * @see f_int128s_append_all() */ extern void test__f_type_array_int128s_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int128s_append_all() + * @see f_int128s_append_all() */ -extern void test__f_type_array_int128s_append_all__parameter_checking(void **state); +extern void test__f_type_array_int128s_append_all__works(void **state); #endif // _TEST__F_type_array__int128s_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_decimate_by.c index f9276b00c..3d4ed9136 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_decimate_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_decimate_by.c @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_int128s_decimate_by__works(void **state) { +void test__f_type_array_int128s_decimate_by__parameter_checking(void **state) { const int length = 5; f_int128s_t data = f_int128s_t_initialize; { - const f_status_t status = f_int128s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int128s_decimate_by(length, &data); + const f_status_t status = f_int128s_decimate_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_int128s_decimate_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_int128s_decimate_by__parameter_checking(void **state) { +void test__f_type_array_int128s_decimate_by__works(void **state) { const int length = 5; f_int128s_t data = f_int128s_t_initialize; { - const f_status_t status = f_int128s_decimate_by(length, 0); + const f_status_t status = f_int128s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_int128s_decimate_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_decimate_by.h index 27c95e5b2..62689ba69 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_decimate_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_decimate_by.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int128s_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int128s_decimate_by() + * @see f_int128s_decimate_by() */ -extern void test__f_type_array_int128s_decimate_by__works(void **state); +extern void test__f_type_array_int128s_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int128s_decimate_by() + * @see f_int128s_decimate_by() */ -extern void test__f_type_array_int128s_decimate_by__parameter_checking(void **state); +extern void test__f_type_array_int128s_decimate_by__works(void **state); #endif // _TEST__F_type_array__int128s_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_decrease_by.c index af81902b4..bc7831ba7 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_decrease_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_decrease_by.c @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_int128s_decrease_by__works(void **state) { +void test__f_type_array_int128s_decrease_by__parameter_checking(void **state) { const int length = 5; f_int128s_t data = f_int128s_t_initialize; { - const f_status_t status = f_int128s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int128s_decrease_by(length, &data); + const f_status_t status = f_int128s_decrease_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_int128s_decrease_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_int128s_decrease_by__parameter_checking(void **state) { +void test__f_type_array_int128s_decrease_by__works(void **state) { const int length = 5; f_int128s_t data = f_int128s_t_initialize; { - const f_status_t status = f_int128s_decrease_by(length, 0); + const f_status_t status = f_int128s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_int128s_decrease_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_decrease_by.h index 614d3b554..3dd881a59 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_decrease_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_decrease_by.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int128s_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int128s_decrease_by() + * @see f_int128s_decrease_by() */ -extern void test__f_type_array_int128s_decrease_by__works(void **state); +extern void test__f_type_array_int128s_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int128s_decrease_by() + * @see f_int128s_decrease_by() */ -extern void test__f_type_array_int128s_decrease_by__parameter_checking(void **state); +extern void test__f_type_array_int128s_decrease_by__works(void **state); #endif // _TEST__F_type_array__int128s_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_increase.c index 35aa7add7..9a4e4254e 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_increase.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_increase.c @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_int128s_increase__works(void **state) { +void test__f_type_array_int128s_increase__parameter_checking(void **state) { const int length = 5; f_int128s_t data = f_int128s_t_initialize; { - const f_status_t status = f_int128s_resize(length, &data); + const f_status_t status = f_int128s_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_int128s_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -55,17 +45,27 @@ void test__f_type_array_int128s_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_int128s_increase__parameter_checking(void **state) { +void test__f_type_array_int128s_increase__works(void **state) { const int length = 5; f_int128s_t data = f_int128s_t_initialize; { - const f_status_t status = f_int128s_increase(length, 0); + const f_status_t status = f_int128s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_int128s_increase(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); } free((void *) data.array); diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_increase.h index daf6bdba0..cb7cce330 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_increase.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_increase.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__int128s_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int128s_increase() + * @see f_int128s_increase() */ -extern void test__f_type_array_int128s_increase__works(void **state); +extern void test__f_type_array_int128s_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_int128s_increase() + * @see f_int128s_increase() */ extern void test__f_type_array_int128s_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int128s_increase() + * @see f_int128s_increase() */ -extern void test__f_type_array_int128s_increase__parameter_checking(void **state); +extern void test__f_type_array_int128s_increase__works(void **state); #endif // _TEST__F_type_array__int128s_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_increase_by.c index 37583da8a..059d196bb 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_increase_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_increase_by.c @@ -5,6 +5,22 @@ extern "C" { #endif +void test__f_type_array_int128s_increase_by__parameter_checking(void **state) { + + const int length = 5; + f_int128s_t data = f_int128s_t_initialize; + + { + const f_status_t status = f_int128s_increase_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + void test__f_type_array_int128s_increase_by__works(void **state) { const int length = 5; @@ -31,22 +47,6 @@ void test__f_type_array_int128s_increase_by__works(void **state) { free((void *) data.array); } -void test__f_type_array_int128s_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_int128s_t data = f_int128s_t_initialize; - - { - const f_status_t status = f_int128s_increase_by(length, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_increase_by.h index b1c35bf91..77c8b26d2 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_increase_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_increase_by.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int128s_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int128s_increase_by() + * @see f_int128s_increase_by() */ -extern void test__f_type_array_int128s_increase_by__works(void **state); +extern void test__f_type_array_int128s_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int128s_increase_by() + * @see f_int128s_increase_by() */ -extern void test__f_type_array_int128s_increase_by__parameter_checking(void **state); +extern void test__f_type_array_int128s_increase_by__works(void **state); #endif // _TEST__F_type_array__int128s_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_resize.c index 19b6c1367..092258de2 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_resize.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_resize.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_int128s_resize__works(void **state) { +void test__f_type_array_int128s_resize__parameter_checking(void **state) { const int length = 5; f_int128s_t data = f_int128s_t_initialize; { - const f_status_t status = f_int128s_resize(length, &data); + const f_status_t status = f_int128s_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_int128s_resize__parameter_checking(void **state) { +void test__f_type_array_int128s_resize__works(void **state) { const int length = 5; f_int128s_t data = f_int128s_t_initialize; { - const f_status_t status = f_int128s_resize(length, 0); + const f_status_t status = f_int128s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_resize.h index 4d4c60dcd..211b6d548 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128s_resize.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128s_resize.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int128s_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int128s_resize() + * @see f_int128s_resize() */ -extern void test__f_type_array_int128s_resize__works(void **state); +extern void test__f_type_array_int128s_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int128s_resize() + * @see f_int128s_resize() */ -extern void test__f_type_array_int128s_resize__parameter_checking(void **state); +extern void test__f_type_array_int128s_resize__works(void **state); #endif // _TEST__F_type_array__int128s_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_adjust.c index 7bdd2832c..7ad575ab2 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_adjust.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_adjust.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_int128ss_adjust__works(void **state) { +void test__f_type_array_int128ss_adjust__parameter_checking(void **state) { const int length = 5; f_int128ss_t data = f_int128ss_t_initialize; { - const f_status_t status = f_int128ss_adjust(length, &data); + const f_status_t status = f_int128ss_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_int128ss_adjust__parameter_checking(void **state) { +void test__f_type_array_int128ss_adjust__works(void **state) { const int length = 5; f_int128ss_t data = f_int128ss_t_initialize; { - const f_status_t status = f_int128ss_adjust(length, 0); + const f_status_t status = f_int128ss_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_adjust.h index 21c0fa848..3f90bfe3d 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_adjust.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_adjust.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int128ss_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int128ss_adjust() + * @see f_int128ss_adjust() */ -extern void test__f_type_array_int128ss_adjust__works(void **state); +extern void test__f_type_array_int128ss_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int128ss_adjust() + * @see f_int128ss_adjust() */ -extern void test__f_type_array_int128ss_adjust__parameter_checking(void **state); +extern void test__f_type_array_int128ss_adjust__works(void **state); #endif // _TEST__F_type_array__int128ss_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_append.c index c67b66d78..47f6e330b 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_append.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_append.c @@ -5,7 +5,18 @@ extern "C" { #endif -void test__f_type_array_int128ss_append__works(void **state) { +void test__f_type_array_int128ss_append__parameter_checking(void **state) { + + f_int128s_t data = f_int128s_t_initialize; + + { + const f_status_t status = f_int128ss_append(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +void test__f_type_array_int128ss_append__returns_data_not(void **state) { const int length = 5; f_int128s_t source = f_int128s_t_initialize; @@ -19,32 +30,19 @@ void test__f_type_array_int128ss_append__works(void **state) { assert_int_equal(source.size, length); } - for (; source.used < length; ++source.used) { - source.array[source.used] = source.used + 1; - } // for - { const f_status_t status = f_int128ss_append(source, &destination); - assert_int_equal(status, F_none); - assert_int_equal(destination.used, 1); - assert_int_equal(destination.array[0].used, source.used); - assert_int_equal(destination.array[0].size, source.used); - - for (f_array_length_t i = 0; i < destination.array[0].used; ++i) { - assert_int_equal(destination.array[0].array[i], i + 1); - } // for + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + assert_null(destination.array); } - for (f_array_length_t i = 0; i < destination.used; ++i) { - free((void *) destination.array[i].array); - } // for - free((void *) source.array); - free((void *) destination.array); } -void test__f_type_array_int128ss_append__returns_data_not(void **state) { +void test__f_type_array_int128ss_append__works(void **state) { const int length = 5; f_int128s_t source = f_int128s_t_initialize; @@ -58,27 +56,29 @@ void test__f_type_array_int128ss_append__returns_data_not(void **state) { assert_int_equal(source.size, length); } + for (; source.used < length; ++source.used) { + source.array[source.used] = source.used + 1; + } // for + { const f_status_t status = f_int128ss_append(source, &destination); - assert_int_equal(status, F_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); - } - - free((void *) source.array); -} - -void test__f_type_array_int128ss_append__parameter_checking(void **state) { + assert_int_equal(status, F_none); + assert_int_equal(destination.used, 1); + assert_int_equal(destination.array[0].used, source.used); + assert_int_equal(destination.array[0].size, source.used); - f_int128s_t data = f_int128s_t_initialize; + for (f_array_length_t i = 0; i < destination.array[0].used; ++i) { + assert_int_equal(destination.array[0].array[i], i + 1); + } // for + } - { - const f_status_t status = f_int128ss_append(data, 0); + for (f_array_length_t i = 0; i < destination.used; ++i) { + free((void *) destination.array[i].array); + } // for - assert_int_equal(status, F_status_set_error(F_parameter)); - } + free((void *) source.array); + free((void *) destination.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_append.h index e27c02588..3196ce413 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_append.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_append.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__int128ss_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int128ss_append() + * @see f_int128ss_append() */ -extern void test__f_type_array_int128ss_append__works(void **state); +extern void test__f_type_array_int128ss_append__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_int128ss_append() + * @see f_int128ss_append() */ extern void test__f_type_array_int128ss_append__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int128ss_append() + * @see f_int128ss_append() */ -extern void test__f_type_array_int128ss_append__parameter_checking(void **state); +extern void test__f_type_array_int128ss_append__works(void **state); #endif // _TEST__F_type_array__int128ss_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_append_all.c index 26f33bc96..f793a6353 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_append_all.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_append_all.c @@ -5,6 +5,43 @@ extern "C" { #endif +void test__f_type_array_int128ss_append_all__parameter_checking(void **state) { + + const f_int128ss_t data = f_int128ss_t_initialize; + + { + const f_status_t status = f_int128ss_append_all(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +void test__f_type_array_int128ss_append_all__returns_data_not(void **state) { + + const int length = 5; + f_int128ss_t source = f_int128ss_t_initialize; + f_int128ss_t destination = f_int128ss_t_initialize; + + { + const f_status_t status = f_int128ss_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + { + const f_status_t status = f_int128ss_append_all(source, &destination); + + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + assert_null(destination.array); + } + + free((void *) source.array); +} + void test__f_type_array_int128ss_append_all__works(void **state) { const int length = 5; @@ -63,43 +100,6 @@ void test__f_type_array_int128ss_append_all__works(void **state) { free((void *) destination.array); } -void test__f_type_array_int128ss_append_all__returns_data_not(void **state) { - - const int length = 5; - f_int128ss_t source = f_int128ss_t_initialize; - f_int128ss_t destination = f_int128ss_t_initialize; - - { - const f_status_t status = f_int128ss_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_int128ss_append_all(source, &destination); - - assert_int_equal(status, F_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); - } - - free((void *) source.array); -} - -void test__f_type_array_int128ss_append_all__parameter_checking(void **state) { - - const f_int128ss_t data = f_int128ss_t_initialize; - - { - const f_status_t status = f_int128ss_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_append_all.h index 8c0339f22..94a98744d 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_append_all.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_append_all.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__int128ss_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int128ss_append_all() + * @see f_int128ss_append_all() */ -extern void test__f_type_array_int128ss_append_all__works(void **state); +extern void test__f_type_array_int128ss_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_int128ss_append_all() + * @see f_int128ss_append_all() */ extern void test__f_type_array_int128ss_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int128ss_append_all() + * @see f_int128ss_append_all() */ -extern void test__f_type_array_int128ss_append_all__parameter_checking(void **state); +extern void test__f_type_array_int128ss_append_all__works(void **state); #endif // _TEST__F_type_array__int128ss_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_decimate_by.c index 1a6c370a2..e46fc9e26 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_decimate_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_decimate_by.c @@ -5,10 +5,26 @@ extern "C" { #endif -void test__f_type_array_int128ss_decimate_by__works(void **state) { +void test__f_type_array_int128ss_decimate_by__parameter_checking(void **state) { + + const int length = 5; + f_int128ss_t data = f_int128ss_t_initialize; + + { + const f_status_t status = f_int128ss_decimate_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_int128ss_decimate_by__returns_data_not(void **state) { const int length = 5; - f_int128ss_t data = f_int128s_t_initialize; + f_int128ss_t data = f_int128ss_t_initialize; { const f_status_t status = f_int128ss_resize(length, &data); @@ -19,25 +35,33 @@ void test__f_type_array_int128ss_decimate_by__works(void **state) { } { - const f_status_t status = f_int128ss_decimate_by(length, &data); + const f_status_t status = f_int128ss_decimate_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_int128ss_decimate_by__parameter_checking(void **state) { +void test__f_type_array_int128ss_decimate_by__works(void **state) { const int length = 5; - f_int128ss_t data = f_int128s_t_initialize; + f_int128ss_t data = f_int128ss_t_initialize; { - const f_status_t status = f_int128ss_decimate_by(length, 0); + const f_status_t status = f_int128ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_int128ss_decimate_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_decimate_by.h index b4a36479c..ebd4ad515 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_decimate_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_decimate_by.h @@ -11,17 +11,24 @@ #define _TEST__F_type_array__int128ss_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int128ss_decimate_by() + * @see f_int128ss_decimate_by() */ -extern void test__f_type_array_int128ss_decimate_by__works(void **state); +extern void test__f_type_array_int128ss_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * * @see f_type_array_int128ss_decimate_by() */ -extern void test__f_type_array_int128ss_decimate_by__parameter_checking(void **state); +extern void test__f_type_array_int128ss_decimate_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_int128ss_decimate_by() + */ +extern void test__f_type_array_int128ss_decimate_by__works(void **state); #endif // _TEST__F_type_array__int128ss_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_decrease_by.c index a8ac1f498..62b909e32 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_decrease_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_decrease_by.c @@ -5,10 +5,26 @@ extern "C" { #endif -void test__f_type_array_int128ss_decrease_by__works(void **state) { +void test__f_type_array_int128ss_decrease_by__parameter_checking(void **state) { + + const int length = 5; + f_int128ss_t data = f_int128ss_t_initialize; + + { + const f_status_t status = f_int128ss_decrease_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_int128ss_decrease_by__returns_data_not(void **state) { const int length = 5; - f_int128ss_t data = f_int128s_t_initialize; + f_int128ss_t data = f_int128ss_t_initialize; { const f_status_t status = f_int128ss_resize(length, &data); @@ -19,25 +35,33 @@ void test__f_type_array_int128ss_decrease_by__works(void **state) { } { - const f_status_t status = f_int128ss_decrease_by(length, &data); + const f_status_t status = f_int128ss_decrease_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_int128ss_decrease_by__parameter_checking(void **state) { +void test__f_type_array_int128ss_decrease_by__works(void **state) { const int length = 5; - f_int128ss_t data = f_int128s_t_initialize; + f_int128ss_t data = f_int128ss_t_initialize; { - const f_status_t status = f_int128ss_decrease_by(length, 0); + const f_status_t status = f_int128ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_int128ss_decrease_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_decrease_by.h index f7f4da9c2..324a4b2f1 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_decrease_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_decrease_by.h @@ -11,17 +11,24 @@ #define _TEST__F_type_array__int128ss_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int128ss_decrease_by() + * @see f_int128ss_decrease_by() */ -extern void test__f_type_array_int128ss_decrease_by__works(void **state); +extern void test__f_type_array_int128ss_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_int128ss_decrease_by() + * @see f_int128ss_decrease_by() */ -extern void test__f_type_array_int128ss_decrease_by__parameter_checking(void **state); +extern void test__f_type_array_int128ss_decrease_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_int128ss_decrease_by() + */ +extern void test__f_type_array_int128ss_decrease_by__works(void **state); #endif // _TEST__F_type_array__int128ss_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_increase.c index d0cfcc1cc..048b4617f 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_increase.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_increase.c @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_int128ss_increase__works(void **state) { +void test__f_type_array_int128ss_increase__parameter_checking(void **state) { const int length = 5; - f_int128ss_t data = f_int128s_t_initialize; + f_int128ss_t data = f_int128ss_t_initialize; { - const f_status_t status = f_int128ss_resize(length, &data); + const f_status_t status = f_int128ss_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_int128ss_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -34,7 +24,7 @@ void test__f_type_array_int128ss_increase__works(void **state) { void test__f_type_array_int128ss_increase__returns_data_not(void **state) { const int length = 5; - f_int128ss_t data = f_int128s_t_initialize; + f_int128ss_t data = f_int128ss_t_initialize; { const f_status_t status = f_int128ss_resize(length, &data); @@ -55,17 +45,27 @@ void test__f_type_array_int128ss_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_int128ss_increase__parameter_checking(void **state) { +void test__f_type_array_int128ss_increase__works(void **state) { const int length = 5; - f_int128ss_t data = f_int128s_t_initialize; + f_int128ss_t data = f_int128ss_t_initialize; { - const f_status_t status = f_int128ss_increase(length, 0); + const f_status_t status = f_int128ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_int128ss_increase(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); } free((void *) data.array); diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_increase.h index 575159933..3972fc75f 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_increase.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_increase.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__int128ss_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int128ss_increase() + * @see f_int128ss_increase() */ -extern void test__f_type_array_int128ss_increase__works(void **state); +extern void test__f_type_array_int128ss_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_int128ss_increase() + * @see f_int128ss_increase() */ extern void test__f_type_array_int128ss_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int128ss_increase() + * @see f_int128ss_increase() */ -extern void test__f_type_array_int128ss_increase__parameter_checking(void **state); +extern void test__f_type_array_int128ss_increase__works(void **state); #endif // _TEST__F_type_array__int128ss_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_increase_by.c index 8588735ac..f8da9195c 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_increase_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_increase_by.c @@ -5,10 +5,26 @@ extern "C" { #endif -void test__f_type_array_int128ss_increase_by__works(void **state) { +void test__f_type_array_int128ss_increase_by__parameter_checking(void **state) { + + const int length = 5; + f_int128ss_t data = f_int128ss_t_initialize; + + { + const f_status_t status = f_int128ss_increase_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_int128ss_increase_by__returns_data_not(void **state) { const int length = 5; - f_int128ss_t data = f_int128s_t_initialize; + f_int128ss_t data = f_int128ss_t_initialize; { const f_status_t status = f_int128ss_resize(length, &data); @@ -19,32 +35,48 @@ void test__f_type_array_int128ss_increase_by__works(void **state) { } { - data.used = length; + const f_status_t status = f_int128ss_increase_by(0, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + { const f_status_t status = f_int128ss_increase_by(length, &data); - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); } free((void *) data.array); } -void test__f_type_array_int128ss_increase_by__parameter_checking(void **state) { +void test__f_type_array_int128ss_increase_by__works(void **state) { const int length = 5; - f_int128ss_t data = f_int128s_t_initialize; + f_int128ss_t data = f_int128ss_t_initialize; { - const f_status_t status = f_int128ss_increase_by(length, 0); + const f_status_t status = f_int128ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + { + data.used = length; + + const f_status_t status = f_int128ss_increase_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_increase_by.h index dbb6090a9..6f2af9520 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_increase_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_increase_by.h @@ -11,17 +11,24 @@ #define _TEST__F_type_array__int128ss_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int128ss_increase_by() + * @see f_int128ss_increase_by() */ -extern void test__f_type_array_int128ss_increase_by__works(void **state); +extern void test__f_type_array_int128ss_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_int128ss_increase_by() + * @see f_int128ss_increase_by() */ -extern void test__f_type_array_int128ss_increase_by__parameter_checking(void **state); +extern void test__f_type_array_int128ss_increase_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_int128ss_increase_by() + */ +extern void test__f_type_array_int128ss_increase_by__works(void **state); #endif // _TEST__F_type_array__int128ss_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_resize.c index 72eaa3fe1..cabbb02cc 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_resize.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_resize.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_int128ss_resize__works(void **state) { +void test__f_type_array_int128ss_resize__parameter_checking(void **state) { const int length = 5; f_int128ss_t data = f_int128ss_t_initialize; { - const f_status_t status = f_int128ss_resize(length, &data); + const f_status_t status = f_int128ss_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_int128ss_resize__parameter_checking(void **state) { +void test__f_type_array_int128ss_resize__works(void **state) { const int length = 5; f_int128ss_t data = f_int128ss_t_initialize; { - const f_status_t status = f_int128ss_resize(length, 0); + const f_status_t status = f_int128ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_resize.h index 821daa23a..24a5ae203 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_resize.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int128ss_resize.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int128ss_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int128ss_resize() + * @see f_int128ss_resize() */ -extern void test__f_type_array_int128ss_resize__works(void **state); +extern void test__f_type_array_int128ss_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int128ss_resize() + * @see f_int128ss_resize() */ -extern void test__f_type_array_int128ss_resize__parameter_checking(void **state); +extern void test__f_type_array_int128ss_resize__works(void **state); #endif // _TEST__F_type_array__int128ss_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_adjust.c index 3f0931e89..3c4f2796e 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_adjust.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_adjust.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_int16s_adjust__works(void **state) { +void test__f_type_array_int16s_adjust__parameter_checking(void **state) { const int length = 5; f_int16s_t data = f_int16s_t_initialize; { - const f_status_t status = f_int16s_adjust(length, &data); + const f_status_t status = f_int16s_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_int16s_adjust__parameter_checking(void **state) { +void test__f_type_array_int16s_adjust__works(void **state) { const int length = 5; f_int16s_t data = f_int16s_t_initialize; { - const f_status_t status = f_int16s_adjust(length, 0); + const f_status_t status = f_int16s_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_adjust.h index 9376cd3f9..086ffc739 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_adjust.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_adjust.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int16s_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int16s_adjust() + * @see f_int16s_adjust() */ -extern void test__f_type_array_int16s_adjust__works(void **state); +extern void test__f_type_array_int16s_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int16s_adjust() + * @see f_int16s_adjust() */ -extern void test__f_type_array_int16s_adjust__parameter_checking(void **state); +extern void test__f_type_array_int16s_adjust__works(void **state); #endif // _TEST__F_type_array__int16s_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_append.c index 163f197b9..205719672 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_append.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_append.c @@ -5,9 +5,20 @@ extern "C" { #endif +void test__f_type_array_int16s_append__parameter_checking(void **state) { + + const int16_t data = 0; + + { + const f_status_t status = f_int16s_append(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + void test__f_type_array_int16s_append__works(void **state) { - const uint16_t source = 3; + const int16_t source = 3; f_int16s_t destination = f_int16s_t_initialize; { @@ -21,17 +32,6 @@ void test__f_type_array_int16s_append__works(void **state) { free((void *) destination.array); } -void test__f_type_array_int16s_append__parameter_checking(void **state) { - - const uint16_t data = 0; - - { - const f_status_t status = f_int16s_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_append.h index 173530c15..7b4a60165 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_append.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_append.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int16s_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int16s_append() + * @see f_int16s_append() */ -extern void test__f_type_array_int16s_append__works(void **state); +extern void test__f_type_array_int16s_append__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int16s_append() + * @see f_int16s_append() */ -extern void test__f_type_array_int16s_append__parameter_checking(void **state); +extern void test__f_type_array_int16s_append__works(void **state); #endif // _TEST__F_type_array__int16s_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_append_all.c index 19506b0fb..dd2ad4d37 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_append_all.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_append_all.c @@ -5,10 +5,20 @@ extern "C" { #endif -void test__f_type_array_int16s_append_all__works(void **state) { +void test__f_type_array_int16s_append_all__parameter_checking(void **state) { + + const f_int16s_t data = f_int16s_t_initialize; + + { + const f_status_t status = f_int16s_append_all(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +void test__f_type_array_int16s_append_all__returns_data_not(void **state) { const int length = 5; - const int length_used = 2; f_int16s_t source = f_int16s_t_initialize; f_int16s_t destination = f_int16s_t_initialize; @@ -20,29 +30,22 @@ void test__f_type_array_int16s_append_all__works(void **state) { assert_int_equal(source.size, length); } - for (; source.used < length_used; ++source.used) { - source.array[source.used] = source.used + 1; - } // for - { const f_status_t status = f_int16s_append_all(source, &destination); - assert_int_equal(status, F_none); - assert_int_equal(destination.used, source.used); - assert_int_equal(destination.size, source.used); - - for (f_array_length_t i = 0; i < source.used; ++i) { - assert_int_equal(destination.array[i], i + 1); - } // for + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + assert_null(destination.array); } free((void *) source.array); - free((void *) destination.array); } -void test__f_type_array_int16s_append_all__returns_data_not(void **state) { +void test__f_type_array_int16s_append_all__works(void **state) { const int length = 5; + const int length_used = 2; f_int16s_t source = f_int16s_t_initialize; f_int16s_t destination = f_int16s_t_initialize; @@ -54,27 +57,24 @@ void test__f_type_array_int16s_append_all__returns_data_not(void **state) { assert_int_equal(source.size, length); } + for (; source.used < length_used; ++source.used) { + source.array[source.used] = source.used + 1; + } // for + { const f_status_t status = f_int16s_append_all(source, &destination); - assert_int_equal(status, F_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); + assert_int_equal(status, F_none); + assert_int_equal(destination.used, source.used); + assert_int_equal(destination.size, source.used); + + for (f_array_length_t i = 0; i < source.used; ++i) { + assert_int_equal(destination.array[i], i + 1); + } // for } free((void *) source.array); -} - -void test__f_type_array_int16s_append_all__parameter_checking(void **state) { - - const f_int16s_t data = f_int16s_t_initialize; - - { - const f_status_t status = f_int16s_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } + free((void *) destination.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_append_all.h index 2a4637cfb..fb15fffbf 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_append_all.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_append_all.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__int16s_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int16s_append_all() + * @see f_int16s_append_all() */ -extern void test__f_type_array_int16s_append_all__works(void **state); +extern void test__f_type_array_int16s_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_int16s_append_all() + * @see f_int16s_append_all() */ extern void test__f_type_array_int16s_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int16s_append_all() + * @see f_int16s_append_all() */ -extern void test__f_type_array_int16s_append_all__parameter_checking(void **state); +extern void test__f_type_array_int16s_append_all__works(void **state); #endif // _TEST__F_type_array__int16s_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_decimate_by.c index 9fff75ddf..fc67c906a 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_decimate_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_decimate_by.c @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_int16s_decimate_by__works(void **state) { +void test__f_type_array_int16s_decimate_by__parameter_checking(void **state) { const int length = 5; f_int16s_t data = f_int16s_t_initialize; { - const f_status_t status = f_int16s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int16s_decimate_by(length, &data); + const f_status_t status = f_int16s_decimate_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_int16s_decimate_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_int16s_decimate_by__parameter_checking(void **state) { +void test__f_type_array_int16s_decimate_by__works(void **state) { const int length = 5; f_int16s_t data = f_int16s_t_initialize; { - const f_status_t status = f_int16s_decimate_by(length, 0); + const f_status_t status = f_int16s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_int16s_decimate_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_decimate_by.h index f77b1aed2..4341b060b 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_decimate_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_decimate_by.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int16s_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int16s_decimate_by() + * @see f_int16s_decimate_by() */ -extern void test__f_type_array_int16s_decimate_by__works(void **state); +extern void test__f_type_array_int16s_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int16s_decimate_by() + * @see f_int16s_decimate_by() */ -extern void test__f_type_array_int16s_decimate_by__parameter_checking(void **state); +extern void test__f_type_array_int16s_decimate_by__works(void **state); #endif // _TEST__F_type_array__int16s_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_decrease_by.c index 3d30dc178..b4ac65989 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_decrease_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_decrease_by.c @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_int16s_decrease_by__works(void **state) { +void test__f_type_array_int16s_decrease_by__parameter_checking(void **state) { const int length = 5; f_int16s_t data = f_int16s_t_initialize; { - const f_status_t status = f_int16s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int16s_decrease_by(length, &data); + const f_status_t status = f_int16s_decrease_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_int16s_decrease_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_int16s_decrease_by__parameter_checking(void **state) { +void test__f_type_array_int16s_decrease_by__works(void **state) { const int length = 5; f_int16s_t data = f_int16s_t_initialize; { - const f_status_t status = f_int16s_decrease_by(length, 0); + const f_status_t status = f_int16s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_int16s_decrease_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_decrease_by.h index b7a215d8e..695b227c5 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_decrease_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_decrease_by.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int16s_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int16s_decrease_by() + * @see f_int16s_decrease_by() */ -extern void test__f_type_array_int16s_decrease_by__works(void **state); +extern void test__f_type_array_int16s_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int16s_decrease_by() + * @see f_int16s_decrease_by() */ -extern void test__f_type_array_int16s_decrease_by__parameter_checking(void **state); +extern void test__f_type_array_int16s_decrease_by__works(void **state); #endif // _TEST__F_type_array__int16s_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_increase.c index 0d7fe4b64..a10f86865 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_increase.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_increase.c @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_int16s_increase__works(void **state) { +void test__f_type_array_int16s_increase__parameter_checking(void **state) { const int length = 5; f_int16s_t data = f_int16s_t_initialize; { - const f_status_t status = f_int16s_resize(length, &data); + const f_status_t status = f_int16s_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_int16s_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -55,17 +45,27 @@ void test__f_type_array_int16s_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_int16s_increase__parameter_checking(void **state) { +void test__f_type_array_int16s_increase__works(void **state) { const int length = 5; f_int16s_t data = f_int16s_t_initialize; { - const f_status_t status = f_int16s_increase(length, 0); + const f_status_t status = f_int16s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_int16s_increase(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); } free((void *) data.array); diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_increase.h index 8a9c1cba5..9ffab1415 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_increase.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_increase.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__int16s_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int16s_increase() + * @see f_int16s_increase() */ -extern void test__f_type_array_int16s_increase__works(void **state); +extern void test__f_type_array_int16s_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_int16s_increase() + * @see f_int16s_increase() */ extern void test__f_type_array_int16s_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int16s_increase() + * @see f_int16s_increase() */ -extern void test__f_type_array_int16s_increase__parameter_checking(void **state); +extern void test__f_type_array_int16s_increase__works(void **state); #endif // _TEST__F_type_array__int16s_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_increase_by.c index 2f717aeb0..e33b5a4a3 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_increase_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_increase_by.c @@ -5,6 +5,22 @@ extern "C" { #endif +void test__f_type_array_int16s_increase_by__parameter_checking(void **state) { + + const int length = 5; + f_int16s_t data = f_int16s_t_initialize; + + { + const f_status_t status = f_int16s_increase_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + void test__f_type_array_int16s_increase_by__works(void **state) { const int length = 5; @@ -31,22 +47,6 @@ void test__f_type_array_int16s_increase_by__works(void **state) { free((void *) data.array); } -void test__f_type_array_int16s_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_int16s_t data = f_int16s_t_initialize; - - { - const f_status_t status = f_int16s_increase_by(length, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_increase_by.h index 37e7b4d75..575753fc6 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_increase_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_increase_by.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int16s_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int16s_increase_by() + * @see f_int16s_increase_by() */ -extern void test__f_type_array_int16s_increase_by__works(void **state); +extern void test__f_type_array_int16s_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int16s_increase_by() + * @see f_int16s_increase_by() */ -extern void test__f_type_array_int16s_increase_by__parameter_checking(void **state); +extern void test__f_type_array_int16s_increase_by__works(void **state); #endif // _TEST__F_type_array__int16s_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_resize.c index c632a9ea4..9b5c14b98 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_resize.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_resize.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_int16s_resize__works(void **state) { +void test__f_type_array_int16s_resize__parameter_checking(void **state) { const int length = 5; f_int16s_t data = f_int16s_t_initialize; { - const f_status_t status = f_int16s_resize(length, &data); + const f_status_t status = f_int16s_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_int16s_resize__parameter_checking(void **state) { +void test__f_type_array_int16s_resize__works(void **state) { const int length = 5; f_int16s_t data = f_int16s_t_initialize; { - const f_status_t status = f_int16s_resize(length, 0); + const f_status_t status = f_int16s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_resize.h index 5f2933e53..8fea4d636 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16s_resize.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16s_resize.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int16s_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int16s_resize() + * @see f_int16s_resize() */ -extern void test__f_type_array_int16s_resize__works(void **state); +extern void test__f_type_array_int16s_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int16s_resize() + * @see f_int16s_resize() */ -extern void test__f_type_array_int16s_resize__parameter_checking(void **state); +extern void test__f_type_array_int16s_resize__works(void **state); #endif // _TEST__F_type_array__int16s_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_adjust.c index 3055b1738..336011bf6 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_adjust.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_adjust.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_int16ss_adjust__works(void **state) { +void test__f_type_array_int16ss_adjust__parameter_checking(void **state) { const int length = 5; f_int16ss_t data = f_int16ss_t_initialize; { - const f_status_t status = f_int16ss_adjust(length, &data); + const f_status_t status = f_int16ss_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_int16ss_adjust__parameter_checking(void **state) { +void test__f_type_array_int16ss_adjust__works(void **state) { const int length = 5; f_int16ss_t data = f_int16ss_t_initialize; { - const f_status_t status = f_int16ss_adjust(length, 0); + const f_status_t status = f_int16ss_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_adjust.h index c2412551f..d7df55126 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_adjust.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_adjust.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int16ss_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int16ss_adjust() + * @see f_int16ss_adjust() */ -extern void test__f_type_array_int16ss_adjust__works(void **state); +extern void test__f_type_array_int16ss_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int16ss_adjust() + * @see f_int16ss_adjust() */ -extern void test__f_type_array_int16ss_adjust__parameter_checking(void **state); +extern void test__f_type_array_int16ss_adjust__works(void **state); #endif // _TEST__F_type_array__int16ss_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_append.c index 36ee09d00..15eada470 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_append.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_append.c @@ -5,7 +5,18 @@ extern "C" { #endif -void test__f_type_array_int16ss_append__works(void **state) { +void test__f_type_array_int16ss_append__parameter_checking(void **state) { + + f_int16s_t data = f_int16s_t_initialize; + + { + const f_status_t status = f_int16ss_append(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +void test__f_type_array_int16ss_append__returns_data_not(void **state) { const int length = 5; f_int16s_t source = f_int16s_t_initialize; @@ -19,32 +30,19 @@ void test__f_type_array_int16ss_append__works(void **state) { assert_int_equal(source.size, length); } - for (; source.used < length; ++source.used) { - source.array[source.used] = source.used + 1; - } // for - { const f_status_t status = f_int16ss_append(source, &destination); - assert_int_equal(status, F_none); - assert_int_equal(destination.used, 1); - assert_int_equal(destination.array[0].used, source.used); - assert_int_equal(destination.array[0].size, source.used); - - for (f_array_length_t i = 0; i < destination.array[0].used; ++i) { - assert_int_equal(destination.array[0].array[i], i + 1); - } // for + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + assert_null(destination.array); } - for (f_array_length_t i = 0; i < destination.used; ++i) { - free((void *) destination.array[i].array); - } // for - free((void *) source.array); - free((void *) destination.array); } -void test__f_type_array_int16ss_append__returns_data_not(void **state) { +void test__f_type_array_int16ss_append__works(void **state) { const int length = 5; f_int16s_t source = f_int16s_t_initialize; @@ -58,27 +56,29 @@ void test__f_type_array_int16ss_append__returns_data_not(void **state) { assert_int_equal(source.size, length); } + for (; source.used < length; ++source.used) { + source.array[source.used] = source.used + 1; + } // for + { const f_status_t status = f_int16ss_append(source, &destination); - assert_int_equal(status, F_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); - } - - free((void *) source.array); -} - -void test__f_type_array_int16ss_append__parameter_checking(void **state) { + assert_int_equal(status, F_none); + assert_int_equal(destination.used, 1); + assert_int_equal(destination.array[0].used, source.used); + assert_int_equal(destination.array[0].size, source.used); - f_int16s_t data = f_int16s_t_initialize; + for (f_array_length_t i = 0; i < destination.array[0].used; ++i) { + assert_int_equal(destination.array[0].array[i], i + 1); + } // for + } - { - const f_status_t status = f_int16ss_append(data, 0); + for (f_array_length_t i = 0; i < destination.used; ++i) { + free((void *) destination.array[i].array); + } // for - assert_int_equal(status, F_status_set_error(F_parameter)); - } + free((void *) source.array); + free((void *) destination.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_append.h index 7bab07fa0..1947eca0d 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_append.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_append.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__int16ss_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int16ss_append() + * @see f_int16ss_append() */ -extern void test__f_type_array_int16ss_append__works(void **state); +extern void test__f_type_array_int16ss_append__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_int16ss_append() + * @see f_int16ss_append() */ extern void test__f_type_array_int16ss_append__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int16ss_append() + * @see f_int16ss_append() */ -extern void test__f_type_array_int16ss_append__parameter_checking(void **state); +extern void test__f_type_array_int16ss_append__works(void **state); #endif // _TEST__F_type_array__int16ss_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_append_all.c index 08d312316..272af4b9d 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_append_all.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_append_all.c @@ -5,6 +5,43 @@ extern "C" { #endif +void test__f_type_array_int16ss_append_all__parameter_checking(void **state) { + + const f_int16ss_t data = f_int16ss_t_initialize; + + { + const f_status_t status = f_int16ss_append_all(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +void test__f_type_array_int16ss_append_all__returns_data_not(void **state) { + + const int length = 5; + f_int16ss_t source = f_int16ss_t_initialize; + f_int16ss_t destination = f_int16ss_t_initialize; + + { + const f_status_t status = f_int16ss_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + { + const f_status_t status = f_int16ss_append_all(source, &destination); + + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + assert_null(destination.array); + } + + free((void *) source.array); +} + void test__f_type_array_int16ss_append_all__works(void **state) { const int length = 5; @@ -63,43 +100,6 @@ void test__f_type_array_int16ss_append_all__works(void **state) { free((void *) destination.array); } -void test__f_type_array_int16ss_append_all__returns_data_not(void **state) { - - const int length = 5; - f_int16ss_t source = f_int16ss_t_initialize; - f_int16ss_t destination = f_int16ss_t_initialize; - - { - const f_status_t status = f_int16ss_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_int16ss_append_all(source, &destination); - - assert_int_equal(status, F_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); - } - - free((void *) source.array); -} - -void test__f_type_array_int16ss_append_all__parameter_checking(void **state) { - - const f_int16ss_t data = f_int16ss_t_initialize; - - { - const f_status_t status = f_int16ss_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_append_all.h index 8d9fe34ee..09870376e 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_append_all.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_append_all.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__int16ss_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int16ss_append_all() + * @see f_int16ss_append_all() */ -extern void test__f_type_array_int16ss_append_all__works(void **state); +extern void test__f_type_array_int16ss_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_int16ss_append_all() + * @see f_int16ss_append_all() */ extern void test__f_type_array_int16ss_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int16ss_append_all() + * @see f_int16ss_append_all() */ -extern void test__f_type_array_int16ss_append_all__parameter_checking(void **state); +extern void test__f_type_array_int16ss_append_all__works(void **state); #endif // _TEST__F_type_array__int16ss_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_decimate_by.c index fd7040ebc..94f8c5200 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_decimate_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_decimate_by.c @@ -5,10 +5,26 @@ extern "C" { #endif -void test__f_type_array_int16ss_decimate_by__works(void **state) { +void test__f_type_array_int16ss_decimate_by__parameter_checking(void **state) { + + const int length = 5; + f_int16ss_t data = f_int16ss_t_initialize; + + { + const f_status_t status = f_int16ss_decimate_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_int16ss_decimate_by__returns_data_not(void **state) { const int length = 5; - f_int16ss_t data = f_int16s_t_initialize; + f_int16ss_t data = f_int16ss_t_initialize; { const f_status_t status = f_int16ss_resize(length, &data); @@ -19,25 +35,33 @@ void test__f_type_array_int16ss_decimate_by__works(void **state) { } { - const f_status_t status = f_int16ss_decimate_by(length, &data); + const f_status_t status = f_int16ss_decimate_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_int16ss_decimate_by__parameter_checking(void **state) { +void test__f_type_array_int16ss_decimate_by__works(void **state) { const int length = 5; - f_int16ss_t data = f_int16s_t_initialize; + f_int16ss_t data = f_int16ss_t_initialize; { - const f_status_t status = f_int16ss_decimate_by(length, 0); + const f_status_t status = f_int16ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_int16ss_decimate_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_decimate_by.h index 2bd7c2f9d..2fd1103a4 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_decimate_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_decimate_by.h @@ -11,17 +11,24 @@ #define _TEST__F_type_array__int16ss_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int16ss_decimate_by() + * @see f_int16ss_decimate_by() */ -extern void test__f_type_array_int16ss_decimate_by__works(void **state); +extern void test__f_type_array_int16ss_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * * @see f_type_array_int16ss_decimate_by() */ -extern void test__f_type_array_int16ss_decimate_by__parameter_checking(void **state); +extern void test__f_type_array_int16ss_decimate_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_int16ss_decimate_by() + */ +extern void test__f_type_array_int16ss_decimate_by__works(void **state); #endif // _TEST__F_type_array__int16ss_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_decrease_by.c index ed3a4548e..e733e00ac 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_decrease_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_decrease_by.c @@ -5,10 +5,26 @@ extern "C" { #endif -void test__f_type_array_int16ss_decrease_by__works(void **state) { +void test__f_type_array_int16ss_decrease_by__parameter_checking(void **state) { + + const int length = 5; + f_int16ss_t data = f_int16ss_t_initialize; + + { + const f_status_t status = f_int16ss_decrease_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_int16ss_decrease_by__returns_data_not(void **state) { const int length = 5; - f_int16ss_t data = f_int16s_t_initialize; + f_int16ss_t data = f_int16ss_t_initialize; { const f_status_t status = f_int16ss_resize(length, &data); @@ -19,25 +35,33 @@ void test__f_type_array_int16ss_decrease_by__works(void **state) { } { - const f_status_t status = f_int16ss_decrease_by(length, &data); + const f_status_t status = f_int16ss_decrease_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_int16ss_decrease_by__parameter_checking(void **state) { +void test__f_type_array_int16ss_decrease_by__works(void **state) { const int length = 5; - f_int16ss_t data = f_int16s_t_initialize; + f_int16ss_t data = f_int16ss_t_initialize; { - const f_status_t status = f_int16ss_decrease_by(length, 0); + const f_status_t status = f_int16ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_int16ss_decrease_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_decrease_by.h index f5d687a1e..e63f6db41 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_decrease_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_decrease_by.h @@ -11,17 +11,24 @@ #define _TEST__F_type_array__int16ss_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int16ss_decrease_by() + * @see f_int16ss_decrease_by() */ -extern void test__f_type_array_int16ss_decrease_by__works(void **state); +extern void test__f_type_array_int16ss_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_int16ss_decrease_by() + * @see f_int16ss_decrease_by() */ -extern void test__f_type_array_int16ss_decrease_by__parameter_checking(void **state); +extern void test__f_type_array_int16ss_decrease_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_int16ss_decrease_by() + */ +extern void test__f_type_array_int16ss_decrease_by__works(void **state); #endif // _TEST__F_type_array__int16ss_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_increase.c index f1d8273d4..a9b2ea96f 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_increase.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_increase.c @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_int16ss_increase__works(void **state) { +void test__f_type_array_int16ss_increase__parameter_checking(void **state) { const int length = 5; f_int16ss_t data = f_int16s_t_initialize; { - const f_status_t status = f_int16ss_resize(length, &data); + const f_status_t status = f_int16ss_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_int16ss_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -34,7 +24,7 @@ void test__f_type_array_int16ss_increase__works(void **state) { void test__f_type_array_int16ss_increase__returns_data_not(void **state) { const int length = 5; - f_int16ss_t data = f_int16s_t_initialize; + f_int16ss_t data = f_int16ss_t_initialize; { const f_status_t status = f_int16ss_resize(length, &data); @@ -55,17 +45,27 @@ void test__f_type_array_int16ss_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_int16ss_increase__parameter_checking(void **state) { +void test__f_type_array_int16ss_increase__works(void **state) { const int length = 5; - f_int16ss_t data = f_int16s_t_initialize; + f_int16ss_t data = f_int16ss_t_initialize; { - const f_status_t status = f_int16ss_increase(length, 0); + const f_status_t status = f_int16ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_int16ss_increase(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); } free((void *) data.array); diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_increase.h index c0b275d4e..9824f0067 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_increase.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_increase.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__int16ss_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int16ss_increase() + * @see f_int16ss_increase() */ -extern void test__f_type_array_int16ss_increase__works(void **state); +extern void test__f_type_array_int16ss_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_int16ss_increase() + * @see f_int16ss_increase() */ extern void test__f_type_array_int16ss_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int16ss_increase() + * @see f_int16ss_increase() */ -extern void test__f_type_array_int16ss_increase__parameter_checking(void **state); +extern void test__f_type_array_int16ss_increase__works(void **state); #endif // _TEST__F_type_array__int16ss_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_increase_by.c index cbb4a2901..290ac70c7 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_increase_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_increase_by.c @@ -5,10 +5,26 @@ extern "C" { #endif -void test__f_type_array_int16ss_increase_by__works(void **state) { +void test__f_type_array_int16ss_increase_by__parameter_checking(void **state) { + + const int length = 5; + f_int16ss_t data = f_int16ss_t_initialize; + + { + const f_status_t status = f_int16ss_increase_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_int16ss_increase_by__returns_data_not(void **state) { const int length = 5; - f_int16ss_t data = f_int16s_t_initialize; + f_int16ss_t data = f_int16ss_t_initialize; { const f_status_t status = f_int16ss_resize(length, &data); @@ -19,32 +35,72 @@ void test__f_type_array_int16ss_increase_by__works(void **state) { } { - data.used = length; + const f_status_t status = f_int16ss_increase_by(0, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + { const f_status_t status = f_int16ss_increase_by(length, &data); + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_type_array_array_length_decrease_by__returns_data_not(void **state) { + + const int length = 5; + f_array_lengthss_t data = f_array_lengthss_t_initialize; + + { + const f_status_t status = f_array_lengthss_resize(length, &data); + assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_array_lengthss_decrease_by(0, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); } free((void *) data.array); } -void test__f_type_array_int16ss_increase_by__parameter_checking(void **state) { +void test__f_type_array_int16ss_increase_by__works(void **state) { const int length = 5; - f_int16ss_t data = f_int16s_t_initialize; + f_int16ss_t data = f_int16ss_t_initialize; { - const f_status_t status = f_int16ss_increase_by(length, 0); + const f_status_t status = f_int16ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + { + data.used = length; + + const f_status_t status = f_int16ss_increase_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_increase_by.h index 78956ec6b..854d90702 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_increase_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_increase_by.h @@ -11,17 +11,24 @@ #define _TEST__F_type_array__int16ss_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int16ss_increase_by() + * @see f_int16ss_increase_by() */ -extern void test__f_type_array_int16ss_increase_by__works(void **state); +extern void test__f_type_array_int16ss_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_int16ss_increase_by() + * @see f_int16ss_increase_by() */ -extern void test__f_type_array_int16ss_increase_by__parameter_checking(void **state); +extern void test__f_type_array_int16ss_increase_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_int16ss_increase_by() + */ +extern void test__f_type_array_int16ss_increase_by__works(void **state); #endif // _TEST__F_type_array__int16ss_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_resize.c index 7a4e8925d..c5ce86526 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_resize.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_resize.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_int16ss_resize__works(void **state) { +void test__f_type_array_int16ss_resize__parameter_checking(void **state) { const int length = 5; f_int16ss_t data = f_int16ss_t_initialize; { - const f_status_t status = f_int16ss_resize(length, &data); + const f_status_t status = f_int16ss_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_int16ss_resize__parameter_checking(void **state) { +void test__f_type_array_int16ss_resize__works(void **state) { const int length = 5; f_int16ss_t data = f_int16ss_t_initialize; { - const f_status_t status = f_int16ss_resize(length, 0); + const f_status_t status = f_int16ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_resize.h index 6f962b705..3c2d839c4 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_resize.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int16ss_resize.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int16ss_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int16ss_resize() + * @see f_int16ss_resize() */ -extern void test__f_type_array_int16ss_resize__works(void **state); +extern void test__f_type_array_int16ss_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int16ss_resize() + * @see f_int16ss_resize() */ -extern void test__f_type_array_int16ss_resize__parameter_checking(void **state); +extern void test__f_type_array_int16ss_resize__works(void **state); #endif // _TEST__F_type_array__int16ss_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_adjust.c index 8aafe65ed..7f0012e14 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_adjust.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_adjust.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_int32s_adjust__works(void **state) { +void test__f_type_array_int32s_adjust__parameter_checking(void **state) { const int length = 5; f_int32s_t data = f_int32s_t_initialize; { - const f_status_t status = f_int32s_adjust(length, &data); + const f_status_t status = f_int32s_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_int32s_adjust__parameter_checking(void **state) { +void test__f_type_array_int32s_adjust__works(void **state) { const int length = 5; f_int32s_t data = f_int32s_t_initialize; { - const f_status_t status = f_int32s_adjust(length, 0); + const f_status_t status = f_int32s_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_adjust.h index 913daa8cc..e73182136 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_adjust.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_adjust.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int32s_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int32s_adjust() + * @see f_int32s_adjust() */ -extern void test__f_type_array_int32s_adjust__works(void **state); +extern void test__f_type_array_int32s_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int32s_adjust() + * @see f_int32s_adjust() */ -extern void test__f_type_array_int32s_adjust__parameter_checking(void **state); +extern void test__f_type_array_int32s_adjust__works(void **state); #endif // _TEST__F_type_array__int32s_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_append.c index c384176b7..9cd73cfd1 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_append.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_append.c @@ -5,6 +5,17 @@ extern "C" { #endif +void test__f_type_array_int32s_append__parameter_checking(void **state) { + + const int32_t data = 0; + + { + const f_status_t status = f_int32s_append(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + void test__f_type_array_int32s_append__works(void **state) { const int32_t source = 3; @@ -21,17 +32,6 @@ void test__f_type_array_int32s_append__works(void **state) { free((void *) destination.array); } -void test__f_type_array_int32s_append__parameter_checking(void **state) { - - const uint32_t data = 0; - - { - const f_status_t status = f_int32s_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_append.h index 4c22e28c4..dd22e011b 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_append.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_append.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int32s_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int32s_append() + * @see f_int32s_append() */ -extern void test__f_type_array_int32s_append__works(void **state); +extern void test__f_type_array_int32s_append__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int32s_append() + * @see f_int32s_append() */ -extern void test__f_type_array_int32s_append__parameter_checking(void **state); +extern void test__f_type_array_int32s_append__works(void **state); #endif // _TEST__F_type_array__int32s_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_append_all.c index dc8bfbce7..6801fba88 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_append_all.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_append_all.c @@ -5,10 +5,20 @@ extern "C" { #endif -void test__f_type_array_int32s_append_all__works(void **state) { +void test__f_type_array_int32s_append_all__parameter_checking(void **state) { + + const f_int32s_t data = f_int32s_t_initialize; + + { + const f_status_t status = f_int32s_append_all(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +void test__f_type_array_int32s_append_all__returns_data_not(void **state) { const int length = 5; - const int length_used = 2; f_int32s_t source = f_int32s_t_initialize; f_int32s_t destination = f_int32s_t_initialize; @@ -20,29 +30,22 @@ void test__f_type_array_int32s_append_all__works(void **state) { assert_int_equal(source.size, length); } - for (; source.used < length_used; ++source.used) { - source.array[source.used] = source.used + 1; - } // for - { const f_status_t status = f_int32s_append_all(source, &destination); - assert_int_equal(status, F_none); - assert_int_equal(destination.used, source.used); - assert_int_equal(destination.size, source.used); - - for (f_array_length_t i = 0; i < source.used; ++i) { - assert_int_equal(destination.array[i], i + 1); - } // for + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + assert_null(destination.array); } free((void *) source.array); - free((void *) destination.array); } -void test__f_type_array_int32s_append_all__returns_data_not(void **state) { +void test__f_type_array_int32s_append_all__works(void **state) { const int length = 5; + const int length_used = 2; f_int32s_t source = f_int32s_t_initialize; f_int32s_t destination = f_int32s_t_initialize; @@ -54,27 +57,24 @@ void test__f_type_array_int32s_append_all__returns_data_not(void **state) { assert_int_equal(source.size, length); } + for (; source.used < length_used; ++source.used) { + source.array[source.used] = source.used + 1; + } // for + { const f_status_t status = f_int32s_append_all(source, &destination); - assert_int_equal(status, F_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); + assert_int_equal(status, F_none); + assert_int_equal(destination.used, source.used); + assert_int_equal(destination.size, source.used); + + for (f_array_length_t i = 0; i < source.used; ++i) { + assert_int_equal(destination.array[i], i + 1); + } // for } free((void *) source.array); -} - -void test__f_type_array_int32s_append_all__parameter_checking(void **state) { - - const f_int32s_t data = f_int32s_t_initialize; - - { - const f_status_t status = f_int32s_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } + free((void *) destination.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_append_all.h index ed79d51ba..d45982d7a 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_append_all.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_append_all.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__int32s_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int32s_append_all() + * @see f_int32s_append_all() */ -extern void test__f_type_array_int32s_append_all__works(void **state); +extern void test__f_type_array_int32s_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_int32s_append_all() + * @see f_int32s_append_all() */ extern void test__f_type_array_int32s_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int32s_append_all() + * @see f_int32s_append_all() */ -extern void test__f_type_array_int32s_append_all__parameter_checking(void **state); +extern void test__f_type_array_int32s_append_all__works(void **state); #endif // _TEST__F_type_array__int32s_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_decimate_by.c index d6b5032d8..c7ad47911 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_decimate_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_decimate_by.c @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_int32s_decimate_by__works(void **state) { +void test__f_type_array_int32s_decimate_by__parameter_checking(void **state) { const int length = 5; f_int32s_t data = f_int32s_t_initialize; { - const f_status_t status = f_int32s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int32s_decimate_by(length, &data); + const f_status_t status = f_int32s_decimate_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_int32s_decimate_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_int32s_decimate_by__parameter_checking(void **state) { +void test__f_type_array_int32s_decimate_by__works(void **state) { const int length = 5; f_int32s_t data = f_int32s_t_initialize; { - const f_status_t status = f_int32s_decimate_by(length, 0); + const f_status_t status = f_int32s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_int32s_decimate_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_decimate_by.h index ee9a6af92..f6e6e0d09 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_decimate_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_decimate_by.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int32s_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int32s_decimate_by() + * @see f_int32s_decimate_by() */ -extern void test__f_type_array_int32s_decimate_by__works(void **state); +extern void test__f_type_array_int32s_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int32s_decimate_by() + * @see f_int32s_decimate_by() */ -extern void test__f_type_array_int32s_decimate_by__parameter_checking(void **state); +extern void test__f_type_array_int32s_decimate_by__works(void **state); #endif // _TEST__F_type_array__int32s_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_decrease_by.c index 71279a42b..0eec16142 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_decrease_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_decrease_by.c @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_int32s_decrease_by__works(void **state) { +void test__f_type_array_int32s_decrease_by__parameter_checking(void **state) { const int length = 5; f_int32s_t data = f_int32s_t_initialize; { - const f_status_t status = f_int32s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int32s_decrease_by(length, &data); + const f_status_t status = f_int32s_decrease_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_int32s_decrease_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_int32s_decrease_by__parameter_checking(void **state) { +void test__f_type_array_int32s_decrease_by__works(void **state) { const int length = 5; f_int32s_t data = f_int32s_t_initialize; { - const f_status_t status = f_int32s_decrease_by(length, 0); + const f_status_t status = f_int32s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_int32s_decrease_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_decrease_by.h index ed428af50..93be3e1e0 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_decrease_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_decrease_by.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int32s_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int32s_decrease_by() + * @see f_int32s_decrease_by() */ -extern void test__f_type_array_int32s_decrease_by__works(void **state); +extern void test__f_type_array_int32s_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int32s_decrease_by() + * @see f_int32s_decrease_by() */ -extern void test__f_type_array_int32s_decrease_by__parameter_checking(void **state); +extern void test__f_type_array_int32s_decrease_by__works(void **state); #endif // _TEST__F_type_array__int32s_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_increase.c index a6d40221d..a21f42bfc 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_increase.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_increase.c @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_int32s_increase__works(void **state) { +void test__f_type_array_int32s_increase__parameter_checking(void **state) { const int length = 5; f_int32s_t data = f_int32s_t_initialize; { - const f_status_t status = f_int32s_resize(length, &data); + const f_status_t status = f_int32s_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_int32s_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -55,17 +45,27 @@ void test__f_type_array_int32s_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_int32s_increase__parameter_checking(void **state) { +void test__f_type_array_int32s_increase__works(void **state) { const int length = 5; f_int32s_t data = f_int32s_t_initialize; { - const f_status_t status = f_int32s_increase(length, 0); + const f_status_t status = f_int32s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_int32s_increase(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); } free((void *) data.array); diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_increase.h index 7fe8cf58a..95ca4c5a7 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_increase.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_increase.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__int32s_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int32s_increase() + * @see f_int32s_increase() */ -extern void test__f_type_array_int32s_increase__works(void **state); +extern void test__f_type_array_int32s_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_int32s_increase() + * @see f_int32s_increase() */ extern void test__f_type_array_int32s_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int32s_increase() + * @see f_int32s_increase() */ -extern void test__f_type_array_int32s_increase__parameter_checking(void **state); +extern void test__f_type_array_int32s_increase__works(void **state); #endif // _TEST__F_type_array__int32s_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_increase_by.c index c89ce82d7..2f609afec 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_increase_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_increase_by.c @@ -5,6 +5,22 @@ extern "C" { #endif +void test__f_type_array_int32s_increase_by__parameter_checking(void **state) { + + const int length = 5; + f_int32s_t data = f_int32s_t_initialize; + + { + const f_status_t status = f_int32s_increase_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + void test__f_type_array_int32s_increase_by__works(void **state) { const int length = 5; @@ -31,22 +47,6 @@ void test__f_type_array_int32s_increase_by__works(void **state) { free((void *) data.array); } -void test__f_type_array_int32s_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_int32s_t data = f_int32s_t_initialize; - - { - const f_status_t status = f_int32s_increase_by(length, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_increase_by.h index 8be454eb7..0f7ea165f 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_increase_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_increase_by.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int32s_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int32s_increase_by() + * @see f_int32s_increase_by() */ -extern void test__f_type_array_int32s_increase_by__works(void **state); +extern void test__f_type_array_int32s_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int32s_increase_by() + * @see f_int32s_increase_by() */ -extern void test__f_type_array_int32s_increase_by__parameter_checking(void **state); +extern void test__f_type_array_int32s_increase_by__works(void **state); #endif // _TEST__F_type_array__int32s_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_resize.c index fdc0204a8..eca19f6e3 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_resize.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_resize.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_int32s_resize__works(void **state) { +void test__f_type_array_int32s_resize__parameter_checking(void **state) { const int length = 5; f_int32s_t data = f_int32s_t_initialize; { - const f_status_t status = f_int32s_resize(length, &data); + const f_status_t status = f_int32s_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_int32s_resize__parameter_checking(void **state) { +void test__f_type_array_int32s_resize__works(void **state) { const int length = 5; f_int32s_t data = f_int32s_t_initialize; { - const f_status_t status = f_int32s_resize(length, 0); + const f_status_t status = f_int32s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_resize.h index 82f054e11..a878c6b43 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32s_resize.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32s_resize.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int32s_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int32s_resize() + * @see f_int32s_resize() */ -extern void test__f_type_array_int32s_resize__works(void **state); +extern void test__f_type_array_int32s_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int32s_resize() + * @see f_int32s_resize() */ -extern void test__f_type_array_int32s_resize__parameter_checking(void **state); +extern void test__f_type_array_int32s_resize__works(void **state); #endif // _TEST__F_type_array__int32s_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_adjust.c index a973a0361..33de3919f 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_adjust.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_adjust.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_int32ss_adjust__works(void **state) { +void test__f_type_array_int32ss_adjust__parameter_checking(void **state) { const int length = 5; f_int32ss_t data = f_int32ss_t_initialize; { - const f_status_t status = f_int32ss_adjust(length, &data); + const f_status_t status = f_int32ss_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_int32ss_adjust__parameter_checking(void **state) { +void test__f_type_array_int32ss_adjust__works(void **state) { const int length = 5; f_int32ss_t data = f_int32ss_t_initialize; { - const f_status_t status = f_int32ss_adjust(length, 0); + const f_status_t status = f_int32ss_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_adjust.h index a105b7bcb..782bbf242 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_adjust.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_adjust.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int32ss_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int32ss_adjust() + * @see f_int32ss_adjust() */ -extern void test__f_type_array_int32ss_adjust__works(void **state); +extern void test__f_type_array_int32ss_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int32ss_adjust() + * @see f_int32ss_adjust() */ -extern void test__f_type_array_int32ss_adjust__parameter_checking(void **state); +extern void test__f_type_array_int32ss_adjust__works(void **state); #endif // _TEST__F_type_array__int32ss_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_append.c index b4d67f967..6f1696bad 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_append.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_append.c @@ -5,7 +5,18 @@ extern "C" { #endif -void test__f_type_array_int32ss_append__works(void **state) { +void test__f_type_array_int32ss_append__parameter_checking(void **state) { + + f_int32s_t data = f_int32s_t_initialize; + + { + const f_status_t status = f_int32ss_append(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +void test__f_type_array_int32ss_append__returns_data_not(void **state) { const int length = 5; f_int32s_t source = f_int32s_t_initialize; @@ -19,32 +30,19 @@ void test__f_type_array_int32ss_append__works(void **state) { assert_int_equal(source.size, length); } - for (; source.used < length; ++source.used) { - source.array[source.used] = source.used + 1; - } // for - { const f_status_t status = f_int32ss_append(source, &destination); - assert_int_equal(status, F_none); - assert_int_equal(destination.used, 1); - assert_int_equal(destination.array[0].used, source.used); - assert_int_equal(destination.array[0].size, source.used); - - for (f_array_length_t i = 0; i < destination.array[0].used; ++i) { - assert_int_equal(destination.array[0].array[i], i + 1); - } // for + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + assert_null(destination.array); } - for (f_array_length_t i = 0; i < destination.used; ++i) { - free((void *) destination.array[i].array); - } // for - free((void *) source.array); - free((void *) destination.array); } -void test__f_type_array_int32ss_append__returns_data_not(void **state) { +void test__f_type_array_int32ss_append__works(void **state) { const int length = 5; f_int32s_t source = f_int32s_t_initialize; @@ -58,27 +56,29 @@ void test__f_type_array_int32ss_append__returns_data_not(void **state) { assert_int_equal(source.size, length); } + for (; source.used < length; ++source.used) { + source.array[source.used] = source.used + 1; + } // for + { const f_status_t status = f_int32ss_append(source, &destination); - assert_int_equal(status, F_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); - } - - free((void *) source.array); -} - -void test__f_type_array_int32ss_append__parameter_checking(void **state) { + assert_int_equal(status, F_none); + assert_int_equal(destination.used, 1); + assert_int_equal(destination.array[0].used, source.used); + assert_int_equal(destination.array[0].size, source.used); - f_int32s_t data = f_int32s_t_initialize; + for (f_array_length_t i = 0; i < destination.array[0].used; ++i) { + assert_int_equal(destination.array[0].array[i], i + 1); + } // for + } - { - const f_status_t status = f_int32ss_append(data, 0); + for (f_array_length_t i = 0; i < destination.used; ++i) { + free((void *) destination.array[i].array); + } // for - assert_int_equal(status, F_status_set_error(F_parameter)); - } + free((void *) source.array); + free((void *) destination.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_append.h index 5d56e68ab..4358695f1 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_append.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_append.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__int32ss_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int32ss_append() + * @see f_int32ss_append() */ -extern void test__f_type_array_int32ss_append__works(void **state); +extern void test__f_type_array_int32ss_append__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_int32ss_append() + * @see f_int32ss_append() */ extern void test__f_type_array_int32ss_append__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int32ss_append() + * @see f_int32ss_append() */ -extern void test__f_type_array_int32ss_append__parameter_checking(void **state); +extern void test__f_type_array_int32ss_append__works(void **state); #endif // _TEST__F_type_array__int32ss_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_append_all.c index c002afaaa..f7a5201ea 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_append_all.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_append_all.c @@ -5,6 +5,43 @@ extern "C" { #endif +void test__f_type_array_int32ss_append_all__parameter_checking(void **state) { + + const f_int32ss_t data = f_int32ss_t_initialize; + + { + const f_status_t status = f_int32ss_append_all(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +void test__f_type_array_int32ss_append_all__returns_data_not(void **state) { + + const int length = 5; + f_int32ss_t source = f_int32ss_t_initialize; + f_int32ss_t destination = f_int32ss_t_initialize; + + { + const f_status_t status = f_int32ss_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + { + const f_status_t status = f_int32ss_append_all(source, &destination); + + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + assert_null(destination.array); + } + + free((void *) source.array); +} + void test__f_type_array_int32ss_append_all__works(void **state) { const int length = 5; @@ -63,43 +100,6 @@ void test__f_type_array_int32ss_append_all__works(void **state) { free((void *) destination.array); } -void test__f_type_array_int32ss_append_all__returns_data_not(void **state) { - - const int length = 5; - f_int32ss_t source = f_int32ss_t_initialize; - f_int32ss_t destination = f_int32ss_t_initialize; - - { - const f_status_t status = f_int32ss_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_int32ss_append_all(source, &destination); - - assert_int_equal(status, F_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); - } - - free((void *) source.array); -} - -void test__f_type_array_int32ss_append_all__parameter_checking(void **state) { - - const f_int32ss_t data = f_int32ss_t_initialize; - - { - const f_status_t status = f_int32ss_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_append_all.h index 8aaeae7ac..66b63aa1d 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_append_all.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_append_all.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__int32ss_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int32ss_append_all() + * @see f_int32ss_append_all() */ -extern void test__f_type_array_int32ss_append_all__works(void **state); +extern void test__f_type_array_int32ss_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_int32ss_append_all() + * @see f_int32ss_append_all() */ extern void test__f_type_array_int32ss_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int32ss_append_all() + * @see f_int32ss_append_all() */ -extern void test__f_type_array_int32ss_append_all__parameter_checking(void **state); +extern void test__f_type_array_int32ss_append_all__works(void **state); #endif // _TEST__F_type_array__int32ss_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_decimate_by.c index 0fdb7e553..2b16cc73f 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_decimate_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_decimate_by.c @@ -5,10 +5,26 @@ extern "C" { #endif -void test__f_type_array_int32ss_decimate_by__works(void **state) { +void test__f_type_array_int32ss_decimate_by__parameter_checking(void **state) { + + const int length = 5; + f_int32ss_t data = f_int32ss_t_initialize; + + { + const f_status_t status = f_int32ss_decimate_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_int32ss_decimate_by__returns_data_not(void **state) { const int length = 5; - f_int32ss_t data = f_int32s_t_initialize; + f_int32ss_t data = f_int32ss_t_initialize; { const f_status_t status = f_int32ss_resize(length, &data); @@ -19,25 +35,33 @@ void test__f_type_array_int32ss_decimate_by__works(void **state) { } { - const f_status_t status = f_int32ss_decimate_by(length, &data); + const f_status_t status = f_int32ss_decimate_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_int32ss_decimate_by__parameter_checking(void **state) { +void test__f_type_array_int32ss_decimate_by__works(void **state) { const int length = 5; - f_int32ss_t data = f_int32s_t_initialize; + f_int32ss_t data = f_int32ss_t_initialize; { - const f_status_t status = f_int32ss_decimate_by(length, 0); + const f_status_t status = f_int32ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_int32ss_decimate_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_decimate_by.h index 2fc576de9..ac363c4f0 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_decimate_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_decimate_by.h @@ -11,17 +11,24 @@ #define _TEST__F_type_array__int32ss_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int32ss_decimate_by() + * @see f_int32ss_decimate_by() */ -extern void test__f_type_array_int32ss_decimate_by__works(void **state); +extern void test__f_type_array_int32ss_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * * @see f_type_array_int32ss_decimate_by() */ -extern void test__f_type_array_int32ss_decimate_by__parameter_checking(void **state); +extern void test__f_type_array_int32ss_decimate_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_int32ss_decimate_by() + */ +extern void test__f_type_array_int32ss_decimate_by__works(void **state); #endif // _TEST__F_type_array__int32ss_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_decrease_by.c index 99a08265d..575bd125d 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_decrease_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_decrease_by.c @@ -5,10 +5,26 @@ extern "C" { #endif -void test__f_type_array_int32ss_decrease_by__works(void **state) { +void test__f_type_array_int32ss_decrease_by__parameter_checking(void **state) { + + const int length = 5; + f_int32ss_t data = f_int32ss_t_initialize; + + { + const f_status_t status = f_int32ss_decrease_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_int32ss_decrease_by__returns_data_not(void **state) { const int length = 5; - f_int32ss_t data = f_int32s_t_initialize; + f_int32ss_t data = f_int32ss_t_initialize; { const f_status_t status = f_int32ss_resize(length, &data); @@ -19,25 +35,33 @@ void test__f_type_array_int32ss_decrease_by__works(void **state) { } { - const f_status_t status = f_int32ss_decrease_by(length, &data); + const f_status_t status = f_int32ss_decrease_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_int32ss_decrease_by__parameter_checking(void **state) { +void test__f_type_array_int32ss_decrease_by__works(void **state) { const int length = 5; - f_int32ss_t data = f_int32s_t_initialize; + f_int32ss_t data = f_int32ss_t_initialize; { - const f_status_t status = f_int32ss_decrease_by(length, 0); + const f_status_t status = f_int32ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_int32ss_decrease_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_decrease_by.h index 9fa824773..186c1da5d 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_decrease_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_decrease_by.h @@ -11,17 +11,24 @@ #define _TEST__F_type_array__int32ss_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int32ss_decrease_by() + * @see f_int32ss_decrease_by() */ -extern void test__f_type_array_int32ss_decrease_by__works(void **state); +extern void test__f_type_array_int32ss_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_int32ss_decrease_by() + * @see f_int32ss_decrease_by() */ -extern void test__f_type_array_int32ss_decrease_by__parameter_checking(void **state); +extern void test__f_type_array_int32ss_decrease_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_int32ss_decrease_by() + */ +extern void test__f_type_array_int32ss_decrease_by__works(void **state); #endif // _TEST__F_type_array__int32ss_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_increase.c index a3160a470..cf6c38109 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_increase.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_increase.c @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_int32ss_increase__works(void **state) { +void test__f_type_array_int32ss_increase__parameter_checking(void **state) { const int length = 5; f_int32ss_t data = f_int32s_t_initialize; { - const f_status_t status = f_int32ss_resize(length, &data); + const f_status_t status = f_int32ss_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_int32ss_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -34,7 +24,7 @@ void test__f_type_array_int32ss_increase__works(void **state) { void test__f_type_array_int32ss_increase__returns_data_not(void **state) { const int length = 5; - f_int32ss_t data = f_int32s_t_initialize; + f_int32ss_t data = f_int32ss_t_initialize; { const f_status_t status = f_int32ss_resize(length, &data); @@ -55,17 +45,27 @@ void test__f_type_array_int32ss_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_int32ss_increase__parameter_checking(void **state) { +void test__f_type_array_int32ss_increase__works(void **state) { const int length = 5; - f_int32ss_t data = f_int32s_t_initialize; + f_int32ss_t data = f_int32ss_t_initialize; { - const f_status_t status = f_int32ss_increase(length, 0); + const f_status_t status = f_int32ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_int32ss_increase(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); } free((void *) data.array); diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_increase.h index ae844df2d..38440e711 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_increase.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_increase.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__int32ss_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int32ss_increase() + * @see f_int32ss_increase() */ -extern void test__f_type_array_int32ss_increase__works(void **state); +extern void test__f_type_array_int32ss_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_int32ss_increase() + * @see f_int32ss_increase() */ extern void test__f_type_array_int32ss_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int32ss_increase() + * @see f_int32ss_increase() */ -extern void test__f_type_array_int32ss_increase__parameter_checking(void **state); +extern void test__f_type_array_int32ss_increase__works(void **state); #endif // _TEST__F_type_array__int32ss_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_increase_by.c index 47f49fddb..ac607fae7 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_increase_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_increase_by.c @@ -5,10 +5,26 @@ extern "C" { #endif -void test__f_type_array_int32ss_increase_by__works(void **state) { +void test__f_type_array_int32ss_increase_by__parameter_checking(void **state) { + + const int length = 5; + f_int32ss_t data = f_int32ss_t_initialize; + + { + const f_status_t status = f_int32ss_increase_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_int32ss_increase_by__returns_data_not(void **state) { const int length = 5; - f_int32ss_t data = f_int32s_t_initialize; + f_int32ss_t data = f_int32ss_t_initialize; { const f_status_t status = f_int32ss_resize(length, &data); @@ -19,32 +35,48 @@ void test__f_type_array_int32ss_increase_by__works(void **state) { } { - data.used = length; + const f_status_t status = f_int32ss_increase_by(0, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + { const f_status_t status = f_int32ss_increase_by(length, &data); - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); } free((void *) data.array); } -void test__f_type_array_int32ss_increase_by__parameter_checking(void **state) { +void test__f_type_array_int32ss_increase_by__works(void **state) { const int length = 5; - f_int32ss_t data = f_int32s_t_initialize; + f_int32ss_t data = f_int32ss_t_initialize; { - const f_status_t status = f_int32ss_increase_by(length, 0); + const f_status_t status = f_int32ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + { + data.used = length; + + const f_status_t status = f_int32ss_increase_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_increase_by.h index e2ec6e57e..f89d2d1f9 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_increase_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_increase_by.h @@ -11,17 +11,24 @@ #define _TEST__F_type_array__int32ss_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int32ss_increase_by() + * @see f_int32ss_increase_by() */ -extern void test__f_type_array_int32ss_increase_by__works(void **state); +extern void test__f_type_array_int32ss_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_int32ss_increase_by() + * @see f_int32ss_increase_by() */ -extern void test__f_type_array_int32ss_increase_by__parameter_checking(void **state); +extern void test__f_type_array_int32ss_increase_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_int32ss_increase_by() + */ +extern void test__f_type_array_int32ss_increase_by__works(void **state); #endif // _TEST__F_type_array__int32ss_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_resize.c index c53d81e54..64b38cfbb 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_resize.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_resize.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_int32ss_resize__works(void **state) { +void test__f_type_array_int32ss_resize__parameter_checking(void **state) { const int length = 5; f_int32ss_t data = f_int32ss_t_initialize; { - const f_status_t status = f_int32ss_resize(length, &data); + const f_status_t status = f_int32ss_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_int32ss_resize__parameter_checking(void **state) { +void test__f_type_array_int32ss_resize__works(void **state) { const int length = 5; f_int32ss_t data = f_int32ss_t_initialize; { - const f_status_t status = f_int32ss_resize(length, 0); + const f_status_t status = f_int32ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_resize.h index 32e26a829..1a5aa0736 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_resize.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int32ss_resize.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int32ss_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int32ss_resize() + * @see f_int32ss_resize() */ -extern void test__f_type_array_int32ss_resize__works(void **state); +extern void test__f_type_array_int32ss_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int32ss_resize() + * @see f_int32ss_resize() */ -extern void test__f_type_array_int32ss_resize__parameter_checking(void **state); +extern void test__f_type_array_int32ss_resize__works(void **state); #endif // _TEST__F_type_array__int32ss_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_adjust.c index 252565b07..5e0237e1d 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_adjust.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_adjust.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_int64s_adjust__works(void **state) { +void test__f_type_array_int64s_adjust__parameter_checking(void **state) { const int length = 5; f_int64s_t data = f_int64s_t_initialize; { - const f_status_t status = f_int64s_adjust(length, &data); + const f_status_t status = f_int64s_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_int64s_adjust__parameter_checking(void **state) { +void test__f_type_array_int64s_adjust__works(void **state) { const int length = 5; f_int64s_t data = f_int64s_t_initialize; { - const f_status_t status = f_int64s_adjust(length, 0); + const f_status_t status = f_int64s_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_adjust.h index fca10f459..e9b25fa68 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_adjust.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_adjust.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int64s_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int64s_adjust() + * @see f_int64s_adjust() */ -extern void test__f_type_array_int64s_adjust__works(void **state); +extern void test__f_type_array_int64s_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int64s_adjust() + * @see f_int64s_adjust() */ -extern void test__f_type_array_int64s_adjust__parameter_checking(void **state); +extern void test__f_type_array_int64s_adjust__works(void **state); #endif // _TEST__F_type_array__int64s_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_append.c index 2515eeb30..0600e9d91 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_append.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_append.c @@ -5,6 +5,17 @@ extern "C" { #endif +void test__f_type_array_int64s_append__parameter_checking(void **state) { + + const int64_t data = 0; + + { + const f_status_t status = f_int64s_append(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + void test__f_type_array_int64s_append__works(void **state) { const int64_t source = 3; @@ -21,17 +32,6 @@ void test__f_type_array_int64s_append__works(void **state) { free((void *) destination.array); } -void test__f_type_array_int64s_append__parameter_checking(void **state) { - - const uint64_t data = 0; - - { - const f_status_t status = f_int64s_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_append.h index 050b258d0..73de0dc80 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_append.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_append.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int64s_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int64s_append() + * @see f_int64s_append() */ -extern void test__f_type_array_int64s_append__works(void **state); +extern void test__f_type_array_int64s_append__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int64s_append() + * @see f_int64s_append() */ -extern void test__f_type_array_int64s_append__parameter_checking(void **state); +extern void test__f_type_array_int64s_append__works(void **state); #endif // _TEST__F_type_array__int64s_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_append_all.c index dae1f313e..90183c999 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_append_all.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_append_all.c @@ -5,10 +5,20 @@ extern "C" { #endif -void test__f_type_array_int64s_append_all__works(void **state) { +void test__f_type_array_int64s_append_all__parameter_checking(void **state) { + + const f_int64s_t data = f_int64s_t_initialize; + + { + const f_status_t status = f_int64s_append_all(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +void test__f_type_array_int64s_append_all__returns_data_not(void **state) { const int length = 5; - const int length_used = 2; f_int64s_t source = f_int64s_t_initialize; f_int64s_t destination = f_int64s_t_initialize; @@ -20,29 +30,22 @@ void test__f_type_array_int64s_append_all__works(void **state) { assert_int_equal(source.size, length); } - for (; source.used < length_used; ++source.used) { - source.array[source.used] = source.used + 1; - } // for - { const f_status_t status = f_int64s_append_all(source, &destination); - assert_int_equal(status, F_none); - assert_int_equal(destination.used, source.used); - assert_int_equal(destination.size, source.used); - - for (f_array_length_t i = 0; i < source.used; ++i) { - assert_int_equal(destination.array[i], i + 1); - } // for + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + assert_null(destination.array); } free((void *) source.array); - free((void *) destination.array); } -void test__f_type_array_int64s_append_all__returns_data_not(void **state) { +void test__f_type_array_int64s_append_all__works(void **state) { const int length = 5; + const int length_used = 2; f_int64s_t source = f_int64s_t_initialize; f_int64s_t destination = f_int64s_t_initialize; @@ -54,27 +57,24 @@ void test__f_type_array_int64s_append_all__returns_data_not(void **state) { assert_int_equal(source.size, length); } + for (; source.used < length_used; ++source.used) { + source.array[source.used] = source.used + 1; + } // for + { const f_status_t status = f_int64s_append_all(source, &destination); - assert_int_equal(status, F_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); + assert_int_equal(status, F_none); + assert_int_equal(destination.used, source.used); + assert_int_equal(destination.size, source.used); + + for (f_array_length_t i = 0; i < source.used; ++i) { + assert_int_equal(destination.array[i], i + 1); + } // for } free((void *) source.array); -} - -void test__f_type_array_int64s_append_all__parameter_checking(void **state) { - - const f_int64s_t data = f_int64s_t_initialize; - - { - const f_status_t status = f_int64s_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } + free((void *) destination.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_append_all.h index ae20d0cd1..3171f1cc7 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_append_all.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_append_all.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__int64s_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int64s_append_all() + * @see f_int64s_append_all() */ -extern void test__f_type_array_int64s_append_all__works(void **state); +extern void test__f_type_array_int64s_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_int64s_append_all() + * @see f_int64s_append_all() */ extern void test__f_type_array_int64s_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int64s_append_all() + * @see f_int64s_append_all() */ -extern void test__f_type_array_int64s_append_all__parameter_checking(void **state); +extern void test__f_type_array_int64s_append_all__works(void **state); #endif // _TEST__F_type_array__int64s_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_decimate_by.c index 18cb0f7aa..a5be8d892 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_decimate_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_decimate_by.c @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_int64s_decimate_by__works(void **state) { +void test__f_type_array_int64s_decimate_by__parameter_checking(void **state) { const int length = 5; f_int64s_t data = f_int64s_t_initialize; { - const f_status_t status = f_int64s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int64s_decimate_by(length, &data); + const f_status_t status = f_int64s_decimate_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_int64s_decimate_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_int64s_decimate_by__parameter_checking(void **state) { +void test__f_type_array_int64s_decimate_by__works(void **state) { const int length = 5; f_int64s_t data = f_int64s_t_initialize; { - const f_status_t status = f_int64s_decimate_by(length, 0); + const f_status_t status = f_int64s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_int64s_decimate_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_decimate_by.h index 3cd695b6b..feeb67da0 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_decimate_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_decimate_by.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int64s_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int64s_decimate_by() + * @see f_int64s_decimate_by() */ -extern void test__f_type_array_int64s_decimate_by__works(void **state); +extern void test__f_type_array_int64s_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int64s_decimate_by() + * @see f_int64s_decimate_by() */ -extern void test__f_type_array_int64s_decimate_by__parameter_checking(void **state); +extern void test__f_type_array_int64s_decimate_by__works(void **state); #endif // _TEST__F_type_array__int64s_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_decrease_by.c index 93d4de8a6..581f31ec1 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_decrease_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_decrease_by.c @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_int64s_decrease_by__works(void **state) { +void test__f_type_array_int64s_decrease_by__parameter_checking(void **state) { const int length = 5; f_int64s_t data = f_int64s_t_initialize; { - const f_status_t status = f_int64s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int64s_decrease_by(length, &data); + const f_status_t status = f_int64s_decrease_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_int64s_decrease_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_int64s_decrease_by__parameter_checking(void **state) { +void test__f_type_array_int64s_decrease_by__works(void **state) { const int length = 5; f_int64s_t data = f_int64s_t_initialize; { - const f_status_t status = f_int64s_decrease_by(length, 0); + const f_status_t status = f_int64s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_int64s_decrease_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_decrease_by.h index 9f7fcdc0f..4c3511cc8 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_decrease_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_decrease_by.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int64s_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int64s_decrease_by() + * @see f_int64s_decrease_by() */ -extern void test__f_type_array_int64s_decrease_by__works(void **state); +extern void test__f_type_array_int64s_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int64s_decrease_by() + * @see f_int64s_decrease_by() */ -extern void test__f_type_array_int64s_decrease_by__parameter_checking(void **state); +extern void test__f_type_array_int64s_decrease_by__works(void **state); #endif // _TEST__F_type_array__int64s_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_increase.c index 2aaf4f5d1..bd4cab60d 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_increase.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_increase.c @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_int64s_increase__works(void **state) { +void test__f_type_array_int64s_increase__parameter_checking(void **state) { const int length = 5; f_int64s_t data = f_int64s_t_initialize; { - const f_status_t status = f_int64s_resize(length, &data); + const f_status_t status = f_int64s_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_int64s_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -55,17 +45,27 @@ void test__f_type_array_int64s_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_int64s_increase__parameter_checking(void **state) { +void test__f_type_array_int64s_increase__works(void **state) { const int length = 5; f_int64s_t data = f_int64s_t_initialize; { - const f_status_t status = f_int64s_increase(length, 0); + const f_status_t status = f_int64s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_int64s_increase(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); } free((void *) data.array); diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_increase.h index ec62ee031..be94a2b42 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_increase.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_increase.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__int64s_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int64s_increase() + * @see f_int64s_increase() */ -extern void test__f_type_array_int64s_increase__works(void **state); +extern void test__f_type_array_int64s_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_int64s_increase() + * @see f_int64s_increase() */ extern void test__f_type_array_int64s_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int64s_increase() + * @see f_int64s_increase() */ -extern void test__f_type_array_int64s_increase__parameter_checking(void **state); +extern void test__f_type_array_int64s_increase__works(void **state); #endif // _TEST__F_type_array__int64s_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_increase_by.c index 774930054..2ce8ad622 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_increase_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_increase_by.c @@ -5,6 +5,22 @@ extern "C" { #endif +void test__f_type_array_int64s_increase_by__parameter_checking(void **state) { + + const int length = 5; + f_int64s_t data = f_int64s_t_initialize; + + { + const f_status_t status = f_int64s_increase_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + void test__f_type_array_int64s_increase_by__works(void **state) { const int length = 5; @@ -31,22 +47,6 @@ void test__f_type_array_int64s_increase_by__works(void **state) { free((void *) data.array); } -void test__f_type_array_int64s_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_int64s_t data = f_int64s_t_initialize; - - { - const f_status_t status = f_int64s_increase_by(length, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_increase_by.h index f8bd91a3e..fa02badb9 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_increase_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_increase_by.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int64s_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int64s_increase_by() + * @see f_int64s_increase_by() */ -extern void test__f_type_array_int64s_increase_by__works(void **state); +extern void test__f_type_array_int64s_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int64s_increase_by() + * @see f_int64s_increase_by() */ -extern void test__f_type_array_int64s_increase_by__parameter_checking(void **state); +extern void test__f_type_array_int64s_increase_by__works(void **state); #endif // _TEST__F_type_array__int64s_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_resize.c index f2cf58d1b..1286b86f5 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_resize.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_resize.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_int64s_resize__works(void **state) { +void test__f_type_array_int64s_resize__parameter_checking(void **state) { const int length = 5; f_int64s_t data = f_int64s_t_initialize; { - const f_status_t status = f_int64s_resize(length, &data); + const f_status_t status = f_int64s_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_int64s_resize__parameter_checking(void **state) { +void test__f_type_array_int64s_resize__works(void **state) { const int length = 5; f_int64s_t data = f_int64s_t_initialize; { - const f_status_t status = f_int64s_resize(length, 0); + const f_status_t status = f_int64s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_resize.h index 7de48761d..e4b5604c8 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64s_resize.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64s_resize.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int64s_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int64s_resize() + * @see f_int64s_resize() */ -extern void test__f_type_array_int64s_resize__works(void **state); +extern void test__f_type_array_int64s_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int64s_resize() + * @see f_int64s_resize() */ -extern void test__f_type_array_int64s_resize__parameter_checking(void **state); +extern void test__f_type_array_int64s_resize__works(void **state); #endif // _TEST__F_type_array__int64s_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_adjust.c index 5bb533e85..92a11fa3e 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_adjust.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_adjust.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_int64ss_adjust__works(void **state) { +void test__f_type_array_int64ss_adjust__parameter_checking(void **state) { const int length = 5; f_int64ss_t data = f_int64ss_t_initialize; { - const f_status_t status = f_int64ss_adjust(length, &data); + const f_status_t status = f_int64ss_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_int64ss_adjust__parameter_checking(void **state) { +void test__f_type_array_int64ss_adjust__works(void **state) { const int length = 5; f_int64ss_t data = f_int64ss_t_initialize; { - const f_status_t status = f_int64ss_adjust(length, 0); + const f_status_t status = f_int64ss_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_adjust.h index af3236440..8b269268f 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_adjust.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_adjust.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int64ss_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int64ss_adjust() + * @see f_int64ss_adjust() */ -extern void test__f_type_array_int64ss_adjust__works(void **state); +extern void test__f_type_array_int64ss_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int64ss_adjust() + * @see f_int64ss_adjust() */ -extern void test__f_type_array_int64ss_adjust__parameter_checking(void **state); +extern void test__f_type_array_int64ss_adjust__works(void **state); #endif // _TEST__F_type_array__int64ss_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_append.c index f0bba2e0e..c69dc5a5a 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_append.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_append.c @@ -5,7 +5,18 @@ extern "C" { #endif -void test__f_type_array_int64ss_append__works(void **state) { +void test__f_type_array_int64ss_append__parameter_checking(void **state) { + + f_int64s_t data = f_int64s_t_initialize; + + { + const f_status_t status = f_int64ss_append(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +void test__f_type_array_int64ss_append__returns_data_not(void **state) { const int length = 5; f_int64s_t source = f_int64s_t_initialize; @@ -19,32 +30,19 @@ void test__f_type_array_int64ss_append__works(void **state) { assert_int_equal(source.size, length); } - for (; source.used < length; ++source.used) { - source.array[source.used] = source.used + 1; - } // for - { const f_status_t status = f_int64ss_append(source, &destination); - assert_int_equal(status, F_none); - assert_int_equal(destination.used, 1); - assert_int_equal(destination.array[0].used, source.used); - assert_int_equal(destination.array[0].size, source.used); - - for (f_array_length_t i = 0; i < destination.array[0].used; ++i) { - assert_int_equal(destination.array[0].array[i], i + 1); - } // for + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + assert_null(destination.array); } - for (f_array_length_t i = 0; i < destination.used; ++i) { - free((void *) destination.array[i].array); - } // for - free((void *) source.array); - free((void *) destination.array); } -void test__f_type_array_int64ss_append__returns_data_not(void **state) { +void test__f_type_array_int64ss_append__works(void **state) { const int length = 5; f_int64s_t source = f_int64s_t_initialize; @@ -58,27 +56,29 @@ void test__f_type_array_int64ss_append__returns_data_not(void **state) { assert_int_equal(source.size, length); } + for (; source.used < length; ++source.used) { + source.array[source.used] = source.used + 1; + } // for + { const f_status_t status = f_int64ss_append(source, &destination); - assert_int_equal(status, F_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); - } - - free((void *) source.array); -} - -void test__f_type_array_int64ss_append__parameter_checking(void **state) { + assert_int_equal(status, F_none); + assert_int_equal(destination.used, 1); + assert_int_equal(destination.array[0].used, source.used); + assert_int_equal(destination.array[0].size, source.used); - f_int64s_t data = f_int64s_t_initialize; + for (f_array_length_t i = 0; i < destination.array[0].used; ++i) { + assert_int_equal(destination.array[0].array[i], i + 1); + } // for + } - { - const f_status_t status = f_int64ss_append(data, 0); + for (f_array_length_t i = 0; i < destination.used; ++i) { + free((void *) destination.array[i].array); + } // for - assert_int_equal(status, F_status_set_error(F_parameter)); - } + free((void *) source.array); + free((void *) destination.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_append.h index 69065b9b5..d60a6e93b 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_append.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_append.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__int64ss_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int64ss_append() + * @see f_int64ss_append() */ -extern void test__f_type_array_int64ss_append__works(void **state); +extern void test__f_type_array_int64ss_append__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_int64ss_append() + * @see f_int64ss_append() */ extern void test__f_type_array_int64ss_append__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int64ss_append() + * @see f_int64ss_append() */ -extern void test__f_type_array_int64ss_append__parameter_checking(void **state); +extern void test__f_type_array_int64ss_append__works(void **state); #endif // _TEST__F_type_array__int64ss_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_append_all.c index bd4b6672d..f2f53e6b3 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_append_all.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_append_all.c @@ -5,6 +5,43 @@ extern "C" { #endif +void test__f_type_array_int64ss_append_all__parameter_checking(void **state) { + + const f_int64ss_t data = f_int64ss_t_initialize; + + { + const f_status_t status = f_int64ss_append_all(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +void test__f_type_array_int64ss_append_all__returns_data_not(void **state) { + + const int length = 5; + f_int64ss_t source = f_int64ss_t_initialize; + f_int64ss_t destination = f_int64ss_t_initialize; + + { + const f_status_t status = f_int64ss_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + { + const f_status_t status = f_int64ss_append_all(source, &destination); + + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + assert_null(destination.array); + } + + free((void *) source.array); +} + void test__f_type_array_int64ss_append_all__works(void **state) { const int length = 5; @@ -63,43 +100,6 @@ void test__f_type_array_int64ss_append_all__works(void **state) { free((void *) destination.array); } -void test__f_type_array_int64ss_append_all__returns_data_not(void **state) { - - const int length = 5; - f_int64ss_t source = f_int64ss_t_initialize; - f_int64ss_t destination = f_int64ss_t_initialize; - - { - const f_status_t status = f_int64ss_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_int64ss_append_all(source, &destination); - - assert_int_equal(status, F_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); - } - - free((void *) source.array); -} - -void test__f_type_array_int64ss_append_all__parameter_checking(void **state) { - - const f_int64ss_t data = f_int64ss_t_initialize; - - { - const f_status_t status = f_int64ss_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_append_all.h index 6052ec529..abc9284c1 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_append_all.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_append_all.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__int64ss_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int64ss_append_all() + * @see f_int64ss_append_all() */ -extern void test__f_type_array_int64ss_append_all__works(void **state); +extern void test__f_type_array_int64ss_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_int64ss_append_all() + * @see f_int64ss_append_all() */ extern void test__f_type_array_int64ss_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int64ss_append_all() + * @see f_int64ss_append_all() */ -extern void test__f_type_array_int64ss_append_all__parameter_checking(void **state); +extern void test__f_type_array_int64ss_append_all__works(void **state); #endif // _TEST__F_type_array__int64ss_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_decimate_by.c index 03567e8e9..cf0e34d99 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_decimate_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_decimate_by.c @@ -5,10 +5,26 @@ extern "C" { #endif -void test__f_type_array_int64ss_decimate_by__works(void **state) { +void test__f_type_array_int64ss_decimate_by__parameter_checking(void **state) { + + const int length = 5; + f_int64ss_t data = f_int64ss_t_initialize; + + { + const f_status_t status = f_int64ss_decimate_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_int64ss_decimate_by__returns_data_not(void **state) { const int length = 5; - f_int64ss_t data = f_int64s_t_initialize; + f_int64ss_t data = f_int64ss_t_initialize; { const f_status_t status = f_int64ss_resize(length, &data); @@ -19,25 +35,33 @@ void test__f_type_array_int64ss_decimate_by__works(void **state) { } { - const f_status_t status = f_int64ss_decimate_by(length, &data); + const f_status_t status = f_int64ss_decimate_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_int64ss_decimate_by__parameter_checking(void **state) { +void test__f_type_array_int64ss_decimate_by__works(void **state) { const int length = 5; - f_int64ss_t data = f_int64s_t_initialize; + f_int64ss_t data = f_int64ss_t_initialize; { - const f_status_t status = f_int64ss_decimate_by(length, 0); + const f_status_t status = f_int64ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_int64ss_decimate_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_decimate_by.h index a813fff39..00445e73c 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_decimate_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_decimate_by.h @@ -11,17 +11,24 @@ #define _TEST__F_type_array__int64ss_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int64ss_decimate_by() + * @see f_int64ss_decimate_by() */ -extern void test__f_type_array_int64ss_decimate_by__works(void **state); +extern void test__f_type_array_int64ss_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * * @see f_type_array_int64ss_decimate_by() */ -extern void test__f_type_array_int64ss_decimate_by__parameter_checking(void **state); +extern void test__f_type_array_int64ss_decimate_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_int64ss_decimate_by() + */ +extern void test__f_type_array_int64ss_decimate_by__works(void **state); #endif // _TEST__F_type_array__int64ss_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_decrease_by.c index f2909c013..d93f5e2f7 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_decrease_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_decrease_by.c @@ -5,10 +5,26 @@ extern "C" { #endif -void test__f_type_array_int64ss_decrease_by__works(void **state) { +void test__f_type_array_int64ss_decrease_by__parameter_checking(void **state) { + + const int length = 5; + f_int64ss_t data = f_int64ss_t_initialize; + + { + const f_status_t status = f_int64ss_decrease_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_int64ss_decrease_by__returns_data_not(void **state) { const int length = 5; - f_int64ss_t data = f_int64s_t_initialize; + f_int64ss_t data = f_int64ss_t_initialize; { const f_status_t status = f_int64ss_resize(length, &data); @@ -19,25 +35,33 @@ void test__f_type_array_int64ss_decrease_by__works(void **state) { } { - const f_status_t status = f_int64ss_decrease_by(length, &data); + const f_status_t status = f_int64ss_decrease_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_int64ss_decrease_by__parameter_checking(void **state) { +void test__f_type_array_int64ss_decrease_by__works(void **state) { const int length = 5; - f_int64ss_t data = f_int64s_t_initialize; + f_int64ss_t data = f_int64ss_t_initialize; { - const f_status_t status = f_int64ss_decrease_by(length, 0); + const f_status_t status = f_int64ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_int64ss_decrease_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_decrease_by.h index 966ce27ca..b31868188 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_decrease_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_decrease_by.h @@ -11,17 +11,24 @@ #define _TEST__F_type_array__int64ss_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int64ss_decrease_by() + * @see f_int64ss_decrease_by() */ -extern void test__f_type_array_int64ss_decrease_by__works(void **state); +extern void test__f_type_array_int64ss_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_int64ss_decrease_by() + * @see f_int64ss_decrease_by() */ -extern void test__f_type_array_int64ss_decrease_by__parameter_checking(void **state); +extern void test__f_type_array_int64ss_decrease_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_int64ss_decrease_by() + */ +extern void test__f_type_array_int64ss_decrease_by__works(void **state); #endif // _TEST__F_type_array__int64ss_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_increase.c index b0e705438..f2521343f 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_increase.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_increase.c @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_int64ss_increase__works(void **state) { +void test__f_type_array_int64ss_increase__parameter_checking(void **state) { const int length = 5; f_int64ss_t data = f_int64s_t_initialize; { - const f_status_t status = f_int64ss_resize(length, &data); + const f_status_t status = f_int64ss_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_int64ss_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -34,7 +24,7 @@ void test__f_type_array_int64ss_increase__works(void **state) { void test__f_type_array_int64ss_increase__returns_data_not(void **state) { const int length = 5; - f_int64ss_t data = f_int64s_t_initialize; + f_int64ss_t data = f_int64ss_t_initialize; { const f_status_t status = f_int64ss_resize(length, &data); @@ -55,17 +45,27 @@ void test__f_type_array_int64ss_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_int64ss_increase__parameter_checking(void **state) { +void test__f_type_array_int64ss_increase__works(void **state) { const int length = 5; - f_int64ss_t data = f_int64s_t_initialize; + f_int64ss_t data = f_int64ss_t_initialize; { - const f_status_t status = f_int64ss_increase(length, 0); + const f_status_t status = f_int64ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_int64ss_increase(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); } free((void *) data.array); diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_increase.h index 2549016eb..a1e802a9b 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_increase.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_increase.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__int64ss_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int64ss_increase() + * @see f_int64ss_increase() */ -extern void test__f_type_array_int64ss_increase__works(void **state); +extern void test__f_type_array_int64ss_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_int64ss_increase() + * @see f_int64ss_increase() */ extern void test__f_type_array_int64ss_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int64ss_increase() + * @see f_int64ss_increase() */ -extern void test__f_type_array_int64ss_increase__parameter_checking(void **state); +extern void test__f_type_array_int64ss_increase__works(void **state); #endif // _TEST__F_type_array__int64ss_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_increase_by.c index 206def852..27238ba81 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_increase_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_increase_by.c @@ -5,10 +5,26 @@ extern "C" { #endif -void test__f_type_array_int64ss_increase_by__works(void **state) { +void test__f_type_array_int64ss_increase_by__parameter_checking(void **state) { + + const int length = 5; + f_int64ss_t data = f_int64ss_t_initialize; + + { + const f_status_t status = f_int64ss_increase_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_int64ss_increase_by__returns_data_not(void **state) { const int length = 5; - f_int64ss_t data = f_int64s_t_initialize; + f_int64ss_t data = f_int64ss_t_initialize; { const f_status_t status = f_int64ss_resize(length, &data); @@ -19,32 +35,48 @@ void test__f_type_array_int64ss_increase_by__works(void **state) { } { - data.used = length; + const f_status_t status = f_int64ss_increase_by(0, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + { const f_status_t status = f_int64ss_increase_by(length, &data); - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); } free((void *) data.array); } -void test__f_type_array_int64ss_increase_by__parameter_checking(void **state) { +void test__f_type_array_int64ss_increase_by__works(void **state) { const int length = 5; - f_int64ss_t data = f_int64s_t_initialize; + f_int64ss_t data = f_int64ss_t_initialize; { - const f_status_t status = f_int64ss_increase_by(length, 0); + const f_status_t status = f_int64ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + { + data.used = length; + + const f_status_t status = f_int64ss_increase_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_increase_by.h index 689f6586f..62fe6111e 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_increase_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_increase_by.h @@ -11,17 +11,24 @@ #define _TEST__F_type_array__int64ss_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int64ss_increase_by() + * @see f_int64ss_increase_by() */ -extern void test__f_type_array_int64ss_increase_by__works(void **state); +extern void test__f_type_array_int64ss_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_int64ss_increase_by() + * @see f_int64ss_increase_by() */ -extern void test__f_type_array_int64ss_increase_by__parameter_checking(void **state); +extern void test__f_type_array_int64ss_increase_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_int64ss_increase_by() + */ +extern void test__f_type_array_int64ss_increase_by__works(void **state); #endif // _TEST__F_type_array__int64ss_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_resize.c index cceffafa8..65b19ea46 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_resize.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_resize.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_int64ss_resize__works(void **state) { +void test__f_type_array_int64ss_resize__parameter_checking(void **state) { const int length = 5; f_int64ss_t data = f_int64ss_t_initialize; { - const f_status_t status = f_int64ss_resize(length, &data); + const f_status_t status = f_int64ss_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_int64ss_resize__parameter_checking(void **state) { +void test__f_type_array_int64ss_resize__works(void **state) { const int length = 5; f_int64ss_t data = f_int64ss_t_initialize; { - const f_status_t status = f_int64ss_resize(length, 0); + const f_status_t status = f_int64ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_resize.h index 4d8570239..16eaef93d 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_resize.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int64ss_resize.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int64ss_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int64ss_resize() + * @see f_int64ss_resize() */ -extern void test__f_type_array_int64ss_resize__works(void **state); +extern void test__f_type_array_int64ss_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int64ss_resize() + * @see f_int64ss_resize() */ -extern void test__f_type_array_int64ss_resize__parameter_checking(void **state); +extern void test__f_type_array_int64ss_resize__works(void **state); #endif // _TEST__F_type_array__int64ss_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_adjust.c index f857eb0e0..ff4db0190 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_adjust.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_adjust.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_int8s_adjust__works(void **state) { +void test__f_type_array_int8s_adjust__parameter_checking(void **state) { const int length = 5; f_int8s_t data = f_int8s_t_initialize; { - const f_status_t status = f_int8s_adjust(length, &data); + const f_status_t status = f_int8s_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_int8s_adjust__parameter_checking(void **state) { +void test__f_type_array_int8s_adjust__works(void **state) { const int length = 5; f_int8s_t data = f_int8s_t_initialize; { - const f_status_t status = f_int8s_adjust(length, 0); + const f_status_t status = f_int8s_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_adjust.h index 6fea315bb..cd772f56b 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_adjust.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_adjust.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int8s_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int8s_adjust() + * @see f_int8s_adjust() */ -extern void test__f_type_array_int8s_adjust__works(void **state); +extern void test__f_type_array_int8s_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int8s_adjust() + * @see f_int8s_adjust() */ -extern void test__f_type_array_int8s_adjust__parameter_checking(void **state); +extern void test__f_type_array_int8s_adjust__works(void **state); #endif // _TEST__F_type_array__int8s_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_append.c index 8412a3e20..1eef1eaf7 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_append.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_append.c @@ -5,6 +5,17 @@ extern "C" { #endif +void test__f_type_array_int8s_append__parameter_checking(void **state) { + + const int8_t data = 0; + + { + const f_status_t status = f_int8s_append(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + void test__f_type_array_int8s_append__works(void **state) { const int8_t source = 3; @@ -21,17 +32,6 @@ void test__f_type_array_int8s_append__works(void **state) { free((void *) destination.array); } -void test__f_type_array_int8s_append__parameter_checking(void **state) { - - const uint8_t data = 0; - - { - const f_status_t status = f_int8s_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_append.h index 221938dd1..fd718cd19 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_append.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_append.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int8s_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int8s_append() + * @see f_int8s_append() */ -extern void test__f_type_array_int8s_append__works(void **state); +extern void test__f_type_array_int8s_append__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int8s_append() + * @see f_int8s_append() */ -extern void test__f_type_array_int8s_append__parameter_checking(void **state); +extern void test__f_type_array_int8s_append__works(void **state); #endif // _TEST__F_type_array__int8s_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_append_all.c index 79279e3aa..1246f5930 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_append_all.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_append_all.c @@ -5,10 +5,20 @@ extern "C" { #endif -void test__f_type_array_int8s_append_all__works(void **state) { +void test__f_type_array_int8s_append_all__parameter_checking(void **state) { + + const f_int8s_t data = f_int8s_t_initialize; + + { + const f_status_t status = f_int8s_append_all(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +void test__f_type_array_int8s_append_all__returns_data_not(void **state) { const int length = 5; - const int length_used = 2; f_int8s_t source = f_int8s_t_initialize; f_int8s_t destination = f_int8s_t_initialize; @@ -20,29 +30,22 @@ void test__f_type_array_int8s_append_all__works(void **state) { assert_int_equal(source.size, length); } - for (; source.used < length_used; ++source.used) { - source.array[source.used] = source.used + 1; - } // for - { const f_status_t status = f_int8s_append_all(source, &destination); - assert_int_equal(status, F_none); - assert_int_equal(destination.used, source.used); - assert_int_equal(destination.size, source.used); - - for (f_array_length_t i = 0; i < source.used; ++i) { - assert_int_equal(destination.array[i], i + 1); - } // for + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + assert_null(destination.array); } free((void *) source.array); - free((void *) destination.array); } -void test__f_type_array_int8s_append_all__returns_data_not(void **state) { +void test__f_type_array_int8s_append_all__works(void **state) { const int length = 5; + const int length_used = 2; f_int8s_t source = f_int8s_t_initialize; f_int8s_t destination = f_int8s_t_initialize; @@ -54,27 +57,24 @@ void test__f_type_array_int8s_append_all__returns_data_not(void **state) { assert_int_equal(source.size, length); } + for (; source.used < length_used; ++source.used) { + source.array[source.used] = source.used + 1; + } // for + { const f_status_t status = f_int8s_append_all(source, &destination); - assert_int_equal(status, F_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); + assert_int_equal(status, F_none); + assert_int_equal(destination.used, source.used); + assert_int_equal(destination.size, source.used); + + for (f_array_length_t i = 0; i < source.used; ++i) { + assert_int_equal(destination.array[i], i + 1); + } // for } free((void *) source.array); -} - -void test__f_type_array_int8s_append_all__parameter_checking(void **state) { - - const f_int8s_t data = f_int8s_t_initialize; - - { - const f_status_t status = f_int8s_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } + free((void *) destination.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_append_all.h index 28e46c8c6..ce99af9fc 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_append_all.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_append_all.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__int8s_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int8s_append_all() + * @see f_int8s_append_all() */ -extern void test__f_type_array_int8s_append_all__works(void **state); +extern void test__f_type_array_int8s_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_int8s_append_all() + * @see f_int8s_append_all() */ extern void test__f_type_array_int8s_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int8s_append_all() + * @see f_int8s_append_all() */ -extern void test__f_type_array_int8s_append_all__parameter_checking(void **state); +extern void test__f_type_array_int8s_append_all__works(void **state); #endif // _TEST__F_type_array__int8s_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_decimate_by.c index 388ed4957..19cd30853 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_decimate_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_decimate_by.c @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_int8s_decimate_by__works(void **state) { +void test__f_type_array_int8s_decimate_by__parameter_checking(void **state) { const int length = 5; f_int8s_t data = f_int8s_t_initialize; { - const f_status_t status = f_int8s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int8s_decimate_by(length, &data); + const f_status_t status = f_int8s_decimate_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_int8s_decimate_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_int8s_decimate_by__parameter_checking(void **state) { +void test__f_type_array_int8s_decimate_by__works(void **state) { const int length = 5; f_int8s_t data = f_int8s_t_initialize; { - const f_status_t status = f_int8s_decimate_by(length, 0); + const f_status_t status = f_int8s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_int8s_decimate_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_decimate_by.h index 269b5d777..a73804b1e 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_decimate_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_decimate_by.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int8s_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int8s_decimate_by() + * @see f_int8s_decimate_by() */ -extern void test__f_type_array_int8s_decimate_by__works(void **state); +extern void test__f_type_array_int8s_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int8s_decimate_by() + * @see f_int8s_decimate_by() */ -extern void test__f_type_array_int8s_decimate_by__parameter_checking(void **state); +extern void test__f_type_array_int8s_decimate_by__works(void **state); #endif // _TEST__F_type_array__int8s_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_decrease_by.c index e5cfb1e2e..156501472 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_decrease_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_decrease_by.c @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_int8s_decrease_by__works(void **state) { +void test__f_type_array_int8s_decrease_by__parameter_checking(void **state) { const int length = 5; f_int8s_t data = f_int8s_t_initialize; { - const f_status_t status = f_int8s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_int8s_decrease_by(length, &data); + const f_status_t status = f_int8s_decrease_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_int8s_decrease_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_int8s_decrease_by__parameter_checking(void **state) { +void test__f_type_array_int8s_decrease_by__works(void **state) { const int length = 5; f_int8s_t data = f_int8s_t_initialize; { - const f_status_t status = f_int8s_decrease_by(length, 0); + const f_status_t status = f_int8s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_int8s_decrease_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_decrease_by.h index 61b3b8401..edba0a358 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_decrease_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_decrease_by.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int8s_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int8s_decrease_by() + * @see f_int8s_decrease_by() */ -extern void test__f_type_array_int8s_decrease_by__works(void **state); +extern void test__f_type_array_int8s_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int8s_decrease_by() + * @see f_int8s_decrease_by() */ -extern void test__f_type_array_int8s_decrease_by__parameter_checking(void **state); +extern void test__f_type_array_int8s_decrease_by__works(void **state); #endif // _TEST__F_type_array__int8s_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_increase.c index 37d9220ab..b79827a61 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_increase.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_increase.c @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_int8s_increase__works(void **state) { +void test__f_type_array_int8s_increase__parameter_checking(void **state) { const int length = 5; f_int8s_t data = f_int8s_t_initialize; { - const f_status_t status = f_int8s_resize(length, &data); + const f_status_t status = f_int8s_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_int8s_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -55,17 +45,27 @@ void test__f_type_array_int8s_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_int8s_increase__parameter_checking(void **state) { +void test__f_type_array_int8s_increase__works(void **state) { const int length = 5; f_int8s_t data = f_int8s_t_initialize; { - const f_status_t status = f_int8s_increase(length, 0); + const f_status_t status = f_int8s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_int8s_increase(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); } free((void *) data.array); diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_increase.h index 99012eada..0842e98e2 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_increase.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_increase.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__int8s_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int8s_increase() + * @see f_int8s_increase() */ -extern void test__f_type_array_int8s_increase__works(void **state); +extern void test__f_type_array_int8s_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_int8s_increase() + * @see f_int8s_increase() */ extern void test__f_type_array_int8s_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int8s_increase() + * @see f_int8s_increase() */ -extern void test__f_type_array_int8s_increase__parameter_checking(void **state); +extern void test__f_type_array_int8s_increase__works(void **state); #endif // _TEST__F_type_array__int8s_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_increase_by.c index d847d5220..6b022216a 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_increase_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_increase_by.c @@ -5,6 +5,22 @@ extern "C" { #endif +void test__f_type_array_int8s_increase_by__parameter_checking(void **state) { + + const int length = 5; + f_int8s_t data = f_int8s_t_initialize; + + { + const f_status_t status = f_int8s_increase_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + void test__f_type_array_int8s_increase_by__works(void **state) { const int length = 5; @@ -31,22 +47,6 @@ void test__f_type_array_int8s_increase_by__works(void **state) { free((void *) data.array); } -void test__f_type_array_int8s_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_int8s_t data = f_int8s_t_initialize; - - { - const f_status_t status = f_int8s_increase_by(length, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_increase_by.h index 0b903acc0..9934fed7c 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_increase_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_increase_by.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int8s_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int8s_increase_by() + * @see f_int8s_increase_by() */ -extern void test__f_type_array_int8s_increase_by__works(void **state); +extern void test__f_type_array_int8s_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int8s_increase_by() + * @see f_int8s_increase_by() */ -extern void test__f_type_array_int8s_increase_by__parameter_checking(void **state); +extern void test__f_type_array_int8s_increase_by__works(void **state); #endif // _TEST__F_type_array__int8s_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_resize.c index c367b7369..c6ec662fe 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_resize.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_resize.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_int8s_resize__works(void **state) { +void test__f_type_array_int8s_resize__parameter_checking(void **state) { const int length = 5; f_int8s_t data = f_int8s_t_initialize; { - const f_status_t status = f_int8s_resize(length, &data); + const f_status_t status = f_int8s_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_int8s_resize__parameter_checking(void **state) { +void test__f_type_array_int8s_resize__works(void **state) { const int length = 5; f_int8s_t data = f_int8s_t_initialize; { - const f_status_t status = f_int8s_resize(length, 0); + const f_status_t status = f_int8s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_resize.h index bf0e9ce72..175dfdb2f 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8s_resize.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8s_resize.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int8s_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int8s_resize() + * @see f_int8s_resize() */ -extern void test__f_type_array_int8s_resize__works(void **state); +extern void test__f_type_array_int8s_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int8s_resize() + * @see f_int8s_resize() */ -extern void test__f_type_array_int8s_resize__parameter_checking(void **state); +extern void test__f_type_array_int8s_resize__works(void **state); #endif // _TEST__F_type_array__int8s_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_adjust.c index d230abd2d..bbba3cd61 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_adjust.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_adjust.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_int8ss_adjust__works(void **state) { +void test__f_type_array_int8ss_adjust__parameter_checking(void **state) { const int length = 5; f_int8ss_t data = f_int8ss_t_initialize; { - const f_status_t status = f_int8ss_adjust(length, &data); + const f_status_t status = f_int8ss_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_int8ss_adjust__parameter_checking(void **state) { +void test__f_type_array_int8ss_adjust__works(void **state) { const int length = 5; f_int8ss_t data = f_int8ss_t_initialize; { - const f_status_t status = f_int8ss_adjust(length, 0); + const f_status_t status = f_int8ss_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_adjust.h index 6e982b8c5..7829380e0 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_adjust.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_adjust.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int8ss_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int8ss_adjust() + * @see f_int8ss_adjust() */ -extern void test__f_type_array_int8ss_adjust__works(void **state); +extern void test__f_type_array_int8ss_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int8ss_adjust() + * @see f_int8ss_adjust() */ -extern void test__f_type_array_int8ss_adjust__parameter_checking(void **state); +extern void test__f_type_array_int8ss_adjust__works(void **state); #endif // _TEST__F_type_array__int8ss_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_append.c index 5372566f1..f97a83b14 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_append.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_append.c @@ -5,7 +5,18 @@ extern "C" { #endif -void test__f_type_array_int8ss_append__works(void **state) { +void test__f_type_array_int8ss_append__parameter_checking(void **state) { + + f_int8s_t data = f_int8s_t_initialize; + + { + const f_status_t status = f_int8ss_append(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +void test__f_type_array_int8ss_append__returns_data_not(void **state) { const int length = 5; f_int8s_t source = f_int8s_t_initialize; @@ -19,32 +30,19 @@ void test__f_type_array_int8ss_append__works(void **state) { assert_int_equal(source.size, length); } - for (; source.used < length; ++source.used) { - source.array[source.used] = source.used + 1; - } // for - { const f_status_t status = f_int8ss_append(source, &destination); - assert_int_equal(status, F_none); - assert_int_equal(destination.used, 1); - assert_int_equal(destination.array[0].used, source.used); - assert_int_equal(destination.array[0].size, source.used); - - for (f_array_length_t i = 0; i < destination.array[0].used; ++i) { - assert_int_equal(destination.array[0].array[i], i + 1); - } // for + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + assert_null(destination.array); } - for (f_array_length_t i = 0; i < destination.used; ++i) { - free((void *) destination.array[i].array); - } // for - free((void *) source.array); - free((void *) destination.array); } -void test__f_type_array_int8ss_append__returns_data_not(void **state) { +void test__f_type_array_int8ss_append__works(void **state) { const int length = 5; f_int8s_t source = f_int8s_t_initialize; @@ -58,27 +56,29 @@ void test__f_type_array_int8ss_append__returns_data_not(void **state) { assert_int_equal(source.size, length); } + for (; source.used < length; ++source.used) { + source.array[source.used] = source.used + 1; + } // for + { const f_status_t status = f_int8ss_append(source, &destination); - assert_int_equal(status, F_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); - } - - free((void *) source.array); -} - -void test__f_type_array_int8ss_append__parameter_checking(void **state) { + assert_int_equal(status, F_none); + assert_int_equal(destination.used, 1); + assert_int_equal(destination.array[0].used, source.used); + assert_int_equal(destination.array[0].size, source.used); - f_int8s_t data = f_int8s_t_initialize; + for (f_array_length_t i = 0; i < destination.array[0].used; ++i) { + assert_int_equal(destination.array[0].array[i], i + 1); + } // for + } - { - const f_status_t status = f_int8ss_append(data, 0); + for (f_array_length_t i = 0; i < destination.used; ++i) { + free((void *) destination.array[i].array); + } // for - assert_int_equal(status, F_status_set_error(F_parameter)); - } + free((void *) source.array); + free((void *) destination.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_append.h index 57a27abf9..10734ea86 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_append.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_append.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__int8ss_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int8ss_append() + * @see f_int8ss_append() */ -extern void test__f_type_array_int8ss_append__works(void **state); +extern void test__f_type_array_int8ss_append__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_int8ss_append() + * @see f_int8ss_append() */ extern void test__f_type_array_int8ss_append__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int8ss_append() + * @see f_int8ss_append() */ -extern void test__f_type_array_int8ss_append__parameter_checking(void **state); +extern void test__f_type_array_int8ss_append__works(void **state); #endif // _TEST__F_type_array__int8ss_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_append_all.c index 6aeb35f3a..ea4b2db3e 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_append_all.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_append_all.c @@ -5,6 +5,43 @@ extern "C" { #endif +void test__f_type_array_int8ss_append_all__parameter_checking(void **state) { + + const f_int8ss_t data = f_int8ss_t_initialize; + + { + const f_status_t status = f_int8ss_append_all(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +void test__f_type_array_int8ss_append_all__returns_data_not(void **state) { + + const int length = 5; + f_int8ss_t source = f_int8ss_t_initialize; + f_int8ss_t destination = f_int8ss_t_initialize; + + { + const f_status_t status = f_int8ss_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + { + const f_status_t status = f_int8ss_append_all(source, &destination); + + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + assert_null(destination.array); + } + + free((void *) source.array); +} + void test__f_type_array_int8ss_append_all__works(void **state) { const int length = 5; @@ -63,43 +100,6 @@ void test__f_type_array_int8ss_append_all__works(void **state) { free((void *) destination.array); } -void test__f_type_array_int8ss_append_all__returns_data_not(void **state) { - - const int length = 5; - f_int8ss_t source = f_int8ss_t_initialize; - f_int8ss_t destination = f_int8ss_t_initialize; - - { - const f_status_t status = f_int8ss_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_int8ss_append_all(source, &destination); - - assert_int_equal(status, F_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); - } - - free((void *) source.array); -} - -void test__f_type_array_int8ss_append_all__parameter_checking(void **state) { - - const f_int8ss_t data = f_int8ss_t_initialize; - - { - const f_status_t status = f_int8ss_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_append_all.h index 2ce922d3f..5cd3b49a4 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_append_all.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_append_all.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__int8ss_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int8ss_append_all() + * @see f_int8ss_append_all() */ -extern void test__f_type_array_int8ss_append_all__works(void **state); +extern void test__f_type_array_int8ss_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_int8ss_append_all() + * @see f_int8ss_append_all() */ extern void test__f_type_array_int8ss_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int8ss_append_all() + * @see f_int8ss_append_all() */ -extern void test__f_type_array_int8ss_append_all__parameter_checking(void **state); +extern void test__f_type_array_int8ss_append_all__works(void **state); #endif // _TEST__F_type_array__int8ss_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_decimate_by.c index 373da6343..048822334 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_decimate_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_decimate_by.c @@ -5,10 +5,26 @@ extern "C" { #endif -void test__f_type_array_int8ss_decimate_by__works(void **state) { +void test__f_type_array_int8ss_decimate_by__parameter_checking(void **state) { + + const int length = 5; + f_int8ss_t data = f_int8ss_t_initialize; + + { + const f_status_t status = f_int8ss_decimate_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_int8ss_decimate_by__returns_data_not(void **state) { const int length = 5; - f_int8ss_t data = f_int8s_t_initialize; + f_int8ss_t data = f_int8ss_t_initialize; { const f_status_t status = f_int8ss_resize(length, &data); @@ -19,25 +35,33 @@ void test__f_type_array_int8ss_decimate_by__works(void **state) { } { - const f_status_t status = f_int8ss_decimate_by(length, &data); + const f_status_t status = f_int8ss_decimate_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_int8ss_decimate_by__parameter_checking(void **state) { +void test__f_type_array_int8ss_decimate_by__works(void **state) { const int length = 5; - f_int8ss_t data = f_int8s_t_initialize; + f_int8ss_t data = f_int8ss_t_initialize; { - const f_status_t status = f_int8ss_decimate_by(length, 0); + const f_status_t status = f_int8ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_int8ss_decimate_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_decimate_by.h index aba84119c..a1a415fd5 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_decimate_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_decimate_by.h @@ -11,17 +11,24 @@ #define _TEST__F_type_array__int8ss_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int8ss_decimate_by() + * @see f_int8ss_decimate_by() */ -extern void test__f_type_array_int8ss_decimate_by__works(void **state); +extern void test__f_type_array_int8ss_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * * @see f_type_array_int8ss_decimate_by() */ -extern void test__f_type_array_int8ss_decimate_by__parameter_checking(void **state); +extern void test__f_type_array_int8ss_decimate_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_int8ss_decimate_by() + */ +extern void test__f_type_array_int8ss_decimate_by__works(void **state); #endif // _TEST__F_type_array__int8ss_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_decrease_by.c index 67e3342cb..d6dc68e33 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_decrease_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_decrease_by.c @@ -5,10 +5,26 @@ extern "C" { #endif -void test__f_type_array_int8ss_decrease_by__works(void **state) { +void test__f_type_array_int8ss_decrease_by__parameter_checking(void **state) { + + const int length = 5; + f_int8ss_t data = f_int8ss_t_initialize; + + { + const f_status_t status = f_int8ss_decrease_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_int8ss_decrease_by__returns_data_not(void **state) { const int length = 5; - f_int8ss_t data = f_int8s_t_initialize; + f_int8ss_t data = f_int8ss_t_initialize; { const f_status_t status = f_int8ss_resize(length, &data); @@ -19,25 +35,33 @@ void test__f_type_array_int8ss_decrease_by__works(void **state) { } { - const f_status_t status = f_int8ss_decrease_by(length, &data); + const f_status_t status = f_int8ss_decrease_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_int8ss_decrease_by__parameter_checking(void **state) { +void test__f_type_array_int8ss_decrease_by__works(void **state) { const int length = 5; - f_int8ss_t data = f_int8s_t_initialize; + f_int8ss_t data = f_int8ss_t_initialize; { - const f_status_t status = f_int8ss_decrease_by(length, 0); + const f_status_t status = f_int8ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_int8ss_decrease_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_decrease_by.h index 2925c2465..a216a857f 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_decrease_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_decrease_by.h @@ -11,17 +11,24 @@ #define _TEST__F_type_array__int8ss_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int8ss_decrease_by() + * @see f_int8ss_decrease_by() */ -extern void test__f_type_array_int8ss_decrease_by__works(void **state); +extern void test__f_type_array_int8ss_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_int8ss_decrease_by() + * @see f_int8ss_decrease_by() */ -extern void test__f_type_array_int8ss_decrease_by__parameter_checking(void **state); +extern void test__f_type_array_int8ss_decrease_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_int8ss_decrease_by() + */ +extern void test__f_type_array_int8ss_decrease_by__works(void **state); #endif // _TEST__F_type_array__int8ss_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_increase.c index 39445e040..0cc0c5038 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_increase.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_increase.c @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_int8ss_increase__works(void **state) { +void test__f_type_array_int8ss_increase__parameter_checking(void **state) { const int length = 5; f_int8ss_t data = f_int8s_t_initialize; { - const f_status_t status = f_int8ss_resize(length, &data); + const f_status_t status = f_int8ss_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_int8ss_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -34,7 +24,7 @@ void test__f_type_array_int8ss_increase__works(void **state) { void test__f_type_array_int8ss_increase__returns_data_not(void **state) { const int length = 5; - f_int8ss_t data = f_int8s_t_initialize; + f_int8ss_t data = f_int8ss_t_initialize; { const f_status_t status = f_int8ss_resize(length, &data); @@ -55,17 +45,27 @@ void test__f_type_array_int8ss_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_int8ss_increase__parameter_checking(void **state) { +void test__f_type_array_int8ss_increase__works(void **state) { const int length = 5; - f_int8ss_t data = f_int8s_t_initialize; + f_int8ss_t data = f_int8ss_t_initialize; { - const f_status_t status = f_int8ss_increase(length, 0); + const f_status_t status = f_int8ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_int8ss_increase(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); } free((void *) data.array); diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_increase.h index 1d18bb67b..4f496a9e6 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_increase.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_increase.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__int8ss_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int8ss_increase() + * @see f_int8ss_increase() */ -extern void test__f_type_array_int8ss_increase__works(void **state); +extern void test__f_type_array_int8ss_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_int8ss_increase() + * @see f_int8ss_increase() */ extern void test__f_type_array_int8ss_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int8ss_increase() + * @see f_int8ss_increase() */ -extern void test__f_type_array_int8ss_increase__parameter_checking(void **state); +extern void test__f_type_array_int8ss_increase__works(void **state); #endif // _TEST__F_type_array__int8ss_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_increase_by.c index dc4f64ee6..f37b14b78 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_increase_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_increase_by.c @@ -5,10 +5,26 @@ extern "C" { #endif -void test__f_type_array_int8ss_increase_by__works(void **state) { +void test__f_type_array_int8ss_increase_by__parameter_checking(void **state) { + + const int length = 5; + f_int8ss_t data = f_int8ss_t_initialize; + + { + const f_status_t status = f_int8ss_increase_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_int8ss_increase_by__returns_data_not(void **state) { const int length = 5; - f_int8ss_t data = f_int8s_t_initialize; + f_int8ss_t data = f_int8ss_t_initialize; { const f_status_t status = f_int8ss_resize(length, &data); @@ -19,32 +35,48 @@ void test__f_type_array_int8ss_increase_by__works(void **state) { } { - data.used = length; + const f_status_t status = f_int8ss_increase_by(0, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + { const f_status_t status = f_int8ss_increase_by(length, &data); - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); } free((void *) data.array); } -void test__f_type_array_int8ss_increase_by__parameter_checking(void **state) { +void test__f_type_array_int8ss_increase_by__works(void **state) { const int length = 5; - f_int8ss_t data = f_int8s_t_initialize; + f_int8ss_t data = f_int8ss_t_initialize; { - const f_status_t status = f_int8ss_increase_by(length, 0); + const f_status_t status = f_int8ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + { + data.used = length; + + const f_status_t status = f_int8ss_increase_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_increase_by.h index 1c8071937..0975deacf 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_increase_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_increase_by.h @@ -11,17 +11,24 @@ #define _TEST__F_type_array__int8ss_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int8ss_increase_by() + * @see f_int8ss_increase_by() */ -extern void test__f_type_array_int8ss_increase_by__works(void **state); +extern void test__f_type_array_int8ss_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_int8ss_increase_by() + * @see f_int8ss_increase_by() */ -extern void test__f_type_array_int8ss_increase_by__parameter_checking(void **state); +extern void test__f_type_array_int8ss_increase_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_int8ss_increase_by() + */ +extern void test__f_type_array_int8ss_increase_by__works(void **state); #endif // _TEST__F_type_array__int8ss_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_resize.c index 49b9f42a9..b3ef69cfa 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_resize.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_resize.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_int8ss_resize__works(void **state) { +void test__f_type_array_int8ss_resize__parameter_checking(void **state) { const int length = 5; f_int8ss_t data = f_int8ss_t_initialize; { - const f_status_t status = f_int8ss_resize(length, &data); + const f_status_t status = f_int8ss_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_int8ss_resize__parameter_checking(void **state) { +void test__f_type_array_int8ss_resize__works(void **state) { const int length = 5; f_int8ss_t data = f_int8ss_t_initialize; { - const f_status_t status = f_int8ss_resize(length, 0); + const f_status_t status = f_int8ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_resize.h index 42dda375b..ba5ab366f 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_resize.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-int8ss_resize.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__int8ss_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_int8ss_resize() + * @see f_int8ss_resize() */ -extern void test__f_type_array_int8ss_resize__works(void **state); +extern void test__f_type_array_int8ss_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_int8ss_resize() + * @see f_int8ss_resize() */ -extern void test__f_type_array_int8ss_resize__parameter_checking(void **state); +extern void test__f_type_array_int8ss_resize__works(void **state); #endif // _TEST__F_type_array__int8ss_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-states_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-states_adjust.c index 4337c9935..3ec472769 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-states_adjust.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-states_adjust.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_states_adjust__works(void **state) { +void test__f_type_array_states_adjust__parameter_checking(void **state) { const int length = 5; f_states_t data = f_states_t_initialize; { - const f_status_t status = f_states_adjust(length, &data); + const f_status_t status = f_states_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_states_adjust__parameter_checking(void **state) { +void test__f_type_array_states_adjust__works(void **state) { const int length = 5; f_states_t data = f_states_t_initialize; { - const f_status_t status = f_states_adjust(length, 0); + const f_status_t status = f_states_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-states_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-states_adjust.h index dbc993a87..33e083f34 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-states_adjust.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-states_adjust.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__states_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_states_adjust() + * @see f_states_adjust() */ -extern void test__f_type_array_states_adjust__works(void **state); +extern void test__f_type_array_states_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_states_adjust() + * @see f_states_adjust() */ -extern void test__f_type_array_states_adjust__parameter_checking(void **state); +extern void test__f_type_array_states_adjust__works(void **state); #endif // _TEST__F_type_array__states_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-states_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-states_append.c index e142cfa94..11d2fe4fe 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-states_append.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-states_append.c @@ -5,6 +5,17 @@ extern "C" { #endif +void test__f_type_array_states_append__parameter_checking(void **state) { + + const f_state_t data = f_state_t_initialize; + + { + const f_status_t status = f_states_append(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + void test__f_type_array_states_append__works(void **state) { int fake_1 = 1; @@ -31,17 +42,6 @@ void test__f_type_array_states_append__works(void **state) { free((void *) destination.array); } -void test__f_type_array_states_append__parameter_checking(void **state) { - - const f_state_t data = f_state_t_initialize; - - { - const f_status_t status = f_states_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-states_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-states_append.h index 43d227d61..57c23ab76 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-states_append.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-states_append.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__states_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_states_append() + * @see f_states_append() */ -extern void test__f_type_array_states_append__works(void **state); +extern void test__f_type_array_states_append__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_states_append() + * @see f_states_append() */ -extern void test__f_type_array_states_append__parameter_checking(void **state); +extern void test__f_type_array_states_append__works(void **state); #endif // _TEST__F_type_array__states_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-states_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-states_append_all.c index 0c7938ca3..9616d7519 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-states_append_all.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-states_append_all.c @@ -5,6 +5,43 @@ extern "C" { #endif +void test__f_type_array_states_append_all__parameter_checking(void **state) { + + const f_states_t data = f_states_t_initialize; + + { + const f_status_t status = f_states_append_all(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +void test__f_type_array_states_append_all__returns_data_not(void **state) { + + const int length = 5; + f_states_t source = f_states_t_initialize; + f_states_t destination = f_states_t_initialize; + + { + const f_status_t status = f_states_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + { + const f_status_t status = f_states_append_all(source, &destination); + + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + assert_null(destination.array); + } + + free((void *) source.array); +} + void test__f_type_array_states_append_all__works(void **state) { const int length = 5; @@ -53,43 +90,6 @@ void test__f_type_array_states_append_all__works(void **state) { free((void *) destination.array); } -void test__f_type_array_states_append_all__returns_data_not(void **state) { - - const int length = 5; - f_states_t source = f_states_t_initialize; - f_states_t destination = f_states_t_initialize; - - { - const f_status_t status = f_states_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_states_append_all(source, &destination); - - assert_int_equal(status, F_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); - } - - free((void *) source.array); -} - -void test__f_type_array_states_append_all__parameter_checking(void **state) { - - const f_states_t data = f_states_t_initialize; - - { - const f_status_t status = f_states_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-states_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-states_append_all.h index a1f2babcc..68cb6a55b 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-states_append_all.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-states_append_all.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__states_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_states_append_all() + * @see f_states_append_all() */ -extern void test__f_type_array_states_append_all__works(void **state); +extern void test__f_type_array_states_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_states_append_all() + * @see f_states_append_all() */ extern void test__f_type_array_states_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_states_append_all() + * @see f_states_append_all() */ -extern void test__f_type_array_states_append_all__parameter_checking(void **state); +extern void test__f_type_array_states_append_all__works(void **state); #endif // _TEST__F_type_array__states_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-states_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-states_decimate_by.c index 0594ff3ef..e74f0b72f 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-states_decimate_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-states_decimate_by.c @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_states_decimate_by__works(void **state) { +void test__f_type_array_states_decimate_by__parameter_checking(void **state) { const int length = 5; f_states_t data = f_states_t_initialize; { - const f_status_t status = f_states_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_states_decimate_by(length, &data); + const f_status_t status = f_states_decimate_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_states_decimate_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_states_decimate_by__parameter_checking(void **state) { +void test__f_type_array_states_decimate_by__works(void **state) { const int length = 5; f_states_t data = f_states_t_initialize; { - const f_status_t status = f_states_decimate_by(length, 0); + const f_status_t status = f_states_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_states_decimate_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-states_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-states_decimate_by.h index a12f3ce1a..7c983cd81 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-states_decimate_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-states_decimate_by.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__states_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_states_decimate_by() + * @see f_states_decimate_by() */ -extern void test__f_type_array_states_decimate_by__works(void **state); +extern void test__f_type_array_states_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_states_decimate_by() + * @see f_states_decimate_by() */ -extern void test__f_type_array_states_decimate_by__parameter_checking(void **state); +extern void test__f_type_array_states_decimate_by__works(void **state); #endif // _TEST__F_type_array__states_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-states_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-states_decrease_by.c index 69f02f385..1b15b17c4 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-states_decrease_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-states_decrease_by.c @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_states_decrease_by__works(void **state) { +void test__f_type_array_states_decrease_by__parameter_checking(void **state) { const int length = 5; f_states_t data = f_states_t_initialize; { - const f_status_t status = f_states_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_states_decrease_by(length, &data); + const f_status_t status = f_states_decrease_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_states_decrease_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_states_decrease_by__parameter_checking(void **state) { +void test__f_type_array_states_decrease_by__works(void **state) { const int length = 5; f_states_t data = f_states_t_initialize; { - const f_status_t status = f_states_decrease_by(length, 0); + const f_status_t status = f_states_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_states_decrease_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-states_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-states_decrease_by.h index 6b0e7da0d..d79921a61 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-states_decrease_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-states_decrease_by.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__states_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_states_decrease_by() + * @see f_states_decrease_by() */ -extern void test__f_type_array_states_decrease_by__works(void **state); +extern void test__f_type_array_states_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_states_decrease_by() + * @see f_states_decrease_by() */ -extern void test__f_type_array_states_decrease_by__parameter_checking(void **state); +extern void test__f_type_array_states_decrease_by__works(void **state); #endif // _TEST__F_type_array__states_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-states_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-states_increase.c index 36bd2cb50..cacd401da 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-states_increase.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-states_increase.c @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_states_increase__works(void **state) { +void test__f_type_array_states_increase__parameter_checking(void **state) { const int length = 5; f_states_t data = f_states_t_initialize; { - const f_status_t status = f_states_resize(length, &data); + const f_status_t status = f_states_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_states_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -55,17 +45,27 @@ void test__f_type_array_states_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_states_increase__parameter_checking(void **state) { +void test__f_type_array_states_increase__works(void **state) { const int length = 5; f_states_t data = f_states_t_initialize; { - const f_status_t status = f_states_increase(length, 0); + const f_status_t status = f_states_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_states_increase(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); } free((void *) data.array); diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-states_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-states_increase.h index f3443ab0f..d82fa0a2e 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-states_increase.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-states_increase.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__states_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_states_increase() + * @see f_states_increase() */ -extern void test__f_type_array_states_increase__works(void **state); +extern void test__f_type_array_states_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_states_increase() + * @see f_states_increase() */ extern void test__f_type_array_states_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_states_increase() + * @see f_states_increase() */ -extern void test__f_type_array_states_increase__parameter_checking(void **state); +extern void test__f_type_array_states_increase__works(void **state); #endif // _TEST__F_type_array__states_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-states_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-states_increase_by.c index 7fa61bd74..3cfc0b928 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-states_increase_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-states_increase_by.c @@ -5,6 +5,22 @@ extern "C" { #endif +void test__f_type_array_states_increase_by__parameter_checking(void **state) { + + const int length = 5; + f_states_t data = f_states_t_initialize; + + { + const f_status_t status = f_states_increase_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + void test__f_type_array_states_increase_by__works(void **state) { const int length = 5; @@ -31,22 +47,6 @@ void test__f_type_array_states_increase_by__works(void **state) { free((void *) data.array); } -void test__f_type_array_states_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_states_t data = f_states_t_initialize; - - { - const f_status_t status = f_states_increase_by(length, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-states_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-states_increase_by.h index e78e99eb3..1b1011ff6 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-states_increase_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-states_increase_by.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__states_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_states_increase_by() + * @see f_states_increase_by() */ -extern void test__f_type_array_states_increase_by__works(void **state); +extern void test__f_type_array_states_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_states_increase_by() + * @see f_states_increase_by() */ -extern void test__f_type_array_states_increase_by__parameter_checking(void **state); +extern void test__f_type_array_states_increase_by__works(void **state); #endif // _TEST__F_type_array__states_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-states_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-states_resize.c index ada5a9bcf..3751188dd 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-states_resize.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-states_resize.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_states_resize__works(void **state) { +void test__f_type_array_states_resize__parameter_checking(void **state) { const int length = 5; f_states_t data = f_states_t_initialize; { - const f_status_t status = f_states_resize(length, &data); + const f_status_t status = f_states_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_states_resize__parameter_checking(void **state) { +void test__f_type_array_states_resize__works(void **state) { const int length = 5; f_states_t data = f_states_t_initialize; { - const f_status_t status = f_states_resize(length, 0); + const f_status_t status = f_states_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-states_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-states_resize.h index 79e7979a3..5a86821cd 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-states_resize.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-states_resize.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__states_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_states_resize() + * @see f_states_resize() */ -extern void test__f_type_array_states_resize__works(void **state); +extern void test__f_type_array_states_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_states_resize() + * @see f_states_resize() */ -extern void test__f_type_array_states_resize__parameter_checking(void **state); +extern void test__f_type_array_states_resize__works(void **state); #endif // _TEST__F_type_array__states_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statess_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-statess_adjust.c index 61b28e3b9..883bd1d6e 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statess_adjust.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statess_adjust.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_statess_adjust__works(void **state) { +void test__f_type_array_statess_adjust__parameter_checking(void **state) { const int length = 5; f_statess_t data = f_statess_t_initialize; { - const f_status_t status = f_statess_adjust(length, &data); + const f_status_t status = f_statess_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_statess_adjust__parameter_checking(void **state) { +void test__f_type_array_statess_adjust__works(void **state) { const int length = 5; f_statess_t data = f_statess_t_initialize; { - const f_status_t status = f_statess_adjust(length, 0); + const f_status_t status = f_statess_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statess_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-statess_adjust.h index 5cb604e0f..0fa2318f8 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statess_adjust.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statess_adjust.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__statess_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_statess_adjust() + * @see f_statess_adjust() */ -extern void test__f_type_array_statess_adjust__works(void **state); +extern void test__f_type_array_statess_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_statess_adjust() + * @see f_statess_adjust() */ -extern void test__f_type_array_statess_adjust__parameter_checking(void **state); +extern void test__f_type_array_statess_adjust__works(void **state); #endif // _TEST__F_type_array__statess_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statess_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-statess_append.c index 2f471e3dc..600d61a3a 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statess_append.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statess_append.c @@ -5,6 +5,43 @@ extern "C" { #endif +void test__f_type_array_statess_append__parameter_checking(void **state) { + + f_states_t data = f_states_t_initialize; + + { + const f_status_t status = f_statess_append(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +void test__f_type_array_statess_append__returns_data_not(void **state) { + + const int length = 5; + f_states_t source = f_states_t_initialize; + f_statess_t destination = f_statess_t_initialize; + + { + const f_status_t status = f_states_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + { + const f_status_t status = f_statess_append(source, &destination); + + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + assert_null(destination.array); + } + + free((void *) source.array); +} + void test__f_type_array_statess_append__works(void **state) { const int length = 5; @@ -57,43 +94,6 @@ void test__f_type_array_statess_append__works(void **state) { free((void *) destination.array); } -void test__f_type_array_statess_append__returns_data_not(void **state) { - - const int length = 5; - f_states_t source = f_states_t_initialize; - f_statess_t destination = f_statess_t_initialize; - - { - const f_status_t status = f_states_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_statess_append(source, &destination); - - assert_int_equal(status, F_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); - } - - free((void *) source.array); -} - -void test__f_type_array_statess_append__parameter_checking(void **state) { - - f_states_t data = f_states_t_initialize; - - { - const f_status_t status = f_statess_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statess_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-statess_append.h index 54f6bf4f4..655f57376 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statess_append.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statess_append.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__statess_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_statess_append() + * @see f_statess_append() */ -extern void test__f_type_array_statess_append__works(void **state); +extern void test__f_type_array_statess_append__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_statess_append() + * @see f_statess_append() */ extern void test__f_type_array_statess_append__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_statess_append() + * @see f_statess_append() */ -extern void test__f_type_array_statess_append__parameter_checking(void **state); +extern void test__f_type_array_statess_append__works(void **state); #endif // _TEST__F_type_array__statess_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statess_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-statess_append_all.c index 91463562e..d78b52293 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statess_append_all.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statess_append_all.c @@ -5,6 +5,43 @@ extern "C" { #endif +void test__f_type_array_statess_append_all__parameter_checking(void **state) { + + const f_statess_t data = f_statess_t_initialize; + + { + const f_status_t status = f_statess_append_all(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +void test__f_type_array_statess_append_all__returns_data_not(void **state) { + + const int length = 5; + f_statess_t source = f_statess_t_initialize; + f_statess_t destination = f_statess_t_initialize; + + { + const f_status_t status = f_statess_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + { + const f_status_t status = f_statess_append_all(source, &destination); + + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + assert_null(destination.array); + } + + free((void *) source.array); +} + void test__f_type_array_statess_append_all__works(void **state) { const int length = 5; @@ -77,43 +114,6 @@ void test__f_type_array_statess_append_all__works(void **state) { free((void *) destination.array); } -void test__f_type_array_statess_append_all__returns_data_not(void **state) { - - const int length = 5; - f_statess_t source = f_statess_t_initialize; - f_statess_t destination = f_statess_t_initialize; - - { - const f_status_t status = f_statess_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_statess_append_all(source, &destination); - - assert_int_equal(status, F_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); - } - - free((void *) source.array); -} - -void test__f_type_array_statess_append_all__parameter_checking(void **state) { - - const f_statess_t data = f_statess_t_initialize; - - { - const f_status_t status = f_statess_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statess_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-statess_append_all.h index b8a72ead0..b57c1f0ff 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statess_append_all.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statess_append_all.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__statess_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_statess_append_all() + * @see f_statess_append_all() */ -extern void test__f_type_array_statess_append_all__works(void **state); +extern void test__f_type_array_statess_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_statess_append_all() + * @see f_statess_append_all() */ extern void test__f_type_array_statess_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_statess_append_all() + * @see f_statess_append_all() */ -extern void test__f_type_array_statess_append_all__parameter_checking(void **state); +extern void test__f_type_array_statess_append_all__works(void **state); #endif // _TEST__F_type_array__statess_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statess_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-statess_decimate_by.c index 037550296..911c7e4da 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statess_decimate_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statess_decimate_by.c @@ -5,11 +5,27 @@ extern "C" { #endif -void test__f_type_array_statess_decimate_by__works(void **state) { +void test__f_type_array_statess_decimate_by__parameter_checking(void **state) { const int length = 5; f_statess_t data = f_states_t_initialize; + { + const f_status_t status = f_statess_decimate_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_statess_decimate_by__returns_data_not(void **state) { + + const int length = 5; + f_statess_t data = f_statess_t_initialize; + { const f_status_t status = f_statess_resize(length, &data); @@ -19,25 +35,33 @@ void test__f_type_array_statess_decimate_by__works(void **state) { } { - const f_status_t status = f_statess_decimate_by(length, &data); + const f_status_t status = f_statess_decimate_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_statess_decimate_by__parameter_checking(void **state) { +void test__f_type_array_statess_decimate_by__works(void **state) { const int length = 5; f_statess_t data = f_states_t_initialize; { - const f_status_t status = f_statess_decimate_by(length, 0); + const f_status_t status = f_statess_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_statess_decimate_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statess_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-statess_decimate_by.h index dae8b9df9..d8c960c91 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statess_decimate_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statess_decimate_by.h @@ -11,17 +11,24 @@ #define _TEST__F_type_array__statess_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_statess_decimate_by() + * @see f_statess_decimate_by() */ -extern void test__f_type_array_statess_decimate_by__works(void **state); +extern void test__f_type_array_statess_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * * @see f_type_array_statess_decimate_by() */ -extern void test__f_type_array_statess_decimate_by__parameter_checking(void **state); +extern void test__f_type_array_statess_decimate_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_statess_decimate_by() + */ +extern void test__f_type_array_statess_decimate_by__works(void **state); #endif // _TEST__F_type_array__statess_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statess_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-statess_decrease_by.c index 753ff19b7..4990d95d6 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statess_decrease_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statess_decrease_by.c @@ -5,11 +5,27 @@ extern "C" { #endif -void test__f_type_array_statess_decrease_by__works(void **state) { +void test__f_type_array_statess_decrease_by__parameter_checking(void **state) { const int length = 5; f_statess_t data = f_states_t_initialize; + { + const f_status_t status = f_statess_decrease_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_statess_decrease_by__returns_data_not(void **state) { + + const int length = 5; + f_statess_t data = f_statess_t_initialize; + { const f_status_t status = f_statess_resize(length, &data); @@ -19,25 +35,33 @@ void test__f_type_array_statess_decrease_by__works(void **state) { } { - const f_status_t status = f_statess_decrease_by(length, &data); + const f_status_t status = f_statess_decrease_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_statess_decrease_by__parameter_checking(void **state) { +void test__f_type_array_statess_decrease_by__works(void **state) { const int length = 5; f_statess_t data = f_states_t_initialize; { - const f_status_t status = f_statess_decrease_by(length, 0); + const f_status_t status = f_statess_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_statess_decrease_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statess_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-statess_decrease_by.h index b855d49f4..f8b062293 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statess_decrease_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statess_decrease_by.h @@ -11,17 +11,24 @@ #define _TEST__F_type_array__statess_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_statess_decrease_by() + * @see f_statess_decrease_by() */ -extern void test__f_type_array_statess_decrease_by__works(void **state); +extern void test__f_type_array_statess_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_statess_decrease_by() + * @see f_statess_decrease_by() */ -extern void test__f_type_array_statess_decrease_by__parameter_checking(void **state); +extern void test__f_type_array_statess_decrease_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_statess_decrease_by() + */ +extern void test__f_type_array_statess_decrease_by__works(void **state); #endif // _TEST__F_type_array__statess_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statess_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-statess_increase.c index 367d9a5ac..e187d564e 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statess_increase.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statess_increase.c @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_statess_increase__works(void **state) { +void test__f_type_array_statess_increase__parameter_checking(void **state) { const int length = 5; f_statess_t data = f_states_t_initialize; { - const f_status_t status = f_statess_resize(length, &data); + const f_status_t status = f_statess_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_statess_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -55,17 +45,27 @@ void test__f_type_array_statess_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_statess_increase__parameter_checking(void **state) { +void test__f_type_array_statess_increase__works(void **state) { const int length = 5; f_statess_t data = f_states_t_initialize; { - const f_status_t status = f_statess_increase(length, 0); + const f_status_t status = f_statess_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_statess_increase(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); } free((void *) data.array); diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statess_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-statess_increase.h index d015d5d0c..1758a7956 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statess_increase.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statess_increase.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__statess_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_statess_increase() + * @see f_statess_increase() */ -extern void test__f_type_array_statess_increase__works(void **state); +extern void test__f_type_array_statess_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_statess_increase() + * @see f_statess_increase() */ extern void test__f_type_array_statess_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_statess_increase() + * @see f_statess_increase() */ -extern void test__f_type_array_statess_increase__parameter_checking(void **state); +extern void test__f_type_array_statess_increase__works(void **state); #endif // _TEST__F_type_array__statess_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statess_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-statess_increase_by.c index 77070d2d7..57251b075 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statess_increase_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statess_increase_by.c @@ -5,11 +5,27 @@ extern "C" { #endif -void test__f_type_array_statess_increase_by__works(void **state) { +void test__f_type_array_statess_increase_by__parameter_checking(void **state) { const int length = 5; f_statess_t data = f_states_t_initialize; + { + const f_status_t status = f_statess_increase_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_statess_increase_by__returns_data_not(void **state) { + + const int length = 5; + f_statess_t data = f_statess_t_initialize; + { const f_status_t status = f_statess_resize(length, &data); @@ -19,32 +35,48 @@ void test__f_type_array_statess_increase_by__works(void **state) { } { - data.used = length; + const f_status_t status = f_statess_increase_by(0, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + { const f_status_t status = f_statess_increase_by(length, &data); - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); } free((void *) data.array); } -void test__f_type_array_statess_increase_by__parameter_checking(void **state) { +void test__f_type_array_statess_increase_by__works(void **state) { const int length = 5; f_statess_t data = f_states_t_initialize; { - const f_status_t status = f_statess_increase_by(length, 0); + const f_status_t status = f_statess_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + { + data.used = length; + + const f_status_t status = f_statess_increase_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statess_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-statess_increase_by.h index a93ffba97..13d0608f6 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statess_increase_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statess_increase_by.h @@ -11,17 +11,24 @@ #define _TEST__F_type_array__statess_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_statess_increase_by() + * @see f_statess_increase_by() */ -extern void test__f_type_array_statess_increase_by__works(void **state); +extern void test__f_type_array_statess_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_statess_increase_by() + * @see f_statess_increase_by() */ -extern void test__f_type_array_statess_increase_by__parameter_checking(void **state); +extern void test__f_type_array_statess_increase_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_statess_increase_by() + */ +extern void test__f_type_array_statess_increase_by__works(void **state); #endif // _TEST__F_type_array__statess_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statess_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-statess_resize.c index a953b9467..b30e2a06d 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statess_resize.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statess_resize.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_statess_resize__works(void **state) { +void test__f_type_array_statess_resize__parameter_checking(void **state) { const int length = 5; f_statess_t data = f_statess_t_initialize; { - const f_status_t status = f_statess_resize(length, &data); + const f_status_t status = f_statess_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_statess_resize__parameter_checking(void **state) { +void test__f_type_array_statess_resize__works(void **state) { const int length = 5; f_statess_t data = f_statess_t_initialize; { - const f_status_t status = f_statess_resize(length, 0); + const f_status_t status = f_statess_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statess_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-statess_resize.h index 448f6d832..17d6e4022 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statess_resize.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statess_resize.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__statess_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_statess_resize() + * @see f_statess_resize() */ -extern void test__f_type_array_statess_resize__works(void **state); +extern void test__f_type_array_statess_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_statess_resize() + * @see f_statess_resize() */ -extern void test__f_type_array_statess_resize__parameter_checking(void **state); +extern void test__f_type_array_statess_resize__works(void **state); #endif // _TEST__F_type_array__statess_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_adjust.c index ba7dcc6bf..0862cf679 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_adjust.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_adjust.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_statuss_adjust__works(void **state) { +void test__f_type_array_statuss_adjust__parameter_checking(void **state) { const int length = 5; f_statuss_t data = f_statuss_t_initialize; { - const f_status_t status = f_statuss_adjust(length, &data); + const f_status_t status = f_statuss_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_statuss_adjust__parameter_checking(void **state) { +void test__f_type_array_statuss_adjust__works(void **state) { const int length = 5; f_statuss_t data = f_statuss_t_initialize; { - const f_status_t status = f_statuss_adjust(length, 0); + const f_status_t status = f_statuss_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_adjust.h index 24e5d53d0..e28e5d6b5 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_adjust.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_adjust.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__statuss_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_statuss_adjust() + * @see f_statuss_adjust() */ -extern void test__f_type_array_statuss_adjust__works(void **state); +extern void test__f_type_array_statuss_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_statuss_adjust() + * @see f_statuss_adjust() */ -extern void test__f_type_array_statuss_adjust__parameter_checking(void **state); +extern void test__f_type_array_statuss_adjust__works(void **state); #endif // _TEST__F_type_array__statuss_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_append.c index fb8d90506..454ebaa3a 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_append.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_append.c @@ -5,6 +5,17 @@ extern "C" { #endif +void test__f_type_array_statuss_append__parameter_checking(void **state) { + + const f_status_t data = f_status_t_initialize; + + { + const f_status_t status = f_statuss_append(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + void test__f_type_array_statuss_append__works(void **state) { const f_status_t source = 3; @@ -21,17 +32,6 @@ void test__f_type_array_statuss_append__works(void **state) { free((void *) destination.array); } -void test__f_type_array_statuss_append__parameter_checking(void **state) { - - const f_status_t data = f_status_t_initialize; - - { - const f_status_t status = f_statuss_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_append.h index 6fb277f10..48a5dc9a6 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_append.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_append.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__statuss_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_statuss_append() + * @see f_statuss_append() */ -extern void test__f_type_array_statuss_append__works(void **state); +extern void test__f_type_array_statuss_append__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_statuss_append() + * @see f_statuss_append() */ -extern void test__f_type_array_statuss_append__parameter_checking(void **state); +extern void test__f_type_array_statuss_append__works(void **state); #endif // _TEST__F_type_array__statuss_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_append_all.c index 07b1a060c..19e6fe1e7 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_append_all.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_append_all.c @@ -5,10 +5,20 @@ extern "C" { #endif -void test__f_type_array_statuss_append_all__works(void **state) { +void test__f_type_array_statuss_append_all__parameter_checking(void **state) { + + const f_statuss_t data = f_statuss_t_initialize; + + { + const f_status_t status = f_statuss_append_all(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +void test__f_type_array_statuss_append_all__returns_data_not(void **state) { const int length = 5; - const int length_used = 2; f_statuss_t source = f_statuss_t_initialize; f_statuss_t destination = f_statuss_t_initialize; @@ -20,29 +30,22 @@ void test__f_type_array_statuss_append_all__works(void **state) { assert_int_equal(source.size, length); } - for (; source.used < length_used; ++source.used) { - source.array[source.used] = source.used + 1; - } // for - { const f_status_t status = f_statuss_append_all(source, &destination); - assert_int_equal(status, F_none); - assert_int_equal(destination.used, source.used); - assert_int_equal(destination.size, source.used); - - for (f_array_length_t i = 0; i < source.used; ++i) { - assert_int_equal(destination.array[i], i + 1); - } // for + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + assert_null(destination.array); } free((void *) source.array); - free((void *) destination.array); } -void test__f_type_array_statuss_append_all__returns_data_not(void **state) { +void test__f_type_array_statuss_append_all__works(void **state) { const int length = 5; + const int length_used = 2; f_statuss_t source = f_statuss_t_initialize; f_statuss_t destination = f_statuss_t_initialize; @@ -54,27 +57,24 @@ void test__f_type_array_statuss_append_all__returns_data_not(void **state) { assert_int_equal(source.size, length); } + for (; source.used < length_used; ++source.used) { + source.array[source.used] = source.used + 1; + } // for + { const f_status_t status = f_statuss_append_all(source, &destination); - assert_int_equal(status, F_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); + assert_int_equal(status, F_none); + assert_int_equal(destination.used, source.used); + assert_int_equal(destination.size, source.used); + + for (f_array_length_t i = 0; i < source.used; ++i) { + assert_int_equal(destination.array[i], i + 1); + } // for } free((void *) source.array); -} - -void test__f_type_array_statuss_append_all__parameter_checking(void **state) { - - const f_statuss_t data = f_statuss_t_initialize; - - { - const f_status_t status = f_statuss_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } + free((void *) destination.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_append_all.h index c870109d3..509bdee5e 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_append_all.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_append_all.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__statuss_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_statuss_append_all() + * @see f_statuss_append_all() */ -extern void test__f_type_array_statuss_append_all__works(void **state); +extern void test__f_type_array_statuss_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_statuss_append_all() + * @see f_statuss_append_all() */ extern void test__f_type_array_statuss_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_statuss_append_all() + * @see f_statuss_append_all() */ -extern void test__f_type_array_statuss_append_all__parameter_checking(void **state); +extern void test__f_type_array_statuss_append_all__works(void **state); #endif // _TEST__F_type_array__statuss_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_decimate_by.c index 962080cd8..479f12925 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_decimate_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_decimate_by.c @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_statuss_decimate_by__works(void **state) { +void test__f_type_array_statuss_decimate_by__parameter_checking(void **state) { const int length = 5; f_statuss_t data = f_statuss_t_initialize; { - const f_status_t status = f_statuss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_statuss_decimate_by(length, &data); + const f_status_t status = f_statuss_decimate_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_statuss_decimate_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_statuss_decimate_by__parameter_checking(void **state) { +void test__f_type_array_statuss_decimate_by__works(void **state) { const int length = 5; f_statuss_t data = f_statuss_t_initialize; { - const f_status_t status = f_statuss_decimate_by(length, 0); + const f_status_t status = f_statuss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_statuss_decimate_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_decimate_by.h index cd317d30d..f999d0cb7 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_decimate_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_decimate_by.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__statuss_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_statuss_decimate_by() + * @see f_statuss_decimate_by() */ -extern void test__f_type_array_statuss_decimate_by__works(void **state); +extern void test__f_type_array_statuss_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_statuss_decimate_by() + * @see f_statuss_decimate_by() */ -extern void test__f_type_array_statuss_decimate_by__parameter_checking(void **state); +extern void test__f_type_array_statuss_decimate_by__works(void **state); #endif // _TEST__F_type_array__statuss_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_decrease_by.c index 24bcde4b1..1c92e8db3 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_decrease_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_decrease_by.c @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_statuss_decrease_by__works(void **state) { +void test__f_type_array_statuss_decrease_by__parameter_checking(void **state) { const int length = 5; f_statuss_t data = f_statuss_t_initialize; { - const f_status_t status = f_statuss_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_statuss_decrease_by(length, &data); + const f_status_t status = f_statuss_decrease_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_statuss_decrease_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_statuss_decrease_by__parameter_checking(void **state) { +void test__f_type_array_statuss_decrease_by__works(void **state) { const int length = 5; f_statuss_t data = f_statuss_t_initialize; { - const f_status_t status = f_statuss_decrease_by(length, 0); + const f_status_t status = f_statuss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_statuss_decrease_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_decrease_by.h index 52aef547e..523c47c0b 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_decrease_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_decrease_by.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__statuss_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_statuss_decrease_by() + * @see f_statuss_decrease_by() */ -extern void test__f_type_array_statuss_decrease_by__works(void **state); +extern void test__f_type_array_statuss_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_statuss_decrease_by() + * @see f_statuss_decrease_by() */ -extern void test__f_type_array_statuss_decrease_by__parameter_checking(void **state); +extern void test__f_type_array_statuss_decrease_by__works(void **state); #endif // _TEST__F_type_array__statuss_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_increase.c index 5d68d7a07..a07eb6c9e 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_increase.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_increase.c @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_statuss_increase__works(void **state) { +void test__f_type_array_statuss_increase__parameter_checking(void **state) { const int length = 5; f_statuss_t data = f_statuss_t_initialize; { - const f_status_t status = f_statuss_resize(length, &data); + const f_status_t status = f_statuss_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_statuss_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -55,17 +45,27 @@ void test__f_type_array_statuss_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_statuss_increase__parameter_checking(void **state) { +void test__f_type_array_statuss_increase__works(void **state) { const int length = 5; f_statuss_t data = f_statuss_t_initialize; { - const f_status_t status = f_statuss_increase(length, 0); + const f_status_t status = f_statuss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_statuss_increase(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); } free((void *) data.array); diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_increase.h index 65a9252e2..79e9302a2 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_increase.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_increase.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__statuss_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_statuss_increase() + * @see f_statuss_increase() */ -extern void test__f_type_array_statuss_increase__works(void **state); +extern void test__f_type_array_statuss_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_statuss_increase() + * @see f_statuss_increase() */ extern void test__f_type_array_statuss_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_statuss_increase() + * @see f_statuss_increase() */ -extern void test__f_type_array_statuss_increase__parameter_checking(void **state); +extern void test__f_type_array_statuss_increase__works(void **state); #endif // _TEST__F_type_array__statuss_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_increase_by.c index f828eaa82..5cc7bd6b4 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_increase_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_increase_by.c @@ -5,6 +5,23 @@ extern "C" { #endif + +void test__f_type_array_statuss_increase_by__parameter_checking(void **state) { + + const int length = 5; + f_statuss_t data = f_statuss_t_initialize; + + { + const f_status_t status = f_statuss_increase_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + void test__f_type_array_statuss_increase_by__works(void **state) { const int length = 5; @@ -31,22 +48,6 @@ void test__f_type_array_statuss_increase_by__works(void **state) { free((void *) data.array); } -void test__f_type_array_statuss_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_statuss_t data = f_statuss_t_initialize; - - { - const f_status_t status = f_statuss_increase_by(length, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_increase_by.h index bdf0fb1c2..0bed9391d 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_increase_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_increase_by.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__statuss_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_statuss_increase_by() + * @see f_statuss_increase_by() */ -extern void test__f_type_array_statuss_increase_by__works(void **state); +extern void test__f_type_array_statuss_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_statuss_increase_by() + * @see f_statuss_increase_by() */ -extern void test__f_type_array_statuss_increase_by__parameter_checking(void **state); +extern void test__f_type_array_statuss_increase_by__works(void **state); #endif // _TEST__F_type_array__statuss_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_resize.c index 2ecb2a4c6..94d097d62 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_resize.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_resize.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_statuss_resize__works(void **state) { +void test__f_type_array_statuss_resize__parameter_checking(void **state) { const int length = 5; f_statuss_t data = f_statuss_t_initialize; { - const f_status_t status = f_statuss_resize(length, &data); + const f_status_t status = f_statuss_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_statuss_resize__parameter_checking(void **state) { +void test__f_type_array_statuss_resize__works(void **state) { const int length = 5; f_statuss_t data = f_statuss_t_initialize; { - const f_status_t status = f_statuss_resize(length, 0); + const f_status_t status = f_statuss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_resize.h index 4ce51812a..7a884aec2 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_resize.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_resize.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__statuss_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_statuss_resize() + * @see f_statuss_resize() */ -extern void test__f_type_array_statuss_resize__works(void **state); +extern void test__f_type_array_statuss_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_statuss_resize() + * @see f_statuss_resize() */ -extern void test__f_type_array_statuss_resize__parameter_checking(void **state); +extern void test__f_type_array_statuss_resize__works(void **state); #endif // _TEST__F_type_array__statuss_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-statusss_adjust.c index d71506985..80c78991d 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_adjust.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statusss_adjust.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_statusss_adjust__works(void **state) { +void test__f_type_array_statusss_adjust__parameter_checking(void **state) { const int length = 5; f_statusss_t data = f_statusss_t_initialize; { - const f_status_t status = f_statusss_adjust(length, &data); + const f_status_t status = f_statusss_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_statusss_adjust__parameter_checking(void **state) { +void test__f_type_array_statusss_adjust__works(void **state) { const int length = 5; f_statusss_t data = f_statusss_t_initialize; { - const f_status_t status = f_statusss_adjust(length, 0); + const f_status_t status = f_statusss_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-statusss_adjust.h index 2e7f4e8eb..b57ba175f 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_adjust.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statusss_adjust.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__statusss_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_statusss_adjust() + * @see f_statusss_adjust() */ -extern void test__f_type_array_statusss_adjust__works(void **state); +extern void test__f_type_array_statusss_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_statusss_adjust() + * @see f_statusss_adjust() */ -extern void test__f_type_array_statusss_adjust__parameter_checking(void **state); +extern void test__f_type_array_statusss_adjust__works(void **state); #endif // _TEST__F_type_array__statusss_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-statusss_append.c index a0ddc4278..a713c2c5b 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_append.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statusss_append.c @@ -5,7 +5,18 @@ extern "C" { #endif -void test__f_type_array_statusss_append__works(void **state) { +void test__f_type_array_statusss_append__parameter_checking(void **state) { + + f_statuss_t data = f_statuss_t_initialize; + + { + const f_status_t status = f_statusss_append(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +void test__f_type_array_statusss_append__returns_data_not(void **state) { const int length = 5; f_statuss_t source = f_statuss_t_initialize; @@ -19,32 +30,19 @@ void test__f_type_array_statusss_append__works(void **state) { assert_int_equal(source.size, length); } - for (; source.used < length; ++source.used) { - source.array[source.used] = source.used + 1; - } // for - { const f_status_t status = f_statusss_append(source, &destination); - assert_int_equal(status, F_none); - assert_int_equal(destination.used, 1); - assert_int_equal(destination.array[0].used, source.used); - assert_int_equal(destination.array[0].size, source.used); - - for (f_array_length_t i = 0; i < destination.array[0].used; ++i) { - assert_int_equal(destination.array[0].array[i], i + 1); - } // for + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + assert_null(destination.array); } - for (f_array_length_t i = 0; i < destination.used; ++i) { - free((void *) destination.array[i].array); - } // for - free((void *) source.array); - free((void *) destination.array); } -void test__f_type_array_statusss_append__returns_data_not(void **state) { +void test__f_type_array_statusss_append__works(void **state) { const int length = 5; f_statuss_t source = f_statuss_t_initialize; @@ -58,27 +56,29 @@ void test__f_type_array_statusss_append__returns_data_not(void **state) { assert_int_equal(source.size, length); } + for (; source.used < length; ++source.used) { + source.array[source.used] = source.used + 1; + } // for + { const f_status_t status = f_statusss_append(source, &destination); - assert_int_equal(status, F_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); - } - - free((void *) source.array); -} - -void test__f_type_array_statusss_append__parameter_checking(void **state) { + assert_int_equal(status, F_none); + assert_int_equal(destination.used, 1); + assert_int_equal(destination.array[0].used, source.used); + assert_int_equal(destination.array[0].size, source.used); - f_statuss_t data = f_statuss_t_initialize; + for (f_array_length_t i = 0; i < destination.array[0].used; ++i) { + assert_int_equal(destination.array[0].array[i], i + 1); + } // for + } - { - const f_status_t status = f_statusss_append(data, 0); + for (f_array_length_t i = 0; i < destination.used; ++i) { + free((void *) destination.array[i].array); + } // for - assert_int_equal(status, F_status_set_error(F_parameter)); - } + free((void *) source.array); + free((void *) destination.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-statusss_append.h index 89b921e9a..e7e8782e3 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_append.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statusss_append.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__statusss_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_statusss_append() + * @see f_statusss_append() */ -extern void test__f_type_array_statusss_append__works(void **state); +extern void test__f_type_array_statusss_append__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_statusss_append() + * @see f_statusss_append() */ extern void test__f_type_array_statusss_append__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_statusss_append() + * @see f_statusss_append() */ -extern void test__f_type_array_statusss_append__parameter_checking(void **state); +extern void test__f_type_array_statusss_append__works(void **state); #endif // _TEST__F_type_array__statusss_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-statusss_append_all.c index b0b13a1eb..213074ad4 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_append_all.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statusss_append_all.c @@ -5,6 +5,43 @@ extern "C" { #endif +void test__f_type_array_statusss_append_all__parameter_checking(void **state) { + + const f_statusss_t data = f_statusss_t_initialize; + + { + const f_status_t status = f_statusss_append_all(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +void test__f_type_array_statusss_append_all__returns_data_not(void **state) { + + const int length = 5; + f_statusss_t source = f_statusss_t_initialize; + f_statusss_t destination = f_statusss_t_initialize; + + { + const f_status_t status = f_statusss_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + { + const f_status_t status = f_statusss_append_all(source, &destination); + + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + assert_null(destination.array); + } + + free((void *) source.array); +} + void test__f_type_array_statusss_append_all__works(void **state) { const int length = 5; @@ -63,43 +100,6 @@ void test__f_type_array_statusss_append_all__works(void **state) { free((void *) destination.array); } -void test__f_type_array_statusss_append_all__returns_data_not(void **state) { - - const int length = 5; - f_statusss_t source = f_statusss_t_initialize; - f_statusss_t destination = f_statusss_t_initialize; - - { - const f_status_t status = f_statusss_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_statusss_append_all(source, &destination); - - assert_int_equal(status, F_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); - } - - free((void *) source.array); -} - -void test__f_type_array_statusss_append_all__parameter_checking(void **state) { - - const f_statusss_t data = f_statusss_t_initialize; - - { - const f_status_t status = f_statusss_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-statusss_append_all.h index 54ac1cff7..bcbcd205d 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_append_all.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statusss_append_all.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__statusss_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_statusss_append_all() + * @see f_statusss_append_all() */ -extern void test__f_type_array_statusss_append_all__works(void **state); +extern void test__f_type_array_statusss_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_statusss_append_all() + * @see f_statusss_append_all() */ extern void test__f_type_array_statusss_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_statusss_append_all() + * @see f_statusss_append_all() */ -extern void test__f_type_array_statusss_append_all__parameter_checking(void **state); +extern void test__f_type_array_statusss_append_all__works(void **state); #endif // _TEST__F_type_array__statusss_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-statusss_decimate_by.c index 8a7b0411d..7265fd4cd 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_decimate_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statusss_decimate_by.c @@ -5,11 +5,27 @@ extern "C" { #endif -void test__f_type_array_statusss_decimate_by__works(void **state) { +void test__f_type_array_statusss_decimate_by__parameter_checking(void **state) { const int length = 5; f_statusss_t data = f_statuss_t_initialize; + { + const f_status_t status = f_statusss_decimate_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_statusss_decimate_by__returns_data_not(void **state) { + + const int length = 5; + f_statusss_t data = f_statusss_t_initialize; + { const f_status_t status = f_statusss_resize(length, &data); @@ -19,25 +35,33 @@ void test__f_type_array_statusss_decimate_by__works(void **state) { } { - const f_status_t status = f_statusss_decimate_by(length, &data); + const f_status_t status = f_statusss_decimate_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_statusss_decimate_by__parameter_checking(void **state) { +void test__f_type_array_statusss_decimate_by__works(void **state) { const int length = 5; f_statusss_t data = f_statuss_t_initialize; { - const f_status_t status = f_statusss_decimate_by(length, 0); + const f_status_t status = f_statusss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_statusss_decimate_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-statusss_decimate_by.h index 79428b90d..41fb24dba 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_decimate_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statusss_decimate_by.h @@ -11,17 +11,24 @@ #define _TEST__F_type_array__statusss_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_statusss_decimate_by() + * @see f_statusss_decimate_by() */ -extern void test__f_type_array_statusss_decimate_by__works(void **state); +extern void test__f_type_array_statusss_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * * @see f_type_array_statusss_decimate_by() */ -extern void test__f_type_array_statusss_decimate_by__parameter_checking(void **state); +extern void test__f_type_array_statusss_decimate_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_statusss_decimate_by() + */ +extern void test__f_type_array_statusss_decimate_by__works(void **state); #endif // _TEST__F_type_array__statusss_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-statusss_decrease_by.c index 19b69cebc..43e408cb8 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_decrease_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statusss_decrease_by.c @@ -5,11 +5,27 @@ extern "C" { #endif -void test__f_type_array_statusss_decrease_by__works(void **state) { +void test__f_type_array_statusss_decrease_by__parameter_checking(void **state) { const int length = 5; f_statusss_t data = f_statuss_t_initialize; + { + const f_status_t status = f_statusss_decrease_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_statusss_decrease_by__returns_data_not(void **state) { + + const int length = 5; + f_statusss_t data = f_statusss_t_initialize; + { const f_status_t status = f_statusss_resize(length, &data); @@ -19,25 +35,33 @@ void test__f_type_array_statusss_decrease_by__works(void **state) { } { - const f_status_t status = f_statusss_decrease_by(length, &data); + const f_status_t status = f_statusss_decrease_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_statusss_decrease_by__parameter_checking(void **state) { +void test__f_type_array_statusss_decrease_by__works(void **state) { const int length = 5; f_statusss_t data = f_statuss_t_initialize; { - const f_status_t status = f_statusss_decrease_by(length, 0); + const f_status_t status = f_statusss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_statusss_decrease_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-statusss_decrease_by.h index e780d3ffa..987d77108 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_decrease_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statusss_decrease_by.h @@ -11,17 +11,24 @@ #define _TEST__F_type_array__statusss_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_statusss_decrease_by() + * @see f_statusss_decrease_by() */ -extern void test__f_type_array_statusss_decrease_by__works(void **state); +extern void test__f_type_array_statusss_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_statusss_decrease_by() + * @see f_statusss_decrease_by() */ -extern void test__f_type_array_statusss_decrease_by__parameter_checking(void **state); +extern void test__f_type_array_statusss_decrease_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_statusss_decrease_by() + */ +extern void test__f_type_array_statusss_decrease_by__works(void **state); #endif // _TEST__F_type_array__statusss_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-statusss_increase.c index b0476ae49..ec29f0233 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_increase.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statusss_increase.c @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_statusss_increase__works(void **state) { +void test__f_type_array_statusss_increase__parameter_checking(void **state) { const int length = 5; f_statusss_t data = f_statuss_t_initialize; { - const f_status_t status = f_statusss_resize(length, &data); + const f_status_t status = f_statusss_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_statusss_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -55,17 +45,27 @@ void test__f_type_array_statusss_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_statusss_increase__parameter_checking(void **state) { +void test__f_type_array_statusss_increase__works(void **state) { const int length = 5; f_statusss_t data = f_statuss_t_initialize; { - const f_status_t status = f_statusss_increase(length, 0); + const f_status_t status = f_statusss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_statusss_increase(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); } free((void *) data.array); diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-statusss_increase.h index 18a1cabd1..3c925eebb 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_increase.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statusss_increase.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__statusss_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_statusss_increase() + * @see f_statusss_increase() */ -extern void test__f_type_array_statusss_increase__works(void **state); +extern void test__f_type_array_statusss_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_statusss_increase() + * @see f_statusss_increase() */ extern void test__f_type_array_statusss_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_statusss_increase() + * @see f_statusss_increase() */ -extern void test__f_type_array_statusss_increase__parameter_checking(void **state); +extern void test__f_type_array_statusss_increase__works(void **state); #endif // _TEST__F_type_array__statusss_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-statusss_increase_by.c index 0e980331d..5a1206827 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_increase_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statusss_increase_by.c @@ -5,11 +5,27 @@ extern "C" { #endif -void test__f_type_array_statusss_increase_by__works(void **state) { +void test__f_type_array_statusss_increase_by__parameter_checking(void **state) { const int length = 5; f_statusss_t data = f_statuss_t_initialize; + { + const f_status_t status = f_statusss_increase_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_statusss_increase_by__returns_data_not(void **state) { + + const int length = 5; + f_statusss_t data = f_statusss_t_initialize; + { const f_status_t status = f_statusss_resize(length, &data); @@ -19,32 +35,48 @@ void test__f_type_array_statusss_increase_by__works(void **state) { } { - data.used = length; + const f_status_t status = f_statusss_increase_by(0, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + { const f_status_t status = f_statusss_increase_by(length, &data); - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); } free((void *) data.array); } -void test__f_type_array_statusss_increase_by__parameter_checking(void **state) { +void test__f_type_array_statusss_increase_by__works(void **state) { const int length = 5; f_statusss_t data = f_statuss_t_initialize; { - const f_status_t status = f_statusss_increase_by(length, 0); + const f_status_t status = f_statusss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + { + data.used = length; + + const f_status_t status = f_statusss_increase_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-statusss_increase_by.h index 203c72ada..da2d85d8f 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_increase_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statusss_increase_by.h @@ -11,17 +11,24 @@ #define _TEST__F_type_array__statusss_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_statusss_increase_by() + * @see f_statusss_increase_by() */ -extern void test__f_type_array_statusss_increase_by__works(void **state); +extern void test__f_type_array_statusss_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_statusss_increase_by() + * @see f_statusss_increase_by() */ -extern void test__f_type_array_statusss_increase_by__parameter_checking(void **state); +extern void test__f_type_array_statusss_increase_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_statusss_increase_by() + */ +extern void test__f_type_array_statusss_increase_by__works(void **state); #endif // _TEST__F_type_array__statusss_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-statusss_resize.c index b3ecfda64..39aa72d6f 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_resize.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statusss_resize.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_statusss_resize__works(void **state) { +void test__f_type_array_statusss_resize__parameter_checking(void **state) { const int length = 5; f_statusss_t data = f_statusss_t_initialize; { - const f_status_t status = f_statusss_resize(length, &data); + const f_status_t status = f_statusss_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_statusss_resize__parameter_checking(void **state) { +void test__f_type_array_statusss_resize__works(void **state) { const int length = 5; f_statusss_t data = f_statusss_t_initialize; { - const f_status_t status = f_statusss_resize(length, 0); + const f_status_t status = f_statusss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-statusss_resize.h index e95a2dee7..d76761c8c 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-statusss_resize.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statusss_resize.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__statusss_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_statusss_resize() + * @see f_statusss_resize() */ -extern void test__f_type_array_statusss_resize__works(void **state); +extern void test__f_type_array_statusss_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_statusss_resize() + * @see f_statusss_resize() */ -extern void test__f_type_array_statusss_resize__parameter_checking(void **state); +extern void test__f_type_array_statusss_resize__works(void **state); #endif // _TEST__F_type_array__statusss_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_adjust.c index 37025d71f..ffe293770 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_adjust.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_adjust.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_uint128s_adjust__works(void **state) { +void test__f_type_array_uint128s_adjust__parameter_checking(void **state) { const int length = 5; f_uint128s_t data = f_uint128s_t_initialize; { - const f_status_t status = f_uint128s_adjust(length, &data); + const f_status_t status = f_uint128s_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_uint128s_adjust__parameter_checking(void **state) { +void test__f_type_array_uint128s_adjust__works(void **state) { const int length = 5; f_uint128s_t data = f_uint128s_t_initialize; { - const f_status_t status = f_uint128s_adjust(length, 0); + const f_status_t status = f_uint128s_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_adjust.h index 6315a5dc4..251a1d40f 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_adjust.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_adjust.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint128s_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint128s_adjust() + * @see f_uint128s_adjust() */ -extern void test__f_type_array_uint128s_adjust__works(void **state); +extern void test__f_type_array_uint128s_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint128s_adjust() + * @see f_uint128s_adjust() */ -extern void test__f_type_array_uint128s_adjust__parameter_checking(void **state); +extern void test__f_type_array_uint128s_adjust__works(void **state); #endif // _TEST__F_type_array__uint128s_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_append.c index 516e45077..e46007595 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_append.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_append.c @@ -5,6 +5,17 @@ extern "C" { #endif +void test__f_type_array_uint128s_append__parameter_checking(void **state) { + + const uint128_t data = 0; + + { + const f_status_t status = f_uint128s_append(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + void test__f_type_array_uint128s_append__works(void **state) { const uint128_t source = 3; @@ -21,17 +32,6 @@ void test__f_type_array_uint128s_append__works(void **state) { free((void *) destination.array); } -void test__f_type_array_uint128s_append__parameter_checking(void **state) { - - const uint128_t data = 0; - - { - const f_status_t status = f_uint128s_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_append.h index 93ccaf10a..1580565c6 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_append.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_append.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint128s_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint128s_append() + * @see f_uint128s_append() */ -extern void test__f_type_array_uint128s_append__works(void **state); +extern void test__f_type_array_uint128s_append__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint128s_append() + * @see f_uint128s_append() */ -extern void test__f_type_array_uint128s_append__parameter_checking(void **state); +extern void test__f_type_array_uint128s_append__works(void **state); #endif // _TEST__F_type_array__uint128s_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_append_all.c index afbad49bc..65226e5dd 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_append_all.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_append_all.c @@ -5,10 +5,20 @@ extern "C" { #endif -void test__f_type_array_uint128s_append_all__works(void **state) { +void test__f_type_array_uint128s_append_all__parameter_checking(void **state) { + + const f_uint128s_t data = f_uint128s_t_initialize; + + { + const f_status_t status = f_uint128s_append_all(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +void test__f_type_array_uint128s_append_all__returns_data_not(void **state) { const int length = 5; - const int length_used = 2; f_uint128s_t source = f_uint128s_t_initialize; f_uint128s_t destination = f_uint128s_t_initialize; @@ -20,29 +30,22 @@ void test__f_type_array_uint128s_append_all__works(void **state) { assert_int_equal(source.size, length); } - for (; source.used < length_used; ++source.used) { - source.array[source.used] = source.used + 1; - } // for - { const f_status_t status = f_uint128s_append_all(source, &destination); - assert_int_equal(status, F_none); - assert_int_equal(destination.used, source.used); - assert_int_equal(destination.size, source.used); - - for (f_array_length_t i = 0; i < source.used; ++i) { - assert_int_equal(destination.array[i], i + 1); - } // for + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + assert_null(destination.array); } free((void *) source.array); - free((void *) destination.array); } -void test__f_type_array_uint128s_append_all__returns_data_not(void **state) { +void test__f_type_array_uint128s_append_all__works(void **state) { const int length = 5; + const int length_used = 2; f_uint128s_t source = f_uint128s_t_initialize; f_uint128s_t destination = f_uint128s_t_initialize; @@ -54,27 +57,24 @@ void test__f_type_array_uint128s_append_all__returns_data_not(void **state) { assert_int_equal(source.size, length); } + for (; source.used < length_used; ++source.used) { + source.array[source.used] = source.used + 1; + } // for + { const f_status_t status = f_uint128s_append_all(source, &destination); - assert_int_equal(status, F_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); + assert_int_equal(status, F_none); + assert_int_equal(destination.used, source.used); + assert_int_equal(destination.size, source.used); + + for (f_array_length_t i = 0; i < source.used; ++i) { + assert_int_equal(destination.array[i], i + 1); + } // for } free((void *) source.array); -} - -void test__f_type_array_uint128s_append_all__parameter_checking(void **state) { - - const f_uint128s_t data = f_uint128s_t_initialize; - - { - const f_status_t status = f_uint128s_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } + free((void *) destination.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_append_all.h index 40d61c78c..8fcbcf7b5 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_append_all.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_append_all.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__uint128s_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint128s_append_all() + * @see f_uint128s_append_all() */ -extern void test__f_type_array_uint128s_append_all__works(void **state); +extern void test__f_type_array_uint128s_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_uint128s_append_all() + * @see f_uint128s_append_all() */ extern void test__f_type_array_uint128s_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint128s_append_all() + * @see f_uint128s_append_all() */ -extern void test__f_type_array_uint128s_append_all__parameter_checking(void **state); +extern void test__f_type_array_uint128s_append_all__works(void **state); #endif // _TEST__F_type_array__uint128s_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_decimate_by.c index d082f439f..256d110e8 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_decimate_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_decimate_by.c @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_uint128s_decimate_by__works(void **state) { +void test__f_type_array_uint128s_decimate_by__parameter_checking(void **state) { const int length = 5; f_uint128s_t data = f_uint128s_t_initialize; { - const f_status_t status = f_uint128s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint128s_decimate_by(length, &data); + const f_status_t status = f_uint128s_decimate_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_uint128s_decimate_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_uint128s_decimate_by__parameter_checking(void **state) { +void test__f_type_array_uint128s_decimate_by__works(void **state) { const int length = 5; f_uint128s_t data = f_uint128s_t_initialize; { - const f_status_t status = f_uint128s_decimate_by(length, 0); + const f_status_t status = f_uint128s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_uint128s_decimate_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_decimate_by.h index a4f4356c4..bccbadadc 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_decimate_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_decimate_by.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint128s_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint128s_decimate_by() + * @see f_uint128s_decimate_by() */ -extern void test__f_type_array_uint128s_decimate_by__works(void **state); +extern void test__f_type_array_uint128s_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint128s_decimate_by() + * @see f_uint128s_decimate_by() */ -extern void test__f_type_array_uint128s_decimate_by__parameter_checking(void **state); +extern void test__f_type_array_uint128s_decimate_by__works(void **state); #endif // _TEST__F_type_array__uint128s_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_decrease_by.c index 1d6b42ed4..a6322721e 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_decrease_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_decrease_by.c @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_uint128s_decrease_by__works(void **state) { +void test__f_type_array_uint128s_decrease_by__parameter_checking(void **state) { const int length = 5; f_uint128s_t data = f_uint128s_t_initialize; { - const f_status_t status = f_uint128s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint128s_decrease_by(length, &data); + const f_status_t status = f_uint128s_decrease_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_uint128s_decrease_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_uint128s_decrease_by__parameter_checking(void **state) { +void test__f_type_array_uint128s_decrease_by__works(void **state) { const int length = 5; f_uint128s_t data = f_uint128s_t_initialize; { - const f_status_t status = f_uint128s_decrease_by(length, 0); + const f_status_t status = f_uint128s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_uint128s_decrease_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_decrease_by.h index 9c21df093..a3e3b81ab 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_decrease_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_decrease_by.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint128s_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint128s_decrease_by() + * @see f_uint128s_decrease_by() */ -extern void test__f_type_array_uint128s_decrease_by__works(void **state); +extern void test__f_type_array_uint128s_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint128s_decrease_by() + * @see f_uint128s_decrease_by() */ -extern void test__f_type_array_uint128s_decrease_by__parameter_checking(void **state); +extern void test__f_type_array_uint128s_decrease_by__works(void **state); #endif // _TEST__F_type_array__uint128s_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_increase.c index 5a8143f49..8987e3618 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_increase.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_increase.c @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_uint128s_increase__works(void **state) { +void test__f_type_array_uint128s_increase__parameter_checking(void **state) { const int length = 5; f_uint128s_t data = f_uint128s_t_initialize; { - const f_status_t status = f_uint128s_resize(length, &data); + const f_status_t status = f_uint128s_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_uint128s_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -55,17 +45,27 @@ void test__f_type_array_uint128s_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_uint128s_increase__parameter_checking(void **state) { +void test__f_type_array_uint128s_increase__works(void **state) { const int length = 5; f_uint128s_t data = f_uint128s_t_initialize; { - const f_status_t status = f_uint128s_increase(length, 0); + const f_status_t status = f_uint128s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_uint128s_increase(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); } free((void *) data.array); diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_increase.h index 94e707935..600a18a1b 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_increase.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_increase.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__uint128s_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint128s_increase() + * @see f_uint128s_increase() */ -extern void test__f_type_array_uint128s_increase__works(void **state); +extern void test__f_type_array_uint128s_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_uint128s_increase() + * @see f_uint128s_increase() */ extern void test__f_type_array_uint128s_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint128s_increase() + * @see f_uint128s_increase() */ -extern void test__f_type_array_uint128s_increase__parameter_checking(void **state); +extern void test__f_type_array_uint128s_increase__works(void **state); #endif // _TEST__F_type_array__uint128s_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_increase_by.c index 0cd369700..8a3424d72 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_increase_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_increase_by.c @@ -5,6 +5,22 @@ extern "C" { #endif +void test__f_type_array_uint128s_increase_by__parameter_checking(void **state) { + + const int length = 5; + f_uint128s_t data = f_uint128s_t_initialize; + + { + const f_status_t status = f_uint128s_increase_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + void test__f_type_array_uint128s_increase_by__works(void **state) { const int length = 5; @@ -31,22 +47,6 @@ void test__f_type_array_uint128s_increase_by__works(void **state) { free((void *) data.array); } -void test__f_type_array_uint128s_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_uint128s_t data = f_uint128s_t_initialize; - - { - const f_status_t status = f_uint128s_increase_by(length, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_increase_by.h index 90317acbd..9200183f9 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_increase_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_increase_by.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint128s_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint128s_increase_by() + * @see f_uint128s_increase_by() */ -extern void test__f_type_array_uint128s_increase_by__works(void **state); +extern void test__f_type_array_uint128s_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint128s_increase_by() + * @see f_uint128s_increase_by() */ -extern void test__f_type_array_uint128s_increase_by__parameter_checking(void **state); +extern void test__f_type_array_uint128s_increase_by__works(void **state); #endif // _TEST__F_type_array__uint128s_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_resize.c index 65dcf2971..b9bac7482 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_resize.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_resize.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_uint128s_resize__works(void **state) { +void test__f_type_array_uint128s_resize__parameter_checking(void **state) { const int length = 5; f_uint128s_t data = f_uint128s_t_initialize; { - const f_status_t status = f_uint128s_resize(length, &data); + const f_status_t status = f_uint128s_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_uint128s_resize__parameter_checking(void **state) { +void test__f_type_array_uint128s_resize__works(void **state) { const int length = 5; f_uint128s_t data = f_uint128s_t_initialize; { - const f_status_t status = f_uint128s_resize(length, 0); + const f_status_t status = f_uint128s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_resize.h index e21448d68..50cf77afd 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_resize.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128s_resize.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint128s_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint128s_resize() + * @see f_uint128s_resize() */ -extern void test__f_type_array_uint128s_resize__works(void **state); +extern void test__f_type_array_uint128s_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint128s_resize() + * @see f_uint128s_resize() */ -extern void test__f_type_array_uint128s_resize__parameter_checking(void **state); +extern void test__f_type_array_uint128s_resize__works(void **state); #endif // _TEST__F_type_array__uint128s_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_adjust.c index 224e63542..d42630b3b 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_adjust.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_adjust.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_uint128ss_adjust__works(void **state) { +void test__f_type_array_uint128ss_adjust__parameter_checking(void **state) { const int length = 5; f_uint128ss_t data = f_uint128ss_t_initialize; { - const f_status_t status = f_uint128ss_adjust(length, &data); + const f_status_t status = f_uint128ss_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_uint128ss_adjust__parameter_checking(void **state) { +void test__f_type_array_uint128ss_adjust__works(void **state) { const int length = 5; f_uint128ss_t data = f_uint128ss_t_initialize; { - const f_status_t status = f_uint128ss_adjust(length, 0); + const f_status_t status = f_uint128ss_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_adjust.h index 3a0bcde02..75f000a1f 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_adjust.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_adjust.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint128ss_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint128ss_adjust() + * @see f_uint128ss_adjust() */ -extern void test__f_type_array_uint128ss_adjust__works(void **state); +extern void test__f_type_array_uint128ss_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint128ss_adjust() + * @see f_uint128ss_adjust() */ -extern void test__f_type_array_uint128ss_adjust__parameter_checking(void **state); +extern void test__f_type_array_uint128ss_adjust__works(void **state); #endif // _TEST__F_type_array__uint128ss_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_append.c index 50ba45dc7..3887a2258 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_append.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_append.c @@ -5,7 +5,18 @@ extern "C" { #endif -void test__f_type_array_uint128ss_append__works(void **state) { +void test__f_type_array_uint128ss_append__parameter_checking(void **state) { + + f_uint128s_t data = f_uint128s_t_initialize; + + { + const f_status_t status = f_uint128ss_append(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +void test__f_type_array_uint128ss_append__returns_data_not(void **state) { const int length = 5; f_uint128s_t source = f_uint128s_t_initialize; @@ -19,32 +30,19 @@ void test__f_type_array_uint128ss_append__works(void **state) { assert_int_equal(source.size, length); } - for (; source.used < length; ++source.used) { - source.array[source.used] = source.used + 1; - } // for - { const f_status_t status = f_uint128ss_append(source, &destination); - assert_int_equal(status, F_none); - assert_int_equal(destination.used, 1); - assert_int_equal(destination.array[0].used, source.used); - assert_int_equal(destination.array[0].size, source.used); - - for (f_array_length_t i = 0; i < destination.array[0].used; ++i) { - assert_int_equal(destination.array[0].array[i], i + 1); - } // for + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + assert_null(destination.array); } - for (f_array_length_t i = 0; i < destination.used; ++i) { - free((void *) destination.array[i].array); - } // for - free((void *) source.array); - free((void *) destination.array); } -void test__f_type_array_uint128ss_append__returns_data_not(void **state) { +void test__f_type_array_uint128ss_append__works(void **state) { const int length = 5; f_uint128s_t source = f_uint128s_t_initialize; @@ -58,27 +56,29 @@ void test__f_type_array_uint128ss_append__returns_data_not(void **state) { assert_int_equal(source.size, length); } + for (; source.used < length; ++source.used) { + source.array[source.used] = source.used + 1; + } // for + { const f_status_t status = f_uint128ss_append(source, &destination); - assert_int_equal(status, F_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); - } - - free((void *) source.array); -} - -void test__f_type_array_uint128ss_append__parameter_checking(void **state) { + assert_int_equal(status, F_none); + assert_int_equal(destination.used, 1); + assert_int_equal(destination.array[0].used, source.used); + assert_int_equal(destination.array[0].size, source.used); - f_uint128s_t data = f_uint128s_t_initialize; + for (f_array_length_t i = 0; i < destination.array[0].used; ++i) { + assert_int_equal(destination.array[0].array[i], i + 1); + } // for + } - { - const f_status_t status = f_uint128ss_append(data, 0); + for (f_array_length_t i = 0; i < destination.used; ++i) { + free((void *) destination.array[i].array); + } // for - assert_int_equal(status, F_status_set_error(F_parameter)); - } + free((void *) source.array); + free((void *) destination.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_append.h index d019beb43..2a0af89d6 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_append.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_append.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__uint128ss_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint128ss_append() + * @see f_uint128ss_append() */ -extern void test__f_type_array_uint128ss_append__works(void **state); +extern void test__f_type_array_uint128ss_append__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_uint128ss_append() + * @see f_uint128ss_append() */ extern void test__f_type_array_uint128ss_append__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint128ss_append() + * @see f_uint128ss_append() */ -extern void test__f_type_array_uint128ss_append__parameter_checking(void **state); +extern void test__f_type_array_uint128ss_append__works(void **state); #endif // _TEST__F_type_array__uint128ss_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_append_all.c index a3ca3c07f..7db15469b 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_append_all.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_append_all.c @@ -5,6 +5,43 @@ extern "C" { #endif +void test__f_type_array_uint128ss_append_all__parameter_checking(void **state) { + + const f_uint128ss_t data = f_uint128ss_t_initialize; + + { + const f_status_t status = f_uint128ss_append_all(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +void test__f_type_array_uint128ss_append_all__returns_data_not(void **state) { + + const int length = 5; + f_uint128ss_t source = f_uint128ss_t_initialize; + f_uint128ss_t destination = f_uint128ss_t_initialize; + + { + const f_status_t status = f_uint128ss_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + { + const f_status_t status = f_uint128ss_append_all(source, &destination); + + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + assert_null(destination.array); + } + + free((void *) source.array); +} + void test__f_type_array_uint128ss_append_all__works(void **state) { const int length = 5; @@ -63,43 +100,6 @@ void test__f_type_array_uint128ss_append_all__works(void **state) { free((void *) destination.array); } -void test__f_type_array_uint128ss_append_all__returns_data_not(void **state) { - - const int length = 5; - f_uint128ss_t source = f_uint128ss_t_initialize; - f_uint128ss_t destination = f_uint128ss_t_initialize; - - { - const f_status_t status = f_uint128ss_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_uint128ss_append_all(source, &destination); - - assert_int_equal(status, F_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); - } - - free((void *) source.array); -} - -void test__f_type_array_uint128ss_append_all__parameter_checking(void **state) { - - const f_uint128ss_t data = f_uint128ss_t_initialize; - - { - const f_status_t status = f_uint128ss_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_append_all.h index 0b1046601..f727d4c7d 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_append_all.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_append_all.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__uint128ss_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint128ss_append_all() + * @see f_uint128ss_append_all() */ -extern void test__f_type_array_uint128ss_append_all__works(void **state); +extern void test__f_type_array_uint128ss_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_uint128ss_append_all() + * @see f_uint128ss_append_all() */ extern void test__f_type_array_uint128ss_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint128ss_append_all() + * @see f_uint128ss_append_all() */ -extern void test__f_type_array_uint128ss_append_all__parameter_checking(void **state); +extern void test__f_type_array_uint128ss_append_all__works(void **state); #endif // _TEST__F_type_array__uint128ss_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_decimate_by.c index c5f8994f4..71e42e27d 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_decimate_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_decimate_by.c @@ -5,11 +5,27 @@ extern "C" { #endif -void test__f_type_array_uint128ss_decimate_by__works(void **state) { +void test__f_type_array_uint128ss_decimate_by__parameter_checking(void **state) { const int length = 5; f_uint128ss_t data = f_uint128s_t_initialize; + { + const f_status_t status = f_uint128ss_decimate_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_uint128ss_decimate_by__returns_data_not(void **state) { + + const int length = 5; + f_uint128ss_t data = f_uint128ss_t_initialize; + { const f_status_t status = f_uint128ss_resize(length, &data); @@ -19,25 +35,33 @@ void test__f_type_array_uint128ss_decimate_by__works(void **state) { } { - const f_status_t status = f_uint128ss_decimate_by(length, &data); + const f_status_t status = f_uint128ss_decimate_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_uint128ss_decimate_by__parameter_checking(void **state) { +void test__f_type_array_uint128ss_decimate_by__works(void **state) { const int length = 5; f_uint128ss_t data = f_uint128s_t_initialize; { - const f_status_t status = f_uint128ss_decimate_by(length, 0); + const f_status_t status = f_uint128ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_uint128ss_decimate_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_decimate_by.h index 763184e56..67ed15a70 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_decimate_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_decimate_by.h @@ -11,17 +11,24 @@ #define _TEST__F_type_array__uint128ss_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint128ss_decimate_by() + * @see f_uint128ss_decimate_by() */ -extern void test__f_type_array_uint128ss_decimate_by__works(void **state); +extern void test__f_type_array_uint128ss_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * * @see f_type_array_uint128ss_decimate_by() */ -extern void test__f_type_array_uint128ss_decimate_by__parameter_checking(void **state); +extern void test__f_type_array_uint128ss_decimate_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_uint128ss_decimate_by() + */ +extern void test__f_type_array_uint128ss_decimate_by__works(void **state); #endif // _TEST__F_type_array__uint128ss_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_decrease_by.c index e8d7ee58e..59f7298c9 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_decrease_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_decrease_by.c @@ -5,11 +5,27 @@ extern "C" { #endif -void test__f_type_array_uint128ss_decrease_by__works(void **state) { +void test__f_type_array_uint128ss_decrease_by__parameter_checking(void **state) { const int length = 5; f_uint128ss_t data = f_uint128s_t_initialize; + { + const f_status_t status = f_uint128ss_decrease_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_uint128ss_decrease_by__returns_data_not(void **state) { + + const int length = 5; + f_uint128ss_t data = f_uint128ss_t_initialize; + { const f_status_t status = f_uint128ss_resize(length, &data); @@ -19,25 +35,33 @@ void test__f_type_array_uint128ss_decrease_by__works(void **state) { } { - const f_status_t status = f_uint128ss_decrease_by(length, &data); + const f_status_t status = f_uint128ss_decrease_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_uint128ss_decrease_by__parameter_checking(void **state) { +void test__f_type_array_uint128ss_decrease_by__works(void **state) { const int length = 5; f_uint128ss_t data = f_uint128s_t_initialize; { - const f_status_t status = f_uint128ss_decrease_by(length, 0); + const f_status_t status = f_uint128ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_uint128ss_decrease_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_decrease_by.h index f6787bcc3..2ebace326 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_decrease_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_decrease_by.h @@ -11,17 +11,24 @@ #define _TEST__F_type_array__uint128ss_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint128ss_decrease_by() + * @see f_uint128ss_decrease_by() */ -extern void test__f_type_array_uint128ss_decrease_by__works(void **state); +extern void test__f_type_array_uint128ss_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_uint128ss_decrease_by() + * @see f_uint128ss_decrease_by() */ -extern void test__f_type_array_uint128ss_decrease_by__parameter_checking(void **state); +extern void test__f_type_array_uint128ss_decrease_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_uint128ss_decrease_by() + */ +extern void test__f_type_array_uint128ss_decrease_by__works(void **state); #endif // _TEST__F_type_array__uint128ss_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_increase.c index 85cb58e8d..cc5daad25 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_increase.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_increase.c @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_uint128ss_increase__works(void **state) { +void test__f_type_array_uint128ss_increase__parameter_checking(void **state) { const int length = 5; f_uint128ss_t data = f_uint128s_t_initialize; { - const f_status_t status = f_uint128ss_resize(length, &data); + const f_status_t status = f_uint128ss_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_uint128ss_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -55,17 +45,27 @@ void test__f_type_array_uint128ss_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_uint128ss_increase__parameter_checking(void **state) { +void test__f_type_array_uint128ss_increase__works(void **state) { const int length = 5; f_uint128ss_t data = f_uint128s_t_initialize; { - const f_status_t status = f_uint128ss_increase(length, 0); + const f_status_t status = f_uint128ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_uint128ss_increase(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); } free((void *) data.array); diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_increase.h index 98a2cce8a..b56416414 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_increase.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_increase.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__uint128ss_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint128ss_increase() + * @see f_uint128ss_increase() */ -extern void test__f_type_array_uint128ss_increase__works(void **state); +extern void test__f_type_array_uint128ss_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_uint128ss_increase() + * @see f_uint128ss_increase() */ extern void test__f_type_array_uint128ss_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint128ss_increase() + * @see f_uint128ss_increase() */ -extern void test__f_type_array_uint128ss_increase__parameter_checking(void **state); +extern void test__f_type_array_uint128ss_increase__works(void **state); #endif // _TEST__F_type_array__uint128ss_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_increase_by.c index 90ee4a9df..af14f4a11 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_increase_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_increase_by.c @@ -5,11 +5,27 @@ extern "C" { #endif -void test__f_type_array_uint128ss_increase_by__works(void **state) { +void test__f_type_array_uint128ss_increase_by__parameter_checking(void **state) { const int length = 5; f_uint128ss_t data = f_uint128s_t_initialize; + { + const f_status_t status = f_uint128ss_increase_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_uint128ss_increase_by__returns_data_not(void **state) { + + const int length = 5; + f_uint128ss_t data = f_uint128ss_t_initialize; + { const f_status_t status = f_uint128ss_resize(length, &data); @@ -19,32 +35,48 @@ void test__f_type_array_uint128ss_increase_by__works(void **state) { } { - data.used = length; + const f_status_t status = f_uint128ss_increase_by(0, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + { const f_status_t status = f_uint128ss_increase_by(length, &data); - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); } free((void *) data.array); } -void test__f_type_array_uint128ss_increase_by__parameter_checking(void **state) { +void test__f_type_array_uint128ss_increase_by__works(void **state) { const int length = 5; f_uint128ss_t data = f_uint128s_t_initialize; { - const f_status_t status = f_uint128ss_increase_by(length, 0); + const f_status_t status = f_uint128ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + { + data.used = length; + + const f_status_t status = f_uint128ss_increase_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_increase_by.h index c1950d8b9..c49f80275 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_increase_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_increase_by.h @@ -11,17 +11,24 @@ #define _TEST__F_type_array__uint128ss_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint128ss_increase_by() + * @see f_uint128ss_increase_by() */ -extern void test__f_type_array_uint128ss_increase_by__works(void **state); +extern void test__f_type_array_uint128ss_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_uint128ss_increase_by() + * @see f_uint128ss_increase_by() */ -extern void test__f_type_array_uint128ss_increase_by__parameter_checking(void **state); +extern void test__f_type_array_uint128ss_increase_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_uint128ss_increase_by() + */ +extern void test__f_type_array_uint128ss_increase_by__works(void **state); #endif // _TEST__F_type_array__uint128ss_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_resize.c index b4999f123..52a3c4aba 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_resize.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_resize.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_uint128ss_resize__works(void **state) { +void test__f_type_array_uint128ss_resize__parameter_checking(void **state) { const int length = 5; f_uint128ss_t data = f_uint128ss_t_initialize; { - const f_status_t status = f_uint128ss_resize(length, &data); + const f_status_t status = f_uint128ss_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_uint128ss_resize__parameter_checking(void **state) { +void test__f_type_array_uint128ss_resize__works(void **state) { const int length = 5; f_uint128ss_t data = f_uint128ss_t_initialize; { - const f_status_t status = f_uint128ss_resize(length, 0); + const f_status_t status = f_uint128ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_resize.h index be44630df..30ad69789 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_resize.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint128ss_resize.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint128ss_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint128ss_resize() + * @see f_uint128ss_resize() */ -extern void test__f_type_array_uint128ss_resize__works(void **state); +extern void test__f_type_array_uint128ss_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint128ss_resize() + * @see f_uint128ss_resize() */ -extern void test__f_type_array_uint128ss_resize__parameter_checking(void **state); +extern void test__f_type_array_uint128ss_resize__works(void **state); #endif // _TEST__F_type_array__uint128ss_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_adjust.c index e5845d173..c9c6b449f 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_adjust.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_adjust.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_uint16s_adjust__works(void **state) { +void test__f_type_array_uint16s_adjust__parameter_checking(void **state) { const int length = 5; f_uint16s_t data = f_uint16s_t_initialize; { - const f_status_t status = f_uint16s_adjust(length, &data); + const f_status_t status = f_uint16s_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_uint16s_adjust__parameter_checking(void **state) { +void test__f_type_array_uint16s_adjust__works(void **state) { const int length = 5; f_uint16s_t data = f_uint16s_t_initialize; { - const f_status_t status = f_uint16s_adjust(length, 0); + const f_status_t status = f_uint16s_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_adjust.h index ba5c21f7b..41d341851 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_adjust.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_adjust.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint16s_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint16s_adjust() + * @see f_uint16s_adjust() */ -extern void test__f_type_array_uint16s_adjust__works(void **state); +extern void test__f_type_array_uint16s_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint16s_adjust() + * @see f_uint16s_adjust() */ -extern void test__f_type_array_uint16s_adjust__parameter_checking(void **state); +extern void test__f_type_array_uint16s_adjust__works(void **state); #endif // _TEST__F_type_array__uint16s_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_append.c index 62f6a6543..0fc429184 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_append.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_append.c @@ -5,6 +5,17 @@ extern "C" { #endif +void test__f_type_array_uint16s_append__parameter_checking(void **state) { + + const uint16_t data = 0; + + { + const f_status_t status = f_uint16s_append(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + void test__f_type_array_uint16s_append__works(void **state) { const uint16_t source = 3; @@ -21,17 +32,6 @@ void test__f_type_array_uint16s_append__works(void **state) { free((void *) destination.array); } -void test__f_type_array_uint16s_append__parameter_checking(void **state) { - - const uint16_t data = 0; - - { - const f_status_t status = f_uint16s_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_append.h index 3a111c66d..46aa1c831 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_append.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_append.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint16s_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint16s_append() + * @see f_uint16s_append() */ -extern void test__f_type_array_uint16s_append__works(void **state); +extern void test__f_type_array_uint16s_append__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint16s_append() + * @see f_uint16s_append() */ -extern void test__f_type_array_uint16s_append__parameter_checking(void **state); +extern void test__f_type_array_uint16s_append__works(void **state); #endif // _TEST__F_type_array__uint16s_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_append_all.c index 519411b2d..a6d63397c 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_append_all.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_append_all.c @@ -5,10 +5,20 @@ extern "C" { #endif -void test__f_type_array_uint16s_append_all__works(void **state) { +void test__f_type_array_uint16s_append_all__parameter_checking(void **state) { + + const f_uint16s_t data = f_uint16s_t_initialize; + + { + const f_status_t status = f_uint16s_append_all(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +void test__f_type_array_uint16s_append_all__returns_data_not(void **state) { const int length = 5; - const int length_used = 2; f_uint16s_t source = f_uint16s_t_initialize; f_uint16s_t destination = f_uint16s_t_initialize; @@ -20,29 +30,22 @@ void test__f_type_array_uint16s_append_all__works(void **state) { assert_int_equal(source.size, length); } - for (; source.used < length_used; ++source.used) { - source.array[source.used] = source.used + 1; - } // for - { const f_status_t status = f_uint16s_append_all(source, &destination); - assert_int_equal(status, F_none); - assert_int_equal(destination.used, source.used); - assert_int_equal(destination.size, source.used); - - for (f_array_length_t i = 0; i < source.used; ++i) { - assert_int_equal(destination.array[i], i + 1); - } // for + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + assert_null(destination.array); } free((void *) source.array); - free((void *) destination.array); } -void test__f_type_array_uint16s_append_all__returns_data_not(void **state) { +void test__f_type_array_uint16s_append_all__works(void **state) { const int length = 5; + const int length_used = 2; f_uint16s_t source = f_uint16s_t_initialize; f_uint16s_t destination = f_uint16s_t_initialize; @@ -54,27 +57,24 @@ void test__f_type_array_uint16s_append_all__returns_data_not(void **state) { assert_int_equal(source.size, length); } + for (; source.used < length_used; ++source.used) { + source.array[source.used] = source.used + 1; + } // for + { const f_status_t status = f_uint16s_append_all(source, &destination); - assert_int_equal(status, F_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); + assert_int_equal(status, F_none); + assert_int_equal(destination.used, source.used); + assert_int_equal(destination.size, source.used); + + for (f_array_length_t i = 0; i < source.used; ++i) { + assert_int_equal(destination.array[i], i + 1); + } // for } free((void *) source.array); -} - -void test__f_type_array_uint16s_append_all__parameter_checking(void **state) { - - const f_uint16s_t data = f_uint16s_t_initialize; - - { - const f_status_t status = f_uint16s_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } + free((void *) destination.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_append_all.h index db4a986b7..b61b3d247 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_append_all.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_append_all.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__uint16s_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint16s_append_all() + * @see f_uint16s_append_all() */ -extern void test__f_type_array_uint16s_append_all__works(void **state); +extern void test__f_type_array_uint16s_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_uint16s_append_all() + * @see f_uint16s_append_all() */ extern void test__f_type_array_uint16s_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint16s_append_all() + * @see f_uint16s_append_all() */ -extern void test__f_type_array_uint16s_append_all__parameter_checking(void **state); +extern void test__f_type_array_uint16s_append_all__works(void **state); #endif // _TEST__F_type_array__uint16s_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_decimate_by.c index 6dbfbd333..7a9020b53 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_decimate_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_decimate_by.c @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_uint16s_decimate_by__works(void **state) { +void test__f_type_array_uint16s_decimate_by__parameter_checking(void **state) { const int length = 5; f_uint16s_t data = f_uint16s_t_initialize; { - const f_status_t status = f_uint16s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint16s_decimate_by(length, &data); + const f_status_t status = f_uint16s_decimate_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_uint16s_decimate_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_uint16s_decimate_by__parameter_checking(void **state) { +void test__f_type_array_uint16s_decimate_by__works(void **state) { const int length = 5; f_uint16s_t data = f_uint16s_t_initialize; { - const f_status_t status = f_uint16s_decimate_by(length, 0); + const f_status_t status = f_uint16s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_uint16s_decimate_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_decimate_by.h index 1a7694866..90ab5fd3e 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_decimate_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_decimate_by.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint16s_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint16s_decimate_by() + * @see f_uint16s_decimate_by() */ -extern void test__f_type_array_uint16s_decimate_by__works(void **state); +extern void test__f_type_array_uint16s_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint16s_decimate_by() + * @see f_uint16s_decimate_by() */ -extern void test__f_type_array_uint16s_decimate_by__parameter_checking(void **state); +extern void test__f_type_array_uint16s_decimate_by__works(void **state); #endif // _TEST__F_type_array__uint16s_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_decrease_by.c index bc68694e1..00979b4be 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_decrease_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_decrease_by.c @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_uint16s_decrease_by__works(void **state) { +void test__f_type_array_uint16s_decrease_by__parameter_checking(void **state) { const int length = 5; f_uint16s_t data = f_uint16s_t_initialize; { - const f_status_t status = f_uint16s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint16s_decrease_by(length, &data); + const f_status_t status = f_uint16s_decrease_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_uint16s_decrease_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_uint16s_decrease_by__parameter_checking(void **state) { +void test__f_type_array_uint16s_decrease_by__works(void **state) { const int length = 5; f_uint16s_t data = f_uint16s_t_initialize; { - const f_status_t status = f_uint16s_decrease_by(length, 0); + const f_status_t status = f_uint16s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_uint16s_decrease_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_decrease_by.h index 144eda0ba..c2ab789e5 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_decrease_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_decrease_by.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint16s_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint16s_decrease_by() + * @see f_uint16s_decrease_by() */ -extern void test__f_type_array_uint16s_decrease_by__works(void **state); +extern void test__f_type_array_uint16s_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint16s_decrease_by() + * @see f_uint16s_decrease_by() */ -extern void test__f_type_array_uint16s_decrease_by__parameter_checking(void **state); +extern void test__f_type_array_uint16s_decrease_by__works(void **state); #endif // _TEST__F_type_array__uint16s_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_increase.c index 065a40afa..95342c8ff 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_increase.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_increase.c @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_uint16s_increase__works(void **state) { +void test__f_type_array_uint16s_increase__parameter_checking(void **state) { const int length = 5; f_uint16s_t data = f_uint16s_t_initialize; { - const f_status_t status = f_uint16s_resize(length, &data); + const f_status_t status = f_uint16s_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_uint16s_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -55,17 +45,27 @@ void test__f_type_array_uint16s_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_uint16s_increase__parameter_checking(void **state) { +void test__f_type_array_uint16s_increase__works(void **state) { const int length = 5; f_uint16s_t data = f_uint16s_t_initialize; { - const f_status_t status = f_uint16s_increase(length, 0); + const f_status_t status = f_uint16s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_uint16s_increase(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); } free((void *) data.array); diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_increase.h index a754c56c4..0c6612e0a 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_increase.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_increase.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__uint16s_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint16s_increase() + * @see f_uint16s_increase() */ -extern void test__f_type_array_uint16s_increase__works(void **state); +extern void test__f_type_array_uint16s_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_uint16s_increase() + * @see f_uint16s_increase() */ extern void test__f_type_array_uint16s_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint16s_increase() + * @see f_uint16s_increase() */ -extern void test__f_type_array_uint16s_increase__parameter_checking(void **state); +extern void test__f_type_array_uint16s_increase__works(void **state); #endif // _TEST__F_type_array__uint16s_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_increase_by.c index ca07bdc92..1784d0662 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_increase_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_increase_by.c @@ -5,6 +5,22 @@ extern "C" { #endif +void test__f_type_array_uint16s_increase_by__parameter_checking(void **state) { + + const int length = 5; + f_uint16s_t data = f_uint16s_t_initialize; + + { + const f_status_t status = f_uint16s_increase_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + void test__f_type_array_uint16s_increase_by__works(void **state) { const int length = 5; @@ -31,22 +47,6 @@ void test__f_type_array_uint16s_increase_by__works(void **state) { free((void *) data.array); } -void test__f_type_array_uint16s_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_uint16s_t data = f_uint16s_t_initialize; - - { - const f_status_t status = f_uint16s_increase_by(length, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_increase_by.h index 61a7e0f1a..5d7f3e2d7 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_increase_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_increase_by.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint16s_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint16s_increase_by() + * @see f_uint16s_increase_by() */ -extern void test__f_type_array_uint16s_increase_by__works(void **state); +extern void test__f_type_array_uint16s_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint16s_increase_by() + * @see f_uint16s_increase_by() */ -extern void test__f_type_array_uint16s_increase_by__parameter_checking(void **state); +extern void test__f_type_array_uint16s_increase_by__works(void **state); #endif // _TEST__F_type_array__uint16s_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_resize.c index 5357df0b9..048ff5eaf 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_resize.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_resize.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_uint16s_resize__works(void **state) { +void test__f_type_array_uint16s_resize__parameter_checking(void **state) { const int length = 5; f_uint16s_t data = f_uint16s_t_initialize; { - const f_status_t status = f_uint16s_resize(length, &data); + const f_status_t status = f_uint16s_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_uint16s_resize__parameter_checking(void **state) { +void test__f_type_array_uint16s_resize__works(void **state) { const int length = 5; f_uint16s_t data = f_uint16s_t_initialize; { - const f_status_t status = f_uint16s_resize(length, 0); + const f_status_t status = f_uint16s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_resize.h index d34513e67..a545df415 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_resize.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16s_resize.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint16s_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint16s_resize() + * @see f_uint16s_resize() */ -extern void test__f_type_array_uint16s_resize__works(void **state); +extern void test__f_type_array_uint16s_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint16s_resize() + * @see f_uint16s_resize() */ -extern void test__f_type_array_uint16s_resize__parameter_checking(void **state); +extern void test__f_type_array_uint16s_resize__works(void **state); #endif // _TEST__F_type_array__uint16s_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_adjust.c index 58dce85dd..c1c2285fe 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_adjust.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_adjust.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_uint16ss_adjust__works(void **state) { +void test__f_type_array_uint16ss_adjust__parameter_checking(void **state) { const int length = 5; f_uint16ss_t data = f_uint16ss_t_initialize; { - const f_status_t status = f_uint16ss_adjust(length, &data); + const f_status_t status = f_uint16ss_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_uint16ss_adjust__parameter_checking(void **state) { +void test__f_type_array_uint16ss_adjust__works(void **state) { const int length = 5; f_uint16ss_t data = f_uint16ss_t_initialize; { - const f_status_t status = f_uint16ss_adjust(length, 0); + const f_status_t status = f_uint16ss_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_adjust.h index 427d558b7..e27a25ab1 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_adjust.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_adjust.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint16ss_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint16ss_adjust() + * @see f_uint16ss_adjust() */ -extern void test__f_type_array_uint16ss_adjust__works(void **state); +extern void test__f_type_array_uint16ss_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint16ss_adjust() + * @see f_uint16ss_adjust() */ -extern void test__f_type_array_uint16ss_adjust__parameter_checking(void **state); +extern void test__f_type_array_uint16ss_adjust__works(void **state); #endif // _TEST__F_type_array__uint16ss_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_append.c index a89594f5f..e10b0ea85 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_append.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_append.c @@ -5,7 +5,18 @@ extern "C" { #endif -void test__f_type_array_uint16ss_append__works(void **state) { +void test__f_type_array_uint16ss_append__parameter_checking(void **state) { + + f_uint16s_t data = f_uint16s_t_initialize; + + { + const f_status_t status = f_uint16ss_append(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +void test__f_type_array_uint16ss_append__returns_data_not(void **state) { const int length = 5; f_uint16s_t source = f_uint16s_t_initialize; @@ -19,32 +30,19 @@ void test__f_type_array_uint16ss_append__works(void **state) { assert_int_equal(source.size, length); } - for (; source.used < length; ++source.used) { - source.array[source.used] = source.used + 1; - } // for - { const f_status_t status = f_uint16ss_append(source, &destination); - assert_int_equal(status, F_none); - assert_int_equal(destination.used, 1); - assert_int_equal(destination.array[0].used, source.used); - assert_int_equal(destination.array[0].size, source.used); - - for (f_array_length_t i = 0; i < destination.array[0].used; ++i) { - assert_int_equal(destination.array[0].array[i], i + 1); - } // for + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + assert_null(destination.array); } - for (f_array_length_t i = 0; i < destination.used; ++i) { - free((void *) destination.array[i].array); - } // for - free((void *) source.array); - free((void *) destination.array); } -void test__f_type_array_uint16ss_append__returns_data_not(void **state) { +void test__f_type_array_uint16ss_append__works(void **state) { const int length = 5; f_uint16s_t source = f_uint16s_t_initialize; @@ -58,27 +56,29 @@ void test__f_type_array_uint16ss_append__returns_data_not(void **state) { assert_int_equal(source.size, length); } + for (; source.used < length; ++source.used) { + source.array[source.used] = source.used + 1; + } // for + { const f_status_t status = f_uint16ss_append(source, &destination); - assert_int_equal(status, F_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); - } - - free((void *) source.array); -} - -void test__f_type_array_uint16ss_append__parameter_checking(void **state) { + assert_int_equal(status, F_none); + assert_int_equal(destination.used, 1); + assert_int_equal(destination.array[0].used, source.used); + assert_int_equal(destination.array[0].size, source.used); - f_uint16s_t data = f_uint16s_t_initialize; + for (f_array_length_t i = 0; i < destination.array[0].used; ++i) { + assert_int_equal(destination.array[0].array[i], i + 1); + } // for + } - { - const f_status_t status = f_uint16ss_append(data, 0); + for (f_array_length_t i = 0; i < destination.used; ++i) { + free((void *) destination.array[i].array); + } // for - assert_int_equal(status, F_status_set_error(F_parameter)); - } + free((void *) source.array); + free((void *) destination.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_append.h index 3ddc590b3..c9daf1c7c 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_append.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_append.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__uint16ss_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint16ss_append() + * @see f_uint16ss_append() */ -extern void test__f_type_array_uint16ss_append__works(void **state); +extern void test__f_type_array_uint16ss_append__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_uint16ss_append() + * @see f_uint16ss_append() */ extern void test__f_type_array_uint16ss_append__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint16ss_append() + * @see f_uint16ss_append() */ -extern void test__f_type_array_uint16ss_append__parameter_checking(void **state); +extern void test__f_type_array_uint16ss_append__works(void **state); #endif // _TEST__F_type_array__uint16ss_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_append_all.c index 4f1f37c38..7480db036 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_append_all.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_append_all.c @@ -5,6 +5,43 @@ extern "C" { #endif +void test__f_type_array_uint16ss_append_all__parameter_checking(void **state) { + + const f_uint16ss_t data = f_uint16ss_t_initialize; + + { + const f_status_t status = f_uint16ss_append_all(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +void test__f_type_array_uint16ss_append_all__returns_data_not(void **state) { + + const int length = 5; + f_uint16ss_t source = f_uint16ss_t_initialize; + f_uint16ss_t destination = f_uint16ss_t_initialize; + + { + const f_status_t status = f_uint16ss_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + { + const f_status_t status = f_uint16ss_append_all(source, &destination); + + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + assert_null(destination.array); + } + + free((void *) source.array); +} + void test__f_type_array_uint16ss_append_all__works(void **state) { const int length = 5; @@ -63,43 +100,6 @@ void test__f_type_array_uint16ss_append_all__works(void **state) { free((void *) destination.array); } -void test__f_type_array_uint16ss_append_all__returns_data_not(void **state) { - - const int length = 5; - f_uint16ss_t source = f_uint16ss_t_initialize; - f_uint16ss_t destination = f_uint16ss_t_initialize; - - { - const f_status_t status = f_uint16ss_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_uint16ss_append_all(source, &destination); - - assert_int_equal(status, F_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); - } - - free((void *) source.array); -} - -void test__f_type_array_uint16ss_append_all__parameter_checking(void **state) { - - const f_uint16ss_t data = f_uint16ss_t_initialize; - - { - const f_status_t status = f_uint16ss_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_append_all.h index 204816999..0453a7f41 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_append_all.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_append_all.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__uint16ss_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint16ss_append_all() + * @see f_uint16ss_append_all() */ -extern void test__f_type_array_uint16ss_append_all__works(void **state); +extern void test__f_type_array_uint16ss_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_uint16ss_append_all() + * @see f_uint16ss_append_all() */ extern void test__f_type_array_uint16ss_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint16ss_append_all() + * @see f_uint16ss_append_all() */ -extern void test__f_type_array_uint16ss_append_all__parameter_checking(void **state); +extern void test__f_type_array_uint16ss_append_all__works(void **state); #endif // _TEST__F_type_array__uint16ss_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_decimate_by.c index f02ea0d2f..bc1bf2024 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_decimate_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_decimate_by.c @@ -5,11 +5,27 @@ extern "C" { #endif -void test__f_type_array_uint16ss_decimate_by__works(void **state) { +void test__f_type_array_uint16ss_decimate_by__parameter_checking(void **state) { const int length = 5; f_uint16ss_t data = f_uint16s_t_initialize; + { + const f_status_t status = f_uint16ss_decimate_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_uint16ss_decimate_by__returns_data_not(void **state) { + + const int length = 5; + f_uint16ss_t data = f_uint16ss_t_initialize; + { const f_status_t status = f_uint16ss_resize(length, &data); @@ -19,25 +35,33 @@ void test__f_type_array_uint16ss_decimate_by__works(void **state) { } { - const f_status_t status = f_uint16ss_decimate_by(length, &data); + const f_status_t status = f_uint16ss_decimate_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_uint16ss_decimate_by__parameter_checking(void **state) { +void test__f_type_array_uint16ss_decimate_by__works(void **state) { const int length = 5; f_uint16ss_t data = f_uint16s_t_initialize; { - const f_status_t status = f_uint16ss_decimate_by(length, 0); + const f_status_t status = f_uint16ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_uint16ss_decimate_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_decimate_by.h index 08b335dbf..5802d7e40 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_decimate_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_decimate_by.h @@ -11,17 +11,24 @@ #define _TEST__F_type_array__uint16ss_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint16ss_decimate_by() + * @see f_uint16ss_decimate_by() */ -extern void test__f_type_array_uint16ss_decimate_by__works(void **state); +extern void test__f_type_array_uint16ss_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * * @see f_type_array_uint16ss_decimate_by() */ -extern void test__f_type_array_uint16ss_decimate_by__parameter_checking(void **state); +extern void test__f_type_array_uint16ss_decimate_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_uint16ss_decimate_by() + */ +extern void test__f_type_array_uint16ss_decimate_by__works(void **state); #endif // _TEST__F_type_array__uint16ss_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_decrease_by.c index 4a547abfe..2b9c9550f 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_decrease_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_decrease_by.c @@ -5,11 +5,27 @@ extern "C" { #endif -void test__f_type_array_uint16ss_decrease_by__works(void **state) { +void test__f_type_array_uint16ss_decrease_by__parameter_checking(void **state) { const int length = 5; f_uint16ss_t data = f_uint16s_t_initialize; + { + const f_status_t status = f_uint16ss_decrease_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_uint16ss_decrease_by__returns_data_not(void **state) { + + const int length = 5; + f_uint16ss_t data = f_uint16ss_t_initialize; + { const f_status_t status = f_uint16ss_resize(length, &data); @@ -19,25 +35,33 @@ void test__f_type_array_uint16ss_decrease_by__works(void **state) { } { - const f_status_t status = f_uint16ss_decrease_by(length, &data); + const f_status_t status = f_uint16ss_decrease_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_uint16ss_decrease_by__parameter_checking(void **state) { +void test__f_type_array_uint16ss_decrease_by__works(void **state) { const int length = 5; f_uint16ss_t data = f_uint16s_t_initialize; { - const f_status_t status = f_uint16ss_decrease_by(length, 0); + const f_status_t status = f_uint16ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_uint16ss_decrease_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_decrease_by.h index e9c46e396..c30671dd8 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_decrease_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_decrease_by.h @@ -11,17 +11,24 @@ #define _TEST__F_type_array__uint16ss_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint16ss_decrease_by() + * @see f_uint16ss_decrease_by() */ -extern void test__f_type_array_uint16ss_decrease_by__works(void **state); +extern void test__f_type_array_uint16ss_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_uint16ss_decrease_by() + * @see f_uint16ss_decrease_by() */ -extern void test__f_type_array_uint16ss_decrease_by__parameter_checking(void **state); +extern void test__f_type_array_uint16ss_decrease_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_uint16ss_decrease_by() + */ +extern void test__f_type_array_uint16ss_decrease_by__works(void **state); #endif // _TEST__F_type_array__uint16ss_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_increase.c index b47b0d22c..8808da3aa 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_increase.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_increase.c @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_uint16ss_increase__works(void **state) { +void test__f_type_array_uint16ss_increase__parameter_checking(void **state) { const int length = 5; f_uint16ss_t data = f_uint16s_t_initialize; { - const f_status_t status = f_uint16ss_resize(length, &data); + const f_status_t status = f_uint16ss_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_uint16ss_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -55,17 +45,27 @@ void test__f_type_array_uint16ss_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_uint16ss_increase__parameter_checking(void **state) { +void test__f_type_array_uint16ss_increase__works(void **state) { const int length = 5; f_uint16ss_t data = f_uint16s_t_initialize; { - const f_status_t status = f_uint16ss_increase(length, 0); + const f_status_t status = f_uint16ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_uint16ss_increase(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); } free((void *) data.array); diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_increase.h index df1cbf285..c464faefb 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_increase.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_increase.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__uint16ss_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint16ss_increase() + * @see f_uint16ss_increase() */ -extern void test__f_type_array_uint16ss_increase__works(void **state); +extern void test__f_type_array_uint16ss_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_uint16ss_increase() + * @see f_uint16ss_increase() */ extern void test__f_type_array_uint16ss_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint16ss_increase() + * @see f_uint16ss_increase() */ -extern void test__f_type_array_uint16ss_increase__parameter_checking(void **state); +extern void test__f_type_array_uint16ss_increase__works(void **state); #endif // _TEST__F_type_array__uint16ss_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_increase_by.c index 4ad84b62d..79b090028 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_increase_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_increase_by.c @@ -5,11 +5,27 @@ extern "C" { #endif -void test__f_type_array_uint16ss_increase_by__works(void **state) { +void test__f_type_array_uint16ss_increase_by__parameter_checking(void **state) { const int length = 5; f_uint16ss_t data = f_uint16s_t_initialize; + { + const f_status_t status = f_uint16ss_increase_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_uint16ss_increase_by__returns_data_not(void **state) { + + const int length = 5; + f_uint16ss_t data = f_uint16ss_t_initialize; + { const f_status_t status = f_uint16ss_resize(length, &data); @@ -19,32 +35,48 @@ void test__f_type_array_uint16ss_increase_by__works(void **state) { } { - data.used = length; + const f_status_t status = f_uint16ss_increase_by(0, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + { const f_status_t status = f_uint16ss_increase_by(length, &data); - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); } free((void *) data.array); } -void test__f_type_array_uint16ss_increase_by__parameter_checking(void **state) { +void test__f_type_array_uint16ss_increase_by__works(void **state) { const int length = 5; f_uint16ss_t data = f_uint16s_t_initialize; { - const f_status_t status = f_uint16ss_increase_by(length, 0); + const f_status_t status = f_uint16ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + { + data.used = length; + + const f_status_t status = f_uint16ss_increase_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_increase_by.h index 54cc5a3a6..4aa8fa9bf 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_increase_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_increase_by.h @@ -11,17 +11,24 @@ #define _TEST__F_type_array__uint16ss_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint16ss_increase_by() + * @see f_uint16ss_increase_by() */ -extern void test__f_type_array_uint16ss_increase_by__works(void **state); +extern void test__f_type_array_uint16ss_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_uint16ss_increase_by() + * @see f_uint16ss_increase_by() */ -extern void test__f_type_array_uint16ss_increase_by__parameter_checking(void **state); +extern void test__f_type_array_uint16ss_increase_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_uint16ss_increase_by() + */ +extern void test__f_type_array_uint16ss_increase_by__works(void **state); #endif // _TEST__F_type_array__uint16ss_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_resize.c index 4936f1b5a..b087228c0 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_resize.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_resize.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_uint16ss_resize__works(void **state) { +void test__f_type_array_uint16ss_resize__parameter_checking(void **state) { const int length = 5; f_uint16ss_t data = f_uint16ss_t_initialize; { - const f_status_t status = f_uint16ss_resize(length, &data); + const f_status_t status = f_uint16ss_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_uint16ss_resize__parameter_checking(void **state) { +void test__f_type_array_uint16ss_resize__works(void **state) { const int length = 5; f_uint16ss_t data = f_uint16ss_t_initialize; { - const f_status_t status = f_uint16ss_resize(length, 0); + const f_status_t status = f_uint16ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_resize.h index 5f1af71ee..4f4a2aec9 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_resize.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint16ss_resize.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint16ss_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint16ss_resize() + * @see f_uint16ss_resize() */ -extern void test__f_type_array_uint16ss_resize__works(void **state); +extern void test__f_type_array_uint16ss_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint16ss_resize() + * @see f_uint16ss_resize() */ -extern void test__f_type_array_uint16ss_resize__parameter_checking(void **state); +extern void test__f_type_array_uint16ss_resize__works(void **state); #endif // _TEST__F_type_array__uint16ss_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_adjust.c index 70af09099..2e732dbf9 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_adjust.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_adjust.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_uint32s_adjust__works(void **state) { +void test__f_type_array_uint32s_adjust__parameter_checking(void **state) { const int length = 5; f_uint32s_t data = f_uint32s_t_initialize; { - const f_status_t status = f_uint32s_adjust(length, &data); + const f_status_t status = f_uint32s_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_uint32s_adjust__parameter_checking(void **state) { +void test__f_type_array_uint32s_adjust__works(void **state) { const int length = 5; f_uint32s_t data = f_uint32s_t_initialize; { - const f_status_t status = f_uint32s_adjust(length, 0); + const f_status_t status = f_uint32s_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_adjust.h index 4b8587032..a3f4cd052 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_adjust.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_adjust.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint32s_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint32s_adjust() + * @see f_uint32s_adjust() */ -extern void test__f_type_array_uint32s_adjust__works(void **state); +extern void test__f_type_array_uint32s_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint32s_adjust() + * @see f_uint32s_adjust() */ -extern void test__f_type_array_uint32s_adjust__parameter_checking(void **state); +extern void test__f_type_array_uint32s_adjust__works(void **state); #endif // _TEST__F_type_array__uint32s_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_append.c index 723abf763..718879010 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_append.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_append.c @@ -5,6 +5,17 @@ extern "C" { #endif +void test__f_type_array_uint32s_append__parameter_checking(void **state) { + + const uint32_t data = 0; + + { + const f_status_t status = f_uint32s_append(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + void test__f_type_array_uint32s_append__works(void **state) { const uint32_t source = 3; @@ -21,17 +32,6 @@ void test__f_type_array_uint32s_append__works(void **state) { free((void *) destination.array); } -void test__f_type_array_uint32s_append__parameter_checking(void **state) { - - const uint32_t data = 0; - - { - const f_status_t status = f_uint32s_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_append.h index 884e11e4e..d8b5808a8 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_append.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_append.h @@ -9,19 +9,19 @@ */ #ifndef _TEST__F_type_array__uint32s_append #define _TEST__F_type_array__uint32s_append - /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint32s_append() + * @see f_uint32s_append() */ -extern void test__f_type_array_uint32s_append__works(void **state); +extern void test__f_type_array_uint32s_append__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint32s_append() + * @see f_uint32s_append() */ -extern void test__f_type_array_uint32s_append__parameter_checking(void **state); +extern void test__f_type_array_uint32s_append__works(void **state); + #endif // _TEST__F_type_array__uint32s_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_append_all.c index 43529a0da..1caea4ee2 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_append_all.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_append_all.c @@ -5,10 +5,20 @@ extern "C" { #endif -void test__f_type_array_uint32s_append_all__works(void **state) { +void test__f_type_array_uint32s_append_all__parameter_checking(void **state) { + + const f_uint32s_t data = f_uint32s_t_initialize; + + { + const f_status_t status = f_uint32s_append_all(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +void test__f_type_array_uint32s_append_all__returns_data_not(void **state) { const int length = 5; - const int length_used = 2; f_uint32s_t source = f_uint32s_t_initialize; f_uint32s_t destination = f_uint32s_t_initialize; @@ -20,29 +30,22 @@ void test__f_type_array_uint32s_append_all__works(void **state) { assert_int_equal(source.size, length); } - for (; source.used < length_used; ++source.used) { - source.array[source.used] = source.used + 1; - } // for - { const f_status_t status = f_uint32s_append_all(source, &destination); - assert_int_equal(status, F_none); - assert_int_equal(destination.used, source.used); - assert_int_equal(destination.size, source.used); - - for (f_array_length_t i = 0; i < source.used; ++i) { - assert_int_equal(destination.array[i], i + 1); - } // for + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + assert_null(destination.array); } free((void *) source.array); - free((void *) destination.array); } -void test__f_type_array_uint32s_append_all__returns_data_not(void **state) { +void test__f_type_array_uint32s_append_all__works(void **state) { const int length = 5; + const int length_used = 2; f_uint32s_t source = f_uint32s_t_initialize; f_uint32s_t destination = f_uint32s_t_initialize; @@ -54,27 +57,24 @@ void test__f_type_array_uint32s_append_all__returns_data_not(void **state) { assert_int_equal(source.size, length); } + for (; source.used < length_used; ++source.used) { + source.array[source.used] = source.used + 1; + } // for + { const f_status_t status = f_uint32s_append_all(source, &destination); - assert_int_equal(status, F_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); + assert_int_equal(status, F_none); + assert_int_equal(destination.used, source.used); + assert_int_equal(destination.size, source.used); + + for (f_array_length_t i = 0; i < source.used; ++i) { + assert_int_equal(destination.array[i], i + 1); + } // for } free((void *) source.array); -} - -void test__f_type_array_uint32s_append_all__parameter_checking(void **state) { - - const f_uint32s_t data = f_uint32s_t_initialize; - - { - const f_status_t status = f_uint32s_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } + free((void *) destination.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_append_all.h index 521e499d7..a4f91817b 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_append_all.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_append_all.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__uint32s_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint32s_append_all() + * @see f_uint32s_append_all() */ -extern void test__f_type_array_uint32s_append_all__works(void **state); +extern void test__f_type_array_uint32s_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_uint32s_append_all() + * @see f_uint32s_append_all() */ extern void test__f_type_array_uint32s_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint32s_append_all() + * @see f_uint32s_append_all() */ -extern void test__f_type_array_uint32s_append_all__parameter_checking(void **state); +extern void test__f_type_array_uint32s_append_all__works(void **state); #endif // _TEST__F_type_array__uint32s_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_decimate_by.c index 950d1b012..5fc0dc40a 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_decimate_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_decimate_by.c @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_uint32s_decimate_by__works(void **state) { +void test__f_type_array_uint32s_decimate_by__parameter_checking(void **state) { const int length = 5; f_uint32s_t data = f_uint32s_t_initialize; { - const f_status_t status = f_uint32s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint32s_decimate_by(length, &data); + const f_status_t status = f_uint32s_decimate_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_uint32s_decimate_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_uint32s_decimate_by__parameter_checking(void **state) { +void test__f_type_array_uint32s_decimate_by__works(void **state) { const int length = 5; f_uint32s_t data = f_uint32s_t_initialize; { - const f_status_t status = f_uint32s_decimate_by(length, 0); + const f_status_t status = f_uint32s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_uint32s_decimate_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_decimate_by.h index f549ca6cc..e76bc6058 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_decimate_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_decimate_by.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint32s_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint32s_decimate_by() + * @see f_uint32s_decimate_by() */ -extern void test__f_type_array_uint32s_decimate_by__works(void **state); +extern void test__f_type_array_uint32s_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint32s_decimate_by() + * @see f_uint32s_decimate_by() */ -extern void test__f_type_array_uint32s_decimate_by__parameter_checking(void **state); +extern void test__f_type_array_uint32s_decimate_by__works(void **state); #endif // _TEST__F_type_array__uint32s_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_decrease_by.c index 392052b3e..207d384ab 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_decrease_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_decrease_by.c @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_uint32s_decrease_by__works(void **state) { +void test__f_type_array_uint32s_decrease_by__parameter_checking(void **state) { const int length = 5; f_uint32s_t data = f_uint32s_t_initialize; { - const f_status_t status = f_uint32s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint32s_decrease_by(length, &data); + const f_status_t status = f_uint32s_decrease_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_uint32s_decrease_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_uint32s_decrease_by__parameter_checking(void **state) { +void test__f_type_array_uint32s_decrease_by__works(void **state) { const int length = 5; f_uint32s_t data = f_uint32s_t_initialize; { - const f_status_t status = f_uint32s_decrease_by(length, 0); + const f_status_t status = f_uint32s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_uint32s_decrease_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_decrease_by.h index 35f03bba2..bf74dcb30 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_decrease_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_decrease_by.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint32s_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint32s_decrease_by() + * @see f_uint32s_decrease_by() */ -extern void test__f_type_array_uint32s_decrease_by__works(void **state); +extern void test__f_type_array_uint32s_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint32s_decrease_by() + * @see f_uint32s_decrease_by() */ -extern void test__f_type_array_uint32s_decrease_by__parameter_checking(void **state); +extern void test__f_type_array_uint32s_decrease_by__works(void **state); #endif // _TEST__F_type_array__uint32s_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_increase.c index d77df7fcb..378ae00eb 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_increase.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_increase.c @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_uint32s_increase__works(void **state) { +void test__f_type_array_uint32s_increase__parameter_checking(void **state) { const int length = 5; f_uint32s_t data = f_uint32s_t_initialize; { - const f_status_t status = f_uint32s_resize(length, &data); + const f_status_t status = f_uint32s_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_uint32s_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -55,17 +45,27 @@ void test__f_type_array_uint32s_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_uint32s_increase__parameter_checking(void **state) { +void test__f_type_array_uint32s_increase__works(void **state) { const int length = 5; f_uint32s_t data = f_uint32s_t_initialize; { - const f_status_t status = f_uint32s_increase(length, 0); + const f_status_t status = f_uint32s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_uint32s_increase(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); } free((void *) data.array); diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_increase.h index e0db8f355..059cb0546 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_increase.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_increase.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__uint32s_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint32s_increase() + * @see f_uint32s_increase() */ -extern void test__f_type_array_uint32s_increase__works(void **state); +extern void test__f_type_array_uint32s_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_uint32s_increase() + * @see f_uint32s_increase() */ extern void test__f_type_array_uint32s_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint32s_increase() + * @see f_uint32s_increase() */ -extern void test__f_type_array_uint32s_increase__parameter_checking(void **state); +extern void test__f_type_array_uint32s_increase__works(void **state); #endif // _TEST__F_type_array__uint32s_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_increase_by.c index f165f0411..8d42d04e5 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_increase_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_increase_by.c @@ -5,6 +5,22 @@ extern "C" { #endif +void test__f_type_array_uint32s_increase_by__parameter_checking(void **state) { + + const int length = 5; + f_uint32s_t data = f_uint32s_t_initialize; + + { + const f_status_t status = f_uint32s_increase_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + void test__f_type_array_uint32s_increase_by__works(void **state) { const int length = 5; @@ -31,22 +47,6 @@ void test__f_type_array_uint32s_increase_by__works(void **state) { free((void *) data.array); } -void test__f_type_array_uint32s_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_uint32s_t data = f_uint32s_t_initialize; - - { - const f_status_t status = f_uint32s_increase_by(length, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_increase_by.h index 6afbf5d70..9b6dd4532 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_increase_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_increase_by.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint32s_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint32s_increase_by() + * @see f_uint32s_increase_by() */ -extern void test__f_type_array_uint32s_increase_by__works(void **state); +extern void test__f_type_array_uint32s_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint32s_increase_by() + * @see f_uint32s_increase_by() */ -extern void test__f_type_array_uint32s_increase_by__parameter_checking(void **state); +extern void test__f_type_array_uint32s_increase_by__works(void **state); #endif // _TEST__F_type_array__uint32s_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_resize.c index 4006ef2a9..54d8457e7 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_resize.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_resize.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_uint32s_resize__works(void **state) { +void test__f_type_array_uint32s_resize__parameter_checking(void **state) { const int length = 5; f_uint32s_t data = f_uint32s_t_initialize; { - const f_status_t status = f_uint32s_resize(length, &data); + const f_status_t status = f_uint32s_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_uint32s_resize__parameter_checking(void **state) { +void test__f_type_array_uint32s_resize__works(void **state) { const int length = 5; f_uint32s_t data = f_uint32s_t_initialize; { - const f_status_t status = f_uint32s_resize(length, 0); + const f_status_t status = f_uint32s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_resize.h index 26a116d37..6d1377dd7 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_resize.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32s_resize.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint32s_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint32s_resize() + * @see f_uint32s_resize() */ -extern void test__f_type_array_uint32s_resize__works(void **state); +extern void test__f_type_array_uint32s_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint32s_resize() + * @see f_uint32s_resize() */ -extern void test__f_type_array_uint32s_resize__parameter_checking(void **state); +extern void test__f_type_array_uint32s_resize__works(void **state); #endif // _TEST__F_type_array__uint32s_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_adjust.c index d1808091b..89bf16c93 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_adjust.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_adjust.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_uint32ss_adjust__works(void **state) { +void test__f_type_array_uint32ss_adjust__parameter_checking(void **state) { const int length = 5; f_uint32ss_t data = f_uint32ss_t_initialize; { - const f_status_t status = f_uint32ss_adjust(length, &data); + const f_status_t status = f_uint32ss_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_uint32ss_adjust__parameter_checking(void **state) { +void test__f_type_array_uint32ss_adjust__works(void **state) { const int length = 5; f_uint32ss_t data = f_uint32ss_t_initialize; { - const f_status_t status = f_uint32ss_adjust(length, 0); + const f_status_t status = f_uint32ss_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_adjust.h index 5d27154de..875a950d6 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_adjust.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_adjust.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint32ss_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint32ss_adjust() + * @see f_uint32ss_adjust() */ -extern void test__f_type_array_uint32ss_adjust__works(void **state); +extern void test__f_type_array_uint32ss_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint32ss_adjust() + * @see f_uint32ss_adjust() */ -extern void test__f_type_array_uint32ss_adjust__parameter_checking(void **state); +extern void test__f_type_array_uint32ss_adjust__works(void **state); #endif // _TEST__F_type_array__uint32ss_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_append.c index 32cd33806..c88d47333 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_append.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_append.c @@ -5,7 +5,18 @@ extern "C" { #endif -void test__f_type_array_uint32ss_append__works(void **state) { +void test__f_type_array_uint32ss_append__parameter_checking(void **state) { + + f_uint32s_t data = f_uint32s_t_initialize; + + { + const f_status_t status = f_uint32ss_append(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +void test__f_type_array_uint32ss_append__returns_data_not(void **state) { const int length = 5; f_uint32s_t source = f_uint32s_t_initialize; @@ -19,32 +30,19 @@ void test__f_type_array_uint32ss_append__works(void **state) { assert_int_equal(source.size, length); } - for (; source.used < length; ++source.used) { - source.array[source.used] = source.used + 1; - } // for - { const f_status_t status = f_uint32ss_append(source, &destination); - assert_int_equal(status, F_none); - assert_int_equal(destination.used, 1); - assert_int_equal(destination.array[0].used, source.used); - assert_int_equal(destination.array[0].size, source.used); - - for (f_array_length_t i = 0; i < destination.array[0].used; ++i) { - assert_int_equal(destination.array[0].array[i], i + 1); - } // for + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + assert_null(destination.array); } - for (f_array_length_t i = 0; i < destination.used; ++i) { - free((void *) destination.array[i].array); - } // for - free((void *) source.array); - free((void *) destination.array); } -void test__f_type_array_uint32ss_append__returns_data_not(void **state) { +void test__f_type_array_uint32ss_append__works(void **state) { const int length = 5; f_uint32s_t source = f_uint32s_t_initialize; @@ -58,27 +56,29 @@ void test__f_type_array_uint32ss_append__returns_data_not(void **state) { assert_int_equal(source.size, length); } + for (; source.used < length; ++source.used) { + source.array[source.used] = source.used + 1; + } // for + { const f_status_t status = f_uint32ss_append(source, &destination); - assert_int_equal(status, F_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); - } - - free((void *) source.array); -} - -void test__f_type_array_uint32ss_append__parameter_checking(void **state) { + assert_int_equal(status, F_none); + assert_int_equal(destination.used, 1); + assert_int_equal(destination.array[0].used, source.used); + assert_int_equal(destination.array[0].size, source.used); - f_uint32s_t data = f_uint32s_t_initialize; + for (f_array_length_t i = 0; i < destination.array[0].used; ++i) { + assert_int_equal(destination.array[0].array[i], i + 1); + } // for + } - { - const f_status_t status = f_uint32ss_append(data, 0); + for (f_array_length_t i = 0; i < destination.used; ++i) { + free((void *) destination.array[i].array); + } // for - assert_int_equal(status, F_status_set_error(F_parameter)); - } + free((void *) source.array); + free((void *) destination.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_append.h index fd2cf401f..58480ad67 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_append.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_append.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__uint32ss_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint32ss_append() + * @see f_uint32ss_append() */ -extern void test__f_type_array_uint32ss_append__works(void **state); +extern void test__f_type_array_uint32ss_append__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_uint32ss_append() + * @see f_uint32ss_append() */ extern void test__f_type_array_uint32ss_append__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint32ss_append() + * @see f_uint32ss_append() */ -extern void test__f_type_array_uint32ss_append__parameter_checking(void **state); +extern void test__f_type_array_uint32ss_append__works(void **state); #endif // _TEST__F_type_array__uint32ss_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_append_all.c index 032593afa..41b482f75 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_append_all.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_append_all.c @@ -5,6 +5,43 @@ extern "C" { #endif +void test__f_type_array_uint32ss_append_all__parameter_checking(void **state) { + + const f_uint32ss_t data = f_uint32ss_t_initialize; + + { + const f_status_t status = f_uint32ss_append_all(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +void test__f_type_array_uint32ss_append_all__returns_data_not(void **state) { + + const int length = 5; + f_uint32ss_t source = f_uint32ss_t_initialize; + f_uint32ss_t destination = f_uint32ss_t_initialize; + + { + const f_status_t status = f_uint32ss_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + { + const f_status_t status = f_uint32ss_append_all(source, &destination); + + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + assert_null(destination.array); + } + + free((void *) source.array); +} + void test__f_type_array_uint32ss_append_all__works(void **state) { const int length = 5; @@ -63,43 +100,6 @@ void test__f_type_array_uint32ss_append_all__works(void **state) { free((void *) destination.array); } -void test__f_type_array_uint32ss_append_all__returns_data_not(void **state) { - - const int length = 5; - f_uint32ss_t source = f_uint32ss_t_initialize; - f_uint32ss_t destination = f_uint32ss_t_initialize; - - { - const f_status_t status = f_uint32ss_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_uint32ss_append_all(source, &destination); - - assert_int_equal(status, F_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); - } - - free((void *) source.array); -} - -void test__f_type_array_uint32ss_append_all__parameter_checking(void **state) { - - const f_uint32ss_t data = f_uint32ss_t_initialize; - - { - const f_status_t status = f_uint32ss_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_append_all.h index 8ca060512..0135f4a62 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_append_all.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_append_all.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__uint32ss_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint32ss_append_all() + * @see f_uint32ss_append_all() */ -extern void test__f_type_array_uint32ss_append_all__works(void **state); +extern void test__f_type_array_uint32ss_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_uint32ss_append_all() + * @see f_uint32ss_append_all() */ extern void test__f_type_array_uint32ss_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint32ss_append_all() + * @see f_uint32ss_append_all() */ -extern void test__f_type_array_uint32ss_append_all__parameter_checking(void **state); +extern void test__f_type_array_uint32ss_append_all__works(void **state); #endif // _TEST__F_type_array__uint32ss_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_decimate_by.c index d941d027a..5219c964f 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_decimate_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_decimate_by.c @@ -5,11 +5,27 @@ extern "C" { #endif -void test__f_type_array_uint32ss_decimate_by__works(void **state) { +void test__f_type_array_uint32ss_decimate_by__parameter_checking(void **state) { const int length = 5; f_uint32ss_t data = f_uint32s_t_initialize; + { + const f_status_t status = f_uint32ss_decimate_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_uint32ss_decimate_by__returns_data_not(void **state) { + + const int length = 5; + f_uint32ss_t data = f_uint32ss_t_initialize; + { const f_status_t status = f_uint32ss_resize(length, &data); @@ -19,25 +35,33 @@ void test__f_type_array_uint32ss_decimate_by__works(void **state) { } { - const f_status_t status = f_uint32ss_decimate_by(length, &data); + const f_status_t status = f_uint32ss_decimate_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_uint32ss_decimate_by__parameter_checking(void **state) { +void test__f_type_array_uint32ss_decimate_by__works(void **state) { const int length = 5; f_uint32ss_t data = f_uint32s_t_initialize; { - const f_status_t status = f_uint32ss_decimate_by(length, 0); + const f_status_t status = f_uint32ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_uint32ss_decimate_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_decimate_by.h index 50380ba11..795512987 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_decimate_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_decimate_by.h @@ -11,17 +11,24 @@ #define _TEST__F_type_array__uint32ss_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint32ss_decimate_by() + * @see f_uint32ss_decimate_by() */ -extern void test__f_type_array_uint32ss_decimate_by__works(void **state); +extern void test__f_type_array_uint32ss_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * * @see f_type_array_uint32ss_decimate_by() */ -extern void test__f_type_array_uint32ss_decimate_by__parameter_checking(void **state); +extern void test__f_type_array_uint32ss_decimate_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_uint32ss_decimate_by() + */ +extern void test__f_type_array_uint32ss_decimate_by__works(void **state); #endif // _TEST__F_type_array__uint32ss_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_decrease_by.c index f7fd55030..27512737f 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_decrease_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_decrease_by.c @@ -5,11 +5,27 @@ extern "C" { #endif -void test__f_type_array_uint32ss_decrease_by__works(void **state) { +void test__f_type_array_uint32ss_decrease_by__parameter_checking(void **state) { const int length = 5; f_uint32ss_t data = f_uint32s_t_initialize; + { + const f_status_t status = f_uint32ss_decrease_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_uint32ss_decrease_by__returns_data_not(void **state) { + + const int length = 5; + f_uint32ss_t data = f_uint32ss_t_initialize; + { const f_status_t status = f_uint32ss_resize(length, &data); @@ -19,25 +35,33 @@ void test__f_type_array_uint32ss_decrease_by__works(void **state) { } { - const f_status_t status = f_uint32ss_decrease_by(length, &data); + const f_status_t status = f_uint32ss_decrease_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_uint32ss_decrease_by__parameter_checking(void **state) { +void test__f_type_array_uint32ss_decrease_by__works(void **state) { const int length = 5; f_uint32ss_t data = f_uint32s_t_initialize; { - const f_status_t status = f_uint32ss_decrease_by(length, 0); + const f_status_t status = f_uint32ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_uint32ss_decrease_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_decrease_by.h index 695a5c9d4..ae170aa47 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_decrease_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_decrease_by.h @@ -11,17 +11,24 @@ #define _TEST__F_type_array__uint32ss_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint32ss_decrease_by() + * @see f_uint32ss_decrease_by() */ -extern void test__f_type_array_uint32ss_decrease_by__works(void **state); +extern void test__f_type_array_uint32ss_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_uint32ss_decrease_by() + * @see f_uint32ss_decrease_by() */ -extern void test__f_type_array_uint32ss_decrease_by__parameter_checking(void **state); +extern void test__f_type_array_uint32ss_decrease_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_uint32ss_decrease_by() + */ +extern void test__f_type_array_uint32ss_decrease_by__works(void **state); #endif // _TEST__F_type_array__uint32ss_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_increase.c index 432b3621c..344012ec7 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_increase.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_increase.c @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_uint32ss_increase__works(void **state) { +void test__f_type_array_uint32ss_increase__parameter_checking(void **state) { const int length = 5; f_uint32ss_t data = f_uint32s_t_initialize; { - const f_status_t status = f_uint32ss_resize(length, &data); + const f_status_t status = f_uint32ss_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_uint32ss_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -55,17 +45,27 @@ void test__f_type_array_uint32ss_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_uint32ss_increase__parameter_checking(void **state) { +void test__f_type_array_uint32ss_increase__works(void **state) { const int length = 5; f_uint32ss_t data = f_uint32s_t_initialize; { - const f_status_t status = f_uint32ss_increase(length, 0); + const f_status_t status = f_uint32ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_uint32ss_increase(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); } free((void *) data.array); diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_increase.h index 18beac0da..754a1babe 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_increase.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_increase.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__uint32ss_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint32ss_increase() + * @see f_uint32ss_increase() */ -extern void test__f_type_array_uint32ss_increase__works(void **state); +extern void test__f_type_array_uint32ss_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_uint32ss_increase() + * @see f_uint32ss_increase() */ extern void test__f_type_array_uint32ss_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint32ss_increase() + * @see f_uint32ss_increase() */ -extern void test__f_type_array_uint32ss_increase__parameter_checking(void **state); +extern void test__f_type_array_uint32ss_increase__works(void **state); #endif // _TEST__F_type_array__uint32ss_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_increase_by.c index 07000c365..449e2b242 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_increase_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_increase_by.c @@ -5,11 +5,27 @@ extern "C" { #endif -void test__f_type_array_uint32ss_increase_by__works(void **state) { +void test__f_type_array_uint32ss_increase_by__parameter_checking(void **state) { const int length = 5; f_uint32ss_t data = f_uint32s_t_initialize; + { + const f_status_t status = f_uint32ss_increase_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_uint32ss_increase_by__returns_data_not(void **state) { + + const int length = 5; + f_uint32ss_t data = f_uint32ss_t_initialize; + { const f_status_t status = f_uint32ss_resize(length, &data); @@ -19,32 +35,48 @@ void test__f_type_array_uint32ss_increase_by__works(void **state) { } { - data.used = length; + const f_status_t status = f_uint32ss_increase_by(0, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + { const f_status_t status = f_uint32ss_increase_by(length, &data); - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); } free((void *) data.array); } -void test__f_type_array_uint32ss_increase_by__parameter_checking(void **state) { +void test__f_type_array_uint32ss_increase_by__works(void **state) { const int length = 5; f_uint32ss_t data = f_uint32s_t_initialize; { - const f_status_t status = f_uint32ss_increase_by(length, 0); + const f_status_t status = f_uint32ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + { + data.used = length; + + const f_status_t status = f_uint32ss_increase_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_increase_by.h index c05511d79..cfbe2c5b6 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_increase_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_increase_by.h @@ -11,17 +11,24 @@ #define _TEST__F_type_array__uint32ss_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint32ss_increase_by() + * @see f_uint32ss_increase_by() */ -extern void test__f_type_array_uint32ss_increase_by__works(void **state); +extern void test__f_type_array_uint32ss_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_uint32ss_increase_by() + * @see f_uint32ss_increase_by() */ -extern void test__f_type_array_uint32ss_increase_by__parameter_checking(void **state); +extern void test__f_type_array_uint32ss_increase_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_uint32ss_increase_by() + */ +extern void test__f_type_array_uint32ss_increase_by__works(void **state); #endif // _TEST__F_type_array__uint32ss_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_resize.c index 16b522ecd..27209a415 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_resize.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_resize.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_uint32ss_resize__works(void **state) { +void test__f_type_array_uint32ss_resize__parameter_checking(void **state) { const int length = 5; f_uint32ss_t data = f_uint32ss_t_initialize; { - const f_status_t status = f_uint32ss_resize(length, &data); + const f_status_t status = f_uint32ss_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_uint32ss_resize__parameter_checking(void **state) { +void test__f_type_array_uint32ss_resize__works(void **state) { const int length = 5; f_uint32ss_t data = f_uint32ss_t_initialize; { - const f_status_t status = f_uint32ss_resize(length, 0); + const f_status_t status = f_uint32ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_resize.h index fd1ed4c5a..e5e6c9f69 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_resize.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint32ss_resize.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint32ss_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint32ss_resize() + * @see f_uint32ss_resize() */ -extern void test__f_type_array_uint32ss_resize__works(void **state); +extern void test__f_type_array_uint32ss_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint32ss_resize() + * @see f_uint32ss_resize() */ -extern void test__f_type_array_uint32ss_resize__parameter_checking(void **state); +extern void test__f_type_array_uint32ss_resize__works(void **state); #endif // _TEST__F_type_array__uint32ss_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_adjust.c index 433695201..fd65031fe 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_adjust.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_adjust.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_uint64s_adjust__works(void **state) { +void test__f_type_array_uint64s_adjust__parameter_checking(void **state) { const int length = 5; f_uint64s_t data = f_uint64s_t_initialize; { - const f_status_t status = f_uint64s_adjust(length, &data); + const f_status_t status = f_uint64s_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_uint64s_adjust__parameter_checking(void **state) { +void test__f_type_array_uint64s_adjust__works(void **state) { const int length = 5; f_uint64s_t data = f_uint64s_t_initialize; { - const f_status_t status = f_uint64s_adjust(length, 0); + const f_status_t status = f_uint64s_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_adjust.h index 90f6b3454..1a262845a 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_adjust.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_adjust.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint64s_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint64s_adjust() + * @see f_uint64s_adjust() */ -extern void test__f_type_array_uint64s_adjust__works(void **state); +extern void test__f_type_array_uint64s_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint64s_adjust() + * @see f_uint64s_adjust() */ -extern void test__f_type_array_uint64s_adjust__parameter_checking(void **state); +extern void test__f_type_array_uint64s_adjust__works(void **state); #endif // _TEST__F_type_array__uint64s_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_append.c index 243e2307e..a4490fbd9 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_append.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_append.c @@ -5,6 +5,17 @@ extern "C" { #endif +void test__f_type_array_uint64s_append__parameter_checking(void **state) { + + const uint64_t data = 0; + + { + const f_status_t status = f_uint64s_append(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + void test__f_type_array_uint64s_append__works(void **state) { const uint64_t source = 3; @@ -21,17 +32,6 @@ void test__f_type_array_uint64s_append__works(void **state) { free((void *) destination.array); } -void test__f_type_array_uint64s_append__parameter_checking(void **state) { - - const uint64_t data = 0; - - { - const f_status_t status = f_uint64s_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_append.h index 2cc3a26b9..d91285459 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_append.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_append.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint64s_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint64s_append() + * @see f_uint64s_append() */ -extern void test__f_type_array_uint64s_append__works(void **state); +extern void test__f_type_array_uint64s_append__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint64s_append() + * @see f_uint64s_append() */ -extern void test__f_type_array_uint64s_append__parameter_checking(void **state); +extern void test__f_type_array_uint64s_append__works(void **state); #endif // _TEST__F_type_array__uint64s_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_append_all.c index 7b8902c71..33db407d3 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_append_all.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_append_all.c @@ -5,10 +5,20 @@ extern "C" { #endif -void test__f_type_array_uint64s_append_all__works(void **state) { +void test__f_type_array_uint64s_append_all__parameter_checking(void **state) { + + const f_uint64s_t data = f_uint64s_t_initialize; + + { + const f_status_t status = f_uint64s_append_all(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +void test__f_type_array_uint64s_append_all__returns_data_not(void **state) { const int length = 5; - const int length_used = 2; f_uint64s_t source = f_uint64s_t_initialize; f_uint64s_t destination = f_uint64s_t_initialize; @@ -20,29 +30,22 @@ void test__f_type_array_uint64s_append_all__works(void **state) { assert_int_equal(source.size, length); } - for (; source.used < length_used; ++source.used) { - source.array[source.used] = source.used + 1; - } // for - { const f_status_t status = f_uint64s_append_all(source, &destination); - assert_int_equal(status, F_none); - assert_int_equal(destination.used, source.used); - assert_int_equal(destination.size, source.used); - - for (f_array_length_t i = 0; i < source.used; ++i) { - assert_int_equal(destination.array[i], i + 1); - } // for + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + assert_null(destination.array); } free((void *) source.array); - free((void *) destination.array); } -void test__f_type_array_uint64s_append_all__returns_data_not(void **state) { +void test__f_type_array_uint64s_append_all__works(void **state) { const int length = 5; + const int length_used = 2; f_uint64s_t source = f_uint64s_t_initialize; f_uint64s_t destination = f_uint64s_t_initialize; @@ -54,27 +57,24 @@ void test__f_type_array_uint64s_append_all__returns_data_not(void **state) { assert_int_equal(source.size, length); } + for (; source.used < length_used; ++source.used) { + source.array[source.used] = source.used + 1; + } // for + { const f_status_t status = f_uint64s_append_all(source, &destination); - assert_int_equal(status, F_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); + assert_int_equal(status, F_none); + assert_int_equal(destination.used, source.used); + assert_int_equal(destination.size, source.used); + + for (f_array_length_t i = 0; i < source.used; ++i) { + assert_int_equal(destination.array[i], i + 1); + } // for } free((void *) source.array); -} - -void test__f_type_array_uint64s_append_all__parameter_checking(void **state) { - - const f_uint64s_t data = f_uint64s_t_initialize; - - { - const f_status_t status = f_uint64s_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } + free((void *) destination.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_append_all.h index 0a43b5109..677529d35 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_append_all.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_append_all.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__uint64s_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint64s_append_all() + * @see f_uint64s_append_all() */ -extern void test__f_type_array_uint64s_append_all__works(void **state); +extern void test__f_type_array_uint64s_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_uint64s_append_all() + * @see f_uint64s_append_all() */ extern void test__f_type_array_uint64s_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint64s_append_all() + * @see f_uint64s_append_all() */ -extern void test__f_type_array_uint64s_append_all__parameter_checking(void **state); +extern void test__f_type_array_uint64s_append_all__works(void **state); #endif // _TEST__F_type_array__uint64s_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_decimate_by.c index f2e2f7074..03532923a 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_decimate_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_decimate_by.c @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_uint64s_decimate_by__works(void **state) { +void test__f_type_array_uint64s_decimate_by__parameter_checking(void **state) { const int length = 5; f_uint64s_t data = f_uint64s_t_initialize; { - const f_status_t status = f_uint64s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint64s_decimate_by(length, &data); + const f_status_t status = f_uint64s_decimate_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_uint64s_decimate_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_uint64s_decimate_by__parameter_checking(void **state) { +void test__f_type_array_uint64s_decimate_by__works(void **state) { const int length = 5; f_uint64s_t data = f_uint64s_t_initialize; { - const f_status_t status = f_uint64s_decimate_by(length, 0); + const f_status_t status = f_uint64s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_uint64s_decimate_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_decimate_by.h index 46c9b0152..6ab6f114e 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_decimate_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_decimate_by.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint64s_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint64s_decimate_by() + * @see f_uint64s_decimate_by() */ -extern void test__f_type_array_uint64s_decimate_by__works(void **state); +extern void test__f_type_array_uint64s_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint64s_decimate_by() + * @see f_uint64s_decimate_by() */ -extern void test__f_type_array_uint64s_decimate_by__parameter_checking(void **state); +extern void test__f_type_array_uint64s_decimate_by__works(void **state); #endif // _TEST__F_type_array__uint64s_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_decrease_by.c index 09d185811..35d7845d0 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_decrease_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_decrease_by.c @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_uint64s_decrease_by__works(void **state) { +void test__f_type_array_uint64s_decrease_by__parameter_checking(void **state) { const int length = 5; f_uint64s_t data = f_uint64s_t_initialize; { - const f_status_t status = f_uint64s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint64s_decrease_by(length, &data); + const f_status_t status = f_uint64s_decrease_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_uint64s_decrease_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_uint64s_decrease_by__parameter_checking(void **state) { +void test__f_type_array_uint64s_decrease_by__works(void **state) { const int length = 5; f_uint64s_t data = f_uint64s_t_initialize; { - const f_status_t status = f_uint64s_decrease_by(length, 0); + const f_status_t status = f_uint64s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_uint64s_decrease_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_decrease_by.h index 69cdf74b4..c862c30d7 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_decrease_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_decrease_by.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint64s_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint64s_decrease_by() + * @see f_uint64s_decrease_by() */ -extern void test__f_type_array_uint64s_decrease_by__works(void **state); +extern void test__f_type_array_uint64s_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint64s_decrease_by() + * @see f_uint64s_decrease_by() */ -extern void test__f_type_array_uint64s_decrease_by__parameter_checking(void **state); +extern void test__f_type_array_uint64s_decrease_by__works(void **state); #endif // _TEST__F_type_array__uint64s_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_increase.c index 5f4e3d09d..1a48211f7 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_increase.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_increase.c @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_uint64s_increase__works(void **state) { +void test__f_type_array_uint64s_increase__parameter_checking(void **state) { const int length = 5; f_uint64s_t data = f_uint64s_t_initialize; { - const f_status_t status = f_uint64s_resize(length, &data); + const f_status_t status = f_uint64s_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_uint64s_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -55,17 +45,27 @@ void test__f_type_array_uint64s_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_uint64s_increase__parameter_checking(void **state) { +void test__f_type_array_uint64s_increase__works(void **state) { const int length = 5; f_uint64s_t data = f_uint64s_t_initialize; { - const f_status_t status = f_uint64s_increase(length, 0); + const f_status_t status = f_uint64s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_uint64s_increase(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); } free((void *) data.array); diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_increase.h index 76a95f800..633728036 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_increase.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_increase.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__uint64s_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint64s_increase() + * @see f_uint64s_increase() */ -extern void test__f_type_array_uint64s_increase__works(void **state); +extern void test__f_type_array_uint64s_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_uint64s_increase() + * @see f_uint64s_increase() */ extern void test__f_type_array_uint64s_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint64s_increase() + * @see f_uint64s_increase() */ -extern void test__f_type_array_uint64s_increase__parameter_checking(void **state); +extern void test__f_type_array_uint64s_increase__works(void **state); #endif // _TEST__F_type_array__uint64s_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_increase_by.c index 89c33b06f..f3ef9ea1a 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_increase_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_increase_by.c @@ -5,6 +5,22 @@ extern "C" { #endif +void test__f_type_array_uint64s_increase_by__parameter_checking(void **state) { + + const int length = 5; + f_uint64s_t data = f_uint64s_t_initialize; + + { + const f_status_t status = f_uint64s_increase_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + void test__f_type_array_uint64s_increase_by__works(void **state) { const int length = 5; @@ -31,22 +47,6 @@ void test__f_type_array_uint64s_increase_by__works(void **state) { free((void *) data.array); } -void test__f_type_array_uint64s_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_uint64s_t data = f_uint64s_t_initialize; - - { - const f_status_t status = f_uint64s_increase_by(length, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_increase_by.h index e0395215a..60e4e77b0 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_increase_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_increase_by.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint64s_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint64s_increase_by() + * @see f_uint64s_increase_by() */ -extern void test__f_type_array_uint64s_increase_by__works(void **state); +extern void test__f_type_array_uint64s_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint64s_increase_by() + * @see f_uint64s_increase_by() */ -extern void test__f_type_array_uint64s_increase_by__parameter_checking(void **state); +extern void test__f_type_array_uint64s_increase_by__works(void **state); #endif // _TEST__F_type_array__uint64s_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_resize.c index 53e459a6f..ee4873999 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_resize.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_resize.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_uint64s_resize__works(void **state) { +void test__f_type_array_uint64s_resize__parameter_checking(void **state) { const int length = 5; f_uint64s_t data = f_uint64s_t_initialize; { - const f_status_t status = f_uint64s_resize(length, &data); + const f_status_t status = f_uint64s_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_uint64s_resize__parameter_checking(void **state) { +void test__f_type_array_uint64s_resize__works(void **state) { const int length = 5; f_uint64s_t data = f_uint64s_t_initialize; { - const f_status_t status = f_uint64s_resize(length, 0); + const f_status_t status = f_uint64s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_resize.h index f28ff4b88..405b16e5b 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_resize.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64s_resize.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint64s_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint64s_resize() + * @see f_uint64s_resize() */ -extern void test__f_type_array_uint64s_resize__works(void **state); +extern void test__f_type_array_uint64s_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint64s_resize() + * @see f_uint64s_resize() */ -extern void test__f_type_array_uint64s_resize__parameter_checking(void **state); +extern void test__f_type_array_uint64s_resize__works(void **state); #endif // _TEST__F_type_array__uint64s_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_adjust.c index a069aa3a6..162a7b789 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_adjust.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_adjust.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_uint64ss_adjust__works(void **state) { +void test__f_type_array_uint64ss_adjust__parameter_checking(void **state) { const int length = 5; f_uint64ss_t data = f_uint64ss_t_initialize; { - const f_status_t status = f_uint64ss_adjust(length, &data); + const f_status_t status = f_uint64ss_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_uint64ss_adjust__parameter_checking(void **state) { +void test__f_type_array_uint64ss_adjust__works(void **state) { const int length = 5; f_uint64ss_t data = f_uint64ss_t_initialize; { - const f_status_t status = f_uint64ss_adjust(length, 0); + const f_status_t status = f_uint64ss_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_adjust.h index 66269a759..80705b212 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_adjust.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_adjust.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint64ss_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint64ss_adjust() + * @see f_uint64ss_adjust() */ -extern void test__f_type_array_uint64ss_adjust__works(void **state); +extern void test__f_type_array_uint64ss_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint64ss_adjust() + * @see f_uint64ss_adjust() */ -extern void test__f_type_array_uint64ss_adjust__parameter_checking(void **state); +extern void test__f_type_array_uint64ss_adjust__works(void **state); #endif // _TEST__F_type_array__uint64ss_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_append.c index 1e5448435..80a085cc5 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_append.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_append.c @@ -5,7 +5,18 @@ extern "C" { #endif -void test__f_type_array_uint64ss_append__works(void **state) { +void test__f_type_array_uint64ss_append__parameter_checking(void **state) { + + f_uint64s_t data = f_uint64s_t_initialize; + + { + const f_status_t status = f_uint64ss_append(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +void test__f_type_array_uint64ss_append__returns_data_not(void **state) { const int length = 5; f_uint64s_t source = f_uint64s_t_initialize; @@ -19,32 +30,19 @@ void test__f_type_array_uint64ss_append__works(void **state) { assert_int_equal(source.size, length); } - for (; source.used < length; ++source.used) { - source.array[source.used] = source.used + 1; - } // for - { const f_status_t status = f_uint64ss_append(source, &destination); - assert_int_equal(status, F_none); - assert_int_equal(destination.used, 1); - assert_int_equal(destination.array[0].used, source.used); - assert_int_equal(destination.array[0].size, source.used); - - for (f_array_length_t i = 0; i < destination.array[0].used; ++i) { - assert_int_equal(destination.array[0].array[i], i + 1); - } // for + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + assert_null(destination.array); } - for (f_array_length_t i = 0; i < destination.used; ++i) { - free((void *) destination.array[i].array); - } // for - free((void *) source.array); - free((void *) destination.array); } -void test__f_type_array_uint64ss_append__returns_data_not(void **state) { +void test__f_type_array_uint64ss_append__works(void **state) { const int length = 5; f_uint64s_t source = f_uint64s_t_initialize; @@ -58,27 +56,29 @@ void test__f_type_array_uint64ss_append__returns_data_not(void **state) { assert_int_equal(source.size, length); } + for (; source.used < length; ++source.used) { + source.array[source.used] = source.used + 1; + } // for + { const f_status_t status = f_uint64ss_append(source, &destination); - assert_int_equal(status, F_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); - } - - free((void *) source.array); -} - -void test__f_type_array_uint64ss_append__parameter_checking(void **state) { + assert_int_equal(status, F_none); + assert_int_equal(destination.used, 1); + assert_int_equal(destination.array[0].used, source.used); + assert_int_equal(destination.array[0].size, source.used); - f_uint64s_t data = f_uint64s_t_initialize; + for (f_array_length_t i = 0; i < destination.array[0].used; ++i) { + assert_int_equal(destination.array[0].array[i], i + 1); + } // for + } - { - const f_status_t status = f_uint64ss_append(data, 0); + for (f_array_length_t i = 0; i < destination.used; ++i) { + free((void *) destination.array[i].array); + } // for - assert_int_equal(status, F_status_set_error(F_parameter)); - } + free((void *) source.array); + free((void *) destination.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_append.h index 071d13a5d..f10b1cb49 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_append.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_append.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__uint64ss_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint64ss_append() + * @see f_uint64ss_append() */ -extern void test__f_type_array_uint64ss_append__works(void **state); +extern void test__f_type_array_uint64ss_append__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_uint64ss_append() + * @see f_uint64ss_append() */ extern void test__f_type_array_uint64ss_append__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint64ss_append() + * @see f_uint64ss_append() */ -extern void test__f_type_array_uint64ss_append__parameter_checking(void **state); +extern void test__f_type_array_uint64ss_append__works(void **state); #endif // _TEST__F_type_array__uint64ss_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_append_all.c index 80edb1f43..242c8e50d 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_append_all.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_append_all.c @@ -5,6 +5,43 @@ extern "C" { #endif +void test__f_type_array_uint64ss_append_all__parameter_checking(void **state) { + + const f_uint64ss_t data = f_uint64ss_t_initialize; + + { + const f_status_t status = f_uint64ss_append_all(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +void test__f_type_array_uint64ss_append_all__returns_data_not(void **state) { + + const int length = 5; + f_uint64ss_t source = f_uint64ss_t_initialize; + f_uint64ss_t destination = f_uint64ss_t_initialize; + + { + const f_status_t status = f_uint64ss_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + { + const f_status_t status = f_uint64ss_append_all(source, &destination); + + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + assert_null(destination.array); + } + + free((void *) source.array); +} + void test__f_type_array_uint64ss_append_all__works(void **state) { const int length = 5; @@ -63,43 +100,6 @@ void test__f_type_array_uint64ss_append_all__works(void **state) { free((void *) destination.array); } -void test__f_type_array_uint64ss_append_all__returns_data_not(void **state) { - - const int length = 5; - f_uint64ss_t source = f_uint64ss_t_initialize; - f_uint64ss_t destination = f_uint64ss_t_initialize; - - { - const f_status_t status = f_uint64ss_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_uint64ss_append_all(source, &destination); - - assert_int_equal(status, F_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); - } - - free((void *) source.array); -} - -void test__f_type_array_uint64ss_append_all__parameter_checking(void **state) { - - const f_uint64ss_t data = f_uint64ss_t_initialize; - - { - const f_status_t status = f_uint64ss_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_append_all.h index 0bc11ed34..9ea4309f0 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_append_all.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_append_all.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__uint64ss_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint64ss_append_all() + * @see f_uint64ss_append_all() */ -extern void test__f_type_array_uint64ss_append_all__works(void **state); +extern void test__f_type_array_uint64ss_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_uint64ss_append_all() + * @see f_uint64ss_append_all() */ extern void test__f_type_array_uint64ss_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint64ss_append_all() + * @see f_uint64ss_append_all() */ -extern void test__f_type_array_uint64ss_append_all__parameter_checking(void **state); +extern void test__f_type_array_uint64ss_append_all__works(void **state); #endif // _TEST__F_type_array__uint64ss_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_decimate_by.c index 53edea25d..889e2b9c4 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_decimate_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_decimate_by.c @@ -5,11 +5,27 @@ extern "C" { #endif -void test__f_type_array_uint64ss_decimate_by__works(void **state) { +void test__f_type_array_uint64ss_decimate_by__parameter_checking(void **state) { const int length = 5; f_uint64ss_t data = f_uint64s_t_initialize; + { + const f_status_t status = f_uint64ss_decimate_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_uint64ss_decimate_by__returns_data_not(void **state) { + + const int length = 5; + f_uint64ss_t data = f_uint64ss_t_initialize; + { const f_status_t status = f_uint64ss_resize(length, &data); @@ -19,25 +35,33 @@ void test__f_type_array_uint64ss_decimate_by__works(void **state) { } { - const f_status_t status = f_uint64ss_decimate_by(length, &data); + const f_status_t status = f_uint64ss_decimate_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_uint64ss_decimate_by__parameter_checking(void **state) { +void test__f_type_array_uint64ss_decimate_by__works(void **state) { const int length = 5; f_uint64ss_t data = f_uint64s_t_initialize; { - const f_status_t status = f_uint64ss_decimate_by(length, 0); + const f_status_t status = f_uint64ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_uint64ss_decimate_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_decimate_by.h index 97a969e27..1be9c0c89 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_decimate_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_decimate_by.h @@ -11,17 +11,24 @@ #define _TEST__F_type_array__uint64ss_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint64ss_decimate_by() + * @see f_uint64ss_decimate_by() */ -extern void test__f_type_array_uint64ss_decimate_by__works(void **state); +extern void test__f_type_array_uint64ss_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * * @see f_type_array_uint64ss_decimate_by() */ -extern void test__f_type_array_uint64ss_decimate_by__parameter_checking(void **state); +extern void test__f_type_array_uint64ss_decimate_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_uint64ss_decimate_by() + */ +extern void test__f_type_array_uint64ss_decimate_by__works(void **state); #endif // _TEST__F_type_array__uint64ss_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_decrease_by.c index a5d8132cf..0240f3d40 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_decrease_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_decrease_by.c @@ -5,11 +5,27 @@ extern "C" { #endif -void test__f_type_array_uint64ss_decrease_by__works(void **state) { +void test__f_type_array_uint64ss_decrease_by__parameter_checking(void **state) { const int length = 5; f_uint64ss_t data = f_uint64s_t_initialize; + { + const f_status_t status = f_uint64ss_decrease_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_uint64ss_decrease_by__returns_data_not(void **state) { + + const int length = 5; + f_uint64ss_t data = f_uint64ss_t_initialize; + { const f_status_t status = f_uint64ss_resize(length, &data); @@ -19,25 +35,33 @@ void test__f_type_array_uint64ss_decrease_by__works(void **state) { } { - const f_status_t status = f_uint64ss_decrease_by(length, &data); + const f_status_t status = f_uint64ss_decrease_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_uint64ss_decrease_by__parameter_checking(void **state) { +void test__f_type_array_uint64ss_decrease_by__works(void **state) { const int length = 5; f_uint64ss_t data = f_uint64s_t_initialize; { - const f_status_t status = f_uint64ss_decrease_by(length, 0); + const f_status_t status = f_uint64ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_uint64ss_decrease_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_decrease_by.h index 9927a9438..83a317025 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_decrease_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_decrease_by.h @@ -11,17 +11,24 @@ #define _TEST__F_type_array__uint64ss_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint64ss_decrease_by() + * @see f_uint64ss_decrease_by() */ -extern void test__f_type_array_uint64ss_decrease_by__works(void **state); +extern void test__f_type_array_uint64ss_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_uint64ss_decrease_by() + * @see f_uint64ss_decrease_by() */ -extern void test__f_type_array_uint64ss_decrease_by__parameter_checking(void **state); +extern void test__f_type_array_uint64ss_decrease_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_uint64ss_decrease_by() + */ +extern void test__f_type_array_uint64ss_decrease_by__works(void **state); #endif // _TEST__F_type_array__uint64ss_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_increase.c index 8338db8f4..622dd6775 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_increase.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_increase.c @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_uint64ss_increase__works(void **state) { +void test__f_type_array_uint64ss_increase__parameter_checking(void **state) { const int length = 5; f_uint64ss_t data = f_uint64s_t_initialize; { - const f_status_t status = f_uint64ss_resize(length, &data); + const f_status_t status = f_uint64ss_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_uint64ss_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -55,17 +45,27 @@ void test__f_type_array_uint64ss_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_uint64ss_increase__parameter_checking(void **state) { +void test__f_type_array_uint64ss_increase__works(void **state) { const int length = 5; f_uint64ss_t data = f_uint64s_t_initialize; { - const f_status_t status = f_uint64ss_increase(length, 0); + const f_status_t status = f_uint64ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_uint64ss_increase(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); } free((void *) data.array); diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_increase.h index ad9671be5..35f50ebb1 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_increase.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_increase.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__uint64ss_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint64ss_increase() + * @see f_uint64ss_increase() */ -extern void test__f_type_array_uint64ss_increase__works(void **state); +extern void test__f_type_array_uint64ss_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_uint64ss_increase() + * @see f_uint64ss_increase() */ extern void test__f_type_array_uint64ss_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint64ss_increase() + * @see f_uint64ss_increase() */ -extern void test__f_type_array_uint64ss_increase__parameter_checking(void **state); +extern void test__f_type_array_uint64ss_increase__works(void **state); #endif // _TEST__F_type_array__uint64ss_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_increase_by.c index ae5192f7a..d6e0bc5ab 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_increase_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_increase_by.c @@ -5,11 +5,27 @@ extern "C" { #endif -void test__f_type_array_uint64ss_increase_by__works(void **state) { +void test__f_type_array_uint64ss_increase_by__parameter_checking(void **state) { const int length = 5; f_uint64ss_t data = f_uint64s_t_initialize; + { + const f_status_t status = f_uint64ss_increase_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_uint64ss_increase_by__returns_data_not(void **state) { + + const int length = 5; + f_uint64ss_t data = f_uint64ss_t_initialize; + { const f_status_t status = f_uint64ss_resize(length, &data); @@ -19,32 +35,48 @@ void test__f_type_array_uint64ss_increase_by__works(void **state) { } { - data.used = length; + const f_status_t status = f_uint64ss_increase_by(0, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + { const f_status_t status = f_uint64ss_increase_by(length, &data); - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); } free((void *) data.array); } -void test__f_type_array_uint64ss_increase_by__parameter_checking(void **state) { +void test__f_type_array_uint64ss_increase_by__works(void **state) { const int length = 5; f_uint64ss_t data = f_uint64s_t_initialize; { - const f_status_t status = f_uint64ss_increase_by(length, 0); + const f_status_t status = f_uint64ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + { + data.used = length; + + const f_status_t status = f_uint64ss_increase_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_increase_by.h index 317326897..6c275a31f 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_increase_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_increase_by.h @@ -11,17 +11,24 @@ #define _TEST__F_type_array__uint64ss_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint64ss_increase_by() + * @see f_uint64ss_increase_by() */ -extern void test__f_type_array_uint64ss_increase_by__works(void **state); +extern void test__f_type_array_uint64ss_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_uint64ss_increase_by() + * @see f_uint64ss_increase_by() */ -extern void test__f_type_array_uint64ss_increase_by__parameter_checking(void **state); +extern void test__f_type_array_uint64ss_increase_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_uint64ss_increase_by() + */ +extern void test__f_type_array_uint64ss_increase_by__works(void **state); #endif // _TEST__F_type_array__uint64ss_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_resize.c index c471785b2..f08eb18bf 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_resize.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_resize.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_uint64ss_resize__works(void **state) { +void test__f_type_array_uint64ss_resize__parameter_checking(void **state) { const int length = 5; f_uint64ss_t data = f_uint64ss_t_initialize; { - const f_status_t status = f_uint64ss_resize(length, &data); + const f_status_t status = f_uint64ss_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_uint64ss_resize__parameter_checking(void **state) { +void test__f_type_array_uint64ss_resize__works(void **state) { const int length = 5; f_uint64ss_t data = f_uint64ss_t_initialize; { - const f_status_t status = f_uint64ss_resize(length, 0); + const f_status_t status = f_uint64ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_resize.h index acd18bc4a..9d67a216a 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_resize.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint64ss_resize.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint64ss_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint64ss_resize() + * @see f_uint64ss_resize() */ -extern void test__f_type_array_uint64ss_resize__works(void **state); +extern void test__f_type_array_uint64ss_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint64ss_resize() + * @see f_uint64ss_resize() */ -extern void test__f_type_array_uint64ss_resize__parameter_checking(void **state); +extern void test__f_type_array_uint64ss_resize__works(void **state); #endif // _TEST__F_type_array__uint64ss_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_adjust.c index 33440e2e6..3817a51ea 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_adjust.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_adjust.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_uint8s_adjust__works(void **state) { +void test__f_type_array_uint8s_adjust__parameter_checking(void **state) { const int length = 5; f_uint8s_t data = f_uint8s_t_initialize; { - const f_status_t status = f_uint8s_adjust(length, &data); + const f_status_t status = f_uint8s_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_uint8s_adjust__parameter_checking(void **state) { +void test__f_type_array_uint8s_adjust__works(void **state) { const int length = 5; f_uint8s_t data = f_uint8s_t_initialize; { - const f_status_t status = f_uint8s_adjust(length, 0); + const f_status_t status = f_uint8s_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_adjust.h index d5afab2d6..bcdfa7616 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_adjust.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_adjust.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint8s_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint8s_adjust() + * @see f_uint8s_adjust() */ -extern void test__f_type_array_uint8s_adjust__works(void **state); +extern void test__f_type_array_uint8s_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint8s_adjust() + * @see f_uint8s_adjust() */ -extern void test__f_type_array_uint8s_adjust__parameter_checking(void **state); +extern void test__f_type_array_uint8s_adjust__works(void **state); #endif // _TEST__F_type_array__uint8s_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_append.c index d039c4784..caca1cc61 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_append.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_append.c @@ -5,6 +5,17 @@ extern "C" { #endif +void test__f_type_array_uint8s_append__parameter_checking(void **state) { + + const uint8_t data = 0; + + { + const f_status_t status = f_uint8s_append(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + void test__f_type_array_uint8s_append__works(void **state) { const uint8_t source = 3; @@ -21,17 +32,6 @@ void test__f_type_array_uint8s_append__works(void **state) { free((void *) destination.array); } -void test__f_type_array_uint8s_append__parameter_checking(void **state) { - - const uint8_t data = 0; - - { - const f_status_t status = f_uint8s_append(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_append.h index 02968f7b7..5a933e390 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_append.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_append.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint8s_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint8s_append() + * @see f_uint8s_append() */ -extern void test__f_type_array_uint8s_append__works(void **state); +extern void test__f_type_array_uint8s_append__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint8s_append() + * @see f_uint8s_append() */ -extern void test__f_type_array_uint8s_append__parameter_checking(void **state); +extern void test__f_type_array_uint8s_append__works(void **state); #endif // _TEST__F_type_array__uint8s_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_append_all.c index a94ae535d..292200815 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_append_all.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_append_all.c @@ -5,10 +5,20 @@ extern "C" { #endif -void test__f_type_array_uint8s_append_all__works(void **state) { +void test__f_type_array_uint8s_append_all__parameter_checking(void **state) { + + const f_uint8s_t data = f_uint8s_t_initialize; + + { + const f_status_t status = f_uint8s_append_all(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +void test__f_type_array_uint8s_append_all__returns_data_not(void **state) { const int length = 5; - const int length_used = 2; f_uint8s_t source = f_uint8s_t_initialize; f_uint8s_t destination = f_uint8s_t_initialize; @@ -20,29 +30,22 @@ void test__f_type_array_uint8s_append_all__works(void **state) { assert_int_equal(source.size, length); } - for (; source.used < length_used; ++source.used) { - source.array[source.used] = source.used + 1; - } // for - { const f_status_t status = f_uint8s_append_all(source, &destination); - assert_int_equal(status, F_none); - assert_int_equal(destination.used, source.used); - assert_int_equal(destination.size, source.used); - - for (f_array_length_t i = 0; i < source.used; ++i) { - assert_int_equal(destination.array[i], i + 1); - } // for + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + assert_null(destination.array); } free((void *) source.array); - free((void *) destination.array); } -void test__f_type_array_uint8s_append_all__returns_data_not(void **state) { +void test__f_type_array_uint8s_append_all__works(void **state) { const int length = 5; + const int length_used = 2; f_uint8s_t source = f_uint8s_t_initialize; f_uint8s_t destination = f_uint8s_t_initialize; @@ -54,27 +57,24 @@ void test__f_type_array_uint8s_append_all__returns_data_not(void **state) { assert_int_equal(source.size, length); } + for (; source.used < length_used; ++source.used) { + source.array[source.used] = source.used + 1; + } // for + { const f_status_t status = f_uint8s_append_all(source, &destination); - assert_int_equal(status, F_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); + assert_int_equal(status, F_none); + assert_int_equal(destination.used, source.used); + assert_int_equal(destination.size, source.used); + + for (f_array_length_t i = 0; i < source.used; ++i) { + assert_int_equal(destination.array[i], i + 1); + } // for } free((void *) source.array); -} - -void test__f_type_array_uint8s_append_all__parameter_checking(void **state) { - - const f_uint8s_t data = f_uint8s_t_initialize; - - { - const f_status_t status = f_uint8s_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } + free((void *) destination.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_append_all.h index 039bf1f61..88654ec8f 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_append_all.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_append_all.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__uint8s_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint8s_append_all() + * @see f_uint8s_append_all() */ -extern void test__f_type_array_uint8s_append_all__works(void **state); +extern void test__f_type_array_uint8s_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_uint8s_append_all() + * @see f_uint8s_append_all() */ extern void test__f_type_array_uint8s_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint8s_append_all() + * @see f_uint8s_append_all() */ -extern void test__f_type_array_uint8s_append_all__parameter_checking(void **state); +extern void test__f_type_array_uint8s_append_all__works(void **state); #endif // _TEST__F_type_array__uint8s_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_decimate_by.c index 40ceac019..2d3a21a9c 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_decimate_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_decimate_by.c @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_uint8s_decimate_by__works(void **state) { +void test__f_type_array_uint8s_decimate_by__parameter_checking(void **state) { const int length = 5; f_uint8s_t data = f_uint8s_t_initialize; { - const f_status_t status = f_uint8s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint8s_decimate_by(length, &data); + const f_status_t status = f_uint8s_decimate_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_uint8s_decimate_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_uint8s_decimate_by__parameter_checking(void **state) { +void test__f_type_array_uint8s_decimate_by__works(void **state) { const int length = 5; f_uint8s_t data = f_uint8s_t_initialize; { - const f_status_t status = f_uint8s_decimate_by(length, 0); + const f_status_t status = f_uint8s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_uint8s_decimate_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_decimate_by.h index fe4247b6d..709cec41a 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_decimate_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_decimate_by.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint8s_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint8s_decimate_by() + * @see f_uint8s_decimate_by() */ -extern void test__f_type_array_uint8s_decimate_by__works(void **state); +extern void test__f_type_array_uint8s_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint8s_decimate_by() + * @see f_uint8s_decimate_by() */ -extern void test__f_type_array_uint8s_decimate_by__parameter_checking(void **state); +extern void test__f_type_array_uint8s_decimate_by__works(void **state); #endif // _TEST__F_type_array__uint8s_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_decrease_by.c index a2baa1bf7..7b12e5958 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_decrease_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_decrease_by.c @@ -5,23 +5,15 @@ extern "C" { #endif -void test__f_type_array_uint8s_decrease_by__works(void **state) { +void test__f_type_array_uint8s_decrease_by__parameter_checking(void **state) { const int length = 5; f_uint8s_t data = f_uint8s_t_initialize; { - const f_status_t status = f_uint8s_resize(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - const f_status_t status = f_uint8s_decrease_by(length, &data); + const f_status_t status = f_uint8s_decrease_by(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } @@ -29,15 +21,23 @@ void test__f_type_array_uint8s_decrease_by__works(void **state) { assert_null(data.array); } -void test__f_type_array_uint8s_decrease_by__parameter_checking(void **state) { +void test__f_type_array_uint8s_decrease_by__works(void **state) { const int length = 5; f_uint8s_t data = f_uint8s_t_initialize; { - const f_status_t status = f_uint8s_decrease_by(length, 0); + const f_status_t status = f_uint8s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_uint8s_decrease_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_decrease_by.h index 6157173ce..c73f24e57 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_decrease_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_decrease_by.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint8s_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint8s_decrease_by() + * @see f_uint8s_decrease_by() */ -extern void test__f_type_array_uint8s_decrease_by__works(void **state); +extern void test__f_type_array_uint8s_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint8s_decrease_by() + * @see f_uint8s_decrease_by() */ -extern void test__f_type_array_uint8s_decrease_by__parameter_checking(void **state); +extern void test__f_type_array_uint8s_decrease_by__works(void **state); #endif // _TEST__F_type_array__uint8s_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_increase.c index 690bbaf4d..b5b8ccb13 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_increase.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_increase.c @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_uint8s_increase__works(void **state) { +void test__f_type_array_uint8s_increase__parameter_checking(void **state) { const int length = 5; f_uint8s_t data = f_uint8s_t_initialize; { - const f_status_t status = f_uint8s_resize(length, &data); + const f_status_t status = f_uint8s_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_uint8s_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -55,17 +45,27 @@ void test__f_type_array_uint8s_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_uint8s_increase__parameter_checking(void **state) { +void test__f_type_array_uint8s_increase__works(void **state) { const int length = 5; f_uint8s_t data = f_uint8s_t_initialize; { - const f_status_t status = f_uint8s_increase(length, 0); + const f_status_t status = f_uint8s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_uint8s_increase(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); } free((void *) data.array); diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_increase.h index 77be55444..99ff20b75 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_increase.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_increase.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__uint8s_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint8s_increase() + * @see f_uint8s_increase() */ -extern void test__f_type_array_uint8s_increase__works(void **state); +extern void test__f_type_array_uint8s_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_uint8s_increase() + * @see f_uint8s_increase() */ extern void test__f_type_array_uint8s_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint8s_increase() + * @see f_uint8s_increase() */ -extern void test__f_type_array_uint8s_increase__parameter_checking(void **state); +extern void test__f_type_array_uint8s_increase__works(void **state); #endif // _TEST__F_type_array__uint8s_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_increase_by.c index f507bd1e8..98a32b2a4 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_increase_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_increase_by.c @@ -5,6 +5,22 @@ extern "C" { #endif + +void test__f_type_array_uint8s_increase_by__parameter_checking(void **state) { + + const int length = 5; + f_uint8s_t data = f_uint8s_t_initialize; + + { + const f_status_t status = f_uint8s_increase_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} void test__f_type_array_uint8s_increase_by__works(void **state) { const int length = 5; @@ -31,22 +47,6 @@ void test__f_type_array_uint8s_increase_by__works(void **state) { free((void *) data.array); } -void test__f_type_array_uint8s_increase_by__parameter_checking(void **state) { - - const int length = 5; - f_uint8s_t data = f_uint8s_t_initialize; - - { - const f_status_t status = f_uint8s_increase_by(length, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); - } - - assert_null(data.array); -} - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_increase_by.h index 7c8206f8c..7ac98ebe6 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_increase_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_increase_by.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint8s_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint8s_increase_by() + * @see f_uint8s_increase_by() */ -extern void test__f_type_array_uint8s_increase_by__works(void **state); +extern void test__f_type_array_uint8s_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint8s_increase_by() + * @see f_uint8s_increase_by() */ -extern void test__f_type_array_uint8s_increase_by__parameter_checking(void **state); +extern void test__f_type_array_uint8s_increase_by__works(void **state); #endif // _TEST__F_type_array__uint8s_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_resize.c index 83b457a69..5c2d172a8 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_resize.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_resize.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_uint8s_resize__works(void **state) { +void test__f_type_array_uint8s_resize__parameter_checking(void **state) { const int length = 5; f_uint8s_t data = f_uint8s_t_initialize; { - const f_status_t status = f_uint8s_resize(length, &data); + const f_status_t status = f_uint8s_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_uint8s_resize__parameter_checking(void **state) { +void test__f_type_array_uint8s_resize__works(void **state) { const int length = 5; f_uint8s_t data = f_uint8s_t_initialize; { - const f_status_t status = f_uint8s_resize(length, 0); + const f_status_t status = f_uint8s_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_resize.h index 8f258e3d3..53997a650 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_resize.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8s_resize.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint8s_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint8s_resize() + * @see f_uint8s_resize() */ -extern void test__f_type_array_uint8s_resize__works(void **state); +extern void test__f_type_array_uint8s_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint8s_resize() + * @see f_uint8s_resize() */ -extern void test__f_type_array_uint8s_resize__parameter_checking(void **state); +extern void test__f_type_array_uint8s_resize__works(void **state); #endif // _TEST__F_type_array__uint8s_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_adjust.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_adjust.c index ec3eed98f..45ace00cd 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_adjust.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_adjust.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_uint8ss_adjust__works(void **state) { +void test__f_type_array_uint8ss_adjust__parameter_checking(void **state) { const int length = 5; f_uint8ss_t data = f_uint8ss_t_initialize; { - const f_status_t status = f_uint8ss_adjust(length, &data); + const f_status_t status = f_uint8ss_adjust(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_uint8ss_adjust__parameter_checking(void **state) { +void test__f_type_array_uint8ss_adjust__works(void **state) { const int length = 5; f_uint8ss_t data = f_uint8ss_t_initialize; { - const f_status_t status = f_uint8ss_adjust(length, 0); + const f_status_t status = f_uint8ss_adjust(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_adjust.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_adjust.h index b6d8dfb32..7fc1ba850 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_adjust.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_adjust.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint8ss_adjust /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint8ss_adjust() + * @see f_uint8ss_adjust() */ -extern void test__f_type_array_uint8ss_adjust__works(void **state); +extern void test__f_type_array_uint8ss_adjust__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint8ss_adjust() + * @see f_uint8ss_adjust() */ -extern void test__f_type_array_uint8ss_adjust__parameter_checking(void **state); +extern void test__f_type_array_uint8ss_adjust__works(void **state); #endif // _TEST__F_type_array__uint8ss_adjust diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_append.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_append.c index 650d761a5..1db489ab3 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_append.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_append.c @@ -5,7 +5,18 @@ extern "C" { #endif -void test__f_type_array_uint8ss_append__works(void **state) { +void test__f_type_array_uint8ss_append__parameter_checking(void **state) { + + f_uint8s_t data = f_uint8s_t_initialize; + + { + const f_status_t status = f_uint8ss_append(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +void test__f_type_array_uint8ss_append__returns_data_not(void **state) { const int length = 5; f_uint8s_t source = f_uint8s_t_initialize; @@ -19,32 +30,19 @@ void test__f_type_array_uint8ss_append__works(void **state) { assert_int_equal(source.size, length); } - for (; source.used < length; ++source.used) { - source.array[source.used] = source.used + 1; - } // for - { const f_status_t status = f_uint8ss_append(source, &destination); - assert_int_equal(status, F_none); - assert_int_equal(destination.used, 1); - assert_int_equal(destination.array[0].used, source.used); - assert_int_equal(destination.array[0].size, source.used); - - for (f_array_length_t i = 0; i < destination.array[0].used; ++i) { - assert_int_equal(destination.array[0].array[i], i + 1); - } // for + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + assert_null(destination.array); } - for (f_array_length_t i = 0; i < destination.used; ++i) { - free((void *) destination.array[i].array); - } // for - free((void *) source.array); - free((void *) destination.array); } -void test__f_type_array_uint8ss_append__returns_data_not(void **state) { +void test__f_type_array_uint8ss_append__works(void **state) { const int length = 5; f_uint8s_t source = f_uint8s_t_initialize; @@ -58,27 +56,29 @@ void test__f_type_array_uint8ss_append__returns_data_not(void **state) { assert_int_equal(source.size, length); } + for (; source.used < length; ++source.used) { + source.array[source.used] = source.used + 1; + } // for + { const f_status_t status = f_uint8ss_append(source, &destination); - assert_int_equal(status, F_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); - } - - free((void *) source.array); -} - -void test__f_type_array_uint8ss_append__parameter_checking(void **state) { + assert_int_equal(status, F_none); + assert_int_equal(destination.used, 1); + assert_int_equal(destination.array[0].used, source.used); + assert_int_equal(destination.array[0].size, source.used); - f_uint8s_t data = f_uint8s_t_initialize; + for (f_array_length_t i = 0; i < destination.array[0].used; ++i) { + assert_int_equal(destination.array[0].array[i], i + 1); + } // for + } - { - const f_status_t status = f_uint8ss_append(data, 0); + for (f_array_length_t i = 0; i < destination.used; ++i) { + free((void *) destination.array[i].array); + } // for - assert_int_equal(status, F_status_set_error(F_parameter)); - } + free((void *) source.array); + free((void *) destination.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_append.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_append.h index c7f66334f..0514099e3 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_append.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_append.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__uint8ss_append /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint8ss_append() + * @see f_uint8ss_append() */ -extern void test__f_type_array_uint8ss_append__works(void **state); +extern void test__f_type_array_uint8ss_append__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_uint8ss_append() + * @see f_uint8ss_append() */ extern void test__f_type_array_uint8ss_append__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint8ss_append() + * @see f_uint8ss_append() */ -extern void test__f_type_array_uint8ss_append__parameter_checking(void **state); +extern void test__f_type_array_uint8ss_append__works(void **state); #endif // _TEST__F_type_array__uint8ss_append diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_append_all.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_append_all.c index 5a4d14df3..ba7020193 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_append_all.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_append_all.c @@ -5,6 +5,43 @@ extern "C" { #endif +void test__f_type_array_uint8ss_append_all__parameter_checking(void **state) { + + const f_uint8ss_t data = f_uint8ss_t_initialize; + + { + const f_status_t status = f_uint8ss_append_all(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +void test__f_type_array_uint8ss_append_all__returns_data_not(void **state) { + + const int length = 5; + f_uint8ss_t source = f_uint8ss_t_initialize; + f_uint8ss_t destination = f_uint8ss_t_initialize; + + { + const f_status_t status = f_uint8ss_resize(length, &source); + + assert_int_equal(status, F_none); + assert_int_equal(source.used, 0); + assert_int_equal(source.size, length); + } + + { + const f_status_t status = f_uint8ss_append_all(source, &destination); + + assert_int_equal(status, F_data_not); + assert_int_equal(destination.used, 0); + assert_int_equal(destination.size, 0); + assert_null(destination.array); + } + + free((void *) source.array); +} + void test__f_type_array_uint8ss_append_all__works(void **state) { const int length = 5; @@ -63,43 +100,6 @@ void test__f_type_array_uint8ss_append_all__works(void **state) { free((void *) destination.array); } -void test__f_type_array_uint8ss_append_all__returns_data_not(void **state) { - - const int length = 5; - f_uint8ss_t source = f_uint8ss_t_initialize; - f_uint8ss_t destination = f_uint8ss_t_initialize; - - { - const f_status_t status = f_uint8ss_resize(length, &source); - - assert_int_equal(status, F_none); - assert_int_equal(source.used, 0); - assert_int_equal(source.size, length); - } - - { - const f_status_t status = f_uint8ss_append_all(source, &destination); - - assert_int_equal(status, F_data_not); - assert_int_equal(destination.used, 0); - assert_int_equal(destination.size, 0); - assert_null(destination.array); - } - - free((void *) source.array); -} - -void test__f_type_array_uint8ss_append_all__parameter_checking(void **state) { - - const f_uint8ss_t data = f_uint8ss_t_initialize; - - { - const f_status_t status = f_uint8ss_append_all(data, 0); - - assert_int_equal(status, F_status_set_error(F_parameter)); - } -} - #ifdef __cplusplus } // extern "C" #endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_append_all.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_append_all.h index 8ec2cb0c1..f22a9693b 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_append_all.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_append_all.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__uint8ss_append_all /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint8ss_append_all() + * @see f_uint8ss_append_all() */ -extern void test__f_type_array_uint8ss_append_all__works(void **state); +extern void test__f_type_array_uint8ss_append_all__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_uint8ss_append_all() + * @see f_uint8ss_append_all() */ extern void test__f_type_array_uint8ss_append_all__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint8ss_append_all() + * @see f_uint8ss_append_all() */ -extern void test__f_type_array_uint8ss_append_all__parameter_checking(void **state); +extern void test__f_type_array_uint8ss_append_all__works(void **state); #endif // _TEST__F_type_array__uint8ss_append_all diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_decimate_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_decimate_by.c index b9cca5db9..271c78099 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_decimate_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_decimate_by.c @@ -5,11 +5,27 @@ extern "C" { #endif -void test__f_type_array_uint8ss_decimate_by__works(void **state) { +void test__f_type_array_uint8ss_decimate_by__parameter_checking(void **state) { const int length = 5; f_uint8ss_t data = f_uint8s_t_initialize; + { + const f_status_t status = f_uint8ss_decimate_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_uint8ss_decimate_by__returns_data_not(void **state) { + + const int length = 5; + f_uint8ss_t data = f_uint8ss_t_initialize; + { const f_status_t status = f_uint8ss_resize(length, &data); @@ -19,25 +35,33 @@ void test__f_type_array_uint8ss_decimate_by__works(void **state) { } { - const f_status_t status = f_uint8ss_decimate_by(length, &data); + const f_status_t status = f_uint8ss_decimate_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_uint8ss_decimate_by__parameter_checking(void **state) { +void test__f_type_array_uint8ss_decimate_by__works(void **state) { const int length = 5; f_uint8ss_t data = f_uint8s_t_initialize; { - const f_status_t status = f_uint8ss_decimate_by(length, 0); + const f_status_t status = f_uint8ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_uint8ss_decimate_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_decimate_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_decimate_by.h index f92c29405..524ee0844 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_decimate_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_decimate_by.h @@ -11,17 +11,24 @@ #define _TEST__F_type_array__uint8ss_decimate_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint8ss_decimate_by() + * @see f_uint8ss_decimate_by() */ -extern void test__f_type_array_uint8ss_decimate_by__works(void **state); +extern void test__f_type_array_uint8ss_decimate_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * * @see f_type_array_uint8ss_decimate_by() */ -extern void test__f_type_array_uint8ss_decimate_by__parameter_checking(void **state); +extern void test__f_type_array_uint8ss_decimate_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_uint8ss_decimate_by() + */ +extern void test__f_type_array_uint8ss_decimate_by__works(void **state); #endif // _TEST__F_type_array__uint8ss_decimate_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_decrease_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_decrease_by.c index 61a91cb51..8ec58153b 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_decrease_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_decrease_by.c @@ -5,11 +5,27 @@ extern "C" { #endif -void test__f_type_array_uint8ss_decrease_by__works(void **state) { +void test__f_type_array_uint8ss_decrease_by__parameter_checking(void **state) { const int length = 5; f_uint8ss_t data = f_uint8s_t_initialize; + { + const f_status_t status = f_uint8ss_decrease_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_uint8ss_decrease_by__returns_data_not(void **state) { + + const int length = 5; + f_uint8ss_t data = f_uint8ss_t_initialize; + { const f_status_t status = f_uint8ss_resize(length, &data); @@ -19,25 +35,33 @@ void test__f_type_array_uint8ss_decrease_by__works(void **state) { } { - const f_status_t status = f_uint8ss_decrease_by(length, &data); + const f_status_t status = f_uint8ss_decrease_by(0, &data); - assert_int_equal(status, F_none); + assert_int_equal(status, F_data_not); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } -void test__f_type_array_uint8ss_decrease_by__parameter_checking(void **state) { +void test__f_type_array_uint8ss_decrease_by__works(void **state) { const int length = 5; f_uint8ss_t data = f_uint8s_t_initialize; { - const f_status_t status = f_uint8ss_decrease_by(length, 0); + const f_status_t status = f_uint8ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + const f_status_t status = f_uint8ss_decrease_by(length, &data); + + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); assert_int_equal(data.size, 0); } diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_decrease_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_decrease_by.h index d78af8dc8..6ce469785 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_decrease_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_decrease_by.h @@ -11,17 +11,24 @@ #define _TEST__F_type_array__uint8ss_decrease_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint8ss_decrease_by() + * @see f_uint8ss_decrease_by() */ -extern void test__f_type_array_uint8ss_decrease_by__works(void **state); +extern void test__f_type_array_uint8ss_decrease_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_uint8ss_decrease_by() + * @see f_uint8ss_decrease_by() */ -extern void test__f_type_array_uint8ss_decrease_by__parameter_checking(void **state); +extern void test__f_type_array_uint8ss_decrease_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_uint8ss_decrease_by() + */ +extern void test__f_type_array_uint8ss_decrease_by__works(void **state); #endif // _TEST__F_type_array__uint8ss_decrease_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_increase.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_increase.c index 99f761228..5775dd4c9 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_increase.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_increase.c @@ -5,27 +5,17 @@ extern "C" { #endif -void test__f_type_array_uint8ss_increase__works(void **state) { +void test__f_type_array_uint8ss_increase__parameter_checking(void **state) { const int length = 5; f_uint8ss_t data = f_uint8s_t_initialize; { - const f_status_t status = f_uint8ss_resize(length, &data); + const f_status_t status = f_uint8ss_increase(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); - } - - { - data.used = length; - - const f_status_t status = f_uint8ss_increase(length, &data); - - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); + assert_int_equal(data.size, 0); } free((void *) data.array); @@ -55,17 +45,27 @@ void test__f_type_array_uint8ss_increase__returns_data_not(void **state) { free((void *) data.array); } -void test__f_type_array_uint8ss_increase__parameter_checking(void **state) { +void test__f_type_array_uint8ss_increase__works(void **state) { const int length = 5; f_uint8ss_t data = f_uint8s_t_initialize; { - const f_status_t status = f_uint8ss_increase(length, 0); + const f_status_t status = f_uint8ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_uint8ss_increase(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_in_range(data.size, length + 1, length + 1 + F_memory_default_allocation_small_d); } free((void *) data.array); diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_increase.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_increase.h index a82b67d4e..867027656 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_increase.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_increase.h @@ -11,24 +11,24 @@ #define _TEST__F_type_array__uint8ss_increase /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint8ss_increase() + * @see f_uint8ss_increase() */ -extern void test__f_type_array_uint8ss_increase__works(void **state); +extern void test__f_type_array_uint8ss_increase__parameter_checking(void **state); /** - * Test that the function returns F_data_not when asked to copy an empty structure. + * Test that the function returns F_data_not. * - * @see f_type_array_uint8ss_increase() + * @see f_uint8ss_increase() */ extern void test__f_type_array_uint8ss_increase__returns_data_not(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint8ss_increase() + * @see f_uint8ss_increase() */ -extern void test__f_type_array_uint8ss_increase__parameter_checking(void **state); +extern void test__f_type_array_uint8ss_increase__works(void **state); #endif // _TEST__F_type_array__uint8ss_increase diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_increase_by.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_increase_by.c index 2d6e55c1c..93481c766 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_increase_by.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_increase_by.c @@ -5,11 +5,27 @@ extern "C" { #endif -void test__f_type_array_uint8ss_increase_by__works(void **state) { +void test__f_type_array_uint8ss_increase_by__parameter_checking(void **state) { const int length = 5; f_uint8ss_t data = f_uint8s_t_initialize; + { + const f_status_t status = f_uint8ss_increase_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_type_array_uint8ss_increase_by__returns_data_not(void **state) { + + const int length = 5; + f_uint8ss_t data = f_uint8ss_t_initialize; + { const f_status_t status = f_uint8ss_resize(length, &data); @@ -19,32 +35,48 @@ void test__f_type_array_uint8ss_increase_by__works(void **state) { } { - data.used = length; + const f_status_t status = f_uint8ss_increase_by(0, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + { const f_status_t status = f_uint8ss_increase_by(length, &data); - assert_int_equal(status, F_none); - assert_int_equal(data.used, length); - assert_int_equal(data.size, length * 2); + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); } free((void *) data.array); } -void test__f_type_array_uint8ss_increase_by__parameter_checking(void **state) { +void test__f_type_array_uint8ss_increase_by__works(void **state) { const int length = 5; f_uint8ss_t data = f_uint8s_t_initialize; { - const f_status_t status = f_uint8ss_increase_by(length, 0); + const f_status_t status = f_uint8ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + { + data.used = length; + + const f_status_t status = f_uint8ss_increase_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, length); + assert_int_equal(data.size, length * 2); + } + + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_increase_by.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_increase_by.h index e0bc0ecf5..1f4db6892 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_increase_by.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_increase_by.h @@ -11,17 +11,24 @@ #define _TEST__F_type_array__uint8ss_increase_by /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint8ss_increase_by() + * @see f_uint8ss_increase_by() */ -extern void test__f_type_array_uint8ss_increase_by__works(void **state); +extern void test__f_type_array_uint8ss_increase_by__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function returns F_data_not. * - * @see f_type_array_uint8ss_increase_by() + * @see f_uint8ss_increase_by() */ -extern void test__f_type_array_uint8ss_increase_by__parameter_checking(void **state); +extern void test__f_type_array_uint8ss_increase_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_uint8ss_increase_by() + */ +extern void test__f_type_array_uint8ss_increase_by__works(void **state); #endif // _TEST__F_type_array__uint8ss_increase_by diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_resize.c b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_resize.c index 251db7571..667b3fe8a 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_resize.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_resize.c @@ -5,36 +5,36 @@ extern "C" { #endif -void test__f_type_array_uint8ss_resize__works(void **state) { +void test__f_type_array_uint8ss_resize__parameter_checking(void **state) { const int length = 5; f_uint8ss_t data = f_uint8ss_t_initialize; { - const f_status_t status = f_uint8ss_resize(length, &data); + const f_status_t status = f_uint8ss_resize(length, 0); - assert_int_equal(status, F_none); + assert_int_equal(status, F_status_set_error(F_parameter)); assert_int_equal(data.used, 0); - assert_int_equal(data.size, length); + assert_int_equal(data.size, 0); } - free((void *) data.array); + assert_null(data.array); } -void test__f_type_array_uint8ss_resize__parameter_checking(void **state) { +void test__f_type_array_uint8ss_resize__works(void **state) { const int length = 5; f_uint8ss_t data = f_uint8ss_t_initialize; { - const f_status_t status = f_uint8ss_resize(length, 0); + const f_status_t status = f_uint8ss_resize(length, &data); - assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(status, F_none); assert_int_equal(data.used, 0); - assert_int_equal(data.size, 0); + assert_int_equal(data.size, length); } - assert_null(data.array); + free((void *) data.array); } #ifdef __cplusplus diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_resize.h b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_resize.h index 69a471866..6710c176f 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_resize.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array-uint8ss_resize.h @@ -11,17 +11,17 @@ #define _TEST__F_type_array__uint8ss_resize /** - * Test that the function works. + * Test that the function correctly fails on invalid parameter. * - * @see f_type_array_uint8ss_resize() + * @see f_uint8ss_resize() */ -extern void test__f_type_array_uint8ss_resize__works(void **state); +extern void test__f_type_array_uint8ss_resize__parameter_checking(void **state); /** - * Test that the function correctly fails on invalid parameter. + * Test that the function works. * - * @see f_type_array_uint8ss_resize() + * @see f_uint8ss_resize() */ -extern void test__f_type_array_uint8ss_resize__parameter_checking(void **state); +extern void test__f_type_array_uint8ss_resize__works(void **state); #endif // _TEST__F_type_array__uint8ss_resize diff --git a/level_0/f_type_array/tests/unit/c/test-type_array.c b/level_0/f_type_array/tests/unit/c/test-type_array.c index fded1e594..15ee24517 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array.c @@ -20,345 +20,375 @@ int main(void) { cmocka_unit_test(test__f_type_array_array_lengths_adjust__works), cmocka_unit_test(test__f_type_array_array_lengths_append__works), cmocka_unit_test(test__f_type_array_array_lengths_append_all__works), - cmocka_unit_test(test__f_type_array_array_lengths_append_all__returns_data_not), cmocka_unit_test(test__f_type_array_array_lengths_decimate_by__works), cmocka_unit_test(test__f_type_array_array_lengths_decrease_by__works), cmocka_unit_test(test__f_type_array_array_lengths_increase__works), - cmocka_unit_test(test__f_type_array_array_lengths_increase__returns_data_not), cmocka_unit_test(test__f_type_array_array_lengths_increase_by__works), cmocka_unit_test(test__f_type_array_array_lengths_resize__works), + cmocka_unit_test(test__f_type_array_array_lengthss_append__returns_data_not), + cmocka_unit_test(test__f_type_array_array_lengthss_append_all__returns_data_not), + cmocka_unit_test(test__f_type_array_array_lengthss_decimate_by__returns_data_not), + cmocka_unit_test(test__f_type_array_array_lengthss_decrease_by__returns_data_not), + cmocka_unit_test(test__f_type_array_array_lengthss_increase__returns_data_not), + cmocka_unit_test(test__f_type_array_array_lengthss_increase_by__returns_data_not), + cmocka_unit_test(test__f_type_array_array_lengthss_adjust__works), cmocka_unit_test(test__f_type_array_array_lengthss_append__works), - cmocka_unit_test(test__f_type_array_array_lengthss_append__returns_data_not), cmocka_unit_test(test__f_type_array_array_lengthss_append_all__works), - cmocka_unit_test(test__f_type_array_array_lengthss_append_all__returns_data_not), cmocka_unit_test(test__f_type_array_array_lengthss_decimate_by__works), cmocka_unit_test(test__f_type_array_array_lengthss_decrease_by__works), cmocka_unit_test(test__f_type_array_array_lengthss_increase__works), - cmocka_unit_test(test__f_type_array_array_lengthss_increase__returns_data_not), cmocka_unit_test(test__f_type_array_array_lengthss_increase_by__works), cmocka_unit_test(test__f_type_array_array_lengthss_resize__works), cmocka_unit_test(test__f_type_array_cells_adjust__works), cmocka_unit_test(test__f_type_array_cells_append__works), cmocka_unit_test(test__f_type_array_cells_append_all__works), - cmocka_unit_test(test__f_type_array_cells_append_all__returns_data_not), cmocka_unit_test(test__f_type_array_cells_decimate_by__works), cmocka_unit_test(test__f_type_array_cells_decrease_by__works), cmocka_unit_test(test__f_type_array_cells_increase__works), - cmocka_unit_test(test__f_type_array_cells_increase__returns_data_not), cmocka_unit_test(test__f_type_array_cells_increase_by__works), cmocka_unit_test(test__f_type_array_cells_resize__works), + cmocka_unit_test(test__f_type_array_cellss_append__returns_data_not), + cmocka_unit_test(test__f_type_array_cellss_append_all__returns_data_not), + cmocka_unit_test(test__f_type_array_cellss_decimate_by__returns_data_not), + cmocka_unit_test(test__f_type_array_cellss_decrease_by__returns_data_not), + cmocka_unit_test(test__f_type_array_cellss_increase__returns_data_not), + cmocka_unit_test(test__f_type_array_cellss_increase_by__returns_data_not), + cmocka_unit_test(test__f_type_array_cellss_adjust__works), cmocka_unit_test(test__f_type_array_cellss_append__works), - cmocka_unit_test(test__f_type_array_cellss_append__returns_data_not), cmocka_unit_test(test__f_type_array_cellss_append_all__works), - cmocka_unit_test(test__f_type_array_cellss_append_all__returns_data_not), cmocka_unit_test(test__f_type_array_cellss_decimate_by__works), cmocka_unit_test(test__f_type_array_cellss_decrease_by__works), cmocka_unit_test(test__f_type_array_cellss_increase__works), - cmocka_unit_test(test__f_type_array_cellss_increase__returns_data_not), cmocka_unit_test(test__f_type_array_cellss_increase_by__works), cmocka_unit_test(test__f_type_array_cellss_resize__works), cmocka_unit_test(test__f_type_array_fll_ids_adjust__works), cmocka_unit_test(test__f_type_array_fll_ids_append__works), cmocka_unit_test(test__f_type_array_fll_ids_append_all__works), - cmocka_unit_test(test__f_type_array_fll_ids_append_all__returns_data_not), cmocka_unit_test(test__f_type_array_fll_ids_decimate_by__works), cmocka_unit_test(test__f_type_array_fll_ids_decrease_by__works), cmocka_unit_test(test__f_type_array_fll_ids_increase__works), - cmocka_unit_test(test__f_type_array_fll_ids_increase__returns_data_not), cmocka_unit_test(test__f_type_array_fll_ids_increase_by__works), cmocka_unit_test(test__f_type_array_fll_ids_resize__works), + cmocka_unit_test(test__f_type_array_fll_idss_append__returns_data_not), + cmocka_unit_test(test__f_type_array_fll_idss_append_all__returns_data_not), + cmocka_unit_test(test__f_type_array_fll_idss_decimate_by__returns_data_not), + cmocka_unit_test(test__f_type_array_fll_idss_decrease_by__returns_data_not), + cmocka_unit_test(test__f_type_array_fll_idss_increase__returns_data_not), + cmocka_unit_test(test__f_type_array_fll_idss_increase_by__returns_data_not), + cmocka_unit_test(test__f_type_array_fll_idss_adjust__works), cmocka_unit_test(test__f_type_array_fll_idss_append__works), - cmocka_unit_test(test__f_type_array_fll_idss_append__returns_data_not), cmocka_unit_test(test__f_type_array_fll_idss_append_all__works), - cmocka_unit_test(test__f_type_array_fll_idss_append_all__returns_data_not), cmocka_unit_test(test__f_type_array_fll_idss_decimate_by__works), cmocka_unit_test(test__f_type_array_fll_idss_decrease_by__works), cmocka_unit_test(test__f_type_array_fll_idss_increase__works), - cmocka_unit_test(test__f_type_array_fll_idss_increase__returns_data_not), cmocka_unit_test(test__f_type_array_fll_idss_increase_by__works), cmocka_unit_test(test__f_type_array_fll_idss_resize__works), cmocka_unit_test(test__f_type_array_int8s_adjust__works), cmocka_unit_test(test__f_type_array_int8s_append__works), cmocka_unit_test(test__f_type_array_int8s_append_all__works), - cmocka_unit_test(test__f_type_array_int8s_append_all__returns_data_not), cmocka_unit_test(test__f_type_array_int8s_decimate_by__works), cmocka_unit_test(test__f_type_array_int8s_decrease_by__works), cmocka_unit_test(test__f_type_array_int8s_increase__works), - cmocka_unit_test(test__f_type_array_int8s_increase__returns_data_not), cmocka_unit_test(test__f_type_array_int8s_increase_by__works), cmocka_unit_test(test__f_type_array_int8s_resize__works), + cmocka_unit_test(test__f_type_array_int8ss_append__returns_data_not), + cmocka_unit_test(test__f_type_array_int8ss_append_all__returns_data_not), + cmocka_unit_test(test__f_type_array_int8ss_decimate_by__returns_data_not), + cmocka_unit_test(test__f_type_array_int8ss_decrease_by__returns_data_not), + cmocka_unit_test(test__f_type_array_int8ss_increase__returns_data_not), + cmocka_unit_test(test__f_type_array_int8ss_increase_by__returns_data_not), + cmocka_unit_test(test__f_type_array_int8ss_adjust__works), cmocka_unit_test(test__f_type_array_int8ss_append__works), - cmocka_unit_test(test__f_type_array_int8ss_append__returns_data_not), cmocka_unit_test(test__f_type_array_int8ss_append_all__works), - cmocka_unit_test(test__f_type_array_int8ss_append_all__returns_data_not), cmocka_unit_test(test__f_type_array_int8ss_decimate_by__works), cmocka_unit_test(test__f_type_array_int8ss_decrease_by__works), cmocka_unit_test(test__f_type_array_int8ss_increase__works), - cmocka_unit_test(test__f_type_array_int8ss_increase__returns_data_not), cmocka_unit_test(test__f_type_array_int8ss_increase_by__works), cmocka_unit_test(test__f_type_array_int8ss_resize__works), cmocka_unit_test(test__f_type_array_int16s_adjust__works), cmocka_unit_test(test__f_type_array_int16s_append__works), cmocka_unit_test(test__f_type_array_int16s_append_all__works), - cmocka_unit_test(test__f_type_array_int16s_append_all__returns_data_not), cmocka_unit_test(test__f_type_array_int16s_decimate_by__works), cmocka_unit_test(test__f_type_array_int16s_decrease_by__works), cmocka_unit_test(test__f_type_array_int16s_increase__works), - cmocka_unit_test(test__f_type_array_int16s_increase__returns_data_not), cmocka_unit_test(test__f_type_array_int16s_increase_by__works), cmocka_unit_test(test__f_type_array_int16s_resize__works), + cmocka_unit_test(test__f_type_array_int16ss_append__returns_data_not), + cmocka_unit_test(test__f_type_array_int16ss_append_all__returns_data_not), + cmocka_unit_test(test__f_type_array_int16ss_decimate_by__returns_data_not), + cmocka_unit_test(test__f_type_array_int16ss_decrease_by__returns_data_not), + cmocka_unit_test(test__f_type_array_int16ss_increase__returns_data_not), + cmocka_unit_test(test__f_type_array_int16ss_increase_by__returns_data_not), + cmocka_unit_test(test__f_type_array_int16ss_adjust__works), cmocka_unit_test(test__f_type_array_int16ss_append__works), - cmocka_unit_test(test__f_type_array_int16ss_append__returns_data_not), cmocka_unit_test(test__f_type_array_int16ss_append_all__works), - cmocka_unit_test(test__f_type_array_int16ss_append_all__returns_data_not), cmocka_unit_test(test__f_type_array_int16ss_decimate_by__works), cmocka_unit_test(test__f_type_array_int16ss_decrease_by__works), cmocka_unit_test(test__f_type_array_int16ss_increase__works), - cmocka_unit_test(test__f_type_array_int16ss_increase__returns_data_not), cmocka_unit_test(test__f_type_array_int16ss_increase_by__works), cmocka_unit_test(test__f_type_array_int16ss_resize__works), cmocka_unit_test(test__f_type_array_int32s_adjust__works), cmocka_unit_test(test__f_type_array_int32s_append__works), cmocka_unit_test(test__f_type_array_int32s_append_all__works), - cmocka_unit_test(test__f_type_array_int32s_append_all__returns_data_not), cmocka_unit_test(test__f_type_array_int32s_decimate_by__works), cmocka_unit_test(test__f_type_array_int32s_decrease_by__works), cmocka_unit_test(test__f_type_array_int32s_increase__works), - cmocka_unit_test(test__f_type_array_int32s_increase__returns_data_not), cmocka_unit_test(test__f_type_array_int32s_increase_by__works), cmocka_unit_test(test__f_type_array_int32s_resize__works), + cmocka_unit_test(test__f_type_array_int32ss_append__returns_data_not), + cmocka_unit_test(test__f_type_array_int32ss_append_all__returns_data_not), + cmocka_unit_test(test__f_type_array_int32ss_decimate_by__returns_data_not), + cmocka_unit_test(test__f_type_array_int32ss_decrease_by__returns_data_not), + cmocka_unit_test(test__f_type_array_int32ss_increase__returns_data_not), + cmocka_unit_test(test__f_type_array_int32ss_increase_by__returns_data_not), + cmocka_unit_test(test__f_type_array_int32ss_adjust__works), cmocka_unit_test(test__f_type_array_int32ss_append__works), - cmocka_unit_test(test__f_type_array_int32ss_append__returns_data_not), cmocka_unit_test(test__f_type_array_int32ss_append_all__works), - cmocka_unit_test(test__f_type_array_int32ss_append_all__returns_data_not), cmocka_unit_test(test__f_type_array_int32ss_decimate_by__works), cmocka_unit_test(test__f_type_array_int32ss_decrease_by__works), cmocka_unit_test(test__f_type_array_int32ss_increase__works), - cmocka_unit_test(test__f_type_array_int32ss_increase__returns_data_not), cmocka_unit_test(test__f_type_array_int32ss_increase_by__works), cmocka_unit_test(test__f_type_array_int32ss_resize__works), cmocka_unit_test(test__f_type_array_int64s_adjust__works), cmocka_unit_test(test__f_type_array_int64s_append__works), cmocka_unit_test(test__f_type_array_int64s_append_all__works), - cmocka_unit_test(test__f_type_array_int64s_append_all__returns_data_not), cmocka_unit_test(test__f_type_array_int64s_decimate_by__works), cmocka_unit_test(test__f_type_array_int64s_decrease_by__works), cmocka_unit_test(test__f_type_array_int64s_increase__works), - cmocka_unit_test(test__f_type_array_int64s_increase__returns_data_not), cmocka_unit_test(test__f_type_array_int64s_increase_by__works), cmocka_unit_test(test__f_type_array_int64s_resize__works), + cmocka_unit_test(test__f_type_array_int64ss_append__returns_data_not), + cmocka_unit_test(test__f_type_array_int64ss_append_all__returns_data_not), + cmocka_unit_test(test__f_type_array_int64ss_decimate_by__returns_data_not), + cmocka_unit_test(test__f_type_array_int64ss_decrease_by__returns_data_not), + cmocka_unit_test(test__f_type_array_int64ss_increase__returns_data_not), + cmocka_unit_test(test__f_type_array_int64ss_increase_by__returns_data_not), + cmocka_unit_test(test__f_type_array_int64ss_adjust__works), cmocka_unit_test(test__f_type_array_int64ss_append__works), - cmocka_unit_test(test__f_type_array_int64ss_append__returns_data_not), cmocka_unit_test(test__f_type_array_int64ss_append_all__works), - cmocka_unit_test(test__f_type_array_int64ss_append_all__returns_data_not), cmocka_unit_test(test__f_type_array_int64ss_decimate_by__works), cmocka_unit_test(test__f_type_array_int64ss_decrease_by__works), cmocka_unit_test(test__f_type_array_int64ss_increase__works), - cmocka_unit_test(test__f_type_array_int64ss_increase__returns_data_not), cmocka_unit_test(test__f_type_array_int64ss_increase_by__works), cmocka_unit_test(test__f_type_array_int64ss_resize__works), cmocka_unit_test(test__f_type_array_int128s_adjust__works), cmocka_unit_test(test__f_type_array_int128s_append__works), cmocka_unit_test(test__f_type_array_int128s_append_all__works), - cmocka_unit_test(test__f_type_array_int128s_append_all__returns_data_not), cmocka_unit_test(test__f_type_array_int128s_decimate_by__works), cmocka_unit_test(test__f_type_array_int128s_decrease_by__works), cmocka_unit_test(test__f_type_array_int128s_increase__works), - cmocka_unit_test(test__f_type_array_int128s_increase__returns_data_not), cmocka_unit_test(test__f_type_array_int128s_increase_by__works), cmocka_unit_test(test__f_type_array_int128s_resize__works), + cmocka_unit_test(test__f_type_array_int128ss_append__returns_data_not), + cmocka_unit_test(test__f_type_array_int128ss_append_all__returns_data_not), + cmocka_unit_test(test__f_type_array_int128ss_decimate_by__returns_data_not), + cmocka_unit_test(test__f_type_array_int128ss_decrease_by__returns_data_not), + cmocka_unit_test(test__f_type_array_int128ss_increase__returns_data_not), + cmocka_unit_test(test__f_type_array_int128ss_increase_by__returns_data_not), + cmocka_unit_test(test__f_type_array_int128ss_adjust__works), cmocka_unit_test(test__f_type_array_int128ss_append__works), - cmocka_unit_test(test__f_type_array_int128ss_append__returns_data_not), cmocka_unit_test(test__f_type_array_int128ss_append_all__works), - cmocka_unit_test(test__f_type_array_int128ss_append_all__returns_data_not), cmocka_unit_test(test__f_type_array_int128ss_decimate_by__works), cmocka_unit_test(test__f_type_array_int128ss_decrease_by__works), cmocka_unit_test(test__f_type_array_int128ss_increase__works), - cmocka_unit_test(test__f_type_array_int128ss_increase__returns_data_not), cmocka_unit_test(test__f_type_array_int128ss_increase_by__works), cmocka_unit_test(test__f_type_array_int128ss_resize__works), cmocka_unit_test(test__f_type_array_states_adjust__works), cmocka_unit_test(test__f_type_array_states_append__works), cmocka_unit_test(test__f_type_array_states_append_all__works), - cmocka_unit_test(test__f_type_array_states_append_all__returns_data_not), cmocka_unit_test(test__f_type_array_states_decimate_by__works), cmocka_unit_test(test__f_type_array_states_decrease_by__works), cmocka_unit_test(test__f_type_array_states_increase__works), - cmocka_unit_test(test__f_type_array_states_increase__returns_data_not), cmocka_unit_test(test__f_type_array_states_increase_by__works), cmocka_unit_test(test__f_type_array_states_resize__works), + cmocka_unit_test(test__f_type_array_statess_append__returns_data_not), + cmocka_unit_test(test__f_type_array_statess_append_all__returns_data_not), + cmocka_unit_test(test__f_type_array_statess_decimate_by__returns_data_not), + cmocka_unit_test(test__f_type_array_statess_decrease_by__returns_data_not), + cmocka_unit_test(test__f_type_array_statess_increase__returns_data_not), + cmocka_unit_test(test__f_type_array_statess_increase_by__returns_data_not), + cmocka_unit_test(test__f_type_array_statess_adjust__works), cmocka_unit_test(test__f_type_array_statess_append__works), - cmocka_unit_test(test__f_type_array_statess_append__returns_data_not), cmocka_unit_test(test__f_type_array_statess_append_all__works), - cmocka_unit_test(test__f_type_array_statess_append_all__returns_data_not), cmocka_unit_test(test__f_type_array_statess_decimate_by__works), cmocka_unit_test(test__f_type_array_statess_decrease_by__works), cmocka_unit_test(test__f_type_array_statess_increase__works), - cmocka_unit_test(test__f_type_array_statess_increase__returns_data_not), cmocka_unit_test(test__f_type_array_statess_increase_by__works), cmocka_unit_test(test__f_type_array_statess_resize__works), cmocka_unit_test(test__f_type_array_statuss_adjust__works), cmocka_unit_test(test__f_type_array_statuss_append__works), cmocka_unit_test(test__f_type_array_statuss_append_all__works), - cmocka_unit_test(test__f_type_array_statuss_append_all__returns_data_not), cmocka_unit_test(test__f_type_array_statuss_decimate_by__works), cmocka_unit_test(test__f_type_array_statuss_decrease_by__works), cmocka_unit_test(test__f_type_array_statuss_increase__works), - cmocka_unit_test(test__f_type_array_statuss_increase__returns_data_not), cmocka_unit_test(test__f_type_array_statuss_increase_by__works), cmocka_unit_test(test__f_type_array_statuss_resize__works), + cmocka_unit_test(test__f_type_array_statusss_append__returns_data_not), + cmocka_unit_test(test__f_type_array_statusss_append_all__returns_data_not), + cmocka_unit_test(test__f_type_array_statusss_decimate_by__returns_data_not), + cmocka_unit_test(test__f_type_array_statusss_decrease_by__returns_data_not), + cmocka_unit_test(test__f_type_array_statusss_increase__returns_data_not), + cmocka_unit_test(test__f_type_array_statusss_increase_by__returns_data_not), + cmocka_unit_test(test__f_type_array_statusss_adjust__works), cmocka_unit_test(test__f_type_array_statusss_append__works), - cmocka_unit_test(test__f_type_array_statusss_append__returns_data_not), cmocka_unit_test(test__f_type_array_statusss_append_all__works), - cmocka_unit_test(test__f_type_array_statusss_append_all__returns_data_not), cmocka_unit_test(test__f_type_array_statusss_decimate_by__works), cmocka_unit_test(test__f_type_array_statusss_decrease_by__works), cmocka_unit_test(test__f_type_array_statusss_increase__works), - cmocka_unit_test(test__f_type_array_statusss_increase__returns_data_not), cmocka_unit_test(test__f_type_array_statusss_increase_by__works), cmocka_unit_test(test__f_type_array_statusss_resize__works), cmocka_unit_test(test__f_type_array_uint8s_adjust__works), cmocka_unit_test(test__f_type_array_uint8s_append__works), cmocka_unit_test(test__f_type_array_uint8s_append_all__works), - cmocka_unit_test(test__f_type_array_uint8s_append_all__returns_data_not), cmocka_unit_test(test__f_type_array_uint8s_decimate_by__works), cmocka_unit_test(test__f_type_array_uint8s_decrease_by__works), cmocka_unit_test(test__f_type_array_uint8s_increase__works), - cmocka_unit_test(test__f_type_array_uint8s_increase__returns_data_not), cmocka_unit_test(test__f_type_array_uint8s_increase_by__works), cmocka_unit_test(test__f_type_array_uint8s_resize__works), + cmocka_unit_test(test__f_type_array_uint8ss_append__returns_data_not), + cmocka_unit_test(test__f_type_array_uint8ss_append_all__returns_data_not), + cmocka_unit_test(test__f_type_array_uint8ss_decimate_by__returns_data_not), + cmocka_unit_test(test__f_type_array_uint8ss_decrease_by__returns_data_not), + cmocka_unit_test(test__f_type_array_uint8ss_increase__returns_data_not), + cmocka_unit_test(test__f_type_array_uint8ss_increase_by__returns_data_not), + cmocka_unit_test(test__f_type_array_uint8ss_adjust__works), cmocka_unit_test(test__f_type_array_uint8ss_append__works), - cmocka_unit_test(test__f_type_array_uint8ss_append__returns_data_not), cmocka_unit_test(test__f_type_array_uint8ss_append_all__works), - cmocka_unit_test(test__f_type_array_uint8ss_append_all__returns_data_not), cmocka_unit_test(test__f_type_array_uint8ss_decimate_by__works), cmocka_unit_test(test__f_type_array_uint8ss_decrease_by__works), cmocka_unit_test(test__f_type_array_uint8ss_increase__works), - cmocka_unit_test(test__f_type_array_uint8ss_increase__returns_data_not), cmocka_unit_test(test__f_type_array_uint8ss_increase_by__works), cmocka_unit_test(test__f_type_array_uint8ss_resize__works), cmocka_unit_test(test__f_type_array_uint16s_adjust__works), cmocka_unit_test(test__f_type_array_uint16s_append__works), cmocka_unit_test(test__f_type_array_uint16s_append_all__works), - cmocka_unit_test(test__f_type_array_uint16s_append_all__returns_data_not), cmocka_unit_test(test__f_type_array_uint16s_decimate_by__works), cmocka_unit_test(test__f_type_array_uint16s_decrease_by__works), cmocka_unit_test(test__f_type_array_uint16s_increase__works), - cmocka_unit_test(test__f_type_array_uint16s_increase__returns_data_not), cmocka_unit_test(test__f_type_array_uint16s_increase_by__works), cmocka_unit_test(test__f_type_array_uint16s_resize__works), + cmocka_unit_test(test__f_type_array_uint16ss_append__returns_data_not), + cmocka_unit_test(test__f_type_array_uint16ss_append_all__returns_data_not), + cmocka_unit_test(test__f_type_array_uint16ss_decimate_by__returns_data_not), + cmocka_unit_test(test__f_type_array_uint16ss_decrease_by__returns_data_not), + cmocka_unit_test(test__f_type_array_uint16ss_increase__returns_data_not), + cmocka_unit_test(test__f_type_array_uint16ss_increase_by__returns_data_not), + cmocka_unit_test(test__f_type_array_uint16ss_adjust__works), cmocka_unit_test(test__f_type_array_uint16ss_append__works), - cmocka_unit_test(test__f_type_array_uint16ss_append__returns_data_not), cmocka_unit_test(test__f_type_array_uint16ss_append_all__works), - cmocka_unit_test(test__f_type_array_uint16ss_append_all__returns_data_not), cmocka_unit_test(test__f_type_array_uint16ss_decimate_by__works), cmocka_unit_test(test__f_type_array_uint16ss_decrease_by__works), cmocka_unit_test(test__f_type_array_uint16ss_increase__works), - cmocka_unit_test(test__f_type_array_uint16ss_increase__returns_data_not), cmocka_unit_test(test__f_type_array_uint16ss_increase_by__works), cmocka_unit_test(test__f_type_array_uint16ss_resize__works), cmocka_unit_test(test__f_type_array_uint32s_adjust__works), cmocka_unit_test(test__f_type_array_uint32s_append__works), cmocka_unit_test(test__f_type_array_uint32s_append_all__works), - cmocka_unit_test(test__f_type_array_uint32s_append_all__returns_data_not), cmocka_unit_test(test__f_type_array_uint32s_decimate_by__works), cmocka_unit_test(test__f_type_array_uint32s_decrease_by__works), cmocka_unit_test(test__f_type_array_uint32s_increase__works), - cmocka_unit_test(test__f_type_array_uint32s_increase__returns_data_not), cmocka_unit_test(test__f_type_array_uint32s_increase_by__works), cmocka_unit_test(test__f_type_array_uint32s_resize__works), + cmocka_unit_test(test__f_type_array_uint32ss_append__returns_data_not), + cmocka_unit_test(test__f_type_array_uint32ss_append_all__returns_data_not), + cmocka_unit_test(test__f_type_array_uint32ss_decimate_by__returns_data_not), + cmocka_unit_test(test__f_type_array_uint32ss_decrease_by__returns_data_not), + cmocka_unit_test(test__f_type_array_uint32ss_increase__returns_data_not), + cmocka_unit_test(test__f_type_array_uint32ss_increase_by__returns_data_not), + cmocka_unit_test(test__f_type_array_uint32ss_adjust__works), cmocka_unit_test(test__f_type_array_uint32ss_append__works), - cmocka_unit_test(test__f_type_array_uint32ss_append__returns_data_not), cmocka_unit_test(test__f_type_array_uint32ss_append_all__works), - cmocka_unit_test(test__f_type_array_uint32ss_append_all__returns_data_not), cmocka_unit_test(test__f_type_array_uint32ss_decimate_by__works), cmocka_unit_test(test__f_type_array_uint32ss_decrease_by__works), cmocka_unit_test(test__f_type_array_uint32ss_increase__works), - cmocka_unit_test(test__f_type_array_uint32ss_increase__returns_data_not), cmocka_unit_test(test__f_type_array_uint32ss_increase_by__works), cmocka_unit_test(test__f_type_array_uint32ss_resize__works), cmocka_unit_test(test__f_type_array_uint64s_adjust__works), cmocka_unit_test(test__f_type_array_uint64s_append__works), cmocka_unit_test(test__f_type_array_uint64s_append_all__works), - cmocka_unit_test(test__f_type_array_uint64s_append_all__returns_data_not), cmocka_unit_test(test__f_type_array_uint64s_decimate_by__works), cmocka_unit_test(test__f_type_array_uint64s_decrease_by__works), cmocka_unit_test(test__f_type_array_uint64s_increase__works), - cmocka_unit_test(test__f_type_array_uint64s_increase__returns_data_not), cmocka_unit_test(test__f_type_array_uint64s_increase_by__works), cmocka_unit_test(test__f_type_array_uint64s_resize__works), + cmocka_unit_test(test__f_type_array_uint64ss_append__returns_data_not), + cmocka_unit_test(test__f_type_array_uint64ss_append_all__returns_data_not), + cmocka_unit_test(test__f_type_array_uint64ss_decimate_by__returns_data_not), + cmocka_unit_test(test__f_type_array_uint64ss_decrease_by__returns_data_not), + cmocka_unit_test(test__f_type_array_uint64ss_increase__returns_data_not), + cmocka_unit_test(test__f_type_array_uint64ss_increase_by__returns_data_not), + cmocka_unit_test(test__f_type_array_uint64ss_adjust__works), cmocka_unit_test(test__f_type_array_uint64ss_append__works), - cmocka_unit_test(test__f_type_array_uint64ss_append__returns_data_not), cmocka_unit_test(test__f_type_array_uint64ss_append_all__works), - cmocka_unit_test(test__f_type_array_uint64ss_append_all__returns_data_not), cmocka_unit_test(test__f_type_array_uint64ss_decimate_by__works), cmocka_unit_test(test__f_type_array_uint64ss_decrease_by__works), cmocka_unit_test(test__f_type_array_uint64ss_increase__works), - cmocka_unit_test(test__f_type_array_uint64ss_increase__returns_data_not), cmocka_unit_test(test__f_type_array_uint64ss_increase_by__works), cmocka_unit_test(test__f_type_array_uint64ss_resize__works), cmocka_unit_test(test__f_type_array_uint128s_adjust__works), cmocka_unit_test(test__f_type_array_uint128s_append__works), cmocka_unit_test(test__f_type_array_uint128s_append_all__works), - cmocka_unit_test(test__f_type_array_uint128s_append_all__returns_data_not), cmocka_unit_test(test__f_type_array_uint128s_decimate_by__works), cmocka_unit_test(test__f_type_array_uint128s_decrease_by__works), cmocka_unit_test(test__f_type_array_uint128s_increase__works), - cmocka_unit_test(test__f_type_array_uint128s_increase__returns_data_not), cmocka_unit_test(test__f_type_array_uint128s_increase_by__works), cmocka_unit_test(test__f_type_array_uint128s_resize__works), + cmocka_unit_test(test__f_type_array_uint128ss_append__returns_data_not), + cmocka_unit_test(test__f_type_array_uint128ss_append_all__returns_data_not), + cmocka_unit_test(test__f_type_array_uint128ss_decimate_by__returns_data_not), + cmocka_unit_test(test__f_type_array_uint128ss_decrease_by__returns_data_not), + cmocka_unit_test(test__f_type_array_uint128ss_increase__returns_data_not), + cmocka_unit_test(test__f_type_array_uint128ss_increase_by__returns_data_not), + cmocka_unit_test(test__f_type_array_uint128ss_adjust__works), cmocka_unit_test(test__f_type_array_uint128ss_append__works), - cmocka_unit_test(test__f_type_array_uint128ss_append__returns_data_not), cmocka_unit_test(test__f_type_array_uint128ss_append_all__works), - cmocka_unit_test(test__f_type_array_uint128ss_append_all__returns_data_not), cmocka_unit_test(test__f_type_array_uint128ss_decimate_by__works), cmocka_unit_test(test__f_type_array_uint128ss_decrease_by__works), cmocka_unit_test(test__f_type_array_uint128ss_increase__works), - cmocka_unit_test(test__f_type_array_uint128ss_increase__returns_data_not), cmocka_unit_test(test__f_type_array_uint128ss_increase_by__works), cmocka_unit_test(test__f_type_array_uint128ss_resize__works), -- 2.47.3