tests/test_string.c

changeset 1680
1aa21afb8763
parent 1679
4a08dabe5e8f
equal deleted inserted replaced
1679:4a08dabe5e8f 1680:1aa21afb8763
700 CX_TEST_ASSERT(n == 3); 700 CX_TEST_ASSERT(n == 3);
701 CX_TEST_ASSERT(0 == cx_strcmp(list[0], "th")); 701 CX_TEST_ASSERT(0 == cx_strcmp(list[0], "th"));
702 CX_TEST_ASSERT(0 == cx_strcmp(list[1], "")); 702 CX_TEST_ASSERT(0 == cx_strcmp(list[1], ""));
703 CX_TEST_ASSERT(0 == cx_strcmp(list[2], "a,csv,string")); 703 CX_TEST_ASSERT(0 == cx_strcmp(list[2], "a,csv,string"));
704 704
705 // call the _m variant just for coverage 705 // test with a cxmutstr
706 cxmutstr mtest = cx_strdup(test); 706 cxmutstr mtest = cx_strdup(test);
707 cxmutstr mlist[4]; 707 cxmutstr mlist[4];
708 n = cx_strsplit_m(mtest, "is,", 4, mlist); 708 n = cx_strsplit(mtest, "is,", 4, mlist);
709 CX_TEST_ASSERT(n == 3); 709 CX_TEST_ASSERT(n == 3);
710 CX_TEST_ASSERT(0 == cx_strcmp(mlist[0], "th")); 710 CX_TEST_ASSERT(0 == cx_strcmp(mlist[0], "th"));
711 CX_TEST_ASSERT(0 == cx_strcmp(mlist[1], "")); 711 CX_TEST_ASSERT(0 == cx_strcmp(mlist[1], ""));
712 CX_TEST_ASSERT(0 == cx_strcmp(mlist[2], "a,csv,string")); 712 CX_TEST_ASSERT(0 == cx_strcmp(mlist[2], "a,csv,string"));
713 cx_strfree(&mtest); 713 cx_strfree(&mtest);
816 CX_TEST_ASSERT(0 == cx_strcmp(list[0], "th")); 816 CX_TEST_ASSERT(0 == cx_strcmp(list[0], "th"));
817 CX_TEST_ASSERT(0 == cx_strcmp(list[1], "")); 817 CX_TEST_ASSERT(0 == cx_strcmp(list[1], ""));
818 CX_TEST_ASSERT(0 == cx_strcmp(list[2], "a,csv,string")); 818 CX_TEST_ASSERT(0 == cx_strcmp(list[2], "a,csv,string"));
819 cxFree(alloc, list); 819 cxFree(alloc, list);
820 820
821 // call the _m variant just for coverage 821 // test with a cxmutstr
822 cxmutstr mtest = cx_strdup(test); 822 cxmutstr mtest = cx_strdup(test);
823 cxmutstr *mlist; 823 cxmutstr *mlist;
824 n = cx_strsplit_ma(alloc, mtest, "is,", 4, &mlist); 824 n = cx_strsplit_a(alloc, mtest, "is,", 4, &mlist);
825 CX_TEST_ASSERT(n == 3); 825 CX_TEST_ASSERT(n == 3);
826 CX_TEST_ASSERT(0 == cx_strcmp(mlist[0], "th")); 826 CX_TEST_ASSERT(0 == cx_strcmp(mlist[0], "th"));
827 CX_TEST_ASSERT(0 == cx_strcmp(mlist[1], "")); 827 CX_TEST_ASSERT(0 == cx_strcmp(mlist[1], ""));
828 CX_TEST_ASSERT(0 == cx_strcmp(mlist[2], "a,csv,string")); 828 CX_TEST_ASSERT(0 == cx_strcmp(mlist[2], "a,csv,string"));
829 cxFree(alloc, mlist); 829 cxFree(alloc, mlist);

mercurial