test/string_tests.c

changeset 74
dc8bade7f2a3
parent 71
303dabadff1c
child 97
499e1b465d77
equal deleted inserted replaced
73:f15c7d6aebb9 74:dc8bade7f2a3
3 */ 3 */
4 4
5 #include "string_tests.h" 5 #include "string_tests.h"
6 6
7 UCX_TEST_IMPLEMENT(test_sstr) { 7 UCX_TEST_IMPLEMENT(test_sstr) {
8 sstr_t s1 = sstr("1234"); 8 sstr_t s1 = sstr((char*)"1234");
9 sstr_t s2 = sstrn("ab", 2); 9 sstr_t s2 = sstrn((char*)"ab", 2);
10 10
11 UCX_TEST_BEGIN 11 UCX_TEST_BEGIN
12 12
13 UCX_TEST_ASSERT(s1.length == 4, "s1 length must be 4"); 13 UCX_TEST_ASSERT(s1.length == 4, "s1 length must be 4");
14 UCX_TEST_ASSERT(s2.length == 2, "s2 length must be 2"); 14 UCX_TEST_ASSERT(s2.length == 2, "s2 length must be 2");
15 15
16 UCX_TEST_END 16 UCX_TEST_END
17 } 17 }
18 18
19 UCX_TEST_IMPLEMENT(test_sstr_len_cat) { 19 UCX_TEST_IMPLEMENT(test_sstr_len_cat) {
20 sstr_t s1 = sstr("1234"); 20 sstr_t s1 = S("1234");
21 sstr_t s2 = sstr(".:.:."); 21 sstr_t s2 = S(".:.:.");
22 sstr_t s3 = sstr("X"); 22 sstr_t s3 = S("X");
23 23
24 sstr_t cat; 24 sstr_t cat;
25 25
26 size_t len = sstrnlen(3, s1, s2, s3); 26 size_t len = sstrnlen(3, s1, s2, s3);
27 27
52 } 52 }
53 53
54 UCX_TEST_IMPLEMENT(test_sstrsplit) { 54 UCX_TEST_IMPLEMENT(test_sstrsplit) {
55 55
56 const char *original = "this,is,a,csv,string"; 56 const char *original = "this,is,a,csv,string";
57 sstr_t test = sstr("this,is,a,csv,string"); /* use copy of original here */ 57 sstr_t test = S("this,is,a,csv,string"); /* use copy of original here */
58 size_t n; 58 size_t n;
59 sstr_t *list; 59 sstr_t *list;
60 60
61 UCX_TEST_BEGIN 61 UCX_TEST_BEGIN
62 62

mercurial