X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Fstr_talloc%2Ftest%2Frun.c;h=6b7fe14ed1d71fd7fabe8e41cae8cc488a1b90aa;hp=c8cc6217bd6e5832d2d0cee2a703a80964567d2c;hb=100444225380d3f5ca29424ea54703d308c7c651;hpb=e70eae05572ae0e7ae119ad02b278f73d4c583dc diff --git a/ccan/str_talloc/test/run.c b/ccan/str_talloc/test/run.c index c8cc6217..6b7fe14e 100644 --- a/ccan/str_talloc/test/run.c +++ b/ccan/str_talloc/test/run.c @@ -4,34 +4,26 @@ #include #include -/* FIXME: ccanize */ #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0])) static char *substrings[] = { "far", "bar", "baz", "b", "ba", "z", "ar", NULL }; int main(int argc, char *argv[]) { - unsigned int n; char **split, *str; void *ctx; - plan_tests(19); - split = strsplit(NULL, "hello world", " ", &n); - ok1(n == 3); + plan_tests(16); + split = strsplit(NULL, "hello world", " "); + ok1(talloc_array_length(split) == 4); ok1(!strcmp(split[0], "hello")); ok1(!strcmp(split[1], "")); ok1(!strcmp(split[2], "world")); ok1(split[3] == NULL); talloc_free(split); - split = strsplit(NULL, "hello world", " ", NULL); - ok1(!strcmp(split[0], "hello")); - ok1(!strcmp(split[1], "")); - ok1(!strcmp(split[2], "world")); - ok1(split[3] == NULL); - talloc_free(split); - - split = strsplit(NULL, "hello world", "o ", NULL); + split = strsplit(NULL, "hello world", "o "); + ok1(talloc_array_length(split) == 6); ok1(!strcmp(split[0], "hell")); ok1(!strcmp(split[1], "")); ok1(!strcmp(split[2], "")); @@ -40,7 +32,7 @@ int main(int argc, char *argv[]) ok1(split[5] == NULL); ctx = split; - split = strsplit(ctx, "hello world", "o ", NULL); + split = strsplit(ctx, "hello world", "o "); ok1(talloc_parent(split) == ctx); talloc_free(ctx);