diff options
author | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2010-06-16 22:36:52 +0000 |
---|---|---|
committer | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2010-06-16 22:36:52 +0000 |
commit | eb928286deee2b49d63a4629e03d42a0ae1cc842 (patch) | |
tree | 9af47e2cb5d32af8472ebcf81b68d9fa4c96a9d6 | |
parent | 8745fe29a9b2b1ca53f187b542a09c9d203ff5ae (diff) | |
download | ffmpeg-eb928286deee2b49d63a4629e03d42a0ae1cc842.tar.gz |
Add more tests to eval, help detecting some of the more apparent
errors, far from being a complete test system.
Originally committed as revision 23635 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavutil/eval.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/libavutil/eval.c b/libavutil/eval.c index 065625c9a6..6e0349872b 100644 --- a/libavutil/eval.c +++ b/libavutil/eval.c @@ -532,6 +532,44 @@ int main(void) { int i; double d; + const char **expr, *exprs[] = { + "", + "1+(5-2)^(3-1)+1/2+sin(PI)-max(-2.2,-3.1)", + "80G/80Gi" + "1k", + "1Gi", + "1gi", + "1GiFoo", + "1k+1k", + "1Gi*3foo", + "foo", + "foo(", + "foo()", + "foo)", + "sin", + "sin(", + "sin()", + "sin)", + "sin 10", + "sin(1,2,3)", + "sin(1 )", + "1", + "1foo", + "bar + PI + E + 100f*2 + foo", + "13k + 12f - foo(1, 2)", + "1gi", + "1Gi", + NULL + }; + + for (expr = exprs; *expr; expr++) { + printf("Evaluating '%s'\n", *expr); + av_parse_and_eval_expr(&d, *expr, + const_names, const_values, + NULL, NULL, NULL, NULL, NULL, 0, NULL); + printf("'%s' -> %f\n\n", *expr, d); + } + av_parse_and_eval_expr(&d, "1+(5-2)^(3-1)+1/2+sin(PI)-max(-2.2,-3.1)", const_names, const_values, NULL, NULL, NULL, NULL, NULL, 0, NULL); |