From 169148e164bfe36eeb92dfe56043faeb3ed8712c Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Sun, 27 Mar 2022 11:00:28 -0500 Subject: [PATCH] Update: Add additional tests for f_string project. This adds tests for the f_string functions for functions defined in string.h. This adds tests for the f_string functions for functions defined in dynamic.h that functionally mirror functions defined in string.h. There are still more functions in dynamic.h that need to have tests written for them. --- level_0/f_string/data/build/settings-tests | 12 +- level_0/f_string/tests/unit/c/test-string-append.c | 39 +++++ level_0/f_string/tests/unit/c/test-string-append.h | 27 ++++ .../tests/unit/c/test-string-append_assure.c | 50 +++++++ .../tests/unit/c/test-string-append_assure.h | 27 ++++ .../unit/c/test-string-append_assure_nulless.c | 49 +++++++ .../unit/c/test-string-append_assure_nulless.h | 27 ++++ .../tests/unit/c/test-string-append_nulless.c | 39 +++++ .../tests/unit/c/test-string-append_nulless.h | 27 ++++ .../tests/unit/c/test-string-dynamic_append.c | 39 +++++ .../tests/unit/c/test-string-dynamic_append.h | 27 ++++ .../unit/c/test-string-dynamic_append_assure.c | 50 +++++++ .../unit/c/test-string-dynamic_append_assure.h | 27 ++++ .../c/test-string-dynamic_append_assure_nulless.c | 49 +++++++ .../c/test-string-dynamic_append_assure_nulless.h | 27 ++++ .../unit/c/test-string-dynamic_append_nulless.c | 39 +++++ .../unit/c/test-string-dynamic_append_nulless.h | 27 ++++ .../tests/unit/c/test-string-dynamic_mash.c | 54 +++++++ .../tests/unit/c/test-string-dynamic_mash.h | 27 ++++ .../unit/c/test-string-dynamic_mash_nulless.c | 52 +++++++ .../unit/c/test-string-dynamic_mash_nulless.h | 27 ++++ .../tests/unit/c/test-string-dynamic_mish.c | 54 +++++++ .../tests/unit/c/test-string-dynamic_mish.h | 27 ++++ .../unit/c/test-string-dynamic_mish_nulless.c | 52 +++++++ .../unit/c/test-string-dynamic_mish_nulless.h | 27 ++++ .../tests/unit/c/test-string-dynamic_prepend.c | 39 +++++ .../tests/unit/c/test-string-dynamic_prepend.h | 27 ++++ .../unit/c/test-string-dynamic_prepend_assure.c | 50 +++++++ .../unit/c/test-string-dynamic_prepend_assure.h | 27 ++++ .../c/test-string-dynamic_prepend_assure_nulless.c | 49 +++++++ .../c/test-string-dynamic_prepend_assure_nulless.h | 27 ++++ .../unit/c/test-string-dynamic_prepend_nulless.c | 39 +++++ .../unit/c/test-string-dynamic_prepend_nulless.h | 27 ++++ .../tests/unit/c/test-string-dynamic_seek_line.c | 82 +++++++++++ .../tests/unit/c/test-string-dynamic_seek_line.h | 48 +++++++ .../unit/c/test-string-dynamic_seek_line_to.c | 104 ++++++++++++++ .../unit/c/test-string-dynamic_seek_line_to.h | 55 ++++++++ .../tests/unit/c/test-string-dynamic_seek_to.c | 87 ++++++++++++ .../tests/unit/c/test-string-dynamic_seek_to.h | 48 +++++++ .../tests/unit/c/test-string-dynamics_append.c | 3 +- .../tests/unit/c/test-string-dynamics_append_all.c | 6 +- level_0/f_string/tests/unit/c/test-string-mash.c | 54 +++++++ level_0/f_string/tests/unit/c/test-string-mash.h | 27 ++++ .../tests/unit/c/test-string-mash_nulless.c | 52 +++++++ .../tests/unit/c/test-string-mash_nulless.h | 27 ++++ level_0/f_string/tests/unit/c/test-string-mish.c | 54 +++++++ level_0/f_string/tests/unit/c/test-string-mish.h | 27 ++++ .../tests/unit/c/test-string-mish_nulless.c | 52 +++++++ .../tests/unit/c/test-string-mish_nulless.h | 27 ++++ .../f_string/tests/unit/c/test-string-prepend.c | 39 +++++ .../f_string/tests/unit/c/test-string-prepend.h | 27 ++++ .../tests/unit/c/test-string-prepend_assure.c | 50 +++++++ .../tests/unit/c/test-string-prepend_assure.h | 27 ++++ .../unit/c/test-string-prepend_assure_nulless.c | 49 +++++++ .../unit/c/test-string-prepend_assure_nulless.h | 27 ++++ .../tests/unit/c/test-string-prepend_nulless.c | 39 +++++ .../tests/unit/c/test-string-prepend_nulless.h | 27 ++++ .../f_string/tests/unit/c/test-string-seek_line.c | 66 +++++++++ .../f_string/tests/unit/c/test-string-seek_line.h | 41 ++++++ .../tests/unit/c/test-string-seek_line_to.c | 87 ++++++++++++ .../tests/unit/c/test-string-seek_line_to.h | 48 +++++++ .../f_string/tests/unit/c/test-string-seek_to.c | 70 +++++++++ .../f_string/tests/unit/c/test-string-seek_to.h | 41 ++++++ level_0/f_string/tests/unit/c/test-string.c | 157 ++++++++++++++++----- level_0/f_string/tests/unit/c/test-string.h | 62 +++++--- 65 files changed, 2740 insertions(+), 57 deletions(-) create mode 100644 level_0/f_string/tests/unit/c/test-string-append.c create mode 100644 level_0/f_string/tests/unit/c/test-string-append.h create mode 100644 level_0/f_string/tests/unit/c/test-string-append_assure.c create mode 100644 level_0/f_string/tests/unit/c/test-string-append_assure.h create mode 100644 level_0/f_string/tests/unit/c/test-string-append_assure_nulless.c create mode 100644 level_0/f_string/tests/unit/c/test-string-append_assure_nulless.h create mode 100644 level_0/f_string/tests/unit/c/test-string-append_nulless.c create mode 100644 level_0/f_string/tests/unit/c/test-string-append_nulless.h create mode 100644 level_0/f_string/tests/unit/c/test-string-dynamic_append.c create mode 100644 level_0/f_string/tests/unit/c/test-string-dynamic_append.h create mode 100644 level_0/f_string/tests/unit/c/test-string-dynamic_append_assure.c create mode 100644 level_0/f_string/tests/unit/c/test-string-dynamic_append_assure.h create mode 100644 level_0/f_string/tests/unit/c/test-string-dynamic_append_assure_nulless.c create mode 100644 level_0/f_string/tests/unit/c/test-string-dynamic_append_assure_nulless.h create mode 100644 level_0/f_string/tests/unit/c/test-string-dynamic_append_nulless.c create mode 100644 level_0/f_string/tests/unit/c/test-string-dynamic_append_nulless.h create mode 100644 level_0/f_string/tests/unit/c/test-string-dynamic_mash.c create mode 100644 level_0/f_string/tests/unit/c/test-string-dynamic_mash.h create mode 100644 level_0/f_string/tests/unit/c/test-string-dynamic_mash_nulless.c create mode 100644 level_0/f_string/tests/unit/c/test-string-dynamic_mash_nulless.h create mode 100644 level_0/f_string/tests/unit/c/test-string-dynamic_mish.c create mode 100644 level_0/f_string/tests/unit/c/test-string-dynamic_mish.h create mode 100644 level_0/f_string/tests/unit/c/test-string-dynamic_mish_nulless.c create mode 100644 level_0/f_string/tests/unit/c/test-string-dynamic_mish_nulless.h create mode 100644 level_0/f_string/tests/unit/c/test-string-dynamic_prepend.c create mode 100644 level_0/f_string/tests/unit/c/test-string-dynamic_prepend.h create mode 100644 level_0/f_string/tests/unit/c/test-string-dynamic_prepend_assure.c create mode 100644 level_0/f_string/tests/unit/c/test-string-dynamic_prepend_assure.h create mode 100644 level_0/f_string/tests/unit/c/test-string-dynamic_prepend_assure_nulless.c create mode 100644 level_0/f_string/tests/unit/c/test-string-dynamic_prepend_assure_nulless.h create mode 100644 level_0/f_string/tests/unit/c/test-string-dynamic_prepend_nulless.c create mode 100644 level_0/f_string/tests/unit/c/test-string-dynamic_prepend_nulless.h create mode 100644 level_0/f_string/tests/unit/c/test-string-dynamic_seek_line.c create mode 100644 level_0/f_string/tests/unit/c/test-string-dynamic_seek_line.h create mode 100644 level_0/f_string/tests/unit/c/test-string-dynamic_seek_line_to.c create mode 100644 level_0/f_string/tests/unit/c/test-string-dynamic_seek_line_to.h create mode 100644 level_0/f_string/tests/unit/c/test-string-dynamic_seek_to.c create mode 100644 level_0/f_string/tests/unit/c/test-string-dynamic_seek_to.h create mode 100644 level_0/f_string/tests/unit/c/test-string-mash.c create mode 100644 level_0/f_string/tests/unit/c/test-string-mash.h create mode 100644 level_0/f_string/tests/unit/c/test-string-mash_nulless.c create mode 100644 level_0/f_string/tests/unit/c/test-string-mash_nulless.h create mode 100644 level_0/f_string/tests/unit/c/test-string-mish.c create mode 100644 level_0/f_string/tests/unit/c/test-string-mish.h create mode 100644 level_0/f_string/tests/unit/c/test-string-mish_nulless.c create mode 100644 level_0/f_string/tests/unit/c/test-string-mish_nulless.h create mode 100644 level_0/f_string/tests/unit/c/test-string-prepend.c create mode 100644 level_0/f_string/tests/unit/c/test-string-prepend.h create mode 100644 level_0/f_string/tests/unit/c/test-string-prepend_assure.c create mode 100644 level_0/f_string/tests/unit/c/test-string-prepend_assure.h create mode 100644 level_0/f_string/tests/unit/c/test-string-prepend_assure_nulless.c create mode 100644 level_0/f_string/tests/unit/c/test-string-prepend_assure_nulless.h create mode 100644 level_0/f_string/tests/unit/c/test-string-prepend_nulless.c create mode 100644 level_0/f_string/tests/unit/c/test-string-prepend_nulless.h create mode 100644 level_0/f_string/tests/unit/c/test-string-seek_line.c create mode 100644 level_0/f_string/tests/unit/c/test-string-seek_line.h create mode 100644 level_0/f_string/tests/unit/c/test-string-seek_line_to.c create mode 100644 level_0/f_string/tests/unit/c/test-string-seek_line_to.h create mode 100644 level_0/f_string/tests/unit/c/test-string-seek_to.c create mode 100644 level_0/f_string/tests/unit/c/test-string-seek_to.h diff --git a/level_0/f_string/data/build/settings-tests b/level_0/f_string/data/build/settings-tests index db3478f..5187f8d 100644 --- a/level_0/f_string/data/build/settings-tests +++ b/level_0/f_string/data/build/settings-tests @@ -20,11 +20,21 @@ build_libraries -lc -lcmocka build_libraries-individual -lf_memory -lf_string build_libraries-level -lfll_0 build_libraries-monolithic -lfll +build_sources_program test-string-append.c test-string-append_assure.c test-string-append_assure_nulless.c test-string-append_nulless.c +build_sources_program test-string-dynamic_append.c test-string-dynamic_append_assure.c test-string-dynamic_append_assure_nulless.c test-string-dynamic_append_nulless.c +build_sources_program test-string-dynamic_mash.c test-string-dynamic_mash_nulless.c +build_sources_program test-string-dynamic_mish.c test-string-dynamic_mish_nulless.c +build_sources_program test-string-dynamic_prepend.c test-string-dynamic_prepend_assure.c test-string-dynamic_prepend_assure_nulless.c test-string-dynamic_prepend_nulless.c +build_sources_program test-string-dynamic_seek_line.c test-string-dynamic_seek_line_to.c test-string-dynamic_seek_to.c build_sources_program test-string-dynamics_adjust.c test-string-dynamics_append.c test-string-dynamics_append_all.c test-string-dynamics_decimate_by.c test-string-dynamics_decrease_by.c test-string-dynamics_increase.c test-string-dynamics_increase_by.c test-string-dynamics_resize.c test-string-dynamicss_adjust.c test-string-dynamicss_append.c test-string-dynamicss_append_all.c test-string-dynamicss_decimate_by.c test-string-dynamicss_decrease_by.c test-string-dynamicss_increase.c test-string-dynamicss_increase_by.c test-string-dynamicss_resize.c -build_sources_program test-string-maps_adjust.c test-string-maps_append.c test-string-maps_append_all.c test-string-maps_decimate_by.c test-string-maps_decrease_by.c test-string-maps_increase.c test-string-maps_increase_by.c test-string-maps_resize.c test-string-mapss_adjust.c test-string-mapss_append.c test-string-mapss_append_all.c test-string-mapss_decimate_by.c test-string-mapss_decrease_by.c test-string-mapss_increase.c test-string-mapss_increase_by.c test-string-mapss_resize.c build_sources_program test-string-map_multis_adjust.c test-string-map_multis_append.c test-string-map_multis_append_all.c test-string-map_multis_decimate_by.c test-string-map_multis_decrease_by.c test-string-map_multis_increase.c test-string-map_multis_increase_by.c test-string-map_multis_resize.c test-string-map_multiss_adjust.c test-string-map_multiss_append.c test-string-map_multiss_append_all.c test-string-map_multiss_decimate_by.c test-string-map_multiss_decrease_by.c test-string-map_multiss_increase.c test-string-map_multiss_increase_by.c test-string-map_multiss_resize.c +build_sources_program test-string-maps_adjust.c test-string-maps_append.c test-string-maps_append_all.c test-string-maps_decimate_by.c test-string-maps_decrease_by.c test-string-maps_increase.c test-string-maps_increase_by.c test-string-maps_resize.c test-string-mapss_adjust.c test-string-mapss_append.c test-string-mapss_append_all.c test-string-mapss_decimate_by.c test-string-mapss_decrease_by.c test-string-mapss_increase.c test-string-mapss_increase_by.c test-string-mapss_resize.c +build_sources_program test-string-mash.c test-string-mash_nulless.c +build_sources_program test-string-mish.c test-string-mish_nulless.c +build_sources_program test-string-prepend.c test-string-prepend_assure.c test-string-prepend_assure_nulless.c test-string-prepend_nulless.c build_sources_program test-string-quantitys_adjust.c test-string-quantitys_append.c test-string-quantitys_append_all.c test-string-quantitys_decimate_by.c test-string-quantitys_decrease_by.c test-string-quantitys_increase.c test-string-quantitys_increase_by.c test-string-quantitys_resize.c test-string-quantityss_adjust.c test-string-quantityss_append.c test-string-quantityss_append_all.c test-string-quantityss_decimate_by.c test-string-quantityss_decrease_by.c test-string-quantityss_increase.c test-string-quantityss_increase_by.c test-string-quantityss_resize.c build_sources_program test-string-ranges_adjust.c test-string-ranges_append.c test-string-ranges_append_all.c test-string-ranges_decimate_by.c test-string-ranges_decrease_by.c test-string-ranges_increase.c test-string-ranges_increase_by.c test-string-ranges_resize.c test-string-rangess_adjust.c test-string-rangess_append.c test-string-rangess_append_all.c test-string-rangess_decimate_by.c test-string-rangess_decrease_by.c test-string-rangess_increase.c test-string-rangess_increase_by.c test-string-rangess_resize.c +build_sources_program test-string-seek_line.c test-string-seek_line_to.c test-string-seek_to.c build_sources_program test-string-triples_adjust.c test-string-triples_append.c test-string-triples_append_all.c test-string-triples_decimate_by.c test-string-triples_decrease_by.c test-string-triples_increase.c test-string-triples_increase_by.c test-string-triples_resize.c test-string-tripless_adjust.c test-string-tripless_append.c test-string-tripless_append_all.c test-string-tripless_decimate_by.c test-string-tripless_decrease_by.c test-string-tripless_increase.c test-string-tripless_increase_by.c test-string-tripless_resize.c build_sources_program test-string.c build_script no diff --git a/level_0/f_string/tests/unit/c/test-string-append.c b/level_0/f_string/tests/unit/c/test-string-append.c new file mode 100644 index 0000000..622c700 --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-append.c @@ -0,0 +1,39 @@ +#include "test-string.h" +#include "test-string-append.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_string_append__works(void **state) { + + const f_string_static_t source = macro_f_string_static_t_initialize("te\0st", 0, 5); + f_string_dynamic_t destination = f_string_dynamic_t_initialize; + + { + const f_status_t status = f_string_append(source.string, source.used, &destination); + + assert_int_equal(status, F_none); + assert_int_equal(destination.used, source.used); + + assert_string_equal(destination.string, source.string); + assert_string_equal(destination.string + 3, source.string + 3); + } + + free((void *) destination.string); +} + +void test__f_string_append__parameter_checking(void **state) { + + const f_string_dynamic_t data = f_string_dynamic_t_initialize; + + { + const f_status_t status = f_string_append(data.string, data.used, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_string/tests/unit/c/test-string-append.h b/level_0/f_string/tests/unit/c/test-string-append.h new file mode 100644 index 0000000..762afab --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-append.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_string_append_h +#define _TEST__F_string_append_h + +/** + * Test that the function works. + * + * @see f_string_append() + */ +extern void test__f_string_append__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_string_append() + */ +extern void test__f_string_append__parameter_checking(void **state); + +#endif // _TEST__F_string_append_h diff --git a/level_0/f_string/tests/unit/c/test-string-append_assure.c b/level_0/f_string/tests/unit/c/test-string-append_assure.c new file mode 100644 index 0000000..e9b4e82 --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-append_assure.c @@ -0,0 +1,50 @@ +#include "test-string.h" +#include "test-string-append_assure.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_string_append_assure__works(void **state) { + + const f_string_static_t source = macro_f_string_static_t_initialize("te\0st", 0, 5); + f_string_dynamic_t destination = f_string_dynamic_t_initialize; + + { + const f_status_t status = f_string_append_assure(source.string, source.used, &destination); + + assert_int_equal(status, F_none); + assert_int_equal(destination.used, source.used); + + assert_string_equal(destination.string, source.string); + assert_string_equal(destination.string + 3, source.string + 3); + } + + // The string already exists, so destination should be unchanged. + { + const f_status_t status = f_string_append_assure(source.string, source.used, &destination); + + assert_int_equal(status, F_none); + assert_int_equal(destination.used, source.used); + + assert_string_equal(destination.string, source.string); + assert_string_equal(destination.string + 3, source.string + 3); + } + + free((void *) destination.string); +} + +void test__f_string_append_assure__parameter_checking(void **state) { + + const f_string_dynamic_t data = f_string_dynamic_t_initialize; + + { + const f_status_t status = f_string_append_assure(data.string, data.used, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_string/tests/unit/c/test-string-append_assure.h b/level_0/f_string/tests/unit/c/test-string-append_assure.h new file mode 100644 index 0000000..a72474d --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-append_assure.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_string_append_assure_h +#define _TEST__F_string_append_assure_h + +/** + * Test that the function works. + * + * @see f_string_append_assure() + */ +extern void test__f_string_append_assure__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_string_append_assure() + */ +extern void test__f_string_append_assure__parameter_checking(void **state); + +#endif // _TEST__F_string_append_assure_h diff --git a/level_0/f_string/tests/unit/c/test-string-append_assure_nulless.c b/level_0/f_string/tests/unit/c/test-string-append_assure_nulless.c new file mode 100644 index 0000000..797c7a7 --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-append_assure_nulless.c @@ -0,0 +1,49 @@ +#include "test-string.h" +#include "test-string-append_assure_nulless.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_string_append_assure_nulless__works(void **state) { + + const f_string_static_t source = macro_f_string_static_t_initialize("te\0st", 0, 5); + const f_string_static_t expected = macro_f_string_static_t_initialize("test", 0, 4); + f_string_dynamic_t destination = f_string_dynamic_t_initialize; + + { + const f_status_t status = f_string_append_assure_nulless(source.string, source.used, &destination); + + assert_int_equal(status, F_none); + assert_int_equal(destination.used, expected.used); + + assert_string_equal(destination.string, expected.string); + } + + // The string already exists, so destination should be unchanged. + { + const f_status_t status = f_string_append_assure_nulless(source.string, source.used, &destination); + + assert_int_equal(status, F_none); + assert_int_equal(destination.used, expected.used); + + assert_string_equal(destination.string, expected.string); + } + + free((void *) destination.string); +} + +void test__f_string_append_assure_nulless__parameter_checking(void **state) { + + const f_string_dynamic_t data = f_string_dynamic_t_initialize; + + { + const f_status_t status = f_string_append_assure_nulless(data.string, data.used, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_string/tests/unit/c/test-string-append_assure_nulless.h b/level_0/f_string/tests/unit/c/test-string-append_assure_nulless.h new file mode 100644 index 0000000..ffa08e4 --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-append_assure_nulless.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_string_append_assure_nulless_h +#define _TEST__F_string_append_assure_nulless_h + +/** + * Test that the function works. + * + * @see f_string_append_assure_nulless() + */ +extern void test__f_string_append_assure_nulless__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_string_append_assure_nulless() + */ +extern void test__f_string_append_assure_nulless__parameter_checking(void **state); + +#endif // _TEST__F_string_append_assure_nulless_h diff --git a/level_0/f_string/tests/unit/c/test-string-append_nulless.c b/level_0/f_string/tests/unit/c/test-string-append_nulless.c new file mode 100644 index 0000000..8d3cb5e --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-append_nulless.c @@ -0,0 +1,39 @@ +#include "test-string.h" +#include "test-string-append_nulless.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_string_append_nulless__works(void **state) { + + const f_string_static_t source = macro_f_string_static_t_initialize("te\0st", 0, 5); + const f_string_static_t expected = macro_f_string_static_t_initialize("test", 0, 4); + f_string_dynamic_t destination = f_string_dynamic_t_initialize; + + { + const f_status_t status = f_string_append_nulless(source.string, source.used, &destination); + + assert_int_equal(status, F_none); + assert_int_equal(destination.used, expected.used); + + assert_string_equal(destination.string, expected.string); + } + + free((void *) destination.string); +} + +void test__f_string_append_nulless__parameter_checking(void **state) { + + const f_string_dynamic_t data = f_string_dynamic_t_initialize; + + { + const f_status_t status = f_string_append_nulless(data.string, data.used, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_string/tests/unit/c/test-string-append_nulless.h b/level_0/f_string/tests/unit/c/test-string-append_nulless.h new file mode 100644 index 0000000..0598faf --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-append_nulless.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_string_append_nulless_h +#define _TEST__F_string_append_nulless_h + +/** + * Test that the function works. + * + * @see f_string_append_nulless() + */ +extern void test__f_string_append_nulless__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_string_append_nulless() + */ +extern void test__f_string_append_nulless__parameter_checking(void **state); + +#endif // _TEST__F_string_append_nulless_h diff --git a/level_0/f_string/tests/unit/c/test-string-dynamic_append.c b/level_0/f_string/tests/unit/c/test-string-dynamic_append.c new file mode 100644 index 0000000..ba99c68 --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-dynamic_append.c @@ -0,0 +1,39 @@ +#include "test-string.h" +#include "test-string-dynamic_append.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_string_dynamic_append__works(void **state) { + + const f_string_static_t source = macro_f_string_static_t_initialize("te\0st", 0, 5); + f_string_dynamic_t destination = f_string_dynamic_t_initialize; + + { + const f_status_t status = f_string_dynamic_append(source, &destination); + + assert_int_equal(status, F_none); + assert_int_equal(destination.used, source.used); + + assert_string_equal(destination.string, source.string); + assert_string_equal(destination.string + 3, source.string + 3); + } + + free((void *) destination.string); +} + +void test__f_string_dynamic_append__parameter_checking(void **state) { + + const f_string_dynamic_t data = f_string_dynamic_t_initialize; + + { + const f_status_t status = f_string_dynamic_append(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_string/tests/unit/c/test-string-dynamic_append.h b/level_0/f_string/tests/unit/c/test-string-dynamic_append.h new file mode 100644 index 0000000..4c25167 --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-dynamic_append.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_string_dynamic_append_h +#define _TEST__F_string_dynamic_append_h + +/** + * Test that the function works. + * + * @see f_string_dynamic_append() + */ +extern void test__f_string_dynamic_append__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_string_dynamic_append() + */ +extern void test__f_string_dynamic_append__parameter_checking(void **state); + +#endif // _TEST__F_string_dynamic_append_h diff --git a/level_0/f_string/tests/unit/c/test-string-dynamic_append_assure.c b/level_0/f_string/tests/unit/c/test-string-dynamic_append_assure.c new file mode 100644 index 0000000..008f7b8 --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-dynamic_append_assure.c @@ -0,0 +1,50 @@ +#include "test-string.h" +#include "test-string-dynamic_append_assure.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_string_dynamic_append_assure__works(void **state) { + + const f_string_static_t source = macro_f_string_static_t_initialize("te\0st", 0, 5); + f_string_dynamic_t destination = f_string_dynamic_t_initialize; + + { + const f_status_t status = f_string_dynamic_append_assure(source, &destination); + + assert_int_equal(status, F_none); + assert_int_equal(destination.used, source.used); + + assert_string_equal(destination.string, source.string); + assert_string_equal(destination.string + 3, source.string + 3); + } + + // The string already exists, so destination should be unchanged. + { + const f_status_t status = f_string_dynamic_append_assure(source, &destination); + + assert_int_equal(status, F_none); + assert_int_equal(destination.used, source.used); + + assert_string_equal(destination.string, source.string); + assert_string_equal(destination.string + 3, source.string + 3); + } + + free((void *) destination.string); +} + +void test__f_string_dynamic_append_assure__parameter_checking(void **state) { + + const f_string_dynamic_t data = f_string_dynamic_t_initialize; + + { + const f_status_t status = f_string_dynamic_append_assure(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_string/tests/unit/c/test-string-dynamic_append_assure.h b/level_0/f_string/tests/unit/c/test-string-dynamic_append_assure.h new file mode 100644 index 0000000..6c1d7de --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-dynamic_append_assure.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_string_dynamic_append_assure_h +#define _TEST__F_string_dynamic_append_assure_h + +/** + * Test that the function works. + * + * @see f_string_dynamic_append_assure() + */ +extern void test__f_string_dynamic_append_assure__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_string_dynamic_append_assure() + */ +extern void test__f_string_dynamic_append_assure__parameter_checking(void **state); + +#endif // _TEST__F_string_dynamic_append_assure_h diff --git a/level_0/f_string/tests/unit/c/test-string-dynamic_append_assure_nulless.c b/level_0/f_string/tests/unit/c/test-string-dynamic_append_assure_nulless.c new file mode 100644 index 0000000..1f3f984 --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-dynamic_append_assure_nulless.c @@ -0,0 +1,49 @@ +#include "test-string.h" +#include "test-string-dynamic_append_assure_nulless.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_string_dynamic_append_assure_nulless__works(void **state) { + + const f_string_static_t source = macro_f_string_static_t_initialize("te\0st", 0, 5); + const f_string_static_t expected = macro_f_string_static_t_initialize("test", 0, 4); + f_string_dynamic_t destination = f_string_dynamic_t_initialize; + + { + const f_status_t status = f_string_dynamic_append_assure_nulless(source, &destination); + + assert_int_equal(status, F_none); + assert_int_equal(destination.used, expected.used); + + assert_string_equal(destination.string, expected.string); + } + + // The string already exists, so destination should be unchanged. + { + const f_status_t status = f_string_dynamic_append_assure_nulless(source, &destination); + + assert_int_equal(status, F_none); + assert_int_equal(destination.used, expected.used); + + assert_string_equal(destination.string, expected.string); + } + + free((void *) destination.string); +} + +void test__f_string_dynamic_append_assure_nulless__parameter_checking(void **state) { + + const f_string_dynamic_t data = f_string_dynamic_t_initialize; + + { + const f_status_t status = f_string_dynamic_append_assure_nulless(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_string/tests/unit/c/test-string-dynamic_append_assure_nulless.h b/level_0/f_string/tests/unit/c/test-string-dynamic_append_assure_nulless.h new file mode 100644 index 0000000..d164034 --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-dynamic_append_assure_nulless.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_string_dynamic_append_assure_nulless_h +#define _TEST__F_string_dynamic_append_assure_nulless_h + +/** + * Test that the function works. + * + * @see f_string_dynamic_append_assure_nulless() + */ +extern void test__f_string_dynamic_append_assure_nulless__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_string_dynamic_append_assure_nulless() + */ +extern void test__f_string_dynamic_append_assure_nulless__parameter_checking(void **state); + +#endif // _TEST__F_string_dynamic_append_assure_nulless_h diff --git a/level_0/f_string/tests/unit/c/test-string-dynamic_append_nulless.c b/level_0/f_string/tests/unit/c/test-string-dynamic_append_nulless.c new file mode 100644 index 0000000..03309a1 --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-dynamic_append_nulless.c @@ -0,0 +1,39 @@ +#include "test-string.h" +#include "test-string-dynamic_append_nulless.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_string_dynamic_append_nulless__works(void **state) { + + const f_string_static_t source = macro_f_string_static_t_initialize("te\0st", 0, 5); + const f_string_static_t expected = macro_f_string_static_t_initialize("test", 0, 4); + f_string_dynamic_t destination = f_string_dynamic_t_initialize; + + { + const f_status_t status = f_string_dynamic_append_nulless(source, &destination); + + assert_int_equal(status, F_none); + assert_int_equal(destination.used, expected.used); + + assert_string_equal(destination.string, expected.string); + } + + free((void *) destination.string); +} + +void test__f_string_dynamic_append_nulless__parameter_checking(void **state) { + + const f_string_dynamic_t data = f_string_dynamic_t_initialize; + + { + const f_status_t status = f_string_dynamic_append_nulless(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_string/tests/unit/c/test-string-dynamic_append_nulless.h b/level_0/f_string/tests/unit/c/test-string-dynamic_append_nulless.h new file mode 100644 index 0000000..cb8a8cf --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-dynamic_append_nulless.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_string_dynamic_append_nulless_h +#define _TEST__F_string_dynamic_append_nulless_h + +/** + * Test that the function works. + * + * @see f_string_dynamic_append_nulless() + */ +extern void test__f_string_dynamic_append_nulless__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_string_dynamic_append_nulless() + */ +extern void test__f_string_dynamic_append_nulless__parameter_checking(void **state); + +#endif // _TEST__F_string_dynamic_append_nulless_h diff --git a/level_0/f_string/tests/unit/c/test-string-dynamic_mash.c b/level_0/f_string/tests/unit/c/test-string-dynamic_mash.c new file mode 100644 index 0000000..3b437f9 --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-dynamic_mash.c @@ -0,0 +1,54 @@ +#include "test-string.h" +#include "test-string-dynamic_mash.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_string_dynamic_mash__works(void **state) { + + const f_string_static_t glue = macro_f_string_static_t_initialize(":", 0, 1); + const f_string_static_t source = macro_f_string_static_t_initialize("te\0st", 0, 5); + const f_string_static_t expected = macro_f_string_static_t_initialize("te\0st:te\0st", 0, 11); + f_string_dynamic_t destination = f_string_dynamic_t_initialize; + + { + const f_status_t status = f_string_dynamic_mash(glue, source, &destination); + + assert_int_equal(status, F_none); + assert_int_equal(destination.used, source.used); + + assert_string_equal(destination.string, source.string); + assert_string_equal(destination.string + 3, source.string + 3); + } + + // Check that the glue is added. + { + const f_status_t status = f_string_dynamic_mash(glue, source, &destination); + + assert_int_equal(status, F_none); + assert_int_equal(destination.used, expected.used); + + assert_string_equal(destination.string, expected.string); + assert_string_equal(destination.string + 3, expected.string + 3); + assert_string_equal(destination.string + 9, expected.string + 9); + } + + free((void *) destination.string); +} + +void test__f_string_dynamic_mash__parameter_checking(void **state) { + + const f_string_static_t glue = macro_f_string_static_t_initialize(":", 0, 1); + const f_string_static_t source = macro_f_string_static_t_initialize("te\0st", 0, 5); + + { + const f_status_t status = f_string_dynamic_mash(glue, source, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_string/tests/unit/c/test-string-dynamic_mash.h b/level_0/f_string/tests/unit/c/test-string-dynamic_mash.h new file mode 100644 index 0000000..8024785 --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-dynamic_mash.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_string_dynamic_mash_h +#define _TEST__F_string_dynamic_mash_h + +/** + * Test that the function works. + * + * @see f_string_dynamic_mash() + */ +extern void test__f_string_dynamic_mash__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_string_dynamic_mash() + */ +extern void test__f_string_dynamic_mash__parameter_checking(void **state); + +#endif // _TEST__F_string_dynamic_mash_h diff --git a/level_0/f_string/tests/unit/c/test-string-dynamic_mash_nulless.c b/level_0/f_string/tests/unit/c/test-string-dynamic_mash_nulless.c new file mode 100644 index 0000000..76e4a22 --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-dynamic_mash_nulless.c @@ -0,0 +1,52 @@ +#include "test-string.h" +#include "test-string-dynamic_mash_nulless.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_string_dynamic_mash_nulless__works(void **state) { + + const f_string_static_t glue = macro_f_string_static_t_initialize(":", 0, 1); + const f_string_static_t source = macro_f_string_static_t_initialize("te\0st", 0, 5); + const f_string_static_t expected1 = macro_f_string_static_t_initialize("test", 0, 4); + const f_string_static_t expected2 = macro_f_string_static_t_initialize("test:test", 0, 9); + f_string_dynamic_t destination = f_string_dynamic_t_initialize; + + { + const f_status_t status = f_string_dynamic_mash_nulless(glue, source, &destination); + + assert_int_equal(status, F_none); + assert_int_equal(destination.used, expected1.used); + + assert_string_equal(destination.string, expected1.string); + } + + // Check that the glue is added. + { + const f_status_t status = f_string_dynamic_mash_nulless(glue, source, &destination); + + assert_int_equal(status, F_none); + assert_int_equal(destination.used, expected2.used); + + assert_string_equal(destination.string, expected2.string); + } + + free((void *) destination.string); +} + +void test__f_string_dynamic_mash_nulless__parameter_checking(void **state) { + + const f_string_static_t glue = macro_f_string_static_t_initialize(":", 0, 1); + const f_string_static_t source = macro_f_string_static_t_initialize("te\0st", 0, 5); + + { + const f_status_t status = f_string_dynamic_mash_nulless(glue, source, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_string/tests/unit/c/test-string-dynamic_mash_nulless.h b/level_0/f_string/tests/unit/c/test-string-dynamic_mash_nulless.h new file mode 100644 index 0000000..5fbe538 --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-dynamic_mash_nulless.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_string_dynamic_mash_nulless_h +#define _TEST__F_string_dynamic_mash_nulless_h + +/** + * Test that the function works. + * + * @see f_string_dynamic_mash_nulless() + */ +extern void test__f_string_dynamic_mash_nulless__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_string_dynamic_mash_nulless() + */ +extern void test__f_string_dynamic_mash_nulless__parameter_checking(void **state); + +#endif // _TEST__F_string_dynamic_mash_nulless_h diff --git a/level_0/f_string/tests/unit/c/test-string-dynamic_mish.c b/level_0/f_string/tests/unit/c/test-string-dynamic_mish.c new file mode 100644 index 0000000..6e9b2fb --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-dynamic_mish.c @@ -0,0 +1,54 @@ +#include "test-string.h" +#include "test-string-dynamic_mish.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_string_dynamic_mish__works(void **state) { + + const f_string_static_t glue = macro_f_string_static_t_initialize(":", 0, 1); + const f_string_static_t source = macro_f_string_static_t_initialize("te\0st", 0, 5); + const f_string_static_t expected = macro_f_string_static_t_initialize("te\0st:te\0st", 0, 11); + f_string_dynamic_t destination = f_string_dynamic_t_initialize; + + { + const f_status_t status = f_string_dynamic_mish(glue, source, &destination); + + assert_int_equal(status, F_none); + assert_int_equal(destination.used, source.used); + + assert_string_equal(destination.string, source.string); + assert_string_equal(destination.string + 3, source.string + 3); + } + + // Check that the glue is added. + { + const f_status_t status = f_string_dynamic_mish(glue, source, &destination); + + assert_int_equal(status, F_none); + assert_int_equal(destination.used, expected.used); + + assert_string_equal(destination.string, expected.string); + assert_string_equal(destination.string + 3, expected.string + 3); + assert_string_equal(destination.string + 9, expected.string + 9); + } + + free((void *) destination.string); +} + +void test__f_string_dynamic_mish__parameter_checking(void **state) { + + const f_string_static_t glue = macro_f_string_static_t_initialize(":", 0, 1); + const f_string_static_t source = macro_f_string_static_t_initialize("te\0st", 0, 5); + + { + const f_status_t status = f_string_dynamic_mish(glue, source, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_string/tests/unit/c/test-string-dynamic_mish.h b/level_0/f_string/tests/unit/c/test-string-dynamic_mish.h new file mode 100644 index 0000000..85d6526 --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-dynamic_mish.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_string_dynamic_mish_h +#define _TEST__F_string_dynamic_mish_h + +/** + * Test that the function works. + * + * @see f_string_dynamic_mish() + */ +extern void test__f_string_dynamic_mish__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_string_dynamic_mish() + */ +extern void test__f_string_dynamic_mish__parameter_checking(void **state); + +#endif // _TEST__F_string_dynamic_mish_h diff --git a/level_0/f_string/tests/unit/c/test-string-dynamic_mish_nulless.c b/level_0/f_string/tests/unit/c/test-string-dynamic_mish_nulless.c new file mode 100644 index 0000000..02a9955 --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-dynamic_mish_nulless.c @@ -0,0 +1,52 @@ +#include "test-string.h" +#include "test-string-dynamic_mish_nulless.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_string_dynamic_mish_nulless__works(void **state) { + + const f_string_static_t glue = macro_f_string_static_t_initialize(":", 0, 1); + const f_string_static_t source = macro_f_string_static_t_initialize("te\0st", 0, 5); + const f_string_static_t expected1 = macro_f_string_static_t_initialize("test", 0, 4); + const f_string_static_t expected2 = macro_f_string_static_t_initialize("test:test", 0, 9); + f_string_dynamic_t destination = f_string_dynamic_t_initialize; + + { + const f_status_t status = f_string_dynamic_mish_nulless(glue, source, &destination); + + assert_int_equal(status, F_none); + assert_int_equal(destination.used, expected1.used); + + assert_string_equal(destination.string, expected1.string); + } + + // Check that the glue is added. + { + const f_status_t status = f_string_dynamic_mish_nulless(glue, source, &destination); + + assert_int_equal(status, F_none); + assert_int_equal(destination.used, expected2.used); + + assert_string_equal(destination.string, expected2.string); + } + + free((void *) destination.string); +} + +void test__f_string_dynamic_mish_nulless__parameter_checking(void **state) { + + const f_string_static_t glue = macro_f_string_static_t_initialize(":", 0, 1); + const f_string_static_t source = macro_f_string_static_t_initialize("te\0st", 0, 5); + + { + const f_status_t status = f_string_dynamic_mish_nulless(glue, source, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_string/tests/unit/c/test-string-dynamic_mish_nulless.h b/level_0/f_string/tests/unit/c/test-string-dynamic_mish_nulless.h new file mode 100644 index 0000000..04a066c --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-dynamic_mish_nulless.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_string_dynamic_mish_nulless_h +#define _TEST__F_string_dynamic_mish_nulless_h + +/** + * Test that the function works. + * + * @see f_string_dynamic_mish_nulless() + */ +extern void test__f_string_dynamic_mish_nulless__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_string_dynamic_mish_nulless() + */ +extern void test__f_string_dynamic_mish_nulless__parameter_checking(void **state); + +#endif // _TEST__F_string_dynamic_mish_nulless_h diff --git a/level_0/f_string/tests/unit/c/test-string-dynamic_prepend.c b/level_0/f_string/tests/unit/c/test-string-dynamic_prepend.c new file mode 100644 index 0000000..1a90d66 --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-dynamic_prepend.c @@ -0,0 +1,39 @@ +#include "test-string.h" +#include "test-string-dynamic_prepend.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_string_dynamic_prepend__works(void **state) { + + const f_string_static_t source = macro_f_string_static_t_initialize("te\0st", 0, 5); + f_string_dynamic_t destination = f_string_dynamic_t_initialize; + + { + const f_status_t status = f_string_dynamic_prepend(source, &destination); + + assert_int_equal(status, F_none); + assert_int_equal(destination.used, source.used); + + assert_string_equal(destination.string, source.string); + assert_string_equal(destination.string + 3, source.string + 3); + } + + free((void *) destination.string); +} + +void test__f_string_dynamic_prepend__parameter_checking(void **state) { + + const f_string_dynamic_t data = f_string_dynamic_t_initialize; + + { + const f_status_t status = f_string_dynamic_prepend(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_string/tests/unit/c/test-string-dynamic_prepend.h b/level_0/f_string/tests/unit/c/test-string-dynamic_prepend.h new file mode 100644 index 0000000..29534c9 --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-dynamic_prepend.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_string_dynamic_prepend_h +#define _TEST__F_string_dynamic_prepend_h + +/** + * Test that the function works. + * + * @see f_string_dynamic_prepend() + */ +extern void test__f_string_dynamic_prepend__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_string_dynamic_prepend() + */ +extern void test__f_string_dynamic_prepend__parameter_checking(void **state); + +#endif // _TEST__F_string_dynamic_prepend_h diff --git a/level_0/f_string/tests/unit/c/test-string-dynamic_prepend_assure.c b/level_0/f_string/tests/unit/c/test-string-dynamic_prepend_assure.c new file mode 100644 index 0000000..a593a21 --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-dynamic_prepend_assure.c @@ -0,0 +1,50 @@ +#include "test-string.h" +#include "test-string-dynamic_prepend_assure.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_string_dynamic_prepend_assure__works(void **state) { + + const f_string_static_t source = macro_f_string_static_t_initialize("te\0st", 0, 5); + f_string_dynamic_t destination = f_string_dynamic_t_initialize; + + { + const f_status_t status = f_string_dynamic_prepend_assure(source, &destination); + + assert_int_equal(status, F_none); + assert_int_equal(destination.used, source.used); + + assert_string_equal(destination.string, source.string); + assert_string_equal(destination.string + 3, source.string + 3); + } + + // The string already exists, so destination should be unchanged. + { + const f_status_t status = f_string_dynamic_prepend_assure(source, &destination); + + assert_int_equal(status, F_none); + assert_int_equal(destination.used, source.used); + + assert_string_equal(destination.string, source.string); + assert_string_equal(destination.string + 3, source.string + 3); + } + + free((void *) destination.string); +} + +void test__f_string_dynamic_prepend_assure__parameter_checking(void **state) { + + const f_string_dynamic_t data = f_string_dynamic_t_initialize; + + { + const f_status_t status = f_string_dynamic_prepend_assure(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_string/tests/unit/c/test-string-dynamic_prepend_assure.h b/level_0/f_string/tests/unit/c/test-string-dynamic_prepend_assure.h new file mode 100644 index 0000000..462d995 --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-dynamic_prepend_assure.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_string_dynamic_prepend_assure_h +#define _TEST__F_string_dynamic_prepend_assure_h + +/** + * Test that the function works. + * + * @see f_string_dynamic_prepend_assure() + */ +extern void test__f_string_dynamic_prepend_assure__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_string_dynamic_prepend_assure() + */ +extern void test__f_string_dynamic_prepend_assure__parameter_checking(void **state); + +#endif // _TEST__F_string_dynamic_prepend_assure_h diff --git a/level_0/f_string/tests/unit/c/test-string-dynamic_prepend_assure_nulless.c b/level_0/f_string/tests/unit/c/test-string-dynamic_prepend_assure_nulless.c new file mode 100644 index 0000000..c3f1965 --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-dynamic_prepend_assure_nulless.c @@ -0,0 +1,49 @@ +#include "test-string.h" +#include "test-string-dynamic_prepend_assure_nulless.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_string_dynamic_prepend_assure_nulless__works(void **state) { + + const f_string_static_t source = macro_f_string_static_t_initialize("te\0st", 0, 5); + const f_string_static_t expected = macro_f_string_static_t_initialize("test", 0, 4); + f_string_dynamic_t destination = f_string_dynamic_t_initialize; + + { + const f_status_t status = f_string_dynamic_prepend_assure_nulless(source, &destination); + + assert_int_equal(status, F_none); + assert_int_equal(destination.used, expected.used); + + assert_string_equal(destination.string, expected.string); + } + + // The string already exists, so destination should be unchanged. + { + const f_status_t status = f_string_dynamic_prepend_assure_nulless(source, &destination); + + assert_int_equal(status, F_none); + assert_int_equal(destination.used, expected.used); + + assert_string_equal(destination.string, expected.string); + } + + free((void *) destination.string); +} + +void test__f_string_dynamic_prepend_assure_nulless__parameter_checking(void **state) { + + const f_string_dynamic_t data = f_string_dynamic_t_initialize; + + { + const f_status_t status = f_string_dynamic_prepend_assure_nulless(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_string/tests/unit/c/test-string-dynamic_prepend_assure_nulless.h b/level_0/f_string/tests/unit/c/test-string-dynamic_prepend_assure_nulless.h new file mode 100644 index 0000000..f8c64c0 --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-dynamic_prepend_assure_nulless.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_string_dynamic_prepend_assure_nulless_h +#define _TEST__F_string_dynamic_prepend_assure_nulless_h + +/** + * Test that the function works. + * + * @see f_string_dynamic_prepend_assure_nulless() + */ +extern void test__f_string_dynamic_prepend_assure_nulless__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_string_dynamic_prepend_assure_nulless() + */ +extern void test__f_string_dynamic_prepend_assure_nulless__parameter_checking(void **state); + +#endif // _TEST__F_string_dynamic_prepend_assure_nulless_h diff --git a/level_0/f_string/tests/unit/c/test-string-dynamic_prepend_nulless.c b/level_0/f_string/tests/unit/c/test-string-dynamic_prepend_nulless.c new file mode 100644 index 0000000..dd70c48 --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-dynamic_prepend_nulless.c @@ -0,0 +1,39 @@ +#include "test-string.h" +#include "test-string-dynamic_prepend_nulless.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_string_dynamic_prepend_nulless__works(void **state) { + + const f_string_static_t source = macro_f_string_static_t_initialize("te\0st", 0, 5); + const f_string_static_t expected = macro_f_string_static_t_initialize("test", 0, 4); + f_string_dynamic_t destination = f_string_dynamic_t_initialize; + + { + const f_status_t status = f_string_dynamic_prepend_nulless(source, &destination); + + assert_int_equal(status, F_none); + assert_int_equal(destination.used, expected.used); + + assert_string_equal(destination.string, expected.string); + } + + free((void *) destination.string); +} + +void test__f_string_dynamic_prepend_nulless__parameter_checking(void **state) { + + const f_string_dynamic_t data = f_string_dynamic_t_initialize; + + { + const f_status_t status = f_string_dynamic_prepend_nulless(data, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_string/tests/unit/c/test-string-dynamic_prepend_nulless.h b/level_0/f_string/tests/unit/c/test-string-dynamic_prepend_nulless.h new file mode 100644 index 0000000..760bd03 --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-dynamic_prepend_nulless.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_string_dynamic_prepend_nulless_h +#define _TEST__F_string_dynamic_prepend_nulless_h + +/** + * Test that the function works. + * + * @see f_string_dynamic_prepend_nulless() + */ +extern void test__f_string_dynamic_prepend_nulless__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_string_dynamic_prepend_nulless() + */ +extern void test__f_string_dynamic_prepend_nulless__parameter_checking(void **state); + +#endif // _TEST__F_string_dynamic_prepend_nulless_h diff --git a/level_0/f_string/tests/unit/c/test-string-dynamic_seek_line.c b/level_0/f_string/tests/unit/c/test-string-dynamic_seek_line.c new file mode 100644 index 0000000..98e36a2 --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-dynamic_seek_line.c @@ -0,0 +1,82 @@ +#include "test-string.h" +#include "test-string-dynamic_seek_line.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_string_dynamic_seek_line__returns_data_not_stop(void **state) { + + const f_string_static_t source = macro_f_string_static_t_initialize("test\nafter", 0, 10); + + { + f_string_range_t range = f_string_range_t_initialize; + + const f_status_t status = f_string_dynamic_seek_line(source, &range); + + assert_int_equal(status, F_data_not_stop); + } +} + +void test__f_string_dynamic_seek_line__returns_none_eos(void **state) { + + const f_string_static_t source = macro_f_string_static_t_initialize("test", 0, 4); + + { + f_string_range_t range = macro_f_string_range_t_initialize(0, source.used - 1); + + const f_status_t status = f_string_dynamic_seek_line(source, &range); + + assert_int_equal(status, F_none_eos); + + assert_int_equal(range.start, source.used); + assert_int_equal(range.stop, source.used - 1); + } +} + +void test__f_string_dynamic_seek_line__returns_none_stop(void **state) { + + const f_string_static_t source = macro_f_string_static_t_initialize("test", 0, 4); + + { + f_string_range_t range = macro_f_string_range_t_initialize(0, source.used - 2); + + const f_status_t status = f_string_dynamic_seek_line(source, &range); + + assert_int_equal(status, F_none_stop); + + assert_int_equal(range.start, source.used - 1); + assert_int_equal(range.stop, source.used - 2); + } +} + +void test__f_string_dynamic_seek_line__works(void **state) { + + const f_string_static_t source = macro_f_string_static_t_initialize("test\nafter", 0, 10); + + { + f_string_range_t range = macro_f_string_range_t_initialize(0, source.used - 1); + + const f_status_t status = f_string_dynamic_seek_line(source, &range); + + assert_int_equal(status, F_none); + + assert_int_equal(range.start, 4); + assert_int_equal(range.stop, source.used - 1); + } +} + +void test__f_string_dynamic_seek_line__parameter_checking(void **state) { + + const f_string_static_t source = macro_f_string_static_t_initialize("teX\nst", 0, 6); + + { + const f_status_t status = f_string_dynamic_seek_line(source, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_string/tests/unit/c/test-string-dynamic_seek_line.h b/level_0/f_string/tests/unit/c/test-string-dynamic_seek_line.h new file mode 100644 index 0000000..44f1d1f --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-dynamic_seek_line.h @@ -0,0 +1,48 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_string_dynamic_seek_line_h +#define _TEST__F_string_dynamic_seek_line_h + +/** + * Test that the function returns F_data_not_stop because range is an empty range (range.start > range.stop). + * + * @see f_string_dynamic_seek_line() + */ +extern void test__f_string_dynamic_seek_line__returns_data_not_stop(void **state); + +/** + * Test that the function returns F_none_eos stopped after end of string because no newline is found. + * + * @see f_string_dynamic_seek_line() + */ +extern void test__f_string_dynamic_seek_line__returns_none_eos(void **state); + +/** + * Test that the function returns F_none_stop stopped after end of range because no newline is found. + * + * @see f_string_dynamic_seek_line() + */ +extern void test__f_string_dynamic_seek_line__returns_none_stop(void **state); + +/** + * Test that the function works. + * + * @see f_string_dynamic_seek_line() + */ +extern void test__f_string_dynamic_seek_line__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_string_dynamic_seek_line() + */ +extern void test__f_string_dynamic_seek_line__parameter_checking(void **state); + +#endif // _TEST__F_string_dynamic_seek_line_h diff --git a/level_0/f_string/tests/unit/c/test-string-dynamic_seek_line_to.c b/level_0/f_string/tests/unit/c/test-string-dynamic_seek_line_to.c new file mode 100644 index 0000000..807243d --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-dynamic_seek_line_to.c @@ -0,0 +1,104 @@ +#include "test-string.h" +#include "test-string-dynamic_seek_line_to.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_string_dynamic_seek_line_to__at_newline(void **state) { + + const f_string_static_t to = macro_f_string_static_t_initialize("X", 0, 1); + const f_string_static_t source = macro_f_string_static_t_initialize("te\nXst", 0, 6); + + { + f_string_range_t range = macro_f_string_range_t_initialize(0, source.used - 1); + + const f_status_t status = f_string_dynamic_seek_line_to(source, to.string[0], &range); + + assert_int_equal(status, F_none_eol); + + assert_int_equal(range.start, 2); + assert_int_equal(range.stop, source.used - 1); + } +} + +void test__f_string_dynamic_seek_line_to__returns_data_not_stop(void **state) { + + const f_string_static_t to = macro_f_string_static_t_initialize("X", 0, 1); + const f_string_static_t source = macro_f_string_static_t_initialize("test\nafter", 0, 10); + + { + f_string_range_t range = f_string_range_t_initialize; + + const f_status_t status = f_string_dynamic_seek_line_to(source, to.string[0], &range); + + assert_int_equal(status, F_data_not_stop); + } +} + +void test__f_string_dynamic_seek_line_to__returns_none_eos(void **state) { + + const f_string_static_t to = macro_f_string_static_t_initialize("X", 0, 1); + const f_string_static_t source = macro_f_string_static_t_initialize("test", 0, 4); + + { + f_string_range_t range = macro_f_string_range_t_initialize(0, source.used - 1); + + const f_status_t status = f_string_dynamic_seek_line_to(source, to.string[0], &range); + + assert_int_equal(status, F_none_eos); + + assert_int_equal(range.start, source.used); + assert_int_equal(range.stop, source.used - 1); + } +} + +void test__f_string_dynamic_seek_line_to__returns_none_stop(void **state) { + + const f_string_static_t to = macro_f_string_static_t_initialize("X", 0, 1); + const f_string_static_t source = macro_f_string_static_t_initialize("test", 0, 4); + + { + f_string_range_t range = macro_f_string_range_t_initialize(0, source.used - 2); + + const f_status_t status = f_string_dynamic_seek_line_to(source, to.string[0], &range); + + assert_int_equal(status, F_none_stop); + + assert_int_equal(range.start, source.used - 1); + assert_int_equal(range.stop, source.used - 2); + } +} + +void test__f_string_dynamic_seek_line_to__works(void **state) { + + const f_string_static_t to = macro_f_string_static_t_initialize("X", 0, 1); + const f_string_static_t source = macro_f_string_static_t_initialize("teX\nst", 0, 6); + + { + f_string_range_t range = macro_f_string_range_t_initialize(0, source.used - 1); + + const f_status_t status = f_string_dynamic_seek_line_to(source, to.string[0], &range); + + assert_int_equal(status, F_none); + + assert_int_equal(range.start, 2); + assert_int_equal(range.stop, source.used - 1); + } +} + +void test__f_string_dynamic_seek_line_to__parameter_checking(void **state) { + + const f_string_static_t to = macro_f_string_static_t_initialize("X", 0, 1); + const f_string_static_t source = macro_f_string_static_t_initialize("teX\nst", 0, 6); + + { + const f_status_t status = f_string_dynamic_seek_line_to(source, to.string[0], 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_string/tests/unit/c/test-string-dynamic_seek_line_to.h b/level_0/f_string/tests/unit/c/test-string-dynamic_seek_line_to.h new file mode 100644 index 0000000..1c63936 --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-dynamic_seek_line_to.h @@ -0,0 +1,55 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_string_dynamic_seek_line_to_h +#define _TEST__F_string_dynamic_seek_line_to_h + +/** + * Test that the function works but stops at newline rather than search string. + * + * @see f_string_dynamic_seek_line_to() + */ +extern void test__f_string_dynamic_seek_line_to__at_newline(void **state); + +/** + * Test that the function returns F_data_not_stop because range is an empty range (range.start > range.stop). + * + * @see f_string_dynamic_seek_line_to() + */ +extern void test__f_string_dynamic_seek_line_to__returns_data_not_stop(void **state); + +/** + * Test that the function returns F_none_eos stopped after end of string because no newline is found. + * + * @see f_string_dynamic_seek_line_to() + */ +extern void test__f_string_dynamic_seek_line_to__returns_none_eos(void **state); + +/** + * Test that the function returns F_none_stop stopped after end of range because no newline is found. + * + * @see f_string_dynamic_seek_line_to() + */ +extern void test__f_string_dynamic_seek_line_to__returns_none_stop(void **state); + +/** + * Test that the function works. + * + * @see f_string_dynamic_seek_line_to() + */ +extern void test__f_string_dynamic_seek_line_to__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_string_dynamic_seek_line_to() + */ +extern void test__f_string_dynamic_seek_line_to__parameter_checking(void **state); + +#endif // _TEST__F_string_dynamic_seek_line_to_h diff --git a/level_0/f_string/tests/unit/c/test-string-dynamic_seek_to.c b/level_0/f_string/tests/unit/c/test-string-dynamic_seek_to.c new file mode 100644 index 0000000..fc6aeb3 --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-dynamic_seek_to.c @@ -0,0 +1,87 @@ +#include "test-string.h" +#include "test-string-dynamic_seek_to.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_string_dynamic_seek_to__returns_data_not_stop(void **state) { + + const f_string_static_t to = macro_f_string_static_t_initialize("X", 0, 1); + const f_string_static_t source = macro_f_string_static_t_initialize("test\nafter", 0, 10); + + { + f_string_range_t range = f_string_range_t_initialize; + + const f_status_t status = f_string_dynamic_seek_to(source, to.string[0], &range); + + assert_int_equal(status, F_data_not_stop); + } +} + +void test__f_string_dynamic_seek_to__returns_none_eos(void **state) { + + const f_string_static_t to = macro_f_string_static_t_initialize("X", 0, 1); + const f_string_static_t source = macro_f_string_static_t_initialize("test\nafter", 0, 10); + + { + f_string_range_t range = macro_f_string_range_t_initialize(0, source.used - 1); + + const f_status_t status = f_string_dynamic_seek_to(source, to.string[0], &range); + + assert_int_equal(status, F_none_eos); + + assert_int_equal(range.start, source.used); + assert_int_equal(range.stop, source.used - 1); + } +} + +void test__f_string_dynamic_seek_to__returns_none_stop(void **state) { + + const f_string_static_t to = macro_f_string_static_t_initialize("X", 0, 1); + const f_string_static_t source = macro_f_string_static_t_initialize("test\nafter", 0, 10); + + { + f_string_range_t range = macro_f_string_range_t_initialize(0, source.used - 2); + + const f_status_t status = f_string_dynamic_seek_to(source, to.string[0], &range); + + assert_int_equal(status, F_none_stop); + + assert_int_equal(range.start, source.used - 1); + assert_int_equal(range.stop, source.used - 2); + } +} + +void test__f_string_dynamic_seek_to__works(void **state) { + + const f_string_static_t to = macro_f_string_static_t_initialize("X", 0, 1); + const f_string_static_t source = macro_f_string_static_t_initialize("te\nXst", 0, 6); + + { + f_string_range_t range = macro_f_string_range_t_initialize(0, source.used - 1); + + const f_status_t status = f_string_dynamic_seek_to(source, to.string[0], &range); + + assert_int_equal(status, F_none); + + assert_int_equal(range.start, 3); + assert_int_equal(range.stop, source.used - 1); + } +} + +void test__f_string_dynamic_seek_to__parameter_checking(void **state) { + + const f_string_static_t to = macro_f_string_static_t_initialize("X", 0, 1); + const f_string_static_t source = macro_f_string_static_t_initialize("teX\nst", 0, 6); + + { + const f_status_t status = f_string_dynamic_seek_to(source, to.string[0], 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_string/tests/unit/c/test-string-dynamic_seek_to.h b/level_0/f_string/tests/unit/c/test-string-dynamic_seek_to.h new file mode 100644 index 0000000..b21325b --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-dynamic_seek_to.h @@ -0,0 +1,48 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_string_dynamic_seek_to_h +#define _TEST__F_string_dynamic_seek_to_h + +/** + * Test that the function returns F_data_not_stop because range is an empty range (range.start > range.stop). + * + * @see f_string_dynamic_seek_to() + */ +extern void test__f_string_dynamic_seek_to__returns_data_not_stop(void **state); + +/** + * Test that the function returns F_none_eos stopped after end of string because no newline is found. + * + * @see f_string_dynamic_seek_to() + */ +extern void test__f_string_dynamic_seek_to__returns_none_eos(void **state); + +/** + * Test that the function returns F_none_stop stopped after end of range because no newline is found. + * + * @see f_string_dynamic_seek_to() + */ +extern void test__f_string_dynamic_seek_to__returns_none_stop(void **state); + +/** + * Test that the function works. + * + * @see f_string_dynamic_seek_to() + */ +extern void test__f_string_dynamic_seek_to__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_string_dynamic_seek_to() + */ +extern void test__f_string_dynamic_seek_to__parameter_checking(void **state); + +#endif // _TEST__F_string_dynamic_seek_to_h diff --git a/level_0/f_string/tests/unit/c/test-string-dynamics_append.c b/level_0/f_string/tests/unit/c/test-string-dynamics_append.c index 8f05603..de7fde5 100644 --- a/level_0/f_string/tests/unit/c/test-string-dynamics_append.c +++ b/level_0/f_string/tests/unit/c/test-string-dynamics_append.c @@ -7,7 +7,7 @@ extern "C" { void test__f_string_dynamics_append__works(void **state) { - const f_string_static_t source = macro_f_string_static_t_initialize("test", 0, 4); + const f_string_static_t source = macro_f_string_static_t_initialize("te\0st", 0, 5); f_string_dynamics_t destination = f_string_dynamics_t_initialize; { @@ -18,6 +18,7 @@ void test__f_string_dynamics_append__works(void **state) { assert_int_equal(destination.array[0].used, source.used); assert_string_equal(destination.array[0].string, source.string); + assert_string_equal(destination.array[0].string + 3, source.string + 3); } free((void *) destination.array[0].string); diff --git a/level_0/f_string/tests/unit/c/test-string-dynamics_append_all.c b/level_0/f_string/tests/unit/c/test-string-dynamics_append_all.c index 6f75af5..1646c2d 100644 --- a/level_0/f_string/tests/unit/c/test-string-dynamics_append_all.c +++ b/level_0/f_string/tests/unit/c/test-string-dynamics_append_all.c @@ -12,7 +12,7 @@ void test__f_string_dynamics_append_all__works(void **state) { f_string_dynamics_t destination = f_string_dynamics_t_initialize; const f_string_static_t test_sources[] = { - macro_f_string_static_t_initialize("test1", 0, 5), + macro_f_string_static_t_initialize("te\0st1", 0, 6), macro_f_string_static_t_initialize("test2", 0, 5), }; @@ -27,8 +27,10 @@ void test__f_string_dynamics_append_all__works(void **state) { status = f_string_dynamic_append(test_sources[source.used], &source.array[source.used]); assert_int_equal(status, F_none); - assert_string_equal(source.array[source.used].string, test_sources[source.used].string); assert_int_equal(source.array[source.used].used, test_sources[source.used].used); + + assert_string_equal(source.array[source.used].string, test_sources[source.used].string); + assert_string_equal(source.array[source.used].string + 3, test_sources[source.used].string + 3); } // for } diff --git a/level_0/f_string/tests/unit/c/test-string-mash.c b/level_0/f_string/tests/unit/c/test-string-mash.c new file mode 100644 index 0000000..870c92b --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-mash.c @@ -0,0 +1,54 @@ +#include "test-string.h" +#include "test-string-mash.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_string_mash__works(void **state) { + + const f_string_static_t glue = macro_f_string_static_t_initialize(":", 0, 1); + const f_string_static_t source = macro_f_string_static_t_initialize("te\0st", 0, 5); + const f_string_static_t expected = macro_f_string_static_t_initialize("te\0st:te\0st", 0, 11); + f_string_dynamic_t destination = f_string_dynamic_t_initialize; + + { + const f_status_t status = f_string_mash(glue.string, glue.used, source.string, source.used, &destination); + + assert_int_equal(status, F_none); + assert_int_equal(destination.used, source.used); + + assert_string_equal(destination.string, source.string); + assert_string_equal(destination.string + 3, source.string + 3); + } + + // Check that the glue is added. + { + const f_status_t status = f_string_mash(glue.string, glue.used, source.string, source.used, &destination); + + assert_int_equal(status, F_none); + assert_int_equal(destination.used, expected.used); + + assert_string_equal(destination.string, expected.string); + assert_string_equal(destination.string + 3, expected.string + 3); + assert_string_equal(destination.string + 9, expected.string + 9); + } + + free((void *) destination.string); +} + +void test__f_string_mash__parameter_checking(void **state) { + + const f_string_static_t glue = macro_f_string_static_t_initialize(":", 0, 1); + const f_string_static_t source = macro_f_string_static_t_initialize("te\0st", 0, 5); + + { + const f_status_t status = f_string_mash(glue.string, glue.used, source.string, source.used, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_string/tests/unit/c/test-string-mash.h b/level_0/f_string/tests/unit/c/test-string-mash.h new file mode 100644 index 0000000..548f5b3 --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-mash.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_string_mash_h +#define _TEST__F_string_mash_h + +/** + * Test that the function works. + * + * @see f_string_mash() + */ +extern void test__f_string_mash__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_string_mash() + */ +extern void test__f_string_mash__parameter_checking(void **state); + +#endif // _TEST__F_string_mash_h diff --git a/level_0/f_string/tests/unit/c/test-string-mash_nulless.c b/level_0/f_string/tests/unit/c/test-string-mash_nulless.c new file mode 100644 index 0000000..55fabbb --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-mash_nulless.c @@ -0,0 +1,52 @@ +#include "test-string.h" +#include "test-string-mash_nulless.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_string_mash_nulless__works(void **state) { + + const f_string_static_t glue = macro_f_string_static_t_initialize(":", 0, 1); + const f_string_static_t source = macro_f_string_static_t_initialize("te\0st", 0, 5); + const f_string_static_t expected1 = macro_f_string_static_t_initialize("test", 0, 4); + const f_string_static_t expected2 = macro_f_string_static_t_initialize("test:test", 0, 9); + f_string_dynamic_t destination = f_string_dynamic_t_initialize; + + { + const f_status_t status = f_string_mash_nulless(glue.string, glue.used, source.string, source.used, &destination); + + assert_int_equal(status, F_none); + assert_int_equal(destination.used, expected1.used); + + assert_string_equal(destination.string, expected1.string); + } + + // Check that the glue is added. + { + const f_status_t status = f_string_mash_nulless(glue.string, glue.used, source.string, source.used, &destination); + + assert_int_equal(status, F_none); + assert_int_equal(destination.used, expected2.used); + + assert_string_equal(destination.string, expected2.string); + } + + free((void *) destination.string); +} + +void test__f_string_mash_nulless__parameter_checking(void **state) { + + const f_string_static_t glue = macro_f_string_static_t_initialize(":", 0, 1); + const f_string_static_t source = macro_f_string_static_t_initialize("te\0st", 0, 5); + + { + const f_status_t status = f_string_mash_nulless(glue.string, glue.used, source.string, source.used, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_string/tests/unit/c/test-string-mash_nulless.h b/level_0/f_string/tests/unit/c/test-string-mash_nulless.h new file mode 100644 index 0000000..b63dc5d --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-mash_nulless.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_string_mash_nulless_h +#define _TEST__F_string_mash_nulless_h + +/** + * Test that the function works. + * + * @see f_string_mash_nulless() + */ +extern void test__f_string_mash_nulless__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_string_mash_nulless() + */ +extern void test__f_string_mash_nulless__parameter_checking(void **state); + +#endif // _TEST__F_string_mash_nulless_h diff --git a/level_0/f_string/tests/unit/c/test-string-mish.c b/level_0/f_string/tests/unit/c/test-string-mish.c new file mode 100644 index 0000000..b090e98 --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-mish.c @@ -0,0 +1,54 @@ +#include "test-string.h" +#include "test-string-mish.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_string_mish__works(void **state) { + + const f_string_static_t glue = macro_f_string_static_t_initialize(":", 0, 1); + const f_string_static_t source = macro_f_string_static_t_initialize("te\0st", 0, 5); + const f_string_static_t expected = macro_f_string_static_t_initialize("te\0st:te\0st", 0, 11); + f_string_dynamic_t destination = f_string_dynamic_t_initialize; + + { + const f_status_t status = f_string_mish(glue.string, glue.used, source.string, source.used, &destination); + + assert_int_equal(status, F_none); + assert_int_equal(destination.used, source.used); + + assert_string_equal(destination.string, source.string); + assert_string_equal(destination.string + 3, source.string + 3); + } + + // Check that the glue is added. + { + const f_status_t status = f_string_mish(glue.string, glue.used, source.string, source.used, &destination); + + assert_int_equal(status, F_none); + assert_int_equal(destination.used, expected.used); + + assert_string_equal(destination.string, expected.string); + assert_string_equal(destination.string + 3, expected.string + 3); + assert_string_equal(destination.string + 9, expected.string + 9); + } + + free((void *) destination.string); +} + +void test__f_string_mish__parameter_checking(void **state) { + + const f_string_static_t glue = macro_f_string_static_t_initialize(":", 0, 1); + const f_string_static_t source = macro_f_string_static_t_initialize("te\0st", 0, 5); + + { + const f_status_t status = f_string_mish(glue.string, glue.used, source.string, source.used, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_string/tests/unit/c/test-string-mish.h b/level_0/f_string/tests/unit/c/test-string-mish.h new file mode 100644 index 0000000..206ef67 --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-mish.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_string_mish_h +#define _TEST__F_string_mish_h + +/** + * Test that the function works. + * + * @see f_string_mish() + */ +extern void test__f_string_mish__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_string_mish() + */ +extern void test__f_string_mish__parameter_checking(void **state); + +#endif // _TEST__F_string_mish_h diff --git a/level_0/f_string/tests/unit/c/test-string-mish_nulless.c b/level_0/f_string/tests/unit/c/test-string-mish_nulless.c new file mode 100644 index 0000000..4024fe8 --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-mish_nulless.c @@ -0,0 +1,52 @@ +#include "test-string.h" +#include "test-string-mish_nulless.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_string_mish_nulless__works(void **state) { + + const f_string_static_t glue = macro_f_string_static_t_initialize(":", 0, 1); + const f_string_static_t source = macro_f_string_static_t_initialize("te\0st", 0, 5); + const f_string_static_t expected1 = macro_f_string_static_t_initialize("test", 0, 4); + const f_string_static_t expected2 = macro_f_string_static_t_initialize("test:test", 0, 9); + f_string_dynamic_t destination = f_string_dynamic_t_initialize; + + { + const f_status_t status = f_string_mish_nulless(glue.string, glue.used, source.string, source.used, &destination); + + assert_int_equal(status, F_none); + assert_int_equal(destination.used, expected1.used); + + assert_string_equal(destination.string, expected1.string); + } + + // Check that the glue is added. + { + const f_status_t status = f_string_mish_nulless(glue.string, glue.used, source.string, source.used, &destination); + + assert_int_equal(status, F_none); + assert_int_equal(destination.used, expected2.used); + + assert_string_equal(destination.string, expected2.string); + } + + free((void *) destination.string); +} + +void test__f_string_mish_nulless__parameter_checking(void **state) { + + const f_string_static_t glue = macro_f_string_static_t_initialize(":", 0, 1); + const f_string_static_t source = macro_f_string_static_t_initialize("te\0st", 0, 5); + + { + const f_status_t status = f_string_mish_nulless(glue.string, glue.used, source.string, source.used, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_string/tests/unit/c/test-string-mish_nulless.h b/level_0/f_string/tests/unit/c/test-string-mish_nulless.h new file mode 100644 index 0000000..7344f28 --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-mish_nulless.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_string_mish_nulless_h +#define _TEST__F_string_mish_nulless_h + +/** + * Test that the function works. + * + * @see f_string_mish_nulless() + */ +extern void test__f_string_mish_nulless__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_string_mish_nulless() + */ +extern void test__f_string_mish_nulless__parameter_checking(void **state); + +#endif // _TEST__F_string_mish_nulless_h diff --git a/level_0/f_string/tests/unit/c/test-string-prepend.c b/level_0/f_string/tests/unit/c/test-string-prepend.c new file mode 100644 index 0000000..d1a6f71 --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-prepend.c @@ -0,0 +1,39 @@ +#include "test-string.h" +#include "test-string-prepend.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_string_prepend__works(void **state) { + + const f_string_static_t source = macro_f_string_static_t_initialize("te\0st", 0, 5); + f_string_dynamic_t destination = f_string_dynamic_t_initialize; + + { + const f_status_t status = f_string_prepend(source.string, source.used, &destination); + + assert_int_equal(status, F_none); + assert_int_equal(destination.used, source.used); + + assert_string_equal(destination.string, source.string); + assert_string_equal(destination.string + 3, source.string + 3); + } + + free((void *) destination.string); +} + +void test__f_string_prepend__parameter_checking(void **state) { + + const f_string_dynamic_t data = f_string_dynamic_t_initialize; + + { + const f_status_t status = f_string_prepend(data.string, data.used, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_string/tests/unit/c/test-string-prepend.h b/level_0/f_string/tests/unit/c/test-string-prepend.h new file mode 100644 index 0000000..70ffe88 --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-prepend.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_string_prepend_h +#define _TEST__F_string_prepend_h + +/** + * Test that the function works. + * + * @see f_string_prepend() + */ +extern void test__f_string_prepend__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_string_prepend() + */ +extern void test__f_string_prepend__parameter_checking(void **state); + +#endif // _TEST__F_string_prepend_h diff --git a/level_0/f_string/tests/unit/c/test-string-prepend_assure.c b/level_0/f_string/tests/unit/c/test-string-prepend_assure.c new file mode 100644 index 0000000..6d2867a --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-prepend_assure.c @@ -0,0 +1,50 @@ +#include "test-string.h" +#include "test-string-prepend_assure.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_string_prepend_assure__works(void **state) { + + const f_string_static_t source = macro_f_string_static_t_initialize("te\0st", 0, 5); + f_string_dynamic_t destination = f_string_dynamic_t_initialize; + + { + const f_status_t status = f_string_prepend_assure(source.string, source.used, &destination); + + assert_int_equal(status, F_none); + assert_int_equal(destination.used, source.used); + + assert_string_equal(destination.string, source.string); + assert_string_equal(destination.string + 3, source.string + 3); + } + + // The string already exists, so destination should be unchanged. + { + const f_status_t status = f_string_prepend_assure(source.string, source.used, &destination); + + assert_int_equal(status, F_none); + assert_int_equal(destination.used, source.used); + + assert_string_equal(destination.string, source.string); + assert_string_equal(destination.string + 3, source.string + 3); + } + + free((void *) destination.string); +} + +void test__f_string_prepend_assure__parameter_checking(void **state) { + + const f_string_dynamic_t data = f_string_dynamic_t_initialize; + + { + const f_status_t status = f_string_prepend_assure(data.string, data.used, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_string/tests/unit/c/test-string-prepend_assure.h b/level_0/f_string/tests/unit/c/test-string-prepend_assure.h new file mode 100644 index 0000000..a13c8e6 --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-prepend_assure.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_string_prepend_assure_h +#define _TEST__F_string_prepend_assure_h + +/** + * Test that the function works. + * + * @see f_string_prepend_assure() + */ +extern void test__f_string_prepend_assure__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_string_prepend_assure() + */ +extern void test__f_string_prepend_assure__parameter_checking(void **state); + +#endif // _TEST__F_string_prepend_assure_h diff --git a/level_0/f_string/tests/unit/c/test-string-prepend_assure_nulless.c b/level_0/f_string/tests/unit/c/test-string-prepend_assure_nulless.c new file mode 100644 index 0000000..0fb73a1 --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-prepend_assure_nulless.c @@ -0,0 +1,49 @@ +#include "test-string.h" +#include "test-string-prepend_assure_nulless.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_string_prepend_assure_nulless__works(void **state) { + + const f_string_static_t source = macro_f_string_static_t_initialize("te\0st", 0, 5); + const f_string_static_t expected = macro_f_string_static_t_initialize("test", 0, 4); + f_string_dynamic_t destination = f_string_dynamic_t_initialize; + + { + const f_status_t status = f_string_prepend_assure_nulless(source.string, source.used, &destination); + + assert_int_equal(status, F_none); + assert_int_equal(destination.used, expected.used); + + assert_string_equal(destination.string, expected.string); + } + + // The string already exists, so destination should be unchanged. + { + const f_status_t status = f_string_prepend_assure_nulless(source.string, source.used, &destination); + + assert_int_equal(status, F_none); + assert_int_equal(destination.used, expected.used); + + assert_string_equal(destination.string, expected.string); + } + + free((void *) destination.string); +} + +void test__f_string_prepend_assure_nulless__parameter_checking(void **state) { + + const f_string_dynamic_t data = f_string_dynamic_t_initialize; + + { + const f_status_t status = f_string_prepend_assure_nulless(data.string, data.used, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_string/tests/unit/c/test-string-prepend_assure_nulless.h b/level_0/f_string/tests/unit/c/test-string-prepend_assure_nulless.h new file mode 100644 index 0000000..ed9b295 --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-prepend_assure_nulless.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_string_prepend_assure_nulless_h +#define _TEST__F_string_prepend_assure_nulless_h + +/** + * Test that the function works. + * + * @see f_string_prepend_assure_nulless() + */ +extern void test__f_string_prepend_assure_nulless__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_string_prepend_assure_nulless() + */ +extern void test__f_string_prepend_assure_nulless__parameter_checking(void **state); + +#endif // _TEST__F_string_prepend_assure_nulless_h diff --git a/level_0/f_string/tests/unit/c/test-string-prepend_nulless.c b/level_0/f_string/tests/unit/c/test-string-prepend_nulless.c new file mode 100644 index 0000000..9da9e99 --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-prepend_nulless.c @@ -0,0 +1,39 @@ +#include "test-string.h" +#include "test-string-prepend_nulless.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_string_prepend_nulless__works(void **state) { + + const f_string_static_t source = macro_f_string_static_t_initialize("te\0st", 0, 5); + const f_string_static_t expected = macro_f_string_static_t_initialize("test", 0, 4); + f_string_dynamic_t destination = f_string_dynamic_t_initialize; + + { + const f_status_t status = f_string_prepend_nulless(source.string, source.used, &destination); + + assert_int_equal(status, F_none); + assert_int_equal(destination.used, expected.used); + + assert_string_equal(destination.string, expected.string); + } + + free((void *) destination.string); +} + +void test__f_string_prepend_nulless__parameter_checking(void **state) { + + const f_string_dynamic_t data = f_string_dynamic_t_initialize; + + { + const f_status_t status = f_string_prepend_nulless(data.string, data.used, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_string/tests/unit/c/test-string-prepend_nulless.h b/level_0/f_string/tests/unit/c/test-string-prepend_nulless.h new file mode 100644 index 0000000..3b96a1d --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-prepend_nulless.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_string_prepend_nulless_h +#define _TEST__F_string_prepend_nulless_h + +/** + * Test that the function works. + * + * @see f_string_prepend_nulless() + */ +extern void test__f_string_prepend_nulless__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_string_prepend_nulless() + */ +extern void test__f_string_prepend_nulless__parameter_checking(void **state); + +#endif // _TEST__F_string_prepend_nulless_h diff --git a/level_0/f_string/tests/unit/c/test-string-seek_line.c b/level_0/f_string/tests/unit/c/test-string-seek_line.c new file mode 100644 index 0000000..7732e53 --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-seek_line.c @@ -0,0 +1,66 @@ +#include "test-string.h" +#include "test-string-seek_line.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_string_seek_line__returns_data_not_stop(void **state) { + + const f_string_static_t source = macro_f_string_static_t_initialize("test\nafter", 0, 10); + + { + f_string_range_t range = f_string_range_t_initialize; + + const f_status_t status = f_string_seek_line(source.string, &range); + + assert_int_equal(status, F_data_not_stop); + } +} + +void test__f_string_seek_line__returns_none_stop(void **state) { + + const f_string_static_t source = macro_f_string_static_t_initialize("test", 0, 4); + + { + f_string_range_t range = macro_f_string_range_t_initialize(0, source.used - 1); + + const f_status_t status = f_string_seek_line(source.string, &range); + + assert_int_equal(status, F_none_stop); + + assert_int_equal(range.start, source.used); + assert_int_equal(range.stop, source.used - 1); + } +} + +void test__f_string_seek_line__works(void **state) { + + const f_string_static_t source = macro_f_string_static_t_initialize("test\nafter", 0, 10); + + { + f_string_range_t range = macro_f_string_range_t_initialize(0, source.used - 1); + + const f_status_t status = f_string_seek_line(source.string, &range); + + assert_int_equal(status, F_none); + + assert_int_equal(range.start, 4); + assert_int_equal(range.stop, source.used - 1); + } +} + +void test__f_string_seek_line__parameter_checking(void **state) { + + const f_string_static_t source = macro_f_string_static_t_initialize("teX\nst", 0, 6); + + { + const f_status_t status = f_string_seek_line(source.string, 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_string/tests/unit/c/test-string-seek_line.h b/level_0/f_string/tests/unit/c/test-string-seek_line.h new file mode 100644 index 0000000..ab8d7e6 --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-seek_line.h @@ -0,0 +1,41 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_string_seek_line_h +#define _TEST__F_string_seek_line_h + +/** + * Test that the function returns F_data_not_stop because range is an empty range (range.start > range.stop). + * + * @see f_string_seek_line() + */ +extern void test__f_string_seek_line__returns_data_not_stop(void **state); + +/** + * Test that the function returns F_none_stop stopped after end of range because no newline is found. + * + * @see f_string_seek_line() + */ +extern void test__f_string_seek_line__returns_none_stop(void **state); + +/** + * Test that the function works. + * + * @see f_string_seek_line() + */ +extern void test__f_string_seek_line__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_string_seek_line() + */ +extern void test__f_string_seek_line__parameter_checking(void **state); + +#endif // _TEST__F_string_seek_line_h diff --git a/level_0/f_string/tests/unit/c/test-string-seek_line_to.c b/level_0/f_string/tests/unit/c/test-string-seek_line_to.c new file mode 100644 index 0000000..ee1a1a4 --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-seek_line_to.c @@ -0,0 +1,87 @@ +#include "test-string.h" +#include "test-string-seek_line_to.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_string_seek_line_to__at_newline(void **state) { + + const f_string_static_t to = macro_f_string_static_t_initialize("X", 0, 1); + const f_string_static_t source = macro_f_string_static_t_initialize("te\nXst", 0, 6); + + { + f_string_range_t range = macro_f_string_range_t_initialize(0, source.used - 1); + + const f_status_t status = f_string_seek_line_to(source.string, to.string[0], &range); + + assert_int_equal(status, F_none_eol); + + assert_int_equal(range.start, 2); + assert_int_equal(range.stop, source.used - 1); + } +} + +void test__f_string_seek_line_to__returns_data_not_stop(void **state) { + + const f_string_static_t to = macro_f_string_static_t_initialize("X", 0, 1); + const f_string_static_t source = macro_f_string_static_t_initialize("test\nafter", 0, 10); + + { + f_string_range_t range = f_string_range_t_initialize; + + const f_status_t status = f_string_seek_line_to(source.string, to.string[0], &range); + + assert_int_equal(status, F_data_not_stop); + } +} + +void test__f_string_seek_line_to__returns_none_stop(void **state) { + + const f_string_static_t to = macro_f_string_static_t_initialize("X", 0, 1); + const f_string_static_t source = macro_f_string_static_t_initialize("test", 0, 4); + + { + f_string_range_t range = macro_f_string_range_t_initialize(0, source.used - 1); + + const f_status_t status = f_string_seek_line_to(source.string, to.string[0], &range); + + assert_int_equal(status, F_none_stop); + + assert_int_equal(range.start, source.used); + assert_int_equal(range.stop, source.used - 1); + } +} + +void test__f_string_seek_line_to__works(void **state) { + + const f_string_static_t to = macro_f_string_static_t_initialize("X", 0, 1); + const f_string_static_t source = macro_f_string_static_t_initialize("teX\nst", 0, 6); + + { + f_string_range_t range = macro_f_string_range_t_initialize(0, source.used - 1); + + const f_status_t status = f_string_seek_line_to(source.string, to.string[0], &range); + + assert_int_equal(status, F_none); + + assert_int_equal(range.start, 2); + assert_int_equal(range.stop, source.used - 1); + } +} + +void test__f_string_seek_line_to__parameter_checking(void **state) { + + const f_string_static_t to = macro_f_string_static_t_initialize("X", 0, 1); + const f_string_static_t source = macro_f_string_static_t_initialize("teX\nst", 0, 6); + + { + const f_status_t status = f_string_seek_line_to(source.string, to.string[0], 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_string/tests/unit/c/test-string-seek_line_to.h b/level_0/f_string/tests/unit/c/test-string-seek_line_to.h new file mode 100644 index 0000000..7a8e5f8 --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-seek_line_to.h @@ -0,0 +1,48 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_string_seek_line_to_h +#define _TEST__F_string_seek_line_to_h + +/** + * Test that the function works but stops at newline rather than search string. + * + * @see f_string_seek_line_to() + */ +extern void test__f_string_seek_line_to__at_newline(void **state); + +/** + * Test that the function returns F_data_not_stop because range is an empty range (range.start > range.stop). + * + * @see f_string_seek_line_to() + */ +extern void test__f_string_seek_line_to__returns_data_not_stop(void **state); + +/** + * Test that the function returns F_none_stop stopped after end of range because no newline is found. + * + * @see f_string_seek_line_to() + */ +extern void test__f_string_seek_line_to__returns_none_stop(void **state); + +/** + * Test that the function works. + * + * @see f_string_seek_line_to() + */ +extern void test__f_string_seek_line_to__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_string_seek_line_to() + */ +extern void test__f_string_seek_line_to__parameter_checking(void **state); + +#endif // _TEST__F_string_seek_line_to_h diff --git a/level_0/f_string/tests/unit/c/test-string-seek_to.c b/level_0/f_string/tests/unit/c/test-string-seek_to.c new file mode 100644 index 0000000..55a8cdf --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-seek_to.c @@ -0,0 +1,70 @@ +#include "test-string.h" +#include "test-string-seek_to.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_string_seek_to__returns_data_not_stop(void **state) { + + const f_string_static_t to = macro_f_string_static_t_initialize("X", 0, 1); + const f_string_static_t source = macro_f_string_static_t_initialize("test\nafter", 0, 10); + + { + f_string_range_t range = f_string_range_t_initialize; + + const f_status_t status = f_string_seek_to(source.string, to.string[0], &range); + + assert_int_equal(status, F_data_not_stop); + } +} + +void test__f_string_seek_to__returns_none_stop(void **state) { + + const f_string_static_t to = macro_f_string_static_t_initialize("X", 0, 1); + const f_string_static_t source = macro_f_string_static_t_initialize("test\nafter", 0, 10); + + { + f_string_range_t range = macro_f_string_range_t_initialize(0, source.used - 1); + + const f_status_t status = f_string_seek_to(source.string, to.string[0], &range); + + assert_int_equal(status, F_none_stop); + + assert_int_equal(range.start, source.used); + assert_int_equal(range.stop, source.used - 1); + } +} + +void test__f_string_seek_to__works(void **state) { + + const f_string_static_t to = macro_f_string_static_t_initialize("X", 0, 1); + const f_string_static_t source = macro_f_string_static_t_initialize("te\nXst", 0, 6); + + { + f_string_range_t range = macro_f_string_range_t_initialize(0, source.used - 1); + + const f_status_t status = f_string_seek_to(source.string, to.string[0], &range); + + assert_int_equal(status, F_none); + + assert_int_equal(range.start, 3); + assert_int_equal(range.stop, source.used - 1); + } +} + +void test__f_string_seek_to__parameter_checking(void **state) { + + const f_string_static_t to = macro_f_string_static_t_initialize("X", 0, 1); + const f_string_static_t source = macro_f_string_static_t_initialize("teX\nst", 0, 6); + + { + const f_status_t status = f_string_seek_to(source.string, to.string[0], 0); + + assert_int_equal(status, F_status_set_error(F_parameter)); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_string/tests/unit/c/test-string-seek_to.h b/level_0/f_string/tests/unit/c/test-string-seek_to.h new file mode 100644 index 0000000..3596d2f --- /dev/null +++ b/level_0/f_string/tests/unit/c/test-string-seek_to.h @@ -0,0 +1,41 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.5 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_string_seek_to_h +#define _TEST__F_string_seek_to_h + +/** + * Test that the function returns F_data_not_stop because range is an empty range (range.start > range.stop). + * + * @see f_string_seek_to() + */ +extern void test__f_string_seek_to__returns_data_not_stop(void **state); + +/** + * Test that the function returns F_none_stop stopped after end of range because no newline is found. + * + * @see f_string_seek_to() + */ +extern void test__f_string_seek_to__returns_none_stop(void **state); + +/** + * Test that the function works. + * + * @see f_string_seek_to() + */ +extern void test__f_string_seek_to__works(void **state); + +/** + * Test that the function correctly fails on invalid parameter. + * + * @see f_string_seek_to() + */ +extern void test__f_string_seek_to__parameter_checking(void **state); + +#endif // _TEST__F_string_seek_to_h diff --git a/level_0/f_string/tests/unit/c/test-string.c b/level_0/f_string/tests/unit/c/test-string.c index 1508cd3..0b5e220 100644 --- a/level_0/f_string/tests/unit/c/test-string.c +++ b/level_0/f_string/tests/unit/c/test-string.c @@ -19,6 +19,43 @@ int setdown(void **state) { int main(void) { const struct CMUnitTest tests[] = { + cmocka_unit_test(test__f_string_append__works), + cmocka_unit_test(test__f_string_append_assure__works), + cmocka_unit_test(test__f_string_append_assure_nulless__works), + cmocka_unit_test(test__f_string_append_nulless__works), + + cmocka_unit_test(test__f_string_dynamic_append__works), + cmocka_unit_test(test__f_string_dynamic_append_assure__works), + cmocka_unit_test(test__f_string_dynamic_append_assure_nulless__works), + cmocka_unit_test(test__f_string_dynamic_append_nulless__works), + + cmocka_unit_test(test__f_string_dynamic_mash__works), + cmocka_unit_test(test__f_string_dynamic_mash_nulless__works), + + cmocka_unit_test(test__f_string_dynamic_mish__works), + cmocka_unit_test(test__f_string_dynamic_mish_nulless__works), + + cmocka_unit_test(test__f_string_dynamic_prepend__works), + cmocka_unit_test(test__f_string_dynamic_prepend_assure__works), + cmocka_unit_test(test__f_string_dynamic_prepend_assure_nulless__works), + cmocka_unit_test(test__f_string_dynamic_prepend_nulless__works), + + cmocka_unit_test(test__f_string_dynamic_seek_line__returns_data_not_stop), + cmocka_unit_test(test__f_string_dynamic_seek_line__returns_none_eos), + cmocka_unit_test(test__f_string_dynamic_seek_line__returns_none_stop), + cmocka_unit_test(test__f_string_dynamic_seek_line__works), + + cmocka_unit_test(test__f_string_dynamic_seek_line_to__at_newline), + cmocka_unit_test(test__f_string_dynamic_seek_line_to__returns_data_not_stop), + cmocka_unit_test(test__f_string_dynamic_seek_line_to__returns_none_eos), + cmocka_unit_test(test__f_string_dynamic_seek_line_to__returns_none_stop), + cmocka_unit_test(test__f_string_dynamic_seek_line_to__works), + + cmocka_unit_test(test__f_string_dynamic_seek_to__returns_data_not_stop), + cmocka_unit_test(test__f_string_dynamic_seek_to__returns_none_eos), + cmocka_unit_test(test__f_string_dynamic_seek_to__returns_none_stop), + cmocka_unit_test(test__f_string_dynamic_seek_to__works), + cmocka_unit_test(test__f_string_dynamics_adjust__works), cmocka_unit_test(test__f_string_dynamics_append__works), cmocka_unit_test(test__f_string_dynamics_append_all__works), @@ -42,6 +79,29 @@ int main(void) { cmocka_unit_test(test__f_string_dynamicss_increase_by__works), cmocka_unit_test(test__f_string_dynamicss_resize__works), + cmocka_unit_test(test__f_string_map_multis_adjust__works), + cmocka_unit_test(test__f_string_map_multis_append__works), + cmocka_unit_test(test__f_string_map_multis_append_all__works), + cmocka_unit_test(test__f_string_map_multis_append_all__returns_data_not), + cmocka_unit_test(test__f_string_map_multis_decimate_by__works), + cmocka_unit_test(test__f_string_map_multis_decrease_by__works), + cmocka_unit_test(test__f_string_map_multis_increase__works), + cmocka_unit_test(test__f_string_map_multis_increase__returns_data_not), + cmocka_unit_test(test__f_string_map_multis_increase_by__works), + cmocka_unit_test(test__f_string_map_multis_resize__works), + + cmocka_unit_test(test__f_string_map_multiss_adjust__works), + cmocka_unit_test(test__f_string_map_multiss_append__works), + cmocka_unit_test(test__f_string_map_multiss_append__returns_data_not), + cmocka_unit_test(test__f_string_map_multiss_append_all__works), + cmocka_unit_test(test__f_string_map_multiss_append_all__returns_data_not), + cmocka_unit_test(test__f_string_map_multiss_decimate_by__works), + cmocka_unit_test(test__f_string_map_multiss_decrease_by__works), + cmocka_unit_test(test__f_string_map_multiss_increase__works), + cmocka_unit_test(test__f_string_map_multiss_increase__returns_data_not), + cmocka_unit_test(test__f_string_map_multiss_increase_by__works), + cmocka_unit_test(test__f_string_map_multiss_resize__works), + cmocka_unit_test(test__f_string_maps_adjust__works), cmocka_unit_test(test__f_string_maps_append__works), cmocka_unit_test(test__f_string_maps_append_all__works), @@ -65,28 +125,16 @@ int main(void) { cmocka_unit_test(test__f_string_mapss_increase_by__works), cmocka_unit_test(test__f_string_mapss_resize__works), - cmocka_unit_test(test__f_string_map_multis_adjust__works), - cmocka_unit_test(test__f_string_map_multis_append__works), - cmocka_unit_test(test__f_string_map_multis_append_all__works), - cmocka_unit_test(test__f_string_map_multis_append_all__returns_data_not), - cmocka_unit_test(test__f_string_map_multis_decimate_by__works), - cmocka_unit_test(test__f_string_map_multis_decrease_by__works), - cmocka_unit_test(test__f_string_map_multis_increase__works), - cmocka_unit_test(test__f_string_map_multis_increase__returns_data_not), - cmocka_unit_test(test__f_string_map_multis_increase_by__works), - cmocka_unit_test(test__f_string_map_multis_resize__works), + cmocka_unit_test(test__f_string_mash__works), + cmocka_unit_test(test__f_string_mash_nulless__works), - cmocka_unit_test(test__f_string_map_multiss_adjust__works), - cmocka_unit_test(test__f_string_map_multiss_append__works), - cmocka_unit_test(test__f_string_map_multiss_append__returns_data_not), - cmocka_unit_test(test__f_string_map_multiss_append_all__works), - cmocka_unit_test(test__f_string_map_multiss_append_all__returns_data_not), - cmocka_unit_test(test__f_string_map_multiss_decimate_by__works), - cmocka_unit_test(test__f_string_map_multiss_decrease_by__works), - cmocka_unit_test(test__f_string_map_multiss_increase__works), - cmocka_unit_test(test__f_string_map_multiss_increase__returns_data_not), - cmocka_unit_test(test__f_string_map_multiss_increase_by__works), - cmocka_unit_test(test__f_string_map_multiss_resize__works), + cmocka_unit_test(test__f_string_mish__works), + cmocka_unit_test(test__f_string_mish_nulless__works), + + cmocka_unit_test(test__f_string_prepend__works), + cmocka_unit_test(test__f_string_prepend_assure__works), + cmocka_unit_test(test__f_string_prepend_assure_nulless__works), + cmocka_unit_test(test__f_string_prepend_nulless__works), cmocka_unit_test(test__f_string_quantitys_adjust__works), cmocka_unit_test(test__f_string_quantitys_append__works), @@ -157,7 +205,25 @@ int main(void) { cmocka_unit_test(test__f_string_tripless_increase_by__works), cmocka_unit_test(test__f_string_tripless_resize__works), + cmocka_unit_test(test__f_string_seek_line__returns_data_not_stop), + cmocka_unit_test(test__f_string_seek_line__returns_none_stop), + cmocka_unit_test(test__f_string_seek_line__works), + + cmocka_unit_test(test__f_string_seek_line_to__at_newline), + cmocka_unit_test(test__f_string_seek_line_to__returns_data_not_stop), + cmocka_unit_test(test__f_string_seek_line_to__returns_none_stop), + cmocka_unit_test(test__f_string_seek_line_to__works), + + cmocka_unit_test(test__f_string_seek_to__returns_data_not_stop), + cmocka_unit_test(test__f_string_seek_to__returns_none_stop), + cmocka_unit_test(test__f_string_seek_to__works), + #ifndef _di_level_0_parameter_checking_ + cmocka_unit_test(test__f_string_append__parameter_checking), + cmocka_unit_test(test__f_string_append_assure__parameter_checking), + cmocka_unit_test(test__f_string_append_assure_nulless__parameter_checking), + cmocka_unit_test(test__f_string_append_nulless__parameter_checking), + cmocka_unit_test(test__f_string_dynamics_adjust__parameter_checking), cmocka_unit_test(test__f_string_dynamics_append__parameter_checking), cmocka_unit_test(test__f_string_dynamics_append_all__parameter_checking), @@ -176,6 +242,24 @@ int main(void) { cmocka_unit_test(test__f_string_dynamicss_increase_by__parameter_checking), cmocka_unit_test(test__f_string_dynamicss_resize__parameter_checking), + cmocka_unit_test(test__f_string_map_multis_adjust__parameter_checking), + cmocka_unit_test(test__f_string_map_multis_append__parameter_checking), + cmocka_unit_test(test__f_string_map_multis_append_all__parameter_checking), + cmocka_unit_test(test__f_string_map_multis_decimate_by__parameter_checking), + cmocka_unit_test(test__f_string_map_multis_decrease_by__parameter_checking), + cmocka_unit_test(test__f_string_map_multis_increase__parameter_checking), + cmocka_unit_test(test__f_string_map_multis_increase_by__parameter_checking), + cmocka_unit_test(test__f_string_map_multis_resize__parameter_checking), + + cmocka_unit_test(test__f_string_map_multiss_adjust__parameter_checking), + cmocka_unit_test(test__f_string_map_multiss_append__parameter_checking), + cmocka_unit_test(test__f_string_map_multiss_append_all__parameter_checking), + cmocka_unit_test(test__f_string_map_multiss_decimate_by__parameter_checking), + cmocka_unit_test(test__f_string_map_multiss_decrease_by__parameter_checking), + cmocka_unit_test(test__f_string_map_multiss_increase__parameter_checking), + cmocka_unit_test(test__f_string_map_multiss_increase_by__parameter_checking), + cmocka_unit_test(test__f_string_map_multiss_resize__parameter_checking), + cmocka_unit_test(test__f_string_maps_adjust__parameter_checking), cmocka_unit_test(test__f_string_maps_append__parameter_checking), cmocka_unit_test(test__f_string_maps_append_all__parameter_checking), @@ -194,23 +278,16 @@ int main(void) { cmocka_unit_test(test__f_string_mapss_increase_by__parameter_checking), cmocka_unit_test(test__f_string_mapss_resize__parameter_checking), - cmocka_unit_test(test__f_string_map_multis_adjust__parameter_checking), - cmocka_unit_test(test__f_string_map_multis_append__parameter_checking), - cmocka_unit_test(test__f_string_map_multis_append_all__parameter_checking), - cmocka_unit_test(test__f_string_map_multis_decimate_by__parameter_checking), - cmocka_unit_test(test__f_string_map_multis_decrease_by__parameter_checking), - cmocka_unit_test(test__f_string_map_multis_increase__parameter_checking), - cmocka_unit_test(test__f_string_map_multis_increase_by__parameter_checking), - cmocka_unit_test(test__f_string_map_multis_resize__parameter_checking), + cmocka_unit_test(test__f_string_mash__parameter_checking), + cmocka_unit_test(test__f_string_mash_nulless__parameter_checking), - cmocka_unit_test(test__f_string_map_multiss_adjust__parameter_checking), - cmocka_unit_test(test__f_string_map_multiss_append__parameter_checking), - cmocka_unit_test(test__f_string_map_multiss_append_all__parameter_checking), - cmocka_unit_test(test__f_string_map_multiss_decimate_by__parameter_checking), - cmocka_unit_test(test__f_string_map_multiss_decrease_by__parameter_checking), - cmocka_unit_test(test__f_string_map_multiss_increase__parameter_checking), - cmocka_unit_test(test__f_string_map_multiss_increase_by__parameter_checking), - cmocka_unit_test(test__f_string_map_multiss_resize__parameter_checking), + cmocka_unit_test(test__f_string_mish__parameter_checking), + cmocka_unit_test(test__f_string_mish_nulless__parameter_checking), + + cmocka_unit_test(test__f_string_prepend__parameter_checking), + cmocka_unit_test(test__f_string_prepend_assure__parameter_checking), + cmocka_unit_test(test__f_string_prepend_assure_nulless__parameter_checking), + cmocka_unit_test(test__f_string_prepend_nulless__parameter_checking), cmocka_unit_test(test__f_string_quantitys_adjust__parameter_checking), cmocka_unit_test(test__f_string_quantitys_append__parameter_checking), @@ -265,6 +342,12 @@ int main(void) { cmocka_unit_test(test__f_string_tripless_increase__parameter_checking), cmocka_unit_test(test__f_string_tripless_increase_by__parameter_checking), cmocka_unit_test(test__f_string_tripless_resize__parameter_checking), + + cmocka_unit_test(test__f_string_seek_line__parameter_checking), + + cmocka_unit_test(test__f_string_seek_line_to__parameter_checking), + + cmocka_unit_test(test__f_string_seek_to__parameter_checking), #endif // _di_level_0_parameter_checking_ }; diff --git a/level_0/f_string/tests/unit/c/test-string.h b/level_0/f_string/tests/unit/c/test-string.h index ac58762..5f6fb38 100644 --- a/level_0/f_string/tests/unit/c/test-string.h +++ b/level_0/f_string/tests/unit/c/test-string.h @@ -26,6 +26,25 @@ //#include "mock-string.h" // Test includes. +#include "test-string-append.h" +#include "test-string-append_assure.h" +#include "test-string-append_assure_nulless.h" +#include "test-string-append_nulless.h" +#include "test-string-dynamic_append.h" +#include "test-string-dynamic_append_assure.h" +#include "test-string-dynamic_append_assure_nulless.h" +#include "test-string-dynamic_append_nulless.h" +#include "test-string-dynamic_mash.h" +#include "test-string-dynamic_mash_nulless.h" +#include "test-string-dynamic_mish.h" +#include "test-string-dynamic_mish_nulless.h" +#include "test-string-dynamic_prepend.h" +#include "test-string-dynamic_prepend_assure.h" +#include "test-string-dynamic_prepend_assure_nulless.h" +#include "test-string-dynamic_prepend_nulless.h" +#include "test-string-dynamic_seek_line.h" +#include "test-string-dynamic_seek_line_to.h" +#include "test-string-dynamic_seek_to.h" #include "test-string-dynamics_adjust.h" #include "test-string-dynamics_append.h" #include "test-string-dynamics_append_all.h" @@ -42,22 +61,6 @@ #include "test-string-dynamicss_increase.h" #include "test-string-dynamicss_increase_by.h" #include "test-string-dynamicss_resize.h" -#include "test-string-maps_adjust.h" -#include "test-string-maps_append.h" -#include "test-string-maps_append_all.h" -#include "test-string-maps_decimate_by.h" -#include "test-string-maps_decrease_by.h" -#include "test-string-maps_increase.h" -#include "test-string-maps_increase_by.h" -#include "test-string-maps_resize.h" -#include "test-string-mapss_adjust.h" -#include "test-string-mapss_append.h" -#include "test-string-mapss_append_all.h" -#include "test-string-mapss_decimate_by.h" -#include "test-string-mapss_decrease_by.h" -#include "test-string-mapss_increase.h" -#include "test-string-mapss_increase_by.h" -#include "test-string-mapss_resize.h" #include "test-string-map_multis_adjust.h" #include "test-string-map_multis_append.h" #include "test-string-map_multis_append_all.h" @@ -74,6 +77,30 @@ #include "test-string-map_multiss_increase.h" #include "test-string-map_multiss_increase_by.h" #include "test-string-map_multiss_resize.h" +#include "test-string-maps_adjust.h" +#include "test-string-maps_append.h" +#include "test-string-maps_append_all.h" +#include "test-string-maps_decimate_by.h" +#include "test-string-maps_decrease_by.h" +#include "test-string-maps_increase.h" +#include "test-string-maps_increase_by.h" +#include "test-string-maps_resize.h" +#include "test-string-mapss_adjust.h" +#include "test-string-mapss_append.h" +#include "test-string-mapss_append_all.h" +#include "test-string-mapss_decimate_by.h" +#include "test-string-mapss_decrease_by.h" +#include "test-string-mapss_increase.h" +#include "test-string-mapss_increase_by.h" +#include "test-string-mapss_resize.h" +#include "test-string-mash.h" +#include "test-string-mash_nulless.h" +#include "test-string-mish.h" +#include "test-string-mish_nulless.h" +#include "test-string-prepend.h" +#include "test-string-prepend_assure.h" +#include "test-string-prepend_assure_nulless.h" +#include "test-string-prepend_nulless.h" #include "test-string-quantitys_adjust.h" #include "test-string-quantitys_append.h" #include "test-string-quantitys_append_all.h" @@ -106,6 +133,9 @@ #include "test-string-rangess_increase.h" #include "test-string-rangess_increase_by.h" #include "test-string-rangess_resize.h" +#include "test-string-seek_line.h" +#include "test-string-seek_line_to.h" +#include "test-string-seek_to.h" #include "test-string-triples_adjust.h" #include "test-string-triples_append.h" #include "test-string-triples_append_all.h" -- 1.8.3.1