test/string_tests.c

changeset 148
c27c2425c0b1
parent 147
1aa598f36872
child 149
3bf87676d42d
     1.1 --- a/test/string_tests.c	Fri Aug 16 14:48:58 2013 +0200
     1.2 +++ b/test/string_tests.c	Mon Aug 19 10:44:11 2013 +0200
     1.3 @@ -69,6 +69,23 @@
     1.4      free(cat.ptr);
     1.5  }
     1.6  
     1.7 +UCX_TEST(test_sstrchr) {
     1.8 +    sstr_t str = ST("I will find you - and I will kill you");
     1.9 +    UCX_TEST_BEGIN
    1.10 +    
    1.11 +    sstr_t result = sstrchr(str, 'w');
    1.12 +    UCX_TEST_ASSERT(result.length == 35, "sstrchr returned wrong length");
    1.13 +    UCX_TEST_ASSERT(strcmp("will find you - and I will kill you", result.ptr)
    1.14 +        == 0, "sstrchr did not return the expected string");
    1.15 +    
    1.16 +    result = sstrrchr(str, 'w');
    1.17 +    UCX_TEST_ASSERT(result.length == 13, "sstrrchr returned wrong length");
    1.18 +    UCX_TEST_ASSERT(strcmp("will kill you", result.ptr)
    1.19 +        == 0, "sstrrchr did not return the expected string");
    1.20 +    
    1.21 +    UCX_TEST_END
    1.22 +}
    1.23 +
    1.24  UCX_TEST(test_sstrsplit) {
    1.25  
    1.26      const char *original = "this,is,a,csv,string";

mercurial