tests/test_string.cpp

changeset 671
d7a67375a7ac
parent 653
e081643aae2a
child 684
380bd45bc94a
equal deleted inserted replaced
670:4ad8ea3aee49 671:d7a67375a7ac
211 EXPECT_NE(cx_strcmp(str, cx_str("Compare This")), 0); 211 EXPECT_NE(cx_strcmp(str, cx_str("Compare This")), 0);
212 EXPECT_LT(cx_strcmp(str, cx_str("compare tool")), 0); 212 EXPECT_LT(cx_strcmp(str, cx_str("compare tool")), 0);
213 EXPECT_GT(cx_strcmp(str, cx_str("compare shit")), 0); 213 EXPECT_GT(cx_strcmp(str, cx_str("compare shit")), 0);
214 EXPECT_LT(cx_strcmp(str, cx_str("compare this not")), 0); 214 EXPECT_LT(cx_strcmp(str, cx_str("compare this not")), 0);
215 EXPECT_GT(cx_strcmp(str, cx_str("compare")), 0); 215 EXPECT_GT(cx_strcmp(str, cx_str("compare")), 0);
216
217 cxstring str2 = cx_str("Compare This");
218 EXPECT_NE(cx_strcmp_p(&str, &str2), 0);
219 str2 = cx_str("compare this");
220 EXPECT_EQ(cx_strcmp_p(&str, &str2), 0);
216 } 221 }
217 222
218 TEST(String, strcasecmp) { 223 TEST(String, strcasecmp) {
219 cxstring str = CX_STR("compare this"); 224 cxstring str = CX_STR("compare this");
220 225
224 EXPECT_EQ(cx_strcasecmp(str, cx_str("Compare This")), 0); 229 EXPECT_EQ(cx_strcasecmp(str, cx_str("Compare This")), 0);
225 EXPECT_LT(cx_strcasecmp(str, cx_str("compare tool")), 0); 230 EXPECT_LT(cx_strcasecmp(str, cx_str("compare tool")), 0);
226 EXPECT_GT(cx_strcasecmp(str, cx_str("compare shit")), 0); 231 EXPECT_GT(cx_strcasecmp(str, cx_str("compare shit")), 0);
227 EXPECT_LT(cx_strcasecmp(str, cx_str("compare this not")), 0); 232 EXPECT_LT(cx_strcasecmp(str, cx_str("compare this not")), 0);
228 EXPECT_GT(cx_strcasecmp(str, cx_str("compare")), 0); 233 EXPECT_GT(cx_strcasecmp(str, cx_str("compare")), 0);
234
235 cxstring str2 = cx_str("Compare This");
236 EXPECT_EQ(cx_strcasecmp_p(&str, &str2), 0);
237 str2 = cx_str("Compare Tool");
238 EXPECT_LT(cx_strcasecmp_p(&str, &str2), 0);
229 } 239 }
230 240
231 TEST(String, strcat) { 241 TEST(String, strcat) {
232 cxstring s1 = CX_STR("12"); 242 cxstring s1 = CX_STR("12");
233 cxstring s2 = CX_STR("34"); 243 cxstring s2 = CX_STR("34");

mercurial