Refactor libavutil/parseutils.c

All tests were in the main method which produces a long main. Now, each test
is in his own method.

I think this produces a more clear code and follows more with the main
priority of FFmpeg "simplicity and small code size"

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Petru Rares Sincraian 2016-03-23 15:32:56 +00:00 committed by Michael Niedermayer
parent fe3de6bc62
commit 68e5976543

View file

@ -749,9 +749,7 @@ static uint32_t av_get_random_seed_deterministic(void)
return randomv = randomv * 1664525 + 1013904223; return randomv = randomv * 1664525 + 1013904223;
} }
int main(void) static void test_av_parse_video_rate(void)
{
printf("Testing av_parse_video_rate()\n");
{ {
int i; int i;
static const char *const rates[] = { static const char *const rates[] = {
@ -791,7 +789,7 @@ int main(void)
} }
} }
printf("\nTesting av_parse_color()\n"); static void test_av_parse_color(void)
{ {
int i; int i;
uint8_t rgba[4]; uint8_t rgba[4];
@ -845,7 +843,7 @@ int main(void)
} }
} }
printf("\nTesting av_small_strptime()\n"); static void test_av_small_strptime(void)
{ {
int i; int i;
struct tm tm = { 0 }; struct tm tm = { 0 };
@ -874,7 +872,7 @@ int main(void)
} }
} }
printf("\nTesting av_parse_time()\n"); static void test_av_parse_time(void)
{ {
int i; int i;
int64_t tv; int64_t tv;
@ -924,6 +922,20 @@ int main(void)
} }
} }
int main(void)
{
printf("Testing av_parse_video_rate()\n");
test_av_parse_video_rate();
printf("\nTesting av_parse_color()\n");
test_av_parse_color();
printf("\nTesting av_small_strptime()\n");
test_av_small_strptime();
printf("\nTesting av_parse_time()\n");
test_av_parse_time();
return 0; return 0;
} }