diff options
author | 2023-05-11 18:17:11 +0200 | |
---|---|---|
committer | 2023-05-11 18:17:11 +0200 | |
commit | 12ff05b3b7dcf90e60e1b666c9b3781fe2412dcd (patch) | |
tree | 0efe44b00d31c2ad2ed308f18b44cf1aa7c78447 /test/test_split.c | |
parent | b3f6133a327390df495954d8ae561a895805c0e1 (diff) | |
download | string2-12ff05b3b7dcf90e60e1b666c9b3781fe2412dcd.tar.gz string2-12ff05b3b7dcf90e60e1b666c9b3781fe2412dcd.zip |
Diffstat (limited to 'test/test_split.c')
-rw-r--r-- | test/test_split.c | 18 |
1 files changed, 18 insertions, 0 deletions
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"); +} |