Commit 5b63633d authored by stefano's avatar stefano

Add more tests to eval, help detecting some of the more apparent

errors, far from being a complete test system.

git-svn-id: file:///var/local/repositories/ffmpeg/trunk@23635 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 7b5420ce
...@@ -532,6 +532,44 @@ int main(void) ...@@ -532,6 +532,44 @@ int main(void)
{ {
int i; int i;
double d; 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)", av_parse_and_eval_expr(&d, "1+(5-2)^(3-1)+1/2+sin(PI)-max(-2.2,-3.1)",
const_names, const_values, const_names, const_values,
NULL, NULL, NULL, NULL, NULL, 0, NULL); NULL, NULL, NULL, NULL, NULL, 0, NULL);
......
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