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
--- a/test/test_string.cpp	Tue Sep 20 10:36:04 2022 +0200
+++ b/test/test_string.cpp	Tue Sep 20 10:37:29 2022 +0200
@@ -187,27 +187,27 @@
 TEST(String, strcmp) {
     cxstring str = CX_STR("compare this");
 
-    EXPECT_EQ(cx_strcmp(CX_STR(""), CX_STR("")), 0);
-    EXPECT_GT(cx_strcmp(str, CX_STR("")), 0);
-    EXPECT_EQ(cx_strcmp(str, CX_STR("compare this")), 0);
-    EXPECT_NE(cx_strcmp(str, CX_STR("Compare This")), 0);
-    EXPECT_LT(cx_strcmp(str, CX_STR("compare tool")), 0);
-    EXPECT_GT(cx_strcmp(str, CX_STR("compare shit")), 0);
-    EXPECT_LT(cx_strcmp(str, CX_STR("compare this not")), 0);
-    EXPECT_GT(cx_strcmp(str, CX_STR("compare")), 0);
+    EXPECT_EQ(cx_strcmp(cx_str(""), cx_str("")), 0);
+    EXPECT_GT(cx_strcmp(str, cx_str("")), 0);
+    EXPECT_EQ(cx_strcmp(str, cx_str("compare this")), 0);
+    EXPECT_NE(cx_strcmp(str, cx_str("Compare This")), 0);
+    EXPECT_LT(cx_strcmp(str, cx_str("compare tool")), 0);
+    EXPECT_GT(cx_strcmp(str, cx_str("compare shit")), 0);
+    EXPECT_LT(cx_strcmp(str, cx_str("compare this not")), 0);
+    EXPECT_GT(cx_strcmp(str, cx_str("compare")), 0);
 }
 
 TEST(String, strcasecmp) {
     cxstring str = CX_STR("compare this");
 
-    EXPECT_EQ(cx_strcasecmp(CX_STR(""), CX_STR("")), 0);
-    EXPECT_GT(cx_strcasecmp(str, CX_STR("")), 0);
-    EXPECT_EQ(cx_strcasecmp(str, CX_STR("compare this")), 0);
-    EXPECT_EQ(cx_strcasecmp(str, CX_STR("Compare This")), 0);
-    EXPECT_LT(cx_strcasecmp(str, CX_STR("compare tool")), 0);
-    EXPECT_GT(cx_strcasecmp(str, CX_STR("compare shit")), 0);
-    EXPECT_LT(cx_strcasecmp(str, CX_STR("compare this not")), 0);
-    EXPECT_GT(cx_strcasecmp(str, CX_STR("compare")), 0);
+    EXPECT_EQ(cx_strcasecmp(cx_str(""), cx_str("")), 0);
+    EXPECT_GT(cx_strcasecmp(str, cx_str("")), 0);
+    EXPECT_EQ(cx_strcasecmp(str, cx_str("compare this")), 0);
+    EXPECT_EQ(cx_strcasecmp(str, cx_str("Compare This")), 0);
+    EXPECT_LT(cx_strcasecmp(str, cx_str("compare tool")), 0);
+    EXPECT_GT(cx_strcasecmp(str, cx_str("compare shit")), 0);
+    EXPECT_LT(cx_strcasecmp(str, cx_str("compare this not")), 0);
+    EXPECT_GT(cx_strcasecmp(str, cx_str("compare")), 0);
 }
 
 
@@ -220,19 +220,19 @@
     CxTestingAllocator alloc;
 
     cxmutstr t1 = cx_strcat_a(&alloc, 2, s1, s2);
-    EXPECT_EQ(cx_strcmp(cx_strcast(t1), CX_STR("1234")), 0);
+    EXPECT_EQ(cx_strcmp(cx_strcast(t1), cx_str("1234")), 0);
     cx_strfree_a(&alloc, &t1);
 
     cxmutstr t2 = cx_strcat_a(&alloc, 3, s1, s2, s3);
-    EXPECT_EQ(cx_strcmp(cx_strcast(t2), CX_STR("123456")), 0);
+    EXPECT_EQ(cx_strcmp(cx_strcast(t2), cx_str("123456")), 0);
     cx_strfree_a(&alloc, &t2);
 
     cxmutstr t3 = cx_strcat_a(&alloc, 6, s1, sn, s2, sn, s3, sn);
-    EXPECT_EQ(cx_strcmp(cx_strcast(t3), CX_STR("123456")), 0);
+    EXPECT_EQ(cx_strcmp(cx_strcast(t3), cx_str("123456")), 0);
     cx_strfree_a(&alloc, &t3);
 
     cxmutstr t4 = cx_strcat_a(&alloc, 2, sn, sn);
-    EXPECT_EQ(cx_strcmp(cx_strcast(t4), CX_STR("")), 0);
+    EXPECT_EQ(cx_strcmp(cx_strcast(t4), cx_str("")), 0);
     cx_strfree_a(&alloc, &t4);
 
     EXPECT_TRUE(alloc.verify());

mercurial