From: Kevin Day Date: Sun, 27 Aug 2023 22:11:39 +0000 (-0500) Subject: Update: Fix some overlooked unit tests following wrap up of re-designing the memory... X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=320bb66bdc132042c3918d056bb89b2119ce9483;p=fll Update: Fix some overlooked unit tests following wrap up of re-designing the memory logic. I forgot to run all tests and overlooked updating these. --- diff --git a/level_0/f_compare/tests/unit/c/test-compare-utf.c b/level_0/f_compare/tests/unit/c/test-compare-utf.c index ad64908..dc8b7f9 100644 --- a/level_0/f_compare/tests/unit/c/test-compare-utf.c +++ b/level_0/f_compare/tests/unit/c/test-compare-utf.c @@ -276,8 +276,8 @@ void test__f_compare_utf__works(void **state) { assert_int_equal(status, expects[i]); } // for - f_utf_string_dynamic_resize(0, &utf_string_1); - f_utf_string_dynamic_resize(0, &utf_string_2); + free((void *) utf_string_1.string); + free((void *) utf_string_2.string); } #ifdef __cplusplus diff --git a/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic.c b/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic.c index 936cfb7..2da9c21 100644 --- a/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic.c +++ b/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic.c @@ -276,8 +276,8 @@ void test__f_compare_utf_dynamic__works(void **state) { assert_int_equal(status, expects[i]); } // for - f_utf_string_dynamic_resize(0, &utf_string_1); - f_utf_string_dynamic_resize(0, &utf_string_2); + free((void *) utf_string_1.string); + free((void *) utf_string_2.string); } #ifdef __cplusplus diff --git a/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_except.c b/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_except.c index 41dd391..8a6e30c 100644 --- a/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_except.c +++ b/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_except.c @@ -299,8 +299,8 @@ void test__f_compare_utf_dynamic_except__works(void **state) { assert_int_equal(status, expects[i]); } // for - f_utf_string_dynamic_resize(0, &utf_string_1); - f_utf_string_dynamic_resize(0, &utf_string_2); + free((void *) utf_string_1.string); + free((void *) utf_string_2.string); } #ifdef __cplusplus diff --git a/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_except_string.c b/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_except_string.c index 956ce9f..6aa77c8 100644 --- a/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_except_string.c +++ b/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_except_string.c @@ -299,8 +299,8 @@ void test__f_compare_utf_dynamic_except_string__works(void **state) { assert_int_equal(status, expects[i]); } // for - f_utf_string_dynamic_resize(0, &utf_string_1); - f_utf_string_dynamic_resize(0, &utf_string_2); + free((void *) utf_string_1.string); + free((void *) utf_string_2.string); } #ifdef __cplusplus diff --git a/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_except_trim.c b/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_except_trim.c index ce95d43..cb3a630 100644 --- a/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_except_trim.c +++ b/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_except_trim.c @@ -312,8 +312,8 @@ void test__f_compare_utf_dynamic_except_trim__works(void **state) { assert_int_equal(status, expects[i]); } // for - f_utf_string_dynamic_resize(0, &utf_string_1); - f_utf_string_dynamic_resize(0, &utf_string_2); + free((void *) utf_string_1.string); + free((void *) utf_string_2.string); } #ifdef __cplusplus diff --git a/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_except_trim_string.c b/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_except_trim_string.c index 377e80f..39f4a4f 100644 --- a/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_except_trim_string.c +++ b/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_except_trim_string.c @@ -312,8 +312,8 @@ void test__f_compare_utf_dynamic_except_trim_string__works(void **state) { assert_int_equal(status, expects[i]); } // for - f_utf_string_dynamic_resize(0, &utf_string_1); - f_utf_string_dynamic_resize(0, &utf_string_2); + free((void *) utf_string_1.string); + free((void *) utf_string_2.string); } #ifdef __cplusplus diff --git a/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_partial.c b/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_partial.c index 362d46e..3d00387 100644 --- a/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_partial.c +++ b/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_partial.c @@ -314,8 +314,8 @@ void test__f_compare_utf_dynamic_partial__works(void **state) { assert_int_equal(status, expects[i]); } // for - f_utf_string_dynamic_resize(0, &utf_string_1); - f_utf_string_dynamic_resize(0, &utf_string_2); + free((void *) utf_string_1.string); + free((void *) utf_string_2.string); } #ifdef __cplusplus diff --git a/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_partial_dynamic.c b/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_partial_dynamic.c index 3e1f099..8386309 100644 --- a/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_partial_dynamic.c +++ b/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_partial_dynamic.c @@ -311,8 +311,8 @@ void test__f_compare_utf_dynamic_partial_dynamic__works(void **state) { assert_int_equal(status, expects[i]); } // for - f_utf_string_dynamic_resize(0, &utf_string_1); - f_utf_string_dynamic_resize(0, &utf_string_2); + free((void *) utf_string_1.string); + free((void *) utf_string_2.string); } #ifdef __cplusplus diff --git a/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_partial_except.c b/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_partial_except.c index 6608aeb..e8a7ae4 100644 --- a/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_partial_except.c +++ b/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_partial_except.c @@ -319,8 +319,8 @@ void test__f_compare_utf_dynamic_partial_except__works(void **state) { assert_int_equal(status, expects[i]); } // for - f_utf_string_dynamic_resize(0, &utf_string_1); - f_utf_string_dynamic_resize(0, &utf_string_2); + free((void *) utf_string_1.string); + free((void *) utf_string_2.string); } #ifdef __cplusplus diff --git a/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_partial_except_dynamic.c b/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_partial_except_dynamic.c index dc0d053..9ee8c58 100644 --- a/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_partial_except_dynamic.c +++ b/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_partial_except_dynamic.c @@ -316,8 +316,8 @@ void test__f_compare_utf_dynamic_partial_except_dynamic__works(void **state) { assert_int_equal(status, expects[i]); } // for - f_utf_string_dynamic_resize(0, &utf_string_1); - f_utf_string_dynamic_resize(0, &utf_string_2); + free((void *) utf_string_1.string); + free((void *) utf_string_2.string); } #ifdef __cplusplus diff --git a/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_partial_except_string.c b/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_partial_except_string.c index 08adac5..494e131 100644 --- a/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_partial_except_string.c +++ b/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_partial_except_string.c @@ -319,8 +319,8 @@ void test__f_compare_utf_dynamic_partial_except_string__works(void **state) { assert_int_equal(status, expects[i]); } // for - f_utf_string_dynamic_resize(0, &utf_string_1); - f_utf_string_dynamic_resize(0, &utf_string_2); + free((void *) utf_string_1.string); + free((void *) utf_string_2.string); } #ifdef __cplusplus diff --git a/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_partial_except_trim.c b/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_partial_except_trim.c index 7387fee..f491a29 100644 --- a/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_partial_except_trim.c +++ b/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_partial_except_trim.c @@ -332,8 +332,8 @@ void test__f_compare_utf_dynamic_partial_except_trim__works(void **state) { assert_int_equal(status, expects[i]); } // for - f_utf_string_dynamic_resize(0, &utf_string_1); - f_utf_string_dynamic_resize(0, &utf_string_2); + free((void *) utf_string_1.string); + free((void *) utf_string_2.string); } #ifdef __cplusplus diff --git a/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_partial_except_trim_dynamic.c b/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_partial_except_trim_dynamic.c index de48681..608eeb6 100644 --- a/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_partial_except_trim_dynamic.c +++ b/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_partial_except_trim_dynamic.c @@ -329,8 +329,8 @@ void test__f_compare_utf_dynamic_partial_except_trim_dynamic__works(void **state assert_int_equal(status, expects[i]); } // for - f_utf_string_dynamic_resize(0, &utf_string_1); - f_utf_string_dynamic_resize(0, &utf_string_2); + free((void *) utf_string_1.string); + free((void *) utf_string_2.string); } #ifdef __cplusplus diff --git a/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_partial_except_trim_string.c b/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_partial_except_trim_string.c index b170d15..8b4f3bc 100644 --- a/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_partial_except_trim_string.c +++ b/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_partial_except_trim_string.c @@ -332,8 +332,8 @@ void test__f_compare_utf_dynamic_partial_except_trim_string__works(void **state) assert_int_equal(status, expects[i]); } // for - f_utf_string_dynamic_resize(0, &utf_string_1); - f_utf_string_dynamic_resize(0, &utf_string_2); + free((void *) utf_string_1.string); + free((void *) utf_string_2.string); } #ifdef __cplusplus diff --git a/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_partial_string.c b/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_partial_string.c index 26c7f3c..b756dda 100644 --- a/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_partial_string.c +++ b/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_partial_string.c @@ -314,8 +314,8 @@ void test__f_compare_utf_dynamic_partial_string__works(void **state) { assert_int_equal(status, expects[i]); } // for - f_utf_string_dynamic_resize(0, &utf_string_1); - f_utf_string_dynamic_resize(0, &utf_string_2); + free((void *) utf_string_1.string); + free((void *) utf_string_2.string); } #ifdef __cplusplus diff --git a/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_partial_trim.c b/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_partial_trim.c index dcab577..1d7010a 100644 --- a/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_partial_trim.c +++ b/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_partial_trim.c @@ -327,8 +327,8 @@ void test__f_compare_utf_dynamic_partial_trim__works(void **state) { assert_int_equal(status, expects[i]); } // for - f_utf_string_dynamic_resize(0, &utf_string_1); - f_utf_string_dynamic_resize(0, &utf_string_2); + free((void *) utf_string_1.string); + free((void *) utf_string_2.string); } #ifdef __cplusplus diff --git a/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_partial_trim_dynamic.c b/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_partial_trim_dynamic.c index ae2bd0c..e15a643 100644 --- a/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_partial_trim_dynamic.c +++ b/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_partial_trim_dynamic.c @@ -324,8 +324,8 @@ void test__f_compare_utf_dynamic_partial_trim_dynamic__works(void **state) { assert_int_equal(status, expects[i]); } // for - f_utf_string_dynamic_resize(0, &utf_string_1); - f_utf_string_dynamic_resize(0, &utf_string_2); + free((void *) utf_string_1.string); + free((void *) utf_string_2.string); } #ifdef __cplusplus diff --git a/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_partial_trim_string.c b/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_partial_trim_string.c index 50e1928..544b15c 100644 --- a/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_partial_trim_string.c +++ b/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_partial_trim_string.c @@ -327,8 +327,8 @@ void test__f_compare_utf_dynamic_partial_trim_string__works(void **state) { assert_int_equal(status, expects[i]); } // for - f_utf_string_dynamic_resize(0, &utf_string_1); - f_utf_string_dynamic_resize(0, &utf_string_2); + free((void *) utf_string_1.string); + free((void *) utf_string_2.string); } #ifdef __cplusplus diff --git a/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_string.c b/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_string.c index f45a05e..e8e0bae 100644 --- a/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_string.c +++ b/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_string.c @@ -276,8 +276,8 @@ void test__f_compare_utf_dynamic_string__works(void **state) { assert_int_equal(status, expects[i]); } // for - f_utf_string_dynamic_resize(0, &utf_string_1); - f_utf_string_dynamic_resize(0, &utf_string_2); + free((void *) utf_string_1.string); + free((void *) utf_string_2.string); } #ifdef __cplusplus diff --git a/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_trim.c b/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_trim.c index 77040fe..1b6ec6d 100644 --- a/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_trim.c +++ b/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_trim.c @@ -117,8 +117,8 @@ void test__f_compare_utf_dynamic_trim__trims(void **state) { assert_int_equal(status, F_equal_to); } // for - f_utf_string_dynamic_resize(0, &utf_string_1); - f_utf_string_dynamic_resize(0, &utf_string_2); + free((void *) utf_string_1.string); + free((void *) utf_string_2.string); } void test__f_compare_utf_dynamic_trim__something_misses_nothing(void **state) { @@ -151,7 +151,7 @@ void test__f_compare_utf_dynamic_trim__something_misses_nothing(void **state) { assert_int_equal(status, F_equal_to_not); } // for - f_utf_string_dynamic_resize(0, &utf_string_1); + free((void *) utf_string_1.string); } void test__f_compare_utf_dynamic_trim__works(void **state) { @@ -425,8 +425,8 @@ void test__f_compare_utf_dynamic_trim__works(void **state) { assert_int_equal(status, expects[i]); } // for - f_utf_string_dynamic_resize(0, &utf_string_1); - f_utf_string_dynamic_resize(0, &utf_string_2); + free((void *) utf_string_1.string); + free((void *) utf_string_2.string); } #ifdef __cplusplus diff --git a/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_trim_string.c b/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_trim_string.c index b09ef71..1b0114f 100644 --- a/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_trim_string.c +++ b/level_0/f_compare/tests/unit/c/test-compare-utf_dynamic_trim_string.c @@ -117,8 +117,8 @@ void test__f_compare_utf_dynamic_trim_string__trims(void **state) { assert_int_equal(status, F_equal_to); } // for - f_utf_string_dynamic_resize(0, &utf_string_1); - f_utf_string_dynamic_resize(0, &utf_string_2); + free((void *) utf_string_1.string); + free((void *) utf_string_2.string); } void test__f_compare_utf_dynamic_trim_string__something_misses_nothing(void **state) { @@ -151,7 +151,7 @@ void test__f_compare_utf_dynamic_trim_string__something_misses_nothing(void **st assert_int_equal(status, F_equal_to_not); } // for - f_utf_string_dynamic_resize(0, &utf_string_1); + free((void *) utf_string_1.string); } void test__f_compare_utf_dynamic_trim_string__works(void **state) { @@ -425,8 +425,8 @@ void test__f_compare_utf_dynamic_trim_string__works(void **state) { assert_int_equal(status, expects[i]); } // for - f_utf_string_dynamic_resize(0, &utf_string_1); - f_utf_string_dynamic_resize(0, &utf_string_2); + free((void *) utf_string_1.string); + free((void *) utf_string_2.string); } #ifdef __cplusplus diff --git a/level_0/f_compare/tests/unit/c/test-compare-utf_except.c b/level_0/f_compare/tests/unit/c/test-compare-utf_except.c index f4c536d..15b57f7 100644 --- a/level_0/f_compare/tests/unit/c/test-compare-utf_except.c +++ b/level_0/f_compare/tests/unit/c/test-compare-utf_except.c @@ -299,8 +299,8 @@ void test__f_compare_utf_except__works(void **state) { assert_int_equal(status, expects[i]); } // for - f_utf_string_dynamic_resize(0, &utf_string_1); - f_utf_string_dynamic_resize(0, &utf_string_2); + free((void *) utf_string_1.string); + free((void *) utf_string_2.string); } #ifdef __cplusplus diff --git a/level_0/f_compare/tests/unit/c/test-compare-utf_except_trim.c b/level_0/f_compare/tests/unit/c/test-compare-utf_except_trim.c index d8f6997..e7391c3 100644 --- a/level_0/f_compare/tests/unit/c/test-compare-utf_except_trim.c +++ b/level_0/f_compare/tests/unit/c/test-compare-utf_except_trim.c @@ -312,8 +312,8 @@ void test__f_compare_utf_except_trim__works(void **state) { assert_int_equal(status, expects[i]); } // for - f_utf_string_dynamic_resize(0, &utf_string_1); - f_utf_string_dynamic_resize(0, &utf_string_2); + free((void *) utf_string_1.string); + free((void *) utf_string_2.string); } #ifdef __cplusplus diff --git a/level_0/f_compare/tests/unit/c/test-compare-utf_trim.c b/level_0/f_compare/tests/unit/c/test-compare-utf_trim.c index 4f675b4..e2b9b53 100644 --- a/level_0/f_compare/tests/unit/c/test-compare-utf_trim.c +++ b/level_0/f_compare/tests/unit/c/test-compare-utf_trim.c @@ -117,8 +117,8 @@ void test__f_compare_utf_trim__trims(void **state) { assert_int_equal(status, F_equal_to); } // for - f_utf_string_dynamic_resize(0, &utf_string_1); - f_utf_string_dynamic_resize(0, &utf_string_2); + free((void *) utf_string_1.string); + free((void *) utf_string_2.string); } void test__f_compare_utf_trim__something_misses_nothing(void **state) { @@ -151,7 +151,7 @@ void test__f_compare_utf_trim__something_misses_nothing(void **state) { assert_int_equal(status, F_equal_to_not); } // for - f_utf_string_dynamic_resize(0, &utf_string_1); + free((void *) utf_string_1.string); } void test__f_compare_utf_trim__works(void **state) { @@ -425,8 +425,8 @@ void test__f_compare_utf_trim__works(void **state) { assert_int_equal(status, expects[i]); } // for - f_utf_string_dynamic_resize(0, &utf_string_1); - f_utf_string_dynamic_resize(0, &utf_string_2); + free((void *) utf_string_1.string); + free((void *) utf_string_2.string); } #ifdef __cplusplus diff --git a/level_0/f_compare/tests/unit/c/test-compare.c b/level_0/f_compare/tests/unit/c/test-compare.c index a22395d..159eb70 100644 --- a/level_0/f_compare/tests/unit/c/test-compare.c +++ b/level_0/f_compare/tests/unit/c/test-compare.c @@ -136,7 +136,7 @@ int main(void) { f_status_t test_convert_dynamic_to_utf(const f_string_static_t dynamic, f_utf_string_dynamic_t * const utf) { - f_status_t status = f_utf_string_dynamic_resize(dynamic.used, utf); + f_status_t status = f_memory_array_resize(dynamic.used, sizeof(f_utf_char_t), (void **) &utf->string, &utf->used, &utf->size); if (F_status_is_error(status)) return status; utf->used = 0; diff --git a/level_0/f_compare/tests/unit/c/test-compare.h b/level_0/f_compare/tests/unit/c/test-compare.h index aa6347d..13e9de6 100644 --- a/level_0/f_compare/tests/unit/c/test-compare.h +++ b/level_0/f_compare/tests/unit/c/test-compare.h @@ -124,11 +124,11 @@ extern int main(void); * @return * F_okay on success. * + * Errors (with error bit) from: f_memory_array_resize(). * Errors (with error bit) from: f_utf_char_to_character(). - * Errors (with error bit) from: f_utf_string_dynamic_resize(). * + * @see f_memory_array_resize() * @see f_utf_char_to_character() - * @see f_utf_string_dynamic_resize() */ extern f_status_t test_convert_dynamic_to_utf(const f_string_static_t dynamic, f_utf_string_dynamic_t * const utf);