From 0cbc6fa9ef62f596260553554405019fe75e9283 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Wed, 1 Jun 2022 23:39:40 -0500 Subject: [PATCH] Update: Add unit tests for f_fss project. --- level_0/f_fss/data/build/settings-mocks | 60 +++++++ level_0/f_fss/data/build/settings-tests | 65 ++++++++ level_0/f_fss/data/build/testfile | 55 +++++++ level_0/f_fss/tests/unit/c/mock-fss.c | 25 +++ level_0/f_fss/tests/unit/c/mock-fss.h | 37 +++++ .../f_fss/tests/unit/c/test-fss-apply_delimit.c | 129 +++++++++++++++ .../f_fss/tests/unit/c/test-fss-apply_delimit.h | 34 ++++ .../tests/unit/c/test-fss-apply_delimit_range.c | 151 +++++++++++++++++ .../tests/unit/c/test-fss-apply_delimit_range.h | 34 ++++ level_0/f_fss/tests/unit/c/test-fss-count_lines.c | 59 +++++++ level_0/f_fss/tests/unit/c/test-fss-count_lines.h | 34 ++++ .../tests/unit/c/test-fss-count_lines_range.c | 81 ++++++++++ .../tests/unit/c/test-fss-count_lines_range.h | 34 ++++ level_0/f_fss/tests/unit/c/test-fss-fail_utf.c | 71 ++++++++ level_0/f_fss/tests/unit/c/test-fss-fail_utf.h | 27 ++++ .../tests/unit/c/test-fss-fail_utf_to_false.c | 71 ++++++++ .../tests/unit/c/test-fss-fail_utf_to_false.h | 27 ++++ level_0/f_fss/tests/unit/c/test-fss-is_combining.c | 92 +++++++++++ level_0/f_fss/tests/unit/c/test-fss-is_combining.h | 20 +++ level_0/f_fss/tests/unit/c/test-fss-is_graph.c | 79 +++++++++ level_0/f_fss/tests/unit/c/test-fss-is_graph.h | 20 +++ level_0/f_fss/tests/unit/c/test-fss-is_space.c | 79 +++++++++ level_0/f_fss/tests/unit/c/test-fss-is_space.h | 20 +++ .../f_fss/tests/unit/c/test-fss-is_zero_width.c | 95 +++++++++++ .../f_fss/tests/unit/c/test-fss-is_zero_width.h | 27 ++++ level_0/f_fss/tests/unit/c/test-fss-items_adjust.c | 42 +++++ level_0/f_fss/tests/unit/c/test-fss-items_adjust.h | 27 ++++ .../tests/unit/c/test-fss-items_decimate_by.c | 74 +++++++++ .../tests/unit/c/test-fss-items_decimate_by.h | 34 ++++ .../tests/unit/c/test-fss-items_decrease_by.c | 74 +++++++++ .../tests/unit/c/test-fss-items_decrease_by.h | 34 ++++ .../f_fss/tests/unit/c/test-fss-items_increase.c | 76 +++++++++ .../f_fss/tests/unit/c/test-fss-items_increase.h | 34 ++++ .../tests/unit/c/test-fss-items_increase_by.c | 76 +++++++++ .../tests/unit/c/test-fss-items_increase_by.h | 34 ++++ level_0/f_fss/tests/unit/c/test-fss-items_resize.c | 42 +++++ level_0/f_fss/tests/unit/c/test-fss-items_resize.h | 27 ++++ level_0/f_fss/tests/unit/c/test-fss-named_adjust.c | 54 +++++++ level_0/f_fss/tests/unit/c/test-fss-named_adjust.h | 27 ++++ .../tests/unit/c/test-fss-named_decimate_by.c | 100 ++++++++++++ .../tests/unit/c/test-fss-named_decimate_by.h | 34 ++++ .../tests/unit/c/test-fss-named_decrease_by.c | 100 ++++++++++++ .../tests/unit/c/test-fss-named_decrease_by.h | 34 ++++ .../f_fss/tests/unit/c/test-fss-named_increase.c | 104 ++++++++++++ .../f_fss/tests/unit/c/test-fss-named_increase.h | 34 ++++ .../tests/unit/c/test-fss-named_increase_by.c | 104 ++++++++++++ .../tests/unit/c/test-fss-named_increase_by.h | 34 ++++ level_0/f_fss/tests/unit/c/test-fss-named_resize.c | 54 +++++++ level_0/f_fss/tests/unit/c/test-fss-named_resize.h | 27 ++++ .../f_fss/tests/unit/c/test-fss-nameds_adjust.c | 42 +++++ .../f_fss/tests/unit/c/test-fss-nameds_adjust.h | 27 ++++ .../tests/unit/c/test-fss-nameds_decimate_by.c | 74 +++++++++ .../tests/unit/c/test-fss-nameds_decimate_by.h | 34 ++++ .../tests/unit/c/test-fss-nameds_decrease_by.c | 74 +++++++++ .../tests/unit/c/test-fss-nameds_decrease_by.h | 34 ++++ .../f_fss/tests/unit/c/test-fss-nameds_increase.c | 76 +++++++++ .../f_fss/tests/unit/c/test-fss-nameds_increase.h | 34 ++++ .../tests/unit/c/test-fss-nameds_increase_by.c | 76 +++++++++ .../tests/unit/c/test-fss-nameds_increase_by.h | 34 ++++ .../f_fss/tests/unit/c/test-fss-nameds_resize.c | 42 +++++ .../f_fss/tests/unit/c/test-fss-nameds_resize.h | 27 ++++ level_0/f_fss/tests/unit/c/test-fss-nest_adjust.c | 42 +++++ level_0/f_fss/tests/unit/c/test-fss-nest_adjust.h | 27 ++++ .../f_fss/tests/unit/c/test-fss-nest_decimate_by.c | 74 +++++++++ .../f_fss/tests/unit/c/test-fss-nest_decimate_by.h | 34 ++++ .../f_fss/tests/unit/c/test-fss-nest_decrease_by.c | 74 +++++++++ .../f_fss/tests/unit/c/test-fss-nest_decrease_by.h | 34 ++++ .../f_fss/tests/unit/c/test-fss-nest_increase.c | 76 +++++++++ .../f_fss/tests/unit/c/test-fss-nest_increase.h | 34 ++++ .../f_fss/tests/unit/c/test-fss-nest_increase_by.c | 76 +++++++++ .../f_fss/tests/unit/c/test-fss-nest_increase_by.h | 34 ++++ level_0/f_fss/tests/unit/c/test-fss-nest_resize.c | 42 +++++ level_0/f_fss/tests/unit/c/test-fss-nest_resize.h | 27 ++++ level_0/f_fss/tests/unit/c/test-fss-nests_adjust.c | 42 +++++ level_0/f_fss/tests/unit/c/test-fss-nests_adjust.h | 27 ++++ .../tests/unit/c/test-fss-nests_decimate_by.c | 74 +++++++++ .../tests/unit/c/test-fss-nests_decimate_by.h | 34 ++++ .../tests/unit/c/test-fss-nests_decrease_by.c | 74 +++++++++ .../tests/unit/c/test-fss-nests_decrease_by.h | 34 ++++ .../f_fss/tests/unit/c/test-fss-nests_increase.c | 76 +++++++++ .../f_fss/tests/unit/c/test-fss-nests_increase.h | 34 ++++ .../tests/unit/c/test-fss-nests_increase_by.c | 76 +++++++++ .../tests/unit/c/test-fss-nests_increase_by.h | 34 ++++ level_0/f_fss/tests/unit/c/test-fss-nests_resize.c | 42 +++++ level_0/f_fss/tests/unit/c/test-fss-nests_resize.h | 27 ++++ level_0/f_fss/tests/unit/c/test-fss-seek_to_eol.c | 124 ++++++++++++++ level_0/f_fss/tests/unit/c/test-fss-seek_to_eol.h | 34 ++++ level_0/f_fss/tests/unit/c/test-fss-set_adjust.c | 44 +++++ level_0/f_fss/tests/unit/c/test-fss-set_adjust.h | 27 ++++ .../f_fss/tests/unit/c/test-fss-set_decimate_by.c | 77 +++++++++ .../f_fss/tests/unit/c/test-fss-set_decimate_by.h | 34 ++++ .../f_fss/tests/unit/c/test-fss-set_decrease_by.c | 77 +++++++++ .../f_fss/tests/unit/c/test-fss-set_decrease_by.h | 34 ++++ level_0/f_fss/tests/unit/c/test-fss-set_increase.c | 80 +++++++++ level_0/f_fss/tests/unit/c/test-fss-set_increase.h | 34 ++++ .../f_fss/tests/unit/c/test-fss-set_increase_by.c | 80 +++++++++ .../f_fss/tests/unit/c/test-fss-set_increase_by.h | 34 ++++ .../f_fss/tests/unit/c/test-fss-set_quote_adjust.c | 60 +++++++ .../f_fss/tests/unit/c/test-fss-set_quote_adjust.h | 27 ++++ .../tests/unit/c/test-fss-set_quote_decimate_by.c | 113 +++++++++++++ .../tests/unit/c/test-fss-set_quote_decimate_by.h | 34 ++++ .../tests/unit/c/test-fss-set_quote_decrease_by.c | 113 +++++++++++++ .../tests/unit/c/test-fss-set_quote_decrease_by.h | 34 ++++ .../tests/unit/c/test-fss-set_quote_increase.c | 118 ++++++++++++++ .../tests/unit/c/test-fss-set_quote_increase.h | 34 ++++ .../tests/unit/c/test-fss-set_quote_increase_by.c | 118 ++++++++++++++ .../tests/unit/c/test-fss-set_quote_increase_by.h | 34 ++++ .../f_fss/tests/unit/c/test-fss-set_quote_resize.c | 60 +++++++ .../f_fss/tests/unit/c/test-fss-set_quote_resize.h | 27 ++++ .../tests/unit/c/test-fss-set_quotes_adjust.c | 42 +++++ .../tests/unit/c/test-fss-set_quotes_adjust.h | 27 ++++ .../tests/unit/c/test-fss-set_quotes_decimate_by.c | 61 +++++++ .../tests/unit/c/test-fss-set_quotes_decimate_by.h | 34 ++++ .../tests/unit/c/test-fss-set_quotes_decrease_by.c | 74 +++++++++ .../tests/unit/c/test-fss-set_quotes_decrease_by.h | 34 ++++ .../tests/unit/c/test-fss-set_quotes_increase.c | 76 +++++++++ .../tests/unit/c/test-fss-set_quotes_increase.h | 34 ++++ .../tests/unit/c/test-fss-set_quotes_increase_by.c | 76 +++++++++ .../tests/unit/c/test-fss-set_quotes_increase_by.h | 34 ++++ .../tests/unit/c/test-fss-set_quotes_resize.c | 42 +++++ .../tests/unit/c/test-fss-set_quotes_resize.h | 27 ++++ level_0/f_fss/tests/unit/c/test-fss-set_resize.c | 48 ++++++ level_0/f_fss/tests/unit/c/test-fss-set_resize.h | 27 ++++ level_0/f_fss/tests/unit/c/test-fss-sets_adjust.c | 42 +++++ level_0/f_fss/tests/unit/c/test-fss-sets_adjust.h | 27 ++++ .../f_fss/tests/unit/c/test-fss-sets_decimate_by.c | 74 +++++++++ .../f_fss/tests/unit/c/test-fss-sets_decimate_by.h | 34 ++++ .../f_fss/tests/unit/c/test-fss-sets_decrease_by.c | 74 +++++++++ .../f_fss/tests/unit/c/test-fss-sets_decrease_by.h | 34 ++++ .../f_fss/tests/unit/c/test-fss-sets_increase.c | 76 +++++++++ .../f_fss/tests/unit/c/test-fss-sets_increase.h | 34 ++++ .../f_fss/tests/unit/c/test-fss-sets_increase_by.c | 76 +++++++++ .../f_fss/tests/unit/c/test-fss-sets_increase_by.h | 34 ++++ level_0/f_fss/tests/unit/c/test-fss-sets_resize.c | 42 +++++ level_0/f_fss/tests/unit/c/test-fss-sets_resize.h | 27 ++++ .../tests/unit/c/test-fss-skip_past_delimit.c | 89 +++++++++++ .../tests/unit/c/test-fss-skip_past_delimit.h | 34 ++++ .../f_fss/tests/unit/c/test-fss-skip_past_space.c | 95 +++++++++++ .../f_fss/tests/unit/c/test-fss-skip_past_space.h | 34 ++++ level_0/f_fss/tests/unit/c/test-fss.c | 178 +++++++++++++++++++++ level_0/f_fss/tests/unit/c/test-fss.h | 138 ++++++++++++++++ 141 files changed, 7657 insertions(+) create mode 100644 level_0/f_fss/data/build/settings-mocks create mode 100644 level_0/f_fss/data/build/settings-tests create mode 100644 level_0/f_fss/data/build/testfile create mode 100644 level_0/f_fss/tests/unit/c/mock-fss.c create mode 100644 level_0/f_fss/tests/unit/c/mock-fss.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-apply_delimit.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-apply_delimit.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-apply_delimit_range.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-apply_delimit_range.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-count_lines.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-count_lines.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-count_lines_range.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-count_lines_range.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-fail_utf.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-fail_utf.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-fail_utf_to_false.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-fail_utf_to_false.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-is_combining.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-is_combining.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-is_graph.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-is_graph.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-is_space.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-is_space.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-is_zero_width.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-is_zero_width.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-items_adjust.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-items_adjust.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-items_decimate_by.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-items_decimate_by.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-items_decrease_by.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-items_decrease_by.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-items_increase.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-items_increase.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-items_increase_by.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-items_increase_by.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-items_resize.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-items_resize.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-named_adjust.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-named_adjust.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-named_decimate_by.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-named_decimate_by.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-named_decrease_by.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-named_decrease_by.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-named_increase.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-named_increase.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-named_increase_by.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-named_increase_by.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-named_resize.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-named_resize.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-nameds_adjust.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-nameds_adjust.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-nameds_decimate_by.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-nameds_decimate_by.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-nameds_decrease_by.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-nameds_decrease_by.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-nameds_increase.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-nameds_increase.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-nameds_increase_by.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-nameds_increase_by.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-nameds_resize.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-nameds_resize.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-nest_adjust.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-nest_adjust.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-nest_decimate_by.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-nest_decimate_by.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-nest_decrease_by.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-nest_decrease_by.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-nest_increase.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-nest_increase.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-nest_increase_by.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-nest_increase_by.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-nest_resize.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-nest_resize.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-nests_adjust.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-nests_adjust.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-nests_decimate_by.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-nests_decimate_by.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-nests_decrease_by.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-nests_decrease_by.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-nests_increase.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-nests_increase.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-nests_increase_by.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-nests_increase_by.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-nests_resize.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-nests_resize.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-seek_to_eol.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-seek_to_eol.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-set_adjust.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-set_adjust.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-set_decimate_by.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-set_decimate_by.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-set_decrease_by.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-set_decrease_by.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-set_increase.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-set_increase.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-set_increase_by.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-set_increase_by.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-set_quote_adjust.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-set_quote_adjust.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-set_quote_decimate_by.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-set_quote_decimate_by.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-set_quote_decrease_by.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-set_quote_decrease_by.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-set_quote_increase.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-set_quote_increase.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-set_quote_increase_by.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-set_quote_increase_by.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-set_quote_resize.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-set_quote_resize.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-set_quotes_adjust.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-set_quotes_adjust.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-set_quotes_decimate_by.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-set_quotes_decimate_by.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-set_quotes_decrease_by.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-set_quotes_decrease_by.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-set_quotes_increase.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-set_quotes_increase.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-set_quotes_increase_by.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-set_quotes_increase_by.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-set_quotes_resize.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-set_quotes_resize.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-set_resize.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-set_resize.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-sets_adjust.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-sets_adjust.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-sets_decimate_by.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-sets_decimate_by.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-sets_decrease_by.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-sets_decrease_by.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-sets_increase.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-sets_increase.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-sets_increase_by.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-sets_increase_by.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-sets_resize.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-sets_resize.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-skip_past_delimit.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-skip_past_delimit.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss-skip_past_space.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss-skip_past_space.h create mode 100644 level_0/f_fss/tests/unit/c/test-fss.c create mode 100644 level_0/f_fss/tests/unit/c/test-fss.h diff --git a/level_0/f_fss/data/build/settings-mocks b/level_0/f_fss/data/build/settings-mocks new file mode 100644 index 0000000..99c4a9b --- /dev/null +++ b/level_0/f_fss/data/build/settings-mocks @@ -0,0 +1,60 @@ +# fss-0001 +# +# Build the project with appropriate mocks linked in via the dynamic linker's "--wrap" functionality. +# +# The -Wl,--wrap does not work across shared files. +# Therefore, this file is a work-around to inject the mocks into the library for testing purposes. +# This should exactly match the "settings" file, except for the additional "-Wl,--wrap" parts and the additional mock source file. +# +# The flags -o0 must be passed to prevent the compiler from optimizing away any functions being mocked (which results in the mock not happening and a real function being called). +# Alternatively, figure out which optimization that is disabled by -o0 and have that specific optimization disabled. +# + +build_name f_fss + +version_major 0 +version_minor 5 +version_micro 9 +version_file micro +version_target minor + +modes individual clang test coverage +modes_default individual test + +build_compiler gcc +build_compiler-clang clang +build_indexer ar +build_indexer_arguments rcs +build_language c + +build_libraries -lc +build_libraries-individual -lf_memory -lf_string -lf_type_array -lf_utf + +build_sources_library fss.c private-fss.c fss/common.c fss/named.c fss/nest.c fss/set.c ../../tests/unit/c/mock-fss.c + +build_sources_headers fss.h fss/comment.h fss/common.h fss/delimit.h fss/named.h fss/nest.h fss/quote.h fss/set.h + +build_script yes +build_shared yes +build_static no + +path_headers fll/level_0 +path_library_script script +path_library_shared shared +path_library_static static + +has_path_standard yes +preserve_path_headers yes + +search_exclusive yes +search_shared yes +search_static yes + +flags -O0 -z now -g -fdiagnostics-color=always -Wno-logical-not-parentheses -Wno-parentheses +flags-clang -Wno-logical-op-parentheses +flags-test -fstack-protector -Wall +flags-coverage --coverage -fprofile-abs-path -fprofile-dir=build/coverage/ + +flags_library -fPIC + +# Inject mocks. diff --git a/level_0/f_fss/data/build/settings-tests b/level_0/f_fss/data/build/settings-tests new file mode 100644 index 0000000..1041c9b --- /dev/null +++ b/level_0/f_fss/data/build/settings-tests @@ -0,0 +1,65 @@ +# fss-0001 +# +# Builds a program that is links to the generated library and is executed to perform tests. +# +# Memory leaks in the test program can be checked for by running valgrind with this executable. +# + +build_name test-f_fss + +version_major 0 +version_minor 5 +version_micro 9 +version_file major +version_target major + +modes individual clang test coverage +modes_default individual test + +build_compiler gcc +build_compiler-clang clang +build_indexer ar +build_indexer_arguments rcs +build_language c + +build_libraries -lc -lcmocka +build_libraries-individual -lf_memory -lf_string -lf_type_array -lf_utf -lf_fss + +build_sources_program test-fss-apply_delimit.c test-fss-apply_delimit_range.c test-fss-count_lines.c test-fss-count_lines_range.c test-fss-fail_utf.c test-fss-fail_utf_to_false.c test-fss-is_combining.c test-fss-is_graph.c test-fss-is_space.c test-fss-is_zero_width.c test-fss-seek_to_eol.c test-fss-skip_past_delimit.c test-fss-skip_past_space.c + +build_sources_program test-fss-items_adjust.c test-fss-items_decimate_by.c test-fss-items_decrease_by.c test-fss-items_increase.c test-fss-items_increase_by.c test-fss-items_resize.c +build_sources_program test-fss-named_adjust.c test-fss-named_decimate_by.c test-fss-named_decrease_by.c test-fss-named_increase.c test-fss-named_increase_by.c test-fss-named_resize.c +build_sources_program test-fss-nameds_adjust.c test-fss-nameds_decimate_by.c test-fss-nameds_decrease_by.c test-fss-nameds_increase.c test-fss-nameds_increase_by.c test-fss-nameds_resize.c +build_sources_program test-fss-nest_adjust.c test-fss-nest_decimate_by.c test-fss-nest_decrease_by.c test-fss-nest_increase.c test-fss-nest_increase_by.c test-fss-nest_resize.c +build_sources_program test-fss-nests_adjust.c test-fss-nests_decimate_by.c test-fss-nests_decrease_by.c test-fss-nests_increase.c test-fss-nests_increase_by.c test-fss-nests_resize.c +build_sources_program test-fss-set_adjust.c test-fss-set_decimate_by.c test-fss-set_decrease_by.c test-fss-set_increase.c test-fss-set_increase_by.c test-fss-set_resize.c +build_sources_program test-fss-set_quote_adjust.c test-fss-set_quote_decimate_by.c test-fss-set_quote_decrease_by.c test-fss-set_quote_increase.c test-fss-set_quote_increase_by.c test-fss-set_quote_resize.c +build_sources_program test-fss-set_quotes_adjust.c test-fss-set_quotes_decimate_by.c test-fss-set_quotes_decrease_by.c test-fss-set_quotes_increase.c test-fss-set_quotes_increase_by.c test-fss-set_quotes_resize.c +build_sources_program test-fss-sets_adjust.c test-fss-sets_decimate_by.c test-fss-sets_decrease_by.c test-fss-sets_increase.c test-fss-sets_increase_by.c test-fss-sets_resize.c + +build_sources_program test-fss.c + +build_script no +build_shared yes +build_static no + +path_headers tests/unit/c +path_sources tests/unit/c + +has_path_standard no +preserve_path_headers yes + +search_exclusive yes +search_shared yes +search_static yes + +defines -Ibuild/includes +defines_static -Lbuild/libraries/static +defines_shared -Lbuild/libraries/shared + +flags -O2 -z now -g -fdiagnostics-color=always -Wno-logical-not-parentheses -Wno-parentheses +flags-clang -Wno-logical-op-parentheses +flags-test -fstack-protector -Wall +flags-coverage -O0 --coverage -fprofile-abs-path -fprofile-dir=build/coverage/ + +flags_program -fPIE diff --git a/level_0/f_fss/data/build/testfile b/level_0/f_fss/data/build/testfile new file mode 100644 index 0000000..0b6db4e --- /dev/null +++ b/level_0/f_fss/data/build/testfile @@ -0,0 +1,55 @@ +# fss-0005 iki-0002 + +settings: + load_build yes + fail exit + + environment LD_LIBRARY_PATH + environment CMOCKA_XML_FILE CMOCKA_MESSAGE_OUTPUT CMOCKA_TEST_ABORT + + # Cmcka is not fully thread-safe, set this to "1" to have cmocka call abort() on a test failure. + #CMOCKA_TEST_ABORT 1 + + # One of: STDOUT, SUBUNIT, TAP, or XML. + #define CMOCKA_MESSAGE_OUTPUT STDOUT + + # When in "XML" output mode, output to this file rather than stdout. + #define CMOCKA_XML_FILE ./out.xml + +main: + build settings individual test + build settings-tests individual test + + operate ld_library_path + + if exists build/programs/shared/test-f_fss + shell build/programs/shared/test-f_fss + + if exists build/programs/static/test-f_fss + shell build/programs/static/test-f_fss + + if not exists build/programs/shared/test-f_fss + and not exists build/programs/static/test-f_fss + operate not_created + +not_created: + print + print 'context:"error"Failed to test due to being unable to find either a shared or static test binary to perform tests. context:"reset"' + + exit failure + +ld_library_path: + if defined environment LD_LIBRARY_PATH + and defined parameter work + define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared:define:"LD_LIBRARY_PATH"' + + else + if defined environment LD_LIBRARY_PATH + define LD_LIBRARY_PATH 'build/libraries/shared:parameter:define:"LD_LIBRARY_PATH"' + + else + if defined parameter work + define LD_LIBRARY_PATH 'build/libraries/shared:parameter:"work:value"libraries/shared' + + else + define LD_LIBRARY_PATH build/libraries/shared diff --git a/level_0/f_fss/tests/unit/c/mock-fss.c b/level_0/f_fss/tests/unit/c/mock-fss.c new file mode 100644 index 0000000..bbdd908 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/mock-fss.c @@ -0,0 +1,25 @@ +#include "mock-fss.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/*int __wrap_getgrgid_r(uid_t uid, struct group *grp, char *buf, size_t buflen, struct group **result) { + + const bool failure = mock_type(bool); + + if (failure) { + errno = mock_type(int); + + return 1; + } + + *grp = *mock_type(struct group *); + *result = mock_type(struct group *); + + return 0; +}*/ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/mock-fss.h b/level_0/f_fss/tests/unit/c/mock-fss.h new file mode 100644 index 0000000..535720f --- /dev/null +++ b/level_0/f_fss/tests/unit/c/mock-fss.h @@ -0,0 +1,37 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the fss project. + */ +#ifndef _MOCK__fss_h +#define _MOCK__fss_h + +// Libc includes. +#include +#include +#include +#include + +// cmocka includes. +#include + +// FLL-0 includes. +#include + +#ifdef __cplusplus +extern "C" { +#endif + +const static int mock_errno_generic = 32767; + +//extern long __wrap_sysconf(int name); + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _MOCK__fss_h diff --git a/level_0/f_fss/tests/unit/c/test-fss-apply_delimit.c b/level_0/f_fss/tests/unit/c/test-fss-apply_delimit.c new file mode 100644 index 0000000..26e98f5 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-apply_delimit.c @@ -0,0 +1,129 @@ +#include "test-fss.h" +#include "test-fss-apply_delimit.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_apply_delimit__parameter_checking(void **state) { + + const f_fss_delimits_t delimits = f_fss_delimits_t_initialize; + f_state_t state_data = f_state_t_initialize; + + { + const f_status_t status = f_fss_apply_delimit(state_data, delimits, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +void test__f_fss_apply_delimit__returns_data_not(void **state) { + + const f_fss_delimits_t delimits = f_fss_delimits_t_initialize; + f_state_t state_data = f_state_t_initialize; + + { + f_string_static_t empty = f_string_static_t_initialize; + + const f_status_t status = f_fss_apply_delimit(state_data, delimits, &empty); + + assert_int_equal(status, F_data_not); + } +} + +void test__f_fss_apply_delimit__works(void **state) { + + f_state_t state_data = f_state_t_initialize; + + f_char_t strings_0[] = "test"; + f_char_t strings_1[] = "test"; + f_char_t strings_2[] = "test"; + f_char_t strings_3[] = "test"; + f_char_t strings_4[] = "test"; + f_char_t strings_5[] = "test"; + f_char_t strings_6[] = "⸙test全test"; + + f_string_static_t tests[] = { + macro_f_string_static_t_initialize(strings_0, 0, 4), + macro_f_string_static_t_initialize(strings_1, 0, 4), + macro_f_string_static_t_initialize(strings_2, 0, 4), + macro_f_string_static_t_initialize(strings_3, 0, 4), + macro_f_string_static_t_initialize(strings_4, 0, 4), + macro_f_string_static_t_initialize(strings_5, 0, 4), + macro_f_string_static_t_initialize(strings_6, 0, 14), + }; + + const f_string_static_t expects[] = { + macro_f_string_static_t_initialize("test", 0, 4), + macro_f_string_static_t_initialize("t\0st", 0, 4), + macro_f_string_static_t_initialize("t\0\0t", 0, 4), + macro_f_string_static_t_initialize("t\0s\0", 0, 4), + macro_f_string_static_t_initialize("\0\0s\0", 0, 4), + macro_f_string_static_t_initialize("\0\0\0\0", 0, 4), + macro_f_string_static_t_initialize("\0\0\0test全\0est", 0, 14), + }; + + f_fss_delimit_t delimits_0[] = { + macro_f_fss_delimit_t_initialize(tests[0].used + 2), + }; + + f_fss_delimit_t delimits_1[] = { + macro_f_fss_delimit_t_initialize(1), + }; + + f_fss_delimit_t delimits_2[] = { + macro_f_fss_delimit_t_initialize(1), + macro_f_fss_delimit_t_initialize(2), + }; + + f_fss_delimit_t delimits_3[] = { + macro_f_fss_delimit_t_initialize(1), + macro_f_fss_delimit_t_initialize(3), + }; + + f_fss_delimit_t delimits_4[] = { + macro_f_fss_delimit_t_initialize(0), + macro_f_fss_delimit_t_initialize(1), + macro_f_fss_delimit_t_initialize(3), + }; + + f_fss_delimit_t delimits_5[] = { + macro_f_fss_delimit_t_initialize(0), + macro_f_fss_delimit_t_initialize(1), + macro_f_fss_delimit_t_initialize(2), + macro_f_fss_delimit_t_initialize(3), + }; + + f_fss_delimit_t delimits_6[] = { + macro_f_fss_delimit_t_initialize(0), + macro_f_fss_delimit_t_initialize(1), + macro_f_fss_delimit_t_initialize(2), + macro_f_fss_delimit_t_initialize(10), + }; + + const f_fss_delimits_t delimitss[] = { + macro_f_fss_delimits_t_initialize(delimits_0, 0, 1), + macro_f_fss_delimits_t_initialize(delimits_1, 0, 1), + macro_f_fss_delimits_t_initialize(delimits_2, 0, 2), + macro_f_fss_delimits_t_initialize(delimits_3, 0, 2), + macro_f_fss_delimits_t_initialize(delimits_4, 0, 3), + macro_f_fss_delimits_t_initialize(delimits_5, 0, 4), + macro_f_fss_delimits_t_initialize(delimits_6, 0, 4), + }; + + for (uint8_t i = 0; i < 7; ++i) { + + const f_status_t status = f_fss_apply_delimit(state_data, delimitss[i], &tests[i]); + + assert_int_equal(status, F_none); + assert_int_equal(tests[i].used, expects[i].used); + + for (uint8_t j = 0; j < tests[i].used; ++j) { + assert_int_equal(tests[i].string[j], expects[i].string[j]); + } // for + } // for +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-apply_delimit.h b/level_0/f_fss/tests/unit/c/test-fss-apply_delimit.h new file mode 100644 index 0000000..fe3b9a4 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-apply_delimit.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test apply delimit in the fss project. + */ +#ifndef _TEST__F_fss__apply_delimit +#define _TEST__F_fss__apply_delimit + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_apply_delimit() + */ +extern void test__f_fss_apply_delimit__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see f_fss_apply_delimit() + */ +extern void test__f_fss_apply_delimit__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_fss_apply_delimit() + */ +extern void test__f_fss_apply_delimit__works(void **state); + +#endif // _TEST__F_fss__apply_delimit diff --git a/level_0/f_fss/tests/unit/c/test-fss-apply_delimit_range.c b/level_0/f_fss/tests/unit/c/test-fss-apply_delimit_range.c new file mode 100644 index 0000000..f1389ea --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-apply_delimit_range.c @@ -0,0 +1,151 @@ +#include "test-fss.h" +#include "test-fss-apply_delimit_range.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_apply_delimit_range__parameter_checking(void **state) { + + const f_fss_delimits_t delimits = f_fss_delimits_t_initialize; + f_state_t state_data = f_state_t_initialize; + const f_string_range_t range = f_string_range_t_initialize; + + { + const f_status_t status = f_fss_apply_delimit_range(state_data, delimits, range, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +void test__f_fss_apply_delimit_range__returns_data_not(void **state) { + + f_string_static_t test = macro_f_string_static_t_initialize("test", 0, 4); + const f_fss_delimits_t delimits = f_fss_delimits_t_initialize; + f_state_t state_data = f_state_t_initialize; + + { + const f_string_range_t range = f_string_range_t_initialize; + f_string_static_t empty = f_string_static_t_initialize; + + const f_status_t status = f_fss_apply_delimit_range(state_data, delimits, range, &empty); + + assert_int_equal(status, F_data_not); + } + + { + const f_string_range_t range = f_string_range_t_initialize; + + const f_status_t status = f_fss_apply_delimit_range(state_data, delimits, range, &test); + + assert_int_equal(status, F_data_not); + } + + { + const f_string_range_t range = macro_f_string_range_t_initialize(0, test.used - 1); + f_string_static_t empty = f_string_static_t_initialize; + + const f_status_t status = f_fss_apply_delimit_range(state_data, delimits, range, &empty); + + assert_int_equal(status, F_data_not); + } +} + +void test__f_fss_apply_delimit_range__works(void **state) { + + f_state_t state_data = f_state_t_initialize; + + f_char_t strings_0[] = "test"; + f_char_t strings_1[] = "test"; + f_char_t strings_2[] = "test"; + f_char_t strings_3[] = "test"; + f_char_t strings_4[] = "test"; + f_char_t strings_5[] = "test"; + f_char_t strings_6[] = "⸙test全test"; + + f_string_static_t tests[] = { + macro_f_string_static_t_initialize(strings_0, 0, 4), + macro_f_string_static_t_initialize(strings_1, 0, 4), + macro_f_string_static_t_initialize(strings_2, 0, 4), + macro_f_string_static_t_initialize(strings_3, 0, 4), + macro_f_string_static_t_initialize(strings_4, 0, 4), + macro_f_string_static_t_initialize(strings_5, 0, 4), + macro_f_string_static_t_initialize(strings_6, 0, 14), + }; + + const f_string_static_t expects[] = { + macro_f_string_static_t_initialize("test", 0, 4), + macro_f_string_static_t_initialize("t\0st", 0, 4), + macro_f_string_static_t_initialize("t\0\0t", 0, 4), + macro_f_string_static_t_initialize("t\0s\0", 0, 4), + macro_f_string_static_t_initialize("\0\0s\0", 0, 4), + macro_f_string_static_t_initialize("\0\0\0\0", 0, 4), + macro_f_string_static_t_initialize("\0\0\0test全\0est", 0, 14), + }; + + f_fss_delimit_t delimits_0[] = { + macro_f_fss_delimit_t_initialize(tests[0].used + 2), + }; + + f_fss_delimit_t delimits_1[] = { + macro_f_fss_delimit_t_initialize(1), + }; + + f_fss_delimit_t delimits_2[] = { + macro_f_fss_delimit_t_initialize(1), + macro_f_fss_delimit_t_initialize(2), + }; + + f_fss_delimit_t delimits_3[] = { + macro_f_fss_delimit_t_initialize(1), + macro_f_fss_delimit_t_initialize(3), + }; + + f_fss_delimit_t delimits_4[] = { + macro_f_fss_delimit_t_initialize(0), + macro_f_fss_delimit_t_initialize(1), + macro_f_fss_delimit_t_initialize(3), + }; + + f_fss_delimit_t delimits_5[] = { + macro_f_fss_delimit_t_initialize(0), + macro_f_fss_delimit_t_initialize(1), + macro_f_fss_delimit_t_initialize(2), + macro_f_fss_delimit_t_initialize(3), + }; + + f_fss_delimit_t delimits_6[] = { + macro_f_fss_delimit_t_initialize(0), + macro_f_fss_delimit_t_initialize(1), + macro_f_fss_delimit_t_initialize(2), + macro_f_fss_delimit_t_initialize(10), + }; + + const f_fss_delimits_t delimitss[] = { + macro_f_fss_delimits_t_initialize(delimits_0, 0, 1), + macro_f_fss_delimits_t_initialize(delimits_1, 0, 1), + macro_f_fss_delimits_t_initialize(delimits_2, 0, 2), + macro_f_fss_delimits_t_initialize(delimits_3, 0, 2), + macro_f_fss_delimits_t_initialize(delimits_4, 0, 3), + macro_f_fss_delimits_t_initialize(delimits_5, 0, 4), + macro_f_fss_delimits_t_initialize(delimits_6, 0, 4), + }; + + for (uint8_t i = 0; i < 7; ++i) { + + const f_string_range_t range = macro_f_string_range_t_initialize(0, tests[i].used - 1); + + const f_status_t status = f_fss_apply_delimit_range(state_data, delimitss[i], range, &tests[i]); + + assert_int_equal(status, F_none); + assert_int_equal(tests[i].used, expects[i].used); + + for (uint8_t j = 0; j < tests[i].used; ++j) { + assert_int_equal(tests[i].string[j], expects[i].string[j]); + } // for + } // for +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-apply_delimit_range.h b/level_0/f_fss/tests/unit/c/test-fss-apply_delimit_range.h new file mode 100644 index 0000000..e0a5e2f --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-apply_delimit_range.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test apply delimit between in the fss project. + */ +#ifndef _TEST__F_fss__apply_delimit_range +#define _TEST__F_fss__apply_delimit_range + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_apply_delimit_range() + */ +extern void test__f_fss_apply_delimit_range__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see f_fss_apply_delimit_range() + */ +extern void test__f_fss_apply_delimit_range__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_fss_apply_delimit_range() + */ +extern void test__f_fss_apply_delimit_range__works(void **state); + +#endif // _TEST__F_fss__apply_delimit_range diff --git a/level_0/f_fss/tests/unit/c/test-fss-count_lines.c b/level_0/f_fss/tests/unit/c/test-fss-count_lines.c new file mode 100644 index 0000000..24751b8 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-count_lines.c @@ -0,0 +1,59 @@ +#include "test-fss.h" +#include "test-fss-count_lines.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_count_lines__parameter_checking(void **state) { + + const f_string_static_t test = macro_f_string_static_t_initialize("test", 0, 4); + f_state_t state_data = f_state_t_initialize; + + { + const f_status_t status = f_fss_count_lines(state_data, test, 0, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +void test__f_fss_count_lines__returns_data_not(void **state) { + + f_state_t state_data = f_state_t_initialize; + + { + f_array_length_t line = 0; + + const f_status_t status = f_fss_count_lines(state_data, f_string_empty_s, 0, &line); + + assert_int_equal(status, F_data_not); + } +} + +void test__f_fss_count_lines__works(void **state) { + + f_state_t state_data = f_state_t_initialize; + + const f_string_static_t buffers[] = { + macro_f_string_static_t_initialize("zero", 0, 4), + macro_f_string_static_t_initialize("one\n", 0, 4), + macro_f_string_static_t_initialize("\ntwo\n", 0, 5), + macro_f_string_static_t_initialize("\nthree\n\n", 0, 8), + macro_f_string_static_t_initialize("\n⸙\nfour\n全\n", 0, 14), + }; + + f_array_length_t line = 0; + f_array_length_t expect = 0; + + for (uint8_t i = 0; i < 5; expect += ++i) { + + const f_status_t status = f_fss_count_lines(state_data, buffers[i], buffers[i].used, &line); + + assert_int_equal(status, F_none); + assert_int_equal(line, expect); + } // for +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-count_lines.h b/level_0/f_fss/tests/unit/c/test-fss-count_lines.h new file mode 100644 index 0000000..df055d3 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-count_lines.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test count lines in the fss project. + */ +#ifndef _TEST__F_fss__count_lines +#define _TEST__F_fss__count_lines + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_count_lines() + */ +extern void test__f_fss_count_lines__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see f_fss_count_lines() + */ +extern void test__f_fss_count_lines__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_fss_count_lines() + */ +extern void test__f_fss_count_lines__works(void **state); + +#endif // _TEST__F_fss__count_lines diff --git a/level_0/f_fss/tests/unit/c/test-fss-count_lines_range.c b/level_0/f_fss/tests/unit/c/test-fss-count_lines_range.c new file mode 100644 index 0000000..49727c5 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-count_lines_range.c @@ -0,0 +1,81 @@ +#include "test-fss.h" +#include "test-fss-count_lines_range.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_count_lines_range__parameter_checking(void **state) { + + f_state_t state_data = f_state_t_initialize; + const f_string_range_t range = f_string_range_t_initialize; + + { + const f_status_t status = f_fss_count_lines_range(state_data, f_string_empty_s, range, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +void test__f_fss_count_lines_range__returns_data_not(void **state) { + + const f_string_static_t test = macro_f_string_static_t_initialize("test", 0, 4); + f_state_t state_data = f_state_t_initialize; + + { + f_array_length_t line = 0; + f_string_range_t range = f_string_range_t_initialize; + + const f_status_t status = f_fss_count_lines_range(state_data, f_string_empty_s, range, &line); + + assert_int_equal(status, F_data_not); + } + + { + f_array_length_t line = 0; + f_string_range_t range = f_string_range_t_initialize; + + const f_status_t status = f_fss_count_lines_range(state_data, test, range, &line); + + assert_int_equal(status, F_data_not); + } + + { + f_array_length_t line = 0; + f_string_range_t range = macro_f_string_range_t_initialize(0, test.used - 1); + + const f_status_t status = f_fss_count_lines_range(state_data, f_string_empty_s, range, &line); + + assert_int_equal(status, F_data_not); + } +} + +void test__f_fss_count_lines_range__works(void **state) { + + f_state_t state_data = f_state_t_initialize; + + const f_string_static_t buffers[] = { + macro_f_string_static_t_initialize("zero", 0, 4), + macro_f_string_static_t_initialize("one\n", 0, 4), + macro_f_string_static_t_initialize("\ntwo\n", 0, 5), + macro_f_string_static_t_initialize("\nthree\n\n", 0, 8), + macro_f_string_static_t_initialize("\n⸙\nfour\n全\n", 0, 14), + }; + + f_array_length_t line = 0; + f_array_length_t expect = 0; + + for (uint8_t i = 0; i < 5; expect += ++i) { + + f_string_range_t range = macro_f_string_range_t_initialize(0, buffers[i].used - 1); + + const f_status_t status = f_fss_count_lines_range(state_data, buffers[i], range, &line); + + assert_int_equal(status, F_none); + assert_int_equal(line, expect); + } // for +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-count_lines_range.h b/level_0/f_fss/tests/unit/c/test-fss-count_lines_range.h new file mode 100644 index 0000000..24c19be --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-count_lines_range.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test count lines range in the fss project. + */ +#ifndef _TEST__F_fss__count_lines_range +#define _TEST__F_fss__count_lines_range + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_count_lines_range() + */ +extern void test__f_fss_count_lines_range__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see f_fss_count_lines_range() + */ +extern void test__f_fss_count_lines_range__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_fss_count_lines_range() + */ +extern void test__f_fss_count_lines_range__works(void **state); + +#endif // _TEST__F_fss__count_lines_range diff --git a/level_0/f_fss/tests/unit/c/test-fss-fail_utf.c b/level_0/f_fss/tests/unit/c/test-fss-fail_utf.c new file mode 100644 index 0000000..d8c652b --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-fail_utf.c @@ -0,0 +1,71 @@ +#include "test-fss.h" +#include "test-fss-fail_utf.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_fail_utf__works_for_error(void **state) { + + f_state_t state_data = f_state_t_initialize; + + { + f_status_t statuss[] = { + F_utf_fragment, + F_complete_not_utf, + F_utf_not, + }; + + uint8_t j = 0; + + for (f_status_t i = 0; i < F_status_code_last; ++i) { + + const f_status_t status = f_fss_fail_utf(state_data, F_status_set_error(i)); + + for (j = 0; j < 3; ++j) { + if (i == statuss[j]) break; + } // for + + if (j == 3) { + assert_int_equal(status, F_status_set_error(i)); + } + else { + assert_int_equal(status, statuss[j]); + } + } // for + } + + state_data.flag |= f_fss_state_flag_utf_fail_on_valid_not_e; + + for (f_status_t i = 0; i < F_status_code_last; ++i) { + + const f_status_t status = f_fss_fail_utf(state_data, F_status_set_error(i)); + + assert_int_equal(status, F_status_set_error(i)); + } // for +} + +void test__f_fss_fail_utf__works_for_no_error(void **state) { + + f_state_t state_data = f_state_t_initialize; + + for (f_status_t i = 0; i < F_status_code_last; ++i) { + + const f_status_t status = f_fss_fail_utf(state_data, i); + + assert_int_equal(status, i); + } // for + + state_data.flag |= f_fss_state_flag_utf_fail_on_valid_not_e; + + for (f_status_t i = 0; i < F_status_code_last; ++i) { + + const f_status_t status = f_fss_fail_utf(state_data, i); + + assert_int_equal(status, i); + } // for +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-fail_utf.h b/level_0/f_fss/tests/unit/c/test-fss-fail_utf.h new file mode 100644 index 0000000..b687004 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-fail_utf.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test fail utf in the fss project. + */ +#ifndef _TEST__F_fss__fail_utf +#define _TEST__F_fss__fail_utf + +/** + * Test that the function works for when error bit is set. + * + * @see f_fss_fail_utf() + */ +extern void test__f_fss_fail_utf__works_for_error(void **state); + +/** + * Test that the function works for when no error bit is set. + * + * @see f_fss_fail_utf() + */ +extern void test__f_fss_fail_utf__works_for_no_error(void **state); + +#endif // _TEST__F_fss__fail_utf diff --git a/level_0/f_fss/tests/unit/c/test-fss-fail_utf_to_false.c b/level_0/f_fss/tests/unit/c/test-fss-fail_utf_to_false.c new file mode 100644 index 0000000..451bc57 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-fail_utf_to_false.c @@ -0,0 +1,71 @@ +#include "test-fss.h" +#include "test-fss-fail_utf_to_false.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_fail_utf_to_false__works_for_error(void **state) { + + f_state_t state_data = f_state_t_initialize; + + { + f_status_t statuss[] = { + F_utf_fragment, + F_complete_not_utf, + F_utf_not, + }; + + uint8_t j = 0; + + for (f_status_t i = 0; i < F_status_code_last; ++i) { + + const f_status_t status = f_fss_fail_utf_to_false(state_data, F_status_set_error(i)); + + for (j = 0; j < 3; ++j) { + if (i == statuss[j]) break; + } // for + + if (j == 3) { + assert_int_equal(status, F_status_set_error(i)); + } + else { + assert_int_equal(status, F_false); + } + } // for + } + + state_data.flag |= f_fss_state_flag_utf_fail_on_valid_not_e; + + for (f_status_t i = 0; i < F_status_code_last; ++i) { + + const f_status_t status = f_fss_fail_utf_to_false(state_data, F_status_set_error(i)); + + assert_int_equal(status, F_status_set_error(i)); + } // for +} + +void test__f_fss_fail_utf_to_false__works_for_no_error(void **state) { + + f_state_t state_data = f_state_t_initialize; + + for (f_status_t i = 0; i < F_status_code_last; ++i) { + + const f_status_t status = f_fss_fail_utf_to_false(state_data, i); + + assert_int_equal(status, i); + } // for + + state_data.flag |= f_fss_state_flag_utf_fail_on_valid_not_e; + + for (f_status_t i = 0; i < F_status_code_last; ++i) { + + const f_status_t status = f_fss_fail_utf_to_false(state_data, i); + + assert_int_equal(status, i); + } // for +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-fail_utf_to_false.h b/level_0/f_fss/tests/unit/c/test-fss-fail_utf_to_false.h new file mode 100644 index 0000000..147857c --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-fail_utf_to_false.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test fail utf to false in the fss project. + */ +#ifndef _TEST__F_fss__fail_utf_to_false +#define _TEST__F_fss__fail_utf_to_false + +/** + * Test that the function works for when error bit is set. + * + * @see f_fss_fail_utf_to_false() + */ +extern void test__f_fss_fail_utf_to_false__works_for_error(void **state); + +/** + * Test that the function works for when no error bit is set. + * + * @see f_fss_fail_utf_to_false() + */ +extern void test__f_fss_fail_utf_to_false__works_for_no_error(void **state); + +#endif // _TEST__F_fss__fail_utf_to_false diff --git a/level_0/f_fss/tests/unit/c/test-fss-is_combining.c b/level_0/f_fss/tests/unit/c/test-fss-is_combining.c new file mode 100644 index 0000000..6088bb0 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-is_combining.c @@ -0,0 +1,92 @@ +#include "test-fss.h" +#include "test-fss-is_combining.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_is_combining__works(void **state) { + + f_state_t state_data = f_state_t_initialize; + + f_string_static_t tests[] = { + macro_f_string_static_t_initialize("\0", 0, 1), + macro_f_string_static_t_initialize("\a", 0, 1), + macro_f_string_static_t_initialize("\t", 0, 1), + macro_f_string_static_t_initialize("\n", 0, 1), + macro_f_string_static_t_initialize(" ", 0, 1), + macro_f_string_static_t_initialize("⸙", 0, 3), + macro_f_string_static_t_initialize("t", 0, 1), + macro_f_string_static_t_initialize("全", 0, 3), + macro_f_string_static_t_initialize("$", 0, 1), + macro_f_string_static_t_initialize(".", 0, 1), + macro_f_string_static_t_initialize(" ́", 0, 3), + }; + + f_status_t expects[] = { + F_false, + F_false, + F_false, + F_false, + F_false, + F_false, + F_false, + F_false, + F_false, + F_false, + F_true, + }; + + // Apply an offset so that the combining character is combining into something inside the quotes rather than the quotes for convenience and code safety. + f_array_length_t offset[] = { + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + }; + + for (f_array_length_t i = 0; i < 11; ++i) { + + const f_string_range_t range = macro_f_string_range_t_initialize(offset[i], tests[i].used - 1); + + const f_status_t status = f_fss_is_combining(state_data, tests[i], range); + + assert_int_equal(status, expects[i]); + } // for + + { + const f_string_range_t range = f_string_range_t_initialize; + + const f_status_t status = f_fss_is_combining(state_data, f_string_empty_s, range); + + assert_int_equal(status, F_false); + } + + { + const f_string_range_t range = macro_f_string_range_t_initialize(0, 2); + + const f_status_t status = f_fss_is_combining(state_data, f_string_empty_s, range); + + assert_int_equal(status, F_false); + } + + { + const f_string_static_t test = macro_f_string_static_t_initialize("test", 0, 4); + const f_string_range_t range = f_string_range_t_initialize; + + const f_status_t status = f_fss_is_combining(state_data, test, range); + + assert_int_equal(status, F_false); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-is_combining.h b/level_0/f_fss/tests/unit/c/test-fss-is_combining.h new file mode 100644 index 0000000..508808c --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-is_combining.h @@ -0,0 +1,20 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test is space in the fss project. + */ +#ifndef _TEST__F_fss__is_combining +#define _TEST__F_fss__is_combining + +/** + * Test that the function works. + * + * @see f_fss_is_combining() + */ +extern void test__f_fss_is_combining__works(void **state); + +#endif // _TEST__F_fss__is_combining diff --git a/level_0/f_fss/tests/unit/c/test-fss-is_graph.c b/level_0/f_fss/tests/unit/c/test-fss-is_graph.c new file mode 100644 index 0000000..703e480 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-is_graph.c @@ -0,0 +1,79 @@ +#include "test-fss.h" +#include "test-fss-is_graph.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_is_graph__works(void **state) { + + f_state_t state_data = f_state_t_initialize; + + f_string_static_t tests[] = { + macro_f_string_static_t_initialize("\0", 0, 1), + macro_f_string_static_t_initialize("\a", 0, 1), + macro_f_string_static_t_initialize("\t", 0, 1), + macro_f_string_static_t_initialize("\n", 0, 1), + macro_f_string_static_t_initialize(" ", 0, 1), + macro_f_string_static_t_initialize("⸙", 0, 3), + macro_f_string_static_t_initialize("t", 0, 1), + macro_f_string_static_t_initialize("全", 0, 3), + macro_f_string_static_t_initialize("$", 0, 1), + macro_f_string_static_t_initialize(".", 0, 1), + macro_f_string_static_t_initialize(" ́", 0, 3), // Space followed by a combining character (U+0020 U+0301). + macro_f_string_static_t_initialize("​", 0, 3), // Zero-width space (U+200B). + }; + + f_status_t expects[] = { + F_false, + F_false, + F_false, + F_false, + F_false, + F_true, + F_true, + F_true, + F_true, + F_true, + F_false, + F_false, + }; + + for (f_array_length_t i = 0; i < 12; ++i) { + + const f_string_range_t range = macro_f_string_range_t_initialize(0, tests[i].used - 1); + + const f_status_t status = f_fss_is_graph(state_data, tests[i], range); + + assert_int_equal(status, expects[i]); + } // for + + { + const f_string_range_t range = f_string_range_t_initialize; + + const f_status_t status = f_fss_is_graph(state_data, f_string_empty_s, range); + + assert_int_equal(status, F_false); + } + + { + const f_string_range_t range = macro_f_string_range_t_initialize(0, 2); + + const f_status_t status = f_fss_is_graph(state_data, f_string_empty_s, range); + + assert_int_equal(status, F_false); + } + + { + const f_string_static_t test = macro_f_string_static_t_initialize("test", 0, 4); + const f_string_range_t range = f_string_range_t_initialize; + + const f_status_t status = f_fss_is_graph(state_data, test, range); + + assert_int_equal(status, F_false); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-is_graph.h b/level_0/f_fss/tests/unit/c/test-fss-is_graph.h new file mode 100644 index 0000000..d22e1e2 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-is_graph.h @@ -0,0 +1,20 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test is graph in the fss project. + */ +#ifndef _TEST__F_fss__is_graph +#define _TEST__F_fss__is_graph + +/** + * Test that the function works. + * + * @see f_fss_is_graph() + */ +extern void test__f_fss_is_graph__works(void **state); + +#endif // _TEST__F_fss__is_graph diff --git a/level_0/f_fss/tests/unit/c/test-fss-is_space.c b/level_0/f_fss/tests/unit/c/test-fss-is_space.c new file mode 100644 index 0000000..7c38e48 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-is_space.c @@ -0,0 +1,79 @@ +#include "test-fss.h" +#include "test-fss-is_space.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_is_space__works(void **state) { + + f_state_t state_data = f_state_t_initialize; + + f_string_static_t tests[] = { + macro_f_string_static_t_initialize("\0", 0, 1), + macro_f_string_static_t_initialize("\a", 0, 1), + macro_f_string_static_t_initialize("\t", 0, 1), + macro_f_string_static_t_initialize("\n", 0, 1), + macro_f_string_static_t_initialize(" ", 0, 1), + macro_f_string_static_t_initialize("⸙", 0, 3), + macro_f_string_static_t_initialize("t", 0, 1), + macro_f_string_static_t_initialize("全", 0, 3), + macro_f_string_static_t_initialize("$", 0, 1), + macro_f_string_static_t_initialize(".", 0, 1), + macro_f_string_static_t_initialize(" ́", 0, 3), // Space followed by a combining character (U+0020 U+0301). + macro_f_string_static_t_initialize("​", 0, 3), // Zero-width space (U+200B). + }; + + f_status_t expects[] = { + F_false, + F_false, + F_true, + F_true, + F_true, + F_false, + F_false, + F_false, + F_false, + F_false, + F_true, + F_false, + }; + + for (f_array_length_t i = 0; i < 12; ++i) { + + const f_string_range_t range = macro_f_string_range_t_initialize(0, tests[i].used - 1); + + const f_status_t status = f_fss_is_space(state_data, tests[i], range); + + assert_int_equal(status, expects[i]); + } // for + + { + const f_string_range_t range = f_string_range_t_initialize; + + const f_status_t status = f_fss_is_space(state_data, f_string_empty_s, range); + + assert_int_equal(status, F_false); + } + + { + const f_string_range_t range = macro_f_string_range_t_initialize(0, 2); + + const f_status_t status = f_fss_is_space(state_data, f_string_empty_s, range); + + assert_int_equal(status, F_false); + } + + { + const f_string_static_t test = macro_f_string_static_t_initialize("test", 0, 4); + const f_string_range_t range = f_string_range_t_initialize; + + const f_status_t status = f_fss_is_space(state_data, test, range); + + assert_int_equal(status, F_false); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-is_space.h b/level_0/f_fss/tests/unit/c/test-fss-is_space.h new file mode 100644 index 0000000..8f16ffc --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-is_space.h @@ -0,0 +1,20 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test is space in the fss project. + */ +#ifndef _TEST__F_fss__is_space +#define _TEST__F_fss__is_space + +/** + * Test that the function works. + * + * @see f_fss_is_space() + */ +extern void test__f_fss_is_space__works(void **state); + +#endif // _TEST__F_fss__is_space diff --git a/level_0/f_fss/tests/unit/c/test-fss-is_zero_width.c b/level_0/f_fss/tests/unit/c/test-fss-is_zero_width.c new file mode 100644 index 0000000..b7a9adc --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-is_zero_width.c @@ -0,0 +1,95 @@ +#include "test-fss.h" +#include "test-fss-is_zero_width.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_is_zero_width__works(void **state) { + + f_state_t state_data = f_state_t_initialize; + + f_string_static_t tests[] = { + macro_f_string_static_t_initialize("\0", 0, 1), + macro_f_string_static_t_initialize("\a", 0, 1), + macro_f_string_static_t_initialize("\t", 0, 1), + macro_f_string_static_t_initialize("\n", 0, 1), + macro_f_string_static_t_initialize(" ", 0, 1), + macro_f_string_static_t_initialize("⸙", 0, 3), + macro_f_string_static_t_initialize("t", 0, 1), + macro_f_string_static_t_initialize("全", 0, 3), + macro_f_string_static_t_initialize("$", 0, 1), + macro_f_string_static_t_initialize(".", 0, 1), + macro_f_string_static_t_initialize(" ́", 0, 3), // Space followed by a combining character (U+0020 U+0301). + macro_f_string_static_t_initialize("​", 0, 3), // Zero-width space (U+200B). + }; + + f_status_t expects[] = { + F_true, + F_true, + F_false, + F_false, + F_false, + F_false, + F_false, + F_false, + F_false, + F_false, + F_false, + F_true, + }; + + // Apply an offset so that the combining character is combining into something inside the quotes rather than the quotes for convenience and code safety. + f_array_length_t offset[] = { + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + }; + + for (f_array_length_t i = 0; i < 12; ++i) { + + const f_string_range_t range = macro_f_string_range_t_initialize(offset[i], tests[i].used - 1); + + const f_status_t status = f_fss_is_zero_width(state_data, tests[i], range); + + assert_int_equal(status, expects[i]); + } // for + + { + const f_string_range_t range = f_string_range_t_initialize; + + const f_status_t status = f_fss_is_zero_width(state_data, f_string_empty_s, range); + + assert_int_equal(status, F_false); + } + + { + const f_string_range_t range = macro_f_string_range_t_initialize(0, 2); + + const f_status_t status = f_fss_is_zero_width(state_data, f_string_empty_s, range); + + assert_int_equal(status, F_false); + } + + { + const f_string_static_t test = macro_f_string_static_t_initialize("test", 0, 4); + const f_string_range_t range = f_string_range_t_initialize; + + const f_status_t status = f_fss_is_zero_width(state_data, test, range); + + assert_int_equal(status, F_false); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-is_zero_width.h b/level_0/f_fss/tests/unit/c/test-fss-is_zero_width.h new file mode 100644 index 0000000..a0b5938 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-is_zero_width.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test is zero width in the fss project. + */ +#ifndef _TEST__F_fss__is_zero_width +#define _TEST__F_fss__is_zero_width + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_is_zero_width() + */ +extern void test__f_fss_is_zero_width__parameter_checking(void **state); + +/** + * Test that the function works. + * + * @see f_fss_is_zero_width() + */ +extern void test__f_fss_is_zero_width__works(void **state); + +#endif // _TEST__F_fss__is_zero_width diff --git a/level_0/f_fss/tests/unit/c/test-fss-items_adjust.c b/level_0/f_fss/tests/unit/c/test-fss-items_adjust.c new file mode 100644 index 0000000..eead9b2 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-items_adjust.c @@ -0,0 +1,42 @@ +#include "test-fss.h" +#include "test-fss-items_adjust.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_items_adjust__parameter_checking(void **state) { + + const int length = 5; + f_fss_items_t data = f_fss_items_t_initialize; + + { + const f_status_t status = f_fss_items_adjust(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_fss_items_adjust__works(void **state) { + + const int length = 5; + f_fss_items_t data = f_fss_items_t_initialize; + + { + const f_status_t status = f_fss_items_adjust(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-items_adjust.h b/level_0/f_fss/tests/unit/c/test-fss-items_adjust.h new file mode 100644 index 0000000..e7a1f37 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-items_adjust.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test items adjust in the fss project. + */ +#ifndef _TEST__F_fss__items_adjust +#define _TEST__F_fss__items_adjust + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_items_adjust() + */ +extern void test__f_fss_items_adjust__parameter_checking(void **state); + +/** + * Test that the function works. + * + * @see f_fss_items_adjust() + */ +extern void test__f_fss_items_adjust__works(void **state); + +#endif // _TEST__F_fss__items_adjust diff --git a/level_0/f_fss/tests/unit/c/test-fss-items_decimate_by.c b/level_0/f_fss/tests/unit/c/test-fss-items_decimate_by.c new file mode 100644 index 0000000..c307ff4 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-items_decimate_by.c @@ -0,0 +1,74 @@ +#include "test-fss.h" +#include "test-fss-items_decimate_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_items_decimate_by__parameter_checking(void **state) { + + const int length = 5; + f_fss_items_t data = f_fss_items_t_initialize; + + { + const f_status_t status = f_fss_items_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_fss_items_decimate_by__returns_data_not(void **state) { + + const int length = 5; + f_fss_items_t data = f_fss_items_t_initialize; + + { + const f_status_t status = f_fss_items_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_fss_items_decimate_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_fss_items_decimate_by__works(void **state) { + + const int length = 5; + f_fss_items_t data = f_fss_items_t_initialize; + + { + const f_status_t status = f_fss_items_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_fss_items_decimate_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-items_decimate_by.h b/level_0/f_fss/tests/unit/c/test-fss-items_decimate_by.h new file mode 100644 index 0000000..1c96109 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-items_decimate_by.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test items decimate by in the fss project. + */ +#ifndef _TEST__F_fss__items_decimate_by +#define _TEST__F_fss__items_decimate_by + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_items_decimate_by() + */ +extern void test__f_fss_items_decimate_by__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see f_fss_items_decimate_by() + */ +extern void test__f_fss_items_decimate_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_fss_items_decimate_by() + */ +extern void test__f_fss_items_decimate_by__works(void **state); + +#endif // _TEST__F_fss__items_decimate_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-items_decrease_by.c b/level_0/f_fss/tests/unit/c/test-fss-items_decrease_by.c new file mode 100644 index 0000000..58e09cd --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-items_decrease_by.c @@ -0,0 +1,74 @@ +#include "test-fss.h" +#include "test-fss-items_decrease_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_items_decrease_by__parameter_checking(void **state) { + + const int length = 5; + f_fss_items_t data = f_fss_items_t_initialize; + + { + const f_status_t status = f_fss_items_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_fss_items_decrease_by__returns_data_not(void **state) { + + const int length = 5; + f_fss_items_t data = f_fss_items_t_initialize; + + { + const f_status_t status = f_fss_items_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_fss_items_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_fss_items_decrease_by__works(void **state) { + + const int length = 5; + f_fss_items_t data = f_fss_items_t_initialize; + + { + const f_status_t status = f_fss_items_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_fss_items_decrease_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-items_decrease_by.h b/level_0/f_fss/tests/unit/c/test-fss-items_decrease_by.h new file mode 100644 index 0000000..20909b7 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-items_decrease_by.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test items decrease by in the fss project. + */ +#ifndef _TEST__F_fss__items_decrease_by +#define _TEST__F_fss__items_decrease_by + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_items_decrease_by() + */ +extern void test__f_fss_items_decrease_by__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see f_fss_items_decrease_by() + */ +extern void test__f_fss_items_decrease_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_fss_items_decrease_by() + */ +extern void test__f_fss_items_decrease_by__works(void **state); + +#endif // _TEST__F_fss__items_decrease_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-items_increase.c b/level_0/f_fss/tests/unit/c/test-fss-items_increase.c new file mode 100644 index 0000000..234533f --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-items_increase.c @@ -0,0 +1,76 @@ +#include "test-fss.h" +#include "test-fss-items_increase.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_items_increase__parameter_checking(void **state) { + + const int length = 5; + f_fss_items_t data = f_fss_items_t_initialize; + + { + const f_status_t status = f_fss_items_increase(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + free((void *) data.array); +} + +void test__f_fss_items_increase__returns_data_not(void **state) { + + const int length = 5; + f_fss_items_t data = f_fss_items_t_initialize; + + { + const f_status_t status = f_fss_items_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_fss_items_increase(length, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_fss_items_increase__works(void **state) { + + const int length = 5; + f_fss_items_t data = f_fss_items_t_initialize; + + { + const f_status_t status = f_fss_items_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_fss_items_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); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-items_increase.h b/level_0/f_fss/tests/unit/c/test-fss-items_increase.h new file mode 100644 index 0000000..5eb0ca3 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-items_increase.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test items increase in the fss project. + */ +#ifndef _TEST__F_fss__items_increase +#define _TEST__F_fss__items_increase + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_items_increase() + */ +extern void test__f_fss_items_increase__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see f_fss_items_increase() + */ +extern void test__f_fss_items_increase__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_fss_items_increase() + */ +extern void test__f_fss_items_increase__works(void **state); + +#endif // _TEST__F_fss__items_increase diff --git a/level_0/f_fss/tests/unit/c/test-fss-items_increase_by.c b/level_0/f_fss/tests/unit/c/test-fss-items_increase_by.c new file mode 100644 index 0000000..4554d9a --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-items_increase_by.c @@ -0,0 +1,76 @@ +#include "test-fss.h" +#include "test-fss-items_increase_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_items_increase_by__parameter_checking(void **state) { + + const int length = 5; + f_fss_items_t data = f_fss_items_t_initialize; + + { + const f_status_t status = f_fss_items_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_fss_items_increase_by__returns_data_not(void **state) { + + const int length = 5; + f_fss_items_t data = f_fss_items_t_initialize; + + { + const f_status_t status = f_fss_items_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_fss_items_increase_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_fss_items_increase_by__works(void **state) { + + const int length = 5; + f_fss_items_t data = f_fss_items_t_initialize; + + { + const f_status_t status = f_fss_items_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_fss_items_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 +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-items_increase_by.h b/level_0/f_fss/tests/unit/c/test-fss-items_increase_by.h new file mode 100644 index 0000000..a2d78a2 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-items_increase_by.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test items increase by in the fss project. + */ +#ifndef _TEST__F_fss__items_increase_by +#define _TEST__F_fss__items_increase_by + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_items_increase_by() + */ +extern void test__f_fss_items_increase_by__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see f_fss_items_increase_by() + */ +extern void test__f_fss_items_increase_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_fss_items_increase_by() + */ +extern void test__f_fss_items_increase_by__works(void **state); + +#endif // _TEST__F_fss__items_increase_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-items_resize.c b/level_0/f_fss/tests/unit/c/test-fss-items_resize.c new file mode 100644 index 0000000..9a080d4 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-items_resize.c @@ -0,0 +1,42 @@ +#include "test-fss.h" +#include "test-fss-items_resize.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_items_resize__parameter_checking(void **state) { + + const int length = 5; + f_fss_items_t data = f_fss_items_t_initialize; + + { + const f_status_t status = f_fss_items_resize(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_fss_items_resize__works(void **state) { + + const int length = 5; + f_fss_items_t data = f_fss_items_t_initialize; + + { + const f_status_t status = f_fss_items_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-items_resize.h b/level_0/f_fss/tests/unit/c/test-fss-items_resize.h new file mode 100644 index 0000000..2b35eb8 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-items_resize.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test items resize in the fss project. + */ +#ifndef _TEST__F_fss__items_resize +#define _TEST__F_fss__items_resize + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_items_resize() + */ +extern void test__f_fss_items_resize__parameter_checking(void **state); + +/** + * Test that the function works. + * + * @see f_fss_items_resize() + */ +extern void test__f_fss_items_resize__works(void **state); + +#endif // _TEST__F_fss__items_resize diff --git a/level_0/f_fss/tests/unit/c/test-fss-named_adjust.c b/level_0/f_fss/tests/unit/c/test-fss-named_adjust.c new file mode 100644 index 0000000..9ed2957 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-named_adjust.c @@ -0,0 +1,54 @@ +#include "test-fss.h" +#include "test-fss-nameds_adjust.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_named_adjust__parameter_checking(void **state) { + + const int length = 5; + f_fss_named_t data = f_fss_named_t_initialize; + + { + const f_status_t status = f_fss_named_adjust(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.objects.size, 0); + assert_int_equal(data.contents.used, 0); + assert_int_equal(data.contents.size, 0); + assert_int_equal(data.quotess.used, 0); + assert_int_equal(data.quotess.size, 0); + } + + assert_null(data.objects.array); + assert_null(data.contents.array); + assert_null(data.quotess.array); +} + +void test__f_fss_named_adjust__works(void **state) { + + const int length = 5; + f_fss_named_t data = f_fss_named_t_initialize; + + { + const f_status_t status = f_fss_named_adjust(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.objects.size, length); + assert_int_equal(data.contents.used, 0); + assert_int_equal(data.contents.size, length); + assert_int_equal(data.quotess.used, 0); + assert_int_equal(data.quotess.size, length); + } + + free((void *) data.objects.array); + free((void *) data.contents.array); + free((void *) data.quotess.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-named_adjust.h b/level_0/f_fss/tests/unit/c/test-fss-named_adjust.h new file mode 100644 index 0000000..060bc25 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-named_adjust.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test named adjust in the fss project. + */ +#ifndef _TEST__F_fss__named_adjust +#define _TEST__F_fss__named_adjust + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_named_adjust() + */ +extern void test__f_fss_named_adjust__parameter_checking(void **state); + +/** + * Test that the function works. + * + * @see f_fss_named_adjust() + */ +extern void test__f_fss_named_adjust__works(void **state); + +#endif // _TEST__F_fss__named_adjust diff --git a/level_0/f_fss/tests/unit/c/test-fss-named_decimate_by.c b/level_0/f_fss/tests/unit/c/test-fss-named_decimate_by.c new file mode 100644 index 0000000..7da3d0e --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-named_decimate_by.c @@ -0,0 +1,100 @@ +#include "test-fss.h" +#include "test-fss-nameds_decimate_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_named_decimate_by__parameter_checking(void **state) { + + const int length = 5; + f_fss_named_t data = f_fss_named_t_initialize; + + { + const f_status_t status = f_fss_named_decimate_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.objects.size, 0); + assert_int_equal(data.contents.used, 0); + assert_int_equal(data.contents.size, 0); + assert_int_equal(data.quotess.used, 0); + assert_int_equal(data.quotess.size, 0); + } + + assert_null(data.objects.array); + assert_null(data.contents.array); + assert_null(data.quotess.array); +} + +void test__f_fss_named_decimate_by__returns_data_not(void **state) { + + const int length = 5; + f_fss_named_t data = f_fss_named_t_initialize; + + { + const f_status_t status = f_fss_named_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.objects.size, length); + assert_int_equal(data.contents.used, 0); + assert_int_equal(data.contents.size, length); + assert_int_equal(data.quotess.used, 0); + assert_int_equal(data.quotess.size, length); + } + + { + const f_status_t status = f_fss_named_decimate_by(0, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.objects.size, length); + assert_int_equal(data.contents.used, 0); + assert_int_equal(data.contents.size, length); + assert_int_equal(data.quotess.used, 0); + assert_int_equal(data.quotess.size, length); + } + + free((void *) data.objects.array); + free((void *) data.contents.array); + free((void *) data.quotess.array); +} + +void test__f_fss_named_decimate_by__works(void **state) { + + const int length = 5; + f_fss_named_t data = f_fss_named_t_initialize; + + { + const f_status_t status = f_fss_named_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.objects.size, length); + assert_int_equal(data.contents.used, 0); + assert_int_equal(data.contents.size, length); + assert_int_equal(data.quotess.used, 0); + assert_int_equal(data.quotess.size, length); + } + + { + const f_status_t status = f_fss_named_decimate_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.objects.size, 0); + assert_int_equal(data.contents.used, 0); + assert_int_equal(data.contents.size, 0); + assert_int_equal(data.quotess.used, 0); + assert_int_equal(data.quotess.size, 0); + } + + assert_null(data.objects.array); + assert_null(data.contents.array); + assert_null(data.quotess.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-named_decimate_by.h b/level_0/f_fss/tests/unit/c/test-fss-named_decimate_by.h new file mode 100644 index 0000000..4203879 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-named_decimate_by.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test named decimate by in the fss project. + */ +#ifndef _TEST__F_fss__named_decimate_by +#define _TEST__F_fss__named_decimate_by + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_named_decimate_by() + */ +extern void test__f_fss_named_decimate_by__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see f_fss_named_decimate_by() + */ +extern void test__f_fss_named_decimate_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_fss_named_decimate_by() + */ +extern void test__f_fss_named_decimate_by__works(void **state); + +#endif // _TEST__F_fss__named_decimate_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-named_decrease_by.c b/level_0/f_fss/tests/unit/c/test-fss-named_decrease_by.c new file mode 100644 index 0000000..1678c12 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-named_decrease_by.c @@ -0,0 +1,100 @@ +#include "test-fss.h" +#include "test-fss-nameds_decrease_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_named_decrease_by__parameter_checking(void **state) { + + const int length = 5; + f_fss_named_t data = f_fss_named_t_initialize; + + { + const f_status_t status = f_fss_named_decrease_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.objects.size, 0); + assert_int_equal(data.contents.used, 0); + assert_int_equal(data.contents.size, 0); + assert_int_equal(data.quotess.used, 0); + assert_int_equal(data.quotess.size, 0); + } + + assert_null(data.objects.array); + assert_null(data.contents.array); + assert_null(data.quotess.array); +} + +void test__f_fss_named_decrease_by__returns_data_not(void **state) { + + const int length = 5; + f_fss_named_t data = f_fss_named_t_initialize; + + { + const f_status_t status = f_fss_named_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.objects.size, length); + assert_int_equal(data.contents.used, 0); + assert_int_equal(data.contents.size, length); + assert_int_equal(data.quotess.used, 0); + assert_int_equal(data.quotess.size, length); + } + + { + const f_status_t status = f_fss_named_decrease_by(0, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.objects.size, length); + assert_int_equal(data.contents.used, 0); + assert_int_equal(data.contents.size, length); + assert_int_equal(data.quotess.used, 0); + assert_int_equal(data.quotess.size, length); + } + + free((void *) data.objects.array); + free((void *) data.contents.array); + free((void *) data.quotess.array); +} + +void test__f_fss_named_decrease_by__works(void **state) { + + const int length = 5; + f_fss_named_t data = f_fss_named_t_initialize; + + { + const f_status_t status = f_fss_named_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.objects.size, length); + assert_int_equal(data.contents.used, 0); + assert_int_equal(data.contents.size, length); + assert_int_equal(data.quotess.used, 0); + assert_int_equal(data.quotess.size, length); + } + + { + const f_status_t status = f_fss_named_decrease_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.objects.size, 0); + assert_int_equal(data.contents.used, 0); + assert_int_equal(data.contents.size, 0); + assert_int_equal(data.quotess.used, 0); + assert_int_equal(data.quotess.size, 0); + } + + assert_null(data.objects.array); + assert_null(data.contents.array); + assert_null(data.quotess.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-named_decrease_by.h b/level_0/f_fss/tests/unit/c/test-fss-named_decrease_by.h new file mode 100644 index 0000000..91def30 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-named_decrease_by.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test named decrease by in the fss project. + */ +#ifndef _TEST__F_fss__named_decrease_by +#define _TEST__F_fss__named_decrease_by + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_named_decrease_by() + */ +extern void test__f_fss_named_decrease_by__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see f_fss_named_decrease_by() + */ +extern void test__f_fss_named_decrease_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_fss_named_decrease_by() + */ +extern void test__f_fss_named_decrease_by__works(void **state); + +#endif // _TEST__F_fss__named_decrease_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-named_increase.c b/level_0/f_fss/tests/unit/c/test-fss-named_increase.c new file mode 100644 index 0000000..a018b2d --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-named_increase.c @@ -0,0 +1,104 @@ +#include "test-fss.h" +#include "test-fss-nameds_increase.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_named_increase__parameter_checking(void **state) { + + const int length = 5; + f_fss_named_t data = f_fss_named_t_initialize; + + { + const f_status_t status = f_fss_named_increase(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.objects.size, 0); + assert_int_equal(data.contents.used, 0); + assert_int_equal(data.contents.size, 0); + assert_int_equal(data.quotess.used, 0); + assert_int_equal(data.quotess.size, 0); + } + + free((void *) data.objects.array); + free((void *) data.contents.array); + free((void *) data.quotess.array); +} + +void test__f_fss_named_increase__returns_data_not(void **state) { + + const int length = 5; + f_fss_named_t data = f_fss_named_t_initialize; + + { + const f_status_t status = f_fss_named_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.objects.size, length); + assert_int_equal(data.contents.used, 0); + assert_int_equal(data.contents.size, length); + assert_int_equal(data.quotess.used, 0); + assert_int_equal(data.quotess.size, length); + } + + { + const f_status_t status = f_fss_named_increase(length, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.objects.size, length); + assert_int_equal(data.contents.used, 0); + assert_int_equal(data.contents.size, length); + assert_int_equal(data.quotess.used, 0); + assert_int_equal(data.quotess.size, length); + } + + free((void *) data.objects.array); + free((void *) data.contents.array); + free((void *) data.quotess.array); +} + +void test__f_fss_named_increase__works(void **state) { + + const int length = 5; + f_fss_named_t data = f_fss_named_t_initialize; + + { + const f_status_t status = f_fss_named_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.objects.size, length); + assert_int_equal(data.contents.used, 0); + assert_int_equal(data.contents.size, length); + assert_int_equal(data.quotess.used, 0); + assert_int_equal(data.quotess.size, length); + } + + { + data.objects.used = length; + data.contents.used = length; + data.quotess.used = length; + + const f_status_t status = f_fss_named_increase(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.objects.used, length); + assert_in_range(data.objects.size, length + 1, length + 1 + F_memory_default_allocation_small_d); + assert_int_equal(data.contents.used, length); + assert_in_range(data.contents.size, length + 1, length + 1 + F_memory_default_allocation_small_d); + assert_int_equal(data.quotess.used, length); + assert_in_range(data.quotess.size, length + 1, length + 1 + F_memory_default_allocation_small_d); + } + + free((void *) data.objects.array); + free((void *) data.contents.array); + free((void *) data.quotess.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-named_increase.h b/level_0/f_fss/tests/unit/c/test-fss-named_increase.h new file mode 100644 index 0000000..4565890 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-named_increase.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test named increase in the fss project. + */ +#ifndef _TEST__F_fss__named_increase +#define _TEST__F_fss__named_increase + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_named_increase() + */ +extern void test__f_fss_named_increase__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see f_fss_named_increase() + */ +extern void test__f_fss_named_increase__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_fss_named_increase() + */ +extern void test__f_fss_named_increase__works(void **state); + +#endif // _TEST__F_fss__named_increase diff --git a/level_0/f_fss/tests/unit/c/test-fss-named_increase_by.c b/level_0/f_fss/tests/unit/c/test-fss-named_increase_by.c new file mode 100644 index 0000000..1fa48db --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-named_increase_by.c @@ -0,0 +1,104 @@ +#include "test-fss.h" +#include "test-fss-nameds_increase_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_named_increase_by__parameter_checking(void **state) { + + const int length = 5; + f_fss_named_t data = f_fss_named_t_initialize; + + { + const f_status_t status = f_fss_named_increase_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.objects.size, 0); + assert_int_equal(data.contents.used, 0); + assert_int_equal(data.contents.size, 0); + assert_int_equal(data.quotess.used, 0); + assert_int_equal(data.quotess.size, 0); + } + + assert_null(data.objects.array); + assert_null(data.contents.array); + assert_null(data.quotess.array); +} + +void test__f_fss_named_increase_by__returns_data_not(void **state) { + + const int length = 5; + f_fss_named_t data = f_fss_named_t_initialize; + + { + const f_status_t status = f_fss_named_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.objects.size, length); + assert_int_equal(data.contents.used, 0); + assert_int_equal(data.contents.size, length); + assert_int_equal(data.quotess.used, 0); + assert_int_equal(data.quotess.size, length); + } + + { + const f_status_t status = f_fss_named_decimate_by(0, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.objects.size, length); + assert_int_equal(data.contents.used, 0); + assert_int_equal(data.contents.size, length); + assert_int_equal(data.quotess.used, 0); + assert_int_equal(data.quotess.size, length); + } + + free((void *) data.objects.array); + free((void *) data.contents.array); + free((void *) data.quotess.array); +} + +void test__f_fss_named_increase_by__works(void **state) { + + const int length = 5; + f_fss_named_t data = f_fss_named_t_initialize; + + { + const f_status_t status = f_fss_named_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.objects.size, length); + assert_int_equal(data.contents.used, 0); + assert_int_equal(data.contents.size, length); + assert_int_equal(data.quotess.used, 0); + assert_int_equal(data.quotess.size, length); + } + + { + data.objects.used = length; + data.contents.used = length; + data.quotess.used = length; + + const f_status_t status = f_fss_named_increase_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.objects.used, length); + assert_int_equal(data.objects.size, length * 2); + assert_int_equal(data.contents.used, length); + assert_int_equal(data.contents.size, length * 2); + assert_int_equal(data.quotess.used, length); + assert_int_equal(data.quotess.size, length * 2); + } + + free((void *) data.objects.array); + free((void *) data.contents.array); + free((void *) data.quotess.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-named_increase_by.h b/level_0/f_fss/tests/unit/c/test-fss-named_increase_by.h new file mode 100644 index 0000000..cafbcf8 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-named_increase_by.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test named increase by in the fss project. + */ +#ifndef _TEST__F_fss__named_increase_by +#define _TEST__F_fss__named_increase_by + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_named_increase_by() + */ +extern void test__f_fss_named_increase_by__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see f_fss_named_increase_by() + */ +extern void test__f_fss_named_increase_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_fss_named_increase_by() + */ +extern void test__f_fss_named_increase_by__works(void **state); + +#endif // _TEST__F_fss__named_increase_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-named_resize.c b/level_0/f_fss/tests/unit/c/test-fss-named_resize.c new file mode 100644 index 0000000..3ce2f05 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-named_resize.c @@ -0,0 +1,54 @@ +#include "test-fss.h" +#include "test-fss-nameds_resize.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_named_resize__parameter_checking(void **state) { + + const int length = 5; + f_fss_named_t data = f_fss_named_t_initialize; + + { + const f_status_t status = f_fss_named_resize(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.objects.size, 0); + assert_int_equal(data.contents.used, 0); + assert_int_equal(data.contents.size, 0); + assert_int_equal(data.quotess.used, 0); + assert_int_equal(data.quotess.size, 0); + } + + assert_null(data.objects.array); + assert_null(data.contents.array); + assert_null(data.quotess.array); +} + +void test__f_fss_named_resize__works(void **state) { + + const int length = 5; + f_fss_named_t data = f_fss_named_t_initialize; + + { + const f_status_t status = f_fss_named_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.objects.size, length); + assert_int_equal(data.contents.used, 0); + assert_int_equal(data.contents.size, length); + assert_int_equal(data.quotess.used, 0); + assert_int_equal(data.quotess.size, length); + } + + free((void *) data.objects.array); + free((void *) data.contents.array); + free((void *) data.quotess.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-named_resize.h b/level_0/f_fss/tests/unit/c/test-fss-named_resize.h new file mode 100644 index 0000000..208885c --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-named_resize.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test named resize in the fss project. + */ +#ifndef _TEST__F_fss__named_resize +#define _TEST__F_fss__named_resize + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_named_resize() + */ +extern void test__f_fss_named_resize__parameter_checking(void **state); + +/** + * Test that the function works. + * + * @see f_fss_named_resize() + */ +extern void test__f_fss_named_resize__works(void **state); + +#endif // _TEST__F_fss__named_resize diff --git a/level_0/f_fss/tests/unit/c/test-fss-nameds_adjust.c b/level_0/f_fss/tests/unit/c/test-fss-nameds_adjust.c new file mode 100644 index 0000000..38b7cbd --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-nameds_adjust.c @@ -0,0 +1,42 @@ +#include "test-fss.h" +#include "test-fss-nameds_adjust.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_nameds_adjust__parameter_checking(void **state) { + + const int length = 5; + f_fss_nameds_t data = f_fss_nameds_t_initialize; + + { + const f_status_t status = f_fss_nameds_adjust(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_fss_nameds_adjust__works(void **state) { + + const int length = 5; + f_fss_nameds_t data = f_fss_nameds_t_initialize; + + { + const f_status_t status = f_fss_nameds_adjust(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-nameds_adjust.h b/level_0/f_fss/tests/unit/c/test-fss-nameds_adjust.h new file mode 100644 index 0000000..f54c704 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-nameds_adjust.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test nameds adjust in the fss project. + */ +#ifndef _TEST__F_fss__nameds_adjust +#define _TEST__F_fss__nameds_adjust + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_nameds_adjust() + */ +extern void test__f_fss_nameds_adjust__parameter_checking(void **state); + +/** + * Test that the function works. + * + * @see f_fss_nameds_adjust() + */ +extern void test__f_fss_nameds_adjust__works(void **state); + +#endif // _TEST__F_fss__nameds_adjust diff --git a/level_0/f_fss/tests/unit/c/test-fss-nameds_decimate_by.c b/level_0/f_fss/tests/unit/c/test-fss-nameds_decimate_by.c new file mode 100644 index 0000000..08ea159 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-nameds_decimate_by.c @@ -0,0 +1,74 @@ +#include "test-fss.h" +#include "test-fss-nameds_decimate_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_nameds_decimate_by__parameter_checking(void **state) { + + const int length = 5; + f_fss_nameds_t data = f_fss_nameds_t_initialize; + + { + const f_status_t status = f_fss_nameds_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_fss_nameds_decimate_by__returns_data_not(void **state) { + + const int length = 5; + f_fss_nameds_t data = f_fss_nameds_t_initialize; + + { + const f_status_t status = f_fss_nameds_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_fss_nameds_decimate_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_fss_nameds_decimate_by__works(void **state) { + + const int length = 5; + f_fss_nameds_t data = f_fss_nameds_t_initialize; + + { + const f_status_t status = f_fss_nameds_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_fss_nameds_decimate_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-nameds_decimate_by.h b/level_0/f_fss/tests/unit/c/test-fss-nameds_decimate_by.h new file mode 100644 index 0000000..62e7923 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-nameds_decimate_by.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test nameds decimate by in the fss project. + */ +#ifndef _TEST__F_fss__nameds_decimate_by +#define _TEST__F_fss__nameds_decimate_by + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_nameds_decimate_by() + */ +extern void test__f_fss_nameds_decimate_by__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see f_fss_nameds_decimate_by() + */ +extern void test__f_fss_nameds_decimate_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_fss_nameds_decimate_by() + */ +extern void test__f_fss_nameds_decimate_by__works(void **state); + +#endif // _TEST__F_fss__nameds_decimate_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-nameds_decrease_by.c b/level_0/f_fss/tests/unit/c/test-fss-nameds_decrease_by.c new file mode 100644 index 0000000..d7a70da --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-nameds_decrease_by.c @@ -0,0 +1,74 @@ +#include "test-fss.h" +#include "test-fss-nameds_decrease_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_nameds_decrease_by__parameter_checking(void **state) { + + const int length = 5; + f_fss_nameds_t data = f_fss_nameds_t_initialize; + + { + const f_status_t status = f_fss_nameds_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_fss_nameds_decrease_by__returns_data_not(void **state) { + + const int length = 5; + f_fss_nameds_t data = f_fss_nameds_t_initialize; + + { + const f_status_t status = f_fss_nameds_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_fss_nameds_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_fss_nameds_decrease_by__works(void **state) { + + const int length = 5; + f_fss_nameds_t data = f_fss_nameds_t_initialize; + + { + const f_status_t status = f_fss_nameds_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_fss_nameds_decrease_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-nameds_decrease_by.h b/level_0/f_fss/tests/unit/c/test-fss-nameds_decrease_by.h new file mode 100644 index 0000000..03a5161 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-nameds_decrease_by.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test nameds decrease by in the fss project. + */ +#ifndef _TEST__F_fss__nameds_decrease_by +#define _TEST__F_fss__nameds_decrease_by + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_nameds_decrease_by() + */ +extern void test__f_fss_nameds_decrease_by__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see f_fss_nameds_decrease_by() + */ +extern void test__f_fss_nameds_decrease_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_fss_nameds_decrease_by() + */ +extern void test__f_fss_nameds_decrease_by__works(void **state); + +#endif // _TEST__F_fss__nameds_decrease_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-nameds_increase.c b/level_0/f_fss/tests/unit/c/test-fss-nameds_increase.c new file mode 100644 index 0000000..4884436 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-nameds_increase.c @@ -0,0 +1,76 @@ +#include "test-fss.h" +#include "test-fss-nameds_increase.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_nameds_increase__parameter_checking(void **state) { + + const int length = 5; + f_fss_nameds_t data = f_fss_nameds_t_initialize; + + { + const f_status_t status = f_fss_nameds_increase(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + free((void *) data.array); +} + +void test__f_fss_nameds_increase__returns_data_not(void **state) { + + const int length = 5; + f_fss_nameds_t data = f_fss_nameds_t_initialize; + + { + const f_status_t status = f_fss_nameds_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_fss_nameds_increase(length, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_fss_nameds_increase__works(void **state) { + + const int length = 5; + f_fss_nameds_t data = f_fss_nameds_t_initialize; + + { + const f_status_t status = f_fss_nameds_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_fss_nameds_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); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-nameds_increase.h b/level_0/f_fss/tests/unit/c/test-fss-nameds_increase.h new file mode 100644 index 0000000..4c4fdcc --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-nameds_increase.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test nameds increase in the fss project. + */ +#ifndef _TEST__F_fss__nameds_increase +#define _TEST__F_fss__nameds_increase + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_nameds_increase() + */ +extern void test__f_fss_nameds_increase__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see f_fss_nameds_increase() + */ +extern void test__f_fss_nameds_increase__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_fss_nameds_increase() + */ +extern void test__f_fss_nameds_increase__works(void **state); + +#endif // _TEST__F_fss__nameds_increase diff --git a/level_0/f_fss/tests/unit/c/test-fss-nameds_increase_by.c b/level_0/f_fss/tests/unit/c/test-fss-nameds_increase_by.c new file mode 100644 index 0000000..594f3fe --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-nameds_increase_by.c @@ -0,0 +1,76 @@ +#include "test-fss.h" +#include "test-fss-nameds_increase_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_nameds_increase_by__parameter_checking(void **state) { + + const int length = 5; + f_fss_nameds_t data = f_fss_nameds_t_initialize; + + { + const f_status_t status = f_fss_nameds_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_fss_nameds_increase_by__returns_data_not(void **state) { + + const int length = 5; + f_fss_nameds_t data = f_fss_nameds_t_initialize; + + { + const f_status_t status = f_fss_nameds_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_fss_nameds_increase_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_fss_nameds_increase_by__works(void **state) { + + const int length = 5; + f_fss_nameds_t data = f_fss_nameds_t_initialize; + + { + const f_status_t status = f_fss_nameds_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_fss_nameds_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 +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-nameds_increase_by.h b/level_0/f_fss/tests/unit/c/test-fss-nameds_increase_by.h new file mode 100644 index 0000000..94164da --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-nameds_increase_by.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test nameds increase by in the fss project. + */ +#ifndef _TEST__F_fss__nameds_increase_by +#define _TEST__F_fss__nameds_increase_by + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_nameds_increase_by() + */ +extern void test__f_fss_nameds_increase_by__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see f_fss_nameds_increase_by() + */ +extern void test__f_fss_nameds_increase_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_fss_nameds_increase_by() + */ +extern void test__f_fss_nameds_increase_by__works(void **state); + +#endif // _TEST__F_fss__nameds_increase_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-nameds_resize.c b/level_0/f_fss/tests/unit/c/test-fss-nameds_resize.c new file mode 100644 index 0000000..cf94465 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-nameds_resize.c @@ -0,0 +1,42 @@ +#include "test-fss.h" +#include "test-fss-nameds_resize.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_nameds_resize__parameter_checking(void **state) { + + const int length = 5; + f_fss_nameds_t data = f_fss_nameds_t_initialize; + + { + const f_status_t status = f_fss_nameds_resize(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_fss_nameds_resize__works(void **state) { + + const int length = 5; + f_fss_nameds_t data = f_fss_nameds_t_initialize; + + { + const f_status_t status = f_fss_nameds_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-nameds_resize.h b/level_0/f_fss/tests/unit/c/test-fss-nameds_resize.h new file mode 100644 index 0000000..ff4875a --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-nameds_resize.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test nameds resize in the fss project. + */ +#ifndef _TEST__F_fss__nameds_resize +#define _TEST__F_fss__nameds_resize + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_nameds_resize() + */ +extern void test__f_fss_nameds_resize__parameter_checking(void **state); + +/** + * Test that the function works. + * + * @see f_fss_nameds_resize() + */ +extern void test__f_fss_nameds_resize__works(void **state); + +#endif // _TEST__F_fss__nameds_resize diff --git a/level_0/f_fss/tests/unit/c/test-fss-nest_adjust.c b/level_0/f_fss/tests/unit/c/test-fss-nest_adjust.c new file mode 100644 index 0000000..72aa9c6 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-nest_adjust.c @@ -0,0 +1,42 @@ +#include "test-fss.h" +#include "test-fss-nests_adjust.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_nest_adjust__parameter_checking(void **state) { + + const int length = 5; + f_fss_nest_t data = f_fss_nest_t_initialize; + + { + const f_status_t status = f_fss_nest_adjust(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.depth); +} + +void test__f_fss_nest_adjust__works(void **state) { + + const int length = 5; + f_fss_nest_t data = f_fss_nest_t_initialize; + + { + const f_status_t status = f_fss_nest_adjust(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.depth); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-nest_adjust.h b/level_0/f_fss/tests/unit/c/test-fss-nest_adjust.h new file mode 100644 index 0000000..c3d0d42 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-nest_adjust.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test nest adjust in the fss project. + */ +#ifndef _TEST__F_fss__nest_adjust +#define _TEST__F_fss__nest_adjust + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_nest_adjust() + */ +extern void test__f_fss_nest_adjust__parameter_checking(void **state); + +/** + * Test that the function works. + * + * @see f_fss_nest_adjust() + */ +extern void test__f_fss_nest_adjust__works(void **state); + +#endif // _TEST__F_fss__nest_adjust diff --git a/level_0/f_fss/tests/unit/c/test-fss-nest_decimate_by.c b/level_0/f_fss/tests/unit/c/test-fss-nest_decimate_by.c new file mode 100644 index 0000000..4cee05b --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-nest_decimate_by.c @@ -0,0 +1,74 @@ +#include "test-fss.h" +#include "test-fss-nests_decimate_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_nest_decimate_by__parameter_checking(void **state) { + + const int length = 5; + f_fss_nest_t data = f_fss_nest_t_initialize; + + { + const f_status_t status = f_fss_nest_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.depth); +} + +void test__f_fss_nest_decimate_by__returns_data_not(void **state) { + + const int length = 5; + f_fss_nest_t data = f_fss_nest_t_initialize; + + { + const f_status_t status = f_fss_nest_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_fss_nest_decimate_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.depth); +} + +void test__f_fss_nest_decimate_by__works(void **state) { + + const int length = 5; + f_fss_nest_t data = f_fss_nest_t_initialize; + + { + const f_status_t status = f_fss_nest_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_fss_nest_decimate_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.depth); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-nest_decimate_by.h b/level_0/f_fss/tests/unit/c/test-fss-nest_decimate_by.h new file mode 100644 index 0000000..06460cb --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-nest_decimate_by.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test nest decimate by in the fss project. + */ +#ifndef _TEST__F_fss__nest_decimate_by +#define _TEST__F_fss__nest_decimate_by + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_nest_decimate_by() + */ +extern void test__f_fss_nest_decimate_by__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see f_fss_nest_decimate_by() + */ +extern void test__f_fss_nest_decimate_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_fss_nest_decimate_by() + */ +extern void test__f_fss_nest_decimate_by__works(void **state); + +#endif // _TEST__F_fss__nest_decimate_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-nest_decrease_by.c b/level_0/f_fss/tests/unit/c/test-fss-nest_decrease_by.c new file mode 100644 index 0000000..716f37b --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-nest_decrease_by.c @@ -0,0 +1,74 @@ +#include "test-fss.h" +#include "test-fss-nests_decrease_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_nest_decrease_by__parameter_checking(void **state) { + + const int length = 5; + f_fss_nest_t data = f_fss_nest_t_initialize; + + { + const f_status_t status = f_fss_nest_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.depth); +} + +void test__f_fss_nest_decrease_by__returns_data_not(void **state) { + + const int length = 5; + f_fss_nest_t data = f_fss_nest_t_initialize; + + { + const f_status_t status = f_fss_nest_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_fss_nest_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.depth); +} + +void test__f_fss_nest_decrease_by__works(void **state) { + + const int length = 5; + f_fss_nest_t data = f_fss_nest_t_initialize; + + { + const f_status_t status = f_fss_nest_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_fss_nest_decrease_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.depth); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-nest_decrease_by.h b/level_0/f_fss/tests/unit/c/test-fss-nest_decrease_by.h new file mode 100644 index 0000000..25eb85b --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-nest_decrease_by.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test nest decrease by in the fss project. + */ +#ifndef _TEST__F_fss__nest_decrease_by +#define _TEST__F_fss__nest_decrease_by + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_nest_decrease_by() + */ +extern void test__f_fss_nest_decrease_by__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see f_fss_nest_decrease_by() + */ +extern void test__f_fss_nest_decrease_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_fss_nest_decrease_by() + */ +extern void test__f_fss_nest_decrease_by__works(void **state); + +#endif // _TEST__F_fss__nest_decrease_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-nest_increase.c b/level_0/f_fss/tests/unit/c/test-fss-nest_increase.c new file mode 100644 index 0000000..5ee8bd9 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-nest_increase.c @@ -0,0 +1,76 @@ +#include "test-fss.h" +#include "test-fss-nests_increase.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_nest_increase__parameter_checking(void **state) { + + const int length = 5; + f_fss_nest_t data = f_fss_nest_t_initialize; + + { + const f_status_t status = f_fss_nest_increase(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + free((void *) data.depth); +} + +void test__f_fss_nest_increase__returns_data_not(void **state) { + + const int length = 5; + f_fss_nest_t data = f_fss_nest_t_initialize; + + { + const f_status_t status = f_fss_nest_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_fss_nest_increase(length, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.depth); +} + +void test__f_fss_nest_increase__works(void **state) { + + const int length = 5; + f_fss_nest_t data = f_fss_nest_t_initialize; + + { + const f_status_t status = f_fss_nest_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_fss_nest_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.depth); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-nest_increase.h b/level_0/f_fss/tests/unit/c/test-fss-nest_increase.h new file mode 100644 index 0000000..4bf152a --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-nest_increase.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test nest increase in the fss project. + */ +#ifndef _TEST__F_fss__nest_increase +#define _TEST__F_fss__nest_increase + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_nest_increase() + */ +extern void test__f_fss_nest_increase__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see f_fss_nest_increase() + */ +extern void test__f_fss_nest_increase__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_fss_nest_increase() + */ +extern void test__f_fss_nest_increase__works(void **state); + +#endif // _TEST__F_fss__nest_increase diff --git a/level_0/f_fss/tests/unit/c/test-fss-nest_increase_by.c b/level_0/f_fss/tests/unit/c/test-fss-nest_increase_by.c new file mode 100644 index 0000000..4d91ea8 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-nest_increase_by.c @@ -0,0 +1,76 @@ +#include "test-fss.h" +#include "test-fss-nests_increase_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_nest_increase_by__parameter_checking(void **state) { + + const int length = 5; + f_fss_nest_t data = f_fss_nest_t_initialize; + + { + const f_status_t status = f_fss_nest_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.depth); +} + +void test__f_fss_nest_increase_by__returns_data_not(void **state) { + + const int length = 5; + f_fss_nest_t data = f_fss_nest_t_initialize; + + { + const f_status_t status = f_fss_nest_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_fss_nest_increase_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.depth); +} + +void test__f_fss_nest_increase_by__works(void **state) { + + const int length = 5; + f_fss_nest_t data = f_fss_nest_t_initialize; + + { + const f_status_t status = f_fss_nest_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_fss_nest_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.depth); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-nest_increase_by.h b/level_0/f_fss/tests/unit/c/test-fss-nest_increase_by.h new file mode 100644 index 0000000..5a785ec --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-nest_increase_by.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test nest increase by in the fss project. + */ +#ifndef _TEST__F_fss__nest_increase_by +#define _TEST__F_fss__nest_increase_by + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_nest_increase_by() + */ +extern void test__f_fss_nest_increase_by__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see f_fss_nest_increase_by() + */ +extern void test__f_fss_nest_increase_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_fss_nest_increase_by() + */ +extern void test__f_fss_nest_increase_by__works(void **state); + +#endif // _TEST__F_fss__nest_increase_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-nest_resize.c b/level_0/f_fss/tests/unit/c/test-fss-nest_resize.c new file mode 100644 index 0000000..74588e2 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-nest_resize.c @@ -0,0 +1,42 @@ +#include "test-fss.h" +#include "test-fss-nests_resize.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_nest_resize__parameter_checking(void **state) { + + const int length = 5; + f_fss_nest_t data = f_fss_nest_t_initialize; + + { + const f_status_t status = f_fss_nest_resize(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.depth); +} + +void test__f_fss_nest_resize__works(void **state) { + + const int length = 5; + f_fss_nest_t data = f_fss_nest_t_initialize; + + { + const f_status_t status = f_fss_nest_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.depth); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-nest_resize.h b/level_0/f_fss/tests/unit/c/test-fss-nest_resize.h new file mode 100644 index 0000000..02498ee --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-nest_resize.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test nest resize in the fss project. + */ +#ifndef _TEST__F_fss__nest_resize +#define _TEST__F_fss__nest_resize + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_nest_resize() + */ +extern void test__f_fss_nest_resize__parameter_checking(void **state); + +/** + * Test that the function works. + * + * @see f_fss_nest_resize() + */ +extern void test__f_fss_nest_resize__works(void **state); + +#endif // _TEST__F_fss__nest_resize diff --git a/level_0/f_fss/tests/unit/c/test-fss-nests_adjust.c b/level_0/f_fss/tests/unit/c/test-fss-nests_adjust.c new file mode 100644 index 0000000..8551b38 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-nests_adjust.c @@ -0,0 +1,42 @@ +#include "test-fss.h" +#include "test-fss-nests_adjust.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_nests_adjust__parameter_checking(void **state) { + + const int length = 5; + f_fss_nests_t data = f_fss_nests_t_initialize; + + { + const f_status_t status = f_fss_nests_adjust(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_fss_nests_adjust__works(void **state) { + + const int length = 5; + f_fss_nests_t data = f_fss_nests_t_initialize; + + { + const f_status_t status = f_fss_nests_adjust(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-nests_adjust.h b/level_0/f_fss/tests/unit/c/test-fss-nests_adjust.h new file mode 100644 index 0000000..eefeb4e --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-nests_adjust.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test nests adjust in the fss project. + */ +#ifndef _TEST__F_fss__nests_adjust +#define _TEST__F_fss__nests_adjust + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_nests_adjust() + */ +extern void test__f_fss_nests_adjust__parameter_checking(void **state); + +/** + * Test that the function works. + * + * @see f_fss_nests_adjust() + */ +extern void test__f_fss_nests_adjust__works(void **state); + +#endif // _TEST__F_fss__nests_adjust diff --git a/level_0/f_fss/tests/unit/c/test-fss-nests_decimate_by.c b/level_0/f_fss/tests/unit/c/test-fss-nests_decimate_by.c new file mode 100644 index 0000000..e4373f4 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-nests_decimate_by.c @@ -0,0 +1,74 @@ +#include "test-fss.h" +#include "test-fss-nests_decimate_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_nests_decimate_by__parameter_checking(void **state) { + + const int length = 5; + f_fss_nests_t data = f_fss_nests_t_initialize; + + { + const f_status_t status = f_fss_nests_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_fss_nests_decimate_by__returns_data_not(void **state) { + + const int length = 5; + f_fss_nests_t data = f_fss_nests_t_initialize; + + { + const f_status_t status = f_fss_nests_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_fss_nests_decimate_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_fss_nests_decimate_by__works(void **state) { + + const int length = 5; + f_fss_nests_t data = f_fss_nests_t_initialize; + + { + const f_status_t status = f_fss_nests_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_fss_nests_decimate_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-nests_decimate_by.h b/level_0/f_fss/tests/unit/c/test-fss-nests_decimate_by.h new file mode 100644 index 0000000..fa4a3a3 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-nests_decimate_by.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test nests decimate by in the fss project. + */ +#ifndef _TEST__F_fss__nests_decimate_by +#define _TEST__F_fss__nests_decimate_by + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_nests_decimate_by() + */ +extern void test__f_fss_nests_decimate_by__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see f_fss_nests_decimate_by() + */ +extern void test__f_fss_nests_decimate_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_fss_nests_decimate_by() + */ +extern void test__f_fss_nests_decimate_by__works(void **state); + +#endif // _TEST__F_fss__nests_decimate_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-nests_decrease_by.c b/level_0/f_fss/tests/unit/c/test-fss-nests_decrease_by.c new file mode 100644 index 0000000..ac58df9 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-nests_decrease_by.c @@ -0,0 +1,74 @@ +#include "test-fss.h" +#include "test-fss-nests_decrease_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_nests_decrease_by__parameter_checking(void **state) { + + const int length = 5; + f_fss_nests_t data = f_fss_nests_t_initialize; + + { + const f_status_t status = f_fss_nests_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_fss_nests_decrease_by__returns_data_not(void **state) { + + const int length = 5; + f_fss_nests_t data = f_fss_nests_t_initialize; + + { + const f_status_t status = f_fss_nests_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_fss_nests_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_fss_nests_decrease_by__works(void **state) { + + const int length = 5; + f_fss_nests_t data = f_fss_nests_t_initialize; + + { + const f_status_t status = f_fss_nests_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_fss_nests_decrease_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-nests_decrease_by.h b/level_0/f_fss/tests/unit/c/test-fss-nests_decrease_by.h new file mode 100644 index 0000000..130595a --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-nests_decrease_by.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test nests decrease by in the fss project. + */ +#ifndef _TEST__F_fss__nests_decrease_by +#define _TEST__F_fss__nests_decrease_by + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_nests_decrease_by() + */ +extern void test__f_fss_nests_decrease_by__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see f_fss_nests_decrease_by() + */ +extern void test__f_fss_nests_decrease_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_fss_nests_decrease_by() + */ +extern void test__f_fss_nests_decrease_by__works(void **state); + +#endif // _TEST__F_fss__nests_decrease_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-nests_increase.c b/level_0/f_fss/tests/unit/c/test-fss-nests_increase.c new file mode 100644 index 0000000..57bc815 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-nests_increase.c @@ -0,0 +1,76 @@ +#include "test-fss.h" +#include "test-fss-nests_increase.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_nests_increase__parameter_checking(void **state) { + + const int length = 5; + f_fss_nests_t data = f_fss_nests_t_initialize; + + { + const f_status_t status = f_fss_nests_increase(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + free((void *) data.array); +} + +void test__f_fss_nests_increase__returns_data_not(void **state) { + + const int length = 5; + f_fss_nests_t data = f_fss_nests_t_initialize; + + { + const f_status_t status = f_fss_nests_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_fss_nests_increase(length, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_fss_nests_increase__works(void **state) { + + const int length = 5; + f_fss_nests_t data = f_fss_nests_t_initialize; + + { + const f_status_t status = f_fss_nests_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_fss_nests_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); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-nests_increase.h b/level_0/f_fss/tests/unit/c/test-fss-nests_increase.h new file mode 100644 index 0000000..1563177 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-nests_increase.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test nests increase in the fss project. + */ +#ifndef _TEST__F_fss__nests_increase +#define _TEST__F_fss__nests_increase + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_nests_increase() + */ +extern void test__f_fss_nests_increase__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see f_fss_nests_increase() + */ +extern void test__f_fss_nests_increase__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_fss_nests_increase() + */ +extern void test__f_fss_nests_increase__works(void **state); + +#endif // _TEST__F_fss__nests_increase diff --git a/level_0/f_fss/tests/unit/c/test-fss-nests_increase_by.c b/level_0/f_fss/tests/unit/c/test-fss-nests_increase_by.c new file mode 100644 index 0000000..22bf2f7 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-nests_increase_by.c @@ -0,0 +1,76 @@ +#include "test-fss.h" +#include "test-fss-nests_increase_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_nests_increase_by__parameter_checking(void **state) { + + const int length = 5; + f_fss_nests_t data = f_fss_nests_t_initialize; + + { + const f_status_t status = f_fss_nests_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_fss_nests_increase_by__returns_data_not(void **state) { + + const int length = 5; + f_fss_nests_t data = f_fss_nests_t_initialize; + + { + const f_status_t status = f_fss_nests_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_fss_nests_increase_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_fss_nests_increase_by__works(void **state) { + + const int length = 5; + f_fss_nests_t data = f_fss_nests_t_initialize; + + { + const f_status_t status = f_fss_nests_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_fss_nests_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 +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-nests_increase_by.h b/level_0/f_fss/tests/unit/c/test-fss-nests_increase_by.h new file mode 100644 index 0000000..a59393d --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-nests_increase_by.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test nests increase by in the fss project. + */ +#ifndef _TEST__F_fss__nests_increase_by +#define _TEST__F_fss__nests_increase_by + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_nests_increase_by() + */ +extern void test__f_fss_nests_increase_by__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see f_fss_nests_increase_by() + */ +extern void test__f_fss_nests_increase_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_fss_nests_increase_by() + */ +extern void test__f_fss_nests_increase_by__works(void **state); + +#endif // _TEST__F_fss__nests_increase_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-nests_resize.c b/level_0/f_fss/tests/unit/c/test-fss-nests_resize.c new file mode 100644 index 0000000..ab8b5a1 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-nests_resize.c @@ -0,0 +1,42 @@ +#include "test-fss.h" +#include "test-fss-nests_resize.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_nests_resize__parameter_checking(void **state) { + + const int length = 5; + f_fss_nests_t data = f_fss_nests_t_initialize; + + { + const f_status_t status = f_fss_nests_resize(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_fss_nests_resize__works(void **state) { + + const int length = 5; + f_fss_nests_t data = f_fss_nests_t_initialize; + + { + const f_status_t status = f_fss_nests_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-nests_resize.h b/level_0/f_fss/tests/unit/c/test-fss-nests_resize.h new file mode 100644 index 0000000..6131af6 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-nests_resize.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test nests resize in the fss project. + */ +#ifndef _TEST__F_fss__nests_resize +#define _TEST__F_fss__nests_resize + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_nests_resize() + */ +extern void test__f_fss_nests_resize__parameter_checking(void **state); + +/** + * Test that the function works. + * + * @see f_fss_nests_resize() + */ +extern void test__f_fss_nests_resize__works(void **state); + +#endif // _TEST__F_fss__nests_resize diff --git a/level_0/f_fss/tests/unit/c/test-fss-seek_to_eol.c b/level_0/f_fss/tests/unit/c/test-fss-seek_to_eol.c new file mode 100644 index 0000000..bb7c7fe --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-seek_to_eol.c @@ -0,0 +1,124 @@ +#include "test-fss.h" +#include "test-fss-seek_to_eol.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_seek_to_eol__parameter_checking(void **state) { + + const f_string_static_t test = macro_f_string_static_t_initialize("test", 0, 4); + f_state_t state_data = f_state_t_initialize; + + { + const f_status_t status = f_fss_seek_to_eol(state_data, test, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +void test__f_fss_seek_to_eol__returns_data_not(void **state) { + + const f_string_static_t test = macro_f_string_static_t_initialize("test", 0, 4); + f_state_t state_data = f_state_t_initialize; + + { + f_string_range_t range = f_string_range_t_initialize; + const f_status_t status = f_fss_seek_to_eol(state_data, f_string_empty_s, &range); + + assert_int_equal(status, F_data_not); + } + + { + f_string_range_t range = f_string_range_t_initialize; + const f_status_t status = f_fss_seek_to_eol(state_data, test, &range); + + assert_int_equal(status, F_data_not); + } + + { + f_string_range_t range = macro_f_string_range_t_initialize(0, 1); + const f_status_t status = f_fss_seek_to_eol(state_data, f_string_empty_s, &range); + + assert_int_equal(status, F_data_not); + } +} + +void test__f_fss_seek_to_eol__works(void **state) { + + f_state_t state_data = f_state_t_initialize; + + f_string_static_t tests[] = { + macro_f_string_static_t_initialize(" ", 0, 2), + macro_f_string_static_t_initialize("\0\0", 0, 2), + macro_f_string_static_t_initialize("\n\n", 0, 2), + macro_f_string_static_t_initialize(" \ntest", 0, 7), + macro_f_string_static_t_initialize("test\ntest\n", 0, 6), + macro_f_string_static_t_initialize("\ntest\n\n", 0, 7), + macro_f_string_static_t_initialize(" ", 0, 2), + macro_f_string_static_t_initialize("\0\0", 0, 2), + macro_f_string_static_t_initialize("\n\n", 0, 2), + macro_f_string_static_t_initialize(" \ntest", 0, 7), + macro_f_string_static_t_initialize("test\ntest\n", 0, 6), + macro_f_string_static_t_initialize("\ntest\n\n", 0, 7), + }; + + f_string_range_t ranges[] = { + macro_f_string_range_t_initialize(0, tests[0].used - 1), + macro_f_string_range_t_initialize(0, tests[1].used - 1), + macro_f_string_range_t_initialize(0, tests[2].used - 1), + macro_f_string_range_t_initialize(0, tests[3].used - 1), + macro_f_string_range_t_initialize(0, tests[4].used - 1), + macro_f_string_range_t_initialize(0, tests[5].used - 1), + macro_f_string_range_t_initialize(0, tests[6].used - 2), + macro_f_string_range_t_initialize(0, tests[7].used - 2), + macro_f_string_range_t_initialize(0, tests[8].used - 2), + macro_f_string_range_t_initialize(0, tests[9].used - 2), + macro_f_string_range_t_initialize(0, tests[10].used - 2), + macro_f_string_range_t_initialize(1, tests[11].used - 2), + }; + + f_array_length_t expects[] = { + 2, + 2, + 0, + 2, + 4, + 0, + 1, + 1, + 0, + 2, + 4, + 5, + }; + + f_status_t statuss[] = { + F_none_eos, + F_none_eos, + F_none, + F_none, + F_none, + F_none, + F_none_stop, + F_none_stop, + F_none, + F_none, + F_none, + F_none, + }; + + for (uint8_t i = 0; i < 12; ++i) { + + f_string_range_t range = ranges[i]; + + const f_status_t status = f_fss_seek_to_eol(state_data, tests[i], &range); + + assert_int_equal(status, statuss[i]); + assert_int_equal(range.start, expects[i]); + } // for +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-seek_to_eol.h b/level_0/f_fss/tests/unit/c/test-fss-seek_to_eol.h new file mode 100644 index 0000000..5bad0c1 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-seek_to_eol.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test seek to eol in the fss project. + */ +#ifndef _TEST__F_fss__seek_to_eol +#define _TEST__F_fss__seek_to_eol + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_seek_to_eol() + */ +extern void test__f_fss_seek_to_eol__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see f_fss_seek_to_eol() + */ +extern void test__f_fss_seek_to_eol__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_fss_seek_to_eol() + */ +extern void test__f_fss_seek_to_eol__works(void **state); + +#endif // _TEST__F_fss__seek_to_eol diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_adjust.c b/level_0/f_fss/tests/unit/c/test-fss-set_adjust.c new file mode 100644 index 0000000..a151fb2 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-set_adjust.c @@ -0,0 +1,44 @@ +#include "test-fss.h" +#include "test-fss-sets_adjust.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_set_adjust__parameter_checking(void **state) { + + const int length = 5; + f_fss_set_t data = f_fss_set_t_initialize; + + { + const f_status_t status = f_fss_set_adjust(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.contents.size, 0); + } + + assert_null(data.objects.array); + assert_null(data.contents.array); +} + +void test__f_fss_set_adjust__works(void **state) { + + const int length = 5; + f_fss_set_t data = f_fss_set_t_initialize; + + { + const f_status_t status = f_fss_set_adjust(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.contents.size, length); + } + + free((void *) data.objects.array); + free((void *) data.contents.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_adjust.h b/level_0/f_fss/tests/unit/c/test-fss-set_adjust.h new file mode 100644 index 0000000..0f50b1a --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-set_adjust.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test set adjust in the fss project. + */ +#ifndef _TEST__F_fss__set_adjust +#define _TEST__F_fss__set_adjust + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_set_adjust() + */ +extern void test__f_fss_set_adjust__parameter_checking(void **state); + +/** + * Test that the function works. + * + * @see f_fss_set_adjust() + */ +extern void test__f_fss_set_adjust__works(void **state); + +#endif // _TEST__F_fss__set_adjust diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_decimate_by.c b/level_0/f_fss/tests/unit/c/test-fss-set_decimate_by.c new file mode 100644 index 0000000..632ce9f --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-set_decimate_by.c @@ -0,0 +1,77 @@ +#include "test-fss.h" +#include "test-fss-sets_decimate_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_set_decimate_by__parameter_checking(void **state) { + + const int length = 5; + f_fss_set_t data = f_fss_set_t_initialize; + + { + const f_status_t status = f_fss_set_decimate_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.contents.size, 0); + } + + assert_null(data.objects.array); + assert_null(data.contents.array); +} + +void test__f_fss_set_decimate_by__returns_data_not(void **state) { + + const int length = 5; + f_fss_set_t data = f_fss_set_t_initialize; + + { + const f_status_t status = f_fss_set_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.contents.size, length); + } + + { + const f_status_t status = f_fss_set_decimate_by(0, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.contents.size, length); + } + + free((void *) data.objects.array); + free((void *) data.contents.array); +} + +void test__f_fss_set_decimate_by__works(void **state) { + + const int length = 5; + f_fss_set_t data = f_fss_set_t_initialize; + + { + const f_status_t status = f_fss_set_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.contents.size, length); + } + + { + const f_status_t status = f_fss_set_decimate_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.contents.size, 0); + } + + assert_null(data.objects.array); + assert_null(data.contents.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_decimate_by.h b/level_0/f_fss/tests/unit/c/test-fss-set_decimate_by.h new file mode 100644 index 0000000..99ba933 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-set_decimate_by.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test set decimate by in the fss project. + */ +#ifndef _TEST__F_fss__set_decimate_by +#define _TEST__F_fss__set_decimate_by + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_set_decimate_by() + */ +extern void test__f_fss_set_decimate_by__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see f_fss_set_decimate_by() + */ +extern void test__f_fss_set_decimate_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_fss_set_decimate_by() + */ +extern void test__f_fss_set_decimate_by__works(void **state); + +#endif // _TEST__F_fss__set_decimate_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_decrease_by.c b/level_0/f_fss/tests/unit/c/test-fss-set_decrease_by.c new file mode 100644 index 0000000..b73f58e --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-set_decrease_by.c @@ -0,0 +1,77 @@ +#include "test-fss.h" +#include "test-fss-sets_decrease_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_set_decrease_by__parameter_checking(void **state) { + + const int length = 5; + f_fss_set_t data = f_fss_set_t_initialize; + + { + const f_status_t status = f_fss_set_decrease_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.contents.size, 0); + } + + assert_null(data.objects.array); + assert_null(data.contents.array); +} + +void test__f_fss_set_decrease_by__returns_data_not(void **state) { + + const int length = 5; + f_fss_set_t data = f_fss_set_t_initialize; + + { + const f_status_t status = f_fss_set_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.contents.size, length); + } + + { + const f_status_t status = f_fss_set_decrease_by(0, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.contents.size, length); + } + + free((void *) data.objects.array); + free((void *) data.contents.array); +} + +void test__f_fss_set_decrease_by__works(void **state) { + + const int length = 5; + f_fss_set_t data = f_fss_set_t_initialize; + + { + const f_status_t status = f_fss_set_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.contents.size, length); + } + + { + const f_status_t status = f_fss_set_decrease_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.contents.size, 0); + } + + assert_null(data.objects.array); + assert_null(data.contents.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_decrease_by.h b/level_0/f_fss/tests/unit/c/test-fss-set_decrease_by.h new file mode 100644 index 0000000..5683256 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-set_decrease_by.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test set decrease by in the fss project. + */ +#ifndef _TEST__F_fss__set_decrease_by +#define _TEST__F_fss__set_decrease_by + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_set_decrease_by() + */ +extern void test__f_fss_set_decrease_by__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see f_fss_set_decrease_by() + */ +extern void test__f_fss_set_decrease_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_fss_set_decrease_by() + */ +extern void test__f_fss_set_decrease_by__works(void **state); + +#endif // _TEST__F_fss__set_decrease_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_increase.c b/level_0/f_fss/tests/unit/c/test-fss-set_increase.c new file mode 100644 index 0000000..ba33119 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-set_increase.c @@ -0,0 +1,80 @@ +#include "test-fss.h" +#include "test-fss-sets_increase.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_set_increase__parameter_checking(void **state) { + + const int length = 5; + f_fss_set_t data = f_fss_set_t_initialize; + + { + const f_status_t status = f_fss_set_increase(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.contents.size, 0); + } + + free((void *) data.objects.array); + free((void *) data.contents.array); +} + +void test__f_fss_set_increase__returns_data_not(void **state) { + + const int length = 5; + f_fss_set_t data = f_fss_set_t_initialize; + + { + const f_status_t status = f_fss_set_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.contents.size, length); + } + + { + const f_status_t status = f_fss_set_increase(length, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.contents.size, length); + } + + free((void *) data.objects.array); + free((void *) data.contents.array); +} + +void test__f_fss_set_increase__works(void **state) { + + const int length = 5; + f_fss_set_t data = f_fss_set_t_initialize; + + { + const f_status_t status = f_fss_set_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.contents.size, length); + } + + { + data.objects.used = length; + data.contents.used = length; + + const f_status_t status = f_fss_set_increase(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.objects.used, length); + assert_in_range(data.contents.size, length + 1, length + 1 + F_memory_default_allocation_small_d); + } + + free((void *) data.objects.array); + free((void *) data.contents.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_increase.h b/level_0/f_fss/tests/unit/c/test-fss-set_increase.h new file mode 100644 index 0000000..f912755 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-set_increase.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test set increase in the fss project. + */ +#ifndef _TEST__F_fss__set_increase +#define _TEST__F_fss__set_increase + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_set_increase() + */ +extern void test__f_fss_set_increase__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see f_fss_set_increase() + */ +extern void test__f_fss_set_increase__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_fss_set_increase() + */ +extern void test__f_fss_set_increase__works(void **state); + +#endif // _TEST__F_fss__set_increase diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_increase_by.c b/level_0/f_fss/tests/unit/c/test-fss-set_increase_by.c new file mode 100644 index 0000000..18b0d0f --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-set_increase_by.c @@ -0,0 +1,80 @@ +#include "test-fss.h" +#include "test-fss-sets_increase_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_set_increase_by__parameter_checking(void **state) { + + const int length = 5; + f_fss_set_t data = f_fss_set_t_initialize; + + { + const f_status_t status = f_fss_set_increase_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.contents.size, 0); + } + + assert_null(data.objects.array); + assert_null(data.contents.array); +} + +void test__f_fss_set_increase_by__returns_data_not(void **state) { + + const int length = 5; + f_fss_set_t data = f_fss_set_t_initialize; + + { + const f_status_t status = f_fss_set_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.contents.size, length); + } + + { + const f_status_t status = f_fss_set_increase_by(0, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.contents.size, length); + } + + free((void *) data.objects.array); + free((void *) data.contents.array); +} + +void test__f_fss_set_increase_by__works(void **state) { + + const int length = 5; + f_fss_set_t data = f_fss_set_t_initialize; + + { + const f_status_t status = f_fss_set_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.contents.size, length); + } + + { + data.objects.used = length; + data.contents.used = length; + + const f_status_t status = f_fss_set_increase_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.objects.used, length); + assert_int_equal(data.contents.size, length * 2); + } + + free((void *) data.objects.array); + free((void *) data.contents.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_increase_by.h b/level_0/f_fss/tests/unit/c/test-fss-set_increase_by.h new file mode 100644 index 0000000..af53129 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-set_increase_by.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test set increase by in the fss project. + */ +#ifndef _TEST__F_fss__set_increase_by +#define _TEST__F_fss__set_increase_by + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_set_increase_by() + */ +extern void test__f_fss_set_increase_by__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see f_fss_set_increase_by() + */ +extern void test__f_fss_set_increase_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_fss_set_increase_by() + */ +extern void test__f_fss_set_increase_by__works(void **state); + +#endif // _TEST__F_fss__set_increase_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_quote_adjust.c b/level_0/f_fss/tests/unit/c/test-fss-set_quote_adjust.c new file mode 100644 index 0000000..9fef2d0 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-set_quote_adjust.c @@ -0,0 +1,60 @@ +#include "test-fss.h" +#include "test-fss-set_quote_adjust.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_set_quote_adjust__parameter_checking(void **state) { + + const int length = 5; + f_fss_set_quote_t data = f_fss_set_quote_t_initialize; + + { + const f_status_t status = f_fss_set_quote_adjust(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.objects.size, 0); + assert_int_equal(data.contents.used, 0); + assert_int_equal(data.contents.size, 0); + assert_int_equal(data.objects_quote.used, 0); + assert_int_equal(data.objects_quote.size, 0); + assert_int_equal(data.contents_quote.used, 0); + assert_int_equal(data.contents_quote.size, 0); + } + + assert_null(data.objects.array); + assert_null(data.contents.array); + assert_null(data.objects_quote.array); + assert_null(data.contents_quote.array); +} + +void test__f_fss_set_quote_adjust__works(void **state) { + + const int length = 5; + f_fss_set_quote_t data = f_fss_set_quote_t_initialize; + + { + const f_status_t status = f_fss_set_quote_adjust(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.objects.size, length); + assert_int_equal(data.contents.used, 0); + assert_int_equal(data.contents.size, length); + assert_int_equal(data.objects_quote.used, 0); + assert_int_equal(data.objects_quote.size, length); + assert_int_equal(data.contents_quote.used, 0); + assert_int_equal(data.contents_quote.size, length); + } + + free((void *) data.objects.array); + free((void *) data.contents.array); + free((void *) data.objects_quote.array); + free((void *) data.contents_quote.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_quote_adjust.h b/level_0/f_fss/tests/unit/c/test-fss-set_quote_adjust.h new file mode 100644 index 0000000..0235bb3 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-set_quote_adjust.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test set quote adjust in the fss project. + */ +#ifndef _TEST__F_fss__set_quote_adjust +#define _TEST__F_fss__set_quote_adjust + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_set_quote_adjust() + */ +extern void test__f_fss_set_quote_adjust__parameter_checking(void **state); + +/** + * Test that the function works. + * + * @see f_fss_set_quote_adjust() + */ +extern void test__f_fss_set_quote_adjust__works(void **state); + +#endif // _TEST__F_fss__set_quote_adjust diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_quote_decimate_by.c b/level_0/f_fss/tests/unit/c/test-fss-set_quote_decimate_by.c new file mode 100644 index 0000000..1f863d9 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-set_quote_decimate_by.c @@ -0,0 +1,113 @@ +#include "test-fss.h" +#include "test-fss-set_quote_decimate_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_set_quote_decimate_by__parameter_checking(void **state) { + + const int length = 5; + f_fss_set_quote_t data = f_fss_set_quote_t_initialize; + + { + const f_status_t status = f_fss_set_quote_decimate_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.objects.size, 0); + assert_int_equal(data.contents.used, 0); + assert_int_equal(data.contents.size, 0); + assert_int_equal(data.objects_quote.used, 0); + assert_int_equal(data.objects_quote.size, 0); + assert_int_equal(data.contents_quote.used, 0); + assert_int_equal(data.contents_quote.size, 0); + } + + assert_null(data.objects.array); + assert_null(data.contents.array); + assert_null(data.objects_quote.array); + assert_null(data.contents_quote.array); +} + +void test__f_fss_set_quote_decimate_by__returns_data_not(void **state) { + + const int length = 5; + f_fss_set_quote_t data = f_fss_set_quote_t_initialize; + + { + const f_status_t status = f_fss_set_quote_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.objects.size, length); + assert_int_equal(data.contents.used, 0); + assert_int_equal(data.contents.size, length); + assert_int_equal(data.objects_quote.used, 0); + assert_int_equal(data.objects_quote.size, length); + assert_int_equal(data.contents_quote.used, 0); + assert_int_equal(data.contents_quote.size, length); + } + + { + const f_status_t status = f_fss_set_quote_decimate_by(0, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.objects.size, length); + assert_int_equal(data.contents.used, 0); + assert_int_equal(data.contents.size, length); + assert_int_equal(data.objects_quote.used, 0); + assert_int_equal(data.objects_quote.size, length); + assert_int_equal(data.contents_quote.used, 0); + assert_int_equal(data.contents_quote.size, length); + } + + free((void *) data.objects.array); + free((void *) data.contents.array); + free((void *) data.objects_quote.array); + free((void *) data.contents_quote.array); +} + +void test__f_fss_set_quote_decimate_by__works(void **state) { + + const int length = 5; + f_fss_set_quote_t data = f_fss_set_quote_t_initialize; + + { + const f_status_t status = f_fss_set_quote_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.objects.size, length); + assert_int_equal(data.contents.used, 0); + assert_int_equal(data.contents.size, length); + assert_int_equal(data.objects_quote.used, 0); + assert_int_equal(data.objects_quote.size, length); + assert_int_equal(data.contents_quote.used, 0); + assert_int_equal(data.contents_quote.size, length); + } + + { + const f_status_t status = f_fss_set_quote_decimate_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.objects.size, 0); + assert_int_equal(data.contents.used, 0); + assert_int_equal(data.contents.size, 0); + assert_int_equal(data.objects_quote.used, 0); + assert_int_equal(data.objects_quote.size, 0); + assert_int_equal(data.contents_quote.used, 0); + assert_int_equal(data.contents_quote.size, 0); + } + + assert_null(data.objects.array); + assert_null(data.contents.array); + assert_null(data.objects_quote.array); + assert_null(data.contents_quote.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_quote_decimate_by.h b/level_0/f_fss/tests/unit/c/test-fss-set_quote_decimate_by.h new file mode 100644 index 0000000..9c2101d --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-set_quote_decimate_by.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test set quote decimate by in the fss project. + */ +#ifndef _TEST__F_fss__set_quote_decimate_by +#define _TEST__F_fss__set_quote_decimate_by + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_set_quote_decimate_by() + */ +extern void test__f_fss_set_quote_decimate_by__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see f_fss_set_quote_decimate_by() + */ +extern void test__f_fss_set_quote_decimate_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_fss_set_quote_decimate_by() + */ +extern void test__f_fss_set_quote_decimate_by__works(void **state); + +#endif // _TEST__F_fss__set_quote_decimate_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_quote_decrease_by.c b/level_0/f_fss/tests/unit/c/test-fss-set_quote_decrease_by.c new file mode 100644 index 0000000..cc5cbb1 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-set_quote_decrease_by.c @@ -0,0 +1,113 @@ +#include "test-fss.h" +#include "test-fss-set_quote_decrease_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_set_quote_decrease_by__parameter_checking(void **state) { + + const int length = 5; + f_fss_set_quote_t data = f_fss_set_quote_t_initialize; + + { + const f_status_t status = f_fss_set_quote_decrease_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.objects.size, 0); + assert_int_equal(data.contents.used, 0); + assert_int_equal(data.contents.size, 0); + assert_int_equal(data.objects_quote.used, 0); + assert_int_equal(data.objects_quote.size, 0); + assert_int_equal(data.contents_quote.used, 0); + assert_int_equal(data.contents_quote.size, 0); + } + + assert_null(data.objects.array); + assert_null(data.contents.array); + assert_null(data.objects_quote.array); + assert_null(data.contents_quote.array); +} + +void test__f_fss_set_quote_decrease_by__returns_data_not(void **state) { + + const int length = 5; + f_fss_set_quote_t data = f_fss_set_quote_t_initialize; + + { + const f_status_t status = f_fss_set_quote_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.objects.size, length); + assert_int_equal(data.contents.used, 0); + assert_int_equal(data.contents.size, length); + assert_int_equal(data.objects_quote.used, 0); + assert_int_equal(data.objects_quote.size, length); + assert_int_equal(data.contents_quote.used, 0); + assert_int_equal(data.contents_quote.size, length); + } + + { + const f_status_t status = f_fss_set_quote_decrease_by(0, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.objects.size, length); + assert_int_equal(data.contents.used, 0); + assert_int_equal(data.contents.size, length); + assert_int_equal(data.objects_quote.used, 0); + assert_int_equal(data.objects_quote.size, length); + assert_int_equal(data.contents_quote.used, 0); + assert_int_equal(data.contents_quote.size, length); + } + + free((void *) data.objects.array); + free((void *) data.contents.array); + free((void *) data.objects_quote.array); + free((void *) data.contents_quote.array); +} + +void test__f_fss_set_quote_decrease_by__works(void **state) { + + const int length = 5; + f_fss_set_quote_t data = f_fss_set_quote_t_initialize; + + { + const f_status_t status = f_fss_set_quote_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.objects.size, length); + assert_int_equal(data.contents.used, 0); + assert_int_equal(data.contents.size, length); + assert_int_equal(data.objects_quote.used, 0); + assert_int_equal(data.objects_quote.size, length); + assert_int_equal(data.contents_quote.used, 0); + assert_int_equal(data.contents_quote.size, length); + } + + { + const f_status_t status = f_fss_set_quote_decrease_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.objects.size, 0); + assert_int_equal(data.contents.used, 0); + assert_int_equal(data.contents.size, 0); + assert_int_equal(data.objects_quote.used, 0); + assert_int_equal(data.objects_quote.size, 0); + assert_int_equal(data.contents_quote.used, 0); + assert_int_equal(data.contents_quote.size, 0); + } + + assert_null(data.objects.array); + assert_null(data.contents.array); + assert_null(data.objects_quote.array); + assert_null(data.contents_quote.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_quote_decrease_by.h b/level_0/f_fss/tests/unit/c/test-fss-set_quote_decrease_by.h new file mode 100644 index 0000000..2d578be --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-set_quote_decrease_by.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test set quote decrease by in the fss project. + */ +#ifndef _TEST__F_fss__set_quote_decrease_by +#define _TEST__F_fss__set_quote_decrease_by + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_set_quote_decrease_by() + */ +extern void test__f_fss_set_quote_decrease_by__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see f_fss_set_quote_decrease_by() + */ +extern void test__f_fss_set_quote_decrease_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_fss_set_quote_decrease_by() + */ +extern void test__f_fss_set_quote_decrease_by__works(void **state); + +#endif // _TEST__F_fss__set_quote_decrease_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_quote_increase.c b/level_0/f_fss/tests/unit/c/test-fss-set_quote_increase.c new file mode 100644 index 0000000..fed0b24 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-set_quote_increase.c @@ -0,0 +1,118 @@ +#include "test-fss.h" +#include "test-fss-set_quote_increase.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_set_quote_increase__parameter_checking(void **state) { + + const int length = 5; + f_fss_set_quote_t data = f_fss_set_quote_t_initialize; + + { + const f_status_t status = f_fss_set_quote_increase(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.objects.size, 0); + assert_int_equal(data.contents.used, 0); + assert_int_equal(data.contents.size, 0); + assert_int_equal(data.objects_quote.used, 0); + assert_int_equal(data.objects_quote.size, 0); + assert_int_equal(data.contents_quote.used, 0); + assert_int_equal(data.contents_quote.size, 0); + } + + free((void *) data.objects.array); + free((void *) data.contents.array); + free((void *) data.objects_quote.array); + free((void *) data.contents_quote.array); +} + +void test__f_fss_set_quote_increase__returns_data_not(void **state) { + + const int length = 5; + f_fss_set_quote_t data = f_fss_set_quote_t_initialize; + + { + const f_status_t status = f_fss_set_quote_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.objects.size, length); + assert_int_equal(data.contents.used, 0); + assert_int_equal(data.contents.size, length); + assert_int_equal(data.objects_quote.used, 0); + assert_int_equal(data.objects_quote.size, length); + assert_int_equal(data.contents_quote.used, 0); + assert_int_equal(data.contents_quote.size, length); + } + + { + const f_status_t status = f_fss_set_quote_increase(length, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.objects.size, length); + assert_int_equal(data.contents.used, 0); + assert_int_equal(data.contents.size, length); + assert_int_equal(data.objects_quote.used, 0); + assert_int_equal(data.objects_quote.size, length); + assert_int_equal(data.contents_quote.used, 0); + assert_int_equal(data.contents_quote.size, length); + } + + free((void *) data.objects.array); + free((void *) data.contents.array); + free((void *) data.objects_quote.array); + free((void *) data.contents_quote.array); +} + +void test__f_fss_set_quote_increase__works(void **state) { + + const int length = 5; + f_fss_set_quote_t data = f_fss_set_quote_t_initialize; + + { + const f_status_t status = f_fss_set_quote_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.objects.size, length); + assert_int_equal(data.contents.used, 0); + assert_int_equal(data.contents.size, length); + assert_int_equal(data.objects_quote.used, 0); + assert_int_equal(data.objects_quote.size, length); + assert_int_equal(data.contents_quote.used, 0); + assert_int_equal(data.contents_quote.size, length); + } + + { + data.objects.used = length; + data.contents.used = length; + data.objects_quote.used = length; + data.contents_quote.used = length; + + const f_status_t status = f_fss_set_quote_increase(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.objects.used, length); + assert_in_range(data.objects.size, length + 1, length + 1 + F_memory_default_allocation_small_d); + assert_int_equal(data.contents.used, length); + assert_in_range(data.contents.size, length + 1, length + 1 + F_memory_default_allocation_small_d); + assert_int_equal(data.objects_quote.used, length); + assert_in_range(data.objects_quote.size, length + 1, length + 1 + F_memory_default_allocation_small_d); + assert_int_equal(data.contents_quote.used, length); + assert_in_range(data.contents_quote.size, length + 1, length + 1 + F_memory_default_allocation_small_d); + } + + free((void *) data.objects.array); + free((void *) data.contents.array); + free((void *) data.objects_quote.array); + free((void *) data.contents_quote.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_quote_increase.h b/level_0/f_fss/tests/unit/c/test-fss-set_quote_increase.h new file mode 100644 index 0000000..7297df7 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-set_quote_increase.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test set quote increase in the fss project. + */ +#ifndef _TEST__F_fss__set_quote_increase +#define _TEST__F_fss__set_quote_increase + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_set_quote_increase() + */ +extern void test__f_fss_set_quote_increase__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see f_fss_set_quote_increase() + */ +extern void test__f_fss_set_quote_increase__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_fss_set_quote_increase() + */ +extern void test__f_fss_set_quote_increase__works(void **state); + +#endif // _TEST__F_fss__set_quote_increase diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_quote_increase_by.c b/level_0/f_fss/tests/unit/c/test-fss-set_quote_increase_by.c new file mode 100644 index 0000000..4cd5f70 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-set_quote_increase_by.c @@ -0,0 +1,118 @@ +#include "test-fss.h" +#include "test-fss-set_quote_increase_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_set_quote_increase_by__parameter_checking(void **state) { + + const int length = 5; + f_fss_set_quote_t data = f_fss_set_quote_t_initialize; + + { + const f_status_t status = f_fss_set_quote_increase_by(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.objects.size, 0); + assert_int_equal(data.contents.used, 0); + assert_int_equal(data.contents.size, 0); + assert_int_equal(data.objects_quote.used, 0); + assert_int_equal(data.objects_quote.size, 0); + assert_int_equal(data.contents_quote.used, 0); + assert_int_equal(data.contents_quote.size, 0); + } + + assert_null(data.objects.array); + assert_null(data.contents.array); + assert_null(data.objects_quote.array); + assert_null(data.contents_quote.array); +} + +void test__f_fss_set_quote_increase_by__returns_data_not(void **state) { + + const int length = 5; + f_fss_set_quote_t data = f_fss_set_quote_t_initialize; + + { + const f_status_t status = f_fss_set_quote_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.objects.size, length); + assert_int_equal(data.contents.used, 0); + assert_int_equal(data.contents.size, length); + assert_int_equal(data.objects_quote.used, 0); + assert_int_equal(data.objects_quote.size, length); + assert_int_equal(data.contents_quote.used, 0); + assert_int_equal(data.contents_quote.size, length); + } + + { + const f_status_t status = f_fss_set_quote_increase_by(0, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.objects.size, length); + assert_int_equal(data.contents.used, 0); + assert_int_equal(data.contents.size, length); + assert_int_equal(data.objects_quote.used, 0); + assert_int_equal(data.objects_quote.size, length); + assert_int_equal(data.contents_quote.used, 0); + assert_int_equal(data.contents_quote.size, length); + } + + free((void *) data.objects.array); + free((void *) data.contents.array); + free((void *) data.objects_quote.array); + free((void *) data.contents_quote.array); +} + +void test__f_fss_set_quote_increase_by__works(void **state) { + + const int length = 5; + f_fss_set_quote_t data = f_fss_set_quote_t_initialize; + + { + const f_status_t status = f_fss_set_quote_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.objects.size, length); + assert_int_equal(data.contents.used, 0); + assert_int_equal(data.contents.size, length); + assert_int_equal(data.objects_quote.used, 0); + assert_int_equal(data.objects_quote.size, length); + assert_int_equal(data.contents_quote.used, 0); + assert_int_equal(data.contents_quote.size, length); + } + + { + data.objects.used = length; + data.contents.used = length; + data.objects_quote.used = length; + data.contents_quote.used = length; + + const f_status_t status = f_fss_set_quote_increase_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.objects.used, length); + assert_int_equal(data.objects.size, length * 2); + assert_int_equal(data.contents.used, length); + assert_int_equal(data.contents.size, length * 2); + assert_int_equal(data.objects_quote.used, length); + assert_int_equal(data.objects_quote.size, length * 2); + assert_int_equal(data.contents_quote.used, length); + assert_int_equal(data.contents_quote.size, length * 2); + } + + free((void *) data.objects.array); + free((void *) data.contents.array); + free((void *) data.objects_quote.array); + free((void *) data.contents_quote.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_quote_increase_by.h b/level_0/f_fss/tests/unit/c/test-fss-set_quote_increase_by.h new file mode 100644 index 0000000..e20a726 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-set_quote_increase_by.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test set quote increase by in the fss project. + */ +#ifndef _TEST__F_fss__set_quote_increase_by +#define _TEST__F_fss__set_quote_increase_by + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_set_quote_increase_by() + */ +extern void test__f_fss_set_quote_increase_by__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see f_fss_set_quote_increase_by() + */ +extern void test__f_fss_set_quote_increase_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_fss_set_quote_increase_by() + */ +extern void test__f_fss_set_quote_increase_by__works(void **state); + +#endif // _TEST__F_fss__set_quote_increase_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_quote_resize.c b/level_0/f_fss/tests/unit/c/test-fss-set_quote_resize.c new file mode 100644 index 0000000..5f99eb3 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-set_quote_resize.c @@ -0,0 +1,60 @@ +#include "test-fss.h" +#include "test-fss-set_quote_resize.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_set_quote_resize__parameter_checking(void **state) { + + const int length = 5; + f_fss_set_quote_t data = f_fss_set_quote_t_initialize; + + { + const f_status_t status = f_fss_set_quote_resize(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.objects.size, 0); + assert_int_equal(data.contents.used, 0); + assert_int_equal(data.contents.size, 0); + assert_int_equal(data.objects_quote.used, 0); + assert_int_equal(data.objects_quote.size, 0); + assert_int_equal(data.contents_quote.used, 0); + assert_int_equal(data.contents_quote.size, 0); + } + + assert_null(data.objects.array); + assert_null(data.contents.array); + assert_null(data.objects_quote.array); + assert_null(data.contents_quote.array); +} + +void test__f_fss_set_quote_resize__works(void **state) { + + const int length = 5; + f_fss_set_quote_t data = f_fss_set_quote_t_initialize; + + { + const f_status_t status = f_fss_set_quote_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.objects.size, length); + assert_int_equal(data.contents.used, 0); + assert_int_equal(data.contents.size, length); + assert_int_equal(data.objects_quote.used, 0); + assert_int_equal(data.objects_quote.size, length); + assert_int_equal(data.contents_quote.used, 0); + assert_int_equal(data.contents_quote.size, length); + } + + free((void *) data.objects.array); + free((void *) data.contents.array); + free((void *) data.objects_quote.array); + free((void *) data.contents_quote.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_quote_resize.h b/level_0/f_fss/tests/unit/c/test-fss-set_quote_resize.h new file mode 100644 index 0000000..4f63387 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-set_quote_resize.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test set quote resize in the fss project. + */ +#ifndef _TEST__F_fss__set_quote_resize +#define _TEST__F_fss__set_quote_resize + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_set_quote_resize() + */ +extern void test__f_fss_set_quote_resize__parameter_checking(void **state); + +/** + * Test that the function works. + * + * @see f_fss_set_quote_resize() + */ +extern void test__f_fss_set_quote_resize__works(void **state); + +#endif // _TEST__F_fss__set_quote_resize diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_quotes_adjust.c b/level_0/f_fss/tests/unit/c/test-fss-set_quotes_adjust.c new file mode 100644 index 0000000..eda1ba6 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-set_quotes_adjust.c @@ -0,0 +1,42 @@ +#include "test-fss.h" +#include "test-fss-set_quotes_adjust.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_set_quotes_adjust__parameter_checking(void **state) { + + const int length = 5; + f_fss_set_quotes_t data = f_fss_set_quotes_t_initialize; + + { + const f_status_t status = f_fss_set_quotes_adjust(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_fss_set_quotes_adjust__works(void **state) { + + const int length = 5; + f_fss_set_quotes_t data = f_fss_set_quotes_t_initialize; + + { + const f_status_t status = f_fss_set_quotes_adjust(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_quotes_adjust.h b/level_0/f_fss/tests/unit/c/test-fss-set_quotes_adjust.h new file mode 100644 index 0000000..78ef945 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-set_quotes_adjust.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test set quote adjust in the fss project. + */ +#ifndef _TEST__F_fss__set_quotes_adjust +#define _TEST__F_fss__set_quotes_adjust + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_set_quotes_adjust() + */ +extern void test__f_fss_set_quotes_adjust__parameter_checking(void **state); + +/** + * Test that the function works. + * + * @see f_fss_set_quotes_adjust() + */ +extern void test__f_fss_set_quotes_adjust__works(void **state); + +#endif // _TEST__F_fss__set_quotes_adjust diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_quotes_decimate_by.c b/level_0/f_fss/tests/unit/c/test-fss-set_quotes_decimate_by.c new file mode 100644 index 0000000..764892a --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-set_quotes_decimate_by.c @@ -0,0 +1,61 @@ +#include "test-fss.h" +#include "test-fss-set_quotes_decimate_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_set_quotes_decimate_by__parameter_checking(void **state) { + + const int length = 5; + f_fss_set_quotes_t data = f_fss_set_quotes_t_initialize; + + { + const f_status_t status = f_fss_set_quotes_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_fss_set_quotes_decimate_by__returns_data_not(void **state) { + + f_fss_set_quotes_t data = f_fss_set_quotes_t_initialize; + + { + const f_status_t status = f_fss_set_quotes_decimate_by(0, &data); + + assert_int_equal(status, F_data_not); + } +} + +void test__f_fss_set_quotes_decimate_by__works(void **state) { + + const int length = 5; + f_fss_set_quotes_t data = f_fss_set_quotes_t_initialize; + + { + const f_status_t status = f_fss_set_quotes_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_fss_set_quotes_decimate_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_quotes_decimate_by.h b/level_0/f_fss/tests/unit/c/test-fss-set_quotes_decimate_by.h new file mode 100644 index 0000000..65beaa3 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-set_quotes_decimate_by.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test set quote decimate by in the fss project. + */ +#ifndef _TEST__F_fss__set_quotes_decimate_by +#define _TEST__F_fss__set_quotes_decimate_by + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_set_quotes_decimate_by() + */ +extern void test__f_fss_set_quotes_decimate_by__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see f_fss_set_quotes_decimate_by() + */ +extern void test__f_fss_set_quotes_decimate_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_fss_set_quotes_decimate_by() + */ +extern void test__f_fss_set_quotes_decimate_by__works(void **state); + +#endif // _TEST__F_fss__set_quotes_decimate_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_quotes_decrease_by.c b/level_0/f_fss/tests/unit/c/test-fss-set_quotes_decrease_by.c new file mode 100644 index 0000000..3ba6e94 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-set_quotes_decrease_by.c @@ -0,0 +1,74 @@ +#include "test-fss.h" +#include "test-fss-set_quotes_decrease_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_set_quotes_decrease_by__parameter_checking(void **state) { + + const int length = 5; + f_fss_set_quotes_t data = f_fss_set_quotes_t_initialize; + + { + const f_status_t status = f_fss_set_quotes_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_fss_set_quotes_decrease_by__returns_data_not(void **state) { + + const int length = 5; + f_fss_set_quotes_t data = f_fss_set_quotes_t_initialize; + + { + const f_status_t status = f_fss_set_quotes_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_fss_set_quotes_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_fss_set_quotes_decrease_by__works(void **state) { + + const int length = 5; + f_fss_set_quotes_t data = f_fss_set_quotes_t_initialize; + + { + const f_status_t status = f_fss_set_quotes_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_fss_set_quotes_decrease_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_quotes_decrease_by.h b/level_0/f_fss/tests/unit/c/test-fss-set_quotes_decrease_by.h new file mode 100644 index 0000000..d11be2e --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-set_quotes_decrease_by.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test set quote decrease by in the fss project. + */ +#ifndef _TEST__F_fss__set_quotes_decrease_by +#define _TEST__F_fss__set_quotes_decrease_by + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_set_quotes_decrease_by() + */ +extern void test__f_fss_set_quotes_decrease_by__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see f_fss_set_quotes_decrease_by() + */ +extern void test__f_fss_set_quotes_decrease_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_fss_set_quotes_decrease_by() + */ +extern void test__f_fss_set_quotes_decrease_by__works(void **state); + +#endif // _TEST__F_fss__set_quotes_decrease_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_quotes_increase.c b/level_0/f_fss/tests/unit/c/test-fss-set_quotes_increase.c new file mode 100644 index 0000000..7b94503 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-set_quotes_increase.c @@ -0,0 +1,76 @@ +#include "test-fss.h" +#include "test-fss-set_quotes_increase.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_set_quotes_increase__parameter_checking(void **state) { + + const int length = 5; + f_fss_set_quotes_t data = f_fss_set_quotes_t_initialize; + + { + const f_status_t status = f_fss_set_quotes_increase(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + free((void *) data.array); +} + +void test__f_fss_set_quotes_increase__returns_data_not(void **state) { + + const int length = 5; + f_fss_set_quotes_t data = f_fss_set_quotes_t_initialize; + + { + const f_status_t status = f_fss_set_quotes_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_fss_set_quotes_increase(length, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_fss_set_quotes_increase__works(void **state) { + + const int length = 5; + f_fss_set_quotes_t data = f_fss_set_quotes_t_initialize; + + { + const f_status_t status = f_fss_set_quotes_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_fss_set_quotes_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); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_quotes_increase.h b/level_0/f_fss/tests/unit/c/test-fss-set_quotes_increase.h new file mode 100644 index 0000000..daa0297 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-set_quotes_increase.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test set quote increase in the fss project. + */ +#ifndef _TEST__F_fss__set_quotes_increase +#define _TEST__F_fss__set_quotes_increase + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_set_quotes_increase() + */ +extern void test__f_fss_set_quotes_increase__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see f_fss_set_quotes_increase() + */ +extern void test__f_fss_set_quotes_increase__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_fss_set_quotes_increase() + */ +extern void test__f_fss_set_quotes_increase__works(void **state); + +#endif // _TEST__F_fss__set_quotes_increase diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_quotes_increase_by.c b/level_0/f_fss/tests/unit/c/test-fss-set_quotes_increase_by.c new file mode 100644 index 0000000..16fd7a9 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-set_quotes_increase_by.c @@ -0,0 +1,76 @@ +#include "test-fss.h" +#include "test-fss-set_quotes_increase_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_set_quotes_increase_by__parameter_checking(void **state) { + + const int length = 5; + f_fss_set_quotes_t data = f_fss_set_quotes_t_initialize; + + { + const f_status_t status = f_fss_set_quotes_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_fss_set_quotes_increase_by__returns_data_not(void **state) { + + const int length = 5; + f_fss_set_quotes_t data = f_fss_set_quotes_t_initialize; + + { + const f_status_t status = f_fss_set_quotes_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_fss_set_quotes_increase_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_fss_set_quotes_increase_by__works(void **state) { + + const int length = 5; + f_fss_set_quotes_t data = f_fss_set_quotes_t_initialize; + + { + const f_status_t status = f_fss_set_quotes_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_fss_set_quotes_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 +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_quotes_increase_by.h b/level_0/f_fss/tests/unit/c/test-fss-set_quotes_increase_by.h new file mode 100644 index 0000000..078ce28 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-set_quotes_increase_by.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test set quote increase by in the fss project. + */ +#ifndef _TEST__F_fss__set_quotes_increase_by +#define _TEST__F_fss__set_quotes_increase_by + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_set_quotes_increase_by() + */ +extern void test__f_fss_set_quotes_increase_by__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see f_fss_set_quotes_increase_by() + */ +extern void test__f_fss_set_quotes_increase_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_fss_set_quotes_increase_by() + */ +extern void test__f_fss_set_quotes_increase_by__works(void **state); + +#endif // _TEST__F_fss__set_quotes_increase_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_quotes_resize.c b/level_0/f_fss/tests/unit/c/test-fss-set_quotes_resize.c new file mode 100644 index 0000000..327f527 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-set_quotes_resize.c @@ -0,0 +1,42 @@ +#include "test-fss.h" +#include "test-fss-set_quotes_resize.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_set_quotes_resize__parameter_checking(void **state) { + + const int length = 5; + f_fss_set_quotes_t data = f_fss_set_quotes_t_initialize; + + { + const f_status_t status = f_fss_set_quotes_resize(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_fss_set_quotes_resize__works(void **state) { + + const int length = 5; + f_fss_set_quotes_t data = f_fss_set_quotes_t_initialize; + + { + const f_status_t status = f_fss_set_quotes_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_quotes_resize.h b/level_0/f_fss/tests/unit/c/test-fss-set_quotes_resize.h new file mode 100644 index 0000000..4aac964 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-set_quotes_resize.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test set quote resize in the fss project. + */ +#ifndef _TEST__F_fss__set_quotes_resize +#define _TEST__F_fss__set_quotes_resize + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_set_quotes_resize() + */ +extern void test__f_fss_set_quotes_resize__parameter_checking(void **state); + +/** + * Test that the function works. + * + * @see f_fss_set_quotes_resize() + */ +extern void test__f_fss_set_quotes_resize__works(void **state); + +#endif // _TEST__F_fss__set_quotes_resize diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_resize.c b/level_0/f_fss/tests/unit/c/test-fss-set_resize.c new file mode 100644 index 0000000..94fb610 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-set_resize.c @@ -0,0 +1,48 @@ +#include "test-fss.h" +#include "test-fss-set_resize.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_set_resize__parameter_checking(void **state) { + + const int length = 5; + f_fss_set_t data = f_fss_set_t_initialize; + + { + const f_status_t status = f_fss_set_resize(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.objects.size, 0); + assert_int_equal(data.contents.used, 0); + assert_int_equal(data.contents.size, 0); + } + + assert_null(data.objects.array); + assert_null(data.contents.array); +} + +void test__f_fss_set_resize__works(void **state) { + + const int length = 5; + f_fss_set_t data = f_fss_set_t_initialize; + + { + const f_status_t status = f_fss_set_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.objects.used, 0); + assert_int_equal(data.objects.size, length); + assert_int_equal(data.contents.used, 0); + assert_int_equal(data.contents.size, length); + } + + free((void *) data.objects.array); + free((void *) data.contents.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-set_resize.h b/level_0/f_fss/tests/unit/c/test-fss-set_resize.h new file mode 100644 index 0000000..109e72e --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-set_resize.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test set resize in the fss project. + */ +#ifndef _TEST__F_fss__set_resize +#define _TEST__F_fss__set_resize + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_set_resize() + */ +extern void test__f_fss_set_resize__parameter_checking(void **state); + +/** + * Test that the function works. + * + * @see f_fss_set_resize() + */ +extern void test__f_fss_set_resize__works(void **state); + +#endif // _TEST__F_fss__set_resize diff --git a/level_0/f_fss/tests/unit/c/test-fss-sets_adjust.c b/level_0/f_fss/tests/unit/c/test-fss-sets_adjust.c new file mode 100644 index 0000000..b6cc15b --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-sets_adjust.c @@ -0,0 +1,42 @@ +#include "test-fss.h" +#include "test-fss-sets_adjust.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_sets_adjust__parameter_checking(void **state) { + + const int length = 5; + f_fss_sets_t data = f_fss_sets_t_initialize; + + { + const f_status_t status = f_fss_sets_adjust(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_fss_sets_adjust__works(void **state) { + + const int length = 5; + f_fss_sets_t data = f_fss_sets_t_initialize; + + { + const f_status_t status = f_fss_sets_adjust(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-sets_adjust.h b/level_0/f_fss/tests/unit/c/test-fss-sets_adjust.h new file mode 100644 index 0000000..b1c4e53 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-sets_adjust.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test sets adjust in the fss project. + */ +#ifndef _TEST__F_fss__sets_adjust +#define _TEST__F_fss__sets_adjust + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_sets_adjust() + */ +extern void test__f_fss_sets_adjust__parameter_checking(void **state); + +/** + * Test that the function works. + * + * @see f_fss_sets_adjust() + */ +extern void test__f_fss_sets_adjust__works(void **state); + +#endif // _TEST__F_fss__sets_adjust diff --git a/level_0/f_fss/tests/unit/c/test-fss-sets_decimate_by.c b/level_0/f_fss/tests/unit/c/test-fss-sets_decimate_by.c new file mode 100644 index 0000000..677df5e --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-sets_decimate_by.c @@ -0,0 +1,74 @@ +#include "test-fss.h" +#include "test-fss-sets_decimate_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_sets_decimate_by__parameter_checking(void **state) { + + const int length = 5; + f_fss_sets_t data = f_fss_sets_t_initialize; + + { + const f_status_t status = f_fss_sets_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_fss_sets_decimate_by__returns_data_not(void **state) { + + const int length = 5; + f_fss_sets_t data = f_fss_sets_t_initialize; + + { + const f_status_t status = f_fss_sets_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_fss_sets_decimate_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_fss_sets_decimate_by__works(void **state) { + + const int length = 5; + f_fss_sets_t data = f_fss_sets_t_initialize; + + { + const f_status_t status = f_fss_sets_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_fss_sets_decimate_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-sets_decimate_by.h b/level_0/f_fss/tests/unit/c/test-fss-sets_decimate_by.h new file mode 100644 index 0000000..f6c09e0 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-sets_decimate_by.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test sets decimate by in the fss project. + */ +#ifndef _TEST__F_fss__sets_decimate_by +#define _TEST__F_fss__sets_decimate_by + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_sets_decimate_by() + */ +extern void test__f_fss_sets_decimate_by__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see f_fss_sets_decimate_by() + */ +extern void test__f_fss_sets_decimate_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_fss_sets_decimate_by() + */ +extern void test__f_fss_sets_decimate_by__works(void **state); + +#endif // _TEST__F_fss__sets_decimate_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-sets_decrease_by.c b/level_0/f_fss/tests/unit/c/test-fss-sets_decrease_by.c new file mode 100644 index 0000000..42ee4ed --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-sets_decrease_by.c @@ -0,0 +1,74 @@ +#include "test-fss.h" +#include "test-fss-sets_decrease_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_sets_decrease_by__parameter_checking(void **state) { + + const int length = 5; + f_fss_sets_t data = f_fss_sets_t_initialize; + + { + const f_status_t status = f_fss_sets_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_fss_sets_decrease_by__returns_data_not(void **state) { + + const int length = 5; + f_fss_sets_t data = f_fss_sets_t_initialize; + + { + const f_status_t status = f_fss_sets_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_fss_sets_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_fss_sets_decrease_by__works(void **state) { + + const int length = 5; + f_fss_sets_t data = f_fss_sets_t_initialize; + + { + const f_status_t status = f_fss_sets_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_fss_sets_decrease_by(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-sets_decrease_by.h b/level_0/f_fss/tests/unit/c/test-fss-sets_decrease_by.h new file mode 100644 index 0000000..e8c2596 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-sets_decrease_by.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test sets decrease by in the fss project. + */ +#ifndef _TEST__F_fss__sets_decrease_by +#define _TEST__F_fss__sets_decrease_by + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_sets_decrease_by() + */ +extern void test__f_fss_sets_decrease_by__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see f_fss_sets_decrease_by() + */ +extern void test__f_fss_sets_decrease_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_fss_sets_decrease_by() + */ +extern void test__f_fss_sets_decrease_by__works(void **state); + +#endif // _TEST__F_fss__sets_decrease_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-sets_increase.c b/level_0/f_fss/tests/unit/c/test-fss-sets_increase.c new file mode 100644 index 0000000..8500388 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-sets_increase.c @@ -0,0 +1,76 @@ +#include "test-fss.h" +#include "test-fss-sets_increase.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_sets_increase__parameter_checking(void **state) { + + const int length = 5; + f_fss_sets_t data = f_fss_sets_t_initialize; + + { + const f_status_t status = f_fss_sets_increase(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + free((void *) data.array); +} + +void test__f_fss_sets_increase__returns_data_not(void **state) { + + const int length = 5; + f_fss_sets_t data = f_fss_sets_t_initialize; + + { + const f_status_t status = f_fss_sets_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_fss_sets_increase(length, &data); + + assert_int_equal(status, F_data_not); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +void test__f_fss_sets_increase__works(void **state) { + + const int length = 5; + f_fss_sets_t data = f_fss_sets_t_initialize; + + { + const f_status_t status = f_fss_sets_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_fss_sets_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); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-sets_increase.h b/level_0/f_fss/tests/unit/c/test-fss-sets_increase.h new file mode 100644 index 0000000..3d942d1 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-sets_increase.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test sets increase in the fss project. + */ +#ifndef _TEST__F_fss__sets_increase +#define _TEST__F_fss__sets_increase + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_sets_increase() + */ +extern void test__f_fss_sets_increase__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see f_fss_sets_increase() + */ +extern void test__f_fss_sets_increase__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_fss_sets_increase() + */ +extern void test__f_fss_sets_increase__works(void **state); + +#endif // _TEST__F_fss__sets_increase diff --git a/level_0/f_fss/tests/unit/c/test-fss-sets_increase_by.c b/level_0/f_fss/tests/unit/c/test-fss-sets_increase_by.c new file mode 100644 index 0000000..e6b8ca7 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-sets_increase_by.c @@ -0,0 +1,76 @@ +#include "test-fss.h" +#include "test-fss-sets_increase_by.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_sets_increase_by__parameter_checking(void **state) { + + const int length = 5; + f_fss_sets_t data = f_fss_sets_t_initialize; + + { + const f_status_t status = f_fss_sets_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_fss_sets_increase_by__returns_data_not(void **state) { + + const int length = 5; + f_fss_sets_t data = f_fss_sets_t_initialize; + + { + const f_status_t status = f_fss_sets_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_fss_sets_increase_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_fss_sets_increase_by__works(void **state) { + + const int length = 5; + f_fss_sets_t data = f_fss_sets_t_initialize; + + { + const f_status_t status = f_fss_sets_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + { + data.used = length; + + const f_status_t status = f_fss_sets_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 +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-sets_increase_by.h b/level_0/f_fss/tests/unit/c/test-fss-sets_increase_by.h new file mode 100644 index 0000000..e8ef640 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-sets_increase_by.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test sets increase by in the fss project. + */ +#ifndef _TEST__F_fss__sets_increase_by +#define _TEST__F_fss__sets_increase_by + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_sets_increase_by() + */ +extern void test__f_fss_sets_increase_by__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see f_fss_sets_increase_by() + */ +extern void test__f_fss_sets_increase_by__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_fss_sets_increase_by() + */ +extern void test__f_fss_sets_increase_by__works(void **state); + +#endif // _TEST__F_fss__sets_increase_by diff --git a/level_0/f_fss/tests/unit/c/test-fss-sets_resize.c b/level_0/f_fss/tests/unit/c/test-fss-sets_resize.c new file mode 100644 index 0000000..c0a2351 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-sets_resize.c @@ -0,0 +1,42 @@ +#include "test-fss.h" +#include "test-fss-sets_resize.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_sets_resize__parameter_checking(void **state) { + + const int length = 5; + f_fss_sets_t data = f_fss_sets_t_initialize; + + { + const f_status_t status = f_fss_sets_resize(length, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, 0); + } + + assert_null(data.array); +} + +void test__f_fss_sets_resize__works(void **state) { + + const int length = 5; + f_fss_sets_t data = f_fss_sets_t_initialize; + + { + const f_status_t status = f_fss_sets_resize(length, &data); + + assert_int_equal(status, F_none); + assert_int_equal(data.used, 0); + assert_int_equal(data.size, length); + } + + free((void *) data.array); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-sets_resize.h b/level_0/f_fss/tests/unit/c/test-fss-sets_resize.h new file mode 100644 index 0000000..2a1d1f6 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-sets_resize.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test sets resize by in the fss project. + */ +#ifndef _TEST__F_fss__sets_resize +#define _TEST__F_fss__sets_resize + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_sets_resize() + */ +extern void test__f_fss_sets_resize__parameter_checking(void **state); + +/** + * Test that the function works. + * + * @see f_fss_sets_resize() + */ +extern void test__f_fss_sets_resize__works(void **state); + +#endif // _TEST__F_fss__sets_resize diff --git a/level_0/f_fss/tests/unit/c/test-fss-skip_past_delimit.c b/level_0/f_fss/tests/unit/c/test-fss-skip_past_delimit.c new file mode 100644 index 0000000..8f24417 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-skip_past_delimit.c @@ -0,0 +1,89 @@ +#include "test-fss.h" +#include "test-fss-skip_past_delimit.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_skip_past_delimit__parameter_checking(void **state) { + + const f_string_static_t test = macro_f_string_static_t_initialize("test", 0, 4); + f_state_t state_data = f_state_t_initialize; + + { + const f_status_t status = f_fss_skip_past_delimit(state_data, test, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +void test__f_fss_skip_past_delimit__returns_data_not(void **state) { + + const f_string_static_t test = macro_f_string_static_t_initialize("test", 0, 4); + f_state_t state_data = f_state_t_initialize; + + { + f_string_range_t range = f_string_range_t_initialize; + + const f_status_t status = f_fss_skip_past_delimit(state_data, f_string_empty_s, &range); + + assert_int_equal(status, F_data_not); + } + + { + f_string_range_t range = f_string_range_t_initialize; + + const f_status_t status = f_fss_skip_past_delimit(state_data, test, &range); + + assert_int_equal(status, F_data_not); + } + + { + f_string_range_t range = macro_f_string_range_t_initialize(0, test.used - 1); + + const f_status_t status = f_fss_skip_past_delimit(state_data, f_string_empty_s, &range); + + assert_int_equal(status, F_data_not); + } + + { + f_string_range_t range = macro_f_string_range_t_initialize(test.used, test.used + 2); + + const f_status_t status = f_fss_skip_past_delimit(state_data, test, &range); + + assert_int_equal(status, F_data_not); + } +} + +void test__f_fss_skip_past_delimit__works(void **state) { + + f_state_t state_data = f_state_t_initialize; + + f_string_static_t tests[] = { + macro_f_string_static_t_initialize("test", 0, 4), + macro_f_string_static_t_initialize("\0test", 0, 5), + macro_f_string_static_t_initialize("\0\0\0test", 0, 7), + macro_f_string_static_t_initialize("\0\0\0test\0\0", 0, 9), + }; + + f_array_length_t expects[] = { + 0, + 1, + 3, + 3, + }; + + for (uint8_t i = 0; i < 4; ++i) { + + f_string_range_t range = macro_f_string_range_t_initialize(0, tests[i].used - 1); + + const f_status_t status = f_fss_skip_past_delimit(state_data, tests[i], &range); + + assert_int_equal(status, F_none); + assert_int_equal(range.start, expects[i]); + } // for +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-skip_past_delimit.h b/level_0/f_fss/tests/unit/c/test-fss-skip_past_delimit.h new file mode 100644 index 0000000..5a90288 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-skip_past_delimit.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test skip past delimit in the fss project. + */ +#ifndef _TEST__F_fss__skip_past_delimit +#define _TEST__F_fss__skip_past_delimit + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_skip_past_delimit() + */ +extern void test__f_fss_skip_past_delimit__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see f_fss_skip_past_delimit() + */ +extern void test__f_fss_skip_past_delimit__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_fss_skip_past_delimit() + */ +extern void test__f_fss_skip_past_delimit__works(void **state); + +#endif // _TEST__F_fss__skip_past_delimit diff --git a/level_0/f_fss/tests/unit/c/test-fss-skip_past_space.c b/level_0/f_fss/tests/unit/c/test-fss-skip_past_space.c new file mode 100644 index 0000000..d192a31 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-skip_past_space.c @@ -0,0 +1,95 @@ +#include "test-fss.h" +#include "test-fss-skip_past_space.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_fss_skip_past_space__parameter_checking(void **state) { + + const f_string_static_t test = macro_f_string_static_t_initialize("test", 0, 4); + f_state_t state_data = f_state_t_initialize; + + { + const f_status_t status = f_fss_skip_past_space(state_data, test, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +void test__f_fss_skip_past_space__returns_data_not(void **state) { + + const f_string_static_t test = macro_f_string_static_t_initialize("test", 0, 4); + f_state_t state_data = f_state_t_initialize; + + { + f_string_range_t range = f_string_range_t_initialize; + + const f_status_t status = f_fss_skip_past_space(state_data, f_string_empty_s, &range); + + assert_int_equal(status, F_data_not); + } + + { + f_string_range_t range = f_string_range_t_initialize; + + const f_status_t status = f_fss_skip_past_space(state_data, test, &range); + + assert_int_equal(status, F_data_not); + } + + { + f_string_range_t range = macro_f_string_range_t_initialize(0, test.used - 1); + + const f_status_t status = f_fss_skip_past_space(state_data, f_string_empty_s, &range); + + assert_int_equal(status, F_data_not); + } + + { + f_string_range_t range = macro_f_string_range_t_initialize(test.used, test.used + 2); + + const f_status_t status = f_fss_skip_past_space(state_data, test, &range); + + assert_int_equal(status, F_data_not); + } +} + +void test__f_fss_skip_past_space__works(void **state) { + + f_state_t state_data = f_state_t_initialize; + + f_string_static_t tests[] = { + macro_f_string_static_t_initialize("test", 0, 4), + macro_f_string_static_t_initialize(" test", 0, 5), + macro_f_string_static_t_initialize(" test", 0, 7), + macro_f_string_static_t_initialize(" \0test ", 0, 9), + macro_f_string_static_t_initialize(" \t\atest ", 0, 9), + macro_f_string_static_t_initialize("\a\t $test ", 0, 10), + macro_f_string_static_t_initialize(" ́test", 0, 7), + }; + + f_array_length_t expects[] = { + 0, + 1, + 3, + 3, + 3, + 3, + 3, + }; + + for (uint8_t i = 0; i < 7; ++i) { + + f_string_range_t range = macro_f_string_range_t_initialize(0, tests[i].used - 1); + + const f_status_t status = f_fss_skip_past_space(state_data, tests[i], &range); + + assert_int_equal(status, F_none); + assert_int_equal(range.start, expects[i]); + } // for +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss-skip_past_space.h b/level_0/f_fss/tests/unit/c/test-fss-skip_past_space.h new file mode 100644 index 0000000..2595044 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss-skip_past_space.h @@ -0,0 +1,34 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test skip past space in the fss project. + */ +#ifndef _TEST__F_fss__skip_past_space +#define _TEST__F_fss__skip_past_space + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_fss_skip_past_space() + */ +extern void test__f_fss_skip_past_space__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see f_fss_skip_past_space() + */ +extern void test__f_fss_skip_past_space__returns_data_not(void **state); + +/** + * Test that the function works. + * + * @see f_fss_skip_past_space() + */ +extern void test__f_fss_skip_past_space__works(void **state); + +#endif // _TEST__F_fss__skip_past_space diff --git a/level_0/f_fss/tests/unit/c/test-fss.c b/level_0/f_fss/tests/unit/c/test-fss.c new file mode 100644 index 0000000..70c1057 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss.c @@ -0,0 +1,178 @@ +#include "test-fss.h" + +#ifdef __cplusplus +extern "C" { +#endif + +int setup(void **state) { + + return 0; +} + +int setdown(void **state) { + + errno = 0; + + return 0; +} + +int main(void) { + + const struct CMUnitTest tests[] = { + cmocka_unit_test(test__f_fss_apply_delimit__returns_data_not), + cmocka_unit_test(test__f_fss_apply_delimit_range__returns_data_not), + cmocka_unit_test(test__f_fss_count_lines__returns_data_not), + cmocka_unit_test(test__f_fss_count_lines_range__returns_data_not), + cmocka_unit_test(test__f_fss_seek_to_eol__returns_data_not), + cmocka_unit_test(test__f_fss_skip_past_delimit__returns_data_not), + cmocka_unit_test(test__f_fss_skip_past_space__returns_data_not), + + cmocka_unit_test(test__f_fss_apply_delimit__works), + cmocka_unit_test(test__f_fss_apply_delimit_range__works), + cmocka_unit_test(test__f_fss_count_lines__works), + cmocka_unit_test(test__f_fss_count_lines_range__works), + cmocka_unit_test(test__f_fss_is_combining__works), + cmocka_unit_test(test__f_fss_is_graph__works), + cmocka_unit_test(test__f_fss_is_space__works), + cmocka_unit_test(test__f_fss_is_zero_width__works), + cmocka_unit_test(test__f_fss_seek_to_eol__works), + cmocka_unit_test(test__f_fss_skip_past_delimit__works), + cmocka_unit_test(test__f_fss_skip_past_space__works), + + cmocka_unit_test(test__f_fss_fail_utf__works_for_error), + cmocka_unit_test(test__f_fss_fail_utf_to_false__works_for_error), + + cmocka_unit_test(test__f_fss_fail_utf__works_for_no_error), + cmocka_unit_test(test__f_fss_fail_utf_to_false__works_for_no_error), + + cmocka_unit_test(test__f_fss_items_decimate_by__returns_data_not), + cmocka_unit_test(test__f_fss_items_decrease_by__returns_data_not), + cmocka_unit_test(test__f_fss_items_increase__returns_data_not), + cmocka_unit_test(test__f_fss_items_increase_by__returns_data_not), + + cmocka_unit_test(test__f_fss_named_decimate_by__returns_data_not), + cmocka_unit_test(test__f_fss_named_decrease_by__returns_data_not), + cmocka_unit_test(test__f_fss_named_increase__returns_data_not), + cmocka_unit_test(test__f_fss_named_increase_by__returns_data_not), + + cmocka_unit_test(test__f_fss_nameds_decimate_by__returns_data_not), + cmocka_unit_test(test__f_fss_nameds_decrease_by__returns_data_not), + cmocka_unit_test(test__f_fss_nameds_increase__returns_data_not), + cmocka_unit_test(test__f_fss_nameds_increase_by__returns_data_not), + + cmocka_unit_test(test__f_fss_nest_decimate_by__returns_data_not), + cmocka_unit_test(test__f_fss_nest_decrease_by__returns_data_not), + cmocka_unit_test(test__f_fss_nest_increase__returns_data_not), + cmocka_unit_test(test__f_fss_nest_increase_by__returns_data_not), + + cmocka_unit_test(test__f_fss_nests_decimate_by__returns_data_not), + cmocka_unit_test(test__f_fss_nests_decrease_by__returns_data_not), + cmocka_unit_test(test__f_fss_nests_increase__returns_data_not), + cmocka_unit_test(test__f_fss_nests_increase_by__returns_data_not), + + cmocka_unit_test(test__f_fss_set_decimate_by__returns_data_not), + cmocka_unit_test(test__f_fss_set_decrease_by__returns_data_not), + cmocka_unit_test(test__f_fss_set_increase__returns_data_not), + cmocka_unit_test(test__f_fss_set_increase_by__returns_data_not), + + cmocka_unit_test(test__f_fss_set_quote_decimate_by__returns_data_not), + cmocka_unit_test(test__f_fss_set_quote_decrease_by__returns_data_not), + cmocka_unit_test(test__f_fss_set_quote_increase__returns_data_not), + cmocka_unit_test(test__f_fss_set_quote_increase_by__returns_data_not), + + cmocka_unit_test(test__f_fss_set_quotes_decimate_by__returns_data_not), + cmocka_unit_test(test__f_fss_set_quotes_decrease_by__returns_data_not), + cmocka_unit_test(test__f_fss_set_quotes_increase__returns_data_not), + cmocka_unit_test(test__f_fss_set_quotes_increase_by__returns_data_not), + + cmocka_unit_test(test__f_fss_sets_decimate_by__returns_data_not), + cmocka_unit_test(test__f_fss_sets_decrease_by__returns_data_not), + cmocka_unit_test(test__f_fss_sets_increase__returns_data_not), + cmocka_unit_test(test__f_fss_sets_increase_by__returns_data_not), + + #ifndef _di_level_0_parameter_checking_ + cmocka_unit_test(test__f_fss_apply_delimit__parameter_checking), + cmocka_unit_test(test__f_fss_apply_delimit_range__parameter_checking), + cmocka_unit_test(test__f_fss_count_lines__parameter_checking), + cmocka_unit_test(test__f_fss_count_lines_range__parameter_checking), + // f_fss_fail_utf() doesn't use parameter checking. + // f_fss_fail_utf_false() doesn't use parameter checking. + // f_fss_is_combining() doesn't use parameter checking. + // f_fss_is_graph() doesn't use parameter checking. + // f_fss_is_space() doesn't use parameter checking. + // f_fss_is_zero_width() doesn't use parameter checking. + cmocka_unit_test(test__f_fss_seek_to_eol__parameter_checking), + cmocka_unit_test(test__f_fss_skip_past_delimit__parameter_checking), + cmocka_unit_test(test__f_fss_skip_past_space__parameter_checking), + + cmocka_unit_test(test__f_fss_items_adjust__parameter_checking), + cmocka_unit_test(test__f_fss_items_decimate_by__parameter_checking), + cmocka_unit_test(test__f_fss_items_decrease_by__parameter_checking), + cmocka_unit_test(test__f_fss_items_increase__parameter_checking), + cmocka_unit_test(test__f_fss_items_increase_by__parameter_checking), + cmocka_unit_test(test__f_fss_items_resize__parameter_checking), + + cmocka_unit_test(test__f_fss_named_adjust__parameter_checking), + cmocka_unit_test(test__f_fss_named_decimate_by__parameter_checking), + cmocka_unit_test(test__f_fss_named_decrease_by__parameter_checking), + cmocka_unit_test(test__f_fss_named_increase__parameter_checking), + cmocka_unit_test(test__f_fss_named_increase_by__parameter_checking), + cmocka_unit_test(test__f_fss_named_resize__parameter_checking), + + cmocka_unit_test(test__f_fss_nameds_adjust__parameter_checking), + cmocka_unit_test(test__f_fss_nameds_decimate_by__parameter_checking), + cmocka_unit_test(test__f_fss_nameds_decrease_by__parameter_checking), + cmocka_unit_test(test__f_fss_nameds_increase__parameter_checking), + cmocka_unit_test(test__f_fss_nameds_increase_by__parameter_checking), + cmocka_unit_test(test__f_fss_nameds_resize__parameter_checking), + + cmocka_unit_test(test__f_fss_nest_adjust__parameter_checking), + cmocka_unit_test(test__f_fss_nest_decimate_by__parameter_checking), + cmocka_unit_test(test__f_fss_nest_decrease_by__parameter_checking), + cmocka_unit_test(test__f_fss_nest_increase__parameter_checking), + cmocka_unit_test(test__f_fss_nest_increase_by__parameter_checking), + cmocka_unit_test(test__f_fss_nest_resize__parameter_checking), + + cmocka_unit_test(test__f_fss_nests_adjust__parameter_checking), + cmocka_unit_test(test__f_fss_nests_decimate_by__parameter_checking), + cmocka_unit_test(test__f_fss_nests_decrease_by__parameter_checking), + cmocka_unit_test(test__f_fss_nests_increase__parameter_checking), + cmocka_unit_test(test__f_fss_nests_increase_by__parameter_checking), + cmocka_unit_test(test__f_fss_nests_resize__parameter_checking), + + cmocka_unit_test(test__f_fss_set_adjust__parameter_checking), + cmocka_unit_test(test__f_fss_set_decimate_by__parameter_checking), + cmocka_unit_test(test__f_fss_set_decrease_by__parameter_checking), + cmocka_unit_test(test__f_fss_set_increase__parameter_checking), + cmocka_unit_test(test__f_fss_set_increase_by__parameter_checking), + cmocka_unit_test(test__f_fss_set_resize__parameter_checking), + + cmocka_unit_test(test__f_fss_set_quote_adjust__parameter_checking), + cmocka_unit_test(test__f_fss_set_quote_decimate_by__parameter_checking), + cmocka_unit_test(test__f_fss_set_quote_decrease_by__parameter_checking), + cmocka_unit_test(test__f_fss_set_quote_increase__parameter_checking), + cmocka_unit_test(test__f_fss_set_quote_increase_by__parameter_checking), + cmocka_unit_test(test__f_fss_set_quote_resize__parameter_checking), + + cmocka_unit_test(test__f_fss_set_quotes_adjust__parameter_checking), + cmocka_unit_test(test__f_fss_set_quotes_decimate_by__parameter_checking), + cmocka_unit_test(test__f_fss_set_quotes_decrease_by__parameter_checking), + cmocka_unit_test(test__f_fss_set_quotes_increase__parameter_checking), + cmocka_unit_test(test__f_fss_set_quotes_increase_by__parameter_checking), + cmocka_unit_test(test__f_fss_set_quotes_resize__parameter_checking), + + cmocka_unit_test(test__f_fss_sets_adjust__parameter_checking), + cmocka_unit_test(test__f_fss_sets_decimate_by__parameter_checking), + cmocka_unit_test(test__f_fss_sets_decrease_by__parameter_checking), + cmocka_unit_test(test__f_fss_sets_increase__parameter_checking), + cmocka_unit_test(test__f_fss_sets_increase_by__parameter_checking), + cmocka_unit_test(test__f_fss_sets_resize__parameter_checking), + #endif // _di_level_0_parameter_checking_ + }; + + return cmocka_run_group_tests(tests, setup, setdown); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_fss/tests/unit/c/test-fss.h b/level_0/f_fss/tests/unit/c/test-fss.h new file mode 100644 index 0000000..9b90048 --- /dev/null +++ b/level_0/f_fss/tests/unit/c/test-fss.h @@ -0,0 +1,138 @@ +/** + * FLL - Level 0 + * + * Project: FSS + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the fss project. + */ +#ifndef _TEST__F_fss_h +#define _TEST__F_fss_h + +// Libc includes. +#include +#include +#include +#include + +// cmocka includes. +#include + +// FLL-0 includes. +#include + +// Mock includes. +#include "mock-fss.h" + +// Test includes. +#include "test-fss-apply_delimit.h" +#include "test-fss-apply_delimit_range.h" +#include "test-fss-count_lines.h" +#include "test-fss-count_lines_range.h" +#include "test-fss-fail_utf.h" +#include "test-fss-fail_utf_to_false.h" +#include "test-fss-is_combining.h" +#include "test-fss-is_graph.h" +#include "test-fss-is_space.h" +#include "test-fss-is_zero_width.h" +#include "test-fss-items_adjust.h" +#include "test-fss-items_decimate_by.h" +#include "test-fss-items_decrease_by.h" +#include "test-fss-items_increase.h" +#include "test-fss-items_increase_by.h" +#include "test-fss-items_resize.h" +#include "test-fss-named_adjust.h" +#include "test-fss-named_decimate_by.h" +#include "test-fss-named_decrease_by.h" +#include "test-fss-named_increase.h" +#include "test-fss-named_increase_by.h" +#include "test-fss-named_resize.h" +#include "test-fss-nameds_adjust.h" +#include "test-fss-nameds_decimate_by.h" +#include "test-fss-nameds_decrease_by.h" +#include "test-fss-nameds_increase.h" +#include "test-fss-nameds_increase_by.h" +#include "test-fss-nameds_resize.h" +#include "test-fss-nest_adjust.h" +#include "test-fss-nest_decimate_by.h" +#include "test-fss-nest_decrease_by.h" +#include "test-fss-nest_increase.h" +#include "test-fss-nest_increase_by.h" +#include "test-fss-nest_resize.h" +#include "test-fss-nests_adjust.h" +#include "test-fss-nests_decimate_by.h" +#include "test-fss-nests_decrease_by.h" +#include "test-fss-nests_increase.h" +#include "test-fss-nests_increase_by.h" +#include "test-fss-nests_resize.h" +#include "test-fss-seek_to_eol.h" +#include "test-fss-set_adjust.h" +#include "test-fss-set_decimate_by.h" +#include "test-fss-set_decrease_by.h" +#include "test-fss-set_increase.h" +#include "test-fss-set_increase_by.h" +#include "test-fss-set_resize.h" +#include "test-fss-set_quote_adjust.h" +#include "test-fss-set_quote_decimate_by.h" +#include "test-fss-set_quote_decrease_by.h" +#include "test-fss-set_quote_increase.h" +#include "test-fss-set_quote_increase_by.h" +#include "test-fss-set_quote_resize.h" +#include "test-fss-set_quotes_adjust.h" +#include "test-fss-set_quotes_decimate_by.h" +#include "test-fss-set_quotes_decrease_by.h" +#include "test-fss-set_quotes_increase.h" +#include "test-fss-set_quotes_increase_by.h" +#include "test-fss-set_quotes_resize.h" +#include "test-fss-sets_adjust.h" +#include "test-fss-sets_decimate_by.h" +#include "test-fss-sets_decrease_by.h" +#include "test-fss-sets_increase.h" +#include "test-fss-sets_increase_by.h" +#include "test-fss-sets_resize.h" +#include "test-fss-skip_past_delimit.h" +#include "test-fss-skip_past_space.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Perform any setup operations. + * + * @param state + * The test state. + * + * @return + * The status of this function, where 0 means success. + */ +extern int setup(void **state); + +/** + * Peform any setdown operations. + * + * @param state + * The test state. + * + * @return + * The status of this function, where 0 means success. + */ +extern int setdown(void **state); + +/** + * Run all tests. + * + * @return + * The final result of the tests. + * + * @see cmocka_run_group_tests() + * @see cmocka_unit_test() + */ +extern int main(void); + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _TEST__F_fss_h -- 1.8.3.1