29 static const char *
const strings[] = {
51 " foo bar : blahblah",
53 "'foo : \\ \\ ' : blahblah",
54 "'\\fo\\o:': blahblah",
55 "\\'fo\\o\\:': foo ' :blahblah"
57 const char *haystack =
"Education consists mainly in what we have unlearned.";
58 const char *
const needle[] = {
"learned.",
"unlearned.",
"Unlearned"};
60 printf(
"Testing av_get_token()\n");
62 const char *p = strings[i];
66 printf(
" -> |%s|", q);
67 printf(
" + |%s|\n", p);
71 printf(
"Testing av_append_path_component()\n");
72 #define TEST_APPEND_PATH_COMPONENT(path, component, expected) \
73 fullpath = av_append_path_component((path), (component)); \
74 printf("%s = %s\n", fullpath ? fullpath : "(null)", expected); \
86 #define TEST_STRNSTR(haystack, needle, hay_length, expected) \
87 ptr = av_strnstr(haystack, needle, hay_length); \
88 if (ptr != expected){ \
89 printf("expected: %p, received %p\n", expected, ptr); \
91 TEST_STRNSTR(haystack, needle [0], strlen(haystack), haystack+44);
92 TEST_STRNSTR(haystack, needle [1], strlen(haystack), haystack+42);
94 TEST_STRNSTR(haystack, strings[1], strlen(haystack), haystack );
97 #define TEST_D2STR(value, expected) \
98 if((ptr = av_d2str(value)) == NULL){ \
99 printf("error, received null pointer!\n"); \
101 if(strcmp(ptr, expected) != 0) \
102 printf( "expected: %s, received: %s\n", expected, ptr); \
Memory handling functions.
#define TEST_D2STR(value, expected)
char * av_get_token(const char **buf, const char *term)
Unescape the given string until a non escaped terminating char, and return the token corresponding to...
#define FF_ARRAY_ELEMS(a)
#define TEST_STRNSTR(haystack, needle, hay_length, expected)
common internal and external API header
#define TEST_APPEND_PATH_COMPONENT(path, component, expected)