From 4914e0a7b3b634be96145df0547c2b9a51720ad8 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Sun, 21 Jan 2024 22:49:47 -0600 Subject: [PATCH] Progress: Add basic unit tests for other fl_fss functions. This adds only the parameter checking and the F_data_not return checking unit tests. --- level_1/fl_fss/data/build/settings-tests | 5 + .../tests/unit/c/test-fss-basic_content_read.c | 90 ++++++++++++ .../tests/unit/c/test-fss-basic_content_read.h | 27 ++++ .../tests/unit/c/test-fss-basic_content_write.c | 64 ++++++++ .../tests/unit/c/test-fss-basic_content_write.h | 27 ++++ .../unit/c/test-fss-basic_list_content_read.c | 124 ++++++++++++++++ .../unit/c/test-fss-basic_list_content_read.h | 27 ++++ .../unit/c/test-fss-basic_list_content_write.c | 104 +++++++++++++ .../unit/c/test-fss-basic_list_content_write.h | 27 ++++ .../tests/unit/c/test-fss-basic_list_object_read.c | 90 ++++++++++++ .../tests/unit/c/test-fss-basic_list_object_read.h | 27 ++++ .../unit/c/test-fss-basic_list_object_write.c | 64 ++++++++ .../unit/c/test-fss-basic_list_object_write.h | 27 ++++ .../tests/unit/c/test-fss-basic_object_read.c | 140 ++++++++++++++++++ .../tests/unit/c/test-fss-basic_object_read.h | 27 ++++ .../tests/unit/c/test-fss-basic_object_write.c | 64 ++++++++ .../tests/unit/c/test-fss-basic_object_write.h | 27 ++++ .../unit/c/test-fss-embedded_list_content_read.c | 140 ++++++++++++++++++ .../unit/c/test-fss-embedded_list_content_read.h | 27 ++++ .../unit/c/test-fss-embedded_list_content_write.c | 162 +++++++++++++++++++++ .../unit/c/test-fss-embedded_list_content_write.h | 27 ++++ .../unit/c/test-fss-embedded_list_object_read.c | 90 ++++++++++++ .../unit/c/test-fss-embedded_list_object_read.h | 27 ++++ .../unit/c/test-fss-embedded_list_object_write.c | 64 ++++++++ .../unit/c/test-fss-embedded_list_object_write.h | 27 ++++ .../tests/unit/c/test-fss-extended_content_read.c | 140 ++++++++++++++++++ .../tests/unit/c/test-fss-extended_content_read.h | 27 ++++ .../tests/unit/c/test-fss-extended_content_write.c | 64 ++++++++ .../tests/unit/c/test-fss-extended_content_write.h | 27 ++++ .../unit/c/test-fss-extended_list_content_read.c | 156 ++++++++++++++++++++ .../unit/c/test-fss-extended_list_content_read.h | 27 ++++ .../unit/c/test-fss-extended_list_content_write.c | 162 +++++++++++++++++++++ .../unit/c/test-fss-extended_list_content_write.h | 27 ++++ .../unit/c/test-fss-extended_list_object_read.c | 90 ++++++++++++ .../unit/c/test-fss-extended_list_object_read.h | 27 ++++ .../unit/c/test-fss-extended_list_object_write.c | 64 ++++++++ .../unit/c/test-fss-extended_list_object_write.h | 27 ++++ .../tests/unit/c/test-fss-extended_object_read.c | 156 ++++++++++++++++++++ .../tests/unit/c/test-fss-extended_object_read.h | 27 ++++ .../tests/unit/c/test-fss-extended_object_write.c | 64 ++++++++ .../tests/unit/c/test-fss-extended_object_write.h | 27 ++++ .../tests/unit/c/test-fss-payload_header_map.h | 3 +- level_1/fl_fss/tests/unit/c/test-fss.c | 50 +++++++ level_1/fl_fss/tests/unit/c/test-fss.h | 25 ++++ 44 files changed, 2713 insertions(+), 2 deletions(-) create mode 100644 level_1/fl_fss/tests/unit/c/test-fss-basic_content_read.c create mode 100644 level_1/fl_fss/tests/unit/c/test-fss-basic_content_read.h create mode 100644 level_1/fl_fss/tests/unit/c/test-fss-basic_content_write.c create mode 100644 level_1/fl_fss/tests/unit/c/test-fss-basic_content_write.h create mode 100644 level_1/fl_fss/tests/unit/c/test-fss-basic_list_content_read.c create mode 100644 level_1/fl_fss/tests/unit/c/test-fss-basic_list_content_read.h create mode 100644 level_1/fl_fss/tests/unit/c/test-fss-basic_list_content_write.c create mode 100644 level_1/fl_fss/tests/unit/c/test-fss-basic_list_content_write.h create mode 100644 level_1/fl_fss/tests/unit/c/test-fss-basic_list_object_read.c create mode 100644 level_1/fl_fss/tests/unit/c/test-fss-basic_list_object_read.h create mode 100644 level_1/fl_fss/tests/unit/c/test-fss-basic_list_object_write.c create mode 100644 level_1/fl_fss/tests/unit/c/test-fss-basic_list_object_write.h create mode 100644 level_1/fl_fss/tests/unit/c/test-fss-basic_object_read.c create mode 100644 level_1/fl_fss/tests/unit/c/test-fss-basic_object_read.h create mode 100644 level_1/fl_fss/tests/unit/c/test-fss-basic_object_write.c create mode 100644 level_1/fl_fss/tests/unit/c/test-fss-basic_object_write.h create mode 100644 level_1/fl_fss/tests/unit/c/test-fss-embedded_list_content_read.c create mode 100644 level_1/fl_fss/tests/unit/c/test-fss-embedded_list_content_read.h create mode 100644 level_1/fl_fss/tests/unit/c/test-fss-embedded_list_content_write.c create mode 100644 level_1/fl_fss/tests/unit/c/test-fss-embedded_list_content_write.h create mode 100644 level_1/fl_fss/tests/unit/c/test-fss-embedded_list_object_read.c create mode 100644 level_1/fl_fss/tests/unit/c/test-fss-embedded_list_object_read.h create mode 100644 level_1/fl_fss/tests/unit/c/test-fss-embedded_list_object_write.c create mode 100644 level_1/fl_fss/tests/unit/c/test-fss-embedded_list_object_write.h create mode 100644 level_1/fl_fss/tests/unit/c/test-fss-extended_content_read.c create mode 100644 level_1/fl_fss/tests/unit/c/test-fss-extended_content_read.h create mode 100644 level_1/fl_fss/tests/unit/c/test-fss-extended_content_write.c create mode 100644 level_1/fl_fss/tests/unit/c/test-fss-extended_content_write.h create mode 100644 level_1/fl_fss/tests/unit/c/test-fss-extended_list_content_read.c create mode 100644 level_1/fl_fss/tests/unit/c/test-fss-extended_list_content_read.h create mode 100644 level_1/fl_fss/tests/unit/c/test-fss-extended_list_content_write.c create mode 100644 level_1/fl_fss/tests/unit/c/test-fss-extended_list_content_write.h create mode 100644 level_1/fl_fss/tests/unit/c/test-fss-extended_list_object_read.c create mode 100644 level_1/fl_fss/tests/unit/c/test-fss-extended_list_object_read.h create mode 100644 level_1/fl_fss/tests/unit/c/test-fss-extended_list_object_write.c create mode 100644 level_1/fl_fss/tests/unit/c/test-fss-extended_list_object_write.h create mode 100644 level_1/fl_fss/tests/unit/c/test-fss-extended_object_read.c create mode 100644 level_1/fl_fss/tests/unit/c/test-fss-extended_object_read.h create mode 100644 level_1/fl_fss/tests/unit/c/test-fss-extended_object_write.c create mode 100644 level_1/fl_fss/tests/unit/c/test-fss-extended_object_write.h diff --git a/level_1/fl_fss/data/build/settings-tests b/level_1/fl_fss/data/build/settings-tests index 9d9dc61..2e49e56 100644 --- a/level_1/fl_fss/data/build/settings-tests +++ b/level_1/fl_fss/data/build/settings-tests @@ -25,6 +25,11 @@ build_language c build_libraries -lc -lcmocka build_libraries-individual -lf_abstruse -lf_conversion -lf_file -lf_fss -lf_memory -lf_string -lf_type_array -lf_utf -lfl_fss +build_sources_program test-fss-basic_content_read.c test-fss-basic_content_write.c test-fss-basic_object_read.c test-fss-basic_object_write.c +build_sources_program test-fss-basic_list_content_read.c test-fss-basic_list_content_write.c test-fss-basic_list_object_read.c test-fss-basic_list_object_write.c +build_sources_program test-fss-embedded_list_content_read.c test-fss-embedded_list_content_write.c test-fss-embedded_list_object_read.c test-fss-embedded_list_object_write.c +build_sources_program test-fss-extended_content_read.c test-fss-extended_content_write.c test-fss-extended_object_read.c test-fss-extended_object_write.c +build_sources_program test-fss-extended_list_content_read.c test-fss-extended_list_content_write.c test-fss-extended_list_object_read.c test-fss-extended_list_object_write.c build_sources_program test-fss-payload_header_map.c build_sources_program test-fss.c diff --git a/level_1/fl_fss/tests/unit/c/test-fss-basic_content_read.c b/level_1/fl_fss/tests/unit/c/test-fss-basic_content_read.c new file mode 100644 index 0000000..abcd011 --- /dev/null +++ b/level_1/fl_fss/tests/unit/c/test-fss-basic_content_read.c @@ -0,0 +1,90 @@ +#include "test-fss.h" +#include "test-fss-basic_content_read.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__fl_fss_basic_content_read__parameter_checking(void **void_state) { + + f_state_t state = f_state_t_initialize; + f_range_t range = f_range_t_initialize; + f_ranges_t found = f_ranges_t_initialize; + f_number_unsigneds_t delimits = f_number_unsigneds_t_initialize; + + { + state.status = F_none; + + fl_fss_basic_content_read(f_string_empty_s, 0, 0, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_basic_content_read(f_string_empty_s, &range, 0, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_basic_content_read(f_string_empty_s, &range, &found, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_basic_content_read(f_string_empty_s, &range, 0, &delimits, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_basic_content_read(f_string_empty_s, 0, &found, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_basic_content_read(f_string_empty_s, 0, &found, &delimits, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_basic_content_read(f_string_empty_s, 0, 0, &delimits, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } +} + +void test__fl_fss_basic_content_read__returns_data_not(void **void_state) { + + f_state_t state = f_state_t_initialize; + f_range_t range = f_range_t_initialize; + f_ranges_t found = f_ranges_t_initialize; + f_number_unsigneds_t delimits = f_number_unsigneds_t_initialize; + + { + state.status = F_none; + + fl_fss_basic_content_read(f_string_empty_s, &range, &found, &delimits, &state); + + assert_int_equal(state.status, F_data_not); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_1/fl_fss/tests/unit/c/test-fss-basic_content_read.h b/level_1/fl_fss/tests/unit/c/test-fss-basic_content_read.h new file mode 100644 index 0000000..ccc1bde --- /dev/null +++ b/level_1/fl_fss/tests/unit/c/test-fss-basic_content_read.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 2 + * + * Project: FSS + * API Version: 0.6 + * Licenses: lgpl-2.1-or-later + * + * Test the fl_fss project. + */ +#ifndef _TEST__FL_fss_basic_content_read_h +#define _TEST__FL_fss_basic_content_read_h + +/** + * Test that parameter checking works as expected. + * + * @see fl_fss_basic_content_read() + */ +extern void test__fl_fss_basic_content_read__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see fl_fss_basic_content_read() + */ +extern void test__fl_fss_basic_content_read__returns_data_not(void **state); + +#endif // _TEST__FL_fss_basic_content_read_h diff --git a/level_1/fl_fss/tests/unit/c/test-fss-basic_content_write.c b/level_1/fl_fss/tests/unit/c/test-fss-basic_content_write.c new file mode 100644 index 0000000..f173e1f --- /dev/null +++ b/level_1/fl_fss/tests/unit/c/test-fss-basic_content_write.c @@ -0,0 +1,64 @@ +#include "test-fss.h" +#include "test-fss-basic_content_write.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__fl_fss_basic_content_write__parameter_checking(void **void_state) { + + f_state_t state = f_state_t_initialize; + f_range_t range = f_range_t_initialize; + f_string_dynamic_t destination = f_string_dynamic_t_initialize; + + { + state.status = F_none; + + fl_fss_basic_content_write(f_string_empty_s, 0, 0, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_basic_content_write(f_string_empty_s, 0, &range, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_basic_content_write(f_string_empty_s, 0, 0, &destination, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + if (destination.string) { + free(destination.string); + } +} + +void test__fl_fss_basic_content_write__returns_data_not(void **void_state) { + + f_state_t state = f_state_t_initialize; + f_range_t range = f_range_t_initialize; + f_string_dynamic_t destination = f_string_dynamic_t_initialize; + + { + state.status = F_none; + + fl_fss_basic_content_write(f_string_empty_s, 0, &range, &destination, &state); + + assert_int_equal(state.status, F_data_not); + } + + if (destination.string) { + free(destination.string); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_1/fl_fss/tests/unit/c/test-fss-basic_content_write.h b/level_1/fl_fss/tests/unit/c/test-fss-basic_content_write.h new file mode 100644 index 0000000..7372f0a --- /dev/null +++ b/level_1/fl_fss/tests/unit/c/test-fss-basic_content_write.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 2 + * + * Project: FSS + * API Version: 0.6 + * Licenses: lgpl-2.1-or-later + * + * Test the fl_fss project. + */ +#ifndef _TEST__FL_fss_basic_content_write_h +#define _TEST__FL_fss_basic_content_write_h + +/** + * Test that parameter checking works as expected. + * + * @see fl_fss_basic_content_write() + */ +extern void test__fl_fss_basic_content_write__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see fl_fss_basic_content_write() + */ +extern void test__fl_fss_basic_content_write__returns_data_not(void **state); + +#endif // _TEST__FL_fss_basic_content_write_h diff --git a/level_1/fl_fss/tests/unit/c/test-fss-basic_list_content_read.c b/level_1/fl_fss/tests/unit/c/test-fss-basic_list_content_read.c new file mode 100644 index 0000000..191e606 --- /dev/null +++ b/level_1/fl_fss/tests/unit/c/test-fss-basic_list_content_read.c @@ -0,0 +1,124 @@ +#include "test-fss.h" +#include "test-fss-basic_list_content_read.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__fl_fss_basic_list_content_read__parameter_checking(void **void_state) { + + f_state_t state = f_state_t_initialize; + f_range_t range = f_range_t_initialize; + f_ranges_t found = f_ranges_t_initialize; + f_ranges_t comments = f_ranges_t_initialize; + f_number_unsigneds_t delimits = f_number_unsigneds_t_initialize; + + { + state.status = F_none; + + fl_fss_basic_list_content_read(f_string_empty_s, 0, 0, 0, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_basic_list_content_read(f_string_empty_s, &range, 0, 0, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_basic_list_content_read(f_string_empty_s, &range, &found, 0, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_basic_list_content_read(f_string_empty_s, &range, 0, &delimits, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_basic_list_content_read(f_string_empty_s, &range, 0, 0, &comments, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_basic_list_content_read(f_string_empty_s, 0, &found, 0, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_basic_list_content_read(f_string_empty_s, 0, &found, &delimits, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_basic_list_content_read(f_string_empty_s, 0, &found, 0, &comments, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_basic_list_content_read(f_string_empty_s, 0, 0, &delimits, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_basic_list_content_read(f_string_empty_s, 0, 0, &delimits, &comments, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_basic_list_content_read(f_string_empty_s, 0, 0, 0, &comments, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } +} + +void test__fl_fss_basic_list_content_read__returns_data_not(void **void_state) { + + f_state_t state = f_state_t_initialize; + f_range_t range = f_range_t_initialize; + f_ranges_t found = f_ranges_t_initialize; + f_ranges_t comments = f_ranges_t_initialize; + f_number_unsigneds_t delimits = f_number_unsigneds_t_initialize; + + { + state.status = F_none; + + fl_fss_basic_list_content_read(f_string_empty_s, &range, &found, &delimits, &comments, &state); + + assert_int_equal(state.status, F_data_not); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_1/fl_fss/tests/unit/c/test-fss-basic_list_content_read.h b/level_1/fl_fss/tests/unit/c/test-fss-basic_list_content_read.h new file mode 100644 index 0000000..2da85e6 --- /dev/null +++ b/level_1/fl_fss/tests/unit/c/test-fss-basic_list_content_read.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 2 + * + * Project: FSS + * API Version: 0.6 + * Licenses: lgpl-2.1-or-later + * + * Test the fl_fss project. + */ +#ifndef _TEST__FL_fss_basic_list_content_read_list_h +#define _TEST__FL_fss_basic_list_content_read_list_h + +/** + * Test that parameter checking works as expected. + * + * @see fl_fss_basic_list_content_read() + */ +extern void test__fl_fss_basic_list_content_read__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see fl_fss_basic_list_content_read() + */ +extern void test__fl_fss_basic_list_content_read__returns_data_not(void **state); + +#endif // _TEST__FL_fss_basic_list_content_read_list_h diff --git a/level_1/fl_fss/tests/unit/c/test-fss-basic_list_content_write.c b/level_1/fl_fss/tests/unit/c/test-fss-basic_list_content_write.c new file mode 100644 index 0000000..c623502 --- /dev/null +++ b/level_1/fl_fss/tests/unit/c/test-fss-basic_list_content_write.c @@ -0,0 +1,104 @@ +#include "test-fss.h" +#include "test-fss-basic_list_content_write.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__fl_fss_basic_list_content_write__parameter_checking(void **void_state) { + + f_state_t state = f_state_t_initialize; + f_range_t range = f_range_t_initialize; + f_string_dynamic_t destination = f_string_dynamic_t_initialize; + + { + state.status = F_none; + + fl_fss_basic_list_content_write(f_string_empty_s, 0, 0, 0, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_basic_list_content_write(f_string_empty_s, 0, &f_string_empty_s, 0, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_basic_list_content_write(f_string_empty_s, 0, &f_string_empty_s, &range, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_basic_list_content_write(f_string_empty_s, 0, &f_string_empty_s, 0, &destination, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_basic_list_content_write(f_string_empty_s, 0, 0, &range, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_basic_list_content_write(f_string_empty_s, 0, 0, 0, &destination, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_basic_list_content_write(f_string_empty_s, 0, &f_string_empty_s, 0, &destination, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + if (destination.string) { + free(destination.string); + } +} + +void test__fl_fss_basic_list_content_write__returns_data_not(void **void_state) { + + f_state_t state = f_state_t_initialize; + f_range_t range = f_range_t_initialize; + f_string_dynamic_t destination = f_string_dynamic_t_initialize; + + { + state.status = F_none; + + fl_fss_basic_list_content_write(f_string_empty_s, 0, 0, &range, &destination, &state); + + assert_int_equal(state.status, F_data_not); + } + + { + state.status = F_none; + + fl_fss_basic_list_content_write(f_string_empty_s, 0, &f_string_empty_s, &range, &destination, &state); + + assert_int_equal(state.status, F_data_not); + } + + if (destination.string) { + free(destination.string); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_1/fl_fss/tests/unit/c/test-fss-basic_list_content_write.h b/level_1/fl_fss/tests/unit/c/test-fss-basic_list_content_write.h new file mode 100644 index 0000000..561e1eb --- /dev/null +++ b/level_1/fl_fss/tests/unit/c/test-fss-basic_list_content_write.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 2 + * + * Project: FSS + * API Version: 0.6 + * Licenses: lgpl-2.1-or-later + * + * Test the fl_fss project. + */ +#ifndef _TEST__FL_fss_basic_list_content_write_list_h +#define _TEST__FL_fss_basic_list_content_write_list_h + +/** + * Test that parameter checking works as expected. + * + * @see fl_fss_basic_list_content_write() + */ +extern void test__fl_fss_basic_list_content_write__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see fl_fss_basic_list_content_write() + */ +extern void test__fl_fss_basic_list_content_write__returns_data_not(void **state); + +#endif // _TEST__FL_fss_basic_list_content_write_list_h diff --git a/level_1/fl_fss/tests/unit/c/test-fss-basic_list_object_read.c b/level_1/fl_fss/tests/unit/c/test-fss-basic_list_object_read.c new file mode 100644 index 0000000..5b17c23 --- /dev/null +++ b/level_1/fl_fss/tests/unit/c/test-fss-basic_list_object_read.c @@ -0,0 +1,90 @@ +#include "test-fss.h" +#include "test-fss-basic_list_object_read.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__fl_fss_basic_list_object_read__parameter_checking(void **void_state) { + + f_state_t state = f_state_t_initialize; + f_range_t range = f_range_t_initialize; + f_range_t found = f_range_t_initialize; + f_number_unsigneds_t delimits = f_number_unsigneds_t_initialize; + + { + state.status = F_none; + + fl_fss_basic_list_object_read(f_string_empty_s, 0, 0, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_basic_list_object_read(f_string_empty_s, &range, 0, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_basic_list_object_read(f_string_empty_s, &range, &found, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_basic_list_object_read(f_string_empty_s, &range, 0, &delimits, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_basic_list_object_read(f_string_empty_s, 0, &found, &delimits, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_basic_list_object_read(f_string_empty_s, 0, &found, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_basic_list_object_read(f_string_empty_s, 0, 0, &delimits, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } +} + +void test__fl_fss_basic_list_object_read__returns_data_not(void **void_state) { + + f_state_t state = f_state_t_initialize; + f_range_t range = f_range_t_initialize; + f_range_t found = f_range_t_initialize; + f_number_unsigneds_t delimits = f_number_unsigneds_t_initialize; + + { + state.status = F_none; + + fl_fss_basic_list_object_read(f_string_empty_s, &range, &found, &delimits, &state); + + assert_int_equal(state.status, F_data_not); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_1/fl_fss/tests/unit/c/test-fss-basic_list_object_read.h b/level_1/fl_fss/tests/unit/c/test-fss-basic_list_object_read.h new file mode 100644 index 0000000..52ee19b --- /dev/null +++ b/level_1/fl_fss/tests/unit/c/test-fss-basic_list_object_read.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 2 + * + * Project: FSS + * API Version: 0.6 + * Licenses: lgpl-2.1-or-later + * + * Test the fl_fss project. + */ +#ifndef _TEST__FL_fss_basic_list_object_read_list_h +#define _TEST__FL_fss_basic_list_object_read_list_h + +/** + * Test that parameter checking works as expected. + * + * @see fl_fss_basic_list_object_read() + */ +extern void test__fl_fss_basic_list_object_read__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see fl_fss_basic_list_object_read() + */ +extern void test__fl_fss_basic_list_object_read__returns_data_not(void **state); + +#endif // _TEST__FL_fss_basic_list_object_read_list_h diff --git a/level_1/fl_fss/tests/unit/c/test-fss-basic_list_object_write.c b/level_1/fl_fss/tests/unit/c/test-fss-basic_list_object_write.c new file mode 100644 index 0000000..f527068 --- /dev/null +++ b/level_1/fl_fss/tests/unit/c/test-fss-basic_list_object_write.c @@ -0,0 +1,64 @@ +#include "test-fss.h" +#include "test-fss-basic_list_object_write.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__fl_fss_basic_list_object_write__parameter_checking(void **void_state) { + + f_state_t state = f_state_t_initialize; + f_range_t range = f_range_t_initialize; + f_string_dynamic_t destination = f_string_dynamic_t_initialize; + + { + state.status = F_none; + + fl_fss_basic_list_object_write(f_string_empty_s, 0, 0, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_basic_list_object_write(f_string_empty_s, 0, &range, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_basic_list_object_write(f_string_empty_s, 0, 0, &destination, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + if (destination.string) { + free(destination.string); + } +} + +void test__fl_fss_basic_list_object_write__returns_data_not(void **void_state) { + + f_state_t state = f_state_t_initialize; + f_range_t range = f_range_t_initialize; + f_string_dynamic_t destination = f_string_dynamic_t_initialize; + + { + state.status = F_none; + + fl_fss_basic_list_object_write(f_string_empty_s, 0, &range, &destination, &state); + + assert_int_equal(state.status, F_data_not); + } + + if (destination.string) { + free(destination.string); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_1/fl_fss/tests/unit/c/test-fss-basic_list_object_write.h b/level_1/fl_fss/tests/unit/c/test-fss-basic_list_object_write.h new file mode 100644 index 0000000..dd8928d --- /dev/null +++ b/level_1/fl_fss/tests/unit/c/test-fss-basic_list_object_write.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 2 + * + * Project: FSS + * API Version: 0.6 + * Licenses: lgpl-2.1-or-later + * + * Test the fl_fss project. + */ +#ifndef _TEST__FL_fss_basic_list_object_write_list_h +#define _TEST__FL_fss_basic_list_object_write_list_h + +/** + * Test that parameter checking works as expected. + * + * @see fl_fss_basic_list_object_write() + */ +extern void test__fl_fss_basic_list_object_write__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see fl_fss_basic_list_object_write() + */ +extern void test__fl_fss_basic_list_object_write__returns_data_not(void **state); + +#endif // _TEST__FL_fss_basic_list_object_write_list_h diff --git a/level_1/fl_fss/tests/unit/c/test-fss-basic_object_read.c b/level_1/fl_fss/tests/unit/c/test-fss-basic_object_read.c new file mode 100644 index 0000000..704270b --- /dev/null +++ b/level_1/fl_fss/tests/unit/c/test-fss-basic_object_read.c @@ -0,0 +1,140 @@ +#include "test-fss.h" +#include "test-fss-basic_object_read.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__fl_fss_basic_object_read__parameter_checking(void **void_state) { + + f_state_t state = f_state_t_initialize; + f_range_t range = f_range_t_initialize; + f_range_t found = f_range_t_initialize; + uint8_t quote = 0; + f_number_unsigneds_t delimits = f_number_unsigneds_t_initialize; + + { + state.status = F_none; + + fl_fss_basic_object_read(f_string_empty_s, 0, 0, 0, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_basic_object_read(f_string_empty_s, &range, 0, 0, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_basic_object_read(f_string_empty_s, &range, &found, 0, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_basic_object_read(f_string_empty_s, &range, &found, "e, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_basic_object_read(f_string_empty_s, &range, 0, "e, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_basic_object_read(f_string_empty_s, &range, 0, "e, &delimits, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_basic_object_read(f_string_empty_s, &range, 0, 0, &delimits, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_basic_object_read(f_string_empty_s, 0, &found, 0, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_basic_object_read(f_string_empty_s, 0, &found, "e, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_basic_object_read(f_string_empty_s, 0, &found, 0, &delimits, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_basic_object_read(f_string_empty_s, 0, 0, "e, &delimits, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_basic_object_read(f_string_empty_s, 0, 0, 0, &delimits, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } +} + +void test__fl_fss_basic_object_read__returns_data_not(void **void_state) { + + f_state_t state = f_state_t_initialize; + f_range_t range = f_range_t_initialize; + f_range_t found = f_range_t_initialize; + uint8_t quote = 0; + f_number_unsigneds_t delimits = f_number_unsigneds_t_initialize; + + { + state.status = F_none; + + fl_fss_basic_object_read(f_string_empty_s, &range, &found, 0, &delimits, &state); + + assert_int_equal(state.status, F_data_not); + } + + { + state.status = F_none; + + fl_fss_basic_object_read(f_string_empty_s, &range, &found, "e, &delimits, &state); + + assert_int_equal(state.status, F_data_not); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_1/fl_fss/tests/unit/c/test-fss-basic_object_read.h b/level_1/fl_fss/tests/unit/c/test-fss-basic_object_read.h new file mode 100644 index 0000000..59800a5 --- /dev/null +++ b/level_1/fl_fss/tests/unit/c/test-fss-basic_object_read.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 2 + * + * Project: FSS + * API Version: 0.6 + * Licenses: lgpl-2.1-or-later + * + * Test the fl_fss project. + */ +#ifndef _TEST__FL_fss_basic_object_read_h +#define _TEST__FL_fss_basic_object_read_h + +/** + * Test that parameter checking works as expected. + * + * @see fl_fss_basic_object_read() + */ +extern void test__fl_fss_basic_object_read__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see fl_fss_basic_object_read() + */ +extern void test__fl_fss_basic_object_read__returns_data_not(void **state); + +#endif // _TEST__FL_fss_basic_object_read_h diff --git a/level_1/fl_fss/tests/unit/c/test-fss-basic_object_write.c b/level_1/fl_fss/tests/unit/c/test-fss-basic_object_write.c new file mode 100644 index 0000000..217260f --- /dev/null +++ b/level_1/fl_fss/tests/unit/c/test-fss-basic_object_write.c @@ -0,0 +1,64 @@ +#include "test-fss.h" +#include "test-fss-basic_object_write.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__fl_fss_basic_object_write__parameter_checking(void **void_state) { + + f_state_t state = f_state_t_initialize; + f_range_t range = f_range_t_initialize; + f_string_dynamic_t destination = f_string_dynamic_t_initialize; + + { + state.status = F_none; + + fl_fss_basic_object_write(f_string_empty_s, 0, 0, 0, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_basic_object_write(f_string_empty_s, 0, 0, &range, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_basic_object_write(f_string_empty_s, 0, 0, 0, &destination, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + if (destination.string) { + free(destination.string); + } +} + +void test__fl_fss_basic_object_write__returns_data_not(void **void_state) { + + f_state_t state = f_state_t_initialize; + f_range_t range = f_range_t_initialize; + f_string_dynamic_t destination = f_string_dynamic_t_initialize; + + { + state.status = F_none; + + fl_fss_basic_object_write(f_string_empty_s, 0, 0, &range, &destination, &state); + + assert_int_equal(state.status, F_data_not); + } + + if (destination.string) { + free(destination.string); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_1/fl_fss/tests/unit/c/test-fss-basic_object_write.h b/level_1/fl_fss/tests/unit/c/test-fss-basic_object_write.h new file mode 100644 index 0000000..abc00c1 --- /dev/null +++ b/level_1/fl_fss/tests/unit/c/test-fss-basic_object_write.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 2 + * + * Project: FSS + * API Version: 0.6 + * Licenses: lgpl-2.1-or-later + * + * Test the fl_fss project. + */ +#ifndef _TEST__FL_fss_basic_object_write_h +#define _TEST__FL_fss_basic_object_write_h + +/** + * Test that parameter checking works as expected. + * + * @see fl_fss_basic_object_write() + */ +extern void test__fl_fss_basic_object_write__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see fl_fss_basic_object_write() + */ +extern void test__fl_fss_basic_object_write__returns_data_not(void **state); + +#endif // _TEST__FL_fss_basic_object_write_h diff --git a/level_1/fl_fss/tests/unit/c/test-fss-embedded_list_content_read.c b/level_1/fl_fss/tests/unit/c/test-fss-embedded_list_content_read.c new file mode 100644 index 0000000..bac41fb --- /dev/null +++ b/level_1/fl_fss/tests/unit/c/test-fss-embedded_list_content_read.c @@ -0,0 +1,140 @@ +#include "test-fss.h" +#include "test-fss-embedded_list_content_read.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__fl_fss_embedded_list_content_read__parameter_checking(void **void_state) { + + f_state_t state = f_state_t_initialize; + f_range_t range = f_range_t_initialize; + f_fss_nest_t found = f_fss_nest_t_initialize; + f_ranges_t comments = f_ranges_t_initialize; + f_number_unsigneds_t delimits = f_number_unsigneds_t_initialize; + + { + state.status = F_none; + + fl_fss_embedded_list_content_read(f_string_empty_s, 0, 0, 0, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_embedded_list_content_read(f_string_empty_s, &range, 0, 0, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_embedded_list_content_read(f_string_empty_s, &range, &found, 0, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_embedded_list_content_read(f_string_empty_s, &range, 0, &delimits, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_embedded_list_content_read(f_string_empty_s, &range, 0, 0, &comments, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_embedded_list_content_read(f_string_empty_s, 0, &found, &delimits, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_embedded_list_content_read(f_string_empty_s, 0, &found, 0, &comments, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_embedded_list_content_read(f_string_empty_s, 0, &found, &delimits, &comments, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_embedded_list_content_read(f_string_empty_s, 0, &found, 0, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_embedded_list_content_read(f_string_empty_s, 0, &found, 0, &comments, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_embedded_list_content_read(f_string_empty_s, 0, 0, &delimits, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_embedded_list_content_read(f_string_empty_s, 0, 0, &delimits, &comments, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_embedded_list_content_read(f_string_empty_s, 0, 0, 0, &comments, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } +} + +void test__fl_fss_embedded_list_content_read__returns_data_not(void **void_state) { + + f_state_t state = f_state_t_initialize; + f_range_t range = f_range_t_initialize; + f_fss_nest_t found = f_fss_nest_t_initialize; + f_ranges_t comments = f_ranges_t_initialize; + f_number_unsigneds_t delimits = f_number_unsigneds_t_initialize; + + { + state.status = F_none; + + fl_fss_embedded_list_content_read(f_string_empty_s, &range, &found, &delimits, &comments, &state); + + assert_int_equal(state.status, F_data_not); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_1/fl_fss/tests/unit/c/test-fss-embedded_list_content_read.h b/level_1/fl_fss/tests/unit/c/test-fss-embedded_list_content_read.h new file mode 100644 index 0000000..27cde1c --- /dev/null +++ b/level_1/fl_fss/tests/unit/c/test-fss-embedded_list_content_read.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 2 + * + * Project: FSS + * API Version: 0.6 + * Licenses: lgpl-2.1-or-later + * + * Test the fl_fss project. + */ +#ifndef _TEST__FL_fss_embedded_list_content_read_h +#define _TEST__FL_fss_embedded_list_content_read_h + +/** + * Test that parameter checking works as expected. + * + * @see fl_fss_embedded_list_content_read() + */ +extern void test__fl_fss_embedded_list_content_read__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see fl_fss_embedded_list_content_read() + */ +extern void test__fl_fss_embedded_list_content_read__returns_data_not(void **state); + +#endif // _TEST__FL_fss_embedded_list_content_read_h diff --git a/level_1/fl_fss/tests/unit/c/test-fss-embedded_list_content_write.c b/level_1/fl_fss/tests/unit/c/test-fss-embedded_list_content_write.c new file mode 100644 index 0000000..107ab25 --- /dev/null +++ b/level_1/fl_fss/tests/unit/c/test-fss-embedded_list_content_write.c @@ -0,0 +1,162 @@ +#include "test-fss.h" +#include "test-fss-embedded_list_content_write.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__fl_fss_embedded_list_content_write__parameter_checking(void **void_state) { + + f_state_t state = f_state_t_initialize; + f_range_t range = f_range_t_initialize; + f_ranges_t ignore = f_ranges_t_initialize; + f_string_dynamic_t destination = f_string_dynamic_t_initialize; + + { + state.status = F_none; + + fl_fss_embedded_list_content_write(f_string_empty_s, 0, 0, 0, 0, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_embedded_list_content_write(f_string_empty_s, 0, &f_string_empty_s, 0, 0, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_embedded_list_content_write(f_string_empty_s, 0, &f_string_empty_s, &ignore, 0, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_embedded_list_content_write(f_string_empty_s, 0, &f_string_empty_s, &ignore, &range, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_embedded_list_content_write(f_string_empty_s, 0, &f_string_empty_s, &ignore, 0, &destination, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_embedded_list_content_write(f_string_empty_s, 0, &f_string_empty_s, 0, &range, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_embedded_list_content_write(f_string_empty_s, 0, &f_string_empty_s, 0, 0, &destination, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_embedded_list_content_write(f_string_empty_s, 0, 0, &ignore, 0, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_embedded_list_content_write(f_string_empty_s, 0, 0, &ignore, &range, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_embedded_list_content_write(f_string_empty_s, 0, 0, &ignore, 0, &destination, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_embedded_list_content_write(f_string_empty_s, 0, 0, 0, &range, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_embedded_list_content_write(f_string_empty_s, 0, 0, 0, 0, &destination, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + if (destination.string) { + free(destination.string); + } +} + +void test__fl_fss_embedded_list_content_write__returns_data_not(void **void_state) { + + f_state_t state = f_state_t_initialize; + f_range_t range = f_range_t_initialize; + f_ranges_t ignore = f_ranges_t_initialize; + f_string_dynamic_t destination = f_string_dynamic_t_initialize; + + { + state.status = F_none; + + fl_fss_embedded_list_content_write(f_string_empty_s, 0, 0, 0, &range, &destination, &state); + + assert_int_equal(state.status, F_data_not); + } + + { + state.status = F_none; + + fl_fss_embedded_list_content_write(f_string_empty_s, 0, 0, &ignore, &range, &destination, &state); + + assert_int_equal(state.status, F_data_not); + } + + { + state.status = F_none; + + fl_fss_embedded_list_content_write(f_string_empty_s, 0, &f_string_empty_s, 0, &range, &destination, &state); + + assert_int_equal(state.status, F_data_not); + } + + { + state.status = F_none; + + fl_fss_embedded_list_content_write(f_string_empty_s, 0, &f_string_empty_s, &ignore, &range, &destination, &state); + + assert_int_equal(state.status, F_data_not); + } + + if (destination.string) { + free(destination.string); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_1/fl_fss/tests/unit/c/test-fss-embedded_list_content_write.h b/level_1/fl_fss/tests/unit/c/test-fss-embedded_list_content_write.h new file mode 100644 index 0000000..b68f7f3 --- /dev/null +++ b/level_1/fl_fss/tests/unit/c/test-fss-embedded_list_content_write.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 2 + * + * Project: FSS + * API Version: 0.6 + * Licenses: lgpl-2.1-or-later + * + * Test the fl_fss project. + */ +#ifndef _TEST__FL_fss_embedded_list_content_write_h +#define _TEST__FL_fss_embedded_list_content_write_h + +/** + * Test that parameter checking works as expected. + * + * @see fl_fss_embedded_list_content_write() + */ +extern void test__fl_fss_embedded_list_content_write__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see fl_fss_embedded_list_content_write() + */ +extern void test__fl_fss_embedded_list_content_write__returns_data_not(void **state); + +#endif // _TEST__FL_fss_embedded_list_content_write_h diff --git a/level_1/fl_fss/tests/unit/c/test-fss-embedded_list_object_read.c b/level_1/fl_fss/tests/unit/c/test-fss-embedded_list_object_read.c new file mode 100644 index 0000000..5dbf9b7 --- /dev/null +++ b/level_1/fl_fss/tests/unit/c/test-fss-embedded_list_object_read.c @@ -0,0 +1,90 @@ +#include "test-fss.h" +#include "test-fss-embedded_list_object_read.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__fl_fss_embedded_list_object_read__parameter_checking(void **void_state) { + + f_state_t state = f_state_t_initialize; + f_range_t range = f_range_t_initialize; + f_range_t found = f_range_t_initialize; + f_number_unsigneds_t delimits = f_number_unsigneds_t_initialize; + + { + state.status = F_none; + + fl_fss_embedded_list_object_read(f_string_empty_s, 0, 0, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_embedded_list_object_read(f_string_empty_s, &range, 0, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_embedded_list_object_read(f_string_empty_s, &range, &found, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_embedded_list_object_read(f_string_empty_s, &range, 0, &delimits, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_embedded_list_object_read(f_string_empty_s, 0, &found, &delimits, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_embedded_list_object_read(f_string_empty_s, 0, &found, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_embedded_list_object_read(f_string_empty_s, 0, 0, &delimits, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } +} + +void test__fl_fss_embedded_list_object_read__returns_data_not(void **void_state) { + + f_state_t state = f_state_t_initialize; + f_range_t range = f_range_t_initialize; + f_range_t found = f_range_t_initialize; + f_number_unsigneds_t delimits = f_number_unsigneds_t_initialize; + + { + state.status = F_none; + + fl_fss_embedded_list_object_read(f_string_empty_s, &range, &found, &delimits, &state); + + assert_int_equal(state.status, F_data_not); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_1/fl_fss/tests/unit/c/test-fss-embedded_list_object_read.h b/level_1/fl_fss/tests/unit/c/test-fss-embedded_list_object_read.h new file mode 100644 index 0000000..33773ec --- /dev/null +++ b/level_1/fl_fss/tests/unit/c/test-fss-embedded_list_object_read.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 2 + * + * Project: FSS + * API Version: 0.6 + * Licenses: lgpl-2.1-or-later + * + * Test the fl_fss project. + */ +#ifndef _TEST__FL_fss_embedded_list_object_read_h +#define _TEST__FL_fss_embedded_list_object_read_h + +/** + * Test that parameter checking works as expected. + * + * @see fl_fss_embedded_list_object_read() + */ +extern void test__fl_fss_embedded_list_object_read__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see fl_fss_embedded_list_object_read() + */ +extern void test__fl_fss_embedded_list_object_read__returns_data_not(void **state); + +#endif // _TEST__FL_fss_embedded_list_object_read_h diff --git a/level_1/fl_fss/tests/unit/c/test-fss-embedded_list_object_write.c b/level_1/fl_fss/tests/unit/c/test-fss-embedded_list_object_write.c new file mode 100644 index 0000000..13066cf --- /dev/null +++ b/level_1/fl_fss/tests/unit/c/test-fss-embedded_list_object_write.c @@ -0,0 +1,64 @@ +#include "test-fss.h" +#include "test-fss-embedded_list_object_write.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__fl_fss_embedded_list_object_write__parameter_checking(void **void_state) { + + f_state_t state = f_state_t_initialize; + f_range_t range = f_range_t_initialize; + f_string_dynamic_t destination = f_string_dynamic_t_initialize; + + { + state.status = F_none; + + fl_fss_embedded_list_object_write(f_string_empty_s, 0, 0, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_embedded_list_object_write(f_string_empty_s, 0, &range, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_embedded_list_object_write(f_string_empty_s, 0, 0, &destination, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + if (destination.string) { + free(destination.string); + } +} + +void test__fl_fss_embedded_list_object_write__returns_data_not(void **void_state) { + + f_state_t state = f_state_t_initialize; + f_range_t range = f_range_t_initialize; + f_string_dynamic_t destination = f_string_dynamic_t_initialize; + + { + state.status = F_none; + + fl_fss_embedded_list_object_write(f_string_empty_s, 0, &range, &destination, &state); + + assert_int_equal(state.status, F_data_not); + } + + if (destination.string) { + free(destination.string); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_1/fl_fss/tests/unit/c/test-fss-embedded_list_object_write.h b/level_1/fl_fss/tests/unit/c/test-fss-embedded_list_object_write.h new file mode 100644 index 0000000..e7a8e82 --- /dev/null +++ b/level_1/fl_fss/tests/unit/c/test-fss-embedded_list_object_write.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 2 + * + * Project: FSS + * API Version: 0.6 + * Licenses: lgpl-2.1-or-later + * + * Test the fl_fss project. + */ +#ifndef _TEST__FL_fss_embedded_list_object_write_h +#define _TEST__FL_fss_embedded_list_object_write_h + +/** + * Test that parameter checking works as expected. + * + * @see fl_fss_embedded_list_object_write() + */ +extern void test__fl_fss_embedded_list_object_write__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see fl_fss_embedded_list_object_write() + */ +extern void test__fl_fss_embedded_list_object_write__returns_data_not(void **state); + +#endif // _TEST__FL_fss_embedded_list_object_write_h diff --git a/level_1/fl_fss/tests/unit/c/test-fss-extended_content_read.c b/level_1/fl_fss/tests/unit/c/test-fss-extended_content_read.c new file mode 100644 index 0000000..46fef01 --- /dev/null +++ b/level_1/fl_fss/tests/unit/c/test-fss-extended_content_read.c @@ -0,0 +1,140 @@ +#include "test-fss.h" +#include "test-fss-extended_content_read.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__fl_fss_extended_content_read__parameter_checking(void **void_state) { + + f_state_t state = f_state_t_initialize; + f_range_t range = f_range_t_initialize; + f_ranges_t found = f_ranges_t_initialize; + f_uint8s_t quotes = f_uint8s_t_initialize; + f_number_unsigneds_t delimits = f_number_unsigneds_t_initialize; + + { + state.status = F_none; + + fl_fss_extended_content_read(f_string_empty_s, 0, 0, 0, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_content_read(f_string_empty_s, &range, 0, 0, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_content_read(f_string_empty_s, &range, &found, 0, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_content_read(f_string_empty_s, &range, 0, "es, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_content_read(f_string_empty_s, &range, 0, 0, &delimits, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_content_read(f_string_empty_s, &range, &found, "es, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_content_read(f_string_empty_s, &range, &found, 0, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_content_read(f_string_empty_s, 0, &found, "es, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_content_read(f_string_empty_s, 0, &found, 0, &delimits, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_content_read(f_string_empty_s, 0, 0, "es, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_content_read(f_string_empty_s, 0, 0, "es, &delimits, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_content_read(f_string_empty_s, 0, 0, 0, &delimits, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } +} + +void test__fl_fss_extended_content_read__returns_data_not(void **void_state) { + + f_state_t state = f_state_t_initialize; + f_range_t range = f_range_t_initialize; + f_ranges_t found = f_ranges_t_initialize; + f_uint8s_t quotes = f_uint8s_t_initialize; + f_number_unsigneds_t delimits = f_number_unsigneds_t_initialize; + + { + state.status = F_none; + + fl_fss_extended_content_read(f_string_empty_s, &range, &found, 0, &delimits, &state); + + assert_int_equal(state.status, F_data_not); + } + + { + state.status = F_none; + + fl_fss_extended_content_read(f_string_empty_s, &range, &found, "es, &delimits, &state); + + assert_int_equal(state.status, F_data_not); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_1/fl_fss/tests/unit/c/test-fss-extended_content_read.h b/level_1/fl_fss/tests/unit/c/test-fss-extended_content_read.h new file mode 100644 index 0000000..75ee0de --- /dev/null +++ b/level_1/fl_fss/tests/unit/c/test-fss-extended_content_read.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 2 + * + * Project: FSS + * API Version: 0.6 + * Licenses: lgpl-2.1-or-later + * + * Test the fl_fss project. + */ +#ifndef _TEST__FL_fss_extended_content_read_h +#define _TEST__FL_fss_extended_content_read_h + +/** + * Test that parameter checking works as expected. + * + * @see fl_fss_extended_content_read() + */ +extern void test__fl_fss_extended_content_read__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see fl_fss_extended_content_read() + */ +extern void test__fl_fss_extended_content_read__returns_data_not(void **state); + +#endif // _TEST__FL_fss_extended_content_read_h diff --git a/level_1/fl_fss/tests/unit/c/test-fss-extended_content_write.c b/level_1/fl_fss/tests/unit/c/test-fss-extended_content_write.c new file mode 100644 index 0000000..ba5ede1 --- /dev/null +++ b/level_1/fl_fss/tests/unit/c/test-fss-extended_content_write.c @@ -0,0 +1,64 @@ +#include "test-fss.h" +#include "test-fss-extended_content_write.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__fl_fss_extended_content_write__parameter_checking(void **void_state) { + + f_state_t state = f_state_t_initialize; + f_range_t range = f_range_t_initialize; + f_string_dynamic_t destination = f_string_dynamic_t_initialize; + + { + state.status = F_none; + + fl_fss_extended_content_write(f_string_empty_s, 0, 0, 0, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_content_write(f_string_empty_s, 0, 0, &range, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_content_write(f_string_empty_s, 0, 0, 0, &destination, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + if (destination.string) { + free(destination.string); + } +} + +void test__fl_fss_extended_content_write__returns_data_not(void **void_state) { + + f_state_t state = f_state_t_initialize; + f_range_t range = f_range_t_initialize; + f_string_dynamic_t destination = f_string_dynamic_t_initialize; + + { + state.status = F_none; + + fl_fss_extended_content_write(f_string_empty_s, 0, 0, &range, &destination, &state); + + assert_int_equal(state.status, F_data_not); + } + + if (destination.string) { + free(destination.string); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_1/fl_fss/tests/unit/c/test-fss-extended_content_write.h b/level_1/fl_fss/tests/unit/c/test-fss-extended_content_write.h new file mode 100644 index 0000000..e4a3d24 --- /dev/null +++ b/level_1/fl_fss/tests/unit/c/test-fss-extended_content_write.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 2 + * + * Project: FSS + * API Version: 0.6 + * Licenses: lgpl-2.1-or-later + * + * Test the fl_fss project. + */ +#ifndef _TEST__FL_fss_extended_content_write_h +#define _TEST__FL_fss_extended_content_write_h + +/** + * Test that parameter checking works as expected. + * + * @see fl_fss_extended_content_write() + */ +extern void test__fl_fss_extended_content_write__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see fl_fss_extended_content_write() + */ +extern void test__fl_fss_extended_content_write__returns_data_not(void **state); + +#endif // _TEST__FL_fss_extended_content_write_h diff --git a/level_1/fl_fss/tests/unit/c/test-fss-extended_list_content_read.c b/level_1/fl_fss/tests/unit/c/test-fss-extended_list_content_read.c new file mode 100644 index 0000000..8665371 --- /dev/null +++ b/level_1/fl_fss/tests/unit/c/test-fss-extended_list_content_read.c @@ -0,0 +1,156 @@ +#include "test-fss.h" +#include "test-fss-extended_list_content_read.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__fl_fss_extended_list_content_read__parameter_checking(void **void_state) { + + f_state_t state = f_state_t_initialize; + f_range_t range = f_range_t_initialize; + f_ranges_t found = f_ranges_t_initialize; + f_ranges_t comments = f_ranges_t_initialize; + f_number_unsigneds_t delimits = f_number_unsigneds_t_initialize; + + { + state.status = F_none; + + fl_fss_extended_list_content_read(f_string_empty_s, 0, 0, 0, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_list_content_read(f_string_empty_s, &range, 0, 0, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_list_content_read(f_string_empty_s, &range, &found, 0, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_list_content_read(f_string_empty_s, &range, &found, &delimits, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_list_content_read(f_string_empty_s, &range, &found, 0, &comments, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_list_content_read(f_string_empty_s, &range, 0, &delimits, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_list_content_read(f_string_empty_s, &range, 0, &delimits, &comments, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_list_content_read(f_string_empty_s, &range, 0, 0, &comments, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_list_content_read(f_string_empty_s, 0, &found, 0, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_list_content_read(f_string_empty_s, 0, &found, &delimits, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_list_content_read(f_string_empty_s, 0, &found, 0, &comments, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_list_content_read(f_string_empty_s, 0, &found, &delimits, &comments, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_list_content_read(f_string_empty_s, 0, 0, &delimits, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_list_content_read(f_string_empty_s, 0, 0, &delimits, &comments, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_list_content_read(f_string_empty_s, 0, 0, 0, &comments, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } +} + +void test__fl_fss_extended_list_content_read__returns_data_not(void **void_state) { + + f_state_t state = f_state_t_initialize; + f_range_t range = f_range_t_initialize; + f_ranges_t found = f_ranges_t_initialize; + f_ranges_t comments = f_ranges_t_initialize; + f_number_unsigneds_t delimits = f_number_unsigneds_t_initialize; + + { + state.status = F_none; + + fl_fss_extended_list_content_read(f_string_empty_s, &range, &found, &delimits, &comments, &state); + + assert_int_equal(state.status, F_data_not); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_1/fl_fss/tests/unit/c/test-fss-extended_list_content_read.h b/level_1/fl_fss/tests/unit/c/test-fss-extended_list_content_read.h new file mode 100644 index 0000000..8f348ab --- /dev/null +++ b/level_1/fl_fss/tests/unit/c/test-fss-extended_list_content_read.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 2 + * + * Project: FSS + * API Version: 0.6 + * Licenses: lgpl-2.1-or-later + * + * Test the fl_fss project. + */ +#ifndef _TEST__FL_fss_extended_list_content_read_list_h +#define _TEST__FL_fss_extended_list_content_read_list_h + +/** + * Test that parameter checking works as expected. + * + * @see fl_fss_extended_list_content_read() + */ +extern void test__fl_fss_extended_list_content_read__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see fl_fss_extended_list_content_read() + */ +extern void test__fl_fss_extended_list_content_read__returns_data_not(void **state); + +#endif // _TEST__FL_fss_extended_list_content_read_list_h diff --git a/level_1/fl_fss/tests/unit/c/test-fss-extended_list_content_write.c b/level_1/fl_fss/tests/unit/c/test-fss-extended_list_content_write.c new file mode 100644 index 0000000..e73ca23 --- /dev/null +++ b/level_1/fl_fss/tests/unit/c/test-fss-extended_list_content_write.c @@ -0,0 +1,162 @@ +#include "test-fss.h" +#include "test-fss-extended_list_content_write.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__fl_fss_extended_list_content_write__parameter_checking(void **void_state) { + + f_state_t state = f_state_t_initialize; + f_range_t range = f_range_t_initialize; + f_ranges_t ignore = f_ranges_t_initialize; + f_string_dynamic_t destination = f_string_dynamic_t_initialize; + + { + state.status = F_none; + + fl_fss_extended_list_content_write(f_string_empty_s, 0, 0, 0, 0, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_list_content_write(f_string_empty_s, 0, &f_string_empty_s, 0, 0, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_list_content_write(f_string_empty_s, 0, &f_string_empty_s, &ignore, 0, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_list_content_write(f_string_empty_s, 0, &f_string_empty_s, &ignore, &range, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_list_content_write(f_string_empty_s, 0, &f_string_empty_s, &ignore, 0, &destination, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_list_content_write(f_string_empty_s, 0, &f_string_empty_s, 0, &range, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_list_content_write(f_string_empty_s, 0, &f_string_empty_s, 0, 0, &destination, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_list_content_write(f_string_empty_s, 0, 0, &ignore, 0, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_list_content_write(f_string_empty_s, 0, 0, &ignore, &range, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_list_content_write(f_string_empty_s, 0, 0, &ignore, 0, &destination, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_list_content_write(f_string_empty_s, 0, 0, 0, &range, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_list_content_write(f_string_empty_s, 0, 0, 0, 0, &destination, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + if (destination.string) { + free(destination.string); + } +} + +void test__fl_fss_extended_list_content_write__returns_data_not(void **void_state) { + + f_state_t state = f_state_t_initialize; + f_range_t range = f_range_t_initialize; + f_ranges_t ignore = f_ranges_t_initialize; + f_string_dynamic_t destination = f_string_dynamic_t_initialize; + + { + state.status = F_none; + + fl_fss_extended_list_content_write(f_string_empty_s, 0, 0, 0, &range, &destination, &state); + + assert_int_equal(state.status, F_data_not); + } + + { + state.status = F_none; + + fl_fss_extended_list_content_write(f_string_empty_s, 0, &f_string_empty_s, 0, &range, &destination, &state); + + assert_int_equal(state.status, F_data_not); + } + + { + state.status = F_none; + + fl_fss_extended_list_content_write(f_string_empty_s, 0, 0, &ignore, &range, &destination, &state); + + assert_int_equal(state.status, F_data_not); + } + + { + state.status = F_none; + + fl_fss_extended_list_content_write(f_string_empty_s, 0, &f_string_empty_s, &ignore, &range, &destination, &state); + + assert_int_equal(state.status, F_data_not); + } + + if (destination.string) { + free(destination.string); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_1/fl_fss/tests/unit/c/test-fss-extended_list_content_write.h b/level_1/fl_fss/tests/unit/c/test-fss-extended_list_content_write.h new file mode 100644 index 0000000..3b47407 --- /dev/null +++ b/level_1/fl_fss/tests/unit/c/test-fss-extended_list_content_write.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 2 + * + * Project: FSS + * API Version: 0.6 + * Licenses: lgpl-2.1-or-later + * + * Test the fl_fss project. + */ +#ifndef _TEST__FL_fss_extended_list_content_write_list_h +#define _TEST__FL_fss_extended_list_content_write_list_h + +/** + * Test that parameter checking works as expected. + * + * @see fl_fss_extended_list_content_write() + */ +extern void test__fl_fss_extended_list_content_write__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see fl_fss_extended_list_content_write() + */ +extern void test__fl_fss_extended_list_content_write__returns_data_not(void **state); + +#endif // _TEST__FL_fss_extended_list_content_write_list_h diff --git a/level_1/fl_fss/tests/unit/c/test-fss-extended_list_object_read.c b/level_1/fl_fss/tests/unit/c/test-fss-extended_list_object_read.c new file mode 100644 index 0000000..5dd75ca --- /dev/null +++ b/level_1/fl_fss/tests/unit/c/test-fss-extended_list_object_read.c @@ -0,0 +1,90 @@ +#include "test-fss.h" +#include "test-fss-extended_list_object_read.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__fl_fss_extended_list_object_read__parameter_checking(void **void_state) { + + f_state_t state = f_state_t_initialize; + f_range_t range = f_range_t_initialize; + f_range_t found = f_range_t_initialize; + f_number_unsigneds_t delimits = f_number_unsigneds_t_initialize; + + { + state.status = F_none; + + fl_fss_extended_list_object_read(f_string_empty_s, 0, 0, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_list_object_read(f_string_empty_s, &range, 0, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_list_object_read(f_string_empty_s, &range, &found, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_list_object_read(f_string_empty_s, &range, 0, &delimits, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_list_object_read(f_string_empty_s, 0, &found, &delimits, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_list_object_read(f_string_empty_s, 0, &found, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_list_object_read(f_string_empty_s, 0, 0, &delimits, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } +} + +void test__fl_fss_extended_list_object_read__returns_data_not(void **void_state) { + + f_state_t state = f_state_t_initialize; + f_range_t range = f_range_t_initialize; + f_range_t found = f_range_t_initialize; + f_number_unsigneds_t delimits = f_number_unsigneds_t_initialize; + + { + state.status = F_none; + + fl_fss_extended_list_object_read(f_string_empty_s, &range, &found, &delimits, &state); + + assert_int_equal(state.status, F_data_not); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_1/fl_fss/tests/unit/c/test-fss-extended_list_object_read.h b/level_1/fl_fss/tests/unit/c/test-fss-extended_list_object_read.h new file mode 100644 index 0000000..6ca4410 --- /dev/null +++ b/level_1/fl_fss/tests/unit/c/test-fss-extended_list_object_read.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 2 + * + * Project: FSS + * API Version: 0.6 + * Licenses: lgpl-2.1-or-later + * + * Test the fl_fss project. + */ +#ifndef _TEST__FL_fss_extended_list_object_read_list_h +#define _TEST__FL_fss_extended_list_object_read_list_h + +/** + * Test that parameter checking works as expected. + * + * @see fl_fss_extended_list_object_read() + */ +extern void test__fl_fss_extended_list_object_read__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see fl_fss_extended_list_object_read() + */ +extern void test__fl_fss_extended_list_object_read__returns_data_not(void **state); + +#endif // _TEST__FL_fss_extended_list_object_read_list_h diff --git a/level_1/fl_fss/tests/unit/c/test-fss-extended_list_object_write.c b/level_1/fl_fss/tests/unit/c/test-fss-extended_list_object_write.c new file mode 100644 index 0000000..4f8a81f --- /dev/null +++ b/level_1/fl_fss/tests/unit/c/test-fss-extended_list_object_write.c @@ -0,0 +1,64 @@ +#include "test-fss.h" +#include "test-fss-extended_list_object_write.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__fl_fss_extended_list_object_write__parameter_checking(void **void_state) { + + f_state_t state = f_state_t_initialize; + f_range_t range = f_range_t_initialize; + f_string_dynamic_t destination = f_string_dynamic_t_initialize; + + { + state.status = F_none; + + fl_fss_extended_list_object_write(f_string_empty_s, 0, 0, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_list_object_write(f_string_empty_s, 0, &range, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_list_object_write(f_string_empty_s, 0, 0, &destination, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + if (destination.string) { + free(destination.string); + } +} + +void test__fl_fss_extended_list_object_write__returns_data_not(void **void_state) { + + f_state_t state = f_state_t_initialize; + f_range_t range = f_range_t_initialize; + f_string_dynamic_t destination = f_string_dynamic_t_initialize; + + { + state.status = F_none; + + fl_fss_extended_list_object_write(f_string_empty_s, 0, &range, &destination, &state); + + assert_int_equal(state.status, F_data_not); + } + + if (destination.string) { + free(destination.string); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_1/fl_fss/tests/unit/c/test-fss-extended_list_object_write.h b/level_1/fl_fss/tests/unit/c/test-fss-extended_list_object_write.h new file mode 100644 index 0000000..7ec33c4 --- /dev/null +++ b/level_1/fl_fss/tests/unit/c/test-fss-extended_list_object_write.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 2 + * + * Project: FSS + * API Version: 0.6 + * Licenses: lgpl-2.1-or-later + * + * Test the fl_fss project. + */ +#ifndef _TEST__FL_fss_extended_list_object_write_list_h +#define _TEST__FL_fss_extended_list_object_write_list_h + +/** + * Test that parameter checking works as expected. + * + * @see fl_fss_extended_list_object_write() + */ +extern void test__fl_fss_extended_list_object_write__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see fl_fss_extended_list_object_write() + */ +extern void test__fl_fss_extended_list_object_write__returns_data_not(void **state); + +#endif // _TEST__FL_fss_extended_list_object_write_list_h diff --git a/level_1/fl_fss/tests/unit/c/test-fss-extended_object_read.c b/level_1/fl_fss/tests/unit/c/test-fss-extended_object_read.c new file mode 100644 index 0000000..3bb97b5 --- /dev/null +++ b/level_1/fl_fss/tests/unit/c/test-fss-extended_object_read.c @@ -0,0 +1,156 @@ +#include "test-fss.h" +#include "test-fss-extended_object_read.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__fl_fss_extended_object_read__parameter_checking(void **void_state) { + + f_state_t state = f_state_t_initialize; + f_range_t range = f_range_t_initialize; + f_range_t found = f_range_t_initialize; + uint8_t quote = 0; + f_number_unsigneds_t delimits = f_number_unsigneds_t_initialize; + + { + state.status = F_none; + + fl_fss_extended_object_read(f_string_empty_s, 0, 0, 0, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_object_read(f_string_empty_s, &range, 0, 0, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_object_read(f_string_empty_s, &range, &found, 0, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_object_read(f_string_empty_s, &range, &found, "e, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_object_read(f_string_empty_s, &range, 0, "e, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_object_read(f_string_empty_s, &range, 0, "e, &delimits, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_object_read(f_string_empty_s, &range, 0, 0, &delimits, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_object_read(f_string_empty_s, 0, &found, 0, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_object_read(f_string_empty_s, 0, &found, "e, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_object_read(f_string_empty_s, 0, &found, 0, &delimits, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_object_read(f_string_empty_s, 0, &found, "e, &delimits, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_object_read(f_string_empty_s, 0, 0, "e, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_object_read(f_string_empty_s, 0, 0, "e, &delimits, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_object_read(f_string_empty_s, 0, 0, 0, &delimits, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } +} + +void test__fl_fss_extended_object_read__returns_data_not(void **void_state) { + + f_state_t state = f_state_t_initialize; + f_range_t range = f_range_t_initialize; + f_range_t found = f_range_t_initialize; + uint8_t quote = 0; + f_number_unsigneds_t delimits = f_number_unsigneds_t_initialize; + + { + state.status = F_none; + + fl_fss_extended_object_read(f_string_empty_s, &range, &found, 0, &delimits, &state); + + assert_int_equal(state.status, F_data_not); + } + + { + state.status = F_none; + + fl_fss_extended_object_read(f_string_empty_s, &range, &found, "e, &delimits, &state); + + assert_int_equal(state.status, F_data_not); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_1/fl_fss/tests/unit/c/test-fss-extended_object_read.h b/level_1/fl_fss/tests/unit/c/test-fss-extended_object_read.h new file mode 100644 index 0000000..d92c6b0 --- /dev/null +++ b/level_1/fl_fss/tests/unit/c/test-fss-extended_object_read.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 2 + * + * Project: FSS + * API Version: 0.6 + * Licenses: lgpl-2.1-or-later + * + * Test the fl_fss project. + */ +#ifndef _TEST__FL_fss_extended_object_read_h +#define _TEST__FL_fss_extended_object_read_h + +/** + * Test that parameter checking works as expected. + * + * @see fl_fss_extended_object_read() + */ +extern void test__fl_fss_extended_object_read__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see fl_fss_extended_object_read() + */ +extern void test__fl_fss_extended_object_read__returns_data_not(void **state); + +#endif // _TEST__FL_fss_extended_object_read_h diff --git a/level_1/fl_fss/tests/unit/c/test-fss-extended_object_write.c b/level_1/fl_fss/tests/unit/c/test-fss-extended_object_write.c new file mode 100644 index 0000000..edfdd80 --- /dev/null +++ b/level_1/fl_fss/tests/unit/c/test-fss-extended_object_write.c @@ -0,0 +1,64 @@ +#include "test-fss.h" +#include "test-fss-extended_object_write.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__fl_fss_extended_object_write__parameter_checking(void **void_state) { + + f_state_t state = f_state_t_initialize; + f_range_t range = f_range_t_initialize; + f_string_dynamic_t destination = f_string_dynamic_t_initialize; + + { + state.status = F_none; + + fl_fss_extended_object_write(f_string_empty_s, 0, 0, 0, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_object_write(f_string_empty_s, 0, 0, &range, 0, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + { + state.status = F_none; + + fl_fss_extended_object_write(f_string_empty_s, 0, 0, 0, &destination, &state); + + assert_int_equal(state.status, F_status_set_error(F_parameter)); + } + + if (destination.string) { + free(destination.string); + } +} + +void test__fl_fss_extended_object_write__returns_data_not(void **void_state) { + + f_state_t state = f_state_t_initialize; + f_range_t range = f_range_t_initialize; + f_string_dynamic_t destination = f_string_dynamic_t_initialize; + + { + state.status = F_none; + + fl_fss_extended_object_write(f_string_empty_s, 0, 0, &range, &destination, &state); + + assert_int_equal(state.status, F_data_not); + } + + if (destination.string) { + free(destination.string); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_1/fl_fss/tests/unit/c/test-fss-extended_object_write.h b/level_1/fl_fss/tests/unit/c/test-fss-extended_object_write.h new file mode 100644 index 0000000..bc5639e --- /dev/null +++ b/level_1/fl_fss/tests/unit/c/test-fss-extended_object_write.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 2 + * + * Project: FSS + * API Version: 0.6 + * Licenses: lgpl-2.1-or-later + * + * Test the fl_fss project. + */ +#ifndef _TEST__FL_fss_extended_object_write_h +#define _TEST__FL_fss_extended_object_write_h + +/** + * Test that parameter checking works as expected. + * + * @see fl_fss_extended_object_write() + */ +extern void test__fl_fss_extended_object_write__parameter_checking(void **state); + +/** + * Test that the function returns F_data_not. + * + * @see fl_fss_extended_object_write() + */ +extern void test__fl_fss_extended_object_write__returns_data_not(void **state); + +#endif // _TEST__FL_fss_extended_object_write_h diff --git a/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map.h b/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map.h index 930f40d..ab67d79 100644 --- a/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map.h +++ b/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map.h @@ -1,7 +1,7 @@ /** * FLL - Level 2 * - * Project: IKI + * Project: FSS * API Version: 0.6 * Licenses: lgpl-2.1-or-later * @@ -24,5 +24,4 @@ extern void test__fl_fss_payload_header_map__parameter_checking(void **state); */ extern void test__fl_fss_payload_header_map__returns_data_not(void **state); - #endif // _TEST__FL_fss_payload_header_map_h diff --git a/level_1/fl_fss/tests/unit/c/test-fss.c b/level_1/fl_fss/tests/unit/c/test-fss.c index d45ea3d..70e132b 100644 --- a/level_1/fl_fss/tests/unit/c/test-fss.c +++ b/level_1/fl_fss/tests/unit/c/test-fss.c @@ -19,9 +19,59 @@ int setdown(void **state) { int main(void) { const struct CMUnitTest tests[] = { + cmocka_unit_test(test__fl_fss_basic_content_read__returns_data_not), + cmocka_unit_test(test__fl_fss_basic_content_write__returns_data_not), + cmocka_unit_test(test__fl_fss_basic_object_read__returns_data_not), + cmocka_unit_test(test__fl_fss_basic_object_write__returns_data_not), + + cmocka_unit_test(test__fl_fss_basic_list_content_read__returns_data_not), + cmocka_unit_test(test__fl_fss_basic_list_content_write__returns_data_not), + cmocka_unit_test(test__fl_fss_basic_list_object_read__returns_data_not), + cmocka_unit_test(test__fl_fss_basic_list_object_write__returns_data_not), + + cmocka_unit_test(test__fl_fss_embedded_list_content_read__returns_data_not), + cmocka_unit_test(test__fl_fss_embedded_list_content_write__returns_data_not), + cmocka_unit_test(test__fl_fss_embedded_list_object_read__returns_data_not), + cmocka_unit_test(test__fl_fss_embedded_list_object_write__returns_data_not), + + cmocka_unit_test(test__fl_fss_extended_content_read__returns_data_not), + cmocka_unit_test(test__fl_fss_extended_content_write__returns_data_not), + cmocka_unit_test(test__fl_fss_extended_object_read__returns_data_not), + cmocka_unit_test(test__fl_fss_extended_object_write__returns_data_not), + + cmocka_unit_test(test__fl_fss_extended_list_content_read__returns_data_not), + cmocka_unit_test(test__fl_fss_extended_list_content_write__returns_data_not), + cmocka_unit_test(test__fl_fss_extended_list_object_read__returns_data_not), + cmocka_unit_test(test__fl_fss_extended_list_object_write__returns_data_not), + cmocka_unit_test(test__fl_fss_payload_header_map__returns_data_not), #ifndef _di_level_0_parameter_checking_ + cmocka_unit_test(test__fl_fss_basic_content_read__parameter_checking), + cmocka_unit_test(test__fl_fss_basic_content_write__parameter_checking), + cmocka_unit_test(test__fl_fss_basic_object_read__parameter_checking), + cmocka_unit_test(test__fl_fss_basic_object_write__parameter_checking), + + cmocka_unit_test(test__fl_fss_basic_list_content_read__parameter_checking), + cmocka_unit_test(test__fl_fss_basic_list_content_write__parameter_checking), + cmocka_unit_test(test__fl_fss_basic_list_object_read__parameter_checking), + cmocka_unit_test(test__fl_fss_basic_list_object_write__parameter_checking), + + cmocka_unit_test(test__fl_fss_embedded_list_content_read__parameter_checking), + cmocka_unit_test(test__fl_fss_embedded_list_content_write__parameter_checking), + cmocka_unit_test(test__fl_fss_embedded_list_object_read__parameter_checking), + cmocka_unit_test(test__fl_fss_embedded_list_object_write__parameter_checking), + + cmocka_unit_test(test__fl_fss_extended_content_read__parameter_checking), + cmocka_unit_test(test__fl_fss_extended_content_write__parameter_checking), + cmocka_unit_test(test__fl_fss_extended_object_read__parameter_checking), + cmocka_unit_test(test__fl_fss_extended_object_write__parameter_checking), + + cmocka_unit_test(test__fl_fss_extended_list_content_read__parameter_checking), + cmocka_unit_test(test__fl_fss_extended_list_content_write__parameter_checking), + cmocka_unit_test(test__fl_fss_extended_list_object_read__parameter_checking), + cmocka_unit_test(test__fl_fss_extended_list_object_write__parameter_checking), + cmocka_unit_test(test__fl_fss_payload_header_map__parameter_checking), #endif // _di_level_0_parameter_checking_ }; diff --git a/level_1/fl_fss/tests/unit/c/test-fss.h b/level_1/fl_fss/tests/unit/c/test-fss.h index c1aba1d..c1342d7 100644 --- a/level_1/fl_fss/tests/unit/c/test-fss.h +++ b/level_1/fl_fss/tests/unit/c/test-fss.h @@ -23,12 +23,37 @@ // FLL-1 includes. #include +#include +#include +#include +#include +#include #include // Mock includes. //#include "mock-fss.h" // Test includes. +#include "test-fss-basic_content_read.h" +#include "test-fss-basic_content_write.h" +#include "test-fss-basic_object_read.h" +#include "test-fss-basic_object_write.h" +#include "test-fss-basic_list_content_read.h" +#include "test-fss-basic_list_content_write.h" +#include "test-fss-basic_list_object_read.h" +#include "test-fss-basic_list_object_write.h" +#include "test-fss-embedded_list_content_read.h" +#include "test-fss-embedded_list_content_write.h" +#include "test-fss-embedded_list_object_read.h" +#include "test-fss-embedded_list_object_write.h" +#include "test-fss-extended_content_read.h" +#include "test-fss-extended_content_write.h" +#include "test-fss-extended_object_read.h" +#include "test-fss-extended_object_write.h" +#include "test-fss-extended_list_content_read.h" +#include "test-fss-extended_list_content_write.h" +#include "test-fss-extended_list_object_read.h" +#include "test-fss-extended_list_object_write.h" #include "test-fss-payload_header_map.h" #ifdef __cplusplus -- 1.8.3.1