From 7d5b3c1e9ae35cc2f33c05c1f24f8c9a262eb618 Mon Sep 17 00:00:00 2001 From: Johnny Richard Date: Mon, 18 Apr 2022 00:03:19 +0200 Subject: string_view: Implement string_view_eq function --- test/string_view_test.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'test/string_view_test.c') 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 @@ -48,6 +48,22 @@ test_from_cstr(const MunitParameter params[], return MUNIT_OK; } +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 } -- cgit v1.2.3