mirror of
https://github.com/ArashPartow/exprtk.git
synced 2025-06-12 16:27:23 +00:00
C++ Mathematical Expression Library (ExprTk) http://www.partow.net/programming/exprtk/index.html
This commit is contained in:
445
exprtk_test.cpp
445
exprtk_test.cpp
@ -32,8 +32,8 @@ typedef std::pair<std::string,double> test_t;
|
||||
|
||||
static const test_t test_list[] =
|
||||
{
|
||||
// Note: Each of following tests should all
|
||||
// compile down to a single literal node.
|
||||
// Note: Each of following tests should compile down
|
||||
// to a single literal node.
|
||||
test_t("0",0.0),
|
||||
test_t("1",1.0),
|
||||
test_t("2",2.0),
|
||||
@ -779,101 +779,102 @@ static const test_t test_list[] =
|
||||
test_t("equal($f01(1.1,2.2,3.3),(1.1+2.2)*3.3)",1.0),
|
||||
test_t("equal($f02(1.1,2.2,3.3),(1.1+2.2)-3.3)",1.0),
|
||||
test_t("equal($f03(1.1,2.2,3.3),(1.1+2.2)+3.3)",1.0),
|
||||
test_t("equal($f04(1.1,2.2,3.3),(1.1-2.2)/3.3)",1.0),
|
||||
test_t("equal($f05(1.1,2.2,3.3),(1.1-2.2)*3.3)",1.0),
|
||||
test_t("equal($f06(1.1,2.2,3.3),(1.1*2.2)+3.3)",1.0),
|
||||
test_t("equal($f07(1.1,2.2,3.3),(1.1*2.2)-3.3)",1.0),
|
||||
test_t("equal($f08(1.1,2.2,3.3),(1.1*2.2)/3.3)",1.0),
|
||||
test_t("equal($f09(1.1,2.2,3.3),(1.1*2.2)*3.3)",1.0),
|
||||
test_t("equal($f10(1.1,2.2,3.3),(1.1/2.2)+3.3)",1.0),
|
||||
test_t("equal($f11(1.1,2.2,3.3),(1.1/2.2)-3.3)",1.0),
|
||||
test_t("equal($f12(1.1,2.2,3.3),(1.1/2.2)/3.3)",1.0),
|
||||
test_t("equal($f13(1.1,2.2,3.3),(1.1/2.2)*3.3)",1.0),
|
||||
test_t("equal($f14(1.1,2.2,3.3),1.1/(2.2+3.3))",1.0),
|
||||
test_t("equal($f15(1.1,2.2,3.3),1.1/(2.2-3.3))",1.0),
|
||||
test_t("equal($f16(1.1,2.2,3.3),1.1/(2.2*3.3))",1.0),
|
||||
test_t("equal($f17(1.1,2.2,3.3),1.1/(2.2/3.3))",1.0),
|
||||
test_t("equal($f18(1.1,2.2,3.3),1.1*(2.2+3.3))",1.0),
|
||||
test_t("equal($f19(1.1,2.2,3.3),1.1*(2.2-3.3))",1.0),
|
||||
test_t("equal($f20(1.1,2.2,3.3),1.1*(2.2*3.3))",1.0),
|
||||
test_t("equal($f21(1.1,2.2,3.3),1.1*(2.2/3.3))",1.0),
|
||||
test_t("equal($f22(1.1,2.2,3.3),1.1-(2.2+3.3))",1.0),
|
||||
test_t("equal($f23(1.1,2.2,3.3),1.1-(2.2-3.3))",1.0),
|
||||
test_t("equal($f24(1.1,2.2,3.3),1.1-(2.2/3.3))",1.0),
|
||||
test_t("equal($f25(1.1,2.2,3.3),1.1-(2.2*3.3))",1.0),
|
||||
test_t("equal($f26(1.1,2.2,3.3),1.1+(2.2*3.3))",1.0),
|
||||
test_t("equal($f27(1.1,2.2,3.3),1.1+(2.2/3.3))",1.0),
|
||||
test_t("equal($f28(1.1,2.2,3.3),1.1+(2.2+3.3))",1.0),
|
||||
test_t("equal($f29(1.1,2.2,3.3),1.1+(2.2-3.3))",1.0),
|
||||
test_t("equal($f30(1.1,2.2,3.3),1.1*2.2^2+3.3)",1.0),
|
||||
test_t("equal($f31(1.1,2.2,3.3),1.1*2.2^3+3.3)",1.0),
|
||||
test_t("equal($f32(1.1,2.2,3.3),1.1*2.2^4+3.3)",1.0),
|
||||
test_t("equal($f33(1.1,2.2,3.3),1.1*2.2^5+3.3)",1.0),
|
||||
test_t("equal($f34(1.1,2.2,3.3),1.1*2.2^6+3.3)",1.0),
|
||||
test_t("equal($f35(1.1,2.2,3.3),1.1*2.2^7+3.3)",1.0),
|
||||
test_t("equal($f36(1.1,2.2,3.3),1.1*2.2^8+3.3)",1.0),
|
||||
test_t("equal($f37(1.1,2.2,3.3),1.1*2.2^9+3.3)",1.0),
|
||||
test_t("equal($f38(1.1,2.2,3.3),1.1*log(2.2)+3.3)",1.0),
|
||||
test_t("equal($f39(1.1,2.2,3.3),1.1*log(2.2)-3.3)",1.0),
|
||||
test_t("equal($f40(1.1,2.2,3.3),1.1*log10(2.2)+3.3)",1.0),
|
||||
test_t("equal($f41(1.1,2.2,3.3),1.1*log10(2.2)-3.3)",1.0),
|
||||
test_t("equal($f42(1.1,2.2,3.3),1.1*sin(2.2)+3.3)",1.0),
|
||||
test_t("equal($f43(1.1,2.2,3.3),1.1*sin(2.2)-3.3)",1.0),
|
||||
test_t("equal($f44(1.1,2.2,3.3),1.1*cos(2.2)+3.3)",1.0),
|
||||
test_t("equal($f45(1.1,2.2,3.3),1.1*cos(2.2)-3.3)",1.0),
|
||||
test_t("equal($f46(1.1,2.2,3.3),if(0!=1.1,2.2,3.3))",1.0),
|
||||
test_t("equal($f47(1.1,2.2,3.3,4.4),1.1+((2.2+3.3)/4.4))",1.0),
|
||||
test_t("equal($f48(1.1,2.2,3.3,4.4),1.1+((2.2+3.3)*4.4))",1.0),
|
||||
test_t("equal($f49(1.1,2.2,3.3,4.4),1.1+((2.2-3.3)/4.4))",1.0),
|
||||
test_t("equal($f50(1.1,2.2,3.3,4.4),1.1+((2.2-3.3)*4.4))",1.0),
|
||||
test_t("equal($f51(1.1,2.2,3.3,4.4),1.1+((2.2*3.3)/4.4))",1.0),
|
||||
test_t("equal($f52(1.1,2.2,3.3,4.4),1.1+((2.2*3.3)*4.4))",1.0),
|
||||
test_t("equal($f53(1.1,2.2,3.3,4.4),1.1+((2.2/3.3)+4.4))",1.0),
|
||||
test_t("equal($f54(1.1,2.2,3.3,4.4),1.1+((2.2/3.3)/4.4))",1.0),
|
||||
test_t("equal($f55(1.1,2.2,3.3,4.4),1.1+((2.2/3.3)*4.4))",1.0),
|
||||
test_t("equal($f56(1.1,2.2,3.3,4.4),1.1-((2.2+3.3)/4.4))",1.0),
|
||||
test_t("equal($f57(1.1,2.2,3.3,4.4),1.1-((2.2+3.3)*4.4))",1.0),
|
||||
test_t("equal($f58(1.1,2.2,3.3,4.4),1.1-((2.2-3.3)/4.4))",1.0),
|
||||
test_t("equal($f59(1.1,2.2,3.3,4.4),1.1-((2.2-3.3)*4.4))",1.0),
|
||||
test_t("equal($f60(1.1,2.2,3.3,4.4),1.1-((2.2*3.3)/4.4))",1.0),
|
||||
test_t("equal($f61(1.1,2.2,3.3,4.4),1.1-((2.2*3.3)*4.4))",1.0),
|
||||
test_t("equal($f62(1.1,2.2,3.3,4.4),1.1-((2.2/3.3)/4.4))",1.0),
|
||||
test_t("equal($f63(1.1,2.2,3.3,4.4),1.1-((2.2/3.3)*4.4))",1.0),
|
||||
test_t("equal($f64(1.1,2.2,3.3,4.4),((1.1+2.2)*3.3)-4.4)",1.0),
|
||||
test_t("equal($f65(1.1,2.2,3.3,4.4),((1.1-2.2)*3.3)-4.4)",1.0),
|
||||
test_t("equal($f66(1.1,2.2,3.3,4.4),((1.1*2.2)*3.3)-4.4)",1.0),
|
||||
test_t("equal($f67(1.1,2.2,3.3,4.4),((1.1/2.2)*3.3)-4.4)",1.0),
|
||||
test_t("equal($f68(1.1,2.2,3.3,4.4),((1.1+2.2)/3.3)-4.4)",1.0),
|
||||
test_t("equal($f69(1.1,2.2,3.3,4.4),((1.1-2.2)/3.3)-4.4)",1.0),
|
||||
test_t("equal($f70(1.1,2.2,3.3,4.4),((1.1*2.2)/3.3)-4.4)",1.0),
|
||||
test_t("equal($f71(1.1,2.2,3.3,4.4),((1.1/2.2)/3.3)-4.4)",1.0),
|
||||
test_t("equal($f72(1.1,2.2,3.3,4.4),(1.1*2.2)+(3.3*4.4))",1.0),
|
||||
test_t("equal($f73(1.1,2.2,3.3,4.4),(1.1*2.2)-(3.3*4.4))",1.0),
|
||||
test_t("equal($f74(1.1,2.2,3.3,4.4),(1.1*2.2)+(3.3/4.4))",1.0),
|
||||
test_t("equal($f75(1.1,2.2,3.3,4.4),(1.1*2.2)-(3.3/4.4))",1.0),
|
||||
test_t("equal($f76(1.1,2.2,3.3,4.4),(1.1/2.2)+(3.3/4.4))",1.0),
|
||||
test_t("equal($f77(1.1,2.2,3.3,4.4),(1.1/2.2)-(3.3/4.4))",1.0),
|
||||
test_t("equal($f78(1.1,2.2,3.3,4.4),(1.1/2.2)-(3.3*4.4))",1.0),
|
||||
test_t("equal($f79(1.1,2.2,3.3,4.4),1.1/(2.2+(3.3*4.4)))",1.0),
|
||||
test_t("equal($f80(1.1,2.2,3.3,4.4),1.1/(2.2-(3.3*4.4)))",1.0),
|
||||
test_t("equal($f81(1.1,2.2,3.3,4.4),1.1*(2.2+(3.3*4.4)))",1.0),
|
||||
test_t("equal($f82(1.1,2.2,3.3,4.4),1.1*(2.2-(3.3*4.4)))",1.0),
|
||||
test_t("equal($f83(1.1,2.2,3.3,4.4),1.1*2.2^2+3.3*4.4^2)",1.0),
|
||||
test_t("equal($f84(1.1,2.2,3.3,4.4),1.1*2.2^3+3.3*4.4^3)",1.0),
|
||||
test_t("equal($f85(1.1,2.2,3.3,4.4),1.1*2.2^4+3.3*4.4^4)",1.0),
|
||||
test_t("equal($f86(1.1,2.2,3.3,4.4),1.1*2.2^5+3.3*4.4^5)",1.0),
|
||||
test_t("equal($f87(1.1,2.2,3.3,4.4),1.1*2.2^6+3.3*4.4^6)",1.0),
|
||||
test_t("equal($f88(1.1,2.2,3.3,4.4),1.1*2.2^7+3.3*4.4^7)",1.0),
|
||||
test_t("equal($f89(1.1,2.2,3.3,4.4),1.1*2.2^8+3.3*4.4^8)",1.0),
|
||||
test_t("equal($f90(1.1,2.2,3.3,4.4),1.1*2.2^9+3.3*4.4^9)",1.0),
|
||||
test_t("equal($f91(1.1,2.2,3.3,4.4),if(1.1 and 2.2,3.3,4.4))",1.0),
|
||||
test_t("equal($f92(1.1,2.2,3.3,4.4),if(1.1 or 2.2,3.3,4.4))",1.0),
|
||||
test_t("equal($f93(1.1,2.2,3.3,4.4),if(1.1 < 2.2,3.3,4.4))",1.0),
|
||||
test_t("equal($f94(1.1,2.2,3.3,4.4),if(1.1 <= 2.2,3.3,4.4))",1.0),
|
||||
test_t("equal($f95(1.1,2.2,3.3,4.4),if(1.1 > 2.2,3.3,4.4))",1.0),
|
||||
test_t("equal($f96(1.1,2.2,3.3,4.4),if(1.1 >= 2.2,3.3,4.4))",1.0),
|
||||
test_t("equal($f97(1.1,2.2,3.3,4.4),if(equal(1.1,2.2),3.3,4.4))",1.0),
|
||||
test_t("equal($f98(1.1,2.2,3.3,4.4),1.1*sin(2.2)+3.3*cos(4.4))",1.0),
|
||||
test_t("equal($f04(1.1,2.2,3.3),(1.1-2.2)+3.3)",1.0),
|
||||
test_t("equal($f05(1.1,2.2,3.3),(1.1-2.2)/3.3)",1.0),
|
||||
test_t("equal($f06(1.1,2.2,3.3),(1.1-2.2)*3.3)",1.0),
|
||||
test_t("equal($f07(1.1,2.2,3.3),(1.1*2.2)+3.3)",1.0),
|
||||
test_t("equal($f08(1.1,2.2,3.3),(1.1*2.2)-3.3)",1.0),
|
||||
test_t("equal($f09(1.1,2.2,3.3),(1.1*2.2)/3.3)",1.0),
|
||||
test_t("equal($f10(1.1,2.2,3.3),(1.1*2.2)*3.3)",1.0),
|
||||
test_t("equal($f11(1.1,2.2,3.3),(1.1/2.2)+3.3)",1.0),
|
||||
test_t("equal($f12(1.1,2.2,3.3),(1.1/2.2)-3.3)",1.0),
|
||||
test_t("equal($f13(1.1,2.2,3.3),(1.1/2.2)/3.3)",1.0),
|
||||
test_t("equal($f14(1.1,2.2,3.3),(1.1/2.2)*3.3)",1.0),
|
||||
test_t("equal($f15(1.1,2.2,3.3),1.1/(2.2+3.3))",1.0),
|
||||
test_t("equal($f16(1.1,2.2,3.3),1.1/(2.2-3.3))",1.0),
|
||||
test_t("equal($f17(1.1,2.2,3.3),1.1/(2.2*3.3))",1.0),
|
||||
test_t("equal($f18(1.1,2.2,3.3),1.1/(2.2/3.3))",1.0),
|
||||
test_t("equal($f19(1.1,2.2,3.3),1.1*(2.2+3.3))",1.0),
|
||||
test_t("equal($f20(1.1,2.2,3.3),1.1*(2.2-3.3))",1.0),
|
||||
test_t("equal($f21(1.1,2.2,3.3),1.1*(2.2*3.3))",1.0),
|
||||
test_t("equal($f22(1.1,2.2,3.3),1.1*(2.2/3.3))",1.0),
|
||||
test_t("equal($f23(1.1,2.2,3.3),1.1-(2.2+3.3))",1.0),
|
||||
test_t("equal($f24(1.1,2.2,3.3),1.1-(2.2-3.3))",1.0),
|
||||
test_t("equal($f25(1.1,2.2,3.3),1.1-(2.2/3.3))",1.0),
|
||||
test_t("equal($f26(1.1,2.2,3.3),1.1-(2.2*3.3))",1.0),
|
||||
test_t("equal($f27(1.1,2.2,3.3),1.1+(2.2*3.3))",1.0),
|
||||
test_t("equal($f28(1.1,2.2,3.3),1.1+(2.2/3.3))",1.0),
|
||||
test_t("equal($f29(1.1,2.2,3.3),1.1+(2.2+3.3))",1.0),
|
||||
test_t("equal($f30(1.1,2.2,3.3),1.1+(2.2-3.3))",1.0),
|
||||
test_t("equal($f31(1.1,2.2,3.3),1.1*2.2^2+3.3)",1.0),
|
||||
test_t("equal($f32(1.1,2.2,3.3),1.1*2.2^3+3.3)",1.0),
|
||||
test_t("equal($f33(1.1,2.2,3.3),1.1*2.2^4+3.3)",1.0),
|
||||
test_t("equal($f34(1.1,2.2,3.3),1.1*2.2^5+3.3)",1.0),
|
||||
test_t("equal($f35(1.1,2.2,3.3),1.1*2.2^6+3.3)",1.0),
|
||||
test_t("equal($f36(1.1,2.2,3.3),1.1*2.2^7+3.3)",1.0),
|
||||
test_t("equal($f37(1.1,2.2,3.3),1.1*2.2^8+3.3)",1.0),
|
||||
test_t("equal($f38(1.1,2.2,3.3),1.1*2.2^9+3.3)",1.0),
|
||||
test_t("equal($f39(1.1,2.2,3.3),1.1*log(2.2)+3.3)",1.0),
|
||||
test_t("equal($f40(1.1,2.2,3.3),1.1*log(2.2)-3.3)",1.0),
|
||||
test_t("equal($f41(1.1,2.2,3.3),1.1*log10(2.2)+3.3)",1.0),
|
||||
test_t("equal($f42(1.1,2.2,3.3),1.1*log10(2.2)-3.3)",1.0),
|
||||
test_t("equal($f43(1.1,2.2,3.3),1.1*sin(2.2)+3.3)",1.0),
|
||||
test_t("equal($f44(1.1,2.2,3.3),1.1*sin(2.2)-3.3)",1.0),
|
||||
test_t("equal($f45(1.1,2.2,3.3),1.1*cos(2.2)+3.3)",1.0),
|
||||
test_t("equal($f46(1.1,2.2,3.3),1.1*cos(2.2)-3.3)",1.0),
|
||||
test_t("equal($f47(1.1,2.2,3.3),if(0!=1.1,2.2,3.3))",1.0),
|
||||
test_t("equal($f48(1.1,2.2,3.3,4.4),1.1+((2.2+3.3)/4.4))",1.0),
|
||||
test_t("equal($f49(1.1,2.2,3.3,4.4),1.1+((2.2+3.3)*4.4))",1.0),
|
||||
test_t("equal($f50(1.1,2.2,3.3,4.4),1.1+((2.2-3.3)/4.4))",1.0),
|
||||
test_t("equal($f51(1.1,2.2,3.3,4.4),1.1+((2.2-3.3)*4.4))",1.0),
|
||||
test_t("equal($f52(1.1,2.2,3.3,4.4),1.1+((2.2*3.3)/4.4))",1.0),
|
||||
test_t("equal($f53(1.1,2.2,3.3,4.4),1.1+((2.2*3.3)*4.4))",1.0),
|
||||
test_t("equal($f54(1.1,2.2,3.3,4.4),1.1+((2.2/3.3)+4.4))",1.0),
|
||||
test_t("equal($f55(1.1,2.2,3.3,4.4),1.1+((2.2/3.3)/4.4))",1.0),
|
||||
test_t("equal($f56(1.1,2.2,3.3,4.4),1.1+((2.2/3.3)*4.4))",1.0),
|
||||
test_t("equal($f57(1.1,2.2,3.3,4.4),1.1-((2.2+3.3)/4.4))",1.0),
|
||||
test_t("equal($f58(1.1,2.2,3.3,4.4),1.1-((2.2+3.3)*4.4))",1.0),
|
||||
test_t("equal($f59(1.1,2.2,3.3,4.4),1.1-((2.2-3.3)/4.4))",1.0),
|
||||
test_t("equal($f60(1.1,2.2,3.3,4.4),1.1-((2.2-3.3)*4.4))",1.0),
|
||||
test_t("equal($f61(1.1,2.2,3.3,4.4),1.1-((2.2*3.3)/4.4))",1.0),
|
||||
test_t("equal($f62(1.1,2.2,3.3,4.4),1.1-((2.2*3.3)*4.4))",1.0),
|
||||
test_t("equal($f63(1.1,2.2,3.3,4.4),1.1-((2.2/3.3)/4.4))",1.0),
|
||||
test_t("equal($f64(1.1,2.2,3.3,4.4),1.1-((2.2/3.3)*4.4))",1.0),
|
||||
test_t("equal($f65(1.1,2.2,3.3,4.4),((1.1+2.2)*3.3)-4.4)",1.0),
|
||||
test_t("equal($f66(1.1,2.2,3.3,4.4),((1.1-2.2)*3.3)-4.4)",1.0),
|
||||
test_t("equal($f67(1.1,2.2,3.3,4.4),((1.1*2.2)*3.3)-4.4)",1.0),
|
||||
test_t("equal($f68(1.1,2.2,3.3,4.4),((1.1/2.2)*3.3)-4.4)",1.0),
|
||||
test_t("equal($f69(1.1,2.2,3.3,4.4),((1.1+2.2)/3.3)-4.4)",1.0),
|
||||
test_t("equal($f70(1.1,2.2,3.3,4.4),((1.1-2.2)/3.3)-4.4)",1.0),
|
||||
test_t("equal($f71(1.1,2.2,3.3,4.4),((1.1*2.2)/3.3)-4.4)",1.0),
|
||||
test_t("equal($f72(1.1,2.2,3.3,4.4),((1.1/2.2)/3.3)-4.4)",1.0),
|
||||
test_t("equal($f73(1.1,2.2,3.3,4.4),(1.1*2.2)+(3.3*4.4))",1.0),
|
||||
test_t("equal($f74(1.1,2.2,3.3,4.4),(1.1*2.2)-(3.3*4.4))",1.0),
|
||||
test_t("equal($f75(1.1,2.2,3.3,4.4),(1.1*2.2)+(3.3/4.4))",1.0),
|
||||
test_t("equal($f76(1.1,2.2,3.3,4.4),(1.1*2.2)-(3.3/4.4))",1.0),
|
||||
test_t("equal($f77(1.1,2.2,3.3,4.4),(1.1/2.2)+(3.3/4.4))",1.0),
|
||||
test_t("equal($f78(1.1,2.2,3.3,4.4),(1.1/2.2)-(3.3/4.4))",1.0),
|
||||
test_t("equal($f79(1.1,2.2,3.3,4.4),(1.1/2.2)-(3.3*4.4))",1.0),
|
||||
test_t("equal($f80(1.1,2.2,3.3,4.4),1.1/(2.2+(3.3*4.4)))",1.0),
|
||||
test_t("equal($f81(1.1,2.2,3.3,4.4),1.1/(2.2-(3.3*4.4)))",1.0),
|
||||
test_t("equal($f82(1.1,2.2,3.3,4.4),1.1*(2.2+(3.3*4.4)))",1.0),
|
||||
test_t("equal($f83(1.1,2.2,3.3,4.4),1.1*(2.2-(3.3*4.4)))",1.0),
|
||||
test_t("equal($f84(1.1,2.2,3.3,4.4),1.1*2.2^2+3.3*4.4^2)",1.0),
|
||||
test_t("equal($f85(1.1,2.2,3.3,4.4),1.1*2.2^3+3.3*4.4^3)",1.0),
|
||||
test_t("equal($f86(1.1,2.2,3.3,4.4),1.1*2.2^4+3.3*4.4^4)",1.0),
|
||||
test_t("equal($f87(1.1,2.2,3.3,4.4),1.1*2.2^5+3.3*4.4^5)",1.0),
|
||||
test_t("equal($f88(1.1,2.2,3.3,4.4),1.1*2.2^6+3.3*4.4^6)",1.0),
|
||||
test_t("equal($f89(1.1,2.2,3.3,4.4),1.1*2.2^7+3.3*4.4^7)",1.0),
|
||||
test_t("equal($f90(1.1,2.2,3.3,4.4),1.1*2.2^8+3.3*4.4^8)",1.0),
|
||||
test_t("equal($f91(1.1,2.2,3.3,4.4),1.1*2.2^9+3.3*4.4^9)",1.0),
|
||||
test_t("equal($f92(1.1,2.2,3.3,4.4),if(1.1 and 2.2,3.3,4.4))",1.0),
|
||||
test_t("equal($f93(1.1,2.2,3.3,4.4),if(1.1 or 2.2,3.3,4.4))",1.0),
|
||||
test_t("equal($f94(1.1,2.2,3.3,4.4),if(1.1 < 2.2,3.3,4.4))",1.0),
|
||||
test_t("equal($f95(1.1,2.2,3.3,4.4),if(1.1 <= 2.2,3.3,4.4))",1.0),
|
||||
test_t("equal($f96(1.1,2.2,3.3,4.4),if(1.1 > 2.2,3.3,4.4))",1.0),
|
||||
test_t("equal($f97(1.1,2.2,3.3,4.4),if(1.1 >= 2.2,3.3,4.4))",1.0),
|
||||
test_t("equal($f98(1.1,2.2,3.3,4.4),if(equal(1.1,2.2),3.3,4.4))",1.0),
|
||||
test_t("equal($f99(1.1,2.2,3.3,4.4),1.1*sin(2.2)+3.3*cos(4.4))",1.0),
|
||||
test_t("equal((48.0/2.0*(9.0+3.0)),288.0)",1.0),
|
||||
test_t("equal((48.0/2.0(9.0+3.0)),288.0)",1.0),
|
||||
test_t("equal((6.0/2.0(1.0+2.0)),9.0)",1.0),
|
||||
@ -1300,6 +1301,54 @@ inline bool run_test01()
|
||||
test_xy<T>("equal(y^-23,1/(y*y*y*y*y*y*y*y*y*y*y*y*y*y*y*y*y*y*y*y*y*y*y))",T(0.0),T(12.34),T(1.0)),
|
||||
test_xy<T>("equal(y^-24,1/(y*y*y*y*y*y*y*y*y*y*y*y*y*y*y*y*y*y*y*y*y*y*y*y))",T(0.0),T(12.34),T(1.0)),
|
||||
test_xy<T>("equal(y^-25,1/(y*y*y*y*y*y*y*y*y*y*y*y*y*y*y*y*y*y*y*y*y*y*y*y*y))",T(0.0),T(12.34),T(1.0)),
|
||||
test_xy<T>("(2 + x) + 7",T(3.0),T(0.0),T((2.0 + 3.0) + 7.0)),
|
||||
test_xy<T>("(2 + x) - 7",T(3.0),T(0.0),T((2.0 + 3.0) - 7.0)),
|
||||
test_xy<T>("(2 - x) + 7",T(3.0),T(0.0),T((2.0 - 3.0) + 7.0)),
|
||||
test_xy<T>("(2 - x) - 7",T(3.0),T(0.0),T((2.0 - 3.0) - 7.0)),
|
||||
test_xy<T>("(2 * x) * 7",T(3.0),T(0.0),T((2.0 * 3.0) * 7.0)),
|
||||
test_xy<T>("(2 * x) / 7",T(3.0),T(0.0),T((2.0 * 3.0) / 7.0)),
|
||||
test_xy<T>("(2 / x) * 7",T(3.0),T(0.0),T((2.0 / 3.0) * 7.0)),
|
||||
test_xy<T>("(2 / x) / 7",T(3.0),T(0.0),T((2.0 / 3.0) / 7.0)),
|
||||
test_xy<T>("2 + (x + 7)",T(3.0),T(0.0),T(2.0 + (3.0 + 7.0))),
|
||||
test_xy<T>("2 + (x - 7)",T(3.0),T(0.0),T(2.0 + (3.0 - 7.0))),
|
||||
test_xy<T>("2 - (x + 7)",T(3.0),T(0.0),T(2.0 - (3.0 + 7.0))),
|
||||
test_xy<T>("2 - (x - 7)",T(3.0),T(0.0),T(2.0 - (3.0 - 7.0))),
|
||||
test_xy<T>("2 * (x * 7)",T(3.0),T(0.0),T(2.0 * (3.0 * 7.0))),
|
||||
test_xy<T>("2 * (x / 7)",T(3.0),T(0.0),T(2.0 * (3.0 / 7.0))),
|
||||
test_xy<T>("2 / (x * 7)",T(3.0),T(0.0),T(2.0 / (3.0 * 7.0))),
|
||||
test_xy<T>("2 / (x / 7)",T(3.0),T(0.0),T(2.0 / (3.0 / 7.0))),
|
||||
test_xy<T>("2 + (7 + x)",T(3.0),T(0.0),T(2.0 + (7.0 + 3.0))),
|
||||
test_xy<T>("2 + (7 - x)",T(3.0),T(0.0),T(2.0 + (7.0 - 3.0))),
|
||||
test_xy<T>("2 - (7 + x)",T(3.0),T(0.0),T(2.0 - (7.0 + 3.0))),
|
||||
test_xy<T>("2 - (7 - x)",T(3.0),T(0.0),T(2.0 - (7.0 - 3.0))),
|
||||
test_xy<T>("2 * (7 * x)",T(3.0),T(0.0),T(2.0 * (7.0 * 3.0))),
|
||||
test_xy<T>("2 * (7 / x)",T(3.0),T(0.0),T(2.0 * (7.0 / 3.0))),
|
||||
test_xy<T>("2 / (7 * x)",T(3.0),T(0.0),T(2.0 / (7.0 * 3.0))),
|
||||
test_xy<T>("2 / (7 / x)",T(3.0),T(0.0),T(2.0 / (7.0 / 3.0))),
|
||||
test_xy<T>("(x + 2) + 7",T(3.0),T(0.0),T((3.0 + 2.0) + 7.0)),
|
||||
test_xy<T>("(x + 2) - 7",T(3.0),T(0.0),T((3.0 + 2.0) - 7.0)),
|
||||
test_xy<T>("(x - 2) + 7",T(3.0),T(0.0),T((3.0 - 2.0) + 7.0)),
|
||||
test_xy<T>("(x - 2) - 7",T(3.0),T(0.0),T((3.0 - 2.0) - 7.0)),
|
||||
test_xy<T>("(x * 2) * 7",T(3.0),T(0.0),T((3.0 * 2.0) * 7.0)),
|
||||
test_xy<T>("(x * 2) / 7",T(3.0),T(0.0),T((3.0 * 2.0) / 7.0)),
|
||||
test_xy<T>("(x / 2) * 7",T(3.0),T(0.0),T((3.0 / 2.0) * 7.0)),
|
||||
test_xy<T>("(x / 2) / 7",T(3.0),T(0.0),T((3.0 / 2.0) / 7.0)),
|
||||
test_xy<T>("((2 + x) + (3 + y))",T(7.0),T(9.0),T(((2.0 + 7.0) + (3.0 + 9.0)))),
|
||||
test_xy<T>("((2 + x) - (3 + y))",T(7.0),T(9.0),T(((2.0 + 7.0) - (3.0 + 9.0)))),
|
||||
test_xy<T>("((2 - x) - (3 - y))",T(7.0),T(9.0),T(((2.0 - 7.0) - (3.0 - 9.0)))),
|
||||
test_xy<T>("((2 * x) * (3 * y))",T(7.0),T(9.0),T(((2.0 * 7.0) * (3.0 * 9.0)))),
|
||||
test_xy<T>("((x + 2) + (y + 3))",T(7.0),T(9.0),T(((7.0 + 2.0) + (9.0 + 3.0)))),
|
||||
test_xy<T>("((x + 2) - (y + 3))",T(7.0),T(9.0),T(((7.0 + 2.0) - (9.0 + 3.0)))),
|
||||
test_xy<T>("((x - 2) - (y - 3))",T(7.0),T(9.0),T(((7.0 - 2.0) - (9.0 - 3.0)))),
|
||||
test_xy<T>("((2 * x) * (3 * y))",T(7.0),T(9.0),T(((2.0 * 7.0) * (3.0 * 9.0)))),
|
||||
test_xy<T>("((2 + x) + (y + 3))",T(7.0),T(9.0),T(((2.0 + 7.0) + (9.0 + 3.0)))),
|
||||
test_xy<T>("((2 + x) - (y + 3))",T(7.0),T(9.0),T(((2.0 + 7.0) - (9.0 + 3.0)))),
|
||||
test_xy<T>("((2 - x) - (y - 3))",T(7.0),T(9.0),T(((2.0 - 7.0) - (9.0 - 3.0)))),
|
||||
test_xy<T>("((2 * x) * (3 * y))",T(7.0),T(9.0),T(((2.0 * 7.0) * (3.0 * 9.0)))),
|
||||
test_xy<T>("((x + 2) + (3 + y))",T(7.0),T(9.0),T(((7.0 + 2.0) + (3.0 + 9.0)))),
|
||||
test_xy<T>("((x + 2) - (3 + y))",T(7.0),T(9.0),T(((7.0 + 2.0) - (3.0 + 9.0)))),
|
||||
test_xy<T>("((x - 2) - (3 - y))",T(7.0),T(9.0),T(((7.0 - 2.0) - (3.0 - 9.0)))),
|
||||
test_xy<T>("((2 * x) * (3 * y))",T(7.0),T(9.0),T(((2.0 * 7.0) * (3.0 * 9.0)))),
|
||||
test_xy<T>("0 * (abs (x) + acos (y) + asin (x) + atan (y))",T(1.0),T(1.0),T(0.0)),
|
||||
test_xy<T>("0 * (ceil (x) + cos (y) + cosh (x) + exp (y))",T(1.0),T(1.0),T(0.0)),
|
||||
test_xy<T>("0 * (floor(x) + log (y) + log10(x) + round(y))",T(1.0),T(1.0),T(0.0)),
|
||||
@ -1331,6 +1380,7 @@ inline bool run_test01()
|
||||
|
||||
for (std::size_t r = 0; r < rounds; ++r)
|
||||
{
|
||||
bool loop_result = true;
|
||||
for (std::size_t i = 0; i < test_list_size; ++i)
|
||||
{
|
||||
test_xy<T>& test = const_cast<test_xy<T>&>(test_list[i]);
|
||||
@ -1349,7 +1399,8 @@ inline bool run_test01()
|
||||
printf("run_test01() - Error: %s Expression: %s\n",
|
||||
parser.error().c_str(),
|
||||
test.expr.c_str());
|
||||
return false;
|
||||
loop_result = false;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1361,9 +1412,14 @@ inline bool run_test01()
|
||||
test.expr.c_str(),
|
||||
test.result,
|
||||
result);
|
||||
return false;
|
||||
loop_result = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!loop_result)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -2073,101 +2129,102 @@ inline bool run_test08()
|
||||
"equal($f01(x,y,z),(x+y)*z)",
|
||||
"equal($f02(x,y,z),(x+y)-z)",
|
||||
"equal($f03(x,y,z),(x+y)+z)",
|
||||
"equal($f04(x,y,z),(x-y)/z)",
|
||||
"equal($f05(x,y,z),(x-y)*z)",
|
||||
"equal($f06(x,y,z),(x*y)+z)",
|
||||
"equal($f07(x,y,z),(x*y)-z)",
|
||||
"equal($f08(x,y,z),(x*y)/z)",
|
||||
"equal($f09(x,y,z),(x*y)*z)",
|
||||
"equal($f10(x,y,z),(x/y)+z)",
|
||||
"equal($f11(x,y,z),(x/y)-z)",
|
||||
"equal($f12(x,y,z),(x/y)/z)",
|
||||
"equal($f13(x,y,z),(x/y)*z)",
|
||||
"equal($f14(x,y,z),x/(y+z))",
|
||||
"equal($f15(x,y,z),x/(y-z))",
|
||||
"equal($f16(x,y,z),x/(y*z))",
|
||||
"equal($f17(x,y,z),x/(y/z))",
|
||||
"equal($f18(x,y,z),x*(y+z))",
|
||||
"equal($f19(x,y,z),x*(y-z))",
|
||||
"equal($f20(x,y,z),x*(y*z))",
|
||||
"equal($f21(x,y,z),x*(y/z))",
|
||||
"equal($f22(x,y,z),x-(y+z))",
|
||||
"equal($f23(x,y,z),x-(y-z))",
|
||||
"equal($f24(x,y,z),x-(y/z))",
|
||||
"equal($f25(x,y,z),x-(y*z))",
|
||||
"equal($f26(x,y,z),x+(y*z))",
|
||||
"equal($f27(x,y,z),x+(y/z))",
|
||||
"equal($f28(x,y,z),x+(y+z))",
|
||||
"equal($f29(x,y,z),x+(y-z))",
|
||||
"equal($f30(x,y,z),x*y^2+z)",
|
||||
"equal($f31(x,y,z),x*y^3+z)",
|
||||
"equal($f32(x,y,z),x*y^4+z)",
|
||||
"equal($f33(x,y,z),x*y^5+z)",
|
||||
"equal($f34(x,y,z),x*y^6+z)",
|
||||
"equal($f35(x,y,z),x*y^7+z)",
|
||||
"equal($f36(x,y,z),x*y^8+z)",
|
||||
"equal($f37(x,y,z),x*y^9+z)",
|
||||
"equal($f38(x,y,z),x*log(y)+z)",
|
||||
"equal($f39(x,y,z),x*log(y)-z)",
|
||||
"equal($f40(x,y,z),x*log10(y)+z)",
|
||||
"equal($f41(x,y,z),x*log10(y)-z)",
|
||||
"equal($f42(x,y,z),x*sin(y)+z)",
|
||||
"equal($f43(x,y,z),x*sin(y)-z)",
|
||||
"equal($f44(x,y,z),x*cos(y)+z)",
|
||||
"equal($f45(x,y,z),x*cos(y)-z)",
|
||||
"equal($f46(x,y,z),if(0!=x,y,z))",
|
||||
"equal($f47(x,y,z,w),x+((y+z)/w))",
|
||||
"equal($f48(x,y,z,w),x+((y+z)*w))",
|
||||
"equal($f49(x,y,z,w),x+((y-z)/w))",
|
||||
"equal($f50(x,y,z,w),x+((y-z)*w))",
|
||||
"equal($f51(x,y,z,w),x+((y*z)/w))",
|
||||
"equal($f52(x,y,z,w),x+((y*z)*w))",
|
||||
"equal($f53(x,y,z,w),x+((y/z)+w))",
|
||||
"equal($f54(x,y,z,w),x+((y/z)/w))",
|
||||
"equal($f55(x,y,z,w),x+((y/z)*w))",
|
||||
"equal($f56(x,y,z,w),x-((y+z)/w))",
|
||||
"equal($f57(x,y,z,w),x-((y+z)*w))",
|
||||
"equal($f58(x,y,z,w),x-((y-z)/w))",
|
||||
"equal($f59(x,y,z,w),x-((y-z)*w))",
|
||||
"equal($f60(x,y,z,w),x-((y*z)/w))",
|
||||
"equal($f61(x,y,z,w),x-((y*z)*w))",
|
||||
"equal($f62(x,y,z,w),x-((y/z)/w))",
|
||||
"equal($f63(x,y,z,w),x-((y/z)*w))",
|
||||
"equal($f64(x,y,z,w),((x+y)*z)-w)",
|
||||
"equal($f65(x,y,z,w),((x-y)*z)-w)",
|
||||
"equal($f66(x,y,z,w),((x*y)*z)-w)",
|
||||
"equal($f67(x,y,z,w),((x/y)*z)-w)",
|
||||
"equal($f68(x,y,z,w),((x+y)/z)-w)",
|
||||
"equal($f69(x,y,z,w),((x-y)/z)-w)",
|
||||
"equal($f70(x,y,z,w),((x*y)/z)-w)",
|
||||
"equal($f71(x,y,z,w),((x/y)/z)-w)",
|
||||
"equal($f72(x,y,z,w),(x*y)+(z*w))",
|
||||
"equal($f73(x,y,z,w),(x*y)-(z*w))",
|
||||
"equal($f74(x,y,z,w),(x*y)+(z/w))",
|
||||
"equal($f75(x,y,z,w),(x*y)-(z/w))",
|
||||
"equal($f76(x,y,z,w),(x/y)+(z/w))",
|
||||
"equal($f77(x,y,z,w),(x/y)-(z/w))",
|
||||
"equal($f78(x,y,z,w),(x/y)-(z*w))",
|
||||
"equal($f79(x,y,z,w),x/(y+(z*w)))",
|
||||
"equal($f80(x,y,z,w),x/(y-(z*w)))",
|
||||
"equal($f81(x,y,z,w),x*(y+(z*w)))",
|
||||
"equal($f82(x,y,z,w),x*(y-(z*w)))",
|
||||
"equal($f83(x,y,z,w),x*y^2+z*w^2)",
|
||||
"equal($f84(x,y,z,w),x*y^3+z*w^3)",
|
||||
"equal($f85(x,y,z,w),x*y^4+z*w^4)",
|
||||
"equal($f86(x,y,z,w),x*y^5+z*w^5)",
|
||||
"equal($f87(x,y,z,w),x*y^6+z*w^6)",
|
||||
"equal($f88(x,y,z,w),x*y^7+z*w^7)",
|
||||
"equal($f89(x,y,z,w),x*y^8+z*w^8)",
|
||||
"equal($f90(x,y,z,w),x*y^9+z*w^9)",
|
||||
"equal($f91(x,y,z,w),if(x and y,z,w))",
|
||||
"equal($f92(x,y,z,w),if(x or y,z,w))",
|
||||
"equal($f93(x,y,z,w),if(x < y,z,w))",
|
||||
"equal($f94(x,y,z,w),if(x <= y,z,w))",
|
||||
"equal($f95(x,y,z,w),if(x > y,z,w))",
|
||||
"equal($f96(x,y,z,w),if(x >= y,z,w))",
|
||||
"equal($f97(x,y,z,w),if(equal(x,y),z,w))",
|
||||
"equal($f98(x,y,z,w),x*sin(y)+z*cos(w))"
|
||||
"equal($f04(x,y,z),(x-y)+z)",
|
||||
"equal($f05(x,y,z),(x-y)/z)",
|
||||
"equal($f06(x,y,z),(x-y)*z)",
|
||||
"equal($f07(x,y,z),(x*y)+z)",
|
||||
"equal($f08(x,y,z),(x*y)-z)",
|
||||
"equal($f09(x,y,z),(x*y)/z)",
|
||||
"equal($f10(x,y,z),(x*y)*z)",
|
||||
"equal($f11(x,y,z),(x/y)+z)",
|
||||
"equal($f12(x,y,z),(x/y)-z)",
|
||||
"equal($f13(x,y,z),(x/y)/z)",
|
||||
"equal($f14(x,y,z),(x/y)*z)",
|
||||
"equal($f15(x,y,z),x/(y+z))",
|
||||
"equal($f16(x,y,z),x/(y-z))",
|
||||
"equal($f17(x,y,z),x/(y*z))",
|
||||
"equal($f18(x,y,z),x/(y/z))",
|
||||
"equal($f19(x,y,z),x*(y+z))",
|
||||
"equal($f20(x,y,z),x*(y-z))",
|
||||
"equal($f21(x,y,z),x*(y*z))",
|
||||
"equal($f22(x,y,z),x*(y/z))",
|
||||
"equal($f23(x,y,z),x-(y+z))",
|
||||
"equal($f24(x,y,z),x-(y-z))",
|
||||
"equal($f25(x,y,z),x-(y/z))",
|
||||
"equal($f26(x,y,z),x-(y*z))",
|
||||
"equal($f27(x,y,z),x+(y*z))",
|
||||
"equal($f28(x,y,z),x+(y/z))",
|
||||
"equal($f29(x,y,z),x+(y+z))",
|
||||
"equal($f30(x,y,z),x+(y-z))",
|
||||
"equal($f31(x,y,z),x*y^2+z)",
|
||||
"equal($f32(x,y,z),x*y^3+z)",
|
||||
"equal($f33(x,y,z),x*y^4+z)",
|
||||
"equal($f34(x,y,z),x*y^5+z)",
|
||||
"equal($f35(x,y,z),x*y^6+z)",
|
||||
"equal($f36(x,y,z),x*y^7+z)",
|
||||
"equal($f37(x,y,z),x*y^8+z)",
|
||||
"equal($f38(x,y,z),x*y^9+z)",
|
||||
"equal($f39(x,y,z),x*log(y)+z)",
|
||||
"equal($f40(x,y,z),x*log(y)-z)",
|
||||
"equal($f41(x,y,z),x*log10(y)+z)",
|
||||
"equal($f42(x,y,z),x*log10(y)-z)",
|
||||
"equal($f43(x,y,z),x*sin(y)+z)",
|
||||
"equal($f44(x,y,z),x*sin(y)-z)",
|
||||
"equal($f45(x,y,z),x*cos(y)+z)",
|
||||
"equal($f46(x,y,z),x*cos(y)-z)",
|
||||
"equal($f47(x,y,z),if(0!=x,y,z))",
|
||||
"equal($f48(x,y,z,w),x+((y+z)/w))",
|
||||
"equal($f49(x,y,z,w),x+((y+z)*w))",
|
||||
"equal($f50(x,y,z,w),x+((y-z)/w))",
|
||||
"equal($f51(x,y,z,w),x+((y-z)*w))",
|
||||
"equal($f52(x,y,z,w),x+((y*z)/w))",
|
||||
"equal($f53(x,y,z,w),x+((y*z)*w))",
|
||||
"equal($f54(x,y,z,w),x+((y/z)+w))",
|
||||
"equal($f55(x,y,z,w),x+((y/z)/w))",
|
||||
"equal($f56(x,y,z,w),x+((y/z)*w))",
|
||||
"equal($f57(x,y,z,w),x-((y+z)/w))",
|
||||
"equal($f58(x,y,z,w),x-((y+z)*w))",
|
||||
"equal($f59(x,y,z,w),x-((y-z)/w))",
|
||||
"equal($f60(x,y,z,w),x-((y-z)*w))",
|
||||
"equal($f61(x,y,z,w),x-((y*z)/w))",
|
||||
"equal($f62(x,y,z,w),x-((y*z)*w))",
|
||||
"equal($f63(x,y,z,w),x-((y/z)/w))",
|
||||
"equal($f64(x,y,z,w),x-((y/z)*w))",
|
||||
"equal($f65(x,y,z,w),((x+y)*z)-w)",
|
||||
"equal($f66(x,y,z,w),((x-y)*z)-w)",
|
||||
"equal($f67(x,y,z,w),((x*y)*z)-w)",
|
||||
"equal($f68(x,y,z,w),((x/y)*z)-w)",
|
||||
"equal($f69(x,y,z,w),((x+y)/z)-w)",
|
||||
"equal($f70(x,y,z,w),((x-y)/z)-w)",
|
||||
"equal($f71(x,y,z,w),((x*y)/z)-w)",
|
||||
"equal($f72(x,y,z,w),((x/y)/z)-w)",
|
||||
"equal($f73(x,y,z,w),(x*y)+(z*w))",
|
||||
"equal($f74(x,y,z,w),(x*y)-(z*w))",
|
||||
"equal($f75(x,y,z,w),(x*y)+(z/w))",
|
||||
"equal($f76(x,y,z,w),(x*y)-(z/w))",
|
||||
"equal($f77(x,y,z,w),(x/y)+(z/w))",
|
||||
"equal($f78(x,y,z,w),(x/y)-(z/w))",
|
||||
"equal($f79(x,y,z,w),(x/y)-(z*w))",
|
||||
"equal($f80(x,y,z,w),x/(y+(z*w)))",
|
||||
"equal($f81(x,y,z,w),x/(y-(z*w)))",
|
||||
"equal($f82(x,y,z,w),x*(y+(z*w)))",
|
||||
"equal($f83(x,y,z,w),x*(y-(z*w)))",
|
||||
"equal($f84(x,y,z,w),x*y^2+z*w^2)",
|
||||
"equal($f85(x,y,z,w),x*y^3+z*w^3)",
|
||||
"equal($f86(x,y,z,w),x*y^4+z*w^4)",
|
||||
"equal($f87(x,y,z,w),x*y^5+z*w^5)",
|
||||
"equal($f88(x,y,z,w),x*y^6+z*w^6)",
|
||||
"equal($f89(x,y,z,w),x*y^7+z*w^7)",
|
||||
"equal($f90(x,y,z,w),x*y^8+z*w^8)",
|
||||
"equal($f91(x,y,z,w),x*y^9+z*w^9)",
|
||||
"equal($f92(x,y,z,w),if(x and y,z,w))",
|
||||
"equal($f93(x,y,z,w),if(x or y,z,w))",
|
||||
"equal($f94(x,y,z,w),if(x < y,z,w))",
|
||||
"equal($f95(x,y,z,w),if(x <= y,z,w))",
|
||||
"equal($f96(x,y,z,w),if(x > y,z,w))",
|
||||
"equal($f97(x,y,z,w),if(x >= y,z,w))",
|
||||
"equal($f98(x,y,z,w),if(equal(x,y),z,w))",
|
||||
"equal($f99(x,y,z,w),x*sin(y)+z*cos(w))"
|
||||
};
|
||||
static const std::size_t expr_str_size = sizeof(expr_str) / sizeof(std::string);
|
||||
|
||||
|
Reference in New Issue
Block a user