mirror of
https://github.com/nyanmisaka/ffmpeg-rockchip.git
synced 2026-04-25 08:56:59 +08:00
avutil/avstring: improve av_strreplace implement
Use AVBprint to implement av_strreplace add av_strreplace test case TEST_STRREPLACE Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
This commit is contained in:
@@ -93,6 +93,22 @@ int main(void)
|
||||
TEST_STRNSTR(haystack, needle [2], strlen(haystack), NULL );
|
||||
TEST_STRNSTR(haystack, strings[1], strlen(haystack), haystack );
|
||||
|
||||
/*Testing av_strireplace()*/
|
||||
#define TEST_STRIREPLACE(haystack, needle, expected) \
|
||||
ptr = av_strireplace(haystack, needle, "instead"); \
|
||||
if (ptr == NULL) { \
|
||||
printf("error, received null pointer!\n"); \
|
||||
} else { \
|
||||
if (strcmp(ptr, expected) != 0) \
|
||||
printf( "expected: %s, received: %s\n", expected, ptr); \
|
||||
av_free(ptr); \
|
||||
}
|
||||
|
||||
TEST_STRIREPLACE(haystack, needle [0], "Education consists mainly in what we have uninstead");
|
||||
TEST_STRIREPLACE(haystack, needle [1], "Education consists mainly in what we have instead");
|
||||
TEST_STRIREPLACE(haystack, needle [2], "Education consists mainly in what we have instead.");
|
||||
TEST_STRIREPLACE(haystack, needle [1], "Education consists mainly in what we have instead");
|
||||
|
||||
/*Testing av_d2str()*/
|
||||
#define TEST_D2STR(value, expected) \
|
||||
if((ptr = av_d2str(value)) == NULL){ \
|
||||
|
||||
Reference in New Issue
Block a user