# HG changeset patch # User Mike Becker # Date 1663662964 -7200 # Node ID 3dd55e246d2d6fc2f62c41e95b6984338721f49a # Parent aa51aaa907b9baa5443a88ecdc020327c604b70f use EXPECT_STREQ instead of strcmp diff -r aa51aaa907b9 -r 3dd55e246d2d test/test_string.cpp --- a/test/test_string.cpp Tue Sep 20 10:30:54 2022 +0200 +++ b/test/test_string.cpp Tue Sep 20 10:36:04 2022 +0200 @@ -108,7 +108,7 @@ cxstring result = cx_strchr(str, 'w'); EXPECT_EQ(result.length, 35); - EXPECT_EQ(strcmp("will find you - and I will kill you", result.ptr), 0); + EXPECT_STREQ(result.ptr, "will find you - and I will kill you"); // just for coverage, call the _m variant auto m = cx_strchr_m(cx_mutstrn(nullptr, 0), 'a'); @@ -123,7 +123,7 @@ cxstring result = cx_strrchr(str, 'w'); EXPECT_EQ(result.length, 13); - EXPECT_EQ(strcmp("will kill you", result.ptr), 0); + EXPECT_STREQ(result.ptr, "will kill you"); // just for coverage, call the _m variant auto m = cx_strrchr_m(cx_mutstrn(nullptr, 0), 'a'); @@ -166,21 +166,21 @@ cxstring result = cx_strstr(str, cx_str("match")); EXPECT_EQ(result.length, 20); - EXPECT_EQ(strcmp("match in this string", result.ptr), 0); + EXPECT_STREQ(result.ptr, "match in this string"); result = cx_strstr(str, cx_str("")); EXPECT_EQ(result.length, str.length); - EXPECT_EQ(strcmp(str.ptr, result.ptr), 0); + EXPECT_STREQ(result.ptr, str.ptr); result = cx_strstr(longstr, longstrpattern); EXPECT_EQ(result.length, longstrresult.length); - EXPECT_EQ(strcmp(result.ptr, longstrresult.ptr), 0); + EXPECT_STREQ(result.ptr, longstrresult.ptr); // just for coverage, call the _m variant auto mstr = cx_strdup(longstr); auto m = cx_strstr_m(mstr, longstrpattern); EXPECT_EQ(m.length, longstrresult.length); - EXPECT_EQ(strcmp(m.ptr, longstrresult.ptr), 0); + EXPECT_STREQ(m.ptr, longstrresult.ptr); cx_strfree(&mstr); }