diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2016-05-20 18:00:35 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2016-05-20 19:32:02 +0200 |
commit | b50bd695168976b70e5fab2f2f3a9b0ef8063157 (patch) | |
tree | ec61c7cee58bcf0ff67e5d7824610e665a049f15 /libavutil/eval-test.c | |
parent | e0706e9cc8f30a8242d2b140edace7bf76170506 (diff) | |
download | ffmpeg-b50bd695168976b70e5fab2f2f3a9b0ef8063157.tar.gz |
avutil/eval-test: Check av_expr_parse_and_eval() for failure and also check it in the fate test
Fixes CID1361940
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavutil/eval-test.c')
-rw-r--r-- | libavutil/eval-test.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/libavutil/eval-test.c b/libavutil/eval-test.c index 8e53f488c7..17a63cc25d 100644 --- a/libavutil/eval-test.c +++ b/libavutil/eval-test.c @@ -139,33 +139,42 @@ int main(int argc, char **argv) "clip(0, 0/0, 1)", NULL }; + int ret; for (expr = exprs; *expr; expr++) { printf("Evaluating '%s'\n", *expr); - av_expr_parse_and_eval(&d, *expr, + ret = av_expr_parse_and_eval(&d, *expr, const_names, const_values, NULL, NULL, NULL, NULL, NULL, 0, NULL); if (isnan(d)) printf("'%s' -> nan\n\n", *expr); else printf("'%s' -> %f\n\n", *expr, d); + if (ret < 0) + printf("av_expr_parse_and_eval failed\n"); } - av_expr_parse_and_eval(&d, "1+(5-2)^(3-1)+1/2+sin(PI)-max(-2.2,-3.1)", + ret = av_expr_parse_and_eval(&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); printf("%f == 12.7\n", d); - av_expr_parse_and_eval(&d, "80G/80Gi", + if (ret < 0) + printf("av_expr_parse_and_eval failed\n"); + ret = av_expr_parse_and_eval(&d, "80G/80Gi", const_names, const_values, NULL, NULL, NULL, NULL, NULL, 0, NULL); printf("%f == 0.931322575\n", d); + if (ret < 0) + printf("av_expr_parse_and_eval failed\n"); if (argc > 1 && !strcmp(argv[1], "-t")) { for (i = 0; i < 1050; i++) { START_TIMER; - av_expr_parse_and_eval(&d, "1+(5-2)^(3-1)+1/2+sin(PI)-max(-2.2,-3.1)", + ret = av_expr_parse_and_eval(&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); + if (ret < 0) + printf("av_expr_parse_and_eval failed\n"); STOP_TIMER("av_expr_parse_and_eval"); } } |