Commit 68e59765 authored by Petru Rares Sincraian's avatar Petru Rares Sincraian Committed by Michael Niedermayer

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: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent fe3de6bc
......@@ -749,10 +749,8 @@ static uint32_t av_get_random_seed_deterministic(void)
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;
static const char *const rates[] = {
"-inf",
......@@ -789,10 +787,10 @@ int main(void)
printf("'%s' -> %d/%d %s\n",
rates[i], q.num, q.den, ret ? "ERROR" : "OK");
}
}
}
printf("\nTesting av_parse_color()\n");
{
static void test_av_parse_color(void)
{
int i;
uint8_t rgba[4];
static const char *const color_names[] = {
......@@ -843,10 +841,10 @@ int main(void)
else
printf("%s -> error\n", color_names[i]);
}
}
}
printf("\nTesting av_small_strptime()\n");
{
static void test_av_small_strptime(void)
{
int i;
struct tm tm = { 0 };
struct fmt_timespec_entry {
......@@ -872,10 +870,10 @@ int main(void)
printf("error\n");
}
}
}
}
printf("\nTesting av_parse_time()\n");
{
static void test_av_parse_time(void)
{
int i;
int64_t tv;
time_t tvi;
......@@ -922,7 +920,21 @@ int main(void)
printf("%+21"PRIi64"\n", tv);
}
}
}
}
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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment