75 UCX_TEST(test_sstrchr_sstrrchr) { |
75 UCX_TEST(test_sstrchr_sstrrchr) { |
76 sstr_t str = ST("I will find you - and I will kill you"); |
76 sstr_t str = ST("I will find you - and I will kill you"); |
77 UCX_TEST_BEGIN |
77 UCX_TEST_BEGIN |
78 |
78 |
79 sstr_t notfound = sstrchr(str, 'x'); |
79 sstr_t notfound = sstrchr(str, 'x'); |
80 UCX_TEST_ASSERT(notfound.length == 0, "string length not 0"); |
80 UCX_TEST_ASSERT(notfound.length == 0, |
|
81 "string length not 0 after forward search w/o result"); |
|
82 |
|
83 notfound = sstrrchr(str, 'x'); |
|
84 UCX_TEST_ASSERT(notfound.length == 0, |
|
85 "string length not 0 after reverse search w/o result"); |
81 |
86 |
82 sstr_t result = sstrchr(str, 'w'); |
87 sstr_t result = sstrchr(str, 'w'); |
83 UCX_TEST_ASSERT(result.length == 35, "sstrchr returned wrong length"); |
88 UCX_TEST_ASSERT(result.length == 35, "sstrchr returned wrong length"); |
84 UCX_TEST_ASSERT(strcmp("will find you - and I will kill you", result.ptr) |
89 UCX_TEST_ASSERT(strcmp("will find you - and I will kill you", result.ptr) |
85 == 0, "sstrchr did not return the expected string"); |
90 == 0, "sstrchr did not return the expected string"); |