From 1e43a74b91dfc0482a3d907d3dea486bcbdea2f4 Mon Sep 17 00:00:00 2001 From: Arash Partow Date: Sun, 2 Oct 2016 21:43:42 +1100 Subject: [PATCH] C++ Mathematical Expression Library (ExprTk) https://www.partow.net/programming/exprtk/index.html --- exprtk_test.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/exprtk_test.cpp b/exprtk_test.cpp index b2c1d74..3f30047 100644 --- a/exprtk_test.cpp +++ b/exprtk_test.cpp @@ -6193,10 +6193,19 @@ inline bool run_test18() typedef exprtk::expression expression_t; typedef exprtk::parser parser_t; - std::vector v0 { 0, 0, 0, 0, 0, 0, 0 }; - std::vector v1 { 0, 2, 4, 6, 8, 10, 12 }; - std::vector v2 { 1, 3, 5, 7, 9, 11, 13 }; - std::vector v3 { 0, 1, 2, 3, 4, 5, 6 }; + std::vector v0; + std::vector v1; + std::vector v2; + std::vector v3; + + #define pb(v,N) \ + v.push_back(T(N)); \ + + pb(v0,0) pb(v0,0) pb(v0,0) pb(v0,0) pb(v0,0) pb(v0, 0) pb(v0, 0) + pb(v1,0) pb(v1,2) pb(v1,4) pb(v1,6) pb(v1,8) pb(v1,10) pb(v1,12) + pb(v2,1) pb(v2,3) pb(v2,5) pb(v2,7) pb(v2,9) pb(v2,11) pb(v2,13) + pb(v3,0) pb(v3,1) pb(v3,2) pb(v3,3) pb(v3,4) pb(v3, 5) pb(v3, 6) + #undef pb const std::string expr_string = "sum(v + 1)";