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
     1.1 --- a/test/test_string.cpp	Tue Sep 20 10:30:54 2022 +0200
     1.2 +++ b/test/test_string.cpp	Tue Sep 20 10:36:04 2022 +0200
     1.3 @@ -108,7 +108,7 @@
     1.4  
     1.5      cxstring result = cx_strchr(str, 'w');
     1.6      EXPECT_EQ(result.length, 35);
     1.7 -    EXPECT_EQ(strcmp("will find you - and I will kill you", result.ptr), 0);
     1.8 +    EXPECT_STREQ(result.ptr, "will find you - and I will kill you");
     1.9  
    1.10      // just for coverage, call the _m variant
    1.11      auto m = cx_strchr_m(cx_mutstrn(nullptr, 0), 'a');
    1.12 @@ -123,7 +123,7 @@
    1.13  
    1.14      cxstring result = cx_strrchr(str, 'w');
    1.15      EXPECT_EQ(result.length, 13);
    1.16 -    EXPECT_EQ(strcmp("will kill you", result.ptr), 0);
    1.17 +    EXPECT_STREQ(result.ptr, "will kill you");
    1.18  
    1.19      // just for coverage, call the _m variant
    1.20      auto m = cx_strrchr_m(cx_mutstrn(nullptr, 0), 'a');
    1.21 @@ -166,21 +166,21 @@
    1.22  
    1.23      cxstring result = cx_strstr(str, cx_str("match"));
    1.24      EXPECT_EQ(result.length, 20);
    1.25 -    EXPECT_EQ(strcmp("match in this string", result.ptr), 0);
    1.26 +    EXPECT_STREQ(result.ptr, "match in this string");
    1.27  
    1.28      result = cx_strstr(str, cx_str(""));
    1.29      EXPECT_EQ(result.length, str.length);
    1.30 -    EXPECT_EQ(strcmp(str.ptr, result.ptr), 0);
    1.31 +    EXPECT_STREQ(result.ptr, str.ptr);
    1.32  
    1.33      result = cx_strstr(longstr, longstrpattern);
    1.34      EXPECT_EQ(result.length, longstrresult.length);
    1.35 -    EXPECT_EQ(strcmp(result.ptr, longstrresult.ptr), 0);
    1.36 +    EXPECT_STREQ(result.ptr, longstrresult.ptr);
    1.37  
    1.38      // just for coverage, call the _m variant
    1.39      auto mstr = cx_strdup(longstr);
    1.40      auto m = cx_strstr_m(mstr, longstrpattern);
    1.41      EXPECT_EQ(m.length, longstrresult.length);
    1.42 -    EXPECT_EQ(strcmp(m.ptr, longstrresult.ptr), 0);
    1.43 +    EXPECT_STREQ(m.ptr, longstrresult.ptr);
    1.44      cx_strfree(&mstr);
    1.45  }
    1.46  

mercurial