tests/parseutils: change test to make it platform independent

Make the test independent from the actual error string used to describe a
certain error code.
pull/59/head
Stefano Sabatini 13 years ago
parent 9ec5e956a2
commit 3ecaba677e
  1. 6
      libavutil/parseutils.c
  2. 50
      tests/ref/fate/parseutils

@ -723,12 +723,10 @@ int main(void)
for (i = 0; i < FF_ARRAY_ELEMS(rates); i++) { for (i = 0; i < FF_ARRAY_ELEMS(rates); i++) {
int ret; int ret;
char err[1024];
AVRational q = (AVRational){0, 0}; AVRational q = (AVRational){0, 0};
ret = av_parse_video_rate(&q, rates[i]); ret = av_parse_video_rate(&q, rates[i]);
av_strerror(ret, err, sizeof(err)); printf("'%s' -> %d/%d%s\n",
printf("'%s' -> %d/%d ret:%s\n", rates[i], q.num, q.den, ret ? " error" : "");
rates[i], q.num, q.den, err);
} }
} }

@ -1,29 +1,29 @@
Testing av_parse_video_rate() Testing av_parse_video_rate()
'-inf' -> -1/0 ret:Invalid argument '-inf' -> -1/0 error
'inf' -> 1/0 ret:Invalid argument 'inf' -> 1/0 error
'nan' -> 0/0 ret:Invalid argument 'nan' -> 0/0 error
'123/0' -> 1/0 ret:Invalid argument '123/0' -> 1/0 error
'-123 / 0' -> -1/0 ret:Invalid argument '-123 / 0' -> -1/0 error
'' -> 0/0 ret:Invalid argument '' -> 0/0 error
'/' -> 0/0 ret:Invalid argument '/' -> 0/0 error
' 123 / 321' -> 41/107 ret:Success ' 123 / 321' -> 41/107
'foo/foo' -> 0/0 ret:Invalid argument 'foo/foo' -> 0/0 error
'foo/1' -> 0/0 ret:Invalid argument 'foo/1' -> 0/0 error
'1/foo' -> 1/0 ret:Invalid argument '1/foo' -> 1/0 error
'0/0' -> 0/0 ret:Invalid argument '0/0' -> 0/0 error
'/0' -> 0/0 ret:Invalid argument '/0' -> 0/0 error
'1/' -> 1/0 ret:Invalid argument '1/' -> 1/0 error
'1' -> 1/1 ret:Success '1' -> 1/1
'0' -> 0/1 ret:Invalid argument '0' -> 0/1 error
'-123/123' -> -1/1 ret:Invalid argument '-123/123' -> -1/1 error
'-foo' -> 0/0 ret:Invalid argument '-foo' -> 0/0 error
'123.23' -> 12323/100 ret:Success '123.23' -> 12323/100
'.23' -> 23/100 ret:Success '.23' -> 23/100
'-.23' -> -23/100 ret:Invalid argument '-.23' -> -23/100 error
'-0.234' -> -117/500 ret:Invalid argument '-0.234' -> -117/500 error
'-0.0000001' -> 0/1 ret:Invalid argument '-0.0000001' -> 0/1 error
' 21332.2324 ' -> 917286/43 ret:Success ' 21332.2324 ' -> 917286/43
' -21332.2324 ' -> -917286/43 ret:Invalid argument ' -21332.2324 ' -> -917286/43 error
Testing av_parse_color() Testing av_parse_color()
bikeshed -> R(80) G(64) B(140) A(59) bikeshed -> R(80) G(64) B(140) A(59)

Loading…
Cancel
Save