[FFmpeg-cvslog] r25334 - trunk/libavcore/parseutils.c
stefano
subversion
Mon Oct 4 15:41:06 CEST 2010
Author: stefano
Date: Mon Oct 4 15:41:06 2010
New Revision: 25334
Log:
Add a test for av_parse_video_rate().
Modified:
trunk/libavcore/parseutils.c
Modified: trunk/libavcore/parseutils.c
==============================================================================
--- trunk/libavcore/parseutils.c Mon Oct 4 15:41:04 2010 (r25333)
+++ trunk/libavcore/parseutils.c Mon Oct 4 15:41:06 2010 (r25334)
@@ -136,3 +136,54 @@ int av_parse_video_rate(AVRational *rate
return AVERROR(EINVAL);
return 0;
}
+
+#ifdef TEST
+
+#undef printf
+
+int main(void)
+{
+ printf("Testing av_parse_video_rate()\n");
+ {
+ int i;
+ const char *rates[] = {
+ "-inf",
+ "inf",
+ "nan",
+ "123/0",
+ "-123 / 0",
+ "",
+ "/",
+ " 123 / 321",
+ "foo/foo",
+ "foo/1",
+ "1/foo",
+ "0/0",
+ "/0",
+ "1/",
+ "1",
+ "0",
+ "-123/123",
+ "-foo",
+ "123.23",
+ ".23",
+ "-.23",
+ "-0.234",
+ "-0.0000001",
+ " 21332.2324 ",
+ " -21332.2324 ",
+ };
+
+ for (i = 0; i < FF_ARRAY_ELEMS(rates); i++) {
+ int ret;
+ AVRational q = (AVRational){0, 0};
+ ret = av_parse_video_rate(&q, rates[i]),
+ printf("'%s' -> %d/%d ret:%d\n",
+ rates[i], q.num, q.den, ret);
+ }
+ }
+
+ return 0;
+}
+
+#endif /* TEST */
More information about the ffmpeg-cvslog
mailing list