From: Kevin Day Date: Sun, 3 Apr 2022 00:41:34 +0000 (-0500) Subject: Bugfix: UTF-8 endianess tests fail and improve seek to functions for UTF-8. X-Git-Tag: 0.5.9~1 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=25c0e1862fa241b45419ca038ade57ce56a01a94;p=fll Bugfix: UTF-8 endianess tests fail and improve seek to functions for UTF-8. The original commit dda60cc8d9cad69b55e7d79b4c052677b03b4413 introduced reversed endianness logic. The tests passed for this and so the tests were wrong. The commit that fixed the reversed endianness problems is 78daa0d760fbcc767dd099d68ae02d23b3df4991. These changes revealed the test problems due to the tests now failing. Fix the tests. Make a new character type for the EOL, EOS, and placeholder in a way that is more consistent with the character macros for the f_char_t. The F_utf_substitute_open_box_d_length and F_utf_substitute_open_box_shouldered_d_length should have _s_ rather than _d_ in their names. Change the UTF-8 seek to functions to not need to check for URL fragments. Change the UTF-8 seek to functions to accept f_utf_char_t rather than f_char_t. This completely makes more sense. This allows for searching a f_utf_string_t using a f_utf_char_t. The tests are expecting this behavior earlier and they only happened to succeed due to the coincidence of the bitwise order of the previously incorrect tests. This swaps the bitwise order of the strings. More than likely I need a macro check to handle big endian as well. This is left to changes in the future. The 0.6.x stable series does not guarantee big endian support. The 0.8.x stable series does guarantee big endian support because I will be working on adding networking support. Leave the bitwise improvements and tests for the next development cycle so that I can focus on pushing out the 0.6.x stable release. If I have the time, I might still fix this after the release candidate is released as I will most likely be improving the tests and fixing any discovered problems. --- diff --git a/level_0/f_utf/c/utf/common.c b/level_0/f_utf/c/utf/common.c index d59ca7b..554b9af 100644 --- a/level_0/f_utf/c/utf/common.c +++ b/level_0/f_utf/c/utf/common.c @@ -4,6 +4,12 @@ extern "C" { #endif +#ifndef _di_f_utf_char_t_codes_ + const f_utf_char_t f_utf_char_t_eol_s = (f_utf_char_t) F_utf_char_t_eol_s; + const f_utf_char_t f_utf_char_t_eos_s = (f_utf_char_t) F_utf_char_t_eol_s; + const f_utf_char_t f_utf_char_t_placeholder_s = (f_utf_char_t) F_utf_char_t_eol_s; +#endif // _di_f_utf_char_t_codes_ + #ifndef _di_f_utf_space_ const uint8_t f_utf_space_em_s[F_utf_space_em_s_length] = { 0xe2, 0x80, 0x83 }; const uint8_t f_utf_space_em_quad_s[F_utf_space_em_quad_s_length] = { 0xe2, 0x80, 0x81 }; @@ -39,8 +45,8 @@ extern "C" { const uint8_t f_utf_substitute_middle_dot_s[F_utf_substitute_middle_dot_s_length] = { 0xc2, 0xb7 }; - const uint8_t f_utf_substitute_open_box_s[F_utf_substitute_open_box_d_length] = { 0xe2, 0x90, 0xa3 }; - const uint8_t f_utf_substitute_open_box_shouldered_s[F_utf_substitute_open_box_shouldered_d_length] = { 0xe2, 0x8d, 0xbd }; + const uint8_t f_utf_substitute_open_box_s[F_utf_substitute_open_box_s_length] = { 0xe2, 0x90, 0xa3 }; + const uint8_t f_utf_substitute_open_box_shouldered_s[F_utf_substitute_open_box_shouldered_s_length] = { 0xe2, 0x8d, 0xbd }; #endif // _di_f_utf_substitute_ #ifdef __cplusplus diff --git a/level_0/f_utf/c/utf/common.h b/level_0/f_utf/c/utf/common.h index 9019a0d..36dde62 100644 --- a/level_0/f_utf/c/utf/common.h +++ b/level_0/f_utf/c/utf/common.h @@ -135,8 +135,8 @@ extern "C" { #define F_utf_substitute_middle_dot_s_length 2 - #define F_utf_substitute_open_box_d_length 3 - #define F_utf_substitute_open_box_shouldered_d_length 3 + #define F_utf_substitute_open_box_s_length 3 + #define F_utf_substitute_open_box_shouldered_s_length 3 extern const uint8_t f_utf_substitute_symbol_blank_s[]; extern const uint8_t f_utf_substitute_symbol_space_s[]; @@ -228,20 +228,24 @@ extern "C" { #endif // _di_f_utf_char_t_ /** - * Provide an integer that represents special characters. + * Provide f_utf_char_t special "characters". * - * Because this is an integer, the byte order matters. + * These strings are created via digits and then cast. */ #ifndef _di_f_utf_char_t_codes_ #ifdef _is_F_endian_big - #define F_utf_char_t_eol_d 0x0000000au // 0000 0000, 0000 0000, 0000 0000, 0000 1010 - #define F_utf_char_t_eos_d 0x00000000u // 0000 0000, 0000 0000, 0000 0000, 0000 0000 - #define F_utf_char_t_placeholder_d 0x00000000u // 0000 0000, 0000 0000, 0000 0000, 0000 0000 + #define F_utf_char_t_eol_s 0x0000000au // 0000 0000, 0000 0000, 0000 0000, 0000 1010 + #define F_utf_char_t_eos_s 0x00000000u // 0000 0000, 0000 0000, 0000 0000, 0000 0000 + #define F_utf_char_t_placeholder_s 0x00000000u // 0000 0000, 0000 0000, 0000 0000, 0000 0000 #else - #define F_utf_char_t_eol_d 0x0a000000u // 0000 1010, 0000 0000, 0000 0000, 0000 0000 - #define F_utf_char_t_eos_d 0x00000000u // 0000 0000, 0000 0000, 0000 0000, 0000 0000 - #define F_utf_char_t_placeholder_d 0x00000000u // 0000 0000, 0000 0000, 0000 0000, 0000 0000 + #define F_utf_char_t_eol_s 0x0a000000u // 0000 1010, 0000 0000, 0000 0000, 0000 0000 + #define F_utf_char_t_eos_s 0x00000000u // 0000 0000, 0000 0000, 0000 0000, 0000 0000 + #define F_utf_char_t_placeholder_s 0x00000000u // 0000 0000, 0000 0000, 0000 0000, 0000 0000 #endif // _is_F_endian_big + + extern const f_utf_char_t f_utf_char_t_eol_s; + extern const f_utf_char_t f_utf_char_t_eos_s; + extern const f_utf_char_t f_utf_char_t_placeholder_s; #endif // _di_f_utf_char_t_codes_ /** diff --git a/level_0/f_utf/c/utf/dynamic.c b/level_0/f_utf/c/utf/dynamic.c index 9e946ed..91719b6 100644 --- a/level_0/f_utf/c/utf/dynamic.c +++ b/level_0/f_utf/c/utf/dynamic.c @@ -679,7 +679,7 @@ extern "C" { if (!buffer.used) return F_data_not; if (range->start > range->stop) return F_data_not_stop; - while (buffer.string[range->start] != F_utf_char_t_eol_d) { + while (buffer.string[range->start] != f_utf_char_t_eol_s) { if (macro_f_utf_char_t_width_is(buffer.string[range->start]) == 1) { return F_status_set_error(F_utf); @@ -696,7 +696,7 @@ extern "C" { #endif // _di_f_utf_string_dynamic_seek_line_ #ifndef _di_f_utf_string_dynamic_seek_line_to_ - f_status_t f_utf_string_dynamic_seek_line_to(const f_utf_string_static_t buffer, const f_char_t seek_to_this, f_string_range_t * const range) { + f_status_t f_utf_string_dynamic_seek_line_to(const f_utf_string_static_t buffer, const f_utf_char_t seek_to_this, f_string_range_t * const range) { #ifndef _di_level_0_parameter_checking_ if (!range) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ @@ -710,7 +710,7 @@ extern "C" { return F_status_set_error(F_utf); } - if (buffer.string[range->start] == F_utf_char_t_eol_d) return F_none_eol; + if (buffer.string[range->start] == f_utf_char_t_eol_s) return F_none_eol; ++range->start; @@ -723,7 +723,7 @@ extern "C" { #endif // _di_f_utf_string_dynamic_seek_line_to_ #ifndef _di_f_utf_string_dynamic_seek_to_ - f_status_t f_utf_string_dynamic_seek_to(const f_utf_string_static_t buffer, const f_char_t seek_to_this, f_string_range_t * const range) { + f_status_t f_utf_string_dynamic_seek_to(const f_utf_string_static_t buffer, const f_utf_char_t seek_to_this, f_string_range_t * const range) { #ifndef _di_level_0_parameter_checking_ if (!range) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ diff --git a/level_0/f_utf/c/utf/dynamic.h b/level_0/f_utf/c/utf/dynamic.h index dbccbbe..51e93e5 100644 --- a/level_0/f_utf/c/utf/dynamic.h +++ b/level_0/f_utf/c/utf/dynamic.h @@ -917,7 +917,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_utf_string_dynamic_seek_line_to_ - extern f_status_t f_utf_string_dynamic_seek_line_to(const f_utf_string_static_t buffer, const f_char_t seek_to_this, f_string_range_t * const range); + extern f_status_t f_utf_string_dynamic_seek_line_to(const f_utf_string_static_t buffer, const f_utf_char_t seek_to_this, f_string_range_t * const range); #endif // _di_f_utf_string_dynamic_seek_line_to_ /** @@ -943,7 +943,7 @@ extern "C" { * Errors (with error bit) from: f_memory_resize(). */ #ifndef _di_f_utf_string_dynamic_seek_to_ - extern f_status_t f_utf_string_dynamic_seek_to(const f_utf_string_static_t buffer, const f_char_t seek_to_this, f_string_range_t * const range); + extern f_status_t f_utf_string_dynamic_seek_to(const f_utf_string_static_t buffer, const f_utf_char_t seek_to_this, f_string_range_t * const range); #endif // _di_f_utf_string_dynamic_seek_to_ /** diff --git a/level_0/f_utf/c/utf/string.c b/level_0/f_utf/c/utf/string.c index 81f2431..cb40e7b 100644 --- a/level_0/f_utf/c/utf/string.c +++ b/level_0/f_utf/c/utf/string.c @@ -298,7 +298,7 @@ extern "C" { return F_data_not_stop; } - while (string[range->start] != F_utf_char_t_eol_d) { + while (string[range->start] != f_utf_char_t_eol_s) { if (macro_f_utf_char_t_width_is(string[range->start]) == 1) { return F_status_set_error(F_utf_fragment); @@ -316,7 +316,7 @@ extern "C" { #endif // _di_f_utf_string_seek_line_ #ifndef _di_f_utf_string_seek_line_to_ - f_status_t f_utf_string_seek_line_to(const f_utf_string_t string, const f_char_t seek_to, f_string_range_t * const range) { + f_status_t f_utf_string_seek_line_to(const f_utf_string_t string, const f_utf_char_t seek_to, f_string_range_t * const range) { #ifndef _di_level_0_parameter_checking_ if (!range) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ @@ -327,11 +327,7 @@ extern "C" { while (string[range->start] != seek_to) { - if (macro_f_utf_char_t_width_is(string[range->start]) == 1) { - return F_status_set_error(F_utf_fragment); - } - - if (string[range->start] == F_utf_char_t_eol_d) { + if (string[range->start] == f_utf_char_t_eol_s) { return F_none_eol; } @@ -347,7 +343,7 @@ extern "C" { #endif // _di_f_utf_string_seek_line_to_ #ifndef _di_f_utf_string_seek_to_ - f_status_t f_utf_string_seek_to(const f_utf_string_t string, const f_char_t seek_to, f_string_range_t * const range) { + f_status_t f_utf_string_seek_to(const f_utf_string_t string, const f_utf_char_t seek_to, f_string_range_t * const range) { #ifndef _di_level_0_parameter_checking_ if (!range) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ @@ -358,10 +354,6 @@ extern "C" { while (string[range->start] != seek_to) { - if (macro_f_utf_char_t_width_is(string[range->start]) == 1) { - return F_status_set_error(F_utf_fragment); - } - ++range->start; if (range->start > range->stop) { diff --git a/level_0/f_utf/c/utf/string.h b/level_0/f_utf/c/utf/string.h index 98083d8..2a70f4e 100644 --- a/level_0/f_utf/c/utf/string.h +++ b/level_0/f_utf/c/utf/string.h @@ -377,7 +377,7 @@ extern "C" { * @param string * The string to traverse. * @param seek_to - * A single-width character representing a character to seek to. + * A character representing a character to seek to. * @param range * A range within the buffer representing the start and stop locations. * The start location will be incremented by seek. @@ -389,11 +389,9 @@ extern "C" { * F_data_not_stop if range.start > range.stop. * * F_parameter (with error bit) if a parameter is invalid. - * F_utf (with error bit) if unicode is an invalid Unicode character. - * F_utf_fragment (with error bit) if character is an incomplete UTF-8 fragment. */ #ifndef _di_f_utf_string_seek_line_to_ - extern f_status_t f_utf_string_seek_line_to(const f_utf_string_t string, const f_char_t seek_to, f_string_range_t * const range); + extern f_status_t f_utf_string_seek_line_to(const f_utf_string_t string, const f_utf_char_t seek_to, f_string_range_t * const range); #endif // _di_f_utf_string_seek_line_to_ /** @@ -402,7 +400,7 @@ extern "C" { * @param string * The string to traverse. * @param seek_to - * A single-width character representing a character to seek to. + * A character representing a character to seek to. * @param range * A range within the buffer representing the start and stop locations. * The start location will be incremented by seek. @@ -417,7 +415,7 @@ extern "C" { * F_utf_fragment (with error bit) if character is an incomplete UTF-8 fragment. */ #ifndef _di_f_utf_string_seek_to_ - extern f_status_t f_utf_string_seek_to(const f_utf_string_t string, const f_char_t seek_to, f_string_range_t * const range); + extern f_status_t f_utf_string_seek_to(const f_utf_string_t string, const f_utf_char_t seek_to, f_string_range_t * const range); #endif // _di_f_utf_string_seek_to_ #ifdef __cplusplus diff --git a/level_0/f_utf/tests/unit/c/test-utf-append.c b/level_0/f_utf/tests/unit/c/test-utf-append.c index f9ad946..f20bf3f 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-append.c +++ b/level_0/f_utf/tests/unit/c/test-utf-append.c @@ -7,7 +7,7 @@ extern "C" { void test__f_utf_append__works(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t", 0, 5); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { diff --git a/level_0/f_utf/tests/unit/c/test-utf-append_assure.c b/level_0/f_utf/tests/unit/c/test-utf-append_assure.c index 144501f..544ec0a 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-append_assure.c +++ b/level_0/f_utf/tests/unit/c/test-utf-append_assure.c @@ -7,7 +7,7 @@ extern "C" { void test__f_utf_append_assure__works(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t", 0, 5); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { diff --git a/level_0/f_utf/tests/unit/c/test-utf-append_assure_nulless.c b/level_0/f_utf/tests/unit/c/test-utf-append_assure_nulless.c index b47ecb8..3caf807 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-append_assure_nulless.c +++ b/level_0/f_utf/tests/unit/c/test-utf-append_assure_nulless.c @@ -7,8 +7,8 @@ extern "C" { void test__f_utf_append_assure_nulless__works(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); - const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 4); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t", 0, 5); + const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t", 0, 4); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { diff --git a/level_0/f_utf/tests/unit/c/test-utf-append_nulless.c b/level_0/f_utf/tests/unit/c/test-utf-append_nulless.c index e25db2b..ae8e53d 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-append_nulless.c +++ b/level_0/f_utf/tests/unit/c/test-utf-append_nulless.c @@ -7,8 +7,8 @@ extern "C" { void test__f_utf_append_nulless__works(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); - const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 4); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t", 0, 5); + const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t", 0, 4); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_append.c b/level_0/f_utf/tests/unit/c/test-utf-dynamic_append.c index 15aa0ed..cc06c71 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_append.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_append.c @@ -7,7 +7,7 @@ extern "C" { void test__f_utf_dynamic_append__works(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t", 0, 5); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_append_assure.c b/level_0/f_utf/tests/unit/c/test-utf-dynamic_append_assure.c index b74c8a8..5695a25 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_append_assure.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_append_assure.c @@ -7,7 +7,7 @@ extern "C" { void test__f_utf_dynamic_append_assure__works(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t", 0, 5); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_append_assure_nulless.c b/level_0/f_utf/tests/unit/c/test-utf-dynamic_append_assure_nulless.c index 91b36b7..3a51109 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_append_assure_nulless.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_append_assure_nulless.c @@ -7,8 +7,8 @@ extern "C" { void test__f_utf_dynamic_append_assure_nulless__works(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); - const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 4); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t", 0, 5); + const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t", 0, 4); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_append_nulless.c b/level_0/f_utf/tests/unit/c/test-utf-dynamic_append_nulless.c index 86a5923..4d3d940 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_append_nulless.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_append_nulless.c @@ -7,8 +7,8 @@ extern "C" { void test__f_utf_dynamic_append_nulless__works(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); - const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 4); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t", 0, 5); + const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t", 0, 4); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_mash.c b/level_0/f_utf/tests/unit/c/test-utf-dynamic_mash.c index 1481647..92b45d3 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_mash.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_mash.c @@ -7,9 +7,9 @@ extern "C" { void test__f_utf_dynamic_mash__works(void **state) { - const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) ":\0\0\0", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); - const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0:\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 11); + const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0:", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t", 0, 5); + const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0:\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t", 0, 11); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { @@ -40,8 +40,8 @@ void test__f_utf_dynamic_mash__works(void **state) { void test__f_utf_dynamic_mash__parameter_checking(void **state) { - const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) ":\0\0\0", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); + const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0:", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t", 0, 5); { const f_status_t status = f_utf_string_dynamic_mash(glue, source, 0); diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_mash_nulless.c b/level_0/f_utf/tests/unit/c/test-utf-dynamic_mash_nulless.c index 9b14aa6..9b62a59 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_mash_nulless.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_mash_nulless.c @@ -7,10 +7,10 @@ extern "C" { void test__f_utf_dynamic_mash_nulless__works(void **state) { - const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) ":\0\0\0", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); - const f_utf_string_static_t expected1 = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 4); - const f_utf_string_static_t expected2 = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0:\0\0\0t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 9); + const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0:", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t", 0, 5); + const f_utf_string_static_t expected1 = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t", 0, 4); + const f_utf_string_static_t expected2 = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t\0\0\0:\0\0\0t\0\0\0e\0\0\0s\0\0\0t", 0, 9); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { @@ -41,8 +41,8 @@ void test__f_utf_dynamic_mash_nulless__works(void **state) { void test__f_utf_dynamic_mash_nulless__parameter_checking(void **state) { - const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) ":\0\0\0", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); + const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0:", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t", 0, 5); { const f_status_t status = f_utf_string_dynamic_mash_nulless(glue, source, 0); diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_mish.c b/level_0/f_utf/tests/unit/c/test-utf-dynamic_mish.c index ea7fa96..23b543d 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_mish.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_mish.c @@ -7,9 +7,9 @@ extern "C" { void test__f_utf_dynamic_mish__works(void **state) { - const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) ":\0\0\0", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); - const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0:\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 11); + const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0:", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t", 0, 5); + const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0:\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t", 0, 11); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { @@ -40,8 +40,8 @@ void test__f_utf_dynamic_mish__works(void **state) { void test__f_utf_dynamic_mish__parameter_checking(void **state) { - const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) ":\0\0\0", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); + const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0:", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t", 0, 5); { const f_status_t status = f_utf_string_dynamic_mish(glue, source, 0); diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_mish_nulless.c b/level_0/f_utf/tests/unit/c/test-utf-dynamic_mish_nulless.c index 19f765d..641f6f0 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_mish_nulless.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_mish_nulless.c @@ -7,10 +7,10 @@ extern "C" { void test__f_utf_dynamic_mish_nulless__works(void **state) { - const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) ":\0\0\0", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); - const f_utf_string_static_t expected1 = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 4); - const f_utf_string_static_t expected2 = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0:\0\0\0t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 9); + const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0:", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t", 0, 5); + const f_utf_string_static_t expected1 = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t", 0, 4); + const f_utf_string_static_t expected2 = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t\0\0\0:\0\0\0t\0\0\0e\0\0\0s\0\0\0t", 0, 9); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { @@ -41,8 +41,8 @@ void test__f_utf_dynamic_mish_nulless__works(void **state) { void test__f_utf_dynamic_mish_nulless__parameter_checking(void **state) { - const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) ":\0\0\0", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); + const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0:", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t", 0, 5); { const f_status_t status = f_utf_string_dynamic_mish_nulless(glue, source, 0); diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_append.c b/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_append.c index 1f351f9..034ed62 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_append.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_append.c @@ -7,8 +7,8 @@ extern "C" { void test__f_utf_dynamic_partial_append__works(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "_\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0_\0\0\0", 0, 7); - const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0_\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0_", 0, 7); + const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t", 0, 5); const f_string_range_t partial = macro_f_string_range_t_initialize(1, 5); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_append_assure.c b/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_append_assure.c index 8f49da4..aad0b36 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_append_assure.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_append_assure.c @@ -7,8 +7,8 @@ extern "C" { void test__f_utf_dynamic_partial_append_assure__works(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "_\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0_\0\0\0", 0, 7); - const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0_\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0_", 0, 7); + const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t", 0, 5); const f_string_range_t partial = macro_f_string_range_t_initialize(1, 5); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_append_assure_nulless.c b/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_append_assure_nulless.c index 81efb73..5078b29 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_append_assure_nulless.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_append_assure_nulless.c @@ -7,8 +7,8 @@ extern "C" { void test__f_utf_dynamic_partial_append_assure_nulless__works(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "_\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0_\0\0\0", 0, 7); - const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 4); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0_\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0_", 0, 7); + const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t", 0, 4); const f_string_range_t partial = macro_f_string_range_t_initialize(1, 5); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_append_nulless.c b/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_append_nulless.c index 46917ea..55e9401 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_append_nulless.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_append_nulless.c @@ -7,8 +7,8 @@ extern "C" { void test__f_utf_dynamic_partial_append_nulless__works(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "_\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0_\0\0\0", 0, 7); - const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 4); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0_\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0_", 0, 7); + const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t", 0, 4); const f_string_range_t partial = macro_f_string_range_t_initialize(1, 5); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_mash.c b/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_mash.c index 85095eb..72112f3 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_mash.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_mash.c @@ -7,10 +7,10 @@ extern "C" { void test__f_utf_dynamic_partial_mash__works(void **state) { - const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) ":\0\0\0", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "_\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0_\0\0\0", 0, 7); - const f_utf_string_static_t expected1 = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); - const f_utf_string_static_t expected2 = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0:\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 11); + const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0:", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0_\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0_", 0, 7); + const f_utf_string_static_t expected1 = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t", 0, 5); + const f_utf_string_static_t expected2 = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0:\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t", 0, 11); const f_string_range_t partial = macro_f_string_range_t_initialize(1, 5); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; @@ -42,8 +42,8 @@ void test__f_utf_dynamic_partial_mash__works(void **state) { void test__f_utf_dynamic_partial_mash__parameter_checking(void **state) { - const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) ":\0\0\0", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); + const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0:", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t", 0, 5); const f_string_range_t partial = f_string_range_t_initialize; { diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_mash_nulless.c b/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_mash_nulless.c index 04b0bc0..b5c2586 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_mash_nulless.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_mash_nulless.c @@ -7,10 +7,10 @@ extern "C" { void test__f_utf_dynamic_partial_mash_nulless__works(void **state) { - const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) ":\0\0\0", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "_\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0_\0\0\0", 0, 7); - const f_utf_string_static_t expected1 = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 4); - const f_utf_string_static_t expected2 = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0:\0\0\0t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 9); + const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0:", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0_\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0_", 0, 7); + const f_utf_string_static_t expected1 = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t", 0, 4); + const f_utf_string_static_t expected2 = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t\0\0\0:\0\0\0t\0\0\0e\0\0\0s\0\0\0t", 0, 9); const f_string_range_t partial = macro_f_string_range_t_initialize(1, 5); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; @@ -42,8 +42,8 @@ void test__f_utf_dynamic_partial_mash_nulless__works(void **state) { void test__f_utf_dynamic_partial_mash_nulless__parameter_checking(void **state) { - const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) ":\0\0\0", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); + const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0:", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t", 0, 5); const f_string_range_t partial = f_string_range_t_initialize; { diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_mish.c b/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_mish.c index 0e60cca..70de824 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_mish.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_mish.c @@ -7,10 +7,10 @@ extern "C" { void test__f_utf_dynamic_partial_mish__works(void **state) { - const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) ":\0\0\0", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "_\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0_\0\0\0", 0, 7); - const f_utf_string_static_t expected1 = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); - const f_utf_string_static_t expected2 = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0:\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 11); + const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0:", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0_\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0_", 0, 7); + const f_utf_string_static_t expected1 = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t", 0, 5); + const f_utf_string_static_t expected2 = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0:\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t", 0, 11); const f_string_range_t partial = macro_f_string_range_t_initialize(1, 5); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; @@ -42,8 +42,8 @@ void test__f_utf_dynamic_partial_mish__works(void **state) { void test__f_utf_dynamic_partial_mish__parameter_checking(void **state) { - const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) ":\0\0\0", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); + const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0:", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t", 0, 5); const f_string_range_t partial = f_string_range_t_initialize; { diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_mish_nulless.c b/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_mish_nulless.c index f789563..6ddb762 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_mish_nulless.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_mish_nulless.c @@ -7,10 +7,10 @@ extern "C" { void test__f_utf_dynamic_partial_mish_nulless__works(void **state) { - const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) ":\0\0\0", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "_\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0_\0\0\0", 0, 7); - const f_utf_string_static_t expected1 = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 4); - const f_utf_string_static_t expected2 = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0:\0\0\0t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 9); + const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0:", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0_\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0_", 0, 7); + const f_utf_string_static_t expected1 = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t", 0, 4); + const f_utf_string_static_t expected2 = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t\0\0\0:\0\0\0t\0\0\0e\0\0\0s\0\0\0t", 0, 9); const f_string_range_t partial = macro_f_string_range_t_initialize(1, 5); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; @@ -42,8 +42,8 @@ void test__f_utf_dynamic_partial_mish_nulless__works(void **state) { void test__f_utf_dynamic_partial_mish_nulless__parameter_checking(void **state) { - const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) ":\0\0\0", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); + const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0:", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t", 0, 5); const f_string_range_t partial = f_string_range_t_initialize; { diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_prepend.c b/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_prepend.c index 737ebee..8415119 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_prepend.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_prepend.c @@ -7,8 +7,8 @@ extern "C" { void test__f_utf_dynamic_partial_prepend__works(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "_\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0_\0\0\0", 0, 7); - const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0_\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0_", 0, 7); + const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t", 0, 5); const f_string_range_t partial = macro_f_string_range_t_initialize(1, 5); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_prepend_assure.c b/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_prepend_assure.c index e486905..f7d994c 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_prepend_assure.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_prepend_assure.c @@ -7,8 +7,8 @@ extern "C" { void test__f_utf_dynamic_partial_prepend_assure__works(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "_\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0_\0\0\0", 0, 7); - const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0_\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0_", 0, 7); + const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t", 0, 5); const f_string_range_t partial = macro_f_string_range_t_initialize(1, 5); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_prepend_assure_nulless.c b/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_prepend_assure_nulless.c index 0c39395..5b0ec0b 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_prepend_assure_nulless.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_prepend_assure_nulless.c @@ -7,8 +7,8 @@ extern "C" { void test__f_utf_dynamic_partial_prepend_assure_nulless__works(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "_\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0_\0\0\0", 0, 7); - const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 4); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0_\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0_", 0, 7); + const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t", 0, 4); const f_string_range_t partial = macro_f_string_range_t_initialize(1, 5); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_prepend_nulless.c b/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_prepend_nulless.c index c161ed2..541af3d 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_prepend_nulless.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_partial_prepend_nulless.c @@ -7,8 +7,8 @@ extern "C" { void test__f_utf_dynamic_partial_prepend_nulless__works(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "_\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0_\0\0\0", 0, 7); - const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 4); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0_\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0_", 0, 7); + const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t", 0, 4); const f_string_range_t partial = macro_f_string_range_t_initialize(1, 5); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_prepend.c b/level_0/f_utf/tests/unit/c/test-utf-dynamic_prepend.c index 8864852..5ec1114 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_prepend.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_prepend.c @@ -7,7 +7,7 @@ extern "C" { void test__f_utf_dynamic_prepend__works(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t", 0, 5); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_prepend_assure.c b/level_0/f_utf/tests/unit/c/test-utf-dynamic_prepend_assure.c index f3ce21c..0130073 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_prepend_assure.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_prepend_assure.c @@ -7,7 +7,7 @@ extern "C" { void test__f_utf_dynamic_prepend_assure__works(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t", 0, 5); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_prepend_assure_nulless.c b/level_0/f_utf/tests/unit/c/test-utf-dynamic_prepend_assure_nulless.c index 37499a9..d256dcc 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_prepend_assure_nulless.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_prepend_assure_nulless.c @@ -7,8 +7,8 @@ extern "C" { void test__f_utf_dynamic_prepend_assure_nulless__works(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); - const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 4); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t", 0, 5); + const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t", 0, 4); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_prepend_nulless.c b/level_0/f_utf/tests/unit/c/test-utf-dynamic_prepend_nulless.c index 7737631..17d123c 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_prepend_nulless.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_prepend_nulless.c @@ -7,8 +7,8 @@ extern "C" { void test__f_utf_dynamic_prepend_nulless__works(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); - const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 4); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t", 0, 5); + const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t", 0, 4); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_seek_line.c b/level_0/f_utf/tests/unit/c/test-utf-dynamic_seek_line.c index 03a4987..bcb4d64 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_seek_line.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_seek_line.c @@ -7,7 +7,7 @@ extern "C" { void test__f_utf_dynamic_seek_line__returns_data_not_stop(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0\n\0\0\0a\0\0\0f\0\0\0t\0\0\0e\0\0\0r\0\0\0", 0, 10); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t\0\0\0\n\0\0\0a\0\0\0f\0\0\0t\0\0\0e\0\0\0r", 0, 10); { f_string_range_t range = f_string_range_t_initialize; @@ -20,7 +20,7 @@ void test__f_utf_dynamic_seek_line__returns_data_not_stop(void **state) { void test__f_utf_dynamic_seek_line__returns_none_eos(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 4); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t", 0, 4); { f_string_range_t range = macro_f_string_range_t_initialize(0, source.used - 1); @@ -36,7 +36,7 @@ void test__f_utf_dynamic_seek_line__returns_none_eos(void **state) { void test__f_utf_dynamic_seek_line__returns_none_stop(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 4); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t", 0, 4); { f_string_range_t range = macro_f_string_range_t_initialize(0, source.used - 2); @@ -52,7 +52,7 @@ void test__f_utf_dynamic_seek_line__returns_none_stop(void **state) { void test__f_utf_dynamic_seek_line__works(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0\n\0\0\0a\0\0\0f\0\0\0t\0\0\0e\0\0\0r\0\0\0", 0, 10); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t\0\0\0\n\0\0\0a\0\0\0f\0\0\0t\0\0\0e\0\0\0r", 0, 10); { f_string_range_t range = macro_f_string_range_t_initialize(0, source.used - 1); @@ -68,7 +68,7 @@ void test__f_utf_dynamic_seek_line__works(void **state) { void test__f_utf_dynamic_seek_line__parameter_checking(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0X\0\0\0\n\0\0\0s\0\0\0t\0\0\0", 0, 6); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0X\0\0\0\n\0\0\0s\0\0\0t", 0, 6); { const f_status_t status = f_utf_string_dynamic_seek_line(source, 0); diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_seek_line_to.c b/level_0/f_utf/tests/unit/c/test-utf-dynamic_seek_line_to.c index 9d6ac86..1adb891 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_seek_line_to.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_seek_line_to.c @@ -5,10 +5,10 @@ extern "C" { #endif -void test__f_utf_dynamic_seek_line_to__at_newline(void **state) { +void test__f_utf_dynamic_seek_line_to__after_newline(void **state) { - const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "X\0\0\0", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\n\0\0\0X\0\0\0s\0\0\0t\0\0\0", 0, 6); + const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0X", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\n\0\0\0X\0\0\0s\0\0\0t", 0, 6); { f_string_range_t range = macro_f_string_range_t_initialize(0, source.used - 1); @@ -22,10 +22,27 @@ void test__f_utf_dynamic_seek_line_to__at_newline(void **state) { } } +void test__f_utf_dynamic_seek_line_to__before_newline(void **state) { + + const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0X", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0X\0\0\0\n\0\0\0s\0\0\0t", 0, 6); + + { + f_string_range_t range = macro_f_string_range_t_initialize(0, source.used - 1); + + const f_status_t status = f_utf_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_utf_dynamic_seek_line_to__returns_data_not_stop(void **state) { - const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "X\0\0\0", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0\n\0\0\0a\0\0\0f\0\0\0t\0\0\0e\0\0\0r\0\0\0", 0, 10); + const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0X", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t\0\0\0\n\0\0\0a\0\0\0f\0\0\0t\0\0\0e\0\0\0r", 0, 10); { f_string_range_t range = f_string_range_t_initialize; @@ -38,8 +55,8 @@ void test__f_utf_dynamic_seek_line_to__returns_data_not_stop(void **state) { void test__f_utf_dynamic_seek_line_to__returns_none_eos(void **state) { - const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "X\0\0\0", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 4); + const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0X", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t", 0, 4); { f_string_range_t range = macro_f_string_range_t_initialize(0, source.used - 1); @@ -55,8 +72,8 @@ void test__f_utf_dynamic_seek_line_to__returns_none_eos(void **state) { void test__f_utf_dynamic_seek_line_to__returns_none_stop(void **state) { - const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "X\0\0\0", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 4); + const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0X", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t", 0, 4); { f_string_range_t range = macro_f_string_range_t_initialize(0, source.used - 2); @@ -70,27 +87,10 @@ void test__f_utf_dynamic_seek_line_to__returns_none_stop(void **state) { } } -void test__f_utf_dynamic_seek_line_to__works(void **state) { - - const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "X\0\0\0", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0X\0\0\0\n\0\0\0s\0\0\0t\0\0\0", 0, 6); - - { - f_string_range_t range = macro_f_string_range_t_initialize(0, source.used - 1); - - const f_status_t status = f_utf_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_utf_dynamic_seek_line_to__parameter_checking(void **state) { - const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "X\0\0\0", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0X\0\0\0\n\0\0\0s\0\0\0t\0\0\0", 0, 6); + const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0X", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0X\0\0\0\n\0\0\0s\0\0\0t", 0, 6); { const f_status_t status = f_utf_string_dynamic_seek_line_to(source, to.string[0], 0); diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_seek_line_to.h b/level_0/f_utf/tests/unit/c/test-utf-dynamic_seek_line_to.h index 1652881..d877671 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_seek_line_to.h +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_seek_line_to.h @@ -11,11 +11,18 @@ #define _TEST__F_utf_dynamic_seek_line_to_h /** - * Test that the function works but stops at newline rather than search string. + * Test that the function works where seek target is after a newline. * * @see f_utf_string_dynamic_seek_line_to() */ -extern void test__f_utf_dynamic_seek_line_to__at_newline(void **state); +extern void test__f_utf_dynamic_seek_line_to__after_newline(void **state); + +/** + * Test that the function works where seek target is before a newline. + * + * @see f_utf_string_dynamic_seek_line_to() + */ +extern void test__f_utf_dynamic_seek_line_to__before_newline(void **state); /** * Test that the function returns F_data_not_stop because range is an empty range (range.start > range.stop). @@ -39,13 +46,6 @@ extern void test__f_utf_dynamic_seek_line_to__returns_none_eos(void **state); extern void test__f_utf_dynamic_seek_line_to__returns_none_stop(void **state); /** - * Test that the function works. - * - * @see f_utf_string_dynamic_seek_line_to() - */ -extern void test__f_utf_dynamic_seek_line_to__works(void **state); - -/** * Test that the function correctly fails on invalid parameter. * * @see f_utf_string_dynamic_seek_line_to() diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_seek_to.c b/level_0/f_utf/tests/unit/c/test-utf-dynamic_seek_to.c index d47e680..df3c318 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_seek_to.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_seek_to.c @@ -5,10 +5,44 @@ extern "C" { #endif +void test__f_utf_dynamic_seek_to__after_newline(void **state) { + + const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0X", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\n\0\0\0X\0\0\0s\0\0\0t", 0, 6); + + { + f_string_range_t range = macro_f_string_range_t_initialize(0, source.used - 1); + + const f_status_t status = f_utf_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_utf_dynamic_seek_to__before_newline(void **state) { + + const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0X", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0X\0\0\0\n\0\0\0s\0\0\0t", 0, 6); + + { + f_string_range_t range = macro_f_string_range_t_initialize(0, source.used - 1); + + const f_status_t status = f_utf_string_dynamic_seek_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_utf_dynamic_seek_to__returns_data_not_stop(void **state) { - const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "X\0\0\0", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0\n\0\0\0a\0\0\0f\0\0\0t\0\0\0e\0\0\0r\0\0\0", 0, 10); + const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0X", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t\0\0\0\n\0\0\0a\0\0\0f\0\0\0t\0\0\0e\0\0\0r", 0, 10); { f_string_range_t range = f_string_range_t_initialize; @@ -21,8 +55,8 @@ void test__f_utf_dynamic_seek_to__returns_data_not_stop(void **state) { void test__f_utf_dynamic_seek_to__returns_none_eos(void **state) { - const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "X\0\0\0", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0\n\0\0\0a\0\0\0f\0\0\0t\0\0\0e\0\0\0r\0\0\0", 0, 10); + const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0X", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t\0\0\0\n\0\0\0a\0\0\0f\0\0\0t\0\0\0e\0\0\0r", 0, 10); { f_string_range_t range = macro_f_string_range_t_initialize(0, source.used - 1); @@ -38,8 +72,8 @@ void test__f_utf_dynamic_seek_to__returns_none_eos(void **state) { void test__f_utf_dynamic_seek_to__returns_none_stop(void **state) { - const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "X\0\0\0", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0\n\0\0\0a\0\0\0f\0\0\0t\0\0\0e\0\0\0r\0\0\0", 0, 10); + const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0X", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t\0\0\0\n\0\0\0a\0\0\0f\0\0\0t\0\0\0e\0\0\0r", 0, 10); { f_string_range_t range = macro_f_string_range_t_initialize(0, source.used - 2); @@ -55,10 +89,11 @@ void test__f_utf_dynamic_seek_to__returns_none_stop(void **state) { void test__f_utf_dynamic_seek_to__works(void **state) { - const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "X\0\0\0", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\n\0\0\0X\0\0\0s\0\0\0t\0\0\0", 0, 6); + const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0X", 0, 1); + // Test where newline is before "X". { + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\n\0\0\0X\0\0\0s\0\0\0t", 0, 6); f_string_range_t range = macro_f_string_range_t_initialize(0, source.used - 1); const f_status_t status = f_utf_string_dynamic_seek_to(source, to.string[0], &range); @@ -68,12 +103,25 @@ void test__f_utf_dynamic_seek_to__works(void **state) { assert_int_equal(range.start, 3); assert_int_equal(range.stop, source.used - 1); } + + // Test where newline is after "X". + { + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0X\0\0\0\n\0\0\0s\0\0\0t", 0, 6); + f_string_range_t range = macro_f_string_range_t_initialize(0, source.used - 1); + + const f_status_t status = f_utf_string_dynamic_seek_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_utf_dynamic_seek_to__parameter_checking(void **state) { - const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "X\0\0\0", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0X\0\0\0\n\0\0\0s\0\0\0t\0\0\0", 0, 6); + const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0X", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0X\0\0\0\n\0\0\0s\0\0\0t", 0, 6); { const f_status_t status = f_utf_string_dynamic_seek_to(source, to.string[0], 0); diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamic_seek_to.h b/level_0/f_utf/tests/unit/c/test-utf-dynamic_seek_to.h index 03cc984..d970edf 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamic_seek_to.h +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamic_seek_to.h @@ -11,6 +11,20 @@ #define _TEST__F_utf_dynamic_seek_to_h /** + * Test that the function works where seek target is after a newline. + * + * @see f_utf_string_dynamic_seek_to() + */ +extern void test__f_utf_dynamic_seek_to__after_newline(void **state); + +/** + * Test that the function works where seek target is before a newline. + * + * @see f_utf_string_dynamic_seek_to() + */ +extern void test__f_utf_dynamic_seek_to__before_newline(void **state); + +/** * Test that the function returns F_data_not_stop because range is an empty range (range.start > range.stop). * * @see f_utf_string_dynamic_seek_to() @@ -32,13 +46,6 @@ extern void test__f_utf_dynamic_seek_to__returns_none_eos(void **state); extern void test__f_utf_dynamic_seek_to__returns_none_stop(void **state); /** - * Test that the function works. - * - * @see f_utf_string_dynamic_seek_to() - */ -extern void test__f_utf_dynamic_seek_to__works(void **state); - -/** * Test that the function correctly fails on invalid parameter. * * @see f_utf_string_dynamic_seek_to() diff --git a/level_0/f_utf/tests/unit/c/test-utf-dynamics_append.c b/level_0/f_utf/tests/unit/c/test-utf-dynamics_append.c index bd415da..aef1481 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-dynamics_append.c +++ b/level_0/f_utf/tests/unit/c/test-utf-dynamics_append.c @@ -7,7 +7,7 @@ extern "C" { void test__f_utf_dynamics_append__works(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t", 0, 5); f_utf_string_dynamics_t destination = f_utf_string_dynamics_t_initialize; { diff --git a/level_0/f_utf/tests/unit/c/test-utf-map_multis_append.c b/level_0/f_utf/tests/unit/c/test-utf-map_multis_append.c index 0de5838..59c1713 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-map_multis_append.c +++ b/level_0/f_utf/tests/unit/c/test-utf-map_multis_append.c @@ -16,7 +16,7 @@ void test__f_utf_map_multis_append__works(void **state) { macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0_\0\0\0v\0\0\0a\0\0\0l\0\0\0u\0\0\0e\0\0\02\0\0\0", 0, 11), }; - const f_utf_string_static_t test_name = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0_\0\0\0n\0\0\0a\0\0\0m\0\0\0e\0\0\0", 0, 9); + const f_utf_string_static_t test_name = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t\0\0\0_\0\0\0n\0\0\0a\0\0\0m\0\0\0e", 0, 9); const f_utf_string_statics_t test_value = macro_f_utf_string_statics_t_initialize(test_value_array, 0, length_values); { diff --git a/level_0/f_utf/tests/unit/c/test-utf-map_multis_append_all.c b/level_0/f_utf/tests/unit/c/test-utf-map_multis_append_all.c index 92a83d3..d9c9f29 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-map_multis_append_all.c +++ b/level_0/f_utf/tests/unit/c/test-utf-map_multis_append_all.c @@ -17,7 +17,7 @@ void test__f_utf_map_multis_append_all__works(void **state) { macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0_\0\0\0v\0\0\0a\0\0\0l\0\0\0u\0\0\0e\0\0\02\0\0\0", 0, 11), }; - const f_utf_string_static_t test_name = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0_\0\0\0n\0\0\0a\0\0\0m\0\0\0e\0\0\0", 0, 9); + const f_utf_string_static_t test_name = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t\0\0\0_\0\0\0n\0\0\0a\0\0\0m\0\0\0e", 0, 9); const f_utf_string_statics_t test_value = macro_f_utf_string_statics_t_initialize(test_value_array, 0, length_values); { diff --git a/level_0/f_utf/tests/unit/c/test-utf-maps_append.c b/level_0/f_utf/tests/unit/c/test-utf-maps_append.c index efb1437..de5ca2b 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-maps_append.c +++ b/level_0/f_utf/tests/unit/c/test-utf-maps_append.c @@ -10,8 +10,8 @@ void test__f_utf_maps_append__works(void **state) { f_utf_string_map_t source = f_utf_string_map_t_initialize; f_utf_string_maps_t destination = f_utf_string_maps_t_initialize; - const f_utf_string_static_t test_name = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0_\0\0\0n\0\0\0a\0\0\0m\0\0\0e\0\0\0", 0, 9); - const f_utf_string_static_t test_value = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0_\0\0\0v\0\0\0a\0\0\0l\0\0\0u\0\0\0e\0\0\0", 0, 10); + const f_utf_string_static_t test_name = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t\0\0\0_\0\0\0n\0\0\0a\0\0\0m\0\0\0e", 0, 9); + const f_utf_string_static_t test_value = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t\0\0\0_\0\0\0v\0\0\0a\0\0\0l\0\0\0u\0\0\0e", 0, 10); { f_status_t status = f_utf_string_dynamic_append(test_name, &source.name); diff --git a/level_0/f_utf/tests/unit/c/test-utf-maps_append_all.c b/level_0/f_utf/tests/unit/c/test-utf-maps_append_all.c index 4d7e9a6..c168c59 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-maps_append_all.c +++ b/level_0/f_utf/tests/unit/c/test-utf-maps_append_all.c @@ -12,8 +12,8 @@ void test__f_utf_maps_append_all__works(void **state) { f_utf_string_maps_t source = f_utf_string_maps_t_initialize; f_utf_string_maps_t destination = f_utf_string_maps_t_initialize; - const f_utf_string_static_t test_name = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0_\0\0\0n\0\0\0a\0\0\0m\0\0\0e\0\0\0", 0, 9); - const f_utf_string_static_t test_value = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0_\0\0\0v\0\0\0a\0\0\0l\0\0\0u\0\0\0e\0\0\0", 0, 10); + const f_utf_string_static_t test_name = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t\0\0\0_\0\0\0n\0\0\0a\0\0\0m\0\0\0e", 0, 9); + const f_utf_string_static_t test_value = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t\0\0\0_\0\0\0v\0\0\0a\0\0\0l\0\0\0u\0\0\0e", 0, 10); { f_status_t status = f_utf_string_maps_resize(length_inner, &source); diff --git a/level_0/f_utf/tests/unit/c/test-utf-mash.c b/level_0/f_utf/tests/unit/c/test-utf-mash.c index b82af6d..dd0c126 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-mash.c +++ b/level_0/f_utf/tests/unit/c/test-utf-mash.c @@ -7,9 +7,9 @@ extern "C" { void test__f_utf_mash__works(void **state) { - const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) ":\0\0\0", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); - const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0:\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 11); + const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0:", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t", 0, 5); + const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0:\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t", 0, 11); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { @@ -40,8 +40,8 @@ void test__f_utf_mash__works(void **state) { void test__f_utf_mash__parameter_checking(void **state) { - const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) ":\0\0\0", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); + const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0:", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t", 0, 5); { const f_status_t status = f_utf_string_mash(glue.string, glue.used, source.string, source.used, 0); diff --git a/level_0/f_utf/tests/unit/c/test-utf-mash_nulless.c b/level_0/f_utf/tests/unit/c/test-utf-mash_nulless.c index a2bfee5..7ccf8a6 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-mash_nulless.c +++ b/level_0/f_utf/tests/unit/c/test-utf-mash_nulless.c @@ -7,10 +7,10 @@ extern "C" { void test__f_utf_mash_nulless__works(void **state) { - const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) ":\0\0\0", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); - const f_utf_string_static_t expected1 = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 4); - const f_utf_string_static_t expected2 = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0:\0\0\0t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 9); + const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0:", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t", 0, 5); + const f_utf_string_static_t expected1 = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t", 0, 4); + const f_utf_string_static_t expected2 = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t\0\0\0:\0\0\0t\0\0\0e\0\0\0s\0\0\0t", 0, 9); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { @@ -41,8 +41,8 @@ void test__f_utf_mash_nulless__works(void **state) { void test__f_utf_mash_nulless__parameter_checking(void **state) { - const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) ":\0\0\0", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); + const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0:", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t", 0, 5); { const f_status_t status = f_utf_string_mash_nulless(glue.string, glue.used, source.string, source.used, 0); diff --git a/level_0/f_utf/tests/unit/c/test-utf-mish.c b/level_0/f_utf/tests/unit/c/test-utf-mish.c index d8b79b3..4bd977a 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-mish.c +++ b/level_0/f_utf/tests/unit/c/test-utf-mish.c @@ -7,9 +7,9 @@ extern "C" { void test__f_utf_mish__works(void **state) { - const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) ":\0\0\0", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); - const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0:\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 11); + const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0:", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t", 0, 5); + const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0:\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t", 0, 11); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { @@ -40,8 +40,8 @@ void test__f_utf_mish__works(void **state) { void test__f_utf_mish__parameter_checking(void **state) { - const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) ":\0\0\0", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); + const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0:", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t", 0, 5); { const f_status_t status = f_utf_string_mish(glue.string, glue.used, source.string, source.used, 0); diff --git a/level_0/f_utf/tests/unit/c/test-utf-mish_nulless.c b/level_0/f_utf/tests/unit/c/test-utf-mish_nulless.c index 7e7377a..d8701a5 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-mish_nulless.c +++ b/level_0/f_utf/tests/unit/c/test-utf-mish_nulless.c @@ -7,10 +7,10 @@ extern "C" { void test__f_utf_mish_nulless__works(void **state) { - const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) ":\0\0\0", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); - const f_utf_string_static_t expected1 = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 4); - const f_utf_string_static_t expected2 = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0:\0\0\0t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 9); + const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0:", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t", 0, 5); + const f_utf_string_static_t expected1 = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t", 0, 4); + const f_utf_string_static_t expected2 = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t\0\0\0:\0\0\0t\0\0\0e\0\0\0s\0\0\0t", 0, 9); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { @@ -41,8 +41,8 @@ void test__f_utf_mish_nulless__works(void **state) { void test__f_utf_mish_nulless__parameter_checking(void **state) { - const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) ":\0\0\0", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); + const f_utf_string_static_t glue = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0:", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t", 0, 5); { const f_status_t status = f_utf_string_mish_nulless(glue.string, glue.used, source.string, source.used, 0); diff --git a/level_0/f_utf/tests/unit/c/test-utf-prepend.c b/level_0/f_utf/tests/unit/c/test-utf-prepend.c index 0ae815b..30670fb 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-prepend.c +++ b/level_0/f_utf/tests/unit/c/test-utf-prepend.c @@ -7,7 +7,7 @@ extern "C" { void test__f_utf_prepend__works(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t", 0, 5); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { diff --git a/level_0/f_utf/tests/unit/c/test-utf-prepend_assure.c b/level_0/f_utf/tests/unit/c/test-utf-prepend_assure.c index a254a12..2b950be 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-prepend_assure.c +++ b/level_0/f_utf/tests/unit/c/test-utf-prepend_assure.c @@ -7,7 +7,7 @@ extern "C" { void test__f_utf_prepend_assure__works(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t", 0, 5); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { diff --git a/level_0/f_utf/tests/unit/c/test-utf-prepend_assure_nulless.c b/level_0/f_utf/tests/unit/c/test-utf-prepend_assure_nulless.c index b6cc3b1..4bae657 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-prepend_assure_nulless.c +++ b/level_0/f_utf/tests/unit/c/test-utf-prepend_assure_nulless.c @@ -7,8 +7,8 @@ extern "C" { void test__f_utf_prepend_assure_nulless__works(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); - const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 4); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t", 0, 5); + const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t", 0, 4); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { diff --git a/level_0/f_utf/tests/unit/c/test-utf-prepend_nulless.c b/level_0/f_utf/tests/unit/c/test-utf-prepend_nulless.c index 4b77225..67af198 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-prepend_nulless.c +++ b/level_0/f_utf/tests/unit/c/test-utf-prepend_nulless.c @@ -7,8 +7,8 @@ extern "C" { void test__f_utf_prepend_nulless__works(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t\0\0\0", 0, 5); - const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 4); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\0\0\0\0s\0\0\0t", 0, 5); + const f_utf_string_static_t expected = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t", 0, 4); f_utf_string_dynamic_t destination = f_utf_string_dynamic_t_initialize; { diff --git a/level_0/f_utf/tests/unit/c/test-utf-seek_line.c b/level_0/f_utf/tests/unit/c/test-utf-seek_line.c index 216c2c7..762ab3f 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-seek_line.c +++ b/level_0/f_utf/tests/unit/c/test-utf-seek_line.c @@ -7,7 +7,7 @@ extern "C" { void test__f_utf_seek_line__returns_data_not_stop(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0\n\0\0\0a\0\0\0f\0\0\0t\0\0\0e\0\0\0r\0\0\0", 0, 10); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t\0\0\0\n\0\0\0a\0\0\0f\0\0\0t\0\0\0e\0\0\0r", 0, 10); { f_string_range_t range = f_string_range_t_initialize; @@ -20,7 +20,7 @@ void test__f_utf_seek_line__returns_data_not_stop(void **state) { void test__f_utf_seek_line__returns_none_stop(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 4); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t", 0, 4); { f_string_range_t range = macro_f_string_range_t_initialize(0, source.used - 1); @@ -36,7 +36,7 @@ void test__f_utf_seek_line__returns_none_stop(void **state) { void test__f_utf_seek_line__works(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0\n\0\0\0a\0\0\0f\0\0\0t\0\0\0e\0\0\0r\0\0\0", 0, 10); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t\0\0\0\n\0\0\0a\0\0\0f\0\0\0t\0\0\0e\0\0\0r", 0, 10); { f_string_range_t range = macro_f_string_range_t_initialize(0, source.used - 1); @@ -52,7 +52,7 @@ void test__f_utf_seek_line__works(void **state) { void test__f_utf_seek_line__parameter_checking(void **state) { - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0X\0\0\0\n\0\0\0s\0\0\0t\0\0\0", 0, 6); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0X\0\0\0\n\0\0\0s\0\0\0t", 0, 6); { const f_status_t status = f_utf_string_seek_line(source.string, 0); diff --git a/level_0/f_utf/tests/unit/c/test-utf-seek_line_to.c b/level_0/f_utf/tests/unit/c/test-utf-seek_line_to.c index 27eb516..e14dde6 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-seek_line_to.c +++ b/level_0/f_utf/tests/unit/c/test-utf-seek_line_to.c @@ -5,10 +5,10 @@ extern "C" { #endif -void test__f_utf_seek_line_to__at_newline(void **state) { +void test__f_utf_seek_line_to__after_newline(void **state) { - const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "X\0\0\0", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\n\0\0\0X\0\0\0s\0\0\0t\0\0\0", 0, 6); + const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0X", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\n\0\0\0X\0\0\0s\0\0\0t", 0, 6); { f_string_range_t range = macro_f_string_range_t_initialize(0, source.used - 1); @@ -22,58 +22,58 @@ void test__f_utf_seek_line_to__at_newline(void **state) { } } -void test__f_utf_seek_line_to__returns_data_not_stop(void **state) { +void test__f_utf_seek_line_to__before_newline(void **state) { - const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "X\0\0\0", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0\n\0\0\0a\0\0\0f\0\0\0t\0\0\0e\0\0\0r\0\0\0", 0, 10); + const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0X", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0X\0\0\0\n\0\0\0s\0\0\0t", 0, 6); { - f_string_range_t range = f_string_range_t_initialize; + f_string_range_t range = macro_f_string_range_t_initialize(0, source.used - 1); const f_status_t status = f_utf_string_seek_line_to(source.string, to.string[0], &range); - assert_int_equal(status, F_data_not_stop); + assert_int_equal(status, F_none); + + assert_int_equal(range.start, 2); + assert_int_equal(range.stop, source.used - 1); } } -void test__f_utf_seek_line_to__returns_none_stop(void **state) { +void test__f_utf_seek_line_to__returns_data_not_stop(void **state) { - const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "X\0\0\0", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0", 0, 4); + const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0X", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t\0\0\0\n\0\0\0a\0\0\0f\0\0\0t\0\0\0e\0\0\0r", 0, 10); { - f_string_range_t range = macro_f_string_range_t_initialize(0, source.used - 1); + f_string_range_t range = f_string_range_t_initialize; const f_status_t status = f_utf_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); + assert_int_equal(status, F_data_not_stop); } } -void test__f_utf_seek_line_to__works(void **state) { +void test__f_utf_seek_line_to__returns_none_stop(void **state) { - const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "X\0\0\0", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0X\0\0\0\n\0\0\0s\0\0\0t\0\0\0", 0, 6); + const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0X", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t", 0, 4); { f_string_range_t range = macro_f_string_range_t_initialize(0, source.used - 1); const f_status_t status = f_utf_string_seek_line_to(source.string, to.string[0], &range); - assert_int_equal(status, F_none); + assert_int_equal(status, F_none_stop); - assert_int_equal(range.start, 2); + assert_int_equal(range.start, source.used); assert_int_equal(range.stop, source.used - 1); } } void test__f_utf_seek_line_to__parameter_checking(void **state) { - const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "X\0\0\0", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0X\0\0\0\n\0\0\0s\0\0\0t\0\0\0", 0, 6); + const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0X", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0X\0\0\0\n\0\0\0s\0\0\0t", 0, 6); { const f_status_t status = f_utf_string_seek_line_to(source.string, to.string[0], 0); diff --git a/level_0/f_utf/tests/unit/c/test-utf-seek_line_to.h b/level_0/f_utf/tests/unit/c/test-utf-seek_line_to.h index 4b79e9d..4ec3560 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-seek_line_to.h +++ b/level_0/f_utf/tests/unit/c/test-utf-seek_line_to.h @@ -11,32 +11,32 @@ #define _TEST__F_utf_seek_line_to_h /** - * Test that the function works but stops at newline rather than search string. + * Test that the function works where seek target is after a newline. * * @see f_utf_string_seek_line_to() */ -extern void test__f_utf_seek_line_to__at_newline(void **state); +extern void test__f_utf_seek_line_to__after_newline(void **state); /** - * Test that the function returns F_data_not_stop because range is an empty range (range.start > range.stop). + * Test that the function works where seek target is before a newline. * * @see f_utf_string_seek_line_to() */ -extern void test__f_utf_seek_line_to__returns_data_not_stop(void **state); +extern void test__f_utf_seek_line_to__before_newline(void **state); /** - * Test that the function returns F_none_stop stopped after end of range because no newline is found. + * Test that the function returns F_data_not_stop because range is an empty range (range.start > range.stop). * * @see f_utf_string_seek_line_to() */ -extern void test__f_utf_seek_line_to__returns_none_stop(void **state); +extern void test__f_utf_seek_line_to__returns_data_not_stop(void **state); /** - * Test that the function works. + * Test that the function returns F_none_stop stopped after end of range because no newline is found. * * @see f_utf_string_seek_line_to() */ -extern void test__f_utf_seek_line_to__works(void **state); +extern void test__f_utf_seek_line_to__returns_none_stop(void **state); /** * Test that the function correctly fails on invalid parameter. diff --git a/level_0/f_utf/tests/unit/c/test-utf-seek_to.c b/level_0/f_utf/tests/unit/c/test-utf-seek_to.c index 8a6f740..50fbab4 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-seek_to.c +++ b/level_0/f_utf/tests/unit/c/test-utf-seek_to.c @@ -5,58 +5,75 @@ extern "C" { #endif -void test__f_utf_seek_to__returns_data_not_stop(void **state) { +void test__f_utf_seek_to__after_newline(void **state) { - const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "X\0\0\0", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0\n\0\0\0a\0\0\0f\0\0\0t\0\0\0e\0\0\0r\0\0\0", 0, 10); + const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0X", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\n\0\0\0X\0\0\0s\0\0\0t", 0, 6); { - f_string_range_t range = f_string_range_t_initialize; + f_string_range_t range = macro_f_string_range_t_initialize(0, source.used - 1); const f_status_t status = f_utf_string_seek_to(source.string, to.string[0], &range); - assert_int_equal(status, F_data_not_stop); + assert_int_equal(status, F_none); + + assert_int_equal(range.start, 3); + assert_int_equal(range.stop, source.used - 1); } } -void test__f_utf_seek_to__returns_none_stop(void **state) { +void test__f_utf_seek_to__before_newline(void **state) { - const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "X\0\0\0", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0s\0\0\0t\0\0\0\n\0\0\0a\0\0\0f\0\0\0t\0\0\0e\0\0\0r\0\0\0", 0, 10); + const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0X", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0X\0\0\0\n\0\0\0s\0\0\0t", 0, 6); { f_string_range_t range = macro_f_string_range_t_initialize(0, source.used - 1); const f_status_t status = f_utf_string_seek_to(source.string, to.string[0], &range); - assert_int_equal(status, F_none_stop); + assert_int_equal(status, F_none); - assert_int_equal(range.start, source.used); + assert_int_equal(range.start, 2); assert_int_equal(range.stop, source.used - 1); } } -void test__f_utf_seek_to__works(void **state) { +void test__f_utf_seek_to__returns_data_not_stop(void **state) { - const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "X\0\0\0", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0\n\0\0\0X\0\0\0s\0\0\0t\0\0\0", 0, 6); + const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0X", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t\0\0\0\n\0\0\0a\0\0\0f\0\0\0t\0\0\0e\0\0\0r", 0, 10); + + { + f_string_range_t range = f_string_range_t_initialize; + + const f_status_t status = f_utf_string_seek_to(source.string, to.string[0], &range); + + assert_int_equal(status, F_data_not_stop); + } +} + +void test__f_utf_seek_to__returns_none_stop(void **state) { + + const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0X", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t\0\0\0\n\0\0\0a\0\0\0f\0\0\0t\0\0\0e\0\0\0r", 0, 10); { f_string_range_t range = macro_f_string_range_t_initialize(0, source.used - 1); const f_status_t status = f_utf_string_seek_to(source.string, to.string[0], &range); - assert_int_equal(status, F_none); + assert_int_equal(status, F_none_stop); - assert_int_equal(range.start, 3); + assert_int_equal(range.start, source.used); assert_int_equal(range.stop, source.used - 1); } } void test__f_utf_seek_to__parameter_checking(void **state) { - const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "X\0\0\0", 0, 1); - const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "t\0\0\0e\0\0\0X\0\0\0\n\0\0\0s\0\0\0t\0\0\0", 0, 6); + const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0X", 0, 1); + const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0X\0\0\0\n\0\0\0s\0\0\0t", 0, 6); { const f_status_t status = f_utf_string_seek_to(source.string, to.string[0], 0); diff --git a/level_0/f_utf/tests/unit/c/test-utf-seek_to.h b/level_0/f_utf/tests/unit/c/test-utf-seek_to.h index 8678955..993aee7 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-seek_to.h +++ b/level_0/f_utf/tests/unit/c/test-utf-seek_to.h @@ -11,25 +11,32 @@ #define _TEST__F_utf_seek_to_h /** - * Test that the function returns F_data_not_stop because range is an empty range (range.start > range.stop). + * Test that the function works where seek target is after a newline. * * @see f_utf_string_seek_to() */ -extern void test__f_utf_seek_to__returns_data_not_stop(void **state); +extern void test__f_utf_seek_to__after_newline(void **state); /** - * Test that the function returns F_none_stop stopped after end of range because no newline is found. + * Test that the function works where seek target is before a newline. * * @see f_utf_string_seek_to() */ -extern void test__f_utf_seek_to__returns_none_stop(void **state); +extern void test__f_utf_seek_to__before_newline(void **state); /** - * Test that the function works. + * Test that the function returns F_data_not_stop because range is an empty range (range.start > range.stop). * * @see f_utf_string_seek_to() */ -extern void test__f_utf_seek_to__works(void **state); +extern void test__f_utf_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_utf_string_seek_to() + */ +extern void test__f_utf_seek_to__returns_none_stop(void **state); /** * Test that the function correctly fails on invalid parameter. diff --git a/level_0/f_utf/tests/unit/c/test-utf-triples_append.c b/level_0/f_utf/tests/unit/c/test-utf-triples_append.c index 3a03f41..ead9e96 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-triples_append.c +++ b/level_0/f_utf/tests/unit/c/test-utf-triples_append.c @@ -7,9 +7,9 @@ extern "C" { void test__f_utf_triples_append__works(void **state) { - const f_utf_string_static_t test_a = macro_f_utf_string_static_t_initialize((f_utf_string_t) "a\0\0\0", 0, 1); - const f_utf_string_static_t test_b = macro_f_utf_string_static_t_initialize((f_utf_string_t) "b\0\0\0", 0, 1); - const f_utf_string_static_t test_c = macro_f_utf_string_static_t_initialize((f_utf_string_t) "c\0\0\0", 0, 1); + const f_utf_string_static_t test_a = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0a", 0, 1); + const f_utf_string_static_t test_b = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0b", 0, 1); + const f_utf_string_static_t test_c = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0c", 0, 1); const f_utf_string_triple_t source = macro_f_utf_string_triple_t_initialize(test_a, test_b, test_c); f_utf_string_triples_t destination = f_utf_string_triples_t_initialize; diff --git a/level_0/f_utf/tests/unit/c/test-utf-triples_append_all.c b/level_0/f_utf/tests/unit/c/test-utf-triples_append_all.c index 4bf351a..663e240 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-triples_append_all.c +++ b/level_0/f_utf/tests/unit/c/test-utf-triples_append_all.c @@ -9,13 +9,13 @@ void test__f_utf_triples_append_all__works(void **state) { const int length_sources = 2; - const f_utf_string_static_t test_a = macro_f_utf_string_static_t_initialize((f_utf_string_t) "a\0\0\0", 0, 1); - const f_utf_string_static_t test_b = macro_f_utf_string_static_t_initialize((f_utf_string_t) "b\0\0\0", 0, 1); - const f_utf_string_static_t test_c = macro_f_utf_string_static_t_initialize((f_utf_string_t) "c\0\0\0", 0, 1); + const f_utf_string_static_t test_a = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0a", 0, 1); + const f_utf_string_static_t test_b = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0b", 0, 1); + const f_utf_string_static_t test_c = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0c", 0, 1); - const f_utf_string_static_t test_d = macro_f_utf_string_static_t_initialize((f_utf_string_t) "d\0\0\0", 0, 1); - const f_utf_string_static_t test_e = macro_f_utf_string_static_t_initialize((f_utf_string_t) "e\0\0\0", 0, 1); - const f_utf_string_static_t test_f = macro_f_utf_string_static_t_initialize((f_utf_string_t) "f\0\0\0", 0, 1); + const f_utf_string_static_t test_d = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0d", 0, 1); + const f_utf_string_static_t test_e = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0e", 0, 1); + const f_utf_string_static_t test_f = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0f", 0, 1); f_utf_string_triple_t sources_array[] = { macro_f_utf_string_triple_t_initialize(test_a, test_b, test_c), diff --git a/level_0/f_utf/tests/unit/c/test-utf-tripless_append.c b/level_0/f_utf/tests/unit/c/test-utf-tripless_append.c index 8f273aa..92ebbf1 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-tripless_append.c +++ b/level_0/f_utf/tests/unit/c/test-utf-tripless_append.c @@ -9,13 +9,13 @@ void test__f_utf_tripless_append__works(void **state) { const int length_sources = 2; - const f_utf_string_static_t test_a = macro_f_utf_string_static_t_initialize((f_utf_string_t) "a\0\0\0", 0, 1); - const f_utf_string_static_t test_b = macro_f_utf_string_static_t_initialize((f_utf_string_t) "b\0\0\0", 0, 1); - const f_utf_string_static_t test_c = macro_f_utf_string_static_t_initialize((f_utf_string_t) "c\0\0\0", 0, 1); + const f_utf_string_static_t test_a = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0a", 0, 1); + const f_utf_string_static_t test_b = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0b", 0, 1); + const f_utf_string_static_t test_c = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0c", 0, 1); - const f_utf_string_static_t test_d = macro_f_utf_string_static_t_initialize((f_utf_string_t) "d\0\0\0", 0, 1); - const f_utf_string_static_t test_e = macro_f_utf_string_static_t_initialize((f_utf_string_t) "e\0\0\0", 0, 1); - const f_utf_string_static_t test_f = macro_f_utf_string_static_t_initialize((f_utf_string_t) "f\0\0\0", 0, 1); + const f_utf_string_static_t test_d = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0d", 0, 1); + const f_utf_string_static_t test_e = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0e", 0, 1); + const f_utf_string_static_t test_f = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0f", 0, 1); f_utf_string_triple_t sources_array[] = { macro_f_utf_string_triple_t_initialize(test_a, test_b, test_c), diff --git a/level_0/f_utf/tests/unit/c/test-utf-tripless_append_all.c b/level_0/f_utf/tests/unit/c/test-utf-tripless_append_all.c index e7d3535..8d8cb24 100644 --- a/level_0/f_utf/tests/unit/c/test-utf-tripless_append_all.c +++ b/level_0/f_utf/tests/unit/c/test-utf-tripless_append_all.c @@ -10,21 +10,21 @@ void test__f_utf_tripless_append_all__works(void **state) { const int length_sources = 2; const int length_sources_set = 2; - const f_utf_string_static_t test_a = macro_f_utf_string_static_t_initialize((f_utf_string_t) "a\0\0\0", 0, 1); - const f_utf_string_static_t test_b = macro_f_utf_string_static_t_initialize((f_utf_string_t) "b\0\0\0", 0, 1); - const f_utf_string_static_t test_c = macro_f_utf_string_static_t_initialize((f_utf_string_t) "c\0\0\0", 0, 1); + const f_utf_string_static_t test_a = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0a", 0, 1); + const f_utf_string_static_t test_b = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0b", 0, 1); + const f_utf_string_static_t test_c = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0c", 0, 1); - const f_utf_string_static_t test_d = macro_f_utf_string_static_t_initialize((f_utf_string_t) "d\0\0\0", 0, 1); - const f_utf_string_static_t test_e = macro_f_utf_string_static_t_initialize((f_utf_string_t) "e\0\0\0", 0, 1); - const f_utf_string_static_t test_f = macro_f_utf_string_static_t_initialize((f_utf_string_t) "f\0\0\0", 0, 1); + const f_utf_string_static_t test_d = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0d", 0, 1); + const f_utf_string_static_t test_e = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0e", 0, 1); + const f_utf_string_static_t test_f = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0f", 0, 1); - const f_utf_string_static_t test_g = macro_f_utf_string_static_t_initialize((f_utf_string_t) "g\0\0\0", 0, 1); - const f_utf_string_static_t test_h = macro_f_utf_string_static_t_initialize((f_utf_string_t) "h\0\0\0", 0, 1); - const f_utf_string_static_t test_i = macro_f_utf_string_static_t_initialize((f_utf_string_t) "i\0\0\0", 0, 1); + const f_utf_string_static_t test_g = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0g", 0, 1); + const f_utf_string_static_t test_h = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0h", 0, 1); + const f_utf_string_static_t test_i = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0i", 0, 1); - const f_utf_string_static_t test_j = macro_f_utf_string_static_t_initialize((f_utf_string_t) "j\0\0\0", 0, 1); - const f_utf_string_static_t test_k = macro_f_utf_string_static_t_initialize((f_utf_string_t) "k\0\0\0", 0, 1); - const f_utf_string_static_t test_l = macro_f_utf_string_static_t_initialize((f_utf_string_t) "l\0\0\0", 0, 1); + const f_utf_string_static_t test_j = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0j", 0, 1); + const f_utf_string_static_t test_k = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0k", 0, 1); + const f_utf_string_static_t test_l = macro_f_utf_string_static_t_initialize((f_utf_string_t) "\0\0\0l", 0, 1); f_utf_string_triple_t sources_array1[] = { macro_f_utf_string_triple_t_initialize(test_a, test_b, test_c), diff --git a/level_0/f_utf/tests/unit/c/test-utf.c b/level_0/f_utf/tests/unit/c/test-utf.c index 54ff2fb..8461825 100644 --- a/level_0/f_utf/tests/unit/c/test-utf.c +++ b/level_0/f_utf/tests/unit/c/test-utf.c @@ -71,16 +71,17 @@ int main(void) { cmocka_unit_test(test__f_utf_dynamic_seek_line__returns_none_stop), cmocka_unit_test(test__f_utf_dynamic_seek_line__works), - cmocka_unit_test(test__f_utf_dynamic_seek_line_to__at_newline), + cmocka_unit_test(test__f_utf_dynamic_seek_line_to__after_newline), + cmocka_unit_test(test__f_utf_dynamic_seek_line_to__before_newline), cmocka_unit_test(test__f_utf_dynamic_seek_line_to__returns_data_not_stop), cmocka_unit_test(test__f_utf_dynamic_seek_line_to__returns_none_eos), cmocka_unit_test(test__f_utf_dynamic_seek_line_to__returns_none_stop), - cmocka_unit_test(test__f_utf_dynamic_seek_line_to__works), + cmocka_unit_test(test__f_utf_dynamic_seek_to__after_newline), + cmocka_unit_test(test__f_utf_dynamic_seek_to__before_newline), cmocka_unit_test(test__f_utf_dynamic_seek_to__returns_data_not_stop), cmocka_unit_test(test__f_utf_dynamic_seek_to__returns_none_eos), cmocka_unit_test(test__f_utf_dynamic_seek_to__returns_none_stop), - cmocka_unit_test(test__f_utf_dynamic_seek_to__works), cmocka_unit_test(test__f_utf_dynamic_terminate__appends_null), cmocka_unit_test(test__f_utf_dynamic_terminate__doesnt_append_null), @@ -195,14 +196,15 @@ int main(void) { cmocka_unit_test(test__f_utf_seek_line__returns_none_stop), cmocka_unit_test(test__f_utf_seek_line__works), - cmocka_unit_test(test__f_utf_seek_line_to__at_newline), + cmocka_unit_test(test__f_utf_seek_line_to__after_newline), + cmocka_unit_test(test__f_utf_seek_line_to__before_newline), cmocka_unit_test(test__f_utf_seek_line_to__returns_data_not_stop), cmocka_unit_test(test__f_utf_seek_line_to__returns_none_stop), - cmocka_unit_test(test__f_utf_seek_line_to__works), + cmocka_unit_test(test__f_utf_seek_to__after_newline), + cmocka_unit_test(test__f_utf_seek_to__before_newline), cmocka_unit_test(test__f_utf_seek_to__returns_data_not_stop), cmocka_unit_test(test__f_utf_seek_to__returns_none_stop), - cmocka_unit_test(test__f_utf_seek_to__works), #ifndef _di_level_0_parameter_checking_ cmocka_unit_test(test__f_utf_append__parameter_checking), diff --git a/level_1/fl_utf/c/utf.c b/level_1/fl_utf/c/utf.c index 2a2c5fd..adac0cd 100644 --- a/level_1/fl_utf/c/utf.c +++ b/level_1/fl_utf/c/utf.c @@ -114,7 +114,7 @@ extern "C" { while (buffer.string[range->start] != seek_to_character) { - if (buffer.string[range->start++] == F_utf_char_t_eol_d) { + if (buffer.string[range->start++] == f_utf_char_t_eol_s) { return F_none_eol; } @@ -162,7 +162,7 @@ extern "C" { return status; } - if (buffer.string[range->start++] == F_utf_char_t_eol_d) { + if (buffer.string[range->start++] == f_utf_char_t_eol_s) { return F_none_eol; } @@ -206,7 +206,7 @@ extern "C" { while (buffer.string[range->start] == placeholder || (status = f_utf_character_is_whitespace(buffer.string[range->start])) == F_false) { if (F_status_is_error(status)) return status; - if (buffer.string[range->start] == F_utf_char_t_eol_d) return F_none_eol; + if (buffer.string[range->start] == f_utf_char_t_eol_s) return F_none_eol; ++range->start; @@ -338,7 +338,7 @@ extern "C" { return F_status_set_error(F_utf); } - if (string[range->start] == F_utf_char_t_eol_d) { + if (string[range->start] == f_utf_char_t_eol_s) { return F_none_eol; } @@ -373,7 +373,7 @@ extern "C" { return status; } - if (string[range->start++] == F_utf_char_t_eol_d) { + if (string[range->start++] == f_utf_char_t_eol_s) { return F_none_eol; } @@ -416,7 +416,7 @@ extern "C" { return status; } - if (string[range->start++] == F_utf_char_t_eol_d) { + if (string[range->start++] == f_utf_char_t_eol_s) { return F_none_eol; }