--- a/test/string_tests.c Mon Jul 14 12:45:48 2014 +0200 +++ b/test/string_tests.c Mon Jul 14 13:51:02 2014 +0200 @@ -54,6 +54,7 @@ UCX_TEST_END } + UCX_TEST(test_sstrchr_sstrrchr) { sstr_t str = ST("I will find you - and I will kill you"); UCX_TEST_BEGIN @@ -100,6 +101,37 @@ UCX_TEST_END } + +UCX_TEST(test_sstrcat) { + sstr_t s1 = S("12"); + sstr_t s2 = S("34"); + sstr_t s3 = S("56"); + sstr_t sn = { NULL, 0 }; + + UCX_TEST_BEGIN + + sstr_t t1 = sstrcat(2, s1, s2); + UCX_TEST_ASSERT(!sstrcmp(t1, S("1234")), "t1: wrong content"); + free(t1.ptr); + + sstr_t t2 = sstrcat(3, s1, s2, s3); + UCX_TEST_ASSERT(!sstrcmp(t2, S("123456")), "t2: wrong content"); + free(t2.ptr); + + sstr_t t3 = sstrcat(6, s1, sn, s2, sn, s3, sn); + UCX_TEST_ASSERT(!sstrcmp(t3, S("123456")), "t3: wrong content"); + free(t3.ptr); + + sstr_t t4 = sstrcat(2, sn, sn); + UCX_TEST_ASSERT(t4.ptr, "t4.ptr is NULL"); + UCX_TEST_ASSERT(t4.length == 0, "t4 has wrong length"); + free(t4.ptr); + + + UCX_TEST_END + +} + UCX_TEST(test_sstrsplit) { const char *original = "this,is,a,csv,string";