From dd393c5dbb852b3c6803c5bf6dbc6dd854e52665 Mon Sep 17 00:00:00 2001 From: Thomas Jensen Date: Sat, 14 Oct 2023 22:12:22 +0200 Subject: [PATCH] bxtrs test --- utest/bxstring_test.c | 16 ++++++++++++++++ utest/bxstring_test.h | 2 ++ utest/main.c | 1 + 3 files changed, 19 insertions(+) diff --git a/utest/bxstring_test.c b/utest/bxstring_test.c index 225b8e6e..4a0fcda4 100644 --- a/utest/bxstring_test.c +++ b/utest/bxstring_test.c @@ -1149,6 +1149,22 @@ void test_bxs_rtrim_empty(void **state) +void test_bxs_prepend_spaces_null(void **state) +{ + UNUSED(state); + + bxstr_t *actual = bxs_prepend_spaces(NULL, 2); + assert_non_null(actual); + assert_string_equal(" ", actual->ascii); + assert_int_equal(2, (int) actual->num_chars); + assert_int_equal(2, (int) actual->num_chars_visible); + assert_int_equal(0, (int) actual->num_chars_invisible); + + bxs_free(actual); +} + + + void test_bxs_append_spaces(void **state) { UNUSED(state); diff --git a/utest/bxstring_test.h b/utest/bxstring_test.h index 8958b3ea..8ee596b7 100644 --- a/utest/bxstring_test.h +++ b/utest/bxstring_test.h @@ -83,6 +83,8 @@ void test_bxs_ltrim_max(void **state); void test_bxs_rtrim(void **state); void test_bxs_rtrim_empty(void **state); +void test_bxs_prepend_spaces_null(void **state); + void test_bxs_append_spaces(void **state); void test_bxs_to_output(void **state); diff --git a/utest/main.c b/utest/main.c index 72807efe..779623b5 100644 --- a/utest/main.c +++ b/utest/main.c @@ -168,6 +168,7 @@ int main(void) cmocka_unit_test_setup(test_bxs_ltrim_max, beforeTest), cmocka_unit_test_setup(test_bxs_rtrim, beforeTest), cmocka_unit_test_setup(test_bxs_rtrim_empty, beforeTest), + cmocka_unit_test_setup(test_bxs_prepend_spaces_null, beforeTest), cmocka_unit_test_setup(test_bxs_append_spaces, beforeTest), cmocka_unit_test_setup(test_bxs_to_output, beforeTest), cmocka_unit_test_setup(test_bxs_is_empty_null, beforeTest),