Go to the documentation of this file.
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];
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_STRIREPLACE(haystack, needle, expected) \
98 ptr = av_strireplace(haystack, needle, "instead"); \
100 printf("error, received null pointer!\n"); \
102 if (strcmp(ptr, expected) != 0) \
103 printf( "expected: %s, received: %s\n", expected, ptr); \
107 TEST_STRIREPLACE(haystack, needle [0],
"Education consists mainly in what we have uninstead");
108 TEST_STRIREPLACE(haystack, needle [1],
"Education consists mainly in what we have instead");
109 TEST_STRIREPLACE(haystack, needle [2],
"Education consists mainly in what we have instead.");
110 TEST_STRIREPLACE(haystack, needle [1],
"Education consists mainly in what we have instead");
115 #define TEST_D2STR(value, expected) \
116 if((ptr = av_d2str(value)) == NULL){ \
117 printf("error, received null pointer!\n"); \
119 if(strcmp(ptr, expected) != 0) \
120 printf( "expected: %s, received: %s\n", expected, ptr); \
123 TEST_D2STR(0 ,
"0.000000");
124 TEST_D2STR(-1.2333234,
"-1.233323");
125 TEST_D2STR(-1.2333237,
"-1.233324");
#define FF_ENABLE_DEPRECATION_WARNINGS
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_STRIREPLACE(haystack, needle, expected)
printf("static const uint8_t my_array[100] = {\n")
#define i(width, name, range_min, range_max)
#define TEST_APPEND_PATH_COMPONENT(path, component, expected)
#define FF_DISABLE_DEPRECATION_WARNINGS
#define TEST_STRNSTR(haystack, needle, hay_length, expected)