do not use c++ object initialization

Tue, 20 Sep 2022 10:37:29 +0200

author
Mike Becker <universe@uap-core.de>
date
Tue, 20 Sep 2022 10:37:29 +0200
changeset 588
6a3cd8f0a2cf
parent 587
3dd55e246d2d
child 589
c290f8fd979e

do not use c++ object initialization

test/test_string.cpp file | annotate | diff | comparison | revisions
     1.1 --- a/test/test_string.cpp	Tue Sep 20 10:36:04 2022 +0200
     1.2 +++ b/test/test_string.cpp	Tue Sep 20 10:37:29 2022 +0200
     1.3 @@ -187,27 +187,27 @@
     1.4  TEST(String, strcmp) {
     1.5      cxstring str = CX_STR("compare this");
     1.6  
     1.7 -    EXPECT_EQ(cx_strcmp(CX_STR(""), CX_STR("")), 0);
     1.8 -    EXPECT_GT(cx_strcmp(str, CX_STR("")), 0);
     1.9 -    EXPECT_EQ(cx_strcmp(str, CX_STR("compare this")), 0);
    1.10 -    EXPECT_NE(cx_strcmp(str, CX_STR("Compare This")), 0);
    1.11 -    EXPECT_LT(cx_strcmp(str, CX_STR("compare tool")), 0);
    1.12 -    EXPECT_GT(cx_strcmp(str, CX_STR("compare shit")), 0);
    1.13 -    EXPECT_LT(cx_strcmp(str, CX_STR("compare this not")), 0);
    1.14 -    EXPECT_GT(cx_strcmp(str, CX_STR("compare")), 0);
    1.15 +    EXPECT_EQ(cx_strcmp(cx_str(""), cx_str("")), 0);
    1.16 +    EXPECT_GT(cx_strcmp(str, cx_str("")), 0);
    1.17 +    EXPECT_EQ(cx_strcmp(str, cx_str("compare this")), 0);
    1.18 +    EXPECT_NE(cx_strcmp(str, cx_str("Compare This")), 0);
    1.19 +    EXPECT_LT(cx_strcmp(str, cx_str("compare tool")), 0);
    1.20 +    EXPECT_GT(cx_strcmp(str, cx_str("compare shit")), 0);
    1.21 +    EXPECT_LT(cx_strcmp(str, cx_str("compare this not")), 0);
    1.22 +    EXPECT_GT(cx_strcmp(str, cx_str("compare")), 0);
    1.23  }
    1.24  
    1.25  TEST(String, strcasecmp) {
    1.26      cxstring str = CX_STR("compare this");
    1.27  
    1.28 -    EXPECT_EQ(cx_strcasecmp(CX_STR(""), CX_STR("")), 0);
    1.29 -    EXPECT_GT(cx_strcasecmp(str, CX_STR("")), 0);
    1.30 -    EXPECT_EQ(cx_strcasecmp(str, CX_STR("compare this")), 0);
    1.31 -    EXPECT_EQ(cx_strcasecmp(str, CX_STR("Compare This")), 0);
    1.32 -    EXPECT_LT(cx_strcasecmp(str, CX_STR("compare tool")), 0);
    1.33 -    EXPECT_GT(cx_strcasecmp(str, CX_STR("compare shit")), 0);
    1.34 -    EXPECT_LT(cx_strcasecmp(str, CX_STR("compare this not")), 0);
    1.35 -    EXPECT_GT(cx_strcasecmp(str, CX_STR("compare")), 0);
    1.36 +    EXPECT_EQ(cx_strcasecmp(cx_str(""), cx_str("")), 0);
    1.37 +    EXPECT_GT(cx_strcasecmp(str, cx_str("")), 0);
    1.38 +    EXPECT_EQ(cx_strcasecmp(str, cx_str("compare this")), 0);
    1.39 +    EXPECT_EQ(cx_strcasecmp(str, cx_str("Compare This")), 0);
    1.40 +    EXPECT_LT(cx_strcasecmp(str, cx_str("compare tool")), 0);
    1.41 +    EXPECT_GT(cx_strcasecmp(str, cx_str("compare shit")), 0);
    1.42 +    EXPECT_LT(cx_strcasecmp(str, cx_str("compare this not")), 0);
    1.43 +    EXPECT_GT(cx_strcasecmp(str, cx_str("compare")), 0);
    1.44  }
    1.45  
    1.46  
    1.47 @@ -220,19 +220,19 @@
    1.48      CxTestingAllocator alloc;
    1.49  
    1.50      cxmutstr t1 = cx_strcat_a(&alloc, 2, s1, s2);
    1.51 -    EXPECT_EQ(cx_strcmp(cx_strcast(t1), CX_STR("1234")), 0);
    1.52 +    EXPECT_EQ(cx_strcmp(cx_strcast(t1), cx_str("1234")), 0);
    1.53      cx_strfree_a(&alloc, &t1);
    1.54  
    1.55      cxmutstr t2 = cx_strcat_a(&alloc, 3, s1, s2, s3);
    1.56 -    EXPECT_EQ(cx_strcmp(cx_strcast(t2), CX_STR("123456")), 0);
    1.57 +    EXPECT_EQ(cx_strcmp(cx_strcast(t2), cx_str("123456")), 0);
    1.58      cx_strfree_a(&alloc, &t2);
    1.59  
    1.60      cxmutstr t3 = cx_strcat_a(&alloc, 6, s1, sn, s2, sn, s3, sn);
    1.61 -    EXPECT_EQ(cx_strcmp(cx_strcast(t3), CX_STR("123456")), 0);
    1.62 +    EXPECT_EQ(cx_strcmp(cx_strcast(t3), cx_str("123456")), 0);
    1.63      cx_strfree_a(&alloc, &t3);
    1.64  
    1.65      cxmutstr t4 = cx_strcat_a(&alloc, 2, sn, sn);
    1.66 -    EXPECT_EQ(cx_strcmp(cx_strcast(t4), CX_STR("")), 0);
    1.67 +    EXPECT_EQ(cx_strcmp(cx_strcast(t4), cx_str("")), 0);
    1.68      cx_strfree_a(&alloc, &t4);
    1.69  
    1.70      EXPECT_TRUE(alloc.verify());

mercurial