use EXPECT_STREQ instead of strcmp

Tue, 20 Sep 2022 10:36:04 +0200

author
Mike Becker <universe@uap-core.de>
date
Tue, 20 Sep 2022 10:36:04 +0200
changeset 587
3dd55e246d2d
parent 586
aa51aaa907b9
child 588
6a3cd8f0a2cf

use EXPECT_STREQ instead of strcmp

test/test_string.cpp file | annotate | diff | comparison | revisions
--- 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);
 }
 

mercurial