diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/main.c | 2 | ||||
-rw-r--r-- | test/test_split.c | 18 |
2 files changed, 20 insertions, 0 deletions
diff --git a/test/main.c b/test/main.c index 479d529..7fff724 100644 --- a/test/main.c +++ b/test/main.c @@ -4,11 +4,13 @@ void test_split1(); void test_split2(); +void test_split3(); int main(int argc, char** argv) { test_split1(); test_split2(); + test_split3(); return EXIT_SUCCESS; } diff --git a/test/test_split.c b/test/test_split.c index 7b19caa..fc7513b 100644 --- a/test/test_split.c +++ b/test/test_split.c @@ -39,3 +39,21 @@ test_split2() log("OK\n"); } + +void +test_split3() +{ + log("Running..."); + + char *str = "\nSTR_1\nSTR_2\n"; + int size; + char **tokens = strsplit(str, '\n', &size); + + assert(size == 4); + assert(strlen(tokens[0]) == 0); + assert(strncmp("STR_1", tokens[1], 5) == 0); + assert(strncmp("STR_2", tokens[2], 5) == 0); + assert(strlen(tokens[3]) == 0); + + log("OK\n"); +} |