summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJohnny Richard <johnny@johnnyrichard.com>2022-04-18 00:03:19 +0200
committerJohnny Richard <johnny@johnnyrichard.com>2022-04-18 00:03:19 +0200
commit7d5b3c1e9ae35cc2f33c05c1f24f8c9a262eb618 (patch)
tree7593307bf840f1b26dec8b7571289a69a4cc4960 /test
parentc6071aae178ff9c44820d533701c09577c8840c5 (diff)
string_view: Implement string_view_eq function
Diffstat (limited to 'test')
-rw-r--r--test/string_view_test.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/string_view_test.c b/test/string_view_test.c
index d4ecf9e..a050239 100644
--- a/test/string_view_test.c
+++ b/test/string_view_test.c
@@ -49,6 +49,22 @@ test_from_cstr(const MunitParameter params[],
}
static MunitResult
+test_eq(const MunitParameter params[],
+ void *user_data_or_fixture)
+{
+ string_view_t a = string_view_from_cstr("hello");
+ string_view_t b = string_view_from_cstr("world");
+
+ assert_false(string_view_eq(a, b));
+
+ b = string_view_from_cstr("hello");
+
+ assert_true(string_view_eq(a, b));
+
+ return MUNIT_OK;
+}
+
+static MunitResult
test_chop_by_delim_when_has_delim(const MunitParameter params[],
void *user_data_or_fixture)
{
@@ -85,6 +101,7 @@ test_chop_by_delim_when_has_no_delim(const MunitParameter params[],
static MunitTest tests[] = {
{ "/test_create_new", test_create_new, NULL, NULL, MUNIT_TEST_OPTION_NONE, NULL },
{ "/test_from_cstr", test_from_cstr, NULL, NULL, MUNIT_TEST_OPTION_NONE, NULL },
+ { "/test_eq", test_eq, NULL, NULL, MUNIT_TEST_OPTION_NONE, NULL },
{ "/test_chop_by_delim_when_has_delim", test_chop_by_delim_when_has_delim, NULL, NULL, MUNIT_TEST_OPTION_NONE, NULL },
{ "/test_chop_by_delim_when_has_no_delim", test_chop_by_delim_when_has_no_delim, NULL, NULL, MUNIT_TEST_OPTION_NONE, NULL },
{ NULL, NULL, NULL, NULL, MUNIT_TEST_OPTION_NONE, NULL }