X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Fstr_talloc%2Ftest%2Frun.c;fp=ccan%2Fstr_talloc%2Ftest%2Frun.c;h=0000000000000000000000000000000000000000;hp=df85bb7259d1e5eef637ea2cb09b5c3614d06dc5;hb=7207c7822bbe0deef98aa71a5b2e721be370b446;hpb=4c2395707d92b5891564adcc6ac2f8acb4d61f90 diff --git a/ccan/str_talloc/test/run.c b/ccan/str_talloc/test/run.c deleted file mode 100644 index df85bb72..00000000 --- a/ccan/str_talloc/test/run.c +++ /dev/null @@ -1,49 +0,0 @@ -#include -#include -#include -#include -#include - -#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0])) - -static const char *substrings[] -= { "far", "bar", "baz", "b", "ba", "z", "ar", NULL }; - -int main(int argc, char *argv[]) -{ - char **split, *str; - void *ctx; - - 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", "o "); - ok1(talloc_array_length(split) == 6); - ok1(!strcmp(split[0], "hell")); - ok1(!strcmp(split[1], "")); - ok1(!strcmp(split[2], "")); - ok1(!strcmp(split[3], "w")); - ok1(!strcmp(split[4], "rld")); - ok1(split[5] == NULL); - - ctx = split; - split = strsplit(ctx, "hello world", "o "); - ok1(talloc_parent(split) == ctx); - talloc_free(ctx); - - str = strjoin(NULL, (char **)substrings, ", "); - ok1(!strcmp(str, "far, bar, baz, b, ba, z, ar, ")); - ctx = str; - str = strjoin(ctx, (char **)substrings, ""); - ok1(!strcmp(str, "farbarbazbbazar")); - ok1(talloc_parent(str) == ctx); - talloc_free(ctx); - - return exit_status(); -}