[FFmpeg-devel] [PATCH] tests/parseutils: change test to make it platform independent

Stefano Sabatini stefasab at gmail.com
Sun Jun 10 16:12:22 CEST 2012


Make the test independent from the actual error string used to describe a
certain error code.
---
 libavutil/parseutils.c    |    4 +-
 tests/ref/fate/parseutils |   50 ++++++++++++++++++++++----------------------
 2 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/libavutil/parseutils.c b/libavutil/parseutils.c
index 7a13d0b..f496d35 100644
--- a/libavutil/parseutils.c
+++ b/libavutil/parseutils.c
@@ -727,8 +727,8 @@ int main(void)
             AVRational q = (AVRational){0, 0};
             ret = av_parse_video_rate(&q, rates[i]);
             av_strerror(ret, err, sizeof(err));
-            printf("'%s' -> %d/%d ret:%s\n",
-                   rates[i], q.num, q.den, err);
+            printf("'%s' -> %d/%d %s\n",
+                   rates[i], q.num, q.den, err ? "error" : "");
         }
     }
 
diff --git a/tests/ref/fate/parseutils b/tests/ref/fate/parseutils
index 992429f..6b11cd2 100644
--- a/tests/ref/fate/parseutils
+++ b/tests/ref/fate/parseutils
@@ -1,29 +1,29 @@
 Testing av_parse_video_rate()
-'-inf' -> -1/0 ret:Invalid argument
-'inf' -> 1/0 ret:Invalid argument
-'nan' -> 0/0 ret:Invalid argument
-'123/0' -> 1/0 ret:Invalid argument
-'-123 / 0' -> -1/0 ret:Invalid argument
-'' -> 0/0 ret:Invalid argument
-'/' -> 0/0 ret:Invalid argument
-' 123  /  321' -> 41/107 ret:Success
-'foo/foo' -> 0/0 ret:Invalid argument
-'foo/1' -> 0/0 ret:Invalid argument
-'1/foo' -> 1/0 ret:Invalid argument
-'0/0' -> 0/0 ret:Invalid argument
-'/0' -> 0/0 ret:Invalid argument
-'1/' -> 1/0 ret:Invalid argument
-'1' -> 1/1 ret:Success
-'0' -> 0/1 ret:Invalid argument
-'-123/123' -> -1/1 ret:Invalid argument
-'-foo' -> 0/0 ret:Invalid argument
-'123.23' -> 12323/100 ret:Success
-'.23' -> 23/100 ret:Success
-'-.23' -> -23/100 ret:Invalid argument
-'-0.234' -> -117/500 ret:Invalid argument
-'-0.0000001' -> 0/1 ret:Invalid argument
-'  21332.2324   ' -> 917286/43 ret:Success
-' -21332.2324   ' -> -917286/43 ret:Invalid argument
+'-inf' -> -1/0 error
+'inf' -> 1/0 error
+'nan' -> 0/0 error
+'123/0' -> 1/0 error
+'-123 / 0' -> -1/0 error
+'' -> 0/0 error
+'/' -> 0/0 error
+' 123  /  321' -> 41/107 error
+'foo/foo' -> 0/0 error
+'foo/1' -> 0/0 error
+'1/foo' -> 1/0 error
+'0/0' -> 0/0 error
+'/0' -> 0/0 error
+'1/' -> 1/0 error
+'1' -> 1/1 error
+'0' -> 0/1 error
+'-123/123' -> -1/1 error
+'-foo' -> 0/0 error
+'123.23' -> 12323/100 error
+'.23' -> 23/100 error
+'-.23' -> -23/100 error
+'-0.234' -> -117/500 error
+'-0.0000001' -> 0/1 error
+'  21332.2324   ' -> 917286/43 error
+' -21332.2324   ' -> -917286/43 error
 
 Testing av_parse_color()
 bikeshed -> R(80) G(64) B(140) A(59)
-- 
1.7.5.4



More information about the ffmpeg-devel mailing list